|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxItpProjectNodesService;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxProjectDeviceNumberService;
|
|
|
+import com.rongwei.bscommon.sys.utils.CxConstants;
|
|
|
import com.rongwei.bsentity.domain.ZhcxItpProjectNodesDo;
|
|
|
import com.rongwei.bsentity.domain.ZhcxItpTemplateNodesDo;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxItpTemplateNodesDao;
|
|
@@ -45,6 +46,7 @@ public class ZhcxItpTemplateNodesServiceImpl extends ServiceImpl<ZhcxItpTemplate
|
|
|
&& zhcxItpTemplateNodeSyncProjectVo.getProjectids() != null && zhcxItpTemplateNodeSyncProjectVo.getProjectids().size()>0){
|
|
|
// 待保存的项目ITP节点
|
|
|
List<ZhcxItpProjectNodesDo> toSaveNodes = new ArrayList<>();
|
|
|
+ List<ZhcxItpProjectNodesDo> toUpdateNodes = new ArrayList<>();
|
|
|
// 模板节点ID和项目节点ID的映射关系
|
|
|
Map<String,String> tempProMap = new HashMap<>();
|
|
|
// 获取当前报验点
|
|
@@ -82,6 +84,7 @@ public class ZhcxItpTemplateNodesServiceImpl extends ServiceImpl<ZhcxItpTemplate
|
|
|
eq(ZhcxItpProjectNodesDo::getProjectid, projectid).in(ZhcxItpProjectNodesDo::getItpnodeid, nodeids));
|
|
|
for (ZhcxItpTemplateNodesDo nodess : templateNodess) {
|
|
|
List<ZhcxItpProjectNodesDo> hasProNodes = projectNodesDos.stream().filter(v -> v.getItpnodeid().equals(nodess.getId())).collect(Collectors.toList());
|
|
|
+ // 不存在直接新增
|
|
|
if(hasProNodes == null && hasProNodes.size() == 0){
|
|
|
// 相关属性复制
|
|
|
ZhcxItpProjectNodesDo zhcxItpProjectNodesDo = new ZhcxItpProjectNodesDo();
|
|
@@ -100,6 +103,29 @@ public class ZhcxItpTemplateNodesServiceImpl extends ServiceImpl<ZhcxItpTemplate
|
|
|
// 映射关系建立
|
|
|
tempProMap.put(nodess.getId(),zhcxItpProjectNodesDo.getId());
|
|
|
}
|
|
|
+ // 存在则更新
|
|
|
+ else{
|
|
|
+ ZhcxItpProjectNodesDo itpProjectNodesDo = hasProNodes.get(0);
|
|
|
+ ZhcxItpProjectNodesDo toUpdateNode = new ZhcxItpProjectNodesDo();
|
|
|
+ toUpdateNode.setId(itpProjectNodesDo.getId());
|
|
|
+ // 报验点更新
|
|
|
+ if(CxConstants.ITP_NODETYPE_CHECKPOINT.equals(nodess.getNodetype())){
|
|
|
+ toUpdateNode.setIsneedout(nodess.getIsneedout());
|
|
|
+ toUpdateNode.setInspectiontype(nodess.getInspectiontype());
|
|
|
+ toUpdateNode.setIssupp(nodess.getIssupp());
|
|
|
+ toUpdateNode.setChecktmpid(nodess.getChecktmpid());
|
|
|
+ toUpdateNode.setCheckrole(nodess.getCheckrole());
|
|
|
+ toUpdateNode.setCheckroleid(nodess.getCheckroleid());
|
|
|
+ toUpdateNode.setOrgid(nodess.getOrgid());
|
|
|
+ toUpdateNode.setOrgname(nodess.getOrgname());
|
|
|
+ toUpdateNode.setCheckfile(nodess.getCheckfile());
|
|
|
+ toUpdateNode.setNodename(nodess.getNodename());
|
|
|
+ }else{
|
|
|
+ // 阶段和构建更新
|
|
|
+ toUpdateNode.setNodename(nodess.getNodename());
|
|
|
+ }
|
|
|
+ toUpdateNodes.add(toUpdateNode);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 项目节点相关ID替换
|
|
@@ -139,6 +165,10 @@ public class ZhcxItpTemplateNodesServiceImpl extends ServiceImpl<ZhcxItpTemplate
|
|
|
if(toSaveNodes != null && toSaveNodes.size()>0){
|
|
|
zhcxItpProjectNodesService.saveBatch(toSaveNodes);
|
|
|
}
|
|
|
+ // 数据更新
|
|
|
+ if(toUpdateNodes != null && toUpdateNodes.size()>0){
|
|
|
+ zhcxItpProjectNodesService.updateBatchById(toUpdateNodes);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|