diff --git a/backend/services/project-management/src/main/resources/init_message_task.json b/backend/services/project-management/src/main/resources/init_message_task.json index bca830ee64..153dfbc0cf 100644 --- a/backend/services/project-management/src/main/resources/init_message_task.json +++ b/backend/services/project-management/src/main/resources/init_message_task.json @@ -123,6 +123,34 @@ ] } ] + }, + { + "taskType":"TEST_PLAN_REPORT_TASK", + "taskTypeName":"", + "messageTaskDetailDTOList":[ + { + "event":"DELETE", + "eventName":"", + "receivers":[ + { + "id": "CREATE_USER", + "name": "" + } + ], + "projectRobotConfigList":[ + { + "robotId":"", + "enable":"", + "template":"", + "defaultTemplate":"", + "useDefaultTemplate":true, + "subject":"", + "defaultSubject":"", + "useDefaultSubject":true + } + ] + } + ] } ] }, diff --git a/backend/services/project-management/src/main/resources/message_task.json b/backend/services/project-management/src/main/resources/message_task.json index 2b4664b7ad..c0d8d62bdd 100644 --- a/backend/services/project-management/src/main/resources/message_task.json +++ b/backend/services/project-management/src/main/resources/message_task.json @@ -56,6 +56,78 @@ } ] }, + { + "event":"DELETE", + "eventName":"", + "receivers":[ + { + "id": "CREATE_USER", + "name": "" + } + ], + "projectRobotConfigList":[ + { + "robotId":"", + "enable":"", + "template":"", + "defaultTemplate":"", + "useDefaultTemplate":true, + "subject":"", + "defaultSubject":"", + "useDefaultSubject":true + } + ] + }, + { + "event":"EXECUTE_SUCCESSFUL", + "eventName":"", + "receivers":[ + { + "id": "CREATE_USER", + "name": "" + } + ], + "projectRobotConfigList":[ + { + "robotId":"", + "enable":"", + "template":"", + "defaultTemplate":"", + "useDefaultTemplate":true, + "subject":"", + "defaultSubject":"", + "useDefaultSubject":true + } + ] + }, + { + "event":"EXECUTE_FAILED", + "eventName":"", + "receivers":[ + { + "id": "CREATE_USER", + "name": "" + } + ], + "projectRobotConfigList":[ + { + "robotId":"", + "enable":"", + "template":"", + "defaultTemplate":"", + "useDefaultTemplate":true, + "subject":"", + "defaultSubject":"", + "useDefaultSubject":true + } + ] + } + ] + }, + { + "taskType":"TEST_PLAN_REPORT_TASK", + "taskTypeName":"", + "messageTaskDetailDTOList":[ { "event":"DELETE", "eventName":"", diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java index ef978a912b..a7eb775c52 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanCollectionMinderService.java @@ -290,10 +290,9 @@ public class TestPlanCollectionMinderService { //处理删除 deleteCollection(updateList, request.getPlanId()); //处理更新 - List collect = updateList.stream().filter(t -> t.getLevel() == 2).toList(); - for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : collect) { + for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : updateList) { TestPlanCollection testPlanCollection = updateCollection(request, userId, testPlanCollectionMinderEditDTO, parentMap, collectionMapper); - checkChangeDataRepeat(typeNamesMap, testPlanCollection); + checkChangeDataRepeat(typeNamesMap, testPlanCollectionMinderEditDTO); setAssociateMap(testPlanCollectionMinderEditDTO, associateMap, testPlanCollection); } } @@ -317,25 +316,29 @@ public class TestPlanCollectionMinderService { if (CollectionUtils.isNotEmpty(addList)) { for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : addList) { TestPlanCollection testPlanCollection = addCollection(request, userId, testPlanCollectionMinderEditDTO, parentMap, collectionMapper); - checkChangeDataRepeat(typeNamesMap, testPlanCollection); + checkChangeDataRepeat(typeNamesMap, testPlanCollectionMinderEditDTO); setAssociateMap(testPlanCollectionMinderEditDTO, associateMap, testPlanCollection); } } return typeNamesMap; } - private static void checkChangeDataRepeat(Map> typeNamesMap, TestPlanCollection testPlanCollection) { - List nameList = typeNamesMap.get(testPlanCollection.getType()); + private static void checkChangeDataRepeat(Map> typeNamesMap, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO) { + List nameList = typeNamesMap.get(testPlanCollectionMinderEditDTO.getType()); if (CollectionUtils.isNotEmpty(nameList)) { - if (nameList.contains(testPlanCollection.getName())) { + if (nameList.contains(testPlanCollectionMinderEditDTO.getText())) { throw new MSException(Translator.get("test_plan.mind.collection_name_repeat")); } else { - nameList.add(testPlanCollection.getName()); - typeNamesMap.put(testPlanCollection.getType(), nameList); + if (testPlanCollectionMinderEditDTO.getLevel() == 2) { + nameList.add(testPlanCollectionMinderEditDTO.getText()); + typeNamesMap.put(testPlanCollectionMinderEditDTO.getType(), nameList); + } } } else { - nameList = new ArrayList<>(List.of(testPlanCollection.getName())); - typeNamesMap.put(testPlanCollection.getType(), nameList); + if (testPlanCollectionMinderEditDTO.getLevel() == 2) { + nameList = new ArrayList<>(List.of(testPlanCollectionMinderEditDTO.getText())); + typeNamesMap.put(testPlanCollectionMinderEditDTO.getType(), nameList); + } } } @@ -346,6 +349,7 @@ public class TestPlanCollectionMinderService { for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : list) { TestPlanCollection testPlanCollection = new TestPlanCollection(); BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO); + testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText()); parentList.add(testPlanCollection); } return parentList.stream().collect(Collectors.groupingBy(TestPlanCollection::getType)); @@ -382,7 +386,6 @@ public class TestPlanCollectionMinderService { List testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType()); TestPlanCollection parent = null; TestPlanCollection testPlanCollection = new TestPlanCollection(); - testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText()); if (CollectionUtils.isNotEmpty(testPlanCollections)) { parent = testPlanCollections.get(0); testPlanCollection.setParentId(parent.getId()); @@ -394,6 +397,7 @@ public class TestPlanCollectionMinderService { } else { BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO); } + testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText()); testPlanCollection.setId(IDGenerator.nextStr()); testPlanCollection.setTestPlanId(request.getPlanId()); testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());