From 88763f2ae21e9d3771ba744577edcc2d344802a6 Mon Sep 17 00:00:00 2001
From: vince <757871790@qq.com>
Date: 星期四, 06 三月 2025 16:09:31 +0800
Subject: [PATCH] 修改测温bug

---
 src/main/java/com/fzzy/api/Constant.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/fzzy/api/Constant.java b/src/main/java/com/fzzy/api/Constant.java
index 9fb3f23..f23fede 100644
--- a/src/main/java/com/fzzy/api/Constant.java
+++ b/src/main/java/com/fzzy/api/Constant.java
@@ -339,11 +339,11 @@
         }
         return null;
     }
-    public static ApiCommonDevice getCommonDeviceCacheBySn(String sn) {
+    public static synchronized ApiCommonDevice getCommonDeviceCacheBySn(String sn) {
         if (null == sn) return null;
 
         if (contextDeviceMap.isEmpty()) return null;
-        log.info("鍦ㄧ嚎璁惧锛�" + JSON.toJSONString(contextDeviceMap));
+        //log.info("鍦ㄧ嚎璁惧锛�" + JSON.toJSONString(contextDeviceMap));
         for (ApiCommonDevice device : contextDeviceMap.values()) {
             if (sn.equals(device.getSn())) return device;
         }
@@ -360,6 +360,8 @@
         device.setStatus(Constant.YN_Y);
         device.setCode("SUCCESS");
         device.setMsg("璁惧涓婄嚎");
+        device.setSn(device.getSn());
+        device.setId(device.getId());
         device.setOnlineTime(new Date());
         contextDeviceMap.put(device.getIp(), device);
         log.info("璁惧涓婄嚎锛�" + ip);
@@ -377,6 +379,7 @@
         device.setStatus(Constant.YN_N);
         device.setCode("ERROR");
         device.setMsg("璁惧绂荤嚎");
+        device.setId(device.getId());
         contextDeviceMap.put(device.getIp(), device);
 
         return device;

--
Gitblit v1.9.3