fix(用例管理): 用例导入文件自定义字段未填,值未模板默认值

--bug=1036812 --user=王旭 【用例管理】功能用例-模板有设置自定义字段的默认值,Excel导入用例中自定义值是空,导入后数据是空 https://www.tapd.cn/55049933/s/1472056
This commit is contained in:
WangXu10 2024-03-08 17:22:59 +08:00 committed by 刘瑞斌
parent 65454ce818
commit db88c8d6fd
1 changed files with 11 additions and 4 deletions

View File

@ -1078,7 +1078,14 @@ public class FunctionalCaseService {
FunctionalCaseCustomField caseCustomField = new FunctionalCaseCustomField();
caseCustomField.setCaseId(caseId);
caseCustomField.setFieldId(templateCustomFieldDTO.getFieldId());
caseCustomField.setValue(v.toString());
if (StringUtils.equalsIgnoreCase(v.toString(), "[]")) {
//数组类型
caseCustomField.setValue(JSON.toJSONString(templateCustomFieldDTO.getDefaultValue()));
} else {
caseCustomField.setValue(StringUtils.defaultIfBlank(v.toString(),
Optional.ofNullable(templateCustomFieldDTO.getDefaultValue()).map(Object::toString).orElse(StringUtils.EMPTY)
));
}
customFieldMapper.insertSelective(caseCustomField);
}
});