From ec3fea34586d77aee47dcff2d79619edbb60a47d Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 17 Oct 2022 10:35:43 +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=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=A1=AB=E5=86=99=E6=95=B0=E5=AD=97=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=90=8E=E6=9C=AA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1018206 --user=陈建星 【测试跟踪】用例包含自定义字段,导出后字段内容为空 https://www.tapd.cn/55049933/s/1263227 --- .../java/io/metersphere/service/TestCaseService.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index c6b9fb5578..d6dd8309b9 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -1727,12 +1727,7 @@ public class TestCaseService { if (StringUtils.isNotBlank(field.getValue())) { Object value = JSON.parseObject(field.getValue()); Map optionMap = customSelectValueMap.get(id); - if (value instanceof String) { - if (MapUtils.isNotEmpty(optionMap) && optionMap.containsKey(value)) { - value = optionMap.get(value); - } - map.put(customNameMap.get(id), value.toString()); - } else if (value instanceof List) { + if (value instanceof List) { List results = new ArrayList<>(); List values = (List) value; values.forEach(item -> { @@ -1741,6 +1736,11 @@ public class TestCaseService { } }); map.put(customNameMap.get(id), results.toString()); + } else { + if (MapUtils.isNotEmpty(optionMap) && optionMap.containsKey(value)) { + value = optionMap.get(value); + } + map.put(customNameMap.get(id), value.toString()); } } }