mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-01 03:28:59 +08:00
feat(用例管理): 脑图自定义字段保存调整
This commit is contained in:
parent
d4f37273fb
commit
4530788d66
@ -930,21 +930,19 @@ public class FunctionalCaseMinderService {
|
||||
|
||||
private List<FunctionalCaseCustomField> addCustomFields(FunctionalCaseChangeRequest functionalCaseChangeRequest, String caseId, FunctionalCaseCustomFieldMapper caseCustomFieldMapper, Map<String, Object> defaultValueMap) {
|
||||
List<CaseCustomFieldDTO> customFields = functionalCaseChangeRequest.getCustomFields();
|
||||
List<FunctionalCaseCustomField> caseCustomFields;
|
||||
if (CollectionUtils.isNotEmpty(customFields)) {
|
||||
customFields = customFields.stream().distinct().collect(Collectors.toList());
|
||||
caseCustomFields = saveCustomField(caseId, caseCustomFieldMapper, customFields);
|
||||
} else {
|
||||
List<CaseCustomFieldDTO> customFieldDTOs = new ArrayList<>();
|
||||
defaultValueMap.forEach((k,v)->{
|
||||
List<String> list = customFields.stream().map(CaseCustomFieldDTO::getFieldId).toList();
|
||||
List<CaseCustomFieldDTO> customFieldDTOs = new ArrayList<>();
|
||||
defaultValueMap.forEach((k, v) -> {
|
||||
if (!list.contains(k)) {
|
||||
CaseCustomFieldDTO customFieldDTO = new CaseCustomFieldDTO();
|
||||
customFieldDTO.setFieldId(k);
|
||||
customFieldDTO.setValue(v.toString());
|
||||
customFieldDTOs.add(customFieldDTO);
|
||||
});
|
||||
caseCustomFields = saveCustomField(caseId, caseCustomFieldMapper, customFieldDTOs);
|
||||
}
|
||||
return caseCustomFields;
|
||||
}
|
||||
});
|
||||
customFields.addAll(customFieldDTOs);
|
||||
customFields = customFields.stream().distinct().collect(Collectors.toList());
|
||||
return saveCustomField(caseId, caseCustomFieldMapper, customFields);
|
||||
}
|
||||
|
||||
private List<FunctionalCaseCustomField> saveCustomField(String caseId, FunctionalCaseCustomFieldMapper caseCustomFieldMapper, List<CaseCustomFieldDTO> customFields) {
|
||||
|
Loading…
Reference in New Issue
Block a user