|
@ -138,7 +138,7 @@ public class JobService {
|
|
|
|
|
|
//往quartz框架添加任务
|
|
|
if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId()+ UUID.randomUUID().toString().replace("-",""), params);
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -158,10 +158,10 @@ public class JobService {
|
|
|
params.put("jobConfig", wlyyJobConfigVO);
|
|
|
for (int i = 1; i <= day; i++) {
|
|
|
//往quartz框架添加任务
|
|
|
params.put("daybefore", getYesterday(0 - i-1 ));
|
|
|
params.put("daybefore", getYesterday(0 - i - 1));
|
|
|
params.put("yesterday", getYesterday(0 - i));
|
|
|
if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
|
|
|
Thread.sleep(20000L);
|
|
|
}
|
|
|
}
|
|
@ -203,7 +203,7 @@ public class JobService {
|
|
|
params.put("daybefore", daybefore);
|
|
|
params.put("yesterday", yesterday);
|
|
|
if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
|
|
|
Thread.sleep(20000L);
|
|
|
}
|
|
|
|
|
@ -211,7 +211,6 @@ public class JobService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param quartzJobConfig
|
|
|
* @return
|
|
|
* @throws ClassNotFoundException
|
|
@ -250,69 +249,70 @@ public class JobService {
|
|
|
params.put("daybefore", daybefore);
|
|
|
params.put("yesterday", yesterday);
|
|
|
if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
|
|
|
Thread.sleep(20000L);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@Async("dbExtractExecutor")
|
|
|
public void startaaaa() throws Exception{
|
|
|
quartzHelper.startNow(HealthMessageJob.class,UUID.randomUUID().toString().replace("-",""),new HashMap<>());
|
|
|
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);
|
|
|
if(quartzJobConfig==null){
|
|
|
if (quartzJobConfig == null) {
|
|
|
throw new Exception("id不存在");
|
|
|
}
|
|
|
WlyyQuota wlyyQuota = quotaDao.findOne(quartzJobConfig.getQuotaId());
|
|
|
WlyyQuota wlyyQuota = quotaDao.findOne(quartzJobConfig.getQuotaId());
|
|
|
|
|
|
WlyyQuotaVO wlyyQuotaVO = new WlyyQuotaVO();
|
|
|
WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
|
|
|
BeanUtils.copyProperties(wlyyQuota, wlyyQuotaVO);
|
|
|
BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
|
|
|
WlyyQuotaVO wlyyQuotaVO = new WlyyQuotaVO();
|
|
|
WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
|
|
|
BeanUtils.copyProperties(wlyyQuota, wlyyQuotaVO);
|
|
|
BeanUtils.copyProperties(quartzJobConfig, wlyyJobConfigVO);
|
|
|
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
params.put("quota", wlyyQuotaVO);
|
|
|
params.put("jobConfig", wlyyJobConfigVO);
|
|
|
for (int i = 1; i <= day; i++) {
|
|
|
//往quartz框架添加任务
|
|
|
params.put("daybefore", getYesterday(0 - i -1));
|
|
|
params.put("yesterday", getYesterday(0 - i));
|
|
|
if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-",""), params);
|
|
|
Thread.sleep(20000L);
|
|
|
}
|
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
|
params.put("quota", wlyyQuotaVO);
|
|
|
params.put("jobConfig", wlyyJobConfigVO);
|
|
|
for (int i = 1; i <= day; i++) {
|
|
|
//往quartz框架添加任务
|
|
|
params.put("daybefore", getYesterday(0 - i - 1));
|
|
|
params.put("yesterday", getYesterday(0 - i));
|
|
|
if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
|
|
|
quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
|
|
|
Thread.sleep(20000L);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void startCheckSignJob() throws Exception{
|
|
|
if(!quartzHelper.isExistJob(CheckSignJob.jobKey)){
|
|
|
quartzHelper.addJob(CheckSignJob.class,CheckSignJob.cron,CheckSignJob.jobKey,new HashMap<>());
|
|
|
public void startCheckSignJob() throws Exception {
|
|
|
if (!quartzHelper.isExistJob(CheckSignJob.jobKey)) {
|
|
|
quartzHelper.addJob(CheckSignJob.class, CheckSignJob.cron, CheckSignJob.jobKey, new HashMap<>());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void stopCheckSignJob()throws Exception {
|
|
|
if(quartzHelper.isExistJob(CheckSignJob.jobKey)){
|
|
|
public void stopCheckSignJob() throws Exception {
|
|
|
if (quartzHelper.isExistJob(CheckSignJob.jobKey)) {
|
|
|
quartzHelper.removeJob(CheckSignJob.jobKey);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void productDataByDayToDay(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)){
|
|
|
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++){
|
|
|
productDataByOneDay(getYesterday(i,startDate));
|
|
|
int day = daysBetween(startDate, endDate);
|
|
|
for (int i = 0; i < day; i++) {
|
|
|
productDataByOneDay(getYesterday(i, startDate));
|
|
|
|
|
|
}
|
|
|
}
|
|
|
public static String getYesterday(Integer day,Date startDate) {
|
|
|
|
|
|
public static String getYesterday(Integer day, Date startDate) {
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
cal.setTime(startDate);
|
|
|
cal.add(Calendar.DAY_OF_MONTH, day);
|
|
@ -320,47 +320,46 @@ public class JobService {
|
|
|
return yesterday;
|
|
|
}
|
|
|
|
|
|
public static int daysBetween(Date smdate,Date bdate) throws ParseException
|
|
|
{
|
|
|
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
smdate=sdf.parse(sdf.format(smdate));
|
|
|
bdate=sdf.parse(sdf.format(bdate));
|
|
|
public static int daysBetween(Date smdate, Date bdate) throws ParseException {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
smdate = sdf.parse(sdf.format(smdate));
|
|
|
bdate = sdf.parse(sdf.format(bdate));
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
cal.setTime(smdate);
|
|
|
long time1 = cal.getTimeInMillis();
|
|
|
cal.setTime(bdate);
|
|
|
long time2 = cal.getTimeInMillis();
|
|
|
long between_days=(time2-time1)/(1000*3600*24);
|
|
|
long between_days = (time2 - time1) / (1000 * 3600 * 24);
|
|
|
|
|
|
return Integer.parseInt(String.valueOf(between_days));
|
|
|
}
|
|
|
|
|
|
|
|
|
public void productDataByDayToDayAndId(String start, String end, String id) throws Exception {
|
|
|
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date startDate=sdf.parse(start);
|
|
|
Date endDate=sdf.parse(end);
|
|
|
if(startDate.after(endDate)){
|
|
|
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++){
|
|
|
productDataByOneDayWithId(getYesterday(i,startDate),id);
|
|
|
int day = daysBetween(startDate, endDate);
|
|
|
for (int i = 0; i < day; i++) {
|
|
|
productDataByOneDayWithId(getYesterday(i, startDate), id);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void startCleanCacheJob() throws Exception {
|
|
|
if(!quartzHelper.isExistJob(CacheCleanJob.jobKey)){
|
|
|
quartzHelper.addJob(CacheCleanJob.class,CacheCleanJob.cron,CacheCleanJob.jobKey,new HashMap<>());
|
|
|
}else{
|
|
|
public void startCleanCacheJob() throws Exception {
|
|
|
if (!quartzHelper.isExistJob(CacheCleanJob.jobKey)) {
|
|
|
quartzHelper.addJob(CacheCleanJob.class, CacheCleanJob.cron, CacheCleanJob.jobKey, new HashMap<>());
|
|
|
} else {
|
|
|
throw new Exception("已经启动");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void stopCleanCacheJob()throws Exception {
|
|
|
if(quartzHelper.isExistJob(CacheCleanJob.jobKey)){
|
|
|
public void stopCleanCacheJob() throws Exception {
|
|
|
if (quartzHelper.isExistJob(CacheCleanJob.jobKey)) {
|
|
|
quartzHelper.removeJob(CacheCleanJob.jobKey);
|
|
|
}else{
|
|
|
} else {
|
|
|
throw new Exception("已经停止");
|
|
|
}
|
|
|
}
|
|
@ -370,37 +369,37 @@ public class JobService {
|
|
|
}
|
|
|
|
|
|
public String seeCache() {
|
|
|
Map<String, CacheModel> cacheModesCache= CachePool.getArriveSignFamilyExpenseStatus1Map();
|
|
|
Map<String, String> patientGroupCache=CachePool.getPatientGroup();
|
|
|
Map<String, String> healthGroupCache=CachePool.getHealthGroup();
|
|
|
Map<String, List<String>> diseaseGroupCache=CachePool.getDiseaseGroup();
|
|
|
String returnMessage=" 签约缓存:缓存存在"+cacheModesCache.size()+"天的缓存,";
|
|
|
for(Map.Entry<String, CacheModel> entry:cacheModesCache.entrySet()){
|
|
|
returnMessage+=entry.getKey()+",";
|
|
|
}
|
|
|
returnMessage+="patientGroupCache"+(patientGroupCache.size()>0?"有缓存":"没有缓存");
|
|
|
returnMessage+="healthGroupCache"+(healthGroupCache.size()>0?"有缓存":"没有缓存");
|
|
|
returnMessage+="diseaseGroupCache"+(diseaseGroupCache.size()>0?"有缓存":"没有缓存");
|
|
|
Map<String, CacheModel> cacheModesCache = CachePool.getArriveSignFamilyExpenseStatus1Map();
|
|
|
Map<String, String> patientGroupCache = CachePool.getPatientGroup();
|
|
|
Map<String, String> healthGroupCache = CachePool.getHealthGroup();
|
|
|
Map<String, List<String>> diseaseGroupCache = CachePool.getDiseaseGroup();
|
|
|
String returnMessage = " 签约缓存:缓存存在" + cacheModesCache.size() + "天的缓存,";
|
|
|
for (Map.Entry<String, CacheModel> entry : cacheModesCache.entrySet()) {
|
|
|
returnMessage += entry.getKey() + ",";
|
|
|
}
|
|
|
returnMessage += "patientGroupCache" + (patientGroupCache.size() > 0 ? "有缓存" : "没有缓存");
|
|
|
returnMessage += "healthGroupCache" + (healthGroupCache.size() > 0 ? "有缓存" : "没有缓存");
|
|
|
returnMessage += "diseaseGroupCache" + (diseaseGroupCache.size() > 0 ? "有缓存" : "没有缓存");
|
|
|
return returnMessage;
|
|
|
}
|
|
|
|
|
|
public void startHealthMessageJob() throws Exception {
|
|
|
if(!quartzHelper.isExistJob(HealthMessageJob.jobKey)){
|
|
|
quartzHelper.addJob(HealthMessageJob.class,HealthMessageJob.cron,HealthMessageJob.jobKey,new HashMap<>());
|
|
|
}else{
|
|
|
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)){
|
|
|
public void stopHealthMessageJob() throws Exception {
|
|
|
if (quartzHelper.isExistJob(HealthMessageJob.jobKey)) {
|
|
|
quartzHelper.removeJob(HealthMessageJob.jobKey);
|
|
|
}else{
|
|
|
} else {
|
|
|
throw new Exception("已经停止");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void productHealthDataByOneDay(String day)throws Exception {
|
|
|
public void productHealthDataByOneDay(String day) throws Exception {
|
|
|
SimpleDateFormat dataSimple = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
Date date = dataSimple.parse(day);
|
|
@ -416,61 +415,63 @@ public class JobService {
|
|
|
//往quartz框架添加任务
|
|
|
params.put("now", yesterday);
|
|
|
params.put("yesterday", day);
|
|
|
quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-",""), params);
|
|
|
quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
|
|
|
Thread.sleep(20000L);
|
|
|
}
|
|
|
|
|
|
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)){
|
|
|
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));
|
|
|
int day = daysBetween(startDate, endDate);
|
|
|
for (int i = 0; i < day; i++) {
|
|
|
productHealthDataByOneDay(getYesterday(i, startDate));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) throws Exception{
|
|
|
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));
|
|
|
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 startEveryDayReportJob()throws Exception {
|
|
|
if(!quartzHelper.isExistJob(ReportAllLogJob.jobKey)){
|
|
|
quartzHelper.addJob(ReportAllLogJob.class,ReportAllLogJob.cron,ReportAllLogJob.jobKey,new HashMap<>());
|
|
|
}else{
|
|
|
public void startEveryDayReportJob() throws Exception {
|
|
|
if (!quartzHelper.isExistJob(ReportAllLogJob.jobKey)) {
|
|
|
quartzHelper.addJob(ReportAllLogJob.class, ReportAllLogJob.cron, ReportAllLogJob.jobKey, new HashMap<>());
|
|
|
} else {
|
|
|
throw new Exception("已经启动");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void stopEveryDayReportJob() throws Exception{
|
|
|
if(quartzHelper.isExistJob(ReportAllLogJob.jobKey)){
|
|
|
public void stopEveryDayReportJob() throws Exception {
|
|
|
if (quartzHelper.isExistJob(ReportAllLogJob.jobKey)) {
|
|
|
quartzHelper.removeJob(ReportAllLogJob.jobKey);
|
|
|
}else{
|
|
|
} else {
|
|
|
throw new Exception("已经停止");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void startNoticeJob() throws Exception {
|
|
|
if(!quartzHelper.isExistJob(NoticeJob.jobKey)){
|
|
|
quartzHelper.addJob(NoticeJob.class,NoticeJob.jobCron,NoticeJob.jobKey,new HashMap<>());
|
|
|
}else{
|
|
|
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)){
|
|
|
public void stopNoticeJob() throws Exception {
|
|
|
if (quartzHelper.isExistJob(NoticeJob.jobKey)) {
|
|
|
quartzHelper.removeJob(NoticeJob.jobKey);
|
|
|
}else{
|
|
|
} else {
|
|
|
throw new Exception("已经停止");
|
|
|
}
|
|
|
}
|