lizijie
2022-06-14 cb59966a148f601c41e77637be701fda04251d91
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
package com.moral.task;
 
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.*;
 
import javax.annotation.Resource;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.moral.entity.Organization;
import com.moral.service.DeviceService;
import com.moral.service.HistoryDailyService;
import com.moral.service.HistoryHourlyService;
import com.moral.service.HistoryMinutelyService;
import com.moral.service.HistoryService;
import com.moral.service.OrganizationService;
import com.moral.service.SensorService;
import com.moral.util.DateUtil;
import com.moral.util.WeatherUtil;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
 
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
 
@Component
public class HistoryTableInsertTask {
    private static transient Logger logger = LoggerFactory.getLogger(HistoryTableInsertTask.class);
 
    @Resource
    private SensorService sensorService;
 
    @Resource
    private DeviceService deviceService;
 
    @Resource
    private HistoryService historyService;
 
    @Resource
    private HistoryMinutelyService historyMinutelyService;
 
    @Resource
    private HistoryHourlyService historyHourlyService;
 
    @Resource
    private HistoryDailyService historyDailyService;
 
    @Resource
    private OrganizationService organizationService;
 
    @Resource
    private WeatherUtil weatherUtil;
 
    @Resource
    RedisTemplate redisTemplate;
 
    @XxlJob("historyMinutely")
    public ReturnT insertHistoryMinutelyTable(String params) {
        //正式环境使用
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
        Date insertTimeDate = new Date();
        Date startTimeDate = DateUtil.rollMinute(insertTimeDate, -2);
        Date endTimeDate = DateUtil.rollMinute(insertTimeDate, -1);
        StringBuilder insertTime = new StringBuilder(sdf.format(insertTimeDate));
        StringBuilder endTime = new StringBuilder(sdf.format(endTimeDate));
        StringBuilder startTime = new StringBuilder(sdf.format(startTimeDate));
        String queryYearAndMonthDay = DateUtil.getYear(startTimeDate) + DateUtil.getMonth(startTimeDate) + DateUtil.getDay(startTimeDate);
 
        //测试试用
        /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date endTimeDate = sdf.parse("2020-11-01 00:00:20");
        Date startTimeDate = DateUtil.rollMinute(endTimeDate, -1);
        StringBuilder endTime = new StringBuilder(sdf.format(endTimeDate));
        StringBuilder startTime = new StringBuilder(sdf.format(startTimeDate));
        endTime.replace(17, 19, "00");
        startTime.replace(17, 19, "00");
        String queryYearAndMonthDay = DateUtil.getYear(startTimeDate) + DateUtil.getMonth(startTimeDate) + DateUtil.getDay(startTimeDate);*/
 
        Map<String, Object> devices = new HashMap<>();
        List<String> sensorKeys = sensorService.getSensorKeys();
        devices.put("sensorKeys", sensorKeys);
        devices.put("start", startTime.toString());
        devices.put("end", endTime.toString());
        devices.put("yearAndMonthDay", queryYearAndMonthDay);
 
        try {
            List<Map<String, Object>> minutelyData = deviceService.getSensorData(devices);
            XxlJobLogger.log("historyMinutelyData:" + minutelyData.size());
            List<Map<String, Object>> minutelyDataList = new ArrayList<>();
            for (Map<String, Object> deviceData : minutelyData) {
                if (!ObjectUtils.isEmpty(deviceData)) {
                    Map<String, Object> minutelyDataMap = new LinkedHashMap<>();
                    Map<String, Object> map = new HashMap<>();
                    minutelyDataMap.put("mac", deviceData.get("mac"));
                    minutelyDataMap.put("time", insertTime.toString());
                    for (String key : deviceData.keySet()) {
                        if (!key.equals("mac") && !key.startsWith("M")) {
                            List<Object> date = new ArrayList<>();
                            date.add(deviceData.get(key));
                            date.add(deviceData.get("MIN" + key));
                            date.add(deviceData.get("MAX" + key));
                            map.put(key, date);
                        }
                    }
                    minutelyDataMap.put("json", JSONObject.toJSONString(map));
                    minutelyDataList.add(minutelyDataMap);
                }
            }
            if (!CollectionUtils.isEmpty(minutelyDataList)) {
                String insertYearAndMonth = DateUtil.getYear(endTimeDate) + DateUtil.getMonth(endTimeDate);
                historyMinutelyService.insertHistoryMinutely(minutelyDataList, insertYearAndMonth);
                ReturnT returnT = new ReturnT(200, "插入分钟表成功");
                return returnT;
            }
        } catch (Exception e) {
            XxlJobLogger.log("historyMinutelyException:" + e.getMessage());
            logger.error(e.getMessage());
            e.printStackTrace();
            ReturnT returnT = new ReturnT(500, e.getMessage());
            return returnT;
        }
        List record = new ArrayList();
        record.add("repairMinutelyData_"+endTimeDate.getTime()/1000);
        redisTemplate.opsForList().leftPushAll("unrepair_data", record);
        ReturnT returnT = new ReturnT(500, "插入分钟表失败");
        return returnT;
    }
 
