From 7a30e9d5c7e42202fab42af727c9821472d0da84 Mon Sep 17 00:00:00 2001
From: 许鹏程 <1821349743@qq.com>
Date: 星期四, 15 八月 2024 18:37:26 +0800
Subject: [PATCH] commit udpate
---
src/main/java/com/product/mobile/core/entity/FaceFieldEntity.java | 72 ++++++++++++
src/main/java/com/product/mobile/core/config/MobileCoreCode.java | 60 +++++----
src/main/java/com/product/mobile/core/service/FaceMobileService.java | 147 ++++++++++++++++++++++++
pom.xml | 8 +
src/main/java/com/product/mobile/core/controller/FaceMobileController.java | 50 ++++++++
5 files changed, 309 insertions(+), 28 deletions(-)
diff --git a/pom.xml b/pom.xml
index db82c22..97bbcd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,6 +21,14 @@
<groupId>com.lx</groupId>
<artifactId>product-server-admin</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.lx</groupId>
+ <artifactId>product-server-tool-flow</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.lx</groupId>
+ <artifactId>product-server-tool-face</artifactId>
+ </dependency>
<!--releases -->
<dependency>
<groupId>com.lx</groupId>
diff --git a/src/main/java/com/product/mobile/core/config/MobileCoreCode.java b/src/main/java/com/product/mobile/core/config/MobileCoreCode.java
index 668965a..e904129 100644
--- a/src/main/java/com/product/mobile/core/config/MobileCoreCode.java
+++ b/src/main/java/com/product/mobile/core/config/MobileCoreCode.java
@@ -10,39 +10,43 @@
* @Desc 閿欒鏋氫妇
*/
public enum MobileCoreCode implements IEnum {
- SYSTEM_OPERATION_SUCCESS("鎴愬姛", "200"),
- SYSTEM_FORM_NODATA("璇锋眰鍙傛暟涓虹┖", "999"),
- SYSTEM_FORM_COUNT("璇锋眰鍙傛暟鏈夎", "998"),
- SYSTEM_TABLE_NODATA("璇锋眰琛ㄥ悕鏈夎", "997"),
- SYSTEM_ACQUIRE_PARAM_FAIL("鑾峰彇鍙傛暟澶辫触", "996"),
- SYSTEM_CPAGES_NOT_NULL("鍒嗛〉鍙傛暟涓嶈兘涓虹┖", "995"),
- FIND_NAV_BAR_CONFIG_FAIL("鏌ヨ瀵艰埅鏍忛厤缃鎯呭け璐�", "001"),
- SAVE_NAV_BAR_CONFIG_FAIL("淇濆瓨瀵艰埅鏍忛厤缃け璐�", "002"),
- GET_NAV_BAR_CONFIG_LIST_FAIL("鏌ヨ瀵艰埅鏍忛厤缃垪琛ㄥけ璐�", "003"),
- DEL_NAV_BAR_CONFIG_FAIL("鍒犻櫎瀵艰埅鏍忛厤缃け璐�", "004"),
- GET_NAV_BAR_TREE_LIST_FAIL("鑾峰彇瀵艰埅鏍忓け璐�", "005"),
+ SYSTEM_OPERATION_SUCCESS("鎴愬姛", "200"),
+ SYSTEM_FORM_NODATA("璇锋眰鍙傛暟涓虹┖", "999"),
+ SYSTEM_FORM_COUNT("璇锋眰鍙傛暟鏈夎", "998"),
+ SYSTEM_TABLE_NODATA("璇锋眰琛ㄥ悕鏈夎", "997"),
+ SYSTEM_ACQUIRE_PARAM_FAIL("鑾峰彇鍙傛暟澶辫触", "996"),
+ SYSTEM_CPAGES_NOT_NULL("鍒嗛〉鍙傛暟涓嶈兘涓虹┖", "995"),
+ FIND_NAV_BAR_CONFIG_FAIL("鏌ヨ瀵艰埅鏍忛厤缃鎯呭け璐�", "001"),
+ SAVE_NAV_BAR_CONFIG_FAIL("淇濆瓨瀵艰埅鏍忛厤缃け璐�", "002"),
+ GET_NAV_BAR_CONFIG_LIST_FAIL("鏌ヨ瀵艰埅鏍忛厤缃垪琛ㄥけ璐�", "003"),
+ DEL_NAV_BAR_CONFIG_FAIL("鍒犻櫎瀵艰埅鏍忛厤缃け璐�", "004"),
+ GET_NAV_BAR_TREE_LIST_FAIL("鑾峰彇瀵艰埅鏍忓け璐�", "005"),
- GET_ROUTER_FAIL("鑾峰彇璺敱澶辫触", "006"),
+ GET_ROUTER_FAIL("鑾峰彇璺敱澶辫触", "006"),
- LIST_READ_MESSAGE_FAIL("鑾峰彇宸茶娑堟伅鍒楄〃澶辫触", "007"),
- ;
+ LIST_READ_MESSAGE_FAIL("鑾峰彇宸茶娑堟伅鍒楄〃澶辫触", "007"),
- MobileCoreCode(String text, String code) {
- this.code = code;
- this.text = text;
- }
+ GET_FACE_FIELD_FAIL("鑾峰彇琛ㄥ崟瀛楁澶辫触", "008"),
- private String code;
+ GET_FACE_CONFIG_FAIL("鑾峰彇琛ㄥ崟閰嶇疆澶辫触", "009"),
+ ;
- private String text;
+ MobileCoreCode(String text, String code) {
+ this.code = code;
+ this.text = text;
+ }
- @Override
- public String getText() {
- return this.text;
- }
+ private String code;
- @Override
- public String getValue() {
- return ModuleEnum.MOBILE.getValue() + this.code;
- }
+ private String text;
+
+ @Override
+ public String getText() {
+ return this.text;
+ }
+
+ @Override
+ public String getValue() {
+ return ModuleEnum.MOBILE.getValue() + this.code;
+ }
}
diff --git a/src/main/java/com/product/mobile/core/controller/FaceMobileController.java b/src/main/java/com/product/mobile/core/controller/FaceMobileController.java
new file mode 100644
index 0000000..660f11f
--- /dev/null
+++ b/src/main/java/com/product/mobile/core/controller/FaceMobileController.java
@@ -0,0 +1,50 @@
+package com.product.mobile.core.controller;
+
+import com.product.core.entity.FieldSetEntity;
+import com.product.core.exception.BaseException;
+import com.product.mobile.core.config.MobileCoreCode;
+import com.product.mobile.core.service.FaceMobileService;
+import com.product.module.sys.version.ApiVersion;
+import com.product.util.BaseUtil;
+import com.product.util.support.AbstractBaseController;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @Author cheng
+ * @Date 2024/8/15 10:19
+ * @Desc
+ */
+@RequestMapping("/mobile-face/")
+@RestController
+public class FaceMobileController extends AbstractBaseController {
+
+ @Resource
+ FaceMobileService faceMobileService;
+
+ /**
+ * 鑾峰彇琛ㄥ崟鎵�鏈夌粍浠剁殑瀛楁鏍规嵁flow_task 琛� uuid 鎴栬�� flow_detail 琛� uuid
+ *
+ * @param request
+ * @return
+ */
+ @PostMapping("/get-face-field/{version}")
+ @ApiVersion(1)
+ public String getFaceField(HttpServletRequest request) {
+ try {
+ //涓嶉獙璇佷紶鍏ョ殑琛ㄥ悕 鍙兘浼氭槸 product_sys_flow_task/product_sys_flow_detail
+ FieldSetEntity fse = BaseUtil.getFieldSetEntity(request);
+ return BaseUtil.success(faceMobileService.getFaceField(fse));
+ } catch (BaseException e) {
+ e.printStackTrace();
+ return error(e);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return error(MobileCoreCode.GET_FACE_FIELD_FAIL, e);
+ }
+ }
+}
diff --git a/src/main/java/com/product/mobile/core/entity/FaceFieldEntity.java b/src/main/java/com/product/mobile/core/entity/FaceFieldEntity.java
new file mode 100644
index 0000000..0e31fae
--- /dev/null
+++ b/src/main/java/com/product/mobile/core/entity/FaceFieldEntity.java
@@ -0,0 +1,72 @@
+package com.product.mobile.core.entity;
+
+/**
+ * @Author cheng
+ * @Date 2024/8/15 11:12
+ * @Desc
+ */
+public class FaceFieldEntity {
+
+ /**
+ * 鏄惁蹇呭~
+ */
+ private String required;
+ /**
+ * 鏄剧ず鍚嶇О
+ */
+ private String label;
+
+ /**
+ * 鍙傜収鍚嶇О
+ */
+ private String advanceName;
+
+ /**
+ * 缁勪欢绫诲瀷
+ */
+ private String componentType;
+
+ /**
+ * 鏄惁澶氶��
+ */
+ private String multiple;
+
+ /**
+ * 绂佺敤
+ */
+ private String disabled;
+ /**
+ * 榛樿鍊�
+ */
+ private String defaultValue;
+
+ /**
+ * 鎻愮ず淇℃伅
+ */
+ private String placeholder;
+ /**
+ * 闄勪欢缁戝畾琛ㄥ悕
+ */
+ private String fileTableName;
+
+ /**
+ * 闄勪欢缁戝畾瀛楁
+ */
+ private String fileField;
+
+ /**
+ * 鎺т欢鎺掑簭
+ */
+ private Integer controlSequence;
+ /**
+ * 楂樼骇鍙傜収鍏宠仈璁剧疆
+ */
+ private String promptSetting;
+
+ /**
+ * 娴佹按鍙烽厤缃�
+ */
+ private String serialNumber;
+
+
+}
diff --git a/src/main/java/com/product/mobile/core/service/FaceMobileService.java b/src/main/java/com/product/mobile/core/service/FaceMobileService.java
new file mode 100644
index 0000000..310b02f
--- /dev/null
+++ b/src/main/java/com/product/mobile/core/service/FaceMobileService.java
@@ -0,0 +1,147 @@
+package com.product.mobile.core.service;
+
+import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.ReflectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.product.common.lang.StringUtils;
+import com.product.core.entity.DataTableEntity;
+import com.product.core.entity.FieldSetEntity;
+import com.product.core.exception.BaseException;
+import com.product.core.service.support.AbstractBaseService;
+import com.product.face.util.FaceUtil;
+import com.product.mobile.core.config.MobileCoreCode;
+import com.product.mobile.core.entity.FaceFieldEntity;
+import com.product.tool.flow.config.CmnConst;
+import com.product.tool.flow.config.FlowCode;
+import com.product.tool.flow.service.FlowDetailService;
+import com.product.util.BaseUtil;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+/**
+ * @Author cheng
+ * @Date 2024/8/15 10:21
+ * @Desc
+ */
+@Service
+public class FaceMobileService extends AbstractBaseService {
+
+ @Resource
+ FlowDetailService flowDetailService;
+
+ public List<FaceFieldEntity> getFaceField(FieldSetEntity fse) throws BaseException {
+ String flowBusinessForm = flowDetailService.getFlowBusinessForm(fse);
+ JSONObject jsonObject = JSON.parseObject(flowBusinessForm);
+ JSONObject data = jsonObject.getJSONObject("data");
+ FieldSetEntity faceFse = null;
+ if (data != null && !StringUtils.isEmpty(data.getString("face_number"))) {
+ if (!StringUtils.isEmpty(data.getString("face_number"))) {
+ faceFse = getBaseDao().getFieldSetEntityByFilter("product_sys_face", "face_number=?", new Object[]{data.getString("face_number")}, true);
+ }
+ } else {
+ do {
+ //鏍规嵁娴佺▼鑾峰彇琛ㄥ悕
+ FieldSetEntity detailFse;
+ if (CmnConst.TABLE_FLOW_TASK.equals(fse.getTableName())) {
+ detailFse = getBaseDao().getFieldSetEntityByFilter(CmnConst.TABLE_FLOW_DETAIL, "task_uuid=? and source_uuid is null", new Object[]{fse.getUUID()}, false);
+ } else {
+ detailFse = getBaseDao().getFieldSetEntity(CmnConst.TABLE_FLOW_DETAIL, fse.getString(CmnConst.FIELD_UUID), false);
+ }
+ if (FieldSetEntity.isEmpty(detailFse)) {
+ break;
+ }
+ //鑾峰彇琛ㄥ悕
+ String tableName = detailFse.getString("table_name");
+ FieldSetEntity tableInfo = BaseUtil.getSingleInfoByCache("鎵�鏈夎〃淇℃伅", new String[]{tableName});
+ if (FieldSetEntity.isEmpty(tableInfo)) {
+ break;
+ }
+ String tableUuid = tableInfo.getString("uuid");
+ faceFse = getBaseDao().getFieldSetByFilter("product_sys_face", "table_uuid=?", new Object[]{tableUuid}, true);
+ } while (false);
+
+ }
+
+ if (FieldSetEntity.isEmpty(faceFse) || DataTableEntity.isEmpty(faceFse.getSubDataTable("product_sys_face_control_property"))) {
+ throw new BaseException(MobileCoreCode.GET_FACE_CONFIG_FAIL);
+ }
+
+ DataTableEntity productSysFaceControlProperty = faceFse.getSubDataTable("product_sys_face_control_property");
+ List<FieldSetEntity> tagFieldSetEntityList = new ArrayList<>();
+ //鏍规嵁group_uuid 鍒嗙粍
+ Map<String, List<FieldSetEntity>> groupMap = new HashMap<>();
+ for (FieldSetEntity fieldSetEntity : productSysFaceControlProperty.getData()) {
+ String groupUuid = fieldSetEntity.getString("group_uuid");
+ if ("tag".equals(fieldSetEntity.getString("property_name"))) {
+ tagFieldSetEntityList.add(fieldSetEntity);
+ }
+ if (StringUtils.isEmpty(groupUuid)) {
+ continue;
+ }
+ if (!groupMap.containsKey(groupUuid)) {
+ groupMap.put(groupUuid, new ArrayList<>());
+ }
+ groupMap.get(groupUuid).add(fieldSetEntity);
+ }
+
+ if (CollectionUtil.isEmpty(groupMap)) {
+ throw new BaseException(MobileCoreCode.GET_FACE_CONFIG_FAIL);
+ }
+
+ List<FaceFieldEntity> result = new ArrayList<>();
+ for (FieldSetEntity fs : tagFieldSetEntityList) {
+ String groupUuid = fs.getString("group_uuid");
+ String parentUuid = fs.getString("parent_uuid");
+ if (StringUtils.isEmpty(groupUuid) || StringUtils.isEmpty(parentUuid)) {
+ continue;
+ }
+ List<FieldSetEntity> fieldSetEntity = productSysFaceControlProperty.getFieldSetEntity(parentUuid);
+ if (CollectionUtil.isEmpty(fieldSetEntity)) {
+ continue;
+ }
+ FieldSetEntity parent = fieldSetEntity.get(0);
+ String groupUuid1 = parent.getString("group_uuid");
+ if (StringUtils.isEmpty(groupUuid1)) {
+ continue;
+ }
+ List<FieldSetEntity> parentGroup = groupMap.get(groupUuid1);
+ FaceFieldEntity faceFieldEntity = new FaceFieldEntity();
+ for (FieldSetEntity setEntity : parentGroup) {
+ //鎵惧埌灞炴�у悕绉�= __vModel__
+ String propertyName = setEntity.getString("property_name");
+ if ("__vModel__".equals(setEntity.getString("property_name"))) {
+ result.add(faceFieldEntity);
+ propertyName = "fieldName";
+ }
+ propertyName = StrUtil.toCamelCase(propertyName);
+ if (ReflectUtil.hasField(FaceFieldEntity.class, propertyName)) {
+ ReflectUtil.setFieldValue(faceFieldEntity, propertyName, setEntity.getObject("property_value"));
+ }
+ }
+ List<FieldSetEntity> configGroup = groupMap.get(groupUuid);
+ for (FieldSetEntity setEntity : configGroup) {
+ //鎵惧埌灞炴�у悕绉�= __vModel__
+ String propertyName = setEntity.getString("property_name");
+ if ("tag".equals(propertyName)) {
+ result.add(faceFieldEntity);
+ propertyName = "component_type";
+ } else if ("field".equals(propertyName)) {
+ propertyName = "fileField";
+ } else if ("tableName".equals(propertyName)) {
+ propertyName = "fileTableName";
+ }
+ propertyName = StrUtil.toCamelCase(propertyName);
+ if (ReflectUtil.hasField(FaceFieldEntity.class, propertyName)) {
+ ReflectUtil.setFieldValue(faceFieldEntity, propertyName, setEntity.getObject("property_value"));
+ }
+ }
+
+ }
+
+ return result;
+ }
+}
--
Gitblit v1.9.2