|  | @ -4,11 +4,13 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
 | 
												
													
														
															|  | import com.yihu.jw.im.service.ImService;
 |  | import com.yihu.jw.im.service.ImService;
 | 
												
													
														
															|  | import com.yihu.jw.internet.service.DataGeneratorService;
 |  | import com.yihu.jw.internet.service.DataGeneratorService;
 | 
												
													
														
															|  | import com.yihu.jw.internet.service.InternetService;
 |  | import com.yihu.jw.internet.service.InternetService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.job.DataUploadJob;
 | 
												
													
														
															|  | import com.yihu.jw.job.PrescriptionOverdueJob;
 |  | import com.yihu.jw.job.PrescriptionOverdueJob;
 | 
												
													
														
															|  | import com.yihu.jw.job.PrescriptionStatusUpdateJob;
 |  | import com.yihu.jw.job.PrescriptionStatusUpdateJob;
 | 
												
													
														
															|  | import com.yihu.jw.job.QuartzHelper;
 |  | import com.yihu.jw.job.QuartzHelper;
 | 
												
													
														
															|  | import com.yihu.jw.service.quota.JobService;
 |  | import com.yihu.jw.service.quota.JobService;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.util.SystemConf;
 | 
												
													
														
															|  | import com.yihu.jw.util.date.DateUtil;
 |  | import com.yihu.jw.util.date.DateUtil;
 | 
												
													
														
															|  | import com.yihu.jw.web.BaseController;
 |  | import com.yihu.jw.web.BaseController;
 | 
												
													
														
															|  | import io.swagger.annotations.Api;
 |  | import io.swagger.annotations.Api;
 | 
												
											
												
													
														
															|  | @ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 | 
												
													
														
															|  | import org.springframework.web.bind.annotation.RequestMethod;
 |  | import org.springframework.web.bind.annotation.RequestMethod;
 | 
												
													
														
															|  | import org.springframework.web.bind.annotation.RestController;
 |  | import org.springframework.web.bind.annotation.RestController;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import java.util.HashMap;
 | 
												
													
														
															|  | import java.util.List;
 |  | import java.util.List;
 | 
												
													
														
															|  | import java.util.UUID;
 |  | import java.util.UUID;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -52,29 +55,64 @@ public class JobController extends BaseController {
 | 
												
													
														
															|  |         this.quartzHelper = quartzHelper;
 |  |         this.quartzHelper = quartzHelper;
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     /**
 |  | 
 | 
												
													
														
															|  |      * 启动任务
 |  | 
 | 
												
													
														
															|  |      *
 |  | 
 | 
												
													
														
															|  |      * @param id id
 |  | 
 | 
												
													
														
															|  |      * @return
 |  | 
 | 
												
													
														
															|  |      */
 |  | 
 | 
												
													
														
															|  |     @RequestMapping(value = "startNowById", method = RequestMethod.GET)
 |  | 
 | 
												
													
														
															|  |     public String startNowById(String id) {
 |  | 
 | 
												
													
														
															|  |         try {
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             jobService.startNowById(id);
 |  | 
 | 
												
													
														
															|  |             return success("启动成功!");
 |  | 
 | 
												
													
														
															|  | 
 |  |     @RequestMapping(value = "removeJob", method = RequestMethod.GET)
 | 
												
													
														
															|  | 
 |  |     public String removeJob(String taskId) {
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             if(quartzHelper.isExistJob(taskId)){
 | 
												
													
														
															|  | 
 |  |                 quartzHelper.removeJob(taskId);
 | 
												
													
														
															|  | 
 |  |                 return success("删除成功!");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             return success("删除成功!");
 | 
												
													
														
															|  |         } catch (Exception e) {
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  |             error(e);
 |  |             error(e);
 | 
												
													
														
															|  |             return invalidUserException(e, -1, "启动失败:" + e.getMessage());
 |  | 
 | 
												
													
														
															|  | 
 |  |             return invalidUserException(e, -1, "删除失败:" + e.getMessage());
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |     @RequestMapping(value = "isExist", method = RequestMethod.GET)
 |  |     @RequestMapping(value = "isExist", method = RequestMethod.GET)
 | 
												
													
														
															|  |     public String isExist(String id) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public String isExist(String taskId) {
 | 
												
													
														
															|  | 
 |  |         try {
 | 
												
													
														
															|  | 
 |  |             if(quartzHelper.isExistJob(taskId)){
 | 
												
													
														
															|  | 
 |  |                 return success("job已经存在!");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             return success("job不存在!");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         } catch (Exception e) {
 | 
												
													
														
															|  | 
 |  |             error(e);
 | 
												
													
														
															|  | 
 |  |             return invalidUserException(e, -1, "执行失败:" + e.getMessage());
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |     @RequestMapping(value = "reStartById", method = RequestMethod.GET)
 | 
												
													
														
															|  | 
 |  |     public String reStartById(String taskId) {
 | 
												
													
														
															|  |         try {
 |  |         try {
 | 
												
													
														
															|  |             if(quartzHelper.isExistJob(id)){
 |  | 
 | 
												
													
														
															|  |                 return success("启动成功!");
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             if(quartzHelper.isExistJob(taskId)){
 | 
												
													
														
															|  | 
 |  |                 quartzHelper.removeJob(taskId);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |             switch(taskId){
 | 
												
													
														
															|  | 
 |  |                 case "prescription_overdue_job":
 | 
												
													
														
															|  | 
 |  |                     if (!quartzHelper.isExistJob("prescription_overdue_job")) {
 | 
												
													
														
															|  | 
 |  |                         String trigger = SystemConf.getInstance().getSystemProperties().getProperty("prescription_overdue_job");
 | 
												
													
														
															|  | 
 |  |                         quartzHelper.addJob(PrescriptionOverdueJob.class, trigger, "prescription_overdue_job", new HashMap<String, Object>());
 | 
												
													
														
															|  | 
 |  |                         logger.info("prescription_overdue_job  job success");
 | 
												
													
														
															|  | 
 |  |                     } else {
 | 
												
													
														
															|  | 
 |  |                         logger.info("prescription_overdue_job  job exist");
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  |                     break;
 | 
												
													
														
															|  | 
 |  |                 case "data_upload_job" :
 | 
												
													
														
															|  | 
 |  |                     //互联网医院 监管平台上报
 | 
												
													
														
															|  | 
 |  |                     if (!quartzHelper.isExistJob("data_upload_job")) {
 | 
												
													
														
															|  | 
 |  |                         String trigger = SystemConf.getInstance().getSystemProperties().getProperty("data_upload_job");
 | 
												
													
														
															|  | 
 |  |                         quartzHelper.addJob(DataUploadJob.class, trigger, "data_upload_job", new HashMap<String, Object>());
 | 
												
													
														
															|  | 
 |  |                         logger.info("data_upload_job  job success");
 | 
												
													
														
															|  | 
 |  |                     } else {
 | 
												
													
														
															|  | 
 |  |                         logger.info("data_upload_job  job exist");
 | 
												
													
														
															|  | 
 |  |                     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |                     break;
 | 
												
													
														
															|  | 
 |  |                 default :
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |             return success("启动失败!");
 |  |             return success("启动失败!");
 | 
												
													
														
															|  | 
 |  | 
 |