    @XxlJob("historyHourly")
    public ReturnT insertHistoryHourlyTable(String params) {
        //正式环境使用
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
        Date endTimeDate = new Date();
        Date startTimeDate = DateUtil.rollHour(endTimeDate, -1);
        StringBuilder endTime = new StringBuilder(sdf.format(endTimeDate));
        StringBuilder startTime = new StringBuilder(sdf.format(startTimeDate));
        String yearAndMonth = DateUtil.getYear(startTimeDate) + DateUtil.getMonth(startTimeDate);
 
        //测试环境使用,用于手动指定时间段
       /* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date endTimeDate = sdf.parse("2020-11-01 00:00:22");
        Date startTimeDate = DateUtil.rollHour(endTimeDate, -1);
        StringBuilder endTime = new StringBuilder(sdf.format(endTimeDate));
        StringBuilder startTime = new StringBuilder(sdf.format(startTimeDate));
        endTime.replace(14, 19, "00:00");
        startTime.replace(14, 19, "00:00");
        String yearAndMonth = DateUtil.getYear(startTimeDate) + DateUtil.getMonth(startTimeDate);*/
 
        List<String> sensorKeys = sensorService.getSensorKeys();
        List<String> macs = deviceService.getMacs();
        Map<String, Object> devices = new HashMap<>();
        devices.put("sensorKeys", sensorKeys);
        devices.put("start", startTime.toString());
        devices.put("end", endTime.toString());
        devices.put("macs", macs);
        devices.put("yearAndMonth", yearAndMonth);
 
        try {
            List<Map<String, Object>> hourlyData = historyMinutelyService.getMinutelySensorData(devices);
            XxlJobLogger.log("historyHourlyData:" + hourlyData.size());
            List<Map<String, Object>> hourlyDataList = new ArrayList<>();
            for (Map<String, Object> deviceData : hourlyData) {
                if (!ObjectUtils.isEmpty(deviceData)) {
                    Map<String, Object> hourlyDataMap = new LinkedHashMap<>();
                    JSONObject jo = new JSONObject(true);
                    hourlyDataMap.put("mac", deviceData.get("mac"));
                    hourlyDataMap.put("time", endTime.toString());
                    JSONArray jsonArray = new JSONArray();
                    for (String key : deviceData.keySet()) {
                        if (!key.equals("mac") && !key.startsWith("M")) {
                            List<Object> date = new ArrayList<>();
                            date.add(deviceData.get(key));
                            if (deviceData.get("MIN" + key) instanceof String) {
                                date.add(new BigDecimal(deviceData.get("MIN" + key).toString()));
                                date.add(new BigDecimal(deviceData.get("MAX" + key).toString()));
                            } else if (deviceData.get("MIN" + key) instanceof byte[]) {
                                date.add(new BigDecimal(new String((byte[]) (deviceData.get("MIN" + key)))));
                                date.add(new BigDecimal(new String((byte[]) (deviceData.get("MAX" + key)))));
                            }
                            jo.put(key, date);
                        }
                    }
                    jsonArray.add(jo);
                    hourlyDataMap.put("json", jsonArray.get(0).toString());
                    hourlyDataList.add(hourlyDataMap);
                }
            }
            if (!CollectionUtils.isEmpty(hourlyDataList)) {
                historyHourlyService.insertHistoryHourly(hourlyDataList);
                ReturnT returnT = new ReturnT(200, "插入小时表成功");
                return returnT;
            }
        } catch (Exception e) {
            XxlJobLogger.log("historyHourlyException:" + e.getMessage());
            logger.error(e.getMessage());
            e.printStackTrace();
        }
        ReturnT returnT = new ReturnT(500, "插入小时表失败");
        List record = new ArrayList();
        record.add("repairHourlyData_"+endTimeDate.getTime()/1000);
        redisTemplate.opsForList().leftPushAll("unrepair_data", record);
        return returnT;
    }
 
