Jelajahi Sumber

流程修改

wangliang 1 tahun lalu
induk
melakukan
051403d0b7

TEMPAT SAMPAH
sop-api/src/main/resources/officeSopFlow.zip


+ 18 - 0
sop-business/src/main/java/com/qmth/sop/business/entity/TBDelayWarn.java

@@ -3,6 +3,7 @@ package com.qmth.sop.business.entity;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.sop.common.base.BaseEntity;
+import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.DelayWarnStatusEnum;
 import com.qmth.sop.common.enums.DelayWarnTypeEnum;
 import io.swagger.annotations.ApiModel;
@@ -56,6 +57,23 @@ public class TBDelayWarn extends BaseEntity implements Serializable {
     @ApiModelProperty(value = "状态,NOT_START:未跟进,FOLLOW:跟进,CLOSE:关闭,RESTART:重启")
     private DelayWarnStatusEnum status;
 
+    public TBDelayWarn() {
+
+    }
+
+    public TBDelayWarn(String crmNo, String sopNo, Long serviceId, String code, Long warnTime, Long userId, String fieldObj) {
+        setId(SystemConstant.getDbUuid());
+        this.crmNo = crmNo;
+        this.sopNo = sopNo;
+        this.serviceId = serviceId;
+        this.code = code;
+        this.warnTime = warnTime;
+        this.type = DelayWarnTypeEnum.TIME;
+        this.fieldObj = fieldObj;
+        this.status = DelayWarnStatusEnum.NOT_START;
+        setCreateId(userId);
+    }
+
     public String getCrmNo() {
         return crmNo;
     }

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

@@ -711,7 +711,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
         LinkedHashMap<String, FlowTaskResult> setupMapNew = new LinkedHashMap<>(setupMap.size());
         for (Map.Entry<String, FlowTaskResult> entry : setupMap.entrySet()) {
             if (entry.getValue().getSetup().intValue() > 0) {
-                if (entry.getValue().getSetup().intValue() == 1) {
+                if (entry.getValue().getSetup().intValue() == 1 || entry.getValue().getSetup().intValue() == 3 || entry.getValue().getSetup().intValue() == 4) {
                     for (FlowFormWidgetResult f : entry.getValue().getFormProperty()) {
                         f.setReadable(true);
                         f.setWritable(false);

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

@@ -71,9 +71,9 @@ public class TBViolationServiceImpl extends ServiceImpl<TBViolationMapper, TBVio
     @Transactional
     public Boolean saveTBViolation(TBViolation tBViolation) {
         try {
-             SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+            SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
             if (Objects.isNull(tBViolation.getId())) {// 新增
-                tBViolation.setCode(sequenceService.createCode("violationWarn"));
+                tBViolation.setCode(sequenceService.createCode(DelayWarnSeqTypeEnum.VIOLATION_WARN.getCode()));
                 tBViolation.insertInfo(sysUser.getId());
                 saveOrUpdate(tBViolation);
                 TBViolationResult tbViolationResult = getByCode(tBViolation.getCode());

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

@@ -1249,4 +1249,8 @@ SET code='FORM_GROUP_TITLE', `type`='FORM', form_id='inside_title', form_name='i
 WHERE id=133;
 UPDATE t_d_form_widget
 SET code='FORM_GROUP_TITLE', `type`='FORM', form_id='inside_title', form_name='inside_title', title='项目内审(请于24小时内完成内审)', input_type='STRING', required=0, readable=1, writable=0, visable=1, `scale`=NULL, `length`=NULL, binding=NULL, data_grid=NULL, tips=NULL, format=NULL, span=12, sub_title=NULL, `options`=NULL, flow_type='CLOUD_MARK_SOP_FLOW', form_setup=4, handle=0, create_id=1, create_time=1
-WHERE id=137;
+WHERE id=137;
+
+INSERT INTO `sequence`
+(name, current_value, `increment`)
+VALUES('delayWarn', 0, 1);

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

@@ -105,6 +105,7 @@ public class SystemConstant {
 //    public static final String APPROVE_AUTO = "auto";
     public static final String SYSTEM_AUTO_APPROVE = "系统自动审批";
     public static final String VALUE = "value";
+    public static final String SOP = "SOP";
 
     /**
      * 微信app

+ 32 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/DelayWarnSeqTypeEnum.java

@@ -0,0 +1,32 @@
+package com.qmth.sop.common.enums;
+
+/**
+ * @Description: 延期预警序列类型enum
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2022/1/24
+ */
+public enum DelayWarnSeqTypeEnum {
+
+    VIOLATION_WARN("violationWarn", "violationWarn"),
+
+    DELAY_WARN("项目取消", "delayWarn");
+
+    private String title;
+
+    private String code;
+
+    private DelayWarnSeqTypeEnum(String title, String code) {
+        this.title = title;
+        this.code = code;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public String getCode() {
+        return code;
+    }
+}

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

@@ -11,7 +11,9 @@ public enum DelayWarnTypeEnum {
 
     PLAN("项目信息及计划变更"),
 
-    CANCEL("项目取消");
+    CANCEL("项目取消"),
+
+    TIME("处理时限");
 
     private String title;
 

+ 36 - 5
sop-task/src/main/java/com/qmth/sop/task/listener/MyJobListener.java

@@ -1,17 +1,22 @@
 package com.qmth.sop.task.listener;
 
-import com.qmth.sop.business.entity.TSJobLog;
-import com.qmth.sop.business.entity.TSJobRemind;
-import com.qmth.sop.business.service.TSJobLogService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.entity.*;
+import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.JobEnum;
+import com.qmth.sop.common.enums.*;
+import com.qmth.sop.common.util.ResultUtil;
 import org.quartz.JobDataMap;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.quartz.JobListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Optional;
 
 /**
  * @Description: job监听
@@ -39,6 +44,7 @@ public class MyJobListener implements JobListener {
     }
 
     @Override
+    @Transactional
     public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
         JobEnum jobEnum = JobEnum.valueOf(context.getTrigger().getJobKey().getGroup());
         switch (jobEnum) {
@@ -47,9 +53,34 @@ public class MyJobListener implements JobListener {
                     JobDataMap map = context.getJobDetail().getJobDataMap();
                     TSJobRemind tsJobRemind = (TSJobRemind) map.get(SystemConstant.JOB_DATA);
                     TSJobLogService tsJobLogService = SpringContextHolder.getBean(TSJobLogService.class);
-                    tsJobLogService.save(new TSJobLog(tsJobRemind));
+                    TSJobLog tsJobLog = new TSJobLog(tsJobRemind);
+                    tsJobLogService.save(tsJobLog);
+
+                    //往延期预警表插数据
+                    if (tsJobRemind.getType() == JobQuartzTypeEnum.FLOW && tsJobRemind.getRemindType() == JobTypeEnum.AFTER) {
+                        TFCustomFlowEntityService tfCustomFlowEntityService = SpringContextHolder.getBean(TFCustomFlowEntityService.class);
+                        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getCode, tsJobRemind.getCode()));
+                        Optional.ofNullable(tfCustomFlowEntity).orElseThrow(() -> ExceptionResultEnum.FLOW_ENTITY_NO_DATA.exception());
+
+                        if (tsJobRemind.getCode().contains(SystemConstant.SOP)) {
+                            TBDelayWarnService tbDelayWarnService = SpringContextHolder.getBean(TBDelayWarnService.class);
+                            SequenceService sequenceService = SpringContextHolder.getBean(SequenceService.class);
+
+                            TBSopInfoService tbSopInfoService = SpringContextHolder.getBean(TBSopInfoService.class);
+                            TBSopInfo tbSopInfo = tbSopInfoService.getById(tfCustomFlowEntity.getObjId());
+                            Optional.ofNullable(tbSopInfo).orElseThrow(() -> ExceptionResultEnum.SOP_INFO_NO_DATA.exception());
+
+                            String code = sequenceService.createCode(DelayWarnSeqTypeEnum.DELAY_WARN.getCode());
+                            tbDelayWarnService.save(new TBDelayWarn(tbSopInfo.getCrmNo(), tbSopInfo.getSopNo(), tbSopInfo.getServiceId(), code, tsJobLog.getCreateTime(), tsJobLog.getCreateId(), tsJobRemind.getExecField()));
+                        }
+                    }
                 } catch (Exception e) {
                     log.error(SystemConstant.LOG_ERROR, e);
+                    if (e instanceof ApiException) {
+                        ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
+                    } else {
+                        ResultUtil.error(e.getMessage());
+                    }
                 }
                 break;
             default: