杜洪波
13 小时以前 b5e34f70c46a3d08eae01d2948eba1f2840ae87e
src/main/java/com/product/face/service/FaceDesignService.java
@@ -34,6 +34,14 @@
   @Resource
   public PublicService publicService;
   public DataTableEntity listAllTable(){
      return getBaseDao().listTable("product_sys_datamodel_table", null, "table_type ASC");
   }
   public DataTableEntity listAllDesignFace(){
      return getBaseDao().listTable(FaceConst.TABLE_FACE_CONFIG);
   }
   /**
    * 获取表单配置详情
    *
@@ -51,10 +59,35 @@
      List<JSONObject> result = FaceUtil.getFaceControlList(fse, fieldPropertyDt);
      Map<String, Object> other = new HashMap<>();
      other.put("drawingList", result);
      DataTableEntity faceCustomField = fse.getSubDataTable("product_sys_face_custom_field");
      if (!DataTableEntity.isEmpty(faceCustomField)) {
         for (int i = 0; i < faceCustomField.getRows(); i++) {
            faceCustomField.setFieldValue(i, "customField", true);
            faceCustomField.setFieldValue(i, "added", true);
         }
         other.put("product_sys_face_custom_field", BaseUtil.dataTableEntityToJson(faceCustomField));
      } else {
         other.put("product_sys_face_custom_field", new String[]{});
      }
      fse.getSubData().clear();
      //大写字段值显示转换
//      fse.setValue("formRules", fse.getString("form_rules"));
//      fse.setValue("formModel", fse.getString("form_model"));
//      fse.setValue("labelWidth", fse.getString("label_width"));
      return BaseUtil.success(fse, other);
   }
   public class Pointer {
      int data = 0;
      public int getData() {
         return ++data;
      }
      public void setData(int data) {
         this.data = data;
      }
   }
   /**
    * 保存表单内容数据
@@ -71,17 +104,23 @@
         ErrorCode.SAVE_EMPTY_FACE_FAIL.throwException();
      }
      List<FieldSetEntity> fieldSetEntityList = new ArrayList<>();
      //声明一个带指针的int变量
      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");
            if(DataTableEntity.isEmpty(subDataTable)){
            if (DataTableEntity.isEmpty(subDataTable)) {
               continue;
            }
            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);
      //大写字段值保存转换
//      fse.setValue("form_rules", fse.getString("formRules"));
//      fse.setValue("form_model", fse.getString("formModel"));
//      fse.setValue("label_width", fse.getString("labelWidth"));
      BaseUtil.createCreatorAndCreationTime(fse);
      fields.setData(fieldSetEntityList);
      fse.addSubDataTable(fields);
@@ -97,7 +136,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) {
@@ -106,7 +145,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();
@@ -121,9 +160,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解决(本身是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();
@@ -135,7 +178,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);
            }