package com.ruoyi.system.task.jobs; import com.aizuda.bpm.engine.entity.FlwTaskActor; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.system.bo.ProcessAgreeBO; import com.ruoyi.system.task.base.AbstractJob; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; import org.quartz.JobExecutionException; import java.util.Objects; /** * 发票定时任务 * @author Administrator * */ public class StateProcessJob extends AbstractJob { public static final String name = "stateProcess_"; @Override public void execute(JobExecutionContext context) throws JobExecutionException { JobDataMap maps = context.getMergedJobDataMap(); Long taskId = maps.getLong("id"); try { System.err.println("执行定时任务"); ProcessAgreeBO processAgreeBO = new ProcessAgreeBO(); processAgreeBO.setTaskId(String.valueOf(taskId)); FlwTaskActor flwTaskActor = flwTaskActorMapper.selectOne(Wrappers.lambdaQuery(FlwTaskActor.class).eq(FlwTaskActor::getTaskId, taskId).last("LIMIT 1")); if(Objects.isNull(flwTaskActor)){ System.err.println("该任务不存在"); return; } processAgreeBO.setRemark("自动审批"); processAgreeBO.setUserId(Long.valueOf(flwTaskActor.getActorId())); stateProcessTemplateService.agree(processAgreeBO); // 短信发送 SysUser sysUser = sysUserService.selectUserById(Long.valueOf(flwTaskActor.getActorId())); smsUtil.sendSms(sysUser.getPhonenumber(), "2369951", new String[]{}); }catch(Exception e){ e.printStackTrace(); } } }