wangliang 1 anno fa
parent
commit
693b32f1ac

+ 37 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/WorkTaskResult.java

@@ -120,6 +120,43 @@ public class WorkTaskResult implements Serializable {
     @ApiModelProperty(value = "流转到达时间")
     private Long flowTime;
 
+    @ApiModelProperty(value = "处理时限(小时)")
+    private Integer processHour;
+
+    @ApiModelProperty(value = "客户类型")
+    private ProductTypeEnum customType;
+
+    @ApiModelProperty(value = "客户类型str")
+    private String customTypeStr;
+
+    public ProductTypeEnum getCustomType() {
+        return customType;
+    }
+
+    public void setCustomType(ProductTypeEnum customType) {
+        this.customType = customType;
+    }
+
+    public String getCustomTypeStr() {
+        if (Objects.nonNull(customType)) {
+            return customType.getTitle();
+        } else {
+            return customTypeStr;
+        }
+    }
+
+    public void setCustomTypeStr(String customTypeStr) {
+        this.customTypeStr = customTypeStr;
+    }
+
+    public Integer getProcessHour() {
+        return processHour;
+    }
+
+    public void setProcessHour(Integer processHour) {
+        this.processHour = processHour;
+    }
+
     public Long getFlowTime() {
         return flowTime;
     }

+ 38 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/TBDingApplyMapper.java

@@ -1,7 +1,11 @@
 package com.qmth.sop.business.mapper;
 
-import com.qmth.sop.business.entity.TBDingApply;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.entity.TBDingApply;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
 
 /**
  * <p>
@@ -13,4 +17,37 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface TBDingApplyMapper extends BaseMapper<TBDingApply> {
 
+    /**
+     * 异常待审核接口
+     *
+     * @param iPage
+     * @param userId
+     * @param serviceId
+     * @param name
+     * @param supplierId
+     * @param customName
+     * @param startTime
+     * @param endTime
+     * @param applyStartTime
+     * @param applyEndTime
+     * @return
+     */
+    IPage<Map> flowTaskUnDoneList(IPage<Map> iPage, @Param("userId") Long userId, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("customName") String customName, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime);
+
+    /**
+     * 异常已审核接口
+     *
+     * @param iPage
+     * @param userId
+     * @param serviceId
+     * @param name
+     * @param supplierId
+     * @param customName
+     * @param startTime
+     * @param endTime
+     * @param applyStartTime
+     * @param applyEndTime
+     * @return
+     */
+    IPage<Map> flowTaskDoneList(IPage<Map> iPage, @Param("userId") Long userId, @Param("serviceId") Long serviceId, @Param("name") String name, @Param("supplierId") Long supplierId, @Param("customName") String customName, @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("applyStartTime") Long applyStartTime, @Param("applyEndTime") Long applyEndTime);
 }

+ 35 - 0
sop-business/src/main/java/com/qmth/sop/business/service/TBDingApplyService.java

@@ -1,8 +1,11 @@
 package com.qmth.sop.business.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.sop.business.entity.TBDingApply;
 
+import java.util.Map;
+
 /**
  * <p>
  * 考勤补卡申请表 服务类
@@ -21,4 +24,36 @@ public interface TBDingApplyService extends IService<TBDingApply> {
      * @throws InterruptedException
      */
     Boolean saveDingApply(TBDingApply tbDingApply) throws InterruptedException;
+
+    /**
+     * 异常待审核接口
+     *
+     * @param iPage
+     * @param serviceId
+     * @param name
+     * @param supplierId
+     * @param customName
+     * @param startTime
+     * @param endTime
+     * @param applyStartTime
+     * @param applyEndTime
+     * @return
+     */
+    IPage<Map> flowTaskUnDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime);
+
+    /**
+     * 异常已审核接口
+     *
+     * @param iPage
+     * @param serviceId
+     * @param name
+     * @param supplierId
+     * @param customName
+     * @param startTime
+     * @param endTime
+     * @param applyStartTime
+     * @param applyEndTime
+     * @return
+     */
+    IPage<Map> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime);
 }

+ 41 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -1,5 +1,6 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
 import com.qmth.sop.business.bean.params.FlowApproveParam;
@@ -65,4 +66,44 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
         return this.saveOrUpdate(tbDingApply);
     }
