소스 검색

新增考勤异常审核接口

wangliang 1 년 전
부모
커밋
17495e20bd

+ 1 - 3
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -443,9 +443,7 @@ public class ActivitiServiceImpl implements ActivitiService {
     @Override
     public IPage<WorkTaskResult> getFlowTaskList(IPage<Map> iPage, Long userId, TFCustomTypeEnum type, Long serviceId, String customName, FlowTaskTypeEnum flowTaskTypeEnum) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
-        if (Objects.nonNull(sysUser)) {
-            userId = sysUser.getId();
-        }
+        userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
         Map<String, Object> map = new HashMap<>();
         IPage<WorkTaskResult> workTaskResultIPage = sysUserService.getFlowTaskList(iPage, userId, type, serviceId, customName, flowTaskTypeEnum);
         if (Objects.nonNull(workTaskResultIPage) && !CollectionUtils.isEmpty(workTaskResultIPage.getRecords())) {

+ 8 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/params/FlowApproveParam.java

@@ -63,6 +63,14 @@ public class FlowApproveParam implements Serializable {
         this.crmNo = crmNo;
     }
 
+    public FlowApproveParam(Long taskId, FlowApprovePassEnum approve, List<String> approveUserIds, String crmNo, String approveRemark) {
+        this.taskId = taskId;
+        this.approve = approve;
+        this.approveUserIds = approveUserIds;
+        this.crmNo = crmNo;
+        this.approveRemark = approveRemark;
+    }
+
     public String getCrmNo() {
         return crmNo;
     }

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

@@ -60,4 +60,14 @@ public interface TBDingApplyService extends IService<TBDingApply> {
      * @return
      */
     IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, DingExceptionApproveEnum dingExceptionApprove, String customName, String startTime, String endTime, Long applyStartTime, Long applyEndTime) throws Exception;
+
+    /**
+     * 考勤异常审核接口
+     *
+     * @param taskId
+     * @param dingExceptionApprove
+     * @param userId
+     * @return
+     */
+    Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException;
 }

+ 26 - 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.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.activiti.service.ActivitiService;
@@ -20,6 +21,8 @@ import com.qmth.sop.common.enums.DingExceptionApproveEnum;
 import com.qmth.sop.common.enums.ExceptionResultEnum;
 import com.qmth.sop.common.enums.FlowApprovePassEnum;
 import com.qmth.sop.common.util.ServletUtil;
+import org.activiti.engine.TaskService;
+import org.activiti.engine.task.Task;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -50,6 +53,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Resource
     BasicAttachmentService basicAttachmentService;
 
+    @Resource
+    TaskService taskService;
+
     /**
      * 新增考勤异常补卡申请
      *
@@ -140,4 +146,24 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         }
         return dingApplyDoneResultIPage;
     }
+
+    /**
+     * 考勤异常审核接口
+     *
+     * @param taskId
+     * @param dingExceptionApprove
+     * @param userId
+     * @return
+     */
+    @Override
+    public Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
+        Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
+        Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
+
+        TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.getOne(new QueryWrapper<TFCustomFlowEntity>().lambda().eq(TFCustomFlowEntity::getFlowId, Long.parseLong(task.getProcessInstanceId())));
+        activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, Arrays.asList(String.valueOf(sysUser.getId())), tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
+        return true;
+    }
 }

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

@@ -710,4 +710,14 @@ INSERT INTO sys_privilege
 VALUES(3019, '考勤异常待审核接口', '/api/admin/ding/exception/apply/flow/task/un_done/list', 'URL', 26, 2, 'AUTH', NULL, 1, 1, 0);
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(3020, '考勤异常已审核接口', '/api/admin/ding/exception/apply/flow/task/done/list', 'URL', 26, 3, 'AUTH', NULL, 1, 1, 0);
+VALUES(3020, '考勤异常已审核接口', '/api/admin/ding/exception/apply/flow/task/done/list', 'URL', 26, 3, 'AUTH', NULL, 1, 1, 0);
+
+UPDATE sys_privilege
+SET name='待审核-通过', url='Pass', `type`='LINK', parent_id=27, `sequence`=1, property='AUTH', related='3017,3021', enable=1, default_auth=0, front_display=1
+WHERE id=136;
+UPDATE sys_privilege
+SET name='待审核-拒绝', url='Reject', `type`='LINK', parent_id=27, `sequence`=2, property='AUTH', related='3017,3021', enable=1, default_auth=0, front_display=1
+WHERE id=137;
+INSERT INTO sys_privilege
+(id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
+VALUES(3021, '考勤异常审核接口', '/api/admin/ding/exception/apply/flow/approve', 'URL', 26, 4, 'AUTH', NULL, 1, 1, 0);

+ 13 - 2
sop-server/src/main/java/com/qmth/sop/server/api/TBDingApplyController.java

@@ -4,6 +4,8 @@ package com.qmth.sop.server.api;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.qmth.boot.api.constant.ApiConstant;
+import com.qmth.sop.business.bean.result.DingApplyDoneResult;
+import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
 import com.qmth.sop.business.entity.TBDingApply;
 import com.qmth.sop.business.service.TBDingApplyService;
 import com.qmth.sop.common.contant.SystemConstant;
@@ -49,7 +51,7 @@ public class TBDingApplyController {
 
     @ApiOperation(value = "考勤异常待审核接口")
     @RequestMapping(value = "/flow/task/un_done/list", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = DingApplyUnDoneResult.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,
@@ -65,7 +67,7 @@ public class TBDingApplyController {
 
     @ApiOperation(value = "考勤异常已审核接口")
     @RequestMapping(value = "/flow/task/done/list", method = RequestMethod.POST)
-    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = DingApplyDoneResult.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,
@@ -79,4 +81,13 @@ public class TBDingApplyController {
                                    @ApiParam(value = "页数", required = true) @RequestParam @Min(SystemConstant.PAGE_SIZE_MIN) @Max(SystemConstant.PAGE_SIZE_MAX) Integer pageSize) throws Exception {
         return ResultUtil.ok(tbDingApplyService.flowTaskDoneList(new Page<>(pageNumber, pageSize), serviceId, name, supplierId, dingExceptionApprove, customName, Objects.nonNull(startTime) ? DateUtil.format(new Date(startTime), SystemConstant.DEFAULT_DATE_YMD_PATTERN) : null, Objects.nonNull(endTime) ? DateUtil.format(new Date(endTime), SystemConstant.DEFAULT_DATE_YMD_PATTERN) : null, applyStartTime, applyEndTime));
     }
+
+    @ApiOperation(value = "考勤异常审核接口")
+    @RequestMapping(value = "/flow/approve", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = Object.class)})
+    public Result flowApprove(@ApiParam(value = "流程任务id", required = true) @RequestParam Long taskId,
+                              @ApiParam(value = "审核结果", required = true) @RequestParam DingExceptionApproveEnum dingExceptionApprove,
+                              @ApiParam(value = "审核用户id") @RequestParam(required = false) Long userId) throws InterruptedException {
+        return ResultUtil.ok(tbDingApplyService.flowApprove(taskId, dingExceptionApprove, userId));
+    }
 }