src/main/java/com/product/face/config/ErrorCode.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/face/config/FaceConst.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/face/controller/FaceDesignController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/face/service/FaceDesignService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/product/face/service/ide/IFaceDesignService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/product/face/config/ErrorCode.java
@@ -17,6 +17,8 @@ SAVE_FACE_FAIL("保存表单内容失败", 1), SAVE_EMPTY_FACE_FAIL("保存表单内容失败,表单内容不能为空", 2), DELETE_FACE_FAIL("删除表单失败", 3), ; src/main/java/com/product/face/config/FaceConst.java
@@ -1,11 +1,13 @@ package com.product.face.config; import com.product.core.config.CoreConst; /** * @Author cheng * @Date 2023/4/21 17:43 * @Desc 常量类 */ public class FaceConst { public class FaceConst extends CoreConst { //字段key public static final String FACE_FIELD = "fields"; //表单主表 src/main/java/com/product/face/controller/FaceDesignController.java
@@ -1,5 +1,9 @@ package com.product.face.controller; import com.drew.metadata.Face; import com.product.core.cache.DataPoolCacheImpl; import com.product.core.config.CoreConst; import com.product.core.entity.DataTableEntity; import com.product.core.entity.FieldSetEntity; import com.product.core.exception.BaseException; import com.product.core.spring.context.SpringMVCContextHolder; @@ -16,6 +20,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.*; /** * @Author cheng @@ -28,6 +33,36 @@ @Resource private IFaceDesignService faceDesignService; /** * 表单列表左侧树 * * @return */ @PostMapping("/tree-face/{version}") @ApiVersion(1) public String faceListTree() { DataTableEntity tableInfoData = DataPoolCacheImpl.getInstance().getCacheData("所有表信息"); List<Map<String, Object>> resultList = new ArrayList<>(); if (!DataTableEntity.isEmpty(tableInfoData)) { for (int i = 0; i < tableInfoData.getRows(); i++) { FieldSetEntity fse = tableInfoData.getFieldSetEntity(i); Map<String, Object> record = new HashMap<>(); String tableName = fse.getString(FaceConst.FIELD_TABLE_NAME); String value = fse.getString(FaceConst.UUID); String tableType = fse.getString(FaceConst.FIELD_TABLE_TYPE); String tableDescription = fse.getString("table_description"); record.put("value", value); record.put(FaceConst.FIELD_TABLE_NAME, tableName); record.put(FaceConst.FIELD_TABLE_TYPE, tableType); record.put("table_description", tableDescription); resultList.add(record); } resultList.sort(Comparator.comparing(o -> o.get(FaceConst.FIELD_TABLE_TYPE).toString())); } return success(resultList); } /** * 查询表单设计数据详情 @@ -74,6 +109,29 @@ } /** * 删除表单设计 * * @param request * @return */ @PostMapping("/delete-face/{version}") @ApiVersion(1) public String deleteFace(HttpServletRequest request) { try { FieldSetEntity fse = BaseUtil.getFieldSetEntity(request, FaceConst.TABLE_FACE_CONFIG); IFaceDesignService proxy = getProxy(); proxy.deleteFace(fse); return OK(); } catch (BaseException e) { e.printStackTrace(); return error(e); } catch (Exception e) { e.printStackTrace(); return error(ErrorCode.DELETE_FACE_FAIL, e); } } /** * 获取事务代理 * * @return src/main/java/com/product/face/service/FaceDesignService.java
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.drew.metadata.Face; import com.product.admin.service.PublicService; import com.product.common.lang.StringUtils; import com.product.core.config.CoreConst; import com.product.core.entity.DataTableEntity; @@ -23,6 +24,7 @@ import org.apache.logging.log4j.core.Core; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.File; import java.util.*; import java.util.stream.Collectors; @@ -35,6 +37,9 @@ @Service public class FaceDesignService extends AbstractBaseService implements IFaceDesignService { @Resource private PublicService publicService; /** * 获取表单配置详情 @@ -281,4 +286,18 @@ return fse; } /** * 删除表单设计 * * @param fse * @throws BaseException */ @Override @Transactional public void deleteFace(FieldSetEntity fse) throws BaseException { publicService.delete(fse); } } src/main/java/com/product/face/service/ide/IFaceDesignService.java
@@ -1,6 +1,7 @@ package com.product.face.service.ide; import com.alibaba.fastjson.JSONObject; import com.product.core.entity.DataTableEntity; import com.product.core.entity.FieldSetEntity; import com.product.core.exception.BaseException; @@ -29,4 +30,12 @@ * @throws BaseException */ FieldSetEntity saveFaceData(FieldSetEntity fse) throws BaseException; /** * 删除表单设计 * @param fse * @throws BaseException */ void deleteFace(FieldSetEntity fse) throws BaseException; }