From 98905dd20f1585ca29fcfa19ad2302222bf436a3 Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 17 Apr 2024 19:56:27 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=87=AA=E5=AE=9A=E4=B9=89=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1036812 --user=王旭 【用例管理】功能用例-模板有设置自定义字段的默认值,Excel导入用例中自定义值是空,导入后数据是空 https://www.tapd.cn/55049933/s/1500263 --- .../functional/service/FunctionalCaseService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index e003e0205f..662c29c76e 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -46,6 +46,8 @@ import io.metersphere.system.log.service.OperationLogService; import io.metersphere.system.mapper.OperationHistoryMapper; import io.metersphere.system.mapper.UserMapper; import io.metersphere.system.notice.constants.NoticeConstants; +import io.metersphere.system.resolver.field.AbstractCustomFieldResolver; +import io.metersphere.system.resolver.field.CustomFieldResolverFactory; import io.metersphere.system.service.*; import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.NumGenerator; @@ -1189,7 +1191,11 @@ public class FunctionalCaseService { caseCustomField.setCaseId(caseId); caseCustomField.setFieldId(v.getFieldId()); Optional.ofNullable(value).ifPresentOrElse(v1 -> { - setCustomFieldValue(v1.toString(), caseCustomField); + if((v1.toString().length()==2&&StringUtils.equals(v1.toString(),"[]"))||!StringUtils.isNotBlank(v1.toString())){ + setCustomFieldValue(v.getDefaultValue(), caseCustomField); + }else{ + setCustomFieldValue(v1, caseCustomField); + } }, () -> { setCustomFieldValue(v.getDefaultValue(), caseCustomField); });