From b4304bac2268701dfc89bb62646748ef3eeb08d6 Mon Sep 17 00:00:00 2001 From: lizijie <lzjiiie@163.com> Date: Thu, 12 May 2022 16:17:40 +0800 Subject: [PATCH] 千灯小时分钟数据保存到MQ --- src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java b/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java index 99f4a4d..9baa08a 100644 --- a/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java +++ b/src/main/java/com/moral/task/HistoryTableCreatAndDeleteTask.java @@ -22,20 +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("yyyyMMdd"); + String yearMonthDay = sdf.format(DateUtil.rollHour(new Date(), 24)); try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); - String yearMonthDay = sdf.format(DateUtil.rollHour(new Date(), 24)); historyService.createHistoryTable(yearMonthDay); - }catch (Exception e){ + } catch (Exception e) { logger.error(e.getMessage()); - return new ReturnT(500,"history������������"); + return new ReturnT(500, "history_" + yearMonthDay + "������������"); } - return new ReturnT(200,"history������������������"); + return new ReturnT(200, "history_" + yearMonthDay + "������������"); } } -- Gitblit v1.8.0