From 8aa815dd9fca6dc914c0cba72ada9af5c795a44c Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Tue, 28 Apr 2020 15:19:42 +0800
Subject: [PATCH] update 1小时插入一次
---
src/main/java/com/moral/task/HistoryTableInsertTask.java | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/moral/task/HistoryTableInsertTask.java b/src/main/java/com/moral/task/HistoryTableInsertTask.java
index c2437db..a9f9c19 100644
--- a/src/main/java/com/moral/task/HistoryTableInsertTask.java
+++ b/src/main/java/com/moral/task/HistoryTableInsertTask.java
@@ -24,6 +24,7 @@
import com.moral.service.HistoryDailyService;
import com.moral.service.HistoryHourlyService;
import com.moral.service.HistoryMinutelyService;
+import com.moral.service.HistoryService;
import com.moral.service.SensorService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
@@ -38,6 +39,9 @@
@Resource
private DeviceService deviceService;
+
+ @Resource
+ private HistoryService historyService;
@Resource
private HistoryMinutelyService historyMinutelyService;
@@ -881,4 +885,28 @@
return returnT;
}
+ @XxlJob("historySpecial")
+ public ReturnT insertHistorySpecialTable(String params) {
+ Map macMap = JSON.parseObject(params);
+ List<String> macList = (List<String>) macMap.get("mac");
+ LocalDateTime value = LocalDateTime.now();
+ Map<String, Object> devices = new HashMap<>();
+ devices.put("macList", macList);
+ devices.put("time", value);
+ try {
+ int count = historyService.insertHistorySpecialTable(devices);
+ XxlJobLogger.log("insertHistorySpecialTable:" + count);
+ if (count > 0) {
+ ReturnT returnT = new ReturnT(200, "������historySpecial���������");
+ return returnT;
+ }
+ } catch (Exception e) {
+ XxlJobLogger.log("insertHistorySpecialTableException:" + e.getMessage());
+ logger.error(e.getMessage());
+ e.printStackTrace();
+ }
+ ReturnT returnT = new ReturnT(500, "������historySpecial���������");
+ return returnT;
+ }
+
}
--
Gitblit v1.8.0