Browse Source

新增流程编码生成

wangliang 1 year ago
parent
commit
81572bf846

+ 2 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/SequenceServiceImpl.java

@@ -75,6 +75,7 @@ public class SequenceServiceImpl extends ServiceImpl<SequenceMapper, Sequence> i
     public String createFlowCode(TFCustomTypeEnum tfCustomTypeEnum) throws InterruptedException {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.FLOW_CODE_LENGTH);
         Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("流程编码长度未设置"));
-        return String.format("%0" + sysConfig.getConfigValue() + "d", this.selectNextVal(tfCustomTypeEnum.getCode()));
+        String sequence = String.format("%0" + sysConfig.getConfigValue() + "d", this.selectNextVal(tfCustomTypeEnum.getCode()));
+        return tfCustomTypeEnum.getMark() + sequence;
     }
 }

+ 3 - 1
sop-business/src/main/resources/db/log/wangliang_update_log.sql

@@ -411,5 +411,7 @@ INSERT INTO sys_privilege
 VALUES(3016, '角色权限查询接口', '/api/admin/role/privilege/list', 'URL', 16, 4, 'AUTH', NULL, 1, 1, 0);
 INSERT INTO sys_config
 (id, org_id, config_key, config_name, config_value, remark, enable, sort, create_id, create_time, update_id, update_time)
-VALUES(19, NULL, 'flow.code.length', '流程编码长度', '14', NULL, 1, 1, 1, NULL, NULL, NULL);
+VALUES(19, NULL, 'flow.code.length', '流程编码长度', '10', NULL, 1, 1, 1, NULL, NULL, NULL);
 
+ALTER TABLE t_f_custom_flow_entity MODIFY COLUMN code varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '编号';
+ALTER TABLE t_f_custom_flow_entity ADD CONSTRAINT t_f_custom_flow_entity_UN_code UNIQUE KEY (code,flow_id);

+ 3 - 1
sop-common/src/main/java/com/qmth/sop/common/enums/FieldUniqueEnum.java

@@ -17,7 +17,9 @@ public enum FieldUniqueEnum {
 
     sys_org_UN_name("机构名称"),
 
-    sys_role_UN_type("角色类型");
+    sys_role_UN_type("角色类型"),
+
+    t_f_custom_flow_entity_UN_code("流程编码");
 
     private String title;