+
+    /**
+     * 异常待审核接口
+     *
+     * @param iPage
+     * @param serviceId
+     * @param name
+     * @param supplierId
+     * @param customName
+     * @param startTime
+     * @param endTime
+     * @param applyStartTime
+     * @param applyEndTime
+     * @return
+     */
+    @Override
+    public IPage<Map> flowTaskUnDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        return this.baseMapper.flowTaskUnDoneList(iPage, sysUser.getId(), serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime);
+    }
+
+    /**
+     * 异常已审核接口
+     *
+     * @param iPage
+     * @param serviceId
+     * @param name
+     * @param supplierId
+     * @param customName
+     * @param startTime
+     * @param endTime
+     * @param applyStartTime
+     * @param applyEndTime
+     * @return
+     */
+    @Override
+    public IPage<Map> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        return this.baseMapper.flowTaskDoneList(iPage, sysUser.getId(), serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime);
+    }
 }

+ 11 - 5
sop-business/src/main/resources/mapper/SysUserMapper.xml

@@ -24,6 +24,7 @@
                     tbs.name as serviceName,
                     tbs.type as serviceType,
                     sc.id as customId,
+                    sc.type as customType,
                     sc.name as customName,
                     tfcfe.create_id as createId,
                     su.real_name as createRealName,
@@ -36,7 +37,8 @@
                     tfcf.flow_deployment_id as flowDeploymentId,
                     tfcfe.id as customFlowEntityid,
                     tffa.update_time as flowTime,
-                    datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime
+                    datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime,
+                    24 - TIMESTAMPDIFF(HOUR,DATE_FORMAT(FROM_UNIXTIME(tsjr.exec_time / 1000), '%Y-%m-%d %H:%i:%s'),NOW()) as processHour
                 from
                     ACT_RU_TASK art
                     left join t_f_flow_approve tffa on art.PROC_INST_ID_ = tffa.flow_id
@@ -46,8 +48,9 @@
                     left join t_b_service tbs on tbs.id = tbc.service_id
                     left join sys_custom sc on sc.id = tbc.custom_id
                     left join sys_user su ON tfcfe.create_id = su.id
