|
@@ -16,10 +16,12 @@ import com.qmth.sop.business.service.BasicAttachmentService;
|
|
import com.qmth.sop.business.service.TBDingApplyService;
|
|
import com.qmth.sop.business.service.TBDingApplyService;
|
|
import com.qmth.sop.business.service.TBDingService;
|
|
import com.qmth.sop.business.service.TBDingService;
|
|
import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
|
|
+import com.qmth.sop.common.contant.SpringContextHolder;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.DingExceptionApproveEnum;
|
|
import com.qmth.sop.common.enums.DingExceptionApproveEnum;
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
import com.qmth.sop.common.enums.FlowApprovePassEnum;
|
|
import com.qmth.sop.common.enums.FlowApprovePassEnum;
|
|
|
|
+import com.qmth.sop.common.enums.InOutTypeEnum;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
import org.activiti.engine.TaskService;
|
|
import org.activiti.engine.TaskService;
|
|
import org.activiti.engine.task.Task;
|
|
import org.activiti.engine.task.Task;
|
|
@@ -154,16 +156,78 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
|
|
* @param dingExceptionApprove
|
|
* @param dingExceptionApprove
|
|
* @param userId
|
|
* @param userId
|
|
* @return
|
|
* @return
|
|
|
|
+ * @throws InterruptedException
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional
|
|
public Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException {
|
|
public Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException {
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
|
|
userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
|
|
|
|
+ TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
|
|
|
|
+ return tbDingApplyService.taskApprove(taskId, userId, dingExceptionApprove);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 更新考勤异常打卡时间
|
|
|
|
+ *
|
|
|
|
+ * @param dingExceptionNo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public Boolean updateDingExceptionTime(String dingExceptionNo) {
|
|
|
|
+ TBDingApply tbDingApply = this.getOne(new QueryWrapper<TBDingApply>().lambda().eq(TBDingApply::getDingExceptionNo, dingExceptionNo));
|
|
|
|
+ Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ TBDing tbDing = tbDingService.getById(tbDingApply.getDingId());
|
|
|
|
+ Optional.ofNullable(tbDing).orElseThrow(() -> ExceptionResultEnum.DING_NO_DATA.exception());
|
|
|
|
+
|
|
|
|
+ if (tbDingApply.getType() == InOutTypeEnum.IN) {
|
|
|
|
+ tbDing.setSignInTime(tbDingApply.getApplyTime());
|
|
|
|
+ } else if (tbDingApply.getType() == InOutTypeEnum.OUT) {
|
|
|
|
+ tbDing.setSignOutTime(tbDingApply.getApplyTime());
|
|
|
|
+ }
|
|
|
|
+ return tbDingService.updateById(tbDing);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 考勤异常审核接口
|
|
|
|
+ *
|
|
|
|
+ * @param taskIds
|
|
|
|
+ * @param dingExceptionApprove
|
|
|
|
+ * @param userId
|
|
|
|
+ * @return
|
|
|
|
+ * @throws InterruptedException
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional
|
|
|
|
+ public Boolean flowBatchApprove(List<Long> taskIds, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException {
|
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
+ userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
|
|
|
|
+ TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
|
|
|
|
+ for (Long l : taskIds) {
|
|
|
|
+ tbDingApplyService.taskApprove(l, userId, dingExceptionApprove);
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 审批公用方法
|
|
|
|
+ *
|
|
|
|
+ * @param taskId
|
|
|
|
+ * @param userId
|
|
|
|
+ * @param dingExceptionApprove
|
|
|
|
+ * @return
|
|
|
|
+ * @throws InterruptedException
|
|
|
|
+ */
|
|
|
|
+ public Boolean taskApprove(Long taskId, Long userId, DingExceptionApproveEnum dingExceptionApprove) throws InterruptedException {
|
|
Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
|
|
Task task = taskService.createTaskQuery().taskId(String.valueOf(taskId)).singleResult();
|
|
Optional.ofNullable(task).orElseThrow(() -> ExceptionResultEnum.FLOW_TASK_NO_DATA.exception());
|
|
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())));
|
|
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;
|
|
|
|
|
|
+ activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, Arrays.asList(String.valueOf(userId)), tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
|
|
|
|
+
|
|
|
|
+ TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
|
|
|
|
+ return tbDingApplyService.updateDingExceptionTime(tfCustomFlowEntity.getCode());
|
|
}
|
|
}
|
|
}
|
|
}
|