fix(测试计划): 修复脑图保存根节点更新父节点更新错误问题
This commit is contained in:
parent
f1961d933e
commit
2f31cf385a
|
@ -663,13 +663,8 @@ public class FunctionalCaseMinderService {
|
||||||
//更新附属表信息
|
//更新附属表信息
|
||||||
FunctionalCaseBlob functionalCaseBlob = updateBlob(functionalCaseChangeRequest, caseId, caseBlobMapper);
|
FunctionalCaseBlob functionalCaseBlob = updateBlob(functionalCaseChangeRequest, caseId, caseBlobMapper);
|
||||||
//更新自定义字段
|
//更新自定义字段
|
||||||
List<FunctionalCaseCustomField> functionalCaseCustomFields = updateCustomFields(functionalCaseChangeRequest, oldCaseCustomFieldMap, caseId, caseCustomFieldMapper);
|
String fieldId = defaultCustomFieldValueMap.get("priorityFieldId").toString();
|
||||||
//更新用例等级
|
List<FunctionalCaseCustomField> functionalCaseCustomFields = updateCustomFields(functionalCaseChangeRequest, oldCaseCustomFieldMap, caseId, fieldId, caseCustomFieldMapper);
|
||||||
FunctionalCaseCustomField customField = new FunctionalCaseCustomField();
|
|
||||||
customField.setCaseId(caseId);
|
|
||||||
customField.setFieldId(defaultCustomFieldValueMap.get("priorityFieldId").toString());
|
|
||||||
customField.setValue("P"+(functionalCaseChangeRequest.getPriority()-1));
|
|
||||||
caseCustomFieldMapper.updateByPrimaryKeySelective(customField);
|
|
||||||
//日志
|
//日志
|
||||||
FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, functionalCaseBlob, oldCaseCustomFieldMap.get(caseId), new ArrayList<>(), new ArrayList<>());
|
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<>());
|
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;
|
return functionalCaseBlob;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<FunctionalCaseCustomField> updateCustomFields(FunctionalCaseChangeRequest functionalCaseChangeRequest, Map<String, List<FunctionalCaseCustomField>> caseCustomFieldMap, String caseId, FunctionalCaseCustomFieldMapper caseCustomFieldMapper) {
|
private List<FunctionalCaseCustomField> updateCustomFields(FunctionalCaseChangeRequest functionalCaseChangeRequest, Map<String, List<FunctionalCaseCustomField>> caseCustomFieldMap, String caseId,String fieldId, FunctionalCaseCustomFieldMapper caseCustomFieldMapper) {
|
||||||
List<FunctionalCaseCustomField> total = new ArrayList<>();
|
List<FunctionalCaseCustomField> total = new ArrayList<>();
|
||||||
List<FunctionalCaseCustomField> functionalCaseCustomFields = caseCustomFieldMap.get(caseId);
|
List<FunctionalCaseCustomField> functionalCaseCustomFields = caseCustomFieldMap.get(caseId);
|
||||||
if (CollectionUtils.isEmpty(functionalCaseCustomFields)) {
|
if (CollectionUtils.isEmpty(functionalCaseCustomFields)) {
|
||||||
functionalCaseCustomFields = new ArrayList<>();
|
functionalCaseCustomFields = new ArrayList<>();
|
||||||
}
|
}
|
||||||
List<CaseCustomFieldDTO> customFields = functionalCaseChangeRequest.getCustomFields();
|
List<CaseCustomFieldDTO> customFields = functionalCaseChangeRequest.getCustomFields();
|
||||||
|
//更新用例等级
|
||||||
|
CaseCustomFieldDTO customFieldDTO = new CaseCustomFieldDTO();
|
||||||
|
customFieldDTO.setFieldId(fieldId);
|
||||||
|
customFieldDTO.setValue("P"+(functionalCaseChangeRequest.getPriority()-1));
|
||||||
|
customFields.add(customFieldDTO);
|
||||||
if (CollectionUtils.isNotEmpty(customFields)) {
|
if (CollectionUtils.isNotEmpty(customFields)) {
|
||||||
customFields = customFields.stream().distinct().collect(Collectors.toList());
|
customFields = customFields.stream().distinct().collect(Collectors.toList());
|
||||||
List<String> fieldIds = customFields.stream().map(CaseCustomFieldDTO::getFieldId).collect(Collectors.toList());
|
List<String> fieldIds = customFields.stream().map(CaseCustomFieldDTO::getFieldId).collect(Collectors.toList());
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -251,6 +251,7 @@ public class TestPlanCollectionMinderService {
|
||||||
beansOfType.forEach((k, v) -> {
|
beansOfType.forEach((k, v) -> {
|
||||||
v.associateCollection(request.getPlanId(), associateMap, user);
|
v.associateCollection(request.getPlanId(), associateMap, user);
|
||||||
});
|
});
|
||||||
|
List<TestPlanCollection> testPlanCollections = testPlanCollectionMapper.selectByExample(new TestPlanCollectionExample());
|
||||||
//更新测试计划
|
//更新测试计划
|
||||||
testPlanService.refreshTestPlanStatus(request.getPlanId());
|
testPlanService.refreshTestPlanStatus(request.getPlanId());
|
||||||
}
|
}
|
||||||
|
@ -350,6 +351,7 @@ public class TestPlanCollectionMinderService {
|
||||||
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
||||||
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
|
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
|
||||||
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
|
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
|
||||||
|
testPlanCollection.setParentId(CommonConstants.DEFAULT_NULL_VALUE);
|
||||||
parentList.add(testPlanCollection);
|
parentList.add(testPlanCollection);
|
||||||
}
|
}
|
||||||
return parentList.stream().collect(Collectors.groupingBy(TestPlanCollection::getType));
|
return parentList.stream().collect(Collectors.groupingBy(TestPlanCollection::getType));
|
||||||
|
@ -358,18 +360,17 @@ public class TestPlanCollectionMinderService {
|
||||||
@NotNull
|
@NotNull
|
||||||
private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
|
private static TestPlanCollection updateCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
|
||||||
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
||||||
|
|
||||||
TestPlanCollection parent = parentMap.get(testPlanCollectionMinderEditDTO.getType()).get(0);
|
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()) {
|
if (testPlanCollectionMinderEditDTO.getExtended()) {
|
||||||
BeanUtils.copyBean(testPlanCollection, parent);
|
BeanUtils.copyBean(testPlanCollection, parent);
|
||||||
} else {
|
} else {
|
||||||
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
|
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.setName(testPlanCollectionMinderEditDTO.getText());
|
||||||
testPlanCollection.setTestPlanId(request.getPlanId());
|
testPlanCollection.setTestPlanId(request.getPlanId());
|
||||||
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
|
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
|
||||||
|
@ -384,23 +385,17 @@ public class TestPlanCollectionMinderService {
|
||||||
@NotNull
|
@NotNull
|
||||||
private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
|
private static TestPlanCollection addCollection(TestPlanCollectionMinderEditRequest request, String userId, TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO, Map<String, List<TestPlanCollection>> parentMap, TestPlanCollectionMapper collectionMapper) {
|
||||||
List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType());
|
List<TestPlanCollection> testPlanCollections = parentMap.get(testPlanCollectionMinderEditDTO.getType());
|
||||||
TestPlanCollection parent = null;
|
TestPlanCollection parent = testPlanCollections.get(0);
|
||||||
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
TestPlanCollection testPlanCollection = new TestPlanCollection();
|
||||||
if (CollectionUtils.isNotEmpty(testPlanCollections)) {
|
if (testPlanCollectionMinderEditDTO.getExtended()) {
|
||||||
parent = testPlanCollections.get(0);
|
|
||||||
testPlanCollection.setParentId(parent.getId());
|
|
||||||
} else {
|
|
||||||
testPlanCollection.setParentId(CommonConstants.DEFAULT_NULL_VALUE);
|
|
||||||
}
|
|
||||||
if (testPlanCollectionMinderEditDTO.getExtended() && parent!=null) {
|
|
||||||
BeanUtils.copyBean(testPlanCollection, parent);
|
BeanUtils.copyBean(testPlanCollection, parent);
|
||||||
} else {
|
} else {
|
||||||
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
|
BeanUtils.copyBean(testPlanCollection, testPlanCollectionMinderEditDTO);
|
||||||
}
|
}
|
||||||
|
testPlanCollection.setParentId(parent.getId());
|
||||||
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
|
testPlanCollection.setName(testPlanCollectionMinderEditDTO.getText());
|
||||||
testPlanCollection.setId(IDGenerator.nextStr());
|
testPlanCollection.setId(IDGenerator.nextStr());
|
||||||
testPlanCollection.setTestPlanId(request.getPlanId());
|
testPlanCollection.setTestPlanId(request.getPlanId());
|
||||||
testPlanCollection.setType(testPlanCollectionMinderEditDTO.getType());
|
|
||||||
testPlanCollection.setCreateUser(userId);
|
testPlanCollection.setCreateUser(userId);
|
||||||
testPlanCollection.setCreateTime(System.currentTimeMillis());
|
testPlanCollection.setCreateTime(System.currentTimeMillis());
|
||||||
testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum());
|
testPlanCollection.setPos(testPlanCollectionMinderEditDTO.getNum());
|
||||||
|
|
Loading…
Reference in New Issue