|
@@ -591,6 +591,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
public R<Object> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify, @RequestParam String projectId, @RequestParam String contractId) {
|
|
|
//查询填报状态
|
|
|
InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1));
|
|
|
+ primaryKeyId=primaryKeyId+"*";
|
|
|
if (businessData != null) {
|
|
|
//使用批量废除接口
|
|
|
return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId);
|
|
@@ -1248,8 +1249,25 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//修改试验任务状态为未上报
|
|
|
|
|
|
//批量废除直接调的该接口,primaryKeyId为null,ids=当前试验记录的ids
|
|
|
- String sql = "update u_trial_self_inspection_record set task_status = '已废除' where id in(" + ids + ")";
|
|
|
+ String sql="";
|
|
|
+ String sql1="";
|
|
|
+ if(primaryKeyId.indexOf("*")>0){
|
|
|
+ primaryKeyId=primaryKeyId.substring(0, primaryKeyId.length() - 1);
|
|
|
+ sql= "update u_trial_self_inspection_record set task_status = '未上报' where id="+primaryKeyId;
|
|
|
+ sql1="SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id="+primaryKeyId;
|
|
|
+ }else {
|
|
|
+ sql= "update u_trial_self_inspection_record set task_status = '未上报' where id in(" + ids + ")";
|
|
|
+ sql1="SELECT e.* from u_entrust_info e left join u_trial_self_inspection_record t on t.entrust_id=e.id where t.id in(" + ids + ")";
|
|
|
+ }
|
|
|
jdbcTemplate.execute(sql);
|
|
|
+ List<EntrustInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(EntrustInfo.class));
|
|
|
+ if(!query.isEmpty()){
|
|
|
+ String[] idss = query.stream()
|
|
|
+ .map(item -> String.valueOf(item.getId()))
|
|
|
+ .toArray(String[]::new);
|
|
|
+ String update="update u_entrust_info set status=3 where id in(" + String.join(",", idss)+ ")";
|
|
|
+ jdbcTemplate.execute(update);
|
|
|
+ }
|
|
|
return R.data(200, aopParamsSet, "废除成功");
|
|
|
|
|
|
} catch (Exception e) {
|
|
@@ -1502,8 +1520,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
Map<Long, Long> oldToNewIdMap = new HashMap<>();
|
|
|
Map<String, WbsTreeContract> nodeMap = new HashMap<>();
|
|
|
nodeChildAll.forEach(node -> {
|
|
|
- oldToNewIdMap.put(node.getPKeyId(), SnowFlakeUtil.getId());
|
|
|
- nodeMap.put(node.getPKeyId().toString(), node);
|
|
|
+ oldToNewIdMap.put(node.getId(), SnowFlakeUtil.getId());
|
|
|
+ nodeMap.put(node.getId().toString(), node);
|
|
|
});
|
|
|
|
|
|
/*获取元素表数据*/
|
|
@@ -1556,9 +1574,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
WbsTreeContract newData = new WbsTreeContract();
|
|
|
BeanUtils.copyProperties(nodeOld, newData);
|
|
|
|
|
|
- newData.setPKeyId(oldToNewIdMap.get(nodeOld.getPKeyId()));
|
|
|
- newData.setId(newData.getPKeyId());
|
|
|
-
|
|
|
+ newData.setPKeyId(SnowFlakeUtil.getId());
|
|
|
if (nodeOld.getNodeType() != null && nodeOld.getNodeType() == 6) {
|
|
|
peerMap.put(newData.getPKeyId(), nodeOld.getPKeyId());
|
|
|
}
|
|
@@ -1568,20 +1584,17 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else {
|
|
|
newData.setOldId(nodeOld.getId().toString());
|
|
|
}
|
|
|
+
|
|
|
if (new Integer("1").equals(nodeOld.getType())) {
|
|
|
- // newData.setId(oldToNewIdMap.containsKey(nodeOld.getPKeyId()) ? oldToNewIdMap.get(nodeOld.getPKeyId()) : SnowFlakeUtil.getId());
|
|
|
+ newData.setId(oldToNewIdMap.containsKey(nodeOld.getId()) ? oldToNewIdMap.get(nodeOld.getId()) : SnowFlakeUtil.getId());
|
|
|
newData.setPartitionCode(StringUtils.isNotEmpty(vo.getPartitionCode()) ? vo.getPartitionCode() : null);
|
|
|
}
|
|
|
- //如果被复制的是节点,parendID等于父节点的PkeyID
|
|
|
if (vo.getNeedCopyPrimaryKeyId().equals(nodeOld.getPKeyId().toString())) {
|
|
|
- newData.setParentId(parent.getPKeyId());
|
|
|
- newData.setPId(parent.getPKeyId());
|
|
|
+ newData.setParentId(parent.getId());
|
|
|
newData.setNodeName(vo.getNeedCopyNodeName());
|
|
|
newData.setFullName(vo.getNeedCopyNodeName());
|
|
|
} else {
|
|
|
- //如果是复制的表格,parentID 他父节点的pkeyId
|
|
|
- newData.setParentId(oldToNewIdMap.containsKey(nodeOld.getPId()) ? oldToNewIdMap.get(nodeOld.getPId()) : SnowFlakeUtil.getId());
|
|
|
- newData.setPId(oldToNewIdMap.containsKey(nodeOld.getPId()) ? oldToNewIdMap.get(nodeOld.getPId()) : SnowFlakeUtil.getId());
|
|
|
+ newData.setParentId(oldToNewIdMap.containsKey(nodeOld.getParentId()) ? oldToNewIdMap.get(nodeOld.getParentId()) : SnowFlakeUtil.getId());
|
|
|
}
|
|
|
newData.setCreateTime(new Date());
|
|
|
newData.setUpdateTime(new Date());
|
|
@@ -1590,7 +1603,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
newData.setPdfUrl(null);
|
|
|
newData.setCreateUser(AuthUtil.getUserId());
|
|
|
newData.setSort(ObjectUtil.isNotEmpty(nodeOld.getSort()) ? nodeOld.getSort() : 0);
|
|
|
+
|
|
|
this.restoreParent(newData, oldToNewIdMap);
|
|
|
+
|
|
|
saveList.add(newData);
|
|
|
|
|
|
/*生成工序节点施工日志*/
|
|
@@ -2080,15 +2095,15 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
|
|
|
Map<Long, WbsTreeContract> newMap = BeanUtil.copyProperties(result, WbsTreeContract.class).stream().collect(Collectors.toMap(WbsTreeContract::getId, Function.identity()));
|
|
|
for (WbsTreeContract obj : sortedResult) {
|
|
|
- if (obj != null && ObjectUtil.isNotEmpty(obj.getPId())) {
|
|
|
+ if (obj != null && ObjectUtil.isNotEmpty(obj.getParentId())) {
|
|
|
if (newMap.size() > 0) {
|
|
|
- WbsTreeContract parentObj = newMap.get(obj.getPId());
|
|
|
- if (parentObj != null && ObjectUtil.isNotEmpty(obj.getAncestors()) && ObjectUtil.isNotEmpty(obj.getPId()) && !obj.getAncestors().contains(obj.getPId().toString())) {
|
|
|
+ WbsTreeContract parentObj = newMap.get(obj.getParentId());
|
|
|
+ if (parentObj != null && ObjectUtil.isNotEmpty(obj.getAncestors()) && ObjectUtil.isNotEmpty(obj.getParentId()) && !obj.getAncestors().contains(obj.getParentId().toString())) {
|
|
|
String parentAncestors = parentObj.getAncestors();
|
|
|
- obj.setAncestors(parentAncestors + "," + obj.getPId());
|
|
|
+ obj.setAncestors(parentAncestors + "," + obj.getParentId());
|
|
|
}
|
|
|
}
|
|
|
- newMap.put(obj.getPKeyId(), obj);
|
|
|
+ newMap.put(obj.getId(), obj);
|
|
|
result.add(obj);
|
|
|
}
|
|
|
}
|
|
@@ -2367,18 +2382,14 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else { //多层级节点复制
|
|
|
//根节点id
|
|
|
Long needCopyNodeOldId = needCopyNode.getId();
|
|
|
- Long needCopyNodeOldPKeyId = needCopyNode.getPKeyId();
|
|
|
+ needCopyNode.setId(SnowFlakeUtil.getId());
|
|
|
needCopyNode.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- needCopyNode.setId(needCopyNode.getPKeyId());
|
|
|
- needCopyNode.setPId(needCopyNodeOldPKeyId);
|
|
|
-
|
|
|
needCopyNode.setNodeName(toCopyNode.getNodeName());
|
|
|
needCopyNode.setFullName(toCopyNode.getNodeName());
|
|
|
needCopyNode.setPartitionCode(toCopyNode.getPartitionCode());
|
|
|
needCopyNode.setCreateTime(new Date());
|
|
|
|
|
|
Map<Long, Long> parentIdToId = new HashMap<>();
|
|
|
- Map<Long,Long>pidToPkeyId=new HashMap<>();
|
|
|
Map<Long, List<WbsTreeContract>> tabMap = needTabs.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
|
|
|
|
|
|
//获取节点下所有表的key
|
|
@@ -2392,7 +2403,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (obj != null) {
|
|
|
//构造节点
|
|
|
Long newParentId;
|
|
|
- Long newPid;
|
|
|
if (parentIdToId.size() > 0) {
|
|
|
//去数据源节点获取父级id对应的新id,设置成重设后的新的父级id
|
|
|
newParentId = parentIdToId.get(node.getParentId());
|
|
@@ -2400,22 +2410,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//根节点
|
|
|
newParentId = needCopyNode.getId();
|
|
|
}
|
|
|
- if(pidToPkeyId.size()>0){
|
|
|
- //去数据源节点获取父级id对应的新id,设置成重设后的新的父级Pid
|
|
|
- newPid = pidToPkeyId.get(node.getPId());
|
|
|
- }else{
|
|
|
- //根节点
|
|
|
- newPid = needCopyNode.getPKeyId();
|
|
|
- }
|
|
|
-
|
|
|
if (ObjectUtils.isEmpty(newParentId)) {
|
|
|
newParentId = needCopyNode.getId();
|
|
|
}
|
|
|
- if(ObjectUtils.isEmpty(newPid)){
|
|
|
- newPid=needCopyNode.getPKeyId();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
obj.setPKeyId(SnowFlakeUtil.getId());
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(node.getOldId())) {
|
|
@@ -2427,10 +2424,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
Long id = SnowFlakeUtil.getId();
|
|
|
//数据源节点的老id与新的id的Map,作为下一级的节点的父级id的替换
|
|
|
parentIdToId.put(node.getId(), id);
|
|
|
- pidToPkeyId.put(node.getPId(),newPid);
|
|
|
//重设Id
|
|
|
obj.setId(id);
|
|
|
- obj.setPId(newPid);
|
|
|
obj.setParentId(newParentId);
|
|
|
obj.setCreateTime(new Date());
|
|
|
//获取当前复制的节点的sort
|
|
@@ -2453,7 +2448,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
Long oldPKeyId = needTab.getPKeyId();
|
|
|
String tableName = needTab.getInitTableName();
|
|
|
Long tabId = SnowFlakeUtil.getId();
|
|
|
- objTab.setPId(obj.getPKeyId());
|
|
|
objTab.setId(tabId);
|
|
|
objTab.setParentId(id);
|
|
|
objTab.setPKeyId(SnowFlakeUtil.getId());
|
|
@@ -2503,12 +2497,9 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (isSameNode == 1) {
|
|
|
//同节点
|
|
|
needCopyNode.setParentId(needCopyNode.getParentId());
|
|
|
- needCopyNode.setPId(needCopyNode.getPId());
|
|
|
} else {
|
|
|
//跨节点
|
|
|
needCopyNode.setParentId(toCopyNode.getId());
|
|
|
- needCopyNode.setPId(toCopyNode.getPKeyId());
|
|
|
- needCopyNode.setAncestors(toCopyNode.getAncestors()+","+needCopyNode.getPId());
|
|
|
}
|
|
|
addNodeList.add(0, needCopyNode);
|
|
|
}
|
|
@@ -3061,8 +3052,8 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
Map<String, WbsTreePrivate> nodeMap = new HashMap<>();
|
|
|
Map<String, WbsTreeContract> nodeMapContract = new HashMap<>();
|
|
|
selectedNodeList.forEach(half -> {
|
|
|
- OldIdToNewIdMap.put(half.getPKeyId(), SnowFlakeUtil.getId());
|
|
|
- nodeMap.put(half.getPKeyId().toString(), half);
|
|
|
+ OldIdToNewIdMap.put(half.getId(), SnowFlakeUtil.getId());
|
|
|
+ nodeMap.put(half.getId().toString(), half);
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = BeanUtil.copyProperties(half, WbsTreeContract.class);
|
|
|
nodeMapContract.put(half.getId().toString(), wbsTreeContract);
|
|
@@ -3075,28 +3066,25 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
BeanUtils.copyProperties(half, newData);
|
|
|
|
|
|
//重塑pKeyId、id和parentId
|
|
|
- newData.setPKeyId(OldIdToNewIdMap.get(half.getPKeyId()));
|
|
|
- newData.setId(newData.getPKeyId());
|
|
|
+ newData.setPKeyId(SnowFlakeUtil.getId());
|
|
|
if (new Integer("1").equals(half.getType())) {
|
|
|
- newData.setPId(OldIdToNewIdMap.containsKey(half.getPId()) ? OldIdToNewIdMap.get(half.getPId()) : treeContract.getPKeyId());
|
|
|
+ newData.setId(OldIdToNewIdMap.containsKey(half.getId()) ? OldIdToNewIdMap.get(half.getId()) : SnowFlakeUtil.getId());
|
|
|
}
|
|
|
|
|
|
//设置父级id
|
|
|
boolean var = true;
|
|
|
if ("1".equals(vo.getSaveType())) {
|
|
|
//当前节点及其子节点操作
|
|
|
- if (OldIdToNewIdMap.containsKey(half.getPId())) {
|
|
|
+ if (OldIdToNewIdMap.containsKey(half.getParentId())) {
|
|
|
//跨节点
|
|
|
- WbsTreePrivate wbsTreePrivate = nodeMap.get(half.getPId() + "");
|
|
|
+ WbsTreePrivate wbsTreePrivate = nodeMap.get(half.getParentId() + "");
|
|
|
if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && treeContract.getNodeName().equals(wbsTreePrivate.getNodeName())) {
|
|
|
newData.setParentId(treeContract.getId());
|
|
|
- newData.setPId(treeContract.getPKeyId());
|
|
|
var = false;
|
|
|
|
|
|
//从复制or新增节点开始操作-》选择新增节点,根节点会走到这里
|
|
|
} else if (treeContract.getNodeType().equals(wbsTreePrivate.getNodeType()) && ObjectUtil.isNotEmpty(treeContract.getOldId()) && treeContract.getOldId().equals(wbsTreePrivate.getId().toString())) {
|
|
|
newData.setParentId(treeContract.getId());
|
|
|
- newData.setPId(treeContract.getPKeyId());
|
|
|
var = false;
|
|
|
}
|
|
|
}
|
|
@@ -3113,7 +3101,11 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
} else {
|
|
|
//非自定义节点
|
|
|
//同节点
|
|
|
- newData.setPId(OldIdToNewIdMap.containsKey(half.getPId())?OldIdToNewIdMap.get(half.getPId()):treeContract.getPKeyId());
|
|
|
+ newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId())
|
|
|
+ ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId())
|
|
|
+ ||
|
|
|
+ treeContract.getOldId().equals(half.getParentId().toString())
|
|
|
+ ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3125,19 +3117,16 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (("1").equals(node.getIsPeer())) {
|
|
|
//同级
|
|
|
newData.setParentId(treeContract.getParentId());
|
|
|
- newData.setPId(treeContract.getPKeyId());
|
|
|
|
|
|
} else if (("2").equals(node.getIsPeer())) {
|
|
|
//下一级
|
|
|
newData.setParentId(treeContract.getId());
|
|
|
- newData.setPId(treeContract.getPKeyId());
|
|
|
|
|
|
}
|
|
|
}
|
|
|
} else if (new Integer("2").equals(half.getType())) {
|
|
|
//表
|
|
|
newData.setParentId(OldIdToNewIdMap.containsKey(half.getParentId()) ? OldIdToNewIdMap.get(half.getParentId()) : treeContract.getId().equals(half.getParentId()) || treeContract.getOldId().equals(half.getParentId().toString()) ? treeContract.getId() : SnowFlakeUtil.getId());
|
|
|
- newData.setPId(OldIdToNewIdMap.containsKey(half.getPId())?OldIdToNewIdMap.get(half.getPId()):half.getPId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3163,18 +3152,24 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
//设置节点名称
|
|
|
newData.setFullName(ObjectUtil.isNotEmpty(idAndNodeNameMaps.get(half.getId())) ? idAndNodeNameMaps.get(half.getId()) : half.getFullName());
|
|
|
|
|
|
- //重塑父节点关联关系
|
|
|
- String sql="Select ancestors from m_wbs_tree_contract where p_key_id="+newData.getPId();
|
|
|
- String ancestors = jdbcTemplate.query(sql, (rs, rowNum) -> rs.getString(1))
|
|
|
- .stream()
|
|
|
- .findFirst()
|
|
|
- .orElse(null);
|
|
|
+ /*//重塑父节点关联关系
|
|
|
+ String ancestors = newData.getAncestors();
|
|
|
if (StringUtils.isNotEmpty(ancestors)) {
|
|
|
+ //重组后的链表
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
+ //拆分重组
|
|
|
+ String[] ancestorsArray = ancestors.split(",");
|
|
|
+ for (String oldParentId : ancestorsArray) {
|
|
|
+ if (StringUtils.isNotEmpty(oldParentId)) {
|
|
|
+ //获取新的
|
|
|
+ Long newParentId = OldIdToNewIdMap.get(Long.parseLong(oldParentId));
|
|
|
+ //如果新的id为空,说明不变
|
|
|
+ stringBuilder.append(",").append(newParentId == null ? oldParentId : newParentId);
|
|
|
+ }
|
|
|
+ }
|
|
|
//将新链表设置进对象中
|
|
|
- newData.setAncestors(ancestors+","+newData.getPId());
|
|
|
- }else {
|
|
|
- newData.setAncestors(null);
|
|
|
- }
|
|
|
+ newData.setAncestors(stringBuilder.substring(1));
|
|
|
+ }*/
|
|
|
|
|
|
//设置到保存集合中
|
|
|
saveList.add(newData);
|
|
@@ -3234,15 +3229,6 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- //设置ancestors
|
|
|
- for (WbsTreeContract wbsTreeContract : saveList) {
|
|
|
- if(wbsTreeContract.getAncestors()==null){
|
|
|
- WbsTreeContract wbsTreeContract1 = saveList.stream().filter(s -> s.getPKeyId().equals(wbsTreeContract.getPId())).findFirst().orElse(null);
|
|
|
- if(wbsTreeContract1!=null&&wbsTreeContract1.getAncestors()!=null){
|
|
|
- wbsTreeContract.setAncestors(wbsTreeContract1.getAncestors()+","+wbsTreeContract.getPId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
R<Boolean> booleanR = this.saveOrCopyNodeTree(saveList, saveLedger, 2, treeContract);
|
|
|
|
|
|
List<WbsTreeContract> nowTabs = saveList.stream().filter(f -> new Integer(2).equals(f.getType())).collect(Collectors.toList());
|
|
@@ -4012,10 +3998,10 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
if (parentNode.getNodeType() < parentNode.getNodeType()) {
|
|
|
throw new ServiceException("当前新增选择的节点类型不能大于父级节点类型");
|
|
|
}
|
|
|
+
|
|
|
WbsTreeContract obj = new WbsTreeContract();
|
|
|
obj.setPKeyId(SnowFlakeUtil.getId());
|
|
|
- obj.setId(obj.getPKeyId());
|
|
|
- obj.setPId(parentNode.getPKeyId());
|
|
|
+ obj.setId(SnowFlakeUtil.getId());
|
|
|
obj.setProjectId(parentNode.getProjectId());
|
|
|
obj.setContractId(parentNode.getContractId());
|
|
|
obj.setContractType(ObjectUtil.isNotEmpty(parentNode.getContractType()) ? parentNode.getContractType() : null);
|
|
@@ -4025,7 +4011,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
obj.setFullName(dto.getNodeName());
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(parentNode.getNodeType())) {
|
|
|
- if (parentNode.getPId().equals(0L)) {
|
|
|
+ if (parentNode.getParentId().equals(0L)) {
|
|
|
obj.setNodeType(1);
|
|
|
} else {
|
|
|
obj.setNodeType(parentNode.getNodeType().equals(6) ? 6 : dto.getNodeType());
|
|
@@ -4033,7 +4019,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
}
|
|
|
obj.setPartitionCode(dto.getPartitionCode());
|
|
|
obj.setParentId(parentNode.getId());
|
|
|
- obj.setAncestors(parentNode.getAncestors() + "," + parentNode.getPKeyId());
|
|
|
+ obj.setAncestors(parentNode.getAncestors() + "," + parentNode.getId());
|
|
|
obj.setType(1);
|
|
|
obj.setStatus(1);
|
|
|
obj.setIsDeleted(0);
|
|
@@ -4071,6 +4057,7 @@ public class InformationWriteQueryController extends BladeController {
|
|
|
obj.setIsClassifition(dto.getIsClassifition());
|
|
|
obj.setExcellentNum(dto.getExcellentNum());
|
|
|
obj.setUnitNum(dto.getUnitNum());
|
|
|
+
|
|
|
} else {
|
|
|
throw new ServiceException("标准分类或单元名称选择有误");
|
|
|
}
|