From 96d7cf8eb72810dfa5921a585d64b5ce9909d416 Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Wed, 16 Dec 2020 16:53:25 +0800 Subject: [PATCH] 北京疾控中心设备掉线报警邮件发送 --- src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java b/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java index 654130e..9baa08a 100644 --- a/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java +++ b/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java @@ -22,15 +22,28 @@ @XxlJob("deleteHitoryTable") public ReturnT deleteHistoryTable(String param) { - return new ReturnT(200,"������������"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String yearMonthDay = sdf.format(DateUtil.rollHour(new Date(), -8*24)); + try { + historyService.dropHistoryTable(yearMonthDay); + } catch (Exception e) { + logger.error(e.getMessage()); + return new ReturnT(500, "history_" + yearMonthDay + "������������"); + } + return new ReturnT(200, "history_" + yearMonthDay + "������������"); } @XxlJob("createHistoryTable") public ReturnT createHistoryTable(String param) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - String yearMonthDay = sdf.format(DateUtil.rollHour(new Date(),24)); - historyService.createHistoryTable(yearMonthDay); - return new ReturnT(200,"������������"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String yearMonthDay = sdf.format(DateUtil.rollHour(new Date(), 24)); + try { + historyService.createHistoryTable(yearMonthDay); + } catch (Exception e) { + logger.error(e.getMessage()); + return new ReturnT(500, "history_" + yearMonthDay + "������������"); + } + return new ReturnT(200, "history_" + yearMonthDay + "������������"); } } -- Gitblit v1.8.0