From f2cfc6973ec1b43391654b4bd722c2c316d06fc7 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Thu, 19 Nov 2020 13:08:24 +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