From f7178996ca77a1bccc941c0e7a73b36803e508cb Mon Sep 17 00:00:00 2001
From: vince <757871790@qq.com>
Date: 星期五, 01 三月 2024 16:13:11 +0800
Subject: [PATCH] 优化协议

---
 src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
index 017002e..fb85434 100644
--- a/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
+++ b/src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
@@ -13,6 +13,7 @@
 import com.fzzy.gateway.entity.GatewayDevice;
 import com.fzzy.gateway.hx2023.ScConstant;
 import com.fzzy.gateway.hx2023.data.*;
+import com.fzzy.protocol.ProtocolUtils;
 import com.fzzy.protocol.fzzy.builder.SimpleCommandBuilder;
 import com.fzzy.protocol.fzzy.cmd.BaseRemoteImpl;
 import com.fzzy.protocol.fzzy.data.ReMessage;
@@ -68,7 +69,7 @@
 
 
             //绮儏瑙f瀽
-            log.info("鎺у埗鏌�--->骞冲彴锛屾帹鍔ㄧ殑绮儏淇℃伅--{}", response);
+            log.info("鎺у埗鏌�--->骞冲彴锛屾帶鍒舵煖杩斿洖绮儏妫�娴嬬粨鏋�--{}", response);
 
             //绮儏灏佽鍜屽鐞�
             if (StringUtils.isEmpty(response.getLayerPerCircle())) {
@@ -91,10 +92,9 @@
 
     //淇℃伅璋冩暣灏佽
     private void buildBizInfo1(Response2102 response) {
-        String depotId = response.getHouseId();
 
         //鑾峰彇璇锋眰淇℃伅
-        BaseReqData reqData = ServerUtils.getSyncReq(depotId);
+        BaseReqData reqData = ProtocolUtils.getSyncReq(response.getHouseId());
 
         if (null == reqData) {
             log.error("--绮儏灏佽瑙f瀽锛屾湭鑾峰彇鍒拌姹傜浉鍏冲弬鏁�----");
@@ -132,7 +132,7 @@
         //鏍瑰彿
         int cableNum = 1, position = 0;
 
-        double curTemp = response.getTMin();
+        double curTemp;
         String[] attr = response.getPoints().split(",");
         int x = 0, y = 0, z = 0;
         for (int i = 0; i < attr.length; i++) {
@@ -159,7 +159,11 @@
         }
 
         outPut.setTemperature(temperature);
+        List<GrainTH> ths = new ArrayList<>();
 
+        ths.add(new GrainTH(response.getTIn()!=null?response.getTIn()+"":"",response.getHIn()!=null?response.getHIn()+"":"","1"));
+        outPut.setTemperatureAndhumidity(ths);
+        //grain.setOutput(JSONObject.toJSONString(outPut));
         grain.setOutput(com.alibaba.fastjson2.JSONObject.toJSONString(outPut));
 
 
@@ -203,6 +207,7 @@
         GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol());
         if (null == reportService) {
             log.error("------------绮儏鎺ㄩ�佸け璐ワ紝绯荤粺涓嶅瓨鍦ㄥ綋鍓嶅崗璁墽琛岀被----{}", reqData.getDevice().getDeviceName());
+            return;
         }
         reportService.reportGrainData(reqData);
     }

--
Gitblit v1.9.3