From 84c71e0c4d89cd15d8b85cfc2d2ea7ba0aa251f7 Mon Sep 17 00:00:00 2001
From: 许鹏程 <1821349743@qq.com>
Date: 星期三, 22 一月 2025 18:02:27 +0800
Subject: [PATCH] fix:getPropertyJson method change private
---
src/main/java/com/product/face/util/FaceUtil.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 50 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/product/face/util/FaceUtil.java b/src/main/java/com/product/face/util/FaceUtil.java
index 8dafdd4..19c3565 100644
--- a/src/main/java/com/product/face/util/FaceUtil.java
+++ b/src/main/java/com/product/face/util/FaceUtil.java
@@ -23,7 +23,7 @@
public class FaceUtil {
- public static List<JSONObject> getFaceControlList(DataTableEntity faceControlDt) {
+ public static List<JSONObject> getFaceControlList(FieldSetEntity face, DataTableEntity faceControlDt) {
List<JSONObject> result = new ArrayList<>();
List<FieldSetEntity> data = faceControlDt.getData();
Map<String, List<FieldSetEntity>> collect = data.stream()
@@ -33,15 +33,39 @@
Map<String, List<FieldSetEntity>> groupContainer = data.stream()
.filter(item -> !StringUtils.isEmpty(item.getString(FaceConst.FIELD_PARENT_UUID))) //杩囨护 鍙栧瓙绾�
.collect(Collectors.groupingBy(item -> item.getString(FaceConst.FIELD_PARENT_UUID))); //鍒嗙粍
+ int maxFormId = 100;
for (Map.Entry<String, List<FieldSetEntity>> entry : collect.entrySet()) {
List<FieldSetEntity> propertyList = entry.getValue();
- result.add(getPropertyJson(propertyList, groupContainer));
+ JSONObject propertyJson = getPropertyJson(propertyList, groupContainer);
+ Integer o = propertyJson.getInteger("~formId~");
+ if (o != null && o > maxFormId) {
+ maxFormId = o;
+ }
+ propertyJson.remove("~formId~");
+ Boolean eventProperty = propertyJson.getBoolean("event_property");
+ if (eventProperty != null && eventProperty && propertyJson.get("event_array") != null) {
+ JSONArray eventArray = propertyJson.getJSONArray("event_array");
+ for (int i = 0; i < eventArray.size(); i++) {
+ String params = eventArray.getJSONObject(i).getString("params");
+ String[] paramsArray;
+ if (StringUtils.isEmpty(params)) {
+ paramsArray = new String[]{};
+ } else {
+ paramsArray = params.split(",");
+ }
+ eventArray.getJSONObject(i).put("params", paramsArray);
+ }
+ face.setValue("events", eventArray);
+ continue;
+ }
+ result.add(propertyJson);
}
result.sort(Comparator.comparing(item -> item.getInteger(FaceConst.CONTROL_SEQUENCE)));
+ face.setValue("maxFormId", maxFormId);
return result;
}
- private static JSONObject getPropertyJson(List<FieldSetEntity> propertyList, Map<String, List<FieldSetEntity>> groupContainer) {
+ public static JSONObject getPropertyJson(List<FieldSetEntity> propertyList, Map<String, List<FieldSetEntity>> groupContainer) {
JSONObject property = new JSONObject();
String propertyValue = null;
if (!CollectionUtil.isEmpty(propertyList)) {
@@ -71,6 +95,16 @@
try {
JSONObject propertyJson = getPropertyJson(groupContainer.get(groupUuid), groupContainer);
property.put(propertyName, propertyJson);
+ if ("__config__".equals(propertyName)) {
+ String o = propertyJson.getString("formId");
+ if (NumberUtil.isNumber(o)) {
+ Integer formId = property.getInteger("formId");
+ if (formId == null || formId < NumberUtil.parseInt(o)) {
+ property.put("~formId~", NumberUtil.parseInt(o));
+ }
+ }
+ propertyJson.remove("~formId~");
+ }
} catch (Exception e) {
e.printStackTrace();
throw e;
@@ -81,7 +115,19 @@
if (propertyListChild != null && !propertyListChild.isEmpty()) {
List<Object> array = propertyListChild.stream()
.collect(Collectors.groupingBy(item -> item.getString(FaceConst.FIELD_GROUP_UUID)))
- .values().stream().map(item -> getPropertyJson(item, groupContainer)).sorted(Comparator.comparing(item -> item.getInteger(FaceConst.CONTROL_SEQUENCE))).collect(Collectors.toList());
+ .values().stream().map(item -> {
+ JSONObject propertyJson = getPropertyJson(item, groupContainer);
+ String o = propertyJson.getString("~formId~");
+ if (NumberUtil.isNumber(o)) {
+ Integer formId = property.getInteger("formId");
+ if (formId == null || formId < NumberUtil.parseInt(o)) {
+ property.put("~formId~", NumberUtil.parseInt(o));
+ }
+ }
+ propertyJson.remove("~formId~");
+
+ return propertyJson;
+ }).sorted(Comparator.comparing(item -> item.getInteger(FaceConst.CONTROL_SEQUENCE))).collect(Collectors.toList());
property.put(propertyName, new JSONArray(array));
}
--
Gitblit v1.9.2