|
|
@@ -3207,6 +3207,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
}
|
|
|
int i = 0;
|
|
|
int size = list.size();
|
|
|
+ Long importId=SnowFlakeUtil.getId();
|
|
|
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));
|
|
|
@@ -3237,6 +3238,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
unit.setDateIsComplete(null);
|
|
|
unit.setPId(wbsTreeContractRoot.getPKeyId());
|
|
|
unit.setAncestorsPId(wbsTreeContractRoot.getAncestorsPId() + "," + wbsTreeContractRoot.getPKeyId());
|
|
|
+ unit.setImportId(importId);
|
|
|
baseMapper.insert(unit);
|
|
|
insertList.add(unit);
|
|
|
WbsTreeContractList.add(unit);
|
|
|
@@ -3265,6 +3267,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
subUnit.setDateIsComplete(null);
|
|
|
subUnit.setPId(fatherNode.getPKeyId());
|
|
|
subUnit.setAncestorsPId(fatherNode.getAncestorsPId() + "," + fatherNode.getPKeyId());
|
|
|
+ subUnit.setImportId(importId);
|
|
|
baseMapper.insert(subUnit);
|
|
|
insertList.add(subUnit);
|
|
|
WbsTreeContractList.add(subUnit);
|
|
|
@@ -3313,6 +3316,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
division.setDateIsComplete(null);
|
|
|
division.setPId(contract.getPKeyId());
|
|
|
division.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
+ division.setImportId(importId);
|
|
|
baseMapper.insert(division);
|
|
|
insertList.add(division);
|
|
|
WbsTreeContractList.add(division);
|
|
|
@@ -3368,6 +3372,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
subDivision.setDateIsComplete(null);
|
|
|
subDivision.setPId(contract.getPKeyId());
|
|
|
subDivision.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
+ subDivision.setImportId(importId);
|
|
|
baseMapper.insert(subDivision);
|
|
|
insertList.add(subDivision);
|
|
|
WbsTreeContractList.add(subDivision);
|
|
|
@@ -3426,6 +3431,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
item.setDateIsComplete(null);
|
|
|
item.setPId(contract.getPKeyId());
|
|
|
item.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
+ item.setImportId(importId);
|
|
|
baseMapper.insert(item);
|
|
|
insertList.add(item);
|
|
|
WbsTreeContractList.add(item);
|
|
|
@@ -3487,6 +3493,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
subItem.setDateIsComplete(null);
|
|
|
subItem.setPId(contract.getPKeyId());
|
|
|
subItem.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
|
|
|
+ subItem.setImportId(importId);
|
|
|
baseMapper.insert(subItem);
|
|
|
insertList.add(subItem);
|
|
|
WbsTreeContractList.add(subItem);
|
|
|
@@ -3501,7 +3508,6 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
} catch (Exception e) {
|
|
|
bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
|
|
|
}finally {
|
|
|
- bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
|
|
|
try {
|
|
|
if (!insertList.isEmpty()) {
|
|
|
wbsTreeContractStatisticsClient.updateWbsTreeContractNodes(insertList.stream().map(item -> item.getPKeyId() + "").collect(Collectors.joining(",")));
|
|
|
@@ -3510,11 +3516,28 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ if(!insertList.isEmpty()){
|
|
|
+ int x=insertList.size()/5;
|
|
|
+ int y=0;
|
|
|
+ boolean flag=true;
|
|
|
+ while (flag){
|
|
|
+ y++;
|
|
|
+ Thread.sleep(5000);
|
|
|
+ Integer importSize=baseMapper.selectImportSize(importId);
|
|
|
+ if(importSize==insertList.size()||y==x){
|
|
|
+ flag=false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
bladeRedis.setEx("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId(), "100",7L);
|
|
|
return R.success("新增了" + insertList.size() + "个节点" + "," + String.join(",", updateList) + "节点编号已被修改");
|
|
|
} catch (IOException e) {
|
|
|
bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
|
|
|
return R.fail("文件处理失败: " + e.getMessage());
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }finally {
|
|
|
+ bladeRedis.del("import:projectId:"+wbsTreeContractRoot.getProjectId()+"contractId:"+wbsTreeContractRoot.getContractId());
|
|
|
}
|
|
|
}
|
|
|
|