项目任务树查询 bug fix
This commit is contained in:
@@ -13,6 +13,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/task")
|
||||
@@ -70,4 +73,15 @@ public class SimulationTaskController {
|
||||
return taskService.list(req);
|
||||
}
|
||||
|
||||
@GetMapping("/test")
|
||||
public SdmResponse test() {
|
||||
// 创建一个ScheduledExecutorService实例
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
// 定义要执行的任务
|
||||
Runnable task = () -> System.out.println("任务执行: " + System.nanoTime());
|
||||
// 延时5秒后执行任务
|
||||
scheduler.schedule(task, 5, TimeUnit.SECONDS);
|
||||
|
||||
return SdmResponse.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,9 +209,14 @@ public class ProjectNode extends BaseEntity {
|
||||
private List<String> Tag4;
|
||||
@JsonProperty(value = "Tag5")
|
||||
private List<String> Tag5;
|
||||
@JsonProperty(value = "Tag6")
|
||||
private List<String> Tag6;
|
||||
@JsonProperty(value = "Tag7")
|
||||
private List<String> Tag7;
|
||||
@JsonProperty(value = "Tag8")
|
||||
private List<String> Tag8;
|
||||
@JsonProperty(value = "Tag9")
|
||||
private List<String> Tag9;
|
||||
@JsonProperty(value = "Tag10")
|
||||
private List<String> Tag10;
|
||||
}
|
||||
|
||||
@@ -229,10 +229,15 @@ public class TaskNode extends BaseEntity {
|
||||
private List<String> Tag4;
|
||||
@JsonProperty(value = "Tag5")
|
||||
private List<String> Tag5;
|
||||
@JsonProperty(value = "Tag6")
|
||||
private List<String> Tag6;
|
||||
@JsonProperty(value = "Tag7")
|
||||
private List<String> Tag7;
|
||||
@JsonProperty(value = "Tag8")
|
||||
private List<String> Tag8;
|
||||
@JsonProperty(value = "Tag9")
|
||||
private List<String> Tag9;
|
||||
@JsonProperty(value = "Tag10")
|
||||
private List<String> Tag10;
|
||||
|
||||
// private String tags1;
|
||||
|
||||
@@ -45,13 +45,13 @@ public class SpdmTaskListReq {
|
||||
* 仿真负责人
|
||||
*/
|
||||
@JsonProperty(value = "pMemberIdList")
|
||||
private Integer pMemberIdList;
|
||||
private String pMemberIdList;
|
||||
|
||||
/**
|
||||
* 仿真执行人
|
||||
*/
|
||||
@JsonProperty(value = "eMemberIdList")
|
||||
private Integer eMemberIdList;
|
||||
private String eMemberIdList;
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
@@ -68,4 +68,9 @@ public class SpdmTaskListReq {
|
||||
*/
|
||||
private String disciplineName;
|
||||
|
||||
/**
|
||||
* 实际结束时间
|
||||
*/
|
||||
private String finishTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -238,15 +238,6 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
log.error("至少要有一层顶级节点");
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
// ProjectTreeReq projectTreeReq = new ProjectTreeReq();
|
||||
// for (TaskNodeTag tag : topTagList) {
|
||||
// try {
|
||||
// setTagProperty(projectTreeReq,tag.getValue(),tag.getKey());
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// log.info("projectTreeReq为:{}",projectTreeReq);
|
||||
// topTagList中最后一层可以认为是最顶层节点,但并不需要展示
|
||||
TaskNodeTag topNodeTag = topTagList.get(topTagList.size() - 1);
|
||||
log.info("实际顶层节点为:{}", topNodeTag);
|
||||
@@ -284,51 +275,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
// key:标签,value:节点类型
|
||||
taskTreeTagNodeTypeMap = taskTreeTagMap.stream().collect(Collectors.toMap(TaskNodeTag::getValue, TaskNodeTag::getKey));
|
||||
log.info("taskTreeTagNodeTypeMap为:{}", taskTreeTagNodeTypeMap);
|
||||
// Map<String, String> reverseTagMap = tagMap.stream().collect(Collectors.toMap(TaskNodeTag::getValue, TaskNodeTag::getKey));
|
||||
// 构造项目任务树
|
||||
List<ProjectNodePo> projectNodeList = new ArrayList<>();
|
||||
// List<ProjectNodePo> currentNodeList;
|
||||
// TaskNodeTag tag;
|
||||
// for (int i = 0; i < idMapList.size(); i++) {
|
||||
// tag = idMapList.get(i);
|
||||
// log.info("第{}层节点的标签为:{}",i+1,tag.getValue());
|
||||
// switch (tag.getValue()) {
|
||||
// case TagConstant.TAG1 :
|
||||
// currentNodeList = nodeList.stream().filter(node -> node.getNodeType().equals(nodeTypeMap.get(TagConstant.TAG1))).collect(Collectors.toList());
|
||||
// if (CollectionUtils.isEmpty(currentNodeList)) {
|
||||
// continue;
|
||||
// }
|
||||
// // TODO LDY 存在递归情况
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
// List<ProjectNodePo> currentNodeList;
|
||||
// String currentNodeTagId;
|
||||
// String[] currentNodeTagIdArray;
|
||||
// for (TaskNodeTag taskNodeTag : tagMap) {
|
||||
// currentNodeList = nodeList.stream().filter(node -> node.getNodeType().equals(taskNodeTag.getKey())).toList();
|
||||
// log.info("节点类型为:{}的节点为:{}",taskNodeTag.getKey(),currentNodeList);
|
||||
// for (ProjectNodePo currentNode : currentNodeList) {
|
||||
// try {
|
||||
// currentNodeTagId = getTagProperty(currentNode, taskNodeTag.getValue());
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// if (StringUtils.isEmpty(currentNodeTagId)) {
|
||||
// log.info("节点id:{}的{}的值为空",currentNode.getId(),taskNodeTag.getValue());
|
||||
// continue;
|
||||
// }
|
||||
// // 每个nodeId都代表当前节点类型下的一层数据
|
||||
// for (String nodeId : currentNodeTagId.split(",")) {
|
||||
// // 下层数据可能为node或task或都有
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 如果idMap中的id都不为null,说明查的是最后一层节点下的所有任务、指标
|
||||
// TaskNodeTag realFirstTaskNodeTag = idMapList.stream().filter(tag -> StringUtils.isBlank(tag.getKey())).findFirst().orElseGet(() -> idMapList.get(idMapList.size() - 1));
|
||||
TaskNodeTag realFirstTaskNodeTag = idMapList.get(idMapList.size() - 1);
|
||||
for (TaskNodeTag taskNodeTag : idMapList) {
|
||||
if (StringUtils.isNotBlank(taskNodeTag.getKey())) {
|
||||
@@ -337,54 +284,12 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
}
|
||||
String realFirstTaskNodeType = taskTreeTagNodeTypeMap.get(realFirstTaskNodeTag.getValue());
|
||||
log.info("实际需要展示的最顶层节点类型为:{},id为:{}", taskTreeTagNodeTypeMap.get(realFirstTaskNodeTag.getValue()),realFirstTaskNodeType);
|
||||
// List<ProjectNodePo> realFirstNodeList = taskTreeNodeList.stream().filter(node -> node.getNodeType().equals(realFirstTaskNodeType)).toList();
|
||||
// String realFirstNodeTagId = "";
|
||||
// int currentNodeDepth = 1;
|
||||
// int maxNodeDepth = 1;
|
||||
// for (ProjectNodePo realFirstNode : realFirstNodeList) {
|
||||
// // 根据tag中的分隔符数量,来确定当前节点类型的层数(层数 = 分隔符 + 1)
|
||||
// // 找到最大层数然后去遍历
|
||||
// try {
|
||||
// realFirstNodeTagId = getTagProperty(realFirstNode, realFirstTaskNodeTag.getValue());
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// if (StringUtils.isBlank(realFirstNodeTagId)) {
|
||||
// throw new RuntimeException("查询任务树异常");
|
||||
// }
|
||||
//// if (StringUtils.isEmpty(realFirstNodeTagId)) {
|
||||
//// log.info("节点id:{}的{}的值为空", realFirstNode.getId(), realFirstTaskNodeTag.getValue());
|
||||
//// continue;
|
||||
//// }
|
||||
//
|
||||
// currentNodeDepth = realFirstNodeTagId.split(",").length;
|
||||
// List<ProjectNodePo> currentProjectNodeList = taskTreeProjectNodeMap.get(currentNodeDepth);
|
||||
// if (CollectionUtils.isEmpty(currentProjectNodeList)) {
|
||||
// currentProjectNodeList = new ArrayList<>();
|
||||
// }
|
||||
// currentProjectNodeList.add(realFirstNode);
|
||||
// taskTreeProjectNodeMap.put(currentNodeDepth,currentProjectNodeList);
|
||||
// maxNodeDepth = Math.max(maxNodeDepth, currentNodeDepth);
|
||||
// }
|
||||
|
||||
// int currentNodeDepth = 0;
|
||||
// for (ProjectNodePo eachNode : taskTreeNodeList) {
|
||||
// currentNodeDepth = getCurrentNodeDepth(eachNode);
|
||||
// List<ProjectNodePo> currentProjectNodeList = taskTreeProjectNodeMap.get(currentNodeDepth);
|
||||
// if (CollectionUtils.isEmpty(currentProjectNodeList)) {
|
||||
// currentProjectNodeList = new ArrayList<>();
|
||||
// }
|
||||
// currentProjectNodeList.add(eachNode);
|
||||
// taskTreeProjectNodeMap.put(currentNodeDepth,currentProjectNodeList);
|
||||
// }
|
||||
|
||||
taskTreeProjectNodeMap = taskTreeNodeList.stream().collect(Collectors.groupingBy(ProjectNodePo::getNodeType));
|
||||
|
||||
List<ProjectNodePo> realTopProjectNodeList = taskTreeNodeList.stream().filter(node -> node.getNodeType().equals(realFirstTaskNodeType)).toList();
|
||||
for (ProjectNodePo projectNodePo : realTopProjectNodeList) {
|
||||
generateTaskTree(projectNodePo);
|
||||
}
|
||||
return SdmResponse.success(realTopProjectNodeList);
|
||||
return SdmResponse.success(realTopProjectNodeList.stream().flatMap(item -> item.getChildren().stream().filter(Objects::nonNull)).toList());
|
||||
}
|
||||
|
||||
private int getCurrentNodeDepth(NodeAllBase eachNode) {
|
||||
@@ -495,21 +400,12 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
if (StringUtils.isBlank(nodeTagId)) {
|
||||
return false;
|
||||
}
|
||||
return node.getNodeType().equals(currentNodeType) && nodeTagId.contains(finalCurrentNodeTagId) && (finalCurrentNodeTagId.split(",").length == depth + 1);
|
||||
return node.getNodeType().equals(currentNodeType) && nodeTagId.contains(finalCurrentNodeTagId) && (nodeTagId.split(",").length == depth + 1);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
// 再查不同类型的节点:下一标签下的节点
|
||||
// int childrenIndex = 0;
|
||||
// String childrenNodeType = "";
|
||||
// for (int i = 0; i < taskTreeTagMap.size(); i++) {
|
||||
// if (taskTreeTagMap.get(i).getKey().equals(currentNodeType)) {
|
||||
//// childrenIndex = Math.min(i+1, taskTreeTagMap.size() - 1);
|
||||
// childrenNodeType = taskTreeTagMap.get(Math.min(i+1, taskTreeTagMap.size() - 1)).getKey();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
List<ProjectNodePo> childrenTypeNodeList = taskTreeNodeList.stream().filter(node -> {
|
||||
try {
|
||||
String nodeTagId = getTagProperty(node, currentTag);
|
||||
@@ -522,11 +418,6 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
// List<ProjectNodePo> childrenTypeNodeList = taskTreeProjectNodeMap.get(childrenNodeType);
|
||||
// childrenIndex = 0,说明没有不同类型的子节点了
|
||||
// if (childrenIndex > 0) {
|
||||
// childrenTypeNodeList = taskTreeProjectNodeMap.get(childrenIndex);
|
||||
// }
|
||||
if (CollectionUtils.isNotEmpty(sameTypeNodeList)) {
|
||||
// 递归
|
||||
for (ProjectNodePo nodePo : sameTypeNodeList) {
|
||||
@@ -546,22 +437,12 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
children.addAll(childrenTypeNodeList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(currentNodeAssociatedTaskList)) {
|
||||
currentNodeAssociatedTaskList.forEach(task -> task.setNodeName(task.getTaskName()));
|
||||
children.addAll(currentNodeAssociatedTaskList);
|
||||
}
|
||||
projectNodePo.setChildren(children);
|
||||
}
|
||||
|
||||
private List<ProjectNodePo> getNodeList(List<ProjectNodePo> nodeList, String tag, Map<String, String> nodeTypeMap) {
|
||||
switch (tag) {
|
||||
case TagConstant.TAG1:
|
||||
nodeList = nodeList.stream().filter(node -> node.getNodeType().equals(nodeTypeMap.get(TagConstant.TAG1))).collect(Collectors.toList());
|
||||
|
||||
|
||||
}
|
||||
|
||||
return nodeList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delete(SpdmDeleteProjectReq req) {
|
||||
List<SpdmDeleteProjectDetailReq> deleteNodeList = req.getDeleteNodeList();
|
||||
@@ -569,18 +450,19 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
log.error("参数不能为空");
|
||||
return SdmResponse.failed("参数不能为空");
|
||||
}
|
||||
List<SpdmDeleteProjectDetailReq> nodeList = deleteNodeList.stream().filter(node -> SystemConstants.PROJECT_TAG.equals(node.getNodeType()) || SystemConstants.PHASE_TAG.equals(node.getNodeType()) ||
|
||||
SystemConstants.MACHINE_TAG.equals(node.getNodeType()) || SystemConstants.WORKSPACE_TAG.equals(node.getNodeType()) || SystemConstants.DISCIPLINE_TAG.equals(node.getNodeType())).toList();
|
||||
List<SpdmDeleteProjectDetailReq> nodeList = deleteNodeList.stream().filter(node -> !SystemConstants.TASK_TAG.equals(node.getNodeType()) && !SystemConstants.PERFORMANCE_TAG.equals(node.getNodeType())).toList();
|
||||
List<SpdmDeleteProjectDetailReq> taskList = deleteNodeList.stream().filter(node -> SystemConstants.TASK_TAG.equals(node.getNodeType())).toList();
|
||||
List<SpdmDeleteProjectDetailReq> performanceList = deleteNodeList.stream().filter(node -> SystemConstants.PERFORMANCE_TAG.equals(node.getNodeType())).toList();
|
||||
if (CollectionUtils.isNotEmpty(performanceList)) {
|
||||
List<String> performanceNodeIdList = performanceList.stream().map(SpdmDeleteProjectDetailReq::getUuid).toList();
|
||||
log.info("删除指标:{}",performanceNodeIdList);
|
||||
mapper.deletePerformanceList(performanceNodeIdList);
|
||||
mapper.deletePerformanceExtraList(performanceNodeIdList);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||
List<String> taskIdList = taskList.stream().map(SpdmDeleteProjectDetailReq::getUuid).toList();
|
||||
log.info("删除分析项:{}",taskIdList);
|
||||
mapper.deleteTaskList(taskIdList);
|
||||
mapper.deleteTaskExtraList(taskIdList);
|
||||
mapper.deleteTaskMemberList(taskIdList);
|
||||
@@ -588,6 +470,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
|
||||
if (CollectionUtils.isNotEmpty(nodeList)) {
|
||||
List<String> nodeIdList = nodeList.stream().map(SpdmDeleteProjectDetailReq::getUuid).toList();
|
||||
log.info("删除节点:{}",nodeIdList);
|
||||
mapper.deleteNodeList(nodeIdList);
|
||||
mapper.deleteNodeExtraList(nodeIdList);
|
||||
mapper.deleteNodeMemberList(nodeIdList);
|
||||
@@ -1033,15 +916,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
tag1List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag1List)) {
|
||||
// projectNode.setTags1(String.join(",", tag1List));
|
||||
projectNode.setTag1(tag1List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// projectNode.setTags1(String.join(",",tag1List));
|
||||
// }
|
||||
}
|
||||
|
||||
List<String> tag2List = projectNode.getTag2();
|
||||
@@ -1056,15 +935,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
tag2List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag2List)) {
|
||||
// projectNode.setTags2(String.join(",", tag2List));
|
||||
projectNode.setTag2(tag2List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// projectNode.setTags2(String.join(",",tag2List));
|
||||
// }
|
||||
}
|
||||
|
||||
List<String> tag3List = projectNode.getTag3();
|
||||
@@ -1079,16 +954,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
tag3List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag3List)) {
|
||||
// projectNode.setTags3(String.join(",", tag3List));
|
||||
projectNode.setTag3(tag3List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// projectNode.setTags3(String.join(",",tag3List));
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
List<String> tag4List = projectNode.getTag4();
|
||||
@@ -1103,15 +973,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
tag4List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag4List)) {
|
||||
// projectNode.setTags4(String.join(",", tag4List));
|
||||
projectNode.setTag4(tag4List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// projectNode.setTags4(String.join(",",tag4List));
|
||||
// }
|
||||
}
|
||||
|
||||
List<String> tag5List = projectNode.getTag5();
|
||||
@@ -1126,15 +992,106 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
tag5List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag5List)) {
|
||||
// projectNode.setTags5(String.join(",", tag5List));
|
||||
projectNode.setTag5(tag5List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// projectNode.setTags5(String.join(",",tag5List));
|
||||
// }
|
||||
}
|
||||
|
||||
List<String> tag6List = projectNode.getTag6();
|
||||
if (CollectionUtils.isNotEmpty(tag6List)) {
|
||||
if (tag6List.contains(null)) {
|
||||
tag6List = tag6List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag6".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag6List)) {
|
||||
tag6List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag6List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag6List)) {
|
||||
projectNode.setTag6(tag6List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag7List = projectNode.getTag7();
|
||||
if (CollectionUtils.isNotEmpty(tag7List)) {
|
||||
if (tag7List.contains(null)) {
|
||||
tag7List = tag7List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag7".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag7List)) {
|
||||
tag7List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag7List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag7List)) {
|
||||
projectNode.setTag7(tag7List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag8List = projectNode.getTag8();
|
||||
if (CollectionUtils.isNotEmpty(tag8List)) {
|
||||
if (tag8List.contains(null)) {
|
||||
tag8List = tag8List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag8".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag8List)) {
|
||||
tag8List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag8List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag8List)) {
|
||||
projectNode.setTag8(tag8List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag9List = projectNode.getTag9();
|
||||
if (CollectionUtils.isNotEmpty(tag9List)) {
|
||||
if (tag9List.contains(null)) {
|
||||
tag9List = tag9List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag9".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag9List)) {
|
||||
tag9List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag9List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag9List)) {
|
||||
projectNode.setTag9(tag9List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag10List = projectNode.getTag10();
|
||||
if (CollectionUtils.isNotEmpty(tag10List)) {
|
||||
if (tag10List.contains(null)) {
|
||||
tag10List = tag10List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag10".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag10List)) {
|
||||
tag10List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag10List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag10List)) {
|
||||
projectNode.setTag10(tag10List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1242,6 +1199,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
if (CollectionUtils.isEmpty(taskNodeTree.getNodeList())) {
|
||||
response = SdmResponse.failed("节点不能为空");
|
||||
} else {
|
||||
String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
List<TaskNode> projectNodeList = new ArrayList<>();
|
||||
List<TaskMemberNode> projectNodeMemberList = new ArrayList<>();
|
||||
List<TaskExtraNode> projectNodeExtraList = new ArrayList<>();
|
||||
@@ -1250,9 +1208,204 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
List<TaskExtraNode> taskNodeExtraList = new ArrayList<>();
|
||||
List<TaskNode> projectNodePerformanceList = new ArrayList<>();
|
||||
List<TaskExtraNode> projectNodePerformanceExtraList = new ArrayList<>();
|
||||
List<String> newAllProjectNodeList = new ArrayList<>();
|
||||
List<TaskNode> eachProjectNodeList = new ArrayList<>();
|
||||
for (TaskNode taskNode : taskNodeTree.getNodeList()) {
|
||||
currentTopNodeType = taskNode.getNodeType();
|
||||
traverseTaskNode(taskNode.getPid(), tenantId, VersionEnum.INITIAL.getCode(), taskNode, projectNodeList, projectNodeMemberList, projectNodeExtraList, taskNodeList, taskNodeMemberList, taskNodeExtraList, projectNodePerformanceList, projectNodePerformanceExtraList, tagList);
|
||||
eachProjectNodeList = projectNodeList.stream().filter(node -> !newAllProjectNodeList.contains(node.getUuid())).toList();
|
||||
newAllProjectNodeList.addAll(eachProjectNodeList.stream().map(TaskNode::getUuid).toList());
|
||||
for (TaskNode projectNode : eachProjectNodeList) {
|
||||
List<String> tag1List = projectNode.getTag1();
|
||||
if (CollectionUtils.isNotEmpty(tag1List)) {
|
||||
if (tag1List.contains(null)) {
|
||||
tag1List = tag1List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag1".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag1List)) {
|
||||
tag1List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag1List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag1List)) {
|
||||
projectNode.setTag1(tag1List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag2List = projectNode.getTag2();
|
||||
if (CollectionUtils.isNotEmpty(tag2List)) {
|
||||
if (tag2List.contains(null)) {
|
||||
tag2List = tag2List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag2".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag2List)) {
|
||||
tag2List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag2List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag2List)) {
|
||||
projectNode.setTag2(tag2List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag3List = projectNode.getTag3();
|
||||
if (CollectionUtils.isNotEmpty(tag3List)) {
|
||||
if (tag3List.contains(null)) {
|
||||
tag3List = tag3List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag3".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag3List)) {
|
||||
tag3List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag3List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag3List)) {
|
||||
projectNode.setTag3(tag3List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag4List = projectNode.getTag4();
|
||||
if (CollectionUtils.isNotEmpty(tag4List)) {
|
||||
if (tag4List.contains(null)) {
|
||||
tag4List = tag4List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag4".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag4List)) {
|
||||
tag4List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag4List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag4List)) {
|
||||
projectNode.setTag4(tag4List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag5List = projectNode.getTag5();
|
||||
if (CollectionUtils.isNotEmpty(tag5List)) {
|
||||
if (tag5List.contains(null)) {
|
||||
tag5List = tag5List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag5".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag5List)) {
|
||||
tag5List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag5List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag5List)) {
|
||||
projectNode.setTag5(tag5List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag6List = projectNode.getTag6();
|
||||
if (CollectionUtils.isNotEmpty(tag6List)) {
|
||||
if (tag6List.contains(null)) {
|
||||
tag6List = tag6List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag6".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag6List)) {
|
||||
tag6List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag6List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag6List)) {
|
||||
projectNode.setTag6(tag6List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag7List = projectNode.getTag7();
|
||||
if (CollectionUtils.isNotEmpty(tag7List)) {
|
||||
if (tag7List.contains(null)) {
|
||||
tag7List = tag7List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag7".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag7List)) {
|
||||
tag7List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag7List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag7List)) {
|
||||
projectNode.setTag7(tag7List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag8List = projectNode.getTag8();
|
||||
if (CollectionUtils.isNotEmpty(tag8List)) {
|
||||
if (tag8List.contains(null)) {
|
||||
tag8List = tag8List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag8".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag8List)) {
|
||||
tag8List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag8List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag8List)) {
|
||||
projectNode.setTag8(tag8List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag9List = projectNode.getTag9();
|
||||
if (CollectionUtils.isNotEmpty(tag9List)) {
|
||||
if (tag9List.contains(null)) {
|
||||
tag9List = tag9List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag9".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag9List)) {
|
||||
tag9List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag9List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag9List)) {
|
||||
projectNode.setTag9(tag9List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<String> tag10List = projectNode.getTag10();
|
||||
if (CollectionUtils.isNotEmpty(tag10List)) {
|
||||
if (tag10List.contains(null)) {
|
||||
tag10List = tag10List.stream().filter(ObjectUtils::isNotEmpty).collect(Collectors.toList());
|
||||
for (TaskNodeTag taskNodeTag : tagList) {
|
||||
if ("Tag10".equals(taskNodeTag.getValue())) {
|
||||
if (CollectionUtils.isNotEmpty(tag10List)) {
|
||||
tag10List.addAll(idMap.get(taskNodeTag.getKey()));
|
||||
} else {
|
||||
tag10List = idMap.get(taskNodeTag.getKey());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(tag10List)) {
|
||||
projectNode.setTag10(tag10List);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
idMap.clear();
|
||||
}
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -1261,47 +1414,47 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
Map<String, TaskNode> taskNodeMap = Map.of();
|
||||
if (CollectionUtils.isNotEmpty(projectNodeList)) {
|
||||
// 设置节点的tag信息
|
||||
if (CollectionUtils.isNotEmpty(tagMap)) {
|
||||
List<TaskNode> currentNodeList;
|
||||
for (TaskNodeTag tagReq : tagMap) {
|
||||
String currentNodeType = tagReq.getKey();
|
||||
log.info("当前nodeType为:{},tag为:{}", currentNodeType, tagReq.getValue());
|
||||
currentNodeList = projectNodeList.stream().filter(node -> node.getNodeType().equals(currentNodeType)).toList();
|
||||
if (CollectionUtils.isEmpty(currentNodeList)) {
|
||||
log.error("newRealAddSimulationTaskItems中不存在{}类型的节点", currentNodeType);
|
||||
continue;
|
||||
}
|
||||
List<String> currentNodeIdList = new ArrayList<>();
|
||||
for (TaskNode addNode : currentNodeList) {
|
||||
if (MapUtils.isNotEmpty(projectIdMap)) {
|
||||
for (Map.Entry<String, List<String>> entry : projectIdMap.entrySet()) {
|
||||
// 之前的tag
|
||||
String preTag = entry.getKey();
|
||||
log.info("preTag为:{}", preTag);
|
||||
try {
|
||||
setTagProperty(addNode, preTag, entry.getValue());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// addNode.setUuid(RandomUtil.generateString(32));
|
||||
addNode.setCreateTime(createTime);
|
||||
addNode.setCreator(jobNumber);
|
||||
addNode.setTenantId(tenantId);
|
||||
try {
|
||||
setTagProperty(addNode, tagReq.getValue(), Collections.singletonList(addNode.getUuid()));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
currentNodeIdList.add(addNode.getUuid());
|
||||
}
|
||||
projectIdMap.put(tagReq.getValue(), currentNodeIdList);
|
||||
}
|
||||
}
|
||||
// if (CollectionUtils.isNotEmpty(tagMap)) {
|
||||
// List<TaskNode> currentNodeList;
|
||||
// for (TaskNodeTag tagReq : tagMap) {
|
||||
// String currentNodeType = tagReq.getKey();
|
||||
// log.info("当前nodeType为:{},tag为:{}", currentNodeType, tagReq.getValue());
|
||||
// currentNodeList = projectNodeList.stream().filter(node -> node.getNodeType().equals(currentNodeType)).toList();
|
||||
// if (CollectionUtils.isEmpty(currentNodeList)) {
|
||||
// log.error("newRealAddSimulationTaskItems中不存在{}类型的节点", currentNodeType);
|
||||
// continue;
|
||||
// }
|
||||
// List<String> currentNodeIdList = new ArrayList<>();
|
||||
// for (TaskNode addNode : currentNodeList) {
|
||||
// if (MapUtils.isNotEmpty(projectIdMap)) {
|
||||
// for (Map.Entry<String, List<String>> entry : projectIdMap.entrySet()) {
|
||||
// // 之前的tag
|
||||
// String preTag = entry.getKey();
|
||||
// log.info("preTag为:{}", preTag);
|
||||
// try {
|
||||
// setTagProperty(addNode, preTag, entry.getValue());
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//// addNode.setUuid(RandomUtil.generateString(32));
|
||||
// addNode.setCreateTime(createTime);
|
||||
// addNode.setCreator(jobNumber);
|
||||
// addNode.setTenantId(tenantId);
|
||||
// try {
|
||||
// setTagProperty(addNode, tagReq.getValue(), Collections.singletonList(addNode.getUuid()));
|
||||
// } catch (Exception e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// currentNodeIdList.add(addNode.getUuid());
|
||||
// }
|
||||
// projectIdMap.put(tagReq.getValue(), currentNodeIdList);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// projectNodeList.forEach(projectNode -> projectNode.setCreateTime(createTime));
|
||||
projectNodeList.forEach(node -> node.setCreateTime(curDateStr));
|
||||
|
||||
if (mapper.batchAddSimulationNodes(projectNodeList) <= 0) {
|
||||
response = SdmResponse.failed("添加节点失败");
|
||||
@@ -1873,6 +2026,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
return SdmResponse.failed("新增任务、分析项失败!");
|
||||
}
|
||||
} else if (CollectionUtils.isNotEmpty(deleteNodeList)) {
|
||||
log.info("删除节点参数为:{}",deleteNodeList);
|
||||
SpdmDeleteProjectReq spdmDeleteProjectReq = new SpdmDeleteProjectReq();
|
||||
spdmDeleteProjectReq.setDeleteNodeList(deleteNodeList);
|
||||
SdmResponse response = delete(spdmDeleteProjectReq);
|
||||
|
||||
@@ -31,6 +31,7 @@ import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -72,13 +73,17 @@ public class TaskServiceImpl implements ITaskService {
|
||||
List<SpdmTaskMemberVo> taskMemberVoList = mapper.getMemberList(taskIdList, null);
|
||||
Map<String, List<SpdmTaskMemberVo>> memberMap = Map.of();
|
||||
if (CollectionUtils.isNotEmpty(taskMemberVoList)) {
|
||||
// if (ObjectUtils.isNotEmpty(req.getPMemberIdList())) {
|
||||
// // 通过仿真负责人过滤
|
||||
// taskMemberVoList.stream().filter(member -> MemberTypeEnum.PRINCIPAL.getCode().equals(member.getType()) && member.getUserId())
|
||||
// }
|
||||
// if (StringUtils.isNotBlank(req.getEMemberList())) {
|
||||
// // 通过仿真执行人过滤
|
||||
// }
|
||||
if (ObjectUtils.isNotEmpty(req.getPMemberIdList())) {
|
||||
List<Long> pMemberIdList = Stream.of(req.getPMemberIdList().split(",")).map(Long::valueOf).toList();
|
||||
// 通过仿真负责人过滤
|
||||
taskMemberVoList = taskMemberVoList.stream().filter(member -> MemberTypeEnum.PRINCIPAL.getCode().equals(member.getType()) && pMemberIdList.contains(member.getUserId())).collect(Collectors.toList());
|
||||
}
|
||||
if (StringUtils.isNotBlank(req.getEMemberIdList())) {
|
||||
// 通过仿真执行人过滤
|
||||
List<Long> eMemberIdList = Stream.of(req.getEMemberIdList().split(",")).map(Long::valueOf).toList();
|
||||
// 通过仿真负责人过滤
|
||||
taskMemberVoList = taskMemberVoList.stream().filter(member -> MemberTypeEnum.EXECUTOR.getCode().equals(member.getType()) && eMemberIdList.contains(member.getUserId())).collect(Collectors.toList());
|
||||
}
|
||||
memberMap = taskMemberVoList.stream().collect(Collectors.groupingBy(SpdmTaskMemberVo::getTaskId));
|
||||
}
|
||||
List<SpdmTaskMemberVo> eachMemberList;
|
||||
|
||||
@@ -477,6 +477,7 @@
|
||||
<foreach collection='taskIdList' item='taskId' index='index' separator=','>
|
||||
#{taskId}
|
||||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<delete id="deleteNodeExtraList">
|
||||
|
||||
@@ -49,12 +49,15 @@
|
||||
<if test="req.taskName != null and req.taskName != ''">
|
||||
and task_name = #{req.taskName}
|
||||
</if>
|
||||
<if test="req.status != null and req.status != ''">
|
||||
and status = #{req.status}
|
||||
<if test="req.process != null and req.process != ''">
|
||||
and process = #{req.process}
|
||||
</if>
|
||||
<if test="req.achieveStatus != null and req.achieveStatus != ''">
|
||||
and achieve_status = #{req.achieveStatus}
|
||||
</if>
|
||||
<if test="req.finishTime != null and req.finishTime != ''">
|
||||
and finish_time = #{req.finishTime}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user