Browse Source

统计提交

esb 8 years ago
parent
commit
2bffb4a88e
19 changed files with 188 additions and 26 deletions
  1. 1 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/Application.java
  2. 25 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/JobFactory.java
  3. 36 2
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SchedulerConfig.java
  4. 7 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SwaggerConfig.java
  5. 17 10
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java
  6. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/AllSignExpenseStatusJob.java
  7. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/AllSignJob.java
  8. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/ChangeSignJob.java
  9. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/ConsultJob.java
  10. 6 4
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  11. 6 4
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/FollowUpJob.java
  12. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/HealthGuideJob.java
  13. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignAgeGroupDiseaseJob.java
  14. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignJob.java
  15. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/UnSignJob.java
  16. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/WaitSignJob.java
  17. 2 0
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/check/CheckSignJob.java
  18. 29 6
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  19. 41 0
      patient-co-statistics/src/main/resources/quartz.properties

+ 1 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/Application.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.statistics;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
/**
 * Created by Administrator on 2016.10.12.

+ 25 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/JobFactory.java

@ -0,0 +1,25 @@
package com.yihu.wlyy.statistics.config;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.scheduling.quartz.AdaptableJobFactory;
import org.springframework.stereotype.Component;
/**
 * Created by Administrator on 2016.10.12.
 * 為了讓quartz種可以使用Spring的注入
 */
@Component("jobFactory")
public class JobFactory extends AdaptableJobFactory {
    @Autowired
    private AutowireCapableBeanFactory capableBeanFactory;
    @Override
    protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
    // 调用父类的方法
        Object jobInstance = super.createJobInstance(bundle);
    // 进行注入
        capableBeanFactory.autowireBean(jobInstance);
        return jobInstance;
    }
}

+ 36 - 2
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SchedulerConfig.java

@ -1,20 +1,54 @@
package com.yihu.wlyy.statistics.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import javax.sql.DataSource;
import java.io.IOException;
import java.util.Properties;
/**
 * Created by chenweida on 2016/2/3.
 */
