fix(功能用例): 修复用例脑图更新问题

This commit is contained in:
guoyuqi 2024-06-19 19:17:58 +08:00 committed by Craftsman
parent d5587f023e
commit 3fa5a7dc6e
2 changed files with 16 additions and 13 deletions

View File

@ -130,6 +130,7 @@ public class FunctionalCaseMinderService {
private static final String FUNCTIONAL_CASE = "functional_case";
private static final String FUNCTIONAL_CASE_MODULE = "functional_case_module";
private static final String CHECK_OWNER_CASE = "check_owner_case";
/**
* 功能用例-脑图用例列表查询
*
@ -1015,11 +1016,11 @@ public class FunctionalCaseMinderService {
//更新用例等级
CaseCustomFieldDTO customFieldDTO = new CaseCustomFieldDTO();
customFieldDTO.setFieldId(fieldId);
customFieldDTO.setValue("P"+(functionalCaseChangeRequest.getPriority()-1));
customFieldDTO.setValue("P" + (functionalCaseChangeRequest.getPriority() == 0 ? 0 : functionalCaseChangeRequest.getPriority() - 1));
customFields.add(customFieldDTO);
if (CollectionUtils.isNotEmpty(customFields)) {
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).toList();
Map<String, FunctionalCaseCustomField> collect = functionalCaseCustomFields.stream().filter(t -> fieldIds.contains(t.getFieldId())).collect(Collectors.toMap(FunctionalCaseCustomField::getFieldId, (item) -> item));
List<CaseCustomFieldDTO> addFields = new ArrayList<>();
List<CaseCustomFieldDTO> updateFields = new ArrayList<>();

View File

@ -183,7 +183,6 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
caseChangeRequest.setName("TEST_MINDER_MODULE_ID_GYQ_更新");
caseChangeRequest.setModuleId("TEST_MINDER_MODULE_ID_GYQ");
caseChangeRequest.setTemplateId("100001");
caseChangeRequest.setPriority(3);
caseChangeRequest.setMoveMode("BEFORE");
caseChangeRequest.setTargetId("TEST_FUNCTIONAL_MINDER_CASE_ID_2");
caseChangeRequest.setType("UPDATE");
@ -250,8 +249,11 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey("TEST_FUNCTIONAL_MINDER_CASE_ID_1");
System.out.println(functionalCase);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCase.getName(),"TEST_MINDER_MODULE_ID_GYQ_更新"));
FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample();
customFieldExample.createCriteria().andCaseIdEqualTo("TEST_FUNCTIONAL_MINDER_CASE_ID_1").andFieldIdEqualTo("custom_field_minder_gyq_id_3");
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P0"));
MindAdditionalNode mindAdditionalNode = mindAdditionalNodeMapper.selectByPrimaryKey("additional2");
Assertions.assertTrue(StringUtils.equalsIgnoreCase(mindAdditionalNode.getParentId(),"TEST_MINDER_MODULE_ID_GYQ"));
@ -262,9 +264,9 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
Assertions.assertTrue(functionalCases.get(0).getPos() > 0L);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample();
customFieldExample = new FunctionalCaseCustomFieldExample();
customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.get(0).getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3");
List<FunctionalCaseCustomField> functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);
Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCaseCustomFields.get(0).getValue(),"P2"));
FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample();
functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9");