From 9824fc1a7b71cb4d617ea18cab36b8c179e6a37c Mon Sep 17 00:00:00 2001 From: 许鹏程 <1821349743@qq.com> Date: 星期二, 05 十一月 2024 17:34:16 +0800 Subject: [PATCH] commit --- src/main/java/com/product/face/service/FaceApplyService.java | 103 ++++++++++++++++++++++++++------------------------- 1 files changed, 52 insertions(+), 51 deletions(-) diff --git a/src/main/java/com/product/face/service/FaceApplyService.java b/src/main/java/com/product/face/service/FaceApplyService.java index 689c4a8..ccc6406 100644 --- a/src/main/java/com/product/face/service/FaceApplyService.java +++ b/src/main/java/com/product/face/service/FaceApplyService.java @@ -1,17 +1,26 @@ package com.product.face.service; +import cn.hutool.core.map.MapBuilder; +import cn.hutool.core.map.MapUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.aspose.slides.p2cbca448.and; import com.google.common.collect.Lists; import com.product.admin.service.SystemFaceService; import com.product.common.lang.StringUtils; +import com.product.core.cache.util.RedisUtil; 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.config.ErrorCode; import com.product.face.config.FaceConst; +import com.product.face.entity.FaceEntity; +import com.product.face.entity.FaceListEntity; import com.product.face.entity.TableColumn; +import com.product.face.util.FaceUtil; import com.product.util.BaseUtil; import org.springframework.stereotype.Service; @@ -19,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** * @Author cheng @@ -33,9 +41,13 @@ private SystemFaceService systemFaceService; @Resource - private FaceDesignService designService; + private FaceCacheService faceCacheService; - + /** + * 鑾峰彇琛ㄥ崟閰嶇疆 + * @param fse + * @return + */ public Object getFaceListConf(FieldSetEntity fse) { String faceUuid = fse.getString(FaceConst.FIELD_FACE_UUID); String faceNumber = fse.getString(FaceConst.FIELD_FACE_NUMBER); @@ -46,41 +58,11 @@ if (!StringUtils.isEmpty(faceUuid) && StringUtils.isEmpty(faceNumber)) { return systemFaceService.getFaceFieldList(faceUuid); } - //鏍规嵁琛ㄥ崟鍙锋煡璇� - FieldSetEntity faceConf = getBaseDao().getFieldSetByFilter(FaceConst.TABLE_FACE_CONFIG, "face_number=?", new Object[]{faceNumber}, true); - DataTableEntity fieldPropertyDt = faceConf.getSubDataTable(FaceConst.TABLE_FACE_FIELD_CONTROL_PROPERTY); - if (DataTableEntity.isEmpty(fieldPropertyDt)) { - throw new BaseException(ErrorCode.GET_FACE_CONFIG_FAIL); + FaceListEntity faceListCache = faceCacheService.getFaceListCache(faceNumber); + if (faceListCache == null) { + throw new BaseException(ErrorCode.GET_FACE_CONF_FAIL); } - List<JSONObject> faceControlList = designService.getFaceControlList(fieldPropertyDt); - JSONObject jsonObject = faceControlList.get(0); - if (jsonObject == null || jsonObject.isEmpty()) { - throw new BaseException(ErrorCode.GET_FACE_CONFIG_FAIL); - } - //琛ㄦ牸鍒� - JSONArray tableColumns = jsonObject.getJSONObject(FaceConst.FIELD_PROPERTY_CONFIG).getJSONArray(FaceConst.CHILDREN); - if (tableColumns == null || tableColumns.isEmpty()) { - throw new BaseException(ErrorCode.GET_FACE_CONFIG_FAIL); - } - List<TableColumn> result = Lists.newArrayList(); - for (int i = 0; i < tableColumns.size(); i++) { - TableColumn tableColumn = new TableColumn(); - JSONObject columnJson = tableColumns.getJSONObject(i); - String fieldName = columnJson.getString(FaceConst.FIELD_PROPERTY_VMODEL); - if (StringUtils.isEmpty(fieldName)) { - continue; - } - JSONObject config = columnJson.getJSONObject(FaceConst.FIELD_PROPERTY_CONFIG); - Object setWidth = config.get("setWidth"); - if (!StringUtils.isEmpty(setWidth)) { - tableColumn.setColumnWidth(setWidth + "%"); - } - tableColumn.setField(fieldName); - tableColumn.setTitle(config.getString(FaceConst.FIELD_PROPERTY_LABEL)); - result.add(tableColumn); - } - - return result; + return faceListCache; } /** @@ -91,21 +73,40 @@ * @throws BaseException */ public String getFaceFormConfig(FieldSetEntity fse) throws BaseException { - String faceNumber = fse.getString(FaceConst.FIELD_FACE_NUMBER); - if (StringUtils.isEmpty(faceNumber)) { - throw new BaseException(ErrorCode.REQUEST_PARAM_ERROR); + FaceEntity faceFormCache = faceCacheService.getFaceFormCache(fse.getString(FaceConst.FIELD_FACE_NUMBER)); + if (faceFormCache == null) { + throw new BaseException(ErrorCode.GET_FACE_CONF_FAIL); } - //鏍规嵁琛ㄥ崟鍙锋煡璇� - FieldSetEntity faceConf = getBaseDao().getFieldSetByFilter(FaceConst.TABLE_FACE_CONFIG, "face_number=?", new Object[]{faceNumber}, true); - DataTableEntity fieldPropertyDt = faceConf.getSubDataTable(FaceConst.TABLE_FACE_FIELD_CONTROL_PROPERTY); - if (DataTableEntity.isEmpty(fieldPropertyDt)) { - throw new BaseException(ErrorCode.GET_FACE_CONFIG_FAIL); - } - List<JSONObject> faceControlList = designService.getFaceControlList(fieldPropertyDt); - Map<String, Object> other = new HashMap<>(); - other.put("drawingList", faceControlList); - faceConf.getSubData().clear(); - return BaseUtil.success(faceConf, other); + return BaseUtil.success(faceFormCache.getData(), MapUtil.builder("drawingList", (Object) faceFormCache.getDrawingList()).map()); } + public List<String> getFaceReference(FieldSetEntity fse) throws BaseException { + String faceNumber = fse.getString("face_number"); + if (StringUtils.isEmpty(faceNumber)) { + return null; + } + String[] faceNumberArr = faceNumber.split(","); + StringBuilder sql = new StringBuilder(); + sql.append(" select case when c.property_value like '%prompt' then a.property_value else concat('銆�',a.property_value,'銆�') end as property_value from product_sys_face_control_property a "); + sql.append(" join product_sys_face_control_property b on a.group_uuid=b.group_uuid and a.uuid!=b.uuid "); + sql.append(" join product_sys_face_control_property c on b.uuid=c.parent_uuid "); + sql.append(" where a.property_name='advanceName' and a.master_uuid in (SELECT uuid from product_sys_face where face_type=2 and ").append(BaseUtil.buildQuestionMarkFilter("face_number", faceNumberArr.length, true)).append(") "); + sql.append(" and b.property_name='__config__' and c.property_name='tag' GROUP BY 1 "); + + + DataTableEntity dte = getBaseDao().listTable(sql.toString(), faceNumberArr); + + + List<String> list = Lists.newArrayList(); + + if (DataTableEntity.isEmpty(dte)) { + return list; + } + + for (int i = 0; i < dte.getRows(); i++) { + FieldSetEntity fs = dte.getFieldSetEntity(i); + list.add(fs.getString("property_value")); + } + return list; + } } -- Gitblit v1.9.2