From 29f63744744500a7c5a77e61d5358cbf81322c2a Mon Sep 17 00:00:00 2001 From: zhangyanduan Date: Thu, 23 Jun 2022 14:27:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B9=E9=80=A0=E6=A0=87=E5=87=86?= =?UTF-8?q?=E9=A2=84=E8=AD=A6=E6=A8=A1=E5=9D=97=E5=AE=9A=E6=97=B6=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/adc/da/Timer/ProcessTimer.java | 78 +++++++++---------- .../da/scheduled/WarningSchedulingTasks.java | 29 +++++++ ...0220623_定时任务执行管理表添加预警信息.sql | 1 + 3 files changed, 69 insertions(+), 39 deletions(-) create mode 100644 adc-da-slrs/src/main/java/com/adc/da/scheduled/WarningSchedulingTasks.java create mode 100644 doc/sql/20220623_定时任务执行管理表添加预警信息.sql diff --git a/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java b/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java index 9846d4f2..67312aae 100644 --- a/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java +++ b/adc-da-activiti/src/main/java/com/adc/da/Timer/ProcessTimer.java @@ -69,45 +69,45 @@ public class ProcessTimer { public void urging() { if(isNotScheduled){ log.info("=================================自动催办定时任务启动====================================="); - List 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 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("=================================自动催办定时任务结束====================================="); } } diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/WarningSchedulingTasks.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/WarningSchedulingTasks.java new file mode 100644 index 00000000..4d16ec86 --- /dev/null +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/WarningSchedulingTasks.java @@ -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()); + } + } +} diff --git a/doc/sql/20220623_定时任务执行管理表添加预警信息.sql b/doc/sql/20220623_定时任务执行管理表添加预警信息.sql new file mode 100644 index 00000000..48e83a89 --- /dev/null +++ b/doc/sql/20220623_定时任务执行管理表添加预警信息.sql @@ -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');