From 99c693af3da1391d00872f89ebd18fcc85278200 Mon Sep 17 00:00:00 2001 From: 许鹏程 <1821349743@qq.com> Date: 星期一, 17 二月 2025 22:08:37 +0800 Subject: [PATCH] 归档支持自定义文件夹路径(多层级) --- src/main/java/com/product/face/util/FaceUtil.java | 36 +++++++++++++++++++++++++++++++++--- 1 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/product/face/util/FaceUtil.java b/src/main/java/com/product/face/util/FaceUtil.java index cae7d2e..6ddb6c3 100644 --- a/src/main/java/com/product/face/util/FaceUtil.java +++ b/src/main/java/com/product/face/util/FaceUtil.java @@ -33,9 +33,15 @@ 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(); 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"); @@ -55,10 +61,11 @@ 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)) { @@ -75,7 +82,8 @@ continue; } if ("layout".equals(propertyName)) { - property.put("defaultValue", null); + //褰卞搷琛ㄥ崟璁捐鍣ㄨ繕鍘焛nput閰嶇疆鐨勯粯璁ゅ�� 鏆傛椂鍏堟敞閲婃帀 +// property.put("defaultValue", null); } switch (propertyType) { case "1"://瀛楃涓� @@ -88,6 +96,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; @@ -98,7 +116,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