Commit c945af87 by liuyang

2024/03/06 物料清单删除同步删除附件

parent e0a6d4d9
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-03-06 16:14:16 Generate time : 2024-03-06 16:14:16
Version : 1.0 Version : 1.0
schema : hpjx schema : hpjx
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
<isNotEmpty prepend=" AND " property="docId"> <isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId# DOC_ID = #docId#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="docIds">
DOC_ID in $docIds$
</isNotEmpty>
<isNotEmpty prepend=" AND " property="dirId"> <isNotEmpty prepend=" AND " property="dirId">
DIR_ID = #dirId# DIR_ID = #dirId#
</isNotEmpty> </isNotEmpty>
...@@ -177,8 +180,13 @@ ...@@ -177,8 +180,13 @@
<delete id="delete"> <delete id="delete">
DELETE FROM ${hpjxSchema}.TEUDM_TEMP WHERE DELETE FROM ${hpjxSchema}.TEUDM_TEMP WHERE
COMPANY_CODE = #companyCode# AND COMPANY_CODE = #companyCode#
<isNotEmpty prepend=" AND " property="docId">
DOC_ID = #docId# DOC_ID = #docId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="docIds">
DOC_ID in $docIds$
</isNotEmpty>
</delete> </delete>
<update id="update"> <update id="update">
...@@ -202,30 +210,4 @@ ...@@ -202,30 +210,4 @@
DOC_ID = #docId# DOC_ID = #docId#
</update> </update>
<!--批量删除-->
<delete id="deleteByBatch">
DELETE FROM hpjx.TEUDM_TEMP WHERE DOC_ID in $docId$
</delete>
<!--查询物料清单文件ID-->
<select id="queryByDocId" parameterMap="java.util.HashMap" resultClass="java.util.HashMap">
select
DOC_ID as "docId", <!-- 文件标识 -->
DIR_ID as "dirId", <!-- 目录标识 -->
DOC_NAME as "docName", <!-- 文件名 -->
CHG_NAME as "chgName", <!-- 物理文件名 -->
DOC_SIZE as "docSize", <!-- 文件大小 -->
DOC_TAG as "docTag", <!-- 文件标签 -->
REC_CREATOR as "recCreator", <!-- 记录创建者 -->
REC_CREATE_TIME as "recCreateTime", <!-- 记录创建时间 -->
REC_REVISOR as "recRevisor", <!-- 记录修改者 -->
REC_REVISE_TIME as "recReviseTime", <!-- 记录修改时间 -->
ARCHIVE_FLAG as "archiveFlag", <!-- 同步标记 -->
REAL_PATH as "realPath" <!-- 物理路径 -->
from
HPJX.TEUDM_TEMP
where
DOC_ID in $docId$
</select>
</sqlMap> </sqlMap>
...@@ -4,6 +4,7 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; ...@@ -4,6 +4,7 @@ import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002; import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.kc.tools.HPKCTools; import com.baosight.hpjx.hp.kc.tools.HPKCTools;
...@@ -472,6 +473,9 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -472,6 +473,9 @@ public class ServiceHPSC002 extends ServiceBase {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPSC002 fSc002 = new HPSC002(); HPSC002 fSc002 = new HPSC002();
fSc002.fromMap(resultRow); fSc002.fromMap(resultRow);
// 删除附件文件
delectDoc(fSc002.getId());
DaoUtils.update("HPSC002.delete", fSc002); DaoUtils.update("HPSC002.delete", fSc002);
// 修改父级节点状态是叶子节点或非叶子节点 // 修改父级节点状态是叶子节点或非叶子节点
this.checkTreeNodeLeaf(fSc002.getParentId()); this.checkTreeNodeLeaf(fSc002.getParentId());
...@@ -482,8 +486,6 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -482,8 +486,6 @@ public class ServiceHPSC002 extends ServiceBase {
HPSCTools.HpSc004.deleteByMat(fSc002.getId()); HPSCTools.HpSc004.deleteByMat(fSc002.getId());
// 同步删除生产订单 // 同步删除生产订单
HPSCTools.HpSc005.deleteByMat(fSc002.getId()); HPSCTools.HpSc005.deleteByMat(fSc002.getId());
// 删除附件文件
delectDoc(fSc002.getId());
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -747,13 +749,16 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -747,13 +749,16 @@ public class ServiceHPSC002 extends ServiceBase {
@OperationLogAnnotation(operModul = "物料清单",operType = "删除",operDesc = "删除附件文件") @OperationLogAnnotation(operModul = "物料清单",operType = "删除",operDesc = "删除附件文件")
public void delectDoc(Long id){ public void delectDoc(Long id){
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("docId","(select DOC_ID from HPJX.T_HPSC002A\n" + String companyCode = UserSessionUtils.getCompanyCode();
" where MAT_ID in( select distinct ID from HPJX.T_HPSC002 where ID = '"+id+"' or PARENT_ID = '"+id+"')"); map.put("docIds","(select DOC_ID from HPJX.T_HPSC002A where MAT_ID in(" +
" select distinct ID from HPJX.T_HPSC002 where COMPANY_CODE = '"+companyCode+"' and (ID = '"+id+"' or PARENT_ID = '"+id+"')))");
List<HPDS002> list = this.dao.query("HPDS002.queryByDocId",map); List<HPDS002> list = this.dao.query("HPDS002.query",map);
if (list.size() > 0) {
for (HPDS002 hpds002: list) { for (HPDS002 hpds002: list) {
FileUtils.deleteFile(hpds002.getRealPath()); String realPath = hpds002.getRealPath();
FileUtils.deleteFile(realPath);
}
this.dao.delete(HPDS002.DELETE,map);
} }
this.dao.delete(HPDS002.DELETE_BATCH,map);
} }
} }
...@@ -134,8 +134,12 @@ public class ServiceHPSC002A extends ServiceEPBase { ...@@ -134,8 +134,12 @@ public class ServiceHPSC002A extends ServiceEPBase {
public void delectDoc(String docId){ public void delectDoc(String docId){
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("docId",docId); map.put("docId",docId);
List<Map> list = this.dao.query(HPDS002.QUERY,map); List<HPDS002> list = this.dao.query(HPDS002.QUERY,map);
FileUtils.deleteFile(list.get(0).get(HPDS002.FIELD_REAL_PATH).toString()); if (list.size() > 0) {
String realPath = list.get(0).getRealPath();
FileUtils.deleteFile(realPath);
this.dao.delete(HPDS002.DELETE,map); this.dao.delete(HPDS002.DELETE,map);
} }
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment