|
@@ -403,6 +403,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
//获取当前项目下所有合同段信息
|
|
//获取当前项目下所有合同段信息
|
|
List<ContractInfo> contractInfos = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().select(ContractInfo::getId, ContractInfo::getContractType).eq(ContractInfo::getPId, projectId));
|
|
List<ContractInfo> contractInfos = contractInfoMapper.selectList(Wrappers.<ContractInfo>query().lambda().select(ContractInfo::getId, ContractInfo::getContractType).eq(ContractInfo::getPId, projectId));
|
|
List<Long> contractInfosIds = contractInfos.stream().filter(f -> 1 == f.getContractType()).map(ContractInfo::getId).collect(Collectors.toList());
|
|
List<Long> contractInfosIds = contractInfos.stream().filter(f -> 1 == f.getContractType()).map(ContractInfo::getId).collect(Collectors.toList());
|
|
|
|
+
|
|
Map<Long, WbsTreePrivate> maps = wbsTreePrivatesAll.stream().collect(Collectors.toMap(WbsTreePrivate::getId, wbsTreePrivate -> wbsTreePrivate, (obj1, obj2) -> obj1));
|
|
Map<Long, WbsTreePrivate> maps = wbsTreePrivatesAll.stream().collect(Collectors.toMap(WbsTreePrivate::getId, wbsTreePrivate -> wbsTreePrivate, (obj1, obj2) -> obj1));
|
|
|
|
|
|
for (WbsTree wbsTree : wbsTreeListAll) {
|
|
for (WbsTree wbsTree : wbsTreeListAll) {
|
|
@@ -437,7 +438,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
//获取当前项目下所有合同段下的复制、新增节点
|
|
//获取当前项目下所有合同段下的复制、新增节点
|
|
String sql = "select id,old_id,project_id,contract_id from m_wbs_tree_contract where old_id is not null and project_id = " + projectId + " and contract_id in(" + org.apache.commons.lang.StringUtils.join(contractInfosIds, ",") + ") and wbs_type = " + wbsType + " and type = 1 and status = 1 and is_deleted = 0 and old_id is not null";
|
|
String sql = "select id,old_id,project_id,contract_id from m_wbs_tree_contract where old_id is not null and project_id = " + projectId + " and contract_id in(" + org.apache.commons.lang.StringUtils.join(contractInfosIds, ",") + ") and wbs_type = " + wbsType + " and type = 1 and status = 1 and is_deleted = 0 and old_id is not null";
|
|
List<WbsTreeContract> wbsTreeContractsCopyOrAddAll = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<WbsTreeContract> wbsTreeContractsCopyOrAddAll = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
- Map<String, List<WbsTreeContract>> copyAddNodes = wbsTreeContractsCopyOrAddAll.stream().collect(Collectors.groupingBy(WbsTreeContract::getOldId));
|
|
|
|
|
|
+ Map<String, List<WbsTreeContract>> copyAddNodes = wbsTreeContractsCopyOrAddAll.stream().filter(f -> Objects.nonNull(f.getOldId())).collect(Collectors.groupingBy(WbsTreeContract::getOldId));
|
|
List<WbsTreeContract> listContractAdd = new ArrayList<>();
|
|
List<WbsTreeContract> listContractAdd = new ArrayList<>();
|
|
for (WbsTreeContract obj1 : listContract) {
|
|
for (WbsTreeContract obj1 : listContract) {
|
|
List<WbsTreeContract> copyAddNodesNow = copyAddNodes.get(obj1.getId().toString());
|
|
List<WbsTreeContract> copyAddNodesNow = copyAddNodes.get(obj1.getId().toString());
|
|
@@ -521,7 +522,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
//获取当前项目下所有合同段下的复制、新增节点
|
|
//获取当前项目下所有合同段下的复制、新增节点
|
|
String sql = "select id,old_id,project_id,contract_id from m_wbs_tree_contract where old_id is not null and project_id = " + projectId + " and contract_id in(" + org.apache.commons.lang.StringUtils.join(contractInfosIds, ",") + ") and wbs_type = " + wbsType + " and type = 1 and status = 1 and is_deleted = 0 and old_id is not null";
|
|
String sql = "select id,old_id,project_id,contract_id from m_wbs_tree_contract where old_id is not null and project_id = " + projectId + " and contract_id in(" + org.apache.commons.lang.StringUtils.join(contractInfosIds, ",") + ") and wbs_type = " + wbsType + " and type = 1 and status = 1 and is_deleted = 0 and old_id is not null";
|
|
List<WbsTreeContract> wbsTreeContractsCopyOrAddAll = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
List<WbsTreeContract> wbsTreeContractsCopyOrAddAll = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
- Map<String, List<WbsTreeContract>> copyAddNodes = wbsTreeContractsCopyOrAddAll.stream().collect(Collectors.groupingBy(WbsTreeContract::getOldId));
|
|
|
|
|
|
+ Map<String, List<WbsTreeContract>> copyAddNodes = wbsTreeContractsCopyOrAddAll.stream().filter(f -> Objects.nonNull(f.getOldId())).collect(Collectors.groupingBy(WbsTreeContract::getOldId));
|
|
List<WbsTreeContract> listContractAdd = new ArrayList<>();
|
|
List<WbsTreeContract> listContractAdd = new ArrayList<>();
|
|
for (WbsTreeContract obj1 : listContract) {
|
|
for (WbsTreeContract obj1 : listContract) {
|
|
List<WbsTreeContract> copyAddNodesNow = copyAddNodes.get(obj1.getId().toString());
|
|
List<WbsTreeContract> copyAddNodesNow = copyAddNodes.get(obj1.getId().toString());
|
|
@@ -727,10 +728,10 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
//TODO ---------公有引用同步---------
|
|
//TODO ---------公有引用同步---------
|
|
//获取对应公有树节点
|
|
//获取对应公有树节点
|
|
Map<Long, WbsTree> treePublicNodeAll = wbsTreeMapper.selectList(Wrappers.<WbsTree>query().lambda()
|
|
Map<Long, WbsTree> treePublicNodeAll = wbsTreeMapper.selectList(Wrappers.<WbsTree>query().lambda()
|
|
- .select(WbsTree::getId)
|
|
|
|
- .in(WbsTree::getId, privateNodeIds)
|
|
|
|
- .eq(WbsTree::getStatus, 1)
|
|
|
|
- .eq(WbsTree::getType, 1))
|
|
|
|
|
|
+ .select(WbsTree::getId)
|
|
|
|
+ .in(WbsTree::getId, privateNodeIds)
|
|
|
|
+ .eq(WbsTree::getStatus, 1)
|
|
|
|
+ .eq(WbsTree::getType, 1))
|
|
.stream().collect(Collectors.toMap(WbsTree::getId, Function.identity()));
|
|
.stream().collect(Collectors.toMap(WbsTree::getId, Function.identity()));
|
|
|
|
|
|
Map<String, Long> map = new HashMap<>();
|
|
Map<String, Long> map = new HashMap<>();
|
|
@@ -892,9 +893,10 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
- public boolean syncNodeParam(String projectId, String pKeyId){
|
|
|
|
- projectId=null;//暂不执行
|
|
|
|
|
|
+ public boolean syncNodeParam(String projectId, String pKeyId) {
|
|
|
|
+ projectId = null;//暂不执行
|
|
if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(pKeyId)) {
|
|
if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(pKeyId)) {
|
|
ProjectInfo projectInfo = projectInfoMapper.selectById(projectId);
|
|
ProjectInfo projectInfo = projectInfoMapper.selectById(projectId);
|
|
//当前选择同步的节点信息
|
|
//当前选择同步的节点信息
|
|
@@ -904,7 +906,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
}
|
|
}
|
|
|
|
|
|
//获取当前选择的节点与它所有子节点
|
|
//获取当前选择的节点与它所有子节点
|
|
- List<WbsTreePrivate>selectNodeAndChildNodes=Optional.ofNullable(this.getChildNodes(selectNodeNow)).orElse(new ArrayList<>());
|
|
|
|
|
|
+ List<WbsTreePrivate> selectNodeAndChildNodes = Optional.ofNullable(this.getChildNodes(selectNodeNow)).orElse(new ArrayList<>());
|
|
selectNodeAndChildNodes.add(selectNodeNow);
|
|
selectNodeAndChildNodes.add(selectNodeNow);
|
|
List<Long> privateNodeIds = selectNodeAndChildNodes.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
|
|
List<Long> privateNodeIds = selectNodeAndChildNodes.stream().map(WbsTreePrivate::getId).collect(Collectors.toList());
|
|
List<Long> privateNodePKeyIds = selectNodeAndChildNodes.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
List<Long> privateNodePKeyIds = selectNodeAndChildNodes.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
@@ -966,12 +968,12 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if (!insertList.isEmpty()) {
|
|
if (!insertList.isEmpty()) {
|
|
- insertList.forEach(i->i.setId(SnowFlakeUtil.getId()));
|
|
|
|
|
|
+ insertList.forEach(i -> i.setId(SnowFlakeUtil.getId()));
|
|
this.wbsParamServiceImpl.saveOrUpdateBatch(insertList, 1000);
|
|
this.wbsParamServiceImpl.saveOrUpdateBatch(insertList, 1000);
|
|
/*生成公式,并自动绑定元素*/
|
|
/*生成公式,并自动绑定元素*/
|
|
- Map<Long,Formula> insertFormulaMap = insertList.stream().map(e->{
|
|
|
|
|
|
+ Map<Long, Formula> insertFormulaMap = insertList.stream().map(e -> {
|
|
Map<String, Object> tmpMap = new HashMap<>();
|
|
Map<String, Object> tmpMap = new HashMap<>();
|
|
- Formula formula = new Formula();
|
|
|
|
|
|
+ Formula formula = new Formula();
|
|
formula.setOutm(Formula.FULL);
|
|
formula.setOutm(Formula.FULL);
|
|
formula.setParamId(e.getId());
|
|
formula.setParamId(e.getId());
|
|
Map<String, String> keyMap = new HashMap<>();
|
|
Map<String, String> keyMap = new HashMap<>();
|
|
@@ -988,20 +990,20 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
formula.setMap(JSON.toJSONString(tmpMap));
|
|
formula.setMap(JSON.toJSONString(tmpMap));
|
|
formula.setId(SnowFlakeUtil.getId());
|
|
formula.setId(SnowFlakeUtil.getId());
|
|
return formula;
|
|
return formula;
|
|
- }).collect(Collectors.toMap(Formula::getParamId,f->f));
|
|
|
|
- List<String> nodeIds= insertList.stream().map(WbsParam::getNodeId).distinct().map(Objects::toString).collect(Collectors.toList());
|
|
|
|
|
|
+ }).collect(Collectors.toMap(Formula::getParamId, f -> f));
|
|
|
|
+ List<String> nodeIds = insertList.stream().map(WbsParam::getNodeId).distinct().map(Objects::toString).collect(Collectors.toList());
|
|
/*每道工序下包含的元素集合*/
|
|
/*每道工序下包含的元素集合*/
|
|
- List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList(
|
|
|
|
|
|
+ List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList(
|
|
"select c.e_name as name ,c.id,a.p_key_id pKeyId from m_wbs_tree_private a " +
|
|
"select c.e_name as name ,c.id,a.p_key_id pKeyId from m_wbs_tree_private a " +
|
|
"inner join m_wbs_tree_private b on (a.id=b.parent_id and a.wbs_id=b.wbs_id) " +
|
|
"inner join m_wbs_tree_private b on (a.id=b.parent_id and a.wbs_id=b.wbs_id) " +
|
|
"inner join m_wbs_form_element c on b.init_table_id=c.f_id " +
|
|
"inner join m_wbs_form_element c on b.init_table_id=c.f_id " +
|
|
- "where b.project_id=" + projectId + " and a.p_key_id in(?) and b.is_deleted=0 and c.is_deleted=0 ",nodeIds);
|
|
|
|
|
|
+ "where b.project_id=" + projectId + " and a.p_key_id in(?) and b.is_deleted=0 and c.is_deleted=0 ", nodeIds);
|
|
|
|
|
|
- Map<String,List<Map<String, Object>>> groupElementNode = listMaps.stream().collect(Collectors.groupingBy(e->Func.toStr(e.get("pKeyId"))));
|
|
|
|
- List<ElementFormulaMapping> insertEfm= new ArrayList<>();
|
|
|
|
- insertList.forEach(p->{
|
|
|
|
- List<Map<String, Object>> elementMap =groupElementNode.get(p.getNodeId().toString());
|
|
|
|
- Formula formula= insertFormulaMap.get(p.getId());
|
|
|
|
|
|
+ Map<String, List<Map<String, Object>>> groupElementNode = listMaps.stream().collect(Collectors.groupingBy(e -> Func.toStr(e.get("pKeyId"))));
|
|
|
|
+ List<ElementFormulaMapping> insertEfm = new ArrayList<>();
|
|
|
|
+ insertList.forEach(p -> {
|
|
|
|
+ List<Map<String, Object>> elementMap = groupElementNode.get(p.getNodeId().toString());
|
|
|
|
+ Formula formula = insertFormulaMap.get(p.getId());
|
|
elementMap.forEach(m -> {
|
|
elementMap.forEach(m -> {
|
|
if (com.mixsmart.utils.StringUtils.handleNull(m.get("name")).contains(p.getName())) {
|
|
if (com.mixsmart.utils.StringUtils.handleNull(m.get("name")).contains(p.getName())) {
|
|
/*匹配名称,且该元素没有绑定任何节点参数公式*/
|
|
/*匹配名称,且该元素没有绑定任何节点参数公式*/
|
|
@@ -1022,11 +1024,11 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
- if(insertFormulaMap.size()>0){
|
|
|
|
- this.formulaService.saveBatch(insertFormulaMap.values(),1000);
|
|
|
|
|
|
+ if (insertFormulaMap.size() > 0) {
|
|
|
|
+ this.formulaService.saveBatch(insertFormulaMap.values(), 1000);
|
|
}
|
|
}
|
|
- if(insertEfm.size()>0){
|
|
|
|
- this.elementFormulaMappingService.saveBatch(insertEfm,1000);
|
|
|
|
|
|
+ if (insertEfm.size() > 0) {
|
|
|
|
+ this.elementFormulaMappingService.saveBatch(insertEfm, 1000);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1681,7 +1683,7 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
|
|
}
|
|
}
|
|
|
|
|
|
//反向递归查询父级节点
|
|
//反向递归查询父级节点
|
|
- private void fxSelectParentNode(List<WbsTreePrivate> wbsTreePrivates, Set<WbsTreePrivate> resultNode, String projectId, String wbsId, String wbsType) {
|
|
|
|
|
|
+ public void fxSelectParentNode(List<WbsTreePrivate> wbsTreePrivates, Set<WbsTreePrivate> resultNode, String projectId, String wbsId, String wbsType) {
|
|
List<Long> fuIds = wbsTreePrivates.stream().map(WbsTreePrivate::getParentId).distinct().collect(Collectors.toList());
|
|
List<Long> fuIds = wbsTreePrivates.stream().map(WbsTreePrivate::getParentId).distinct().collect(Collectors.toList());
|
|
if (fuIds.size() > 0 && fuIds.get(0) != 0L) {
|
|
if (fuIds.size() > 0 && fuIds.get(0) != 0L) {
|
|
List<WbsTreePrivate> fuNodes = baseMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
List<WbsTreePrivate> fuNodes = baseMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|