|
@@ -2386,74 +2386,96 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
//本次修改的节点
|
|
//本次修改的节点
|
|
List<String> updateList=new ArrayList<>();
|
|
List<String> updateList=new ArrayList<>();
|
|
|
|
|
|
|
|
+ //新增
|
|
|
|
+ String sqlList="Select parent_id,node_name from m_wbs_tree_contract where contract_id="+wbsTreeContractRoot.getContractId()+" and wbs_id="+wbsTreeContractRoot.getWbsId()+" and is_deleted=0";
|
|
|
|
+ List<WbsTreeContract> WbsTreeContractListupdate = jdbcTemplate.query(sqlList, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
//导入节点与现有节点进行比较。进行修改编号
|
|
//导入节点与现有节点进行比较。进行修改编号
|
|
for (ImportTreeDto dto : list) {
|
|
for (ImportTreeDto dto : list) {
|
|
for (WbsTreeContractVO vo : wbsTreeContractVOS) {
|
|
for (WbsTreeContractVO vo : wbsTreeContractVOS) {
|
|
//wbs节点和单位工程的名称类型能对应上,并且编号不一样,就修改编号
|
|
//wbs节点和单位工程的名称类型能对应上,并且编号不一样,就修改编号
|
|
if(vo.getNodeName().equals(dto.getUnitName())&&vo.getNodeType()==1){
|
|
if(vo.getNodeName().equals(dto.getUnitName())&&vo.getNodeType()==1){
|
|
- if(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getUnitCode())){
|
|
|
|
- baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
- updateList.add(vo.getNodeName());
|
|
|
|
|
|
+ Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 1, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
|
|
+ if(exist){
|
|
|
|
+ if(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getUnitCode())){
|
|
|
|
+ baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
+ updateList.add(vo.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ dto.setIsUnit(true);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- dto.setIsUnit(true);
|
|
|
|
- continue;
|
|
|
|
}
|
|
}
|
|
//wbs节点和子单位工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
//wbs节点和子单位工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
if(vo.getNodeName().equals(dto.getSubUnitName())&&vo.getNodeType()==18){
|
|
if(vo.getNodeName().equals(dto.getSubUnitName())&&vo.getNodeType()==18){
|
|
- if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName()),vo)){
|
|
|
|
- if(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubUnitCode())){
|
|
|
|
- baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
- updateList.add(vo.getNodeName());
|
|
|
|
|
|
+ Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 2, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
|
|
+ if(exist){
|
|
|
|
+ if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName()),vo)){
|
|
|
|
+ if(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubUnitCode())){
|
|
|
|
+ baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
+ updateList.add(vo.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ dto.setIsSubUnit(true);
|
|
}
|
|
}
|
|
- dto.setIsSubUnit(true);
|
|
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- continue;
|
|
|
|
}
|
|
}
|
|
//wbs节点和分部工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
//wbs节点和分部工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
- if(vo.getNodeName().equals(dto.getDivisionName())&&vo.getNodeType()==2&&!vo.getPartitionCode().equals(dto.getDivisionName())){
|
|
|
|
- if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName()),vo)){
|
|
|
|
- baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
- updateList.add(vo.getNodeName());
|
|
|
|
|
|
+ if(vo.getNodeName().equals(dto.getDivisionName())&&vo.getNodeType()==2&&!vo.getPartitionCode().equals(dto.getDivisionCode())){
|
|
|
|
+ Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 3, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
|
|
+ if(exist){
|
|
|
|
+ if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName()),vo)){
|
|
|
|
+ baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
+ updateList.add(vo.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ dto.setIsDivision(true);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- dto.setIsDivision(true);
|
|
|
|
- continue;
|
|
|
|
}
|
|
}
|
|
//wbs节点和子分部工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
//wbs节点和子分部工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
- if(vo.getNodeName().equals(dto.getSubDivisionName())&&vo.getNodeType()==3&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubDivisionName()))){
|
|
|
|
- if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName()),vo)){
|
|
|
|
- baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
- updateList.add(vo.getNodeName());
|
|
|
|
|
|
+ if(vo.getNodeName().equals(dto.getSubDivisionName())&&vo.getNodeType()==3&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubDivisionCode()))){
|
|
|
|
+ Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 4, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
|
|
+ if(exist){
|
|
|
|
+ if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName()),vo)){
|
|
|
|
+ baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
+ updateList.add(vo.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ dto.setIsSubDivision(true);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- dto.setIsSubDivision(true);
|
|
|
|
- continue;
|
|
|
|
}
|
|
}
|
|
//wbs节点和分项工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
//wbs节点和分项工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
- if(vo.getNodeName().equals(dto.getItemName())&&vo.getNodeType()==4&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getItemName()))){
|
|
|
|
- if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName(),dto.getItemName()),vo)){
|
|
|
|
- baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
- updateList.add(vo.getNodeName());
|
|
|
|
|
|
+ if(vo.getNodeName().equals(dto.getItemName())&&vo.getNodeType()==4&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getItemCode()))){
|
|
|
|
+ Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 5, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
|
|
+ if(exist){
|
|
|
|
+ if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName(),dto.getItemName()),vo)){
|
|
|
|
+ baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
+ updateList.add(vo.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ dto.setIsItem(true);
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
- dto.setIsItem(true);
|
|
|
|
- continue;
|
|
|
|
}
|
|
}
|
|
//wbs节点和子分项工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
//wbs节点和子分项工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
|
|
- if(vo.getNodeName().equals(dto.getSubItemName())&&vo.getNodeType()==5&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubItemName()))){
|
|
|
|
- if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName(),dto.getItemName(),dto.getSubItemName()),vo)){
|
|
|
|
- baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
- updateList.add(vo.getNodeName());
|
|
|
|
|
|
+ if(vo.getNodeName().equals(dto.getSubItemName())&&vo.getNodeType()==5&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubItemCode()))){
|
|
|
|
+ Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 6, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
|
|
+ if(exist){
|
|
|
|
+ if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName(),dto.getItemName(),dto.getSubItemName()),vo)){
|
|
|
|
+ baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
|
|
|
|
+ updateList.add(vo.getNodeName());
|
|
|
|
+ }
|
|
|
|
+ dto.setIsSubItem(true);
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
- dto.setIsSubItem(true);
|
|
|
|
- break;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int i=0;
|
|
int i=0;
|
|
- //新增
|
|
|
|
for (ImportTreeDto dto : list) {
|
|
for (ImportTreeDto dto : list) {
|
|
|
|
+ //新增
|
|
|
|
+ String sqlList1="Select parent_id,node_name from m_wbs_tree_contract where contract_id="+wbsTreeContractRoot.getContractId()+" and wbs_id="+wbsTreeContractRoot.getWbsId()+" and is_deleted=0";
|
|
|
|
+ List<WbsTreeContract> WbsTreeContractList = jdbcTemplate.query(sqlList1, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
i++;
|
|
i++;
|
|
//单位工程:如果没有被处理过,说明需要新增
|
|
//单位工程:如果没有被处理过,说明需要新增
|
|
- String sqlList="Select * from m_wbs_tree_contract where contract_id="+wbsTreeContractRoot.getContractId()+" and wbs_id="+wbsTreeContractRoot.getWbsId()+" and is_deleted=0";
|
|
|
|
- List<WbsTreeContract> WbsTreeContractList = jdbcTemplate.query(sqlList, new BeanPropertyRowMapper<>(WbsTreeContract.class));
|
|
|
|
if (!dto.getIsUnit()){
|
|
if (!dto.getIsUnit()){
|
|
//检测是否已经存在,如果存在,就不需要新增了
|
|
//检测是否已经存在,如果存在,就不需要新增了
|
|
Boolean exist = this.isExist(dto, WbsTreeContractList, 1, Long.valueOf(wbsTreeContractRoot.getContractId()));
|
|
Boolean exist = this.isExist(dto, WbsTreeContractList, 1, Long.valueOf(wbsTreeContractRoot.getContractId()));
|