From 4d1360d7e91aa4d394eb4a35adea993a45c0d725 Mon Sep 17 00:00:00 2001
From: shicf <shi_chongfu@163.com>
Date: 星期四, 09 一月 2025 10:53:51 +0800
Subject: [PATCH] Merge branch 'dev' of http://nonxin.cn:8090/r/product/product-server-mobile-core/V2.0.0 into dev

---
 src/main/java/com/product/mobile/core/service/FaceMobileService.java |  137 +++++++++++++++++++++++++++++++++++++++------
 1 files changed, 118 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/product/mobile/core/service/FaceMobileService.java b/src/main/java/com/product/mobile/core/service/FaceMobileService.java
index 592931a..4f774d3 100644
--- a/src/main/java/com/product/mobile/core/service/FaceMobileService.java
+++ b/src/main/java/com/product/mobile/core/service/FaceMobileService.java
@@ -3,11 +3,14 @@
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.drew.metadata.Face;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.product.common.lang.StringUtils;
 import com.product.core.cache.DataPoolCacheImpl;
@@ -30,6 +33,7 @@
 import java.io.File;
 import java.nio.charset.Charset;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @Author cheng
@@ -120,6 +124,16 @@
 								!StringUtils.isEmpty(dt.getFieldSetEntity(0).getString("field_show_name"))) {
 							ls.get(i).setName(dt.getFieldSetEntity(0).getString("field_show_name"));
 						}
+						if ("file".indexOf(ls.get(i).getComponentType()) != -1) {
+							//闄勪欢
+							//鑾峰彇瀛楁绫诲瀷
+							String fieldType = dt.getString(0, "field_type");
+							if ("file-image".equals(fieldType)) {
+								ls.get(i).putOtherParam("fieldType", "image");
+							} else {
+//								ls.get(i).putOtherParam("fieldType", "file");
+							}
+						}
 					}
 					ls.get(i).setTable(table_name);
 				} else {
@@ -174,7 +188,9 @@
 			FieldSetEntity f = dte.getFieldSetEntity(j);
 			if ("pk".equals(f.getString("field_type"))
 					|| "updated_by".equals(f.getString("field_name"))
-					|| "updated_utc_datetime".equals(f.getString("field_name"))) {
+					|| "updated_utc_datetime".equals(f.getString("field_name"))
+					|| "flowsign".equals(f.getString("field_type"))
+					) {
 				continue;
 			}
 			if ("uuid".equals(f.getString("field_name"))) {
@@ -191,6 +207,7 @@
 			uuid.setName(f.getString("field_show_name"));
 			uuid.setField(f.getString("field_name"));
 			uuid.setType(f.getString("field_type"));
+			uuid.setRequired(f.getString("is_required"));
 			uuid.setTable(table_name);
 			ls.add(uuid);
 		}
@@ -298,9 +315,9 @@
 		if (CollectionUtil.isEmpty(groupMap)) {
 			throw new BaseException(MobileCoreCode.GET_FACE_CONFIG_FAIL);
 		}
-
+		Map<String, Map<String, Object>> group = new HashMap<>();
 		List<FaceFieldEntity> result = new ArrayList<>();
-		List<List<FieldSetEntity>> subTableField = new ArrayList<>();
+		Map<String, List<FieldSetEntity>> subTableFieldMap = new HashMap<>();
 		for (FieldSetEntity fs : tagFieldSetEntityList) {
 			String groupUuid = fs.getString("group_uuid");
 			String parentUuid = fs.getString("parent_uuid");
@@ -308,16 +325,72 @@
 				continue;
 			}
 			List<FieldSetEntity> fieldSetEntity = productSysFaceControlProperty.getFieldSetEntity(parentUuid);
-			if (CollectionUtil.isEmpty(fieldSetEntity)) {
-				continue;
-			}
+			int i = result.size();
+			to(groupMap, fieldSetEntity, subTableFieldMap, result, parentMap);
+			String parentUuid1 = fieldSetEntity.get(0).getString("parent_uuid");
+			if (!CollectionUtil.isEmpty(fieldSetEntity) && !StringUtils.isEmpty(parentUuid1)) {
+				if (i + 1 == result.size()) {
+					Map<String, Object> o = group.get(parentUuid1);
+					List<FieldSetEntity> configValueList = null;
+					if (o == null) {
+						List<FieldSetEntity> fieldSetEntity1 = productSysFaceControlProperty.getFieldSetEntity(parentUuid1);
+						List<FieldSetEntity> fieldSetEntity2 = productSysFaceControlProperty.getFieldSetEntity(fieldSetEntity1.get(0).getString("parent_uuid"));
+						List<FieldSetEntity> fieldSetEntities = groupMap.get(fieldSetEntity2.get(0).getString("group_uuid"));
+						//list杞琺ap
+						Map<String, Object> map = new HashMap<>();
+						String tabsChldren = null;
+						for (FieldSetEntity fieldSetEntity3 : fieldSetEntities) {
+							map.put(fieldSetEntity3.getString("property_name"), fieldSetEntity3.getString("property_value"));
+							if ("__config__".equals(fieldSetEntity3.getString("property_name"))) {
+								configValueList = parentMap.get(fieldSetEntity3.getString("uuid"));
+							}
+							if ("children".equals(fieldSetEntity3.getString("property_name"))) {
+								tabsChldren = fieldSetEntity3.getString("property_value");
+							}
+						}
+						if (map.get("tag") != null && "el-tabs".equals(map.get("tag"))) {
+							map.remove("label");
+							if(tabsChldren != null){
 
-			to(groupMap, fieldSetEntity, subTableField, result, parentMap);
+							}
+						}
+						group.put(parentUuid1, map);
+						o = map;
+
+					}
+					result.get(i).putOtherParam("parentContainerName", BaseUtil.ifNull(o.get("title"), o.get("label")));
+					result.get(i).putOtherParam("parentContainer", parentUuid1);
+					Map<String, Object> configValueMap = null;
+					if (o.get("configValue") != null) {
+						configValueMap = (Map<String, Object>) o.get("configValue");
+					}
+					if ((configValueList != null || configValueMap != null) && StringUtils.isEmpty(BaseUtil.ifNull(o.get("title"), o.get("label")))) {
+						if (configValueMap == null) {
+							configValueMap = new HashMap<>();
+							for (FieldSetEntity fieldSetEntity4 : configValueList) {
+								configValueMap.put(fieldSetEntity4.getString("property_name"), fieldSetEntity4.getString("property_value"));
+							}
+						}
+						//tag
+						String tag = (String) configValueMap.get("tag");
+						if ("el-card".equals(tag)) {
+							result.get(i).putOtherParam("parentContainerName", configValueMap.get("label"));
+						} else if ("el-tabs".equals(tag)) {
+							System.out.println(1);
+						} else {
+							System.out.println(2);
+						}
+						o.put("configValue", configValueMap);
+					}
+				}
+			}
 		}
