Browse Source

配置修改

chenweida 7 years ago
parent
commit
3e1918d216

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

@ -271,161 +271,5 @@ public class JobController extends BaseController {
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
        }
    }
    }
    /**
     * 启动健康信息生成的任务
     *
     * @return
     */
    @ApiOperation(value = "启动健康信息生成的任务")
    @RequestMapping(value = "startHealthMessageJob", method = RequestMethod.GET)
    public String startHealthMessageJob() {
        try {
            jobService.startHealthMessageJob();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            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());
        }
    }
    /**
     * 停止判断的任务
     *
     * @return
     */
    @ApiOperation(value = "停止健康信息生成的任务")
    @RequestMapping(value = "stopHealthMessageJob", method = RequestMethod.GET)
    public String stopHealthMessageJob() {
        try {
            jobService.stopHealthMessageJob();
            return success("停止成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天的健康消息
     *
     * @param day
     * @return
     */
    @ApiOperation(value = "生成过去某一天的健康消息")
    @RequestMapping(value = "productHealthDataByOneDay", method = RequestMethod.GET)
    public String productHealthDataByOneDay( @ApiParam(name = "day", value = "yyyy-MM-dd")
                                           @RequestParam(value = "day", required = true)String day) {
        try {
            jobService.productHealthDataByOneDay(day);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 生成过去某一天到某一天的某个指标的数据
     *
     * @param start
     * @param end
     * @return
     */
    @ApiOperation(value = "生成过去某一天到某一天的健康消息(包含头尾)")
    @RequestMapping(value = "productHealthDataByDayToDay", method = RequestMethod.GET)
    public String productHealthDataByDayToDay( @ApiParam(name = "start", value = "yyyy-MM-dd")@RequestParam(value = "start", required = true)String start,
                                              @ApiParam(name = "end", value = "yyyy-MM-dd")@RequestParam(value = "end", required = true)String end
                                             ) {
        try {
            jobService.productHealthDataByDayToDay(start,end);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /**
     * 启动通知任务
     *
     * @return
     */
    @ApiOperation(value = "启动通知任务")
    @RequestMapping(value = "startNoticeJob", method = RequestMethod.GET)
    public String startNoticeJob() {
        try {
            jobService.startNoticeJob();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            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());
        }
    }
    /**
     * 启动通知任务
     *
     * @return
     */
    @ApiOperation(value = "停止通知任务")
    @RequestMapping(value = "stopNoticeJob", method = RequestMethod.GET)
    public String stopNoticeJob() {
        try {
            jobService.stopNoticeJob();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    /******************************** 随访计划消息 ****************************************************/
    @ApiOperation(value = "启动随访计划消息任务")
    @RequestMapping(value = "startFollowupPlantJob", method = RequestMethod.GET)
    public String startFollowupPlantJob() {
        try {
            jobService.startFollowupPlantJob();
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "停止随访计划消息任务")
    @RequestMapping(value = "stopFollowupPlantJob", method = RequestMethod.GET)
    public String stopFollowupPlantJob() {
        try {
            jobService.stopFollowupPlantJob();
            return success("停止成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
}
}

+ 0 - 122
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -36,11 +36,6 @@ public class JobService {
    @Autowired
    @Autowired
    private QuartzJobConfigDao wlyyJobConfigDao;
    private QuartzJobConfigDao wlyyJobConfigDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private DoctorPatientGroupInfoDao doctorPatientGroupInfoDao;
    @Autowired
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
@ -251,12 +246,6 @@ public class JobService {
        }
        }
    }
    }
//    @Transactional
//    @Async("dbExtractExecutor")
//    public void startaaaa() throws Exception {
//        quartzHelper.startNow(HealthMessageJob.class, UUID.randomUUID().toString().replace("-", ""), new HashMap<>());
//    }
    public void productDataByDayAndId(Integer day, String id) throws Exception {
    public void productDataByDayAndId(Integer day, String id) throws Exception {
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id);
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id);
        if (quartzJobConfig == null) {
        if (quartzJobConfig == null) {
@ -345,115 +334,4 @@ public class JobService {
        }
        }
    }
    }
//    public void startHealthMessageJob() throws Exception {
//        if (!quartzHelper.isExistJob(HealthMessageJob.jobKey)) {
//            quartzHelper.addJob(HealthMessageJob.class, HealthMessageJob.cron, HealthMessageJob.jobKey, new HashMap<>());
//        } else {
//            throw new Exception("已经启动");
//        }
//    }
//
//    public void stopHealthMessageJob() throws Exception {
//        if (quartzHelper.isExistJob(HealthMessageJob.jobKey)) {
//            quartzHelper.removeJob(HealthMessageJob.jobKey);
//        } else {
//            throw new Exception("已经停止");
//        }
//    }
//
//    public void productHealthDataByOneDay(String day) throws Exception {
//        SimpleDateFormat dataSimple = new SimpleDateFormat("yyyy-MM-dd");
//
//        Date date = dataSimple.parse(day);
//        if (date == null) {
//            throw new Exception("时间格式错误");
//        }
//        Calendar calendar = new GregorianCalendar();
//        calendar.setTime(date);
//        calendar.add(calendar.DATE, 1);//把日期往后增加一天.整数往后推,负数往前移动
//        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果
//        String yesterday = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime());
//        Map<String, String> params = new HashMap<String, String>();
//        //往quartz框架添加任务
//        params.put("now", yesterday);
//        params.put("yesterday", day);
//
//        quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
//        //Thread.sleep(40000L);
//    }
//
//    public void productHealthDataByDayToDay(String start, String end) throws Exception {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        Date startDate = sdf.parse(start);
//        Date endDate = sdf.parse(end);
//        if (startDate.after(endDate)) {
//            throw new Exception("日期参数错误");
//        }
//        int day = daysBetween(startDate, endDate);
//        for (int i = 0; i < day; i++) {
//            productHealthDataByOneDay(getYesterday(i, startDate));
//        }
//    }
//
//    public static void main(String[] args) throws Exception {
//
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//        Date startDate = sdf.parse("2016-10-20");
//        Date endDate = sdf.parse("2016-10-28");
//        System.out.println(daysBetween(startDate, endDate));
//        System.out.println(getYesterday(0, startDate));
//    }
//
//
//    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<>());
//
//        } else {
//            throw new Exception("已经启动");
//        }
//    }
//
//    public void stopNoticeJob() throws Exception {
//        if (quartzHelper.isExistJob(NoticeJob.jobKey)) {
//            quartzHelper.removeJob(NoticeJob.jobKey);
//        } else {
//            throw new Exception("已经停止");
//        }
//    }
    /*******************************
     * 随访计划任务
     *******************************************************/
//    @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<>());
//        } else {
//            throw new Exception("已经启动");
//        }
//    }
//
//    public void stopFollowupPlantJob() throws Exception {
//        if (quartzHelper.isExistJob(followupJob)) {
//            quartzHelper.removeJob(followupJob);
//        } else {
//            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<>());
//    }
}
}