pom.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/mobile/core/config/MobileCoreCode.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/mobile/core/controller/FaceMobileController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/mobile/core/entity/FaceFieldEntity.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/mobile/core/service/FaceMobileService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
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> 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; } } 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); } } } 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; } 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; } }