From 6495040bbda5308c86e852ad1b080097bfa916a9 Mon Sep 17 00:00:00 2001
From: vince <757871790@qq.com>
Date: 星期三, 09 七月 2025 09:22:17 +0800
Subject: [PATCH] 优化粮温检测

---
 src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java
index f0f6e00..744920c 100644
--- a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java
+++ b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisSystem.java
@@ -4,6 +4,7 @@
 import com.fzzy.api.data.ApiCommonDevice;
 import com.fzzy.gateway.GatewayUtils;
 import com.fzzy.gateway.entity.GatewayDevice;
+import com.fzzy.gateway.service.GatewayDeviceService;
 import com.fzzy.protocol.fzzy.builder.ObjectCommandBuilder;
 import com.fzzy.protocol.fzzy.builder.SimpleCommandBuilder;
 import com.fzzy.protocol.fzzy.cmd.BaseRemoteImpl;
@@ -15,6 +16,7 @@
 import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.util.Date;
 
 /**
@@ -27,20 +29,29 @@
     public static final String BEAN_ID = "fzzy.analysisSystem";
 
 
+    @Resource
+    private GatewayDeviceService gatewayDeviceService;
+
+
     public void analysis1001(ReMessage reMessage) {
 
         //鑾峰彇鍒扮櫥闄嗕俊鎭紝鎵ц璁惧淇℃伅鏁寸悊
-        ApiCommonDevice device = Constant.getCommonDeviceCache(reMessage.getSn());
-        if (null == device) {
-            device = new ApiCommonDevice();
+        GatewayDevice d = GatewayUtils.getCacheByDeviceSn(reMessage.getSn());
+        if (null == d) {
+            d = new GatewayDevice();
         }
+        ApiCommonDevice device = new ApiCommonDevice();
         device.setIp(reMessage.getIp());
         device.setPort(reMessage.getPort());
         device.setSn(reMessage.getSn());
-        device.setId(reMessage.getIedId());
+        device.setId(d.getId());
         device.setOnlineTime(new Date());
+        device.setCode("SUCCESS");
         Constant.updateCache(device);
 
+        //鏇存柊璁惧鍦ㄧ嚎
+        gatewayDeviceService.onlineByCommonDevice(device);
+
 
         //杩斿洖褰撳墠绯荤粺鏃堕棿
         Response1001 response = new Response1001();

--
Gitblit v1.9.3