From 6a59a3f163d4a145f4ccd41d24ea61757db6d895 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Wed, 10 Jan 2024 10:48:10 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20ITSM-=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B7=A5=E5=8D=95=E4=B8=8A=E6=8A=A5=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=80=BC=E4=B8=8D=E5=90=88=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1062112657375232]ITSM-第三方工单上报表单组件值不合法 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1062112657375232 --- .../attribute/handler/CheckboxHandler.java | 3 +- .../form/attribute/handler/RadioHandler.java | 3 +- .../form/attribute/handler/SelectHandler.java | 3 +- .../framework/form/service/FormService.java | 3 +- .../form/service/FormServiceImpl.java | 34 ++++++++++++++----- 5 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java b/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java index b8b2bb94b..9c4357aac 100644 --- a/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java +++ b/src/main/java/neatlogic/module/framework/form/attribute/handler/CheckboxHandler.java @@ -19,7 +19,6 @@ package neatlogic.module.framework.form.attribute.handler; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import neatlogic.framework.common.constvalue.ParamType; -import neatlogic.framework.common.dto.ValueTextVo; import neatlogic.framework.form.attribute.core.FormHandlerBase; import neatlogic.framework.form.constvalue.FormConditionModel; import neatlogic.framework.form.constvalue.FormHandler; @@ -92,7 +91,7 @@ public class CheckboxHandler extends FormHandlerBase { @Override public Object textConversionValue(Object text, JSONObject config) { - List list = formService.textConversionValueForSelectHandler(text, config); + JSONArray list = formService.textConversionValueForSelectHandler(text, config); if (CollectionUtils.isEmpty(list)) { return null; } diff --git a/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java b/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java index f5db49074..c30d0b8c4 100644 --- a/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java +++ b/src/main/java/neatlogic/module/framework/form/attribute/handler/RadioHandler.java @@ -19,7 +19,6 @@ package neatlogic.module.framework.form.attribute.handler; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import neatlogic.framework.common.constvalue.ParamType; -import neatlogic.framework.common.dto.ValueTextVo; import neatlogic.framework.form.attribute.core.FormHandlerBase; import neatlogic.framework.form.constvalue.FormConditionModel; import neatlogic.framework.form.constvalue.FormHandler; @@ -109,7 +108,7 @@ public class RadioHandler extends FormHandlerBase { @Override public Object textConversionValue(Object text, JSONObject config) { - List list = formService.textConversionValueForSelectHandler(text, config); + JSONArray list = formService.textConversionValueForSelectHandler(text, config); if (CollectionUtils.isNotEmpty(list)) { return list.get(0); } diff --git a/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java b/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java index a04abdf67..a8776431e 100644 --- a/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java +++ b/src/main/java/neatlogic/module/framework/form/attribute/handler/SelectHandler.java @@ -19,7 +19,6 @@ package neatlogic.module.framework.form.attribute.handler; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import neatlogic.framework.common.constvalue.ParamType; -import neatlogic.framework.common.dto.ValueTextVo; import neatlogic.framework.form.attribute.core.FormHandlerBase; import neatlogic.framework.form.constvalue.FormConditionModel; import neatlogic.framework.form.constvalue.FormHandler; @@ -203,7 +202,7 @@ public class SelectHandler extends FormHandlerBase { @Override public Object textConversionValue(Object text, JSONObject config) { - List list = formService.textConversionValueForSelectHandler(text, config); + JSONArray list = formService.textConversionValueForSelectHandler(text, config); if (CollectionUtils.isEmpty(list)) { return null; } diff --git a/src/main/java/neatlogic/module/framework/form/service/FormService.java b/src/main/java/neatlogic/module/framework/form/service/FormService.java index cc44a615e..577c97ef0 100644 --- a/src/main/java/neatlogic/module/framework/form/service/FormService.java +++ b/src/main/java/neatlogic/module/framework/form/service/FormService.java @@ -18,7 +18,6 @@ package neatlogic.module.framework.form.service; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import neatlogic.framework.common.dto.ValueTextVo; import neatlogic.framework.form.dto.AttributeDataVo; import neatlogic.framework.form.dto.FormAttributeVo; import neatlogic.framework.form.dto.FormVersionVo; @@ -45,7 +44,7 @@ public interface FormService { */ JSONArray staticListPasswordEncrypt(JSONArray data, JSONObject config); - List textConversionValueForSelectHandler(Object text, JSONObject config); + JSONArray textConversionValueForSelectHandler(Object text, JSONObject config); /** * 校验表单数据有效性,并针对特殊组件数据进行相应处理,如密码类型组件对数据进行加密处理 diff --git a/src/main/java/neatlogic/module/framework/form/service/FormServiceImpl.java b/src/main/java/neatlogic/module/framework/form/service/FormServiceImpl.java index ac4146ab1..8bfcd46a3 100644 --- a/src/main/java/neatlogic/module/framework/form/service/FormServiceImpl.java +++ b/src/main/java/neatlogic/module/framework/form/service/FormServiceImpl.java @@ -333,8 +333,8 @@ public class FormServiceImpl implements FormService, IFormCrossoverService { } @Override - public List textConversionValueForSelectHandler(Object text, JSONObject config) { - List valueList = new ArrayList<>(); + public JSONArray textConversionValueForSelectHandler(Object text, JSONObject config) { + JSONArray valueList = new JSONArray(); if (text == null) { return valueList; } @@ -350,7 +350,10 @@ public class FormServiceImpl implements FormService, IFormCrossoverService { String textStr = (String) text; Object value = valueTextMap.get(textStr); if (value != null) { - valueList.add(new ValueTextVo(value, textStr)); + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", value); + jsonObj.put("text", textStr); + valueList.add(jsonObj); } return valueList; } else if (text instanceof List) { @@ -361,7 +364,10 @@ public class FormServiceImpl implements FormService, IFormCrossoverService { for (String textStr : textList) { Object value = valueTextMap.get(textStr); if (value != null) { - valueList.add(new ValueTextVo(value, textStr)); + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", value); + jsonObj.put("text", textStr); + valueList.add(jsonObj); } } return valueList; @@ -379,12 +385,18 @@ public class FormServiceImpl implements FormService, IFormCrossoverService { if (text instanceof String) { String textStr = (String) text; if (Objects.equals(mapping.getText(), mapping.getValue())) { - valueList.add(new ValueTextVo(textStr, textStr)); + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", textStr); + jsonObj.put("text", textStr); + valueList.add(jsonObj); return valueList; } String value = getValue(matrixUuid, mapping, textStr); if (value != null) { - valueList.add(new ValueTextVo(value, textStr)); + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", value); + jsonObj.put("text", textStr); + valueList.add(jsonObj); } return valueList; } else if (text instanceof List) { @@ -394,11 +406,17 @@ public class FormServiceImpl implements FormService, IFormCrossoverService { } for (String textStr : textList) { if (Objects.equals(mapping.getText(), mapping.getValue())) { - valueList.add(new ValueTextVo(textStr, textStr)); + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", textStr); + jsonObj.put("text", textStr); + valueList.add(jsonObj); } else { String value = getValue(matrixUuid, mapping, textStr); if (value != null) { - valueList.add(new ValueTextVo(value, textStr)); + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", value); + jsonObj.put("text", textStr); + valueList.add(jsonObj); } } } -- Gitee