|
@ -2,8 +2,11 @@ package com.yihu.wlyy.statistics.job.message;
|
|
|
|
|
|
import com.yihu.wlyy.statistics.dao.MessageDao;
|
|
|
import com.yihu.wlyy.statistics.etl.extract.DBExtract;
|
|
|
import com.yihu.wlyy.statistics.etl.storage.DBStorage;
|
|
|
import com.yihu.wlyy.statistics.model.job.QuartzJobLog;
|
|
|
import com.yihu.wlyy.statistics.model.signfamily.Message;
|
|
|
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
|
|
|
import com.yihu.wlyy.statistics.util.JsonUtil;
|
|
|
import org.quartz.Job;
|
|
|
import org.quartz.JobExecutionContext;
|
|
|
import org.quartz.JobExecutionException;
|
|
@ -34,11 +37,17 @@ public class HealthMessageJob implements Job {
|
|
|
private MessageDao messageDao;
|
|
|
@Autowired
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
@Autowired
|
|
|
private DBStorage dbStorage;
|
|
|
|
|
|
@Transactional
|
|
|
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
|
|
try{
|
|
|
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
|
|
|
QuartzJobLog quartzJobLog = new QuartzJobLog();
|
|
|
quartzJobLog.setJobStartTime(new Date());
|
|
|
quartzJobLog.setJobId(jobKey);
|
|
|
quartzJobLog.setJobName(jobKey);
|
|
|
String yesterday=jobExecutionContext.getMergedJobDataMap().getString("yesterday");
|
|
|
String now=jobExecutionContext.getMergedJobDataMap().getString("now");
|
|
|
if(StringUtils.isEmpty(yesterday)){
|
|
@ -91,6 +100,10 @@ public class HealthMessageJob implements Job {
|
|
|
message.setReceiver(entry.getKey());
|
|
|
messageDao.save(message);
|
|
|
}
|
|
|
quartzJobLog.setJobEndTime(new Date());
|
|
|
quartzJobLog.setJobContent("生成"+now+"的健康管理师消息成功");
|
|
|
quartzJobLog.setJobType("1");
|
|
|
dbStorage.saveLog(quartzJobLog);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|