fix: 77914
左侧树节点删除,对应标准编辑中企标体系字段被置空了
This commit is contained in:
+1
-1
@@ -118,7 +118,7 @@ public class ProcessEsChange implements Serializable {
|
||||
* 是否试行(0代表不试行,1代表试行)
|
||||
*/
|
||||
@ApiModelProperty(value = "是否试行(0代表不试行,1代表试行)")
|
||||
private Integer tryFlag;
|
||||
private String tryFlag;
|
||||
|
||||
/**
|
||||
* 试行周期
|
||||
|
||||
-1
@@ -1089,7 +1089,6 @@ public class LawsCommonServiceImpl implements ILawsCommonService {
|
||||
.collect(Collectors.joining(","));
|
||||
stringObjectMap.put(FieldCommon.AUTH_DEPT, authDept);
|
||||
}
|
||||
|
||||
// 标准拆分标识
|
||||
splitFlag(stringObjectMap);
|
||||
// 对返回的字段做处理
|
||||
|
||||
+43
-3
@@ -12,7 +12,7 @@ import com.jero.modules.laws.standard.entity.LawsNodeRelation;
|
||||
import com.jero.modules.laws.standard.entity.LawsTreeNode;
|
||||
import com.jero.modules.laws.standard.mapper.LawsNodeRelationMapper;
|
||||
import com.jero.modules.laws.standard.mapper.LawsTreeNodeMapper;
|
||||
import com.jero.modules.laws.standard.service.ILawsTreeNodeService;
|
||||
import com.jero.modules.laws.standard.service.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -38,6 +38,18 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
|
||||
@Resource
|
||||
private LawsNodeRelationMapper lawsNodeRelationMapper;
|
||||
|
||||
@Resource
|
||||
private ILawsNodeRelationService lawsNodeRelationService;
|
||||
|
||||
@Resource
|
||||
private ILawsEnterpriseStandardService enterpriseStandardService;
|
||||
|
||||
@Resource
|
||||
private ILawsDomesticStandardService domesticStandardService;
|
||||
|
||||
@Resource
|
||||
private ILawsOverseasStandardService overseasStandardService;
|
||||
|
||||
@Override
|
||||
public List<LawsTreeNodeModel> queryTreeNodeList(String moduleCode, String nodeName, String option) {
|
||||
LambdaQueryWrapper<LawsTreeNode> query = new LambdaQueryWrapper<>();
|
||||
@@ -155,14 +167,42 @@ public class LawsTreeNodeServiceImpl extends ServiceImpl<LawsTreeNodeMapper, Law
|
||||
|
||||
@Override
|
||||
public boolean delete(String id, String nodeCode) {
|
||||
String rootNodeCode = "";
|
||||
if (nodeCode.startsWith("A01")) {
|
||||
rootNodeCode = "A01";
|
||||
} else if (nodeCode.startsWith("A02")) {
|
||||
rootNodeCode = "A02";
|
||||
} else {
|
||||
rootNodeCode = "A03";
|
||||
}
|
||||
LawsTreeNode parentNode = this.getOne(new LambdaQueryWrapper<LawsTreeNode>().eq(LawsTreeNode::getNodeCode, rootNodeCode));
|
||||
|
||||
List<String> idList = new ArrayList<>();
|
||||
idList.add(id);
|
||||
List<String> codeList = new ArrayList<>();
|
||||
codeList.add(nodeCode);
|
||||
this.checkChildrenExists(id, idList);
|
||||
boolean ok = this.removeByIds(idList);
|
||||
// 根据idList找到所有受影响的标准
|
||||
List<LawsNodeRelation> list = lawsNodeRelationService.list(new LambdaQueryWrapper<LawsNodeRelation>().in(LawsNodeRelation::getNodeId, idList));
|
||||
// 根据节点code删除标准关联
|
||||
lawsNodeRelationMapper.delete(new LambdaQueryWrapper<LawsNodeRelation>().in(LawsNodeRelation::getNodeId, idList));
|
||||
// 将list按照Id分组
|
||||
Map<String, List<LawsNodeRelation>> groupedByCount = list.stream()
|
||||
.collect(Collectors.groupingBy(LawsNodeRelation::getUniqueRelationFlag));
|
||||
Map<String, List<LawsNodeRelation>> filteredMap = groupedByCount.entrySet()
|
||||
.stream()
|
||||
.filter(entry -> entry.getValue().size() == 1)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
List<LawsNodeRelation> nodeRelationList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<LawsNodeRelation>> entry : filteredMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
LawsNodeRelation lawsNodeRelation = new LawsNodeRelation();
|
||||
lawsNodeRelation.setNodeId(parentNode.getId());
|
||||
lawsNodeRelation.setUniqueRelationFlag(key);
|
||||
lawsNodeRelation.setNodeCode(parentNode.getNodeCode());
|
||||
nodeRelationList.add(lawsNodeRelation);
|
||||
}
|
||||
lawsNodeRelationService.saveBatch(nodeRelationList);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user