fix: 改造标准预警模块定时执行的逻辑
This commit is contained in:
@@ -69,45 +69,45 @@ public class ProcessTimer {
|
||||
public void urging() {
|
||||
if(isNotScheduled){
|
||||
log.info("=================================自动催办定时任务启动=====================================");
|
||||
List<BusProcessName> busProcessNames = workFlowFeignClient.queryBusProcessNameForEnd(null);
|
||||
if (null != busProcessNames && 0 < busProcessNames.size()) {
|
||||
for (BusProcessName busProcessName : busProcessNames) {
|
||||
String type = busProcessName.getPrcType();
|
||||
Integer typeInt = 99;
|
||||
if (StringUtils.isNotEmpty(type)) {
|
||||
typeInt = Integer.valueOf(type);
|
||||
}
|
||||
type = chooseType(typeInt, type);
|
||||
|
||||
UserEO userEO = userEOService.selectByPrimaryKey(busProcessName.getCreatUserName());
|
||||
String[] array = userEO.getEmail().split(",");
|
||||
String overTime = busProcessName.getOverTime();
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date dateTime = null;
|
||||
Integer num = 3;
|
||||
try {
|
||||
dateTime = simpleDateFormat.parse(overTime);
|
||||
Date now = new Date();
|
||||
long daysBetween = (dateTime.getTime() - now.getTime() + 1000000) / (60 * 60 * 24 * 1000);
|
||||
num = Integer.valueOf(String.valueOf(daysBetween));
|
||||
} catch (ParseException e) {
|
||||
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
|
||||
try {
|
||||
dateTime = simpleDateFormat1.parse(overTime);
|
||||
Date now = new Date();
|
||||
long daysBetween = (dateTime.getTime() - now.getTime() + 1000000) / (60 * 60 * 24 * 1000);
|
||||
num = Integer.valueOf(String.valueOf(daysBetween));
|
||||
} catch (ParseException e1) {
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
String msg = "您好,[" + busProcessName.getPrcNum() + "]-[" + busProcessName.getPrcName() + "] 您有待办任务未及时办理,距离截至日期还有[" + String.valueOf(num) + "]天 请及时办理,请登录全球标准法规管理系统 ( http://39.98.140.126:10005/#/login ) 办理:链接 ( http://39.98.140.126:10005/#/processCenter?tabsName=ProcessCenter ) 。\n" +
|
||||
" ——来自 全球标准法规管理系统";
|
||||
String title = "GSRM——【待办任务】[" + type + "] 您有未完成的待办任务";
|
||||
mailUtil.sendMsgFeign(array, title, msg);
|
||||
}
|
||||
}
|
||||
// List<BusProcessName> busProcessNames = workFlowFeignClient.queryBusProcessNameForEnd(null);
|
||||
// if (null != busProcessNames && 0 < busProcessNames.size()) {
|
||||
// for (BusProcessName busProcessName : busProcessNames) {
|
||||
// String type = busProcessName.getPrcType();
|
||||
// Integer typeInt = 99;
|
||||
// if (StringUtils.isNotEmpty(type)) {
|
||||
// typeInt = Integer.valueOf(type);
|
||||
// }
|
||||
// type = chooseType(typeInt, type);
|
||||
//
|
||||
// UserEO userEO = userEOService.selectByPrimaryKey(busProcessName.getCreatUserName());
|
||||
// String[] array = userEO.getEmail().split(",");
|
||||
// String overTime = busProcessName.getOverTime();
|
||||
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
// Date dateTime = null;
|
||||
// Integer num = 3;
|
||||
// try {
|
||||
// dateTime = simpleDateFormat.parse(overTime);
|
||||
// Date now = new Date();
|
||||
// long daysBetween = (dateTime.getTime() - now.getTime() + 1000000) / (60 * 60 * 24 * 1000);
|
||||
// num = Integer.valueOf(String.valueOf(daysBetween));
|
||||
// } catch (ParseException e) {
|
||||
// SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
|
||||
// try {
|
||||
// dateTime = simpleDateFormat1.parse(overTime);
|
||||
// Date now = new Date();
|
||||
// long daysBetween = (dateTime.getTime() - now.getTime() + 1000000) / (60 * 60 * 24 * 1000);
|
||||
// num = Integer.valueOf(String.valueOf(daysBetween));
|
||||
// } catch (ParseException e1) {
|
||||
// e.getMessage();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// String msg = "您好,[" + busProcessName.getPrcNum() + "]-[" + busProcessName.getPrcName() + "] 您有待办任务未及时办理,距离截至日期还有[" + String.valueOf(num) + "]天 请及时办理,请登录全球标准法规管理系统 ( http://39.98.140.126:10005/#/login ) 办理:链接 ( http://39.98.140.126:10005/#/processCenter?tabsName=ProcessCenter ) 。\n" +
|
||||
// " ——来自 全球标准法规管理系统";
|
||||
// String title = "GSRM——【待办任务】[" + type + "] 您有未完成的待办任务";
|
||||
// mailUtil.sendMsgFeign(array, title, msg);
|
||||
// }
|
||||
// }
|
||||
log.info("=================================自动催办定时任务结束=====================================");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.adc.da.scheduled;
|
||||
|
||||
import com.adc.da.common.GetBeanUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Slf4j
|
||||
public class WarningSchedulingTasks implements Runnable{
|
||||
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(WarningSchedulingTasks.class);
|
||||
|
||||
private ScheduledJob scheduledJob;
|
||||
|
||||
public WarningSchedulingTasks() {
|
||||
scheduledJob= GetBeanUtil.getApplicationContext().getBean(ScheduledJob.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
Thread.sleep(2000);
|
||||
scheduledJob.warningSchedulingTasks();
|
||||
}catch(Exception e){
|
||||
logger.info(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
INSERT INTO `tb_task`(`id`, `task_name`, `task_desc`, `task_exp`, `task_status`, `task_class`, `update_time`, `create_time`) VALUES ('6', 'task6', '每天定时扫描标准预警数据', '*/5 * * * * ?', 0, 'com.adc.da.scheduled.WarningSchedulingTasks', '2022-06-23 06:19:32', '2022-06-23 06:19:32');
|
||||
Reference in New Issue
Block a user