-		if (!CollectionUtil.isEmpty(subTableField)) {
+		//鏍规嵁group_uuid 灏嗗瓙琛ㄥ瓧娈靛垎缁�5
+		if (!CollectionUtil.isEmpty(subTableFieldMap)) {
 			//鏍规嵁瀛愯〃琛ㄥ悕瑁呰浇
 			Map<String, FaceFieldEntity> tableByFaceField = new HashMap<>();
-			for (List<FieldSetEntity> fieldSetEntities : subTableField) {
+			for (Map.Entry<String, List<FieldSetEntity>> entry : subTableFieldMap.entrySet()) {
+				List<FieldSetEntity> fieldSetEntities = entry.getValue();
 				String parentUuid = fieldSetEntities.get(0).getString("parent_uuid");
 				//鍏堟壘鍒癱hildren
 				List<FieldSetEntity> fieldSetEntity = productSysFaceControlProperty.getFieldSetEntity(parentUuid);
@@ -363,6 +436,12 @@
 					//涓嶆槸瀛愯〃缁勪欢
 					continue;
 				}
+				List<FaceFieldEntity> fields = new ArrayList<>();
+				for (FieldSetEntity setEntity : fieldSetEntities) {
+					to(groupMap, Lists.newArrayList(setEntity), null, fields, parentMap);
+				}
+
+				faceFieldEntity.setSubField(fields);
 				for (FieldSetEntity setEntity : groupMap.get(groupUuid)) {
 					String propertyName = setEntity.getString("property_name");
 					if ("subTableName".equals(propertyName)) {
@@ -372,6 +451,8 @@
 						faceFieldEntity.setAllowAdd(setEntity.getBoolean("property_value"));
 					} else if ("delete".equals(propertyName)) {
 						faceFieldEntity.setAllowDelete(setEntity.getBoolean("property_value"));
+					} else if ("control_sequence".equals(propertyName)) {
+						faceFieldEntity.putOtherParam("controlSequence", setEntity.getInteger("property_value"));
 					}
 				}
 				List<FaceFieldEntity> subFieldList = faceFieldEntity.getSubField();
@@ -379,18 +460,24 @@
 					subFieldList = new ArrayList<>();
 					faceFieldEntity.setSubField(subFieldList);
 				}
-
-				for (List<FieldSetEntity> setEntities : subTableField) {
-					to(groupMap, setEntities, null, subFieldList, parentMap);
-				}
 				if (!tableByFaceField.containsKey(uuid)) {
 					tableByFaceField.put(uuid, faceFieldEntity);
 					result.add(faceFieldEntity);
 				}
-				break;
-
 			}
+
 		}