-                <where>
-                    art.ASSIGNEE_ = cast(#{userId} as char)
+                    left join t_s_job_remind tsjr on tsjr.code  = tfcfe.code
+                    <where>
+                        art.ASSIGNEE_ = cast(#{userId} as char)
                     <if test="flowTaskTypeEnum != null and flowTaskTypeEnum != '' and flowTaskTypeEnum == 'DRAFT'">
                         and tffa.status = #{flowTaskTypeEnum}
                     </if>
@@ -73,6 +76,7 @@
                     tbs.name as serviceName,
                     tbs.type as serviceType,
                     sc.id as customId,
+                    sc.type as customType,
                     sc.name as customName,
                     tfcfe.create_id as createId,
                     su.real_name as createRealName,
@@ -85,7 +89,8 @@
                     tfcf.flow_deployment_id as flowDeploymentId,
                     tfcfe.id as customFlowEntityid,
                     tffa.update_time as flowTime,
-                    datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime
+                    datediff(now(),FROM_UNIXTIME(tffa.update_time / 1000,'%Y-%m-%d %H:%i:%s')) as diffTime,
+                    24 - TIMESTAMPDIFF(HOUR,DATE_FORMAT(FROM_UNIXTIME(tsjr.exec_time / 1000), '%Y-%m-%d %H:%i:%s'),NOW()) as processHour
                 from
                     ACT_RU_TASK art
                     left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
@@ -96,7 +101,8 @@
                     left join t_b_service tbs on tbs.id = tbc.service_id
                     left join sys_custom sc on sc.id = tbc.custom_id
                     left join sys_user su ON tfcfe.create_id = su.id
-                <where>
+                    left join t_s_job_remind tsjr on tsjr.code  = tfcfe.code
+                 <where>
                     art.ASSIGNEE_ is null
                   and ari.USER_ID_ = cast(#{userId} as char)
                   and ari.TYPE_ = 'candidate'

+ 7 - 0
sop-business/src/main/resources/mapper/TBDingApplyMapper.xml

@@ -2,4 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.TBDingApplyMapper">
 
+    <select id="flowTaskUnDoneList" resultType="java.util.Map">
+
+    </select>
+
+    <select id="flowTaskDoneList" resultType="java.util.Map">
+
+    </select>
 </mapper>

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

@@ -241,9 +241,11 @@ public class SystemConstant {
     public static final String LOCK_FLOW_END_PREFIX = "lock:flow:end:";//流程结束锁
     public static final String LOCK_FLOW_EXCHANGE_PREFIX = "lock:flow:exchange:";//流程转办锁
     public static final String LOCK_SEQUENCE_PREFIX = "lock:sequence:";//序列锁
+    public static final String LOCK_JOB_PREFIX = "lock:job:";//定时任务锁
 
     public static final Long LOCK_FLOW_TIME_OUT = 60L * 2 * 1000;
     public static final Long LOCK_SEQUENCE_TIME_OUT = 60L * 1 * 1000;
+    public static final Long LOCK_JOB_TIME_OUT = 60L * 5 * 1000;
 
     /**
      * 获取数据库uuid

+ 36 - 4
sop-server/src/main/java/com/qmth/sop/server/api/TBDingApplyController.java

@@ -1,6 +1,7 @@
 package com.qmth.sop.server.api;
 
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.sop.business.entity.TBDingApply;
 import com.qmth.sop.business.service.TBDingApplyService;
@@ -9,13 +10,12 @@ import com.qmth.sop.common.util.Result;
 import com.qmth.sop.common.util.ResultUtil;
 import io.swagger.annotations.*;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
 
 /**
  * <p>
@@ -42,4 +42,36 @@ public class TBDingApplyController {
         }
         return ResultUtil.ok(tbDingApplyService.saveDingApply(tbDingApply));
     }
+
+    @ApiOperation(value = "异常待审核接口")
+    @RequestMapping(value = "/flow/task/un_done/list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result flowTaskUnDoneList(@ApiParam(value = "服务单元id") @RequestParam(required = false) Long serviceId,
+                                     @ApiParam(value = "姓名") @RequestParam(required = false) String name,
+                                     @ApiParam(value = "供应商id") @RequestParam(required = false) Long supplierId,
+                                     @ApiParam(value = "客户名称") @RequestParam(required = false) String customName,
+                                     @ApiParam(value = "异常开始时间") @RequestParam(required = false) Long startTime,
+                                     @ApiParam(value = "异常结束时间") @RequestParam(required = false) Long endTime,
+                                     @ApiParam(value = "申请开始时间") @RequestParam(required = false) Long applyStartTime,
+                                     @ApiParam(value = "申请结束时间") @RequestParam(required = false) Long applyEndTime,
+                                     @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                                     @ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(tbDingApplyService.flowTaskUnDoneList(new Page<>(pageNumber, pageSize), serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime));
+    }
+
+    @ApiOperation(value = "异常已审核接口")
+    @RequestMapping(value = "/flow/task/done/list", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result flowTaskDoneList(@ApiParam(value = "服务单元id") @RequestParam(required = false) Long serviceId,
+                                   @ApiParam(value = "姓名") @RequestParam(required = false) String name,
+                                   @ApiParam(value = "供应商id") @RequestParam(required = false) Long supplierId,
+                                   @ApiParam(value = "客户名称") @RequestParam(required = false) String customName,
+                                   @ApiParam(value = "异常开始时间") @RequestParam(required = false) Long startTime,
+                                   @ApiParam(value = "异常结束时间") @RequestParam(required = false) Long endTime,
+                                   @ApiParam(value = "申请开始时间") @RequestParam(required = false) Long applyStartTime,
+                                   @ApiParam(value = "申请结束时间") @RequestParam(required = false) Long applyEndTime,
+                                   @ApiParam(value = "页码", required = true) @RequestParam @Min(SystemConstant.PAGE_NUMBER_MIN) Integer pageNumber,
+                                   @ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) {
+        return ResultUtil.ok(tbDingApplyService.flowTaskDoneList(new Page<>(pageNumber, pageSize), serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime));
+    }
 }

+ 11 - 1
sop-task/src/main/java/com/qmth/sop/task/job/FlowTaskRemindJob.java

@@ -1,6 +1,7 @@
 package com.qmth.sop.task.job;
 
 import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.common.lock.MemoryLock;
 import com.qmth.sop.task.job.service.JobService;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -23,12 +24,21 @@ public class FlowTaskRemindJob extends QuartzJobBean {
     @Resource
     JobService jobService;
 
+    @Resource
+    MemoryLock memoryLock;
+
     @Override
-    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
+        boolean lock = memoryLock.lock(SystemConstant.LOCK_JOB_PREFIX + context.getJobDetail().getKey(), context.getJobDetail().getKey(), SystemConstant.LOCK_JOB_TIME_OUT);
+        if (!lock) {
+            return;
+        }
         try {
             jobService.flowTaskRemindTask();
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
+        } finally {
+            memoryLock.unlock(SystemConstant.LOCK_JOB_PREFIX + context.getJobDetail().getKey());
         }
     }
 }