    @XxlJob("historyDaily")
    public ReturnT insertHistoryDailyTable(String params) {
        LocalDateTime time = LocalDateTime.now();
        LocalDateTime endTime = time.truncatedTo(ChronoUnit.DAYS);
        LocalDateTime startTime = endTime.minusDays(1);
        List<String> sensorKeys = sensorService.getSensorKeys();
        List<String> macs = deviceService.getMacs();
        Map<String, Object> devices = new HashMap<>();
        devices.put("sensorKeys", sensorKeys);
        devices.put("start", startTime);
        devices.put("end", endTime);
        devices.put("macs", macs);
        try {
            List<Map<String, Object>> dailyData = historyHourlyService.getHourlySensorData(devices);
            XxlJobLogger.log("historyDailyData:" + dailyData.size());
            List<Map<String, Object>> dailyDataList = new ArrayList<>();
            for (Map<String, Object> deviceData : dailyData) {
                if (!ObjectUtils.isEmpty(deviceData)) {
                    Map<String, Object> dailyDataMap = new LinkedHashMap<>();
                    JSONObject jo = new JSONObject(true);
                    dailyDataMap.put("mac", deviceData.get("mac"));
                    dailyDataMap.put("time", startTime);
                    JSONArray jsonArray = new JSONArray();
                    for (String key : deviceData.keySet()) {
                        if (!key.equals("mac") && !key.startsWith("M")) {
                            List<Object> date = new ArrayList<>();
                            date.add(deviceData.get(key));
                            if (deviceData.get("MIN" + key) instanceof String) {
                                date.add(new BigDecimal(deviceData.get("MIN" + key).toString()));
                                date.add(new BigDecimal(deviceData.get("MAX" + key).toString()));
                            } else if (deviceData.get("MIN" + key) instanceof byte[]) {
                                date.add(new BigDecimal(new String((byte[]) (deviceData.get("MIN" + key)))));
                                date.add(new BigDecimal(new String((byte[]) (deviceData.get("MAX" + key)))));
                            }
                            jo.put(key, date);
                        }
                    }
                    jsonArray.add(jo);
                    dailyDataMap.put("json", jsonArray.get(0).toString());
                    dailyDataList.add(dailyDataMap);
                }
            }
            if (!CollectionUtils.isEmpty(dailyDataList)) {
                historyDailyService.insertHistoryDaily(dailyDataList);
                ReturnT returnT = new ReturnT(200, "插入天表成功");
                return returnT;
            }
        } catch (Exception e) {
            XxlJobLogger.log("historyDailyException:" + e.getMessage());
            logger.error(e.getMessage());
            e.printStackTrace();
        }
        ReturnT returnT = new ReturnT(500, "插入天表失败");
        return returnT;
    }
 
    @XxlJob("historyMinutelyDelay")
    public ReturnT insertHistoryMinutelyTableDelay(String params) {
        Map macMap = JSON.parseObject(params);
        List<String> macList = (List<String>) macMap.get("mac");
        LocalDateTime time = LocalDateTime.now();
        int year = time.getYear();
        int month = time.getMonthValue();
        int day = time.getDayOfMonth();
        int hour = time.getHour();
        int minute = time.getMinute();
        if (day == 1) {
            if (hour == 0 && minute <= 30) {
                if (month == 1) {
                    month = 12;
                    year = year - 1;
                } else {
                    month = month - 1;
                }
            }
        }
        String monthStr = month < 10 ? ("0" + month) : month + "";
        String yearAndMonth = year + monthStr;
        LocalDateTime value = time.truncatedTo(ChronoUnit.MINUTES);
        LocalDateTime startTime = value.minusMinutes(31);
        LocalDateTime endTime = value.minusMinutes(30);
        List<String> sensorKeys = sensorService.getSensorKeys();
        Map<String, Object> devices = new HashMap<>();
        devices.put("sensorKeys", sensorKeys);
        devices.put("macList", macList);
        devices.put("start", startTime);
        devices.put("end", endTime);
        try {
            List<Map<String, Object>> minutelyData = deviceService.getSensorDataByMac(devices);
            XxlJobLogger.log("historyMinutelyData:" + minutelyData.size());
            List<Map<String, Object>> minutelyDataList = new ArrayList<>();
            for (Map<String, Object> deviceData : minutelyData) {
                if (!ObjectUtils.isEmpty(deviceData)) {
                    Map<String, Object> minutelyDataMap = new LinkedHashMap<>();
                    JSONObject jo = new JSONObject(true);
                    minutelyDataMap.put("mac", deviceData.get("mac"));
                    minutelyDataMap.put("time", startTime);
                    JSONArray jsonArray = new JSONArray();
                    for (String key : deviceData.keySet()) {
                        if (!key.equals("mac") && !key.startsWith("M")) {
                            List<Object> date = new ArrayList<>();
                            date.add(deviceData.get(key));
                            date.add(deviceData.get("MIN" + key));
                            date.add(deviceData.get("MAX" + key));
                            jo.put(key, date);
                        }
                    }
                    jsonArray.add(jo);
                    minutelyDataMap.put("json", jsonArray.get(0).toString());
                    minutelyDataList.add(minutelyDataMap);
                }
            }
            if (!CollectionUtils.isEmpty(minutelyDataList)) {
                historyMinutelyService.insertHistoryMinutely(minutelyDataList, yearAndMonth);
                ReturnT returnT = new ReturnT(200, "插入分钟表成功");
                return returnT;
            }
        } catch (Exception e) {
            XxlJobLogger.log("historyMinutelyException:" + e.getMessage());
            logger.error(e.getMessage());
            e.printStackTrace();
        }
        ReturnT returnT = new ReturnT(500, "插入分钟表失败");
        return returnT;
    }
 
