ZhuDongming
2020-04-28 8aa815dd9fca6dc914c0cba72ada9af5c795a44c
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;
    }
}