|
@ -1,9 +1,11 @@
|
|
|
package com.yihu.jw.care.web;
|
|
|
|
|
|
import com.yihu.jw.care.job.BirthdayReminderJob;
|
|
|
import com.yihu.jw.care.job.QuartzHelper;
|
|
|
import com.yihu.jw.care.job.consult.FinishConsultJob;
|
|
|
import com.yihu.jw.care.job.message.DoctorSendUnreadJob;
|
|
|
import com.yihu.jw.care.job.message.PatientSendUnreadJob;
|
|
|
import com.yihu.jw.care.service.BirthdayReminderService;
|
|
|
import com.yihu.jw.care.service.JobService;
|
|
|
import com.yihu.jw.care.util.SystemConf;
|
|
|
import com.yihu.jw.restmodel.web.ObjEnvelop;
|
|
@ -32,6 +34,8 @@ public class JobController extends BaseController {
|
|
|
|
|
|
private final JobService jobService;
|
|
|
private final QuartzHelper quartzHelper;
|
|
|
@Autowired
|
|
|
private BirthdayReminderService birthdayReminderService;
|
|
|
|
|
|
@Autowired
|
|
|
public JobController(JobService jobService, QuartzHelper quartzHelper) {
|
|
@ -58,6 +62,22 @@ public class JobController extends BaseController {
|
|
|
return success(quartzHelper.getCalendar());
|
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "testJob", method = RequestMethod.GET)
|
|
|
public String testJob(String taskId){
|
|
|
try {
|
|
|
switch(taskId){
|
|
|
case "BIRTHDAY_REMINDER_JOB":
|
|
|
birthdayReminderService.sendMessage();
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
return success("成功");
|
|
|
}catch (Exception e){
|
|
|
error(e);
|
|
|
return invalidUserException(e, -1, "执行失败:" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "isExist", method = RequestMethod.GET)
|
|
@ -77,7 +97,6 @@ public class JobController extends BaseController {
|
|
|
@RequestMapping(value = "reStartById", method = RequestMethod.GET)
|
|
|
public String reStartById(String taskId) {
|
|
|
try {
|
|
|
|
|
|
if(quartzHelper.isExistJob(taskId)){
|
|
|
quartzHelper.removeJob(taskId);
|
|
|
}
|
|
@ -109,7 +128,15 @@ public class JobController extends BaseController {
|
|
|
logger.info("PATIENT_SEND_UNREAD_MES_JOB exist");
|
|
|
}
|
|
|
break;
|
|
|
|
|
|
case "BIRTHDAY_REMINDER_JOB":
|
|
|
if (!quartzHelper.isExistJob("BIRTHDAY_REMINDER_JOB")) {
|
|
|
String trigger = SystemConf.getInstance().getSystemProperties().getProperty("BIRTHDAY_REMINDER_JOB");
|
|
|
quartzHelper.addJob(BirthdayReminderJob.class, trigger, "BIRTHDAY_REMINDER_JOB", new HashMap<String, Object>());
|
|
|
logger.info("BIRTHDAY_REMINDER_JOB success");
|
|
|
} else {
|
|
|
logger.info("BIRTHDAY_REMINDER_JOB exist");
|
|
|
}
|
|
|
break;
|
|
|
default :
|
|
|
}
|
|
|
return success("启动成功!");
|