Преглед на файлове

新增流程编码生成

wangliang преди 1 година
родител
ревизия
618eb3df52

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SequenceService.java

@@ -2,6 +2,7 @@ package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.sop.business.entity.Sequence;
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
 
 /**
  * <p>
@@ -20,4 +21,12 @@ public interface SequenceService extends IService<Sequence> {
      * @return
      */
     Long selectNextVal(String name) throws InterruptedException;
+
+    /**
+     * 创建流程编号
+     *
+     * @param tfCustomTypeEnum
+     * @return
+     */
+    String createFlowCode(TFCustomTypeEnum tfCustomTypeEnum) throws InterruptedException;
 }

+ 20 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SequenceServiceImpl.java

@@ -1,17 +1,21 @@
 package com.qmth.sop.business.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.sop.business.cache.CommonCacheService;
 import com.qmth.sop.business.entity.Sequence;
+import com.qmth.sop.business.entity.SysConfig;
 import com.qmth.sop.business.mapper.SequenceMapper;
 import com.qmth.sop.business.service.SequenceService;
 import com.qmth.sop.business.service.TGErrorService;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.ErrorEnum;
 import com.qmth.sop.common.enums.ExceptionResultEnum;
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
 import com.qmth.sop.common.lock.MemoryLock;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Optional;
 
 /**
  * <p>
@@ -30,6 +34,9 @@ public class SequenceServiceImpl extends ServiceImpl<SequenceMapper, Sequence> i
     @Resource
     TGErrorService tgErrorService;
 
+    @Resource
+    CommonCacheService commonCacheService;
+
     /**
      * 获取序列号
      *
@@ -57,4 +64,17 @@ public class SequenceServiceImpl extends ServiceImpl<SequenceMapper, Sequence> i
         }
         return null;
     }
+
+    /**
+     * 创建流程编号
+     *
+     * @param tfCustomTypeEnum
+     * @return
+     */
+    @Override
+    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()));
+    }
 }

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

@@ -409,4 +409,7 @@ WHERE id=125;
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
 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);
 

+ 1 - 0
sop-common/src/main/java/com/qmth/sop/common/contant/SystemConstant.java

@@ -115,6 +115,7 @@ public class SystemConstant {
     public static final String CODE_SEND_INTERVAL = "code.send.interval";
     public static final String SMS_SIGN_NAME = "sms.sign.name";
     public static final String SMS_TPL_CODE = "sms.tpl.code";
+    public static final String FLOW_CODE_LENGTH = "flow.code.length";
 
     /**
      * api前缀

+ 13 - 6
sop-common/src/main/java/com/qmth/sop/common/enums/TFCustomTypeEnum.java

@@ -9,15 +9,15 @@ package com.qmth.sop.common.enums;
  */
 public enum TFCustomTypeEnum {
 
-    OFFICE_SOP_FLOW("教务处SOP", "officeSopFlow", "testform1.zip"),
+    OFFICE_SOP_FLOW("教务处SOP", "officeSopFlow", "testform1.zip","SOPO"),
 
-    CLOUD_MARK_SOP_FLOW("云阅卷SOP", "cloudMarkSopFlow", null),
+    CLOUD_MARK_SOP_FLOW("云阅卷SOP", "cloudMarkSopFlow", null,"SOPC"),
 
-    DING_EXCEPTION_FLOW("考勤异常审核流程", "dingExceptionFlow", "dingExceptionFlow.zip"),
+    DING_EXCEPTION_FLOW("考勤异常审核流程", "dingExceptionFlow", "dingExceptionFlow.zip","SOPD"),
 
-    PROJECT_EXCHANGE_FLOW("项目计划变更流程 ", "projectExchangeFlow", "projectExchangeFlow.zip"),
+    PROJECT_EXCHANGE_FLOW("项目计划变更流程 ", "projectExchangeFlow", "projectExchangeFlow.zip","SOPE"),
 
-    QUALITY_PROBLEM_FLOW("质量问题反馈流程 ", "qualityProblemFlow", "qualityProblemFlow.zip");
+    QUALITY_PROBLEM_FLOW("质量问题反馈流程 ", "qualityProblemFlow", "qualityProblemFlow.zip","SOPQ");
 
     private String title;
 
@@ -25,10 +25,13 @@ public enum TFCustomTypeEnum {
 
     private String fileName;
 
-    private TFCustomTypeEnum(String title, String code, String fileName) {
+    private String mark;
+
+    private TFCustomTypeEnum(String title, String code, String fileName, String mark) {
         this.title = title;
         this.code = code;
         this.fileName = fileName;
+        this.mark = mark;
     }
 
     public String getTitle() {
@@ -42,4 +45,8 @@ public enum TFCustomTypeEnum {
     public String getFileName() {
         return fileName;
     }
+
+    public String getMark() {
+        return mark;
+    }
 }