From 8e7975e77fdc5441bd247e5be051ce14dddb2100 Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Fri, 28 Oct 2022 17:47:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):=20?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=85=A5=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E7=8A=B6=E6=80=81=E6=A0=A1=E9=AA=8C=E4=B8=8D=E5=87=86?= =?UTF-8?q?=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019038 --user=陈建星 【测试跟踪】模版管理-删除用例状态的未开始-导入的用例中有未开始状态-导入未报错 https://www.tapd.cn/55049933/s/1282558 --- .../CustomFieldMultipleSelectValidator.java | 2 +- .../validate/CustomFieldSelectValidator.java | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldMultipleSelectValidator.java b/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldMultipleSelectValidator.java index 8c48581057..b2e3c71c7f 100644 --- a/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldMultipleSelectValidator.java +++ b/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldMultipleSelectValidator.java @@ -17,7 +17,7 @@ public class CustomFieldMultipleSelectValidator extends CustomFieldSelectValidat if (StringUtils.isBlank(value)) { return; } - prepareCatch(customField); + prepareCache(customField); Set idSet = optionValueSetCache.get(customField.getId()); Set textSet = optionTextSetCache.get(customField.getId()); for (String item : parse2Array(customField.getName(), value)) { diff --git a/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldSelectValidator.java b/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldSelectValidator.java index 09cbd19b33..674b76473d 100644 --- a/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldSelectValidator.java +++ b/test-track/backend/src/main/java/io/metersphere/validate/CustomFieldSelectValidator.java @@ -45,7 +45,7 @@ public class CustomFieldSelectValidator extends AbstractCustomFieldValidator { if (StringUtils.isBlank(value)) { return; } - prepareCatch(customField); + prepareCache(customField); Set idSet = optionValueSetCache.get(customField.getId()); Set 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 options = getOptions(customField.getId(), customField.getOptions()); @@ -87,21 +87,16 @@ public class CustomFieldSelectValidator extends AbstractCustomFieldValidator { */ private void translateSystemOption(CustomFieldDao customField, List options) { Map fieldI18nMap = i18nMap.get(customField.getName()); + // 不为空,说明需要翻译 if (fieldI18nMap != null) { - // 不为空,说明需要翻译 Iterator 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); - } } }