Forráskód Böngészése

厦门-统计-新增2个立即执行的方法

chenweida 8 éve
szülő
commit
414c5628b8

+ 27 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java

@ -337,6 +337,17 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "立即启动健康信息生成的任务")
    @RequestMapping(value = "startHealthMessageJobNow", method = RequestMethod.GET)
    public String startHealthMessageJobNow() {
        try {
            jobService.startHealthMessageJobNow();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 停止判断的任务
     *
@ -451,6 +462,22 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动通知任务
     *
     * @return
     */
    @ApiOperation(value = "立即启动通知任务")
    @RequestMapping(value = "startNoticeJobNow", method = RequestMethod.GET)
    public String startNoticeJobNow() {
        try {
            jobService.startNoticeJobNow();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动通知任务
     *

+ 15 - 3
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -462,8 +462,8 @@ public class JobService {
    public void startNoticeJob() throws Exception {
        if (!quartzHelper.isExistJob(NoticeJob.jobKey)) {
            quartzHelper.addJob(NoticeJob.class,NoticeJob.jobCron,NoticeJob.jobKey,new HashMap<>());
           // quartzHelper.startNow(NoticeJob.class, UUID.randomUUID().toString().replace("-", ""), new HashMap<>());
            quartzHelper.addJob(NoticeJob.class, NoticeJob.jobCron, NoticeJob.jobKey, new HashMap<>());
            // quartzHelper.startNow(NoticeJob.class, UUID.randomUUID().toString().replace("-", ""), new HashMap<>());
        } else {
            throw new Exception("已经启动");
@ -478,11 +478,14 @@ public class JobService {
        }
    }
    /******************************* 随访计划任务 *******************************************************/
    /*******************************
     * 随访计划任务
     *******************************************************/
    @Value("${spring.followupMessage.jobId}")
    private String followupJob;
    @Value("${spring.followupMessage.cron}")
    private String followupJobCron;
    public void startFollowupPlantJob() throws Exception {
        if (!quartzHelper.isExistJob(followupJob)) {
            quartzHelper.addJob(FollowupPlanJob.class, followupJobCron, followupJob, new HashMap<>());
@ -498,4 +501,13 @@ public class JobService {
            throw new Exception("已经停止");
        }
    }
    public void startNoticeJobNow() throws Exception {
        quartzHelper.startNow(NoticeJob.class, UUID.randomUUID().toString(), new HashMap<>());
    }
    public void startHealthMessageJobNow() throws Exception {
        quartzHelper.startNow(HealthMessageJob.class, UUID.randomUUID().toString(), new HashMap<>());
    }
}