@Configuration
public class SchedulerConfig {
    @Autowired
    private ApplicationContext applicationContext;
    @Autowired
    private JobFactory jobFactory;
    @Autowired
    private DataSource dataSource;
    @Bean
    SchedulerFactoryBean schedulerFactoryBean(){
    SchedulerFactoryBean schedulerFactoryBean() throws IOException {
        SchedulerFactoryBean bean = new SchedulerFactoryBean();
        bean.setJobFactory(jobFactory);
        bean.setApplicationContext(this.applicationContext);
        bean.setOverwriteExistingJobs(true);
        bean.setStartupDelay(20);// 延时启动
        bean.setAutoStartup(true);
        bean.setDataSource(dataSource);
        bean.setQuartzProperties(quartzProperties());
        bean.setSchedulerName("PackageResolveScheduler");
        return bean;
    }
    /**
     * quartz配置文件
     * @return
     * @throws IOException
     */
    @Bean
    public Properties quartzProperties() throws IOException {
        PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
        propertiesFactoryBean.setLocation(new ClassPathResource("/quartz.properties"));
        propertiesFactoryBean.afterPropertiesSet();
        return propertiesFactoryBean.getObject();
    }
}

+ 7 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/SwaggerConfig.java

@ -23,7 +23,14 @@ import static springfox.documentation.builders.PathSelectors.regex;
@EnableSwagger2
public class SwaggerConfig extends WebMvcConfigurerAdapter {
    private static final String PUBLIC_API = "Default";
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    @Bean
    public Docket publicAPI() {
        return new Docket(DocumentationType.SWAGGER_2)

+ 17 - 10
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/controller/JobController.java

@ -4,10 +4,12 @@ import com.yihu.wlyy.statistics.job.business.QuartzHelper;
import com.yihu.wlyy.statistics.service.JobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@ -33,7 +35,8 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "根据ID立即单个任务")
    @RequestMapping(value = "startNowById", method = RequestMethod.GET)
    public String startNowById(String id) {
    public String startNowById(
            @ApiParam(name = "id", value = "任务ID")@RequestParam(value = "id", required = true) String id) {
        try {
            jobService.startNowById(id);
            return success("启动成功!");
@ -51,7 +54,7 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去几天的数据")
    @RequestMapping(value = "productDataByDay", method = RequestMethod.GET)
    public String productDataByDay(Integer day) {
    public String productDataByDay(  @ApiParam(name = "day", value = "距离今天的天数(如果是要生成昨天的数据,day=1)")@RequestParam(value = "day", required = true) int day) {
        try {
            jobService.productDataByDay(day);
            return success("启动成功!");
@ -69,7 +72,7 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天的全部的数据")
    @RequestMapping(value = "productDataByOneDay", method = RequestMethod.GET)
    public String productDataByOneDay(String day) {
    public String productDataByOneDay( @ApiParam(name = "day", value = "yyyy-MM-dd")@RequestParam(value = "day", required = true)String day) {
        try {
            jobService.productDataByOneDay(day);
            return success("启动成功!");
@ -87,7 +90,9 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "生成过去某一天的全部的数据")
    @RequestMapping(value = "productDataByOneDayWithId", method = RequestMethod.GET)
    public String productDataByOneDayWithId(String day, String id) {
    public String productDataByOneDayWithId(
            @ApiParam(name = "day", value = "yyyy-MM-dd")@RequestParam(value = "day", required = true)String day,
            @ApiParam(name = "id", value = "任务id")@RequestParam(value = "id", required = true)String id) {
        try {
            jobService.productDataByOneDayWithId(day, id);
            return success("启动成功!");
@ -97,14 +102,16 @@ public class JobController extends BaseController {
        }
    }
    /**
     * 生成过去某几天的某一个指标的数据
     * 生成过去到现在的全部的数据
     *
     * @param day
     * @return
     */
    @ApiOperation(value = "生成过去某一天的全部的数据")
    @ApiOperation(value = "生成过去到现在的全部的数据")
    @RequestMapping(value = "productDataByDayAndId", method = RequestMethod.GET)
    public String productDataByDayAndId(Integer day, String id) {
    public String productDataByDayAndId(
            @ApiParam(name = "day", value = "距离今天的天数(如果是要生成昨天的数据,day=1)")@RequestParam(value = "day", required = true) int day,
            @ApiParam(name="id",required=true)@RequestParam(value = "id", required = true) String id) {
        try {
            jobService.productDataByDayAndId(day, id);
            return success("启动成功!");
@ -122,9 +129,9 @@ public class JobController extends BaseController {
    */
    @ApiOperation(value = "启动单个任务")
    @RequestMapping(value = "startById", method = RequestMethod.GET)
    public String startById(String id) {
    public String startById(
            @ApiParam(name="id",required=true)@RequestParam(value = "id", required = true) String id) {
        try {
            jobService.startById(id);
            return success("启动成功!");
        } catch (Exception e) {
@ -141,7 +148,7 @@ public class JobController extends BaseController {
     */
    @ApiOperation(value = "停止单个任务")
    @RequestMapping(value = "stopById", method = RequestMethod.GET)
    public String stopById(String id) {
    public String stopById(@ApiParam(name="id",required=true)@RequestParam(value = "id", required = true)String id) {
        try {
            jobService.stopById(id);
            return success("停止成功!");

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/AllSignExpenseStatusJob.java

@ -17,6 +17,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -31,6 +32,7 @@ import java.util.*;
 * 签约费用统计 到达量
 */
@Component
@Scope("prototype")
public class AllSignExpenseStatusJob implements Job{
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/AllSignJob.java

@ -16,6 +16,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -30,6 +31,7 @@ import java.util.*;
 * 每天的签约到达量统计
 */
@Component
@Scope("prototype")
public class AllSignJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/ChangeSignJob.java

@ -16,6 +16,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,7 @@ import java.util.*;
 * 已改簽的指标执行类
 */
@Component
@Scope("prototype")
public class ChangeSignJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/ConsultJob.java

@ -16,6 +16,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,7 @@ import java.util.*;
 * 咨询模块的指标执行类
 */
@Component
@Scope("prototype")
public class ConsultJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象

+ 6 - 4
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -22,6 +22,7 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@ -37,6 +38,7 @@ import java.util.*;
 * 实时统计今天的数据
 */
@Component
@Scope("prototype")
public class CurrentDayAllQuotaJob implements Job {
    @Autowired
    private SignFamilyDao signFamilyDao;
@ -87,13 +89,13 @@ public class CurrentDayAllQuotaJob implements Job {
    private String tomorrow = getDayString(1);
    private StringBuffer allContent=new StringBuffer();//日志内容
    @Value("fv.jdbc.driver")
    @Value("${fv.jdbc.driver}")
    String fv_jdbc_driver;
    @Value("fv.jdbc.url")
    @Value("${fv.jdbc.url}")
    String fv_jdbc_url;
    @Value("fv.jdbc.username")
    @Value("${fv.jdbc.username}")
    String fv_jdbc_username;
    @Value("fv.jdbc.password")
    @Value("${fv.jdbc.password}")
    String fv_jdbc_password;
    @Override
    public void execute(JobExecutionContext context)

+ 6 - 4
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/FollowUpJob.java

@ -18,6 +18,7 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -32,6 +33,7 @@ import java.util.*;
 * 随访的指标执行类
 */
@Component
@Scope("prototype")
public class FollowUpJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
@ -61,13 +63,13 @@ public class FollowUpJob implements Job {
    String yesterday;
    String now;
    @Value("fv.jdbc.driver")
    @Value("${fv.jdbc.driver}")
    String fv_jdbc_driver;
    @Value("fv.jdbc.url")
    @Value("${fv.jdbc.url}")
    String fv_jdbc_url;
    @Value("fv.jdbc.username")
    @Value("${fv.jdbc.username}")
    String fv_jdbc_username;
    @Value("fv.jdbc.password")
    @Value("${fv.jdbc.password}")
    String fv_jdbc_password;
    @Override

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/HealthGuideJob.java

@ -17,6 +17,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,7 @@ import java.util.*;
 * 健康指导的指标执行类
 */
@Component
@Scope("prototype")
public class HealthGuideJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignAgeGroupDiseaseJob.java

@ -17,6 +17,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@ -31,6 +32,7 @@ import java.util.*;
 * 签约下按年龄分组后再按疾病统计
 */
@Component
@Scope("prototype")
public class SignAgeGroupDiseaseJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/SignJob.java

@ -23,6 +23,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@ -37,6 +38,7 @@ import java.util.*;
 * 签约的指标执行类
 */
@Component
@Scope("prototype")
public class SignJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/UnSignJob.java

@ -16,6 +16,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,7 @@ import java.util.*;
 * 解约的指标执行类
 */
@Component
@Scope("prototype")
public class UnSignJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/WaitSignJob.java

@ -16,6 +16,7 @@ import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -29,6 +30,7 @@ import java.util.*;
 * 待签约的指标执行类
 */
@Component
@Scope("prototype")
public class WaitSignJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 2 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/check/CheckSignJob.java

@ -16,6 +16,7 @@ import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
@ -27,6 +28,7 @@ import java.util.*;
 * 判断签约的数据对不对 不对的话 添加任务重新生成签约数据
 */
@Component
@Scope("prototype")
public class CheckSignJob implements Job{
    public static String jobKey="CHECK_SIGN_JOB";
    public static String cron="0 0 12 * * ?";

+ 29 - 6
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -107,7 +107,7 @@ public class JobService {
        params.put("jobConfig", wlyyJobConfigVO);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            //往quartz框架添加任务
            quartzHelper.addJob(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getQuartzCron(), quartzJobConfig.getId(), params);
            quartzHelper.addJob(getRightClass(quartzJobConfig), quartzJobConfig.getQuartzCron(), quartzJobConfig.getId(), params);
            quartzJobConfig.setStatus("1");//设置任务状态是启动
        }
    }
@ -127,7 +127,7 @@ public class JobService {
        //往quartz框架添加任务
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getId()+ UUID.randomUUID(), params);
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId()+ UUID.randomUUID(), params);
        }
    }
@ -150,7 +150,7 @@ public class JobService {
                params.put("now", getYesterday(0 - i + 1));
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getId() + UUID.randomUUID(), params);
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID(), params);
                    Thread.sleep(15000L);
                }
            }
@ -192,13 +192,36 @@ public class JobService {
            params.put("now", now);
            params.put("yesterday", yesterday);
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getId() + UUID.randomUUID(), params);
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID(), params);
                Thread.sleep(15000L);
            }
        }
    }
    /**
     *
     * @param quartzJobConfig
     * @return
     * @throws ClassNotFoundException
     */
    private Class getRightClass(QuartzJobConfig quartzJobConfig) throws ClassNotFoundException {
        String packageString="com.yihu.wlyy.statistics.job.business.";
        Class classTemp;
        try{
            classTemp=Class.forName(quartzJobConfig.getJobClass());
        }catch (Exception e){
            try{
            String classString=quartzJobConfig.getJobClass().replace("wlyy","wlyy.statistics").replace("job","job.business");
            classTemp=Class.forName(classString);
            }catch (Exception e1){
                packageString=packageString+quartzJobConfig.getJobClass().substring(quartzJobConfig.getJobClass().lastIndexOf("."));
                classTemp=Class.forName(packageString);
            }
        }
        return classTemp;
    }
    public void productDataByOneDayWithId(String yesterday, String id) throws Exception {
        SimpleDateFormat dataSimple = new SimpleDateFormat("yyyy-MM-dd");
        Date date = dataSimple.parse(yesterday);
@ -229,7 +252,7 @@ public class JobService {
        params.put("now", now);
        params.put("yesterday", yesterday);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getId() + UUID.randomUUID(), params);
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID(), params);
            Thread.sleep(15000L);
        }
    }
@ -293,7 +316,7 @@ public class JobService {
                params.put("now", getYesterday(0 - i + 1));
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(Class.forName(quartzJobConfig.getJobClass()), quartzJobConfig.getId() + UUID.randomUUID(), params);
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID(), params);
                    Thread.sleep(15000L);
                }
            }

+ 41 - 0
patient-co-statistics/src/main/resources/quartz.properties

@ -0,0 +1,41 @@
# Default Properties file for use by StdSchedulerFactory
# to create a Quartz Scheduler Instance, if a different
# properties file is not explicitly specified.
#
 
org.quartz.scheduler.instanceName: DefaultQuartzScheduler
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
 
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 5
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 60000
 
#============================================================================
# Configure JobStore
#============================================================================
 
# RAM
# org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
# Configure JobStore Cluster
org.quartz.jobStore.class:org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass:org.quartz.impl.jdbcjobstore.StdJDBCDelegate
#datasource׺
org.quartz.jobStore.tablePrefix:QRTZ_
#org.quartz.jobStore.dataSource:qzDS
#
##============================================================================
## Configure Datasources
##============================================================================
##datasource
#org.quartz.dataSource.qzDS.driver: com.mysql.jdbc.Driver
#org.quartz.dataSource.qzDS.URL: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#org.quartz.dataSource.qzDS.user: root
#org.quartz.dataSource.qzDS.password: 123456
org.quartz.jobGroupName = RS_JOBGROUP_NAME
org.quartz.triggerGroupName = RS_TRIGGERGROUP_NAME