From caf2599a9869244ded811018811c37a2aabac3fc Mon Sep 17 00:00:00 2001
From: vince <757871790@qq.com>
Date: 星期三, 08 一月 2025 11:29:05 +0800
Subject: [PATCH] 优化测温协议

---
 src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java |   48 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java b/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
index 44e8349..d6cbee4 100644
--- a/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
+++ b/src/main/java/com/fzzy/gateway/service/GatewayDeviceTestPR.java
@@ -1,20 +1,19 @@
 package com.fzzy.gateway.service;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson2.JSONObject;
+import com.alibaba.fastjson.JSONObject;
 import com.bstek.dorado.annotation.Expose;
 import com.fzzy.api.data.GatewayDeviceType;
 import com.fzzy.api.utils.DateUtil;
 import com.fzzy.async.fzzy40.Fzzy40CommonService;
 import com.fzzy.async.fzzy40.entity.Fz40Grain;
-import com.fzzy.gateway.api.DeviceReportService;
+import com.fzzy.gateway.api.GatewayDeviceReportService;
 import com.fzzy.gateway.api.GatewayRemoteManager;
 import com.fzzy.gateway.data.BaseResp;
+import com.fzzy.gateway.data.BaseReqData;
 import com.fzzy.gateway.entity.GatewayDevice;
 import com.fzzy.gateway.hx2023.ScConstant;
 import com.fzzy.gateway.hx2023.data.*;
 import com.fzzy.gateway.service.repository.GatewayDeviceRep;
-import com.fzzy.mqtt.MqttGatewayService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateFormatUtils;
@@ -37,8 +36,8 @@
 
     @Resource
     private GatewayDeviceRep gatewayDeviceRep;
-//    @Resource
-//    private Fzzy40CommonService fzzy40CommonService;
+    @Resource
+    private Fzzy40CommonService fzzy40CommonService;
     @Resource
     private GatewayRemoteManager gatewayRemoteManager;
 //    @Resource
@@ -59,7 +58,7 @@
      */
     @Expose
     public String ajaxTestGrain2(GatewayDevice data) {
-        SyncReqData reqData = new SyncReqData();
+        BaseReqData reqData = new BaseReqData();
         reqData.setDevice(data);
         reqData.setAutoReplay(true);
         reqData.setMessageType(ScConstant.MESSAGE_TYPE_INVOKE_FUNCTION);
@@ -75,7 +74,7 @@
             return "ERROR锛氬綋鍓嶈澶囨病鏈夐厤缃竷绾胯鍒欙紝鏃犳硶鎵ц";
         }
 
-        BaseResp resp = gatewayRemoteManager.getSyncGrainService(data.getSyncProtocol()).syncGrain2(reqData);
+        BaseResp resp = gatewayRemoteManager.getSyncGrainService(data.getSyncProtocol()).syncGrain(reqData);
 
         //鑷姩鎺ㄩ��
         if (200 == resp.getCode() && reqData.isAutoReplay()) {
@@ -121,7 +120,7 @@
     }
 
 
-    private String pushByV40(List<GatewayDevice> list, Date start, Date end) {
+    public String pushByV40(List<GatewayDevice> list, Date start, Date end) {
 
         String depotIdSys;
         List<Fz40Grain> listGrain;
@@ -130,7 +129,7 @@
 
         KafaGrainData pushData;
 
-        DeviceReportService deviceReportService = null;
+        GatewayDeviceReportService deviceReportService = null;
         for (GatewayDevice device : list) {
             depotIdSys = device.getDepotIdSys();
 
@@ -140,8 +139,8 @@
             }
 
             //TODO ----銆�
-           // listGrain = fzzy40CommonService.listGrain(depotIdSys, start, end);
-            listGrain = null;
+            listGrain = fzzy40CommonService.listGrain(depotIdSys, start, end);
+            //listGrain = null;
             if (null == listGrain || listGrain.isEmpty()) {
                 log.info("---------璁惧---{}--鏈悓姝ュ埌绮儏淇℃伅锛岃纭褰撳墠鏉′欢涓嬫槸鍚︽湁鏁版嵁", device.getDeviceName());
                 continue;
@@ -155,11 +154,11 @@
 
 
             if (null == deviceReportService) {
-                deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getProvinceProtocol());
+                deviceReportService = gatewayRemoteManager.getDeviceReportService(device.getPushProtocol());
             }
 
 
-            deviceReportService.pushGrainData2Cloud(pushData);
+           // deviceReportService.reportGrainDataByHand(pushData);
 
         }
 
@@ -292,7 +291,6 @@
     @Expose
     public String ajaxTestWeight(Map<String,Object> data) throws Exception {
         double weigh = (double) data.get("weight");
-        double deviceId = (double) data.get("deviceId");
 
 
         List<GatewayDevice> devices = listAll();
@@ -384,7 +382,7 @@
             lpr.setCarNumber(carNumber);
             JSONObject jsonObject = new JSONObject();
             jsonObject.put("carNumber", carNumber);
-            jsonObject.put("position", "big");
+            jsonObject.put("position", device.getPosition());
             packet.setProperties(jsonObject);
 
             packet.setTimestamp(System.currentTimeMillis());
@@ -403,5 +401,23 @@
         log.info("-----------test-------------------");
         return "SUCCESS";
     }
+    
+    
+    /**
+     * 
+     * gatewayDeviceTestPR#testIde
+     * 娴嬭瘯涓嬭鍒嗘満
+     * @param data
+     * @return
+     */
+    @Expose
+    public String testIde(Map<String,Object> data) throws Exception {
+    	 String deviceId = (String) data.get("deviceId");
+    	 String bizType = (String) data.get("bizType");
+    	 
+    	 log.info("-----------涓嬭鍒嗘満璋冭瘯-璁惧={},浜嬩欢={}",deviceId,bizType);
+    	 
+        return "SUCCESS";
+    }
 
 }

--
Gitblit v1.9.3