|
@@ -2939,7 +2939,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public R importTree(MultipartFile file, Long pkeyId) throws IOException {
|
|
|
//最高节点
|
|
|
WbsTreeContract wbsTreeContractRoot = baseMapper.selectOne(Wrappers.<WbsTreeContract>query().lambda().eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
@@ -3102,12 +3102,12 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
int i = 0;
|
|
|
int size = list.size();
|
|
|
try{
|
|
|
+ String sqlList1 = "Select parent_id,node_name,p_id 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));
|
|
|
for (ImportTreeDto dto : list) {
|
|
|
String progressStr = String.format("%.2f", ((double) ++i / size) * 100);
|
|
|
bladeRedis.set("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), progressStr);
|
|
|
//新增
|
|
|
- String sqlList1 = "Select parent_id,node_name,p_id 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++;
|
|
|
//单位工程:如果没有被处理过,说明需要新增
|
|
|
if (!dto.getIsUnit()) {
|
|
@@ -3133,6 +3133,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
unit.setAncestorsPId(wbsTreeContractRoot.getAncestorsPId() + "," + wbsTreeContractRoot.getPKeyId());
|
|
|
baseMapper.insert(unit);
|
|
|
insertList.add(unit);
|
|
|
+ WbsTreeContractList.add(unit);
|
|
|
}
|
|
|
}
|
|
|
//子单位工程:如果没有被处理过,说明需要新增,最重要是需要找到父节点。单位工程不会有相同的,所以直接根据名称查找
|
|
@@ -3160,6 +3161,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
subUnit.setAncestorsPId(fatherNode.getAncestorsPId() + "," + fatherNode.getPKeyId());
|
|
|
baseMapper.insert(subUnit);
|
|
|
insertList.add(subUnit);
|
|
|
+ WbsTreeContractList.add(subUnit);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -3207,6 +3209,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
division.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
baseMapper.insert(division);
|
|
|
insertList.add(division);
|
|
|
+ WbsTreeContractList.add(division);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -3261,6 +3264,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
subDivision.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
baseMapper.insert(subDivision);
|
|
|
insertList.add(subDivision);
|
|
|
+ WbsTreeContractList.add(subDivision);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -3318,6 +3322,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
item.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
baseMapper.insert(item);
|
|
|
insertList.add(item);
|
|
|
+ WbsTreeContractList.add(item);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -3378,6 +3383,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
subItem.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
baseMapper.insert(subItem);
|
|
|
insertList.add(subItem);
|
|
|
+ WbsTreeContractList.add(subItem);
|
|
|
break;
|
|
|
}
|
|
|
}
|