fix(测试跟踪): 功能用例导入用例状态校验不准确

--bug=1019038 --user=陈建星 【测试跟踪】模版管理-删除用例状态的未开始-导入的用例中有未开始状态-导入未报错 https://www.tapd.cn/55049933/s/1282558
This commit is contained in:
chenjianxing 2022-10-28 17:47:03 +08:00 committed by jianxing
parent dfdd77af97
commit 8e7975e77f
2 changed files with 7 additions and 12 deletions

View File

@ -17,7 +17,7 @@ public class CustomFieldMultipleSelectValidator extends CustomFieldSelectValidat
if (StringUtils.isBlank(value)) {
return;
}
prepareCatch(customField);
prepareCache(customField);
Set<String> idSet = optionValueSetCache.get(customField.getId());
Set<String> textSet = optionTextSetCache.get(customField.getId());
for (String item : parse2Array(customField.getName(), value)) {

View File

@ -45,7 +45,7 @@ public class CustomFieldSelectValidator extends AbstractCustomFieldValidator {
if (StringUtils.isBlank(value)) {
return;
}
prepareCatch(customField);
prepareCache(customField);
Set<String> idSet = optionValueSetCache.get(customField.getId());
Set<String> textSet = optionTextSetCache.get(customField.getId());
if (!idSet.contains(value) && !textSet.contains(value)) {
@ -68,7 +68,7 @@ public class CustomFieldSelectValidator extends AbstractCustomFieldValidator {
*
* @param customField
*/
protected void prepareCatch(CustomFieldDao customField) {
protected void prepareCache(CustomFieldDao customField) {
if (optionValueSetCache.get(customField.getId()) == null) {
List<CustomFieldOptionDTO> options = getOptions(customField.getId(), customField.getOptions());
@ -87,21 +87,16 @@ public class CustomFieldSelectValidator extends AbstractCustomFieldValidator {
*/
private void translateSystemOption(CustomFieldDao customField, List<CustomFieldOptionDTO> options) {
Map<String, String> fieldI18nMap = i18nMap.get(customField.getName());
// 不为空说明需要翻译
if (fieldI18nMap != null) {
// 不为空说明需要翻译
Iterator<CustomFieldOptionDTO> iterator = options.iterator();
// 先将系统字段删掉
// 替换成翻译后的值
while (iterator.hasNext()) {
CustomFieldOptionDTO option = iterator.next();
if (option.getSystem()) {
iterator.remove();
if (option.getSystem() && fieldI18nMap.keySet().contains(option.getValue())) {
option.setText(fieldI18nMap.get(option.getValue()));
}
}
// 再填充翻译后的值
for (String optionValue : fieldI18nMap.keySet()) {
CustomFieldOptionDTO option = new CustomFieldOptionDTO(optionValue, fieldI18nMap.get(optionValue), true);
options.add(option);
}
}
}