From 2f31cf385a5f814d6f2922017dd5c00e6be47ffc Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 19 Jun 2024 16:00:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=91=E5=9B=BE=E4=BF=9D=E5=AD=98=E6=A0=B9?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=9B=B4=E6=96=B0=E7=88=B6=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/FunctionalCaseMinderService.java | 16 +++--- .../src/main/resources/message_task.json | 57 +++++++++++++++++++ .../TestPlanCollectionMinderService.java | 25 ++++---- 3 files changed, 75 insertions(+), 23 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index 05db29d23c..168d0c665e 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -663,13 +663,8 @@ public class FunctionalCaseMinderService { //更新附属表信息 FunctionalCaseBlob functionalCaseBlob = updateBlob(functionalCaseChangeRequest, caseId, caseBlobMapper); //更新自定义字段 - List functionalCaseCustomFields = updateCustomFields(functionalCaseChangeRequest, oldCaseCustomFieldMap, caseId, caseCustomFieldMapper); - //更新用例等级 - FunctionalCaseCustomField customField = new FunctionalCaseCustomField(); - customField.setCaseId(caseId); - customField.setFieldId(defaultCustomFieldValueMap.get("priorityFieldId").toString()); - customField.setValue("P"+(functionalCaseChangeRequest.getPriority()-1)); - caseCustomFieldMapper.updateByPrimaryKeySelective(customField); + String fieldId = defaultCustomFieldValueMap.get("priorityFieldId").toString(); + List functionalCaseCustomFields = updateCustomFields(functionalCaseChangeRequest, oldCaseCustomFieldMap, caseId, fieldId, caseCustomFieldMapper); //日志 FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, functionalCaseBlob, oldCaseCustomFieldMap.get(caseId), new ArrayList<>(), new ArrayList<>()); FunctionalCaseHistoryLogDTO old = new FunctionalCaseHistoryLogDTO(oldCaseMap.get(caseId), oldBlobMap.get(caseId), new ArrayList<>(), new ArrayList<>(), new ArrayList<>()); @@ -1010,13 +1005,18 @@ public class FunctionalCaseMinderService { return functionalCaseBlob; } - private List updateCustomFields(FunctionalCaseChangeRequest functionalCaseChangeRequest, Map> caseCustomFieldMap, String caseId, FunctionalCaseCustomFieldMapper caseCustomFieldMapper) { + private List updateCustomFields(FunctionalCaseChangeRequest functionalCaseChangeRequest, Map> caseCustomFieldMap, String caseId,String fieldId, FunctionalCaseCustomFieldMapper caseCustomFieldMapper) { List total = new ArrayList<>(); List functionalCaseCustomFields = caseCustomFieldMap.get(caseId); if (CollectionUtils.isEmpty(functionalCaseCustomFields)) { functionalCaseCustomFields = new ArrayList<>(); } List customFields = functionalCaseChangeRequest.getCustomFields(); + //更新用例等级 + CaseCustomFieldDTO customFieldDTO = new CaseCustomFieldDTO(); + customFieldDTO.setFieldId(fieldId); + customFieldDTO.setValue("P"+(functionalCaseChangeRequest.getPriority()-1)); + customFields.add(customFieldDTO); if (CollectionUtils.isNotEmpty(customFields)) { customFields = customFields.stream().distinct().collect(Collectors.toList()); List fieldIds = customFields.stream().map(CaseCustomFieldDTO::getFieldId).collect(Collectors.toList()); 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 c0d8d62bdd..153dfbc0cf 100644 --- a/backend/services/project-management/src/main/resources/message_task.json +++ b/backend/services/project-management/src/main/resources/message_task.json @@ -1078,5 +1078,62 @@ ] } ] + }, + { + "projectId":"", + "type":"JENKINS_TASK_MANAGEMENT", + "name":"", + "messageTaskTypeDTOList":[ + { + "taskType":"JENKINS_TASK", + "taskTypeName":"", + "messageTaskDetailDTOList":[ + { + "event":"EXECUTE_SUCCESSFUL", + "eventName":"", + "receivers":[ + { + "id": "", + "name": "" + } + ], + "projectRobotConfigList":[ + { + "robotId":"", + "enable":"", + "template":"", + "defaultTemplate":"", + "useDefaultTemplate":true, + "subject":"", + "defaultSubject":"", + "useDefaultSubject":true + } + ] + }, + { + "event":"EXECUTE_FAILED", + "eventName":"", + "receivers":[ + { + "id": "", + "name": "" + } + ], + "projectRobotConfigList":[ + { + "robotId":"", + "enable":"", + "template":"", + "defaultTemplate":"", + "useDefaultTemplate":true, + "subject":"", + "defaultSubject":"", + "useDefaultSubject":true + } + ] + } + ] + } + ] } ] \ No newline at end of file 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 a7eb775c52..4001d7fdbe 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 @@ -251,6 +251,7 @@ public class TestPlanCollectionMinderService { beansOfType.forEach((k, v) -> { v.associateCollection(request.getPlanId(), associateMap, user); }); + List testPlanCollections = testPlanCollectionMapper.selectByExample(new TestPlanCollectionExample()); //更新测试计划 testPlanService.refreshTestPlanStatus(request.getPlanId()); } @@ -350,6 +351,7 @@ public class TestPlanCollectionMinderService { TestPlanCollection testPlanCollection = new TestPlanCollection(); BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO); testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText()); + testPlanCollection.setParentId(CommonConstants.DEFAULT_NULL_VALUE); parentList.add(testPlanCollection); } return parentList.stream().collect(Collectors.groupingBy(TestPlanCollection::getType)); @@ -358,18 +360,17 @@ public class TestPlanCollectionMinderService { @NotNull private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map> parentMap, TestPlanCollectionMapper collectionMapper) { TestPlanCollection testPlanCollection = new TestPlanCollection(); - TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).get(0); - if (StringUtils.equalsIgnoreCase(parent.getId(), testPlanCollectionMinderEditDTO.getId())) { - testPlanCollection.setParentId(parent.getParentId()); - } else { - testPlanCollection.setParentId(parent.getId()); - } if (testPlanCollectionMinderEditDTO.getExtended()) { BeanUtils.copyBean(testPlanCollection, parent); } else { BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO); } + if (StringUtils.equalsIgnoreCase(parent.getId(), testPlanCollectionMinderEditDTO.getId())) { + testPlanCollection.setParentId(parent.getParentId()); + } else { + testPlanCollection.setParentId(parent.getId()); + } testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText()); testPlanCollection.setTestPlanId(request.getPlanId()); testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType()); @@ -384,23 +385,17 @@ public class TestPlanCollectionMinderService { @NotNull private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map> parentMap, TestPlanCollectionMapper collectionMapper) { List testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType()); - TestPlanCollection parent = null; + TestPlanCollection parent = testPlanCollections.get(0); TestPlanCollection testPlanCollection = new TestPlanCollection(); - if (CollectionUtils.isNotEmpty(testPlanCollections)) { - parent = testPlanCollections.get(0); - testPlanCollection.setParentId(parent.getId()); - } else { - testPlanCollection.setParentId(CommonConstants.DEFAULT_NULL_VALUE); - } - if (testPlanCollectionMinderEditDTO.getExtended() && parent!=null) { + if (testPlanCollectionMinderEditDTO.getExtended()) { BeanUtils.copyBean(testPlanCollection, parent); } else { BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO); } + testPlanCollection.setParentId(parent.getId()); testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText()); testPlanCollection.setId(IDGenerator.nextStr()); testPlanCollection.setTestPlanId(request.getPlanId()); - testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType()); testPlanCollection.setCreateUser(userId); testPlanCollection.setCreateTime(System.currentTimeMillis()); testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum());