From cda9d3a12240ad659efc11603862487d946715b2 Mon Sep 17 00:00:00 2001
From: zhanzhiqin <895896009@qq.com>
Date: 星期三, 27 四月 2022 18:14:08 +0800
Subject: [PATCH] fix

---
 ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
index 99d3b5d..5f0f272 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
@@ -37,10 +37,9 @@
 import java.io.File;
 import java.sql.Wrapper;
 import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
 
 /**
  * @author chenjiantian
@@ -60,10 +59,22 @@
      * @return 鏄惁鎴愬姛
      */
     public boolean saveReportData(String deviceName, A5LightHeartbeatReportInnerFrame.HeartBeatDataPackage heartBeatDataPackage) {
+//        LightReportData lightReportData = RedisUtils.getBean().get(A5LightDataEnum.LIGHT_HEART_BEAT.getCode() + deviceName, LightReportData.class);
+
+
+        String format = LocalDateTime.now().format(DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss"));
         LightReportData lightReportData = new LightReportData();
+
+        if (lightReportData == null) {
+            lightReportData = new LightReportData();
+            lightReportData.setCreateTime(format);
+        }
+        //todo
+        lightReportData.setCreateTime(format);
         BeanUtils.copyProperties(heartBeatDataPackage, lightReportData);
         lightReportData.setDeviceCode(deviceName);
 
+        lightReportData.setUpdateTime(format);
         //鍗曠伅鏁版嵁淇濆瓨鍒扮紦瀛橀噷
         RedisUtils.getBean().set(A5LightDataEnum.LIGHT_HEART_BEAT.getCode() + deviceName, lightReportData);
 
@@ -90,10 +101,10 @@
 
         List<LightReportDataBo> lightReportDataBos = new ArrayList<>(pageSize);
 
-        CommonPage<String> stringCommonPage = SpringContextHolder.getBean(LightService.class).listDeviceCode(pageNo, pageSize,keyword, deviceCode);
+        CommonPage<String> stringCommonPage = SpringContextHolder.getBean(LightService.class).listDeviceCode(pageNo, pageSize, keyword, deviceCode);
         List<String> macList = stringCommonPage.getList();
         if (CollUtil.isEmpty(macList)) {
-            return  new CommonPage();
+            return new CommonPage();
         }
 
         for (String macCode : macList) {
@@ -105,7 +116,7 @@
                 if (lightReportData != null) {
                     BeanUtils.copyProperties(lightReportData, lightReportDataBo);
                 }
-
+                lightReportDataBo.setDeviceCode(macCode);
                 Pole pole = SpringContextHolder.getBean(PoleService.class).getOne(Wrappers.lambdaQuery(Pole.class).eq(Pole::getDeviceCode, macCode));
                 if (pole != null) {
                     lightReportDataBo.setPoleName(pole.getPoleName());

--
Gitblit v1.9.3