From cba4bc64b4c9de37abaf6a013036fc162e7e2d8d Mon Sep 17 00:00:00 2001 From: 6c <420680616@qq.com> Date: 星期一, 16 六月 2025 14:45:10 +0800 Subject: [PATCH] 移动端 人员选择字段未选,默认为0 bug解决(本身是false,但是数据库保存为0) --- src/main/java/com/product/face/service/FaceDesignService.java | 30 +++++++++++++++++++++++++----- 1 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/product/face/service/FaceDesignService.java b/src/main/java/com/product/face/service/FaceDesignService.java index 30ca858..bb32bdc 100644 --- a/src/main/java/com/product/face/service/FaceDesignService.java +++ b/src/main/java/com/product/face/service/FaceDesignService.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; import com.product.admin.service.PublicService; import com.product.common.lang.StringUtils; +import com.product.core.cache.DataPoolCacheImpl; import com.product.core.config.CoreConst; import com.product.core.entity.DataTableEntity; import com.product.core.entity.FieldSetEntity; @@ -17,6 +18,8 @@ import com.product.face.service.ide.IFaceDesignService; import com.product.face.util.FaceUtil; import com.product.util.BaseUtil; +import org.apache.poi.hdgf.pointers.Pointer; +import org.apache.poi.ss.formula.functions.T; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -65,6 +68,17 @@ return BaseUtil.success(fse, other); } + public class Pointer { + int data = 0; + + public int getData() { + return ++data; + } + + public void setData(int data) { + this.data = data; + } + } /** * 淇濆瓨琛ㄥ崟鍐呭鏁版嵁 @@ -81,6 +95,8 @@ ErrorCode.SAVE_EMPTY_FACE_FAIL.throwException(); } List<FieldSetEntity> fieldSetEntityList = new ArrayList<>(); + //澹版槑涓�涓甫鎸囬拡鐨刬nt鍙橀噺 + Pointer pointer = new Pointer(); for (int i = 0; i < fields.getRows(); i++) { if (fields.getBoolean(i, "event_property")) { DataTableEntity subDataTable = fields.getFieldSetEntity(i).getSubDataTable("event_array"); @@ -89,7 +105,7 @@ } fields.setFieldValue(i, "event_array", BaseUtil.dataTableEntityToJson(subDataTable)); } - fieldSetEntityList.addAll(controlTraverse(new JSONObject((Map) fields.getFieldSetEntity(i).getValues()), null, i)); + fieldSetEntityList.addAll(controlTraverse(new JSONObject((Map) fields.getFieldSetEntity(i).getValues()), null, i, pointer)); } fse.removeSubData(FaceConst.FACE_FIELD); BaseUtil.createCreatorAndCreationTime(fse); @@ -107,7 +123,7 @@ return fse; } - public List<FieldSetEntity> controlTraverse(Object o, String parentUuid, Integer sequence) { + public List<FieldSetEntity> controlTraverse(Object o, String parentUuid, Integer sequence, Pointer pointer) { List<FieldSetEntity> fieldSetList = new ArrayList<>(); try { if (o instanceof JSONArray) { @@ -116,7 +132,7 @@ try { for (int i = 0; i < jsonArray.size(); i++) { Object obj = jsonArray.get(i); - fieldSetList.addAll(controlTraverse(obj, parentUuid, i)); + fieldSetList.addAll(controlTraverse(obj, parentUuid, i, pointer)); } } catch (Exception e) { e.printStackTrace(); @@ -131,9 +147,13 @@ FieldSetEntity fs = getTemplateFieldSet(entry.getKey(), entry.getValue(), groupUuid); if (fs != null) { int propertyType = fs.getInteger(FaceConst.FIELD_PROPERTY_TYPE).intValue(); + // 2025骞�6鏈�16鏃� 14:28:39 绉诲姩绔� 浜哄憳閫夋嫨瀛楁鏈�夛紝榛樿涓�0 bug瑙e喅锛堟湰韬槸false锛屼絾鏄暟鎹簱淇濆瓨涓�0锛� + if (5 == propertyType && "defaultValue".equals(fs.getString("property_name")) && !fs.getBoolean("property_value")) { + continue; + } if ((4 == propertyType || 3 == propertyType) && (entry.getValue() instanceof JSONArray || entry.getValue() instanceof JSONObject)) { try { - fieldSetList.addAll(controlTraverse(entry.getValue(), fs.getUUID(), null)); + fieldSetList.addAll(controlTraverse(entry.getValue(), fs.getUUID(), null, pointer)); fs.remove(FaceConst.FIELD_PROPERTY_VALUE); } catch (Exception e) { e.printStackTrace(); @@ -145,7 +165,7 @@ } } if (sequence != null) { - FieldSetEntity fs = getTemplateFieldSet(FaceConst.CONTROL_SEQUENCE, sequence, groupUuid); + FieldSetEntity fs = getTemplateFieldSet(FaceConst.CONTROL_SEQUENCE, pointer.getData(), groupUuid); fs.setValue(FaceConst.FIELD_PARENT_UUID, parentUuid); fieldSetList.add(fs); } -- Gitblit v1.9.2