+		result.sort((item, item2) -> {
+			Object o = item.getOtherParams().get("controlSequence");
+			if (o == null) {
+				return -1;
+			}
+			Object o1 = item2.getOtherParams().get("controlSequence");
+			if (o1 == null) {
+				return 1;
+			}
+			return NumberUtil.parseInt(item.getOtherParams().get("controlSequence").toString()) - NumberUtil.parseInt(item2.getOtherParams().get("controlSequence").toString());
+		});
 		return result;
 	}
 
@@ -421,7 +508,7 @@
 	}
 
 
-	private void to(Map<String, List<FieldSetEntity>> groupMap, List<FieldSetEntity> fieldSetEntity, List<List<FieldSetEntity>> subTableField, List<FaceFieldEntity> result, Map<String, List<FieldSetEntity>> parentMap) {
+	private void to(Map<String, List<FieldSetEntity>> groupMap, List<FieldSetEntity> fieldSetEntity, Map<String, List<FieldSetEntity>> subTableField, List<FaceFieldEntity> result, Map<String, List<FieldSetEntity>> parentMap) {
 		FieldSetEntity parent = fieldSetEntity.get(0);
 		String groupUuid1 = parent.getString("group_uuid");
 		if (StringUtils.isEmpty(groupUuid1)) {
@@ -435,12 +522,18 @@
 			for (FieldSetEntity setEntity : parentGroup) {
 				//鎵惧埌灞炴�у悕绉�= __vModel__
 				String propertyName = setEntity.getString("property_name");
-				if ("componentType".equals(propertyName)) {
+				if ("componentType".equals(propertyName) || "prompt".equals(propertyName)) {
 					continue;
 				}
 				if ("parentType".equals(propertyName) && "subTable".equals(setEntity.getString("property_value")) && subTableField != null) {
 					//瀛愯〃瀛楁
-					subTableField.add(parentGroup);
+					String parentUuid = setEntity.getString("parent_uuid");
+					List<FieldSetEntity> fieldSetEntities = subTableField.get(parentUuid);
+					if (fieldSetEntities == null) {
+						fieldSetEntities = new ArrayList<>();
+						subTableField.put(parentUuid, fieldSetEntities);
+					}
+					fieldSetEntities.add(setEntity);
 					result.remove(faceFieldEntity);
 					break;
 				}
@@ -461,6 +554,9 @@
 					}
 				}
 				propertyName = StrUtil.toCamelCase(propertyName);
+				if ("defaultValue".equals(propertyName) && !"0".equals(setEntity.getString("property_value")) && !"1".equals(setEntity.getString("property_value"))) {
+					continue;
+				}
 				if (ReflectUtil.hasField(FaceFieldEntity.class, propertyName) && !"field".equals(setEntity.getString("property_name")) && !"prompt".equals(setEntity.getString("property_name"))) {
 					ReflectUtil.setFieldValue(faceFieldEntity, propertyName, setEntity.getObject("property_value"));
 
@@ -496,7 +592,7 @@
 		for (FieldSetEntity setEntity : configGroup) {
 			//鎵惧埌灞炴�у悕绉�= __vModel__
 			String propertyName = setEntity.getString("property_name");
-			if ("componentType".equals(propertyName)) {
+			if ("componentType".equals(propertyName) || "prompt".equals(propertyName)) {
 				continue;
 			}
 			if ("tag".equals(propertyName)) {
@@ -511,6 +607,9 @@
 				propertyName = "prompt";
 			}
 			propertyName = StrUtil.toCamelCase(propertyName);
+			if ("defaultValue".equals(propertyName) && !"0".equals(setEntity.getString("property_value")) && !"1".equals(setEntity.getString("property_value"))) {
+				continue;
+			}
 			if (ReflectUtil.hasField(FaceFieldEntity.class, propertyName) && !"field".equals(setEntity.getString("property_name")) && !"prompt".equals(setEntity.getString("property_name"))) {
 				ReflectUtil.setFieldValue(faceFieldEntity, propertyName, setEntity.getObject("property_value"));
 			}

--
Gitblit v1.9.2