    @XxlJob("historySpecial")
    public ReturnT insertHistorySpecialTable(String params) {
        Map macMap = JSON.parseObject(params);
        List<String> macList = (List<String>) macMap.get("mac");
        SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar=Calendar.getInstance();
        Date date=calendar.getTime();
        String s=format.format(date);
        calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - 1);
        Date date1=calendar.getTime();
        String s1=format.format(date1);
        Map<String, Object> devices = new HashMap<>();
        devices.put("macList", macList);
        devices.put("startTime", s1);
        devices.put("endTime", s);
        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;
    }
 
    @XxlJob("historyO3")
    public ReturnT insertHistoryO3Table(String params) {
        Map macMap = JSON.parseObject(params);
        List<String> macList = (List<String>) macMap.get("mac");
        String illuminationRatio = macMap.get("illuminationRatio").toString();
        String pressureRatio1 = macMap.get("pressureRatio1").toString();
        String pressureRatio2 = macMap.get("pressureRatio2").toString();
        String windSpeedRatio = macMap.get("windSpeedRatio").toString();
        BigDecimal temperatureRatio;
        BigDecimal humidityRatio;
        LocalDateTime time = LocalDateTime.now();
        LocalDateTime value = time.truncatedTo(ChronoUnit.HOURS);
        LocalDateTime illuminationTime = value.minusHours(1);
        LocalDateTime temperatureTime = value.minusHours(2);
        LocalDateTime predictionTime = value.plusHours(2);
        Integer predictionHour = predictionTime.getHour();
        Map<String, Object> devices = new HashMap<>();
        devices.put("sensorKeys", Arrays.asList("e7", "e12"));
        devices.put("macList", macList);
        devices.put("time", illuminationTime);
        List<Map<String, Object>> hourlyIlluminationData = historyHourlyService.getHourlySensorDataToCalculateO3(devices);
        XxlJobLogger.log("insertHistoryO3Table-IlluminationDataCount:" + hourlyIlluminationData.size());
        devices.put("time", temperatureTime);
        List<Map<String, Object>> hourlytemperatureData = historyHourlyService.getHourlySensorDataToCalculateO3(devices);
        XxlJobLogger.log("insertHistoryO3Table-temperatureDataCount:" + hourlytemperatureData.size());
        List<Map<String, Object>> hourlyDataList = new ArrayList<>();
        BigDecimal temperature;
        BigDecimal illumination;
        BigDecimal pressure = new BigDecimal("0");
        BigDecimal humidity = new BigDecimal("0");
        BigDecimal windSpeed = new BigDecimal("0");
        try {
            for (Map<String, Object> IlluminationData : hourlyIlluminationData) {
                if (!ObjectUtils.isEmpty(IlluminationData)) {
                    Map<String, Object> hourlyDataMap = new LinkedHashMap<>();
                    hourlyDataMap.put("mac", IlluminationData.get("mac"));
                    hourlyDataMap.put("time", predictionTime);
                    Organization organizationInfoByMac = organizationService.getOrganizationInfoByMac(IlluminationData.get("mac").toString());
                    Map<String, Object> parameters = new HashMap<>();
                    parameters.put("mac", IlluminationData.get("mac"));
                    parameters.put("villageCode", organizationInfoByMac.getVillageCode());
                    parameters.put("townCode", organizationInfoByMac.getTownCode());
                    parameters.put("areaCode", organizationInfoByMac.getAreaCode());
                    parameters.put("cityCode", organizationInfoByMac.getCityCode());
                    parameters.put("provinceCode", organizationInfoByMac.getProvinceCode());
                    List<Map<String, Object>> weatherByMac = weatherUtil.getWeatherByMac(parameters);
                    for (Map<String, Object> stringObjectMap : weatherByMac) {
                        Integer mjHour = Integer.valueOf(stringObjectMap.get("hour").toString());
                        if (predictionHour == mjHour) {
                            pressure = new BigDecimal(stringObjectMap.get("pressure").toString());
                            humidity = new BigDecimal(stringObjectMap.get("humidity").toString());
                            windSpeed = new BigDecimal(stringObjectMap.get("windSpeed").toString());
                        }
                    }
                    JSONObject jo = new JSONObject(true);
                    JSONArray jsonArray = new JSONArray();
                    for (Map<String, Object> temperatureData : hourlytemperatureData) {
                        if (!ObjectUtils.isEmpty(temperatureData)) {
                            if (IlluminationData.get("mac").equals(temperatureData.get("mac"))) {
                                if (temperatureData.get("e7") != null) {
                                    temperature = new BigDecimal(temperatureData.get("e7").toString());
                                } else {
                                    temperature = new BigDecimal("0");
                                }
                                if (temperatureData.get("e12") != null) {
                                    illumination = new BigDecimal(IlluminationData.get("e12").toString());
                                } else {
                                    illumination = new BigDecimal("0");
                                }
                                temperatureRatio = new BigDecimal("8").add(new BigDecimal("32").divide(temperature.subtract(new BigDecimal("12")), 4, BigDecimal.ROUND_HALF_UP));
                                BigDecimal bignum1 = temperature.multiply(temperatureRatio);
                                BigDecimal bignum2 = illumination.divide(new BigDecimal(illuminationRatio), 4, BigDecimal.ROUND_HALF_UP);
                                BigDecimal bignum3 = new BigDecimal(pressureRatio1).divide(pressure.subtract(new BigDecimal(pressureRatio2)), 4, BigDecimal.ROUND_HALF_UP);
                                BigDecimal index = humidity.subtract(new BigDecimal("100")).divide(new BigDecimal("50"), 4, BigDecimal.ROUND_HALF_UP);
                                double indexDouble = Math.pow(0.8, index.doubleValue());
                                humidityRatio = new BigDecimal("1").add(BigDecimal.valueOf(indexDouble));
                                BigDecimal bignum4 = humidity.multiply(humidityRatio);
                                BigDecimal bignum5 = windSpeed.multiply(new BigDecimal(windSpeedRatio));
                                BigDecimal result = bignum1.add(bignum2).add(bignum3).subtract(bignum4).subtract(bignum5).setScale(4, BigDecimal.ROUND_HALF_UP);
                                jo.put("e15", result);
                                jo.put("e6", humidity);
                                jo.put("e7", temperature);
                                jo.put("e12", illumination);
                                jo.put("e18", windSpeed);
                                jo.put("e28", pressure);
                            }
                        }
                    }
                    jsonArray.add(jo);
                    hourlyDataMap.put("json", jsonArray.get(0).toString());
                    hourlyDataList.add(hourlyDataMap);
                }
            }
            if (!CollectionUtils.isEmpty(hourlyDataList)) {
                historyHourlyService.insertHistoryO3Hourly(hourlyDataList);
                ReturnT returnT = new ReturnT(200, "插入臭氧成功");
                return returnT;
            }
        } catch (Exception e) {
            XxlJobLogger.log("insertHistoryO3TableException:" + e.getMessage());
            logger.error(e.getMessage());
            e.printStackTrace();
        }
        ReturnT returnT = new ReturnT(500, "插入臭氧失败");
        return returnT;
    }
 
}