From 328eba66ddc6fdf2f324b9cd04cd6acec9f642de Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期六, 18 十一月 2023 13:48:49 +0800
Subject: [PATCH] 增加HTTP地磅协议实现

---
 src/main/java/com/fzzy/gateway/GatewayUtils.java |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/fzzy/gateway/GatewayUtils.java b/src/main/java/com/fzzy/gateway/GatewayUtils.java
index 7704a2f..0de33a5 100644
--- a/src/main/java/com/fzzy/gateway/GatewayUtils.java
+++ b/src/main/java/com/fzzy/gateway/GatewayUtils.java
@@ -1,12 +1,10 @@
 package com.fzzy.gateway;
 
+import com.fzzy.api.data.GatewayDeviceType;
 import com.fzzy.gateway.entity.GatewayDevice;
 import org.springframework.stereotype.Component;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 甯搁噺
@@ -31,10 +29,20 @@
      */
     public static Map<String, GatewayDevice> cacheMapDeviceSn = new HashMap<>();
 
+    /**
+     * 璁惧缂撳瓨-鍙拡瀵�
+     */
+    public static Map<String, GatewayDevice> cacheMapDeviceWeight = new HashMap<>();
+
 
     public static void add2Cache(GatewayDevice device) {
         cacheMapDeviceId.put(device.getDeviceId(), device);
         cacheMapDeviceSn.put(device.getDeviceSn(), device);
+
+        //淇濆瓨鍦扮
+        if (GatewayDeviceType.TYPE_01.getCode().equals(device.getType())) {
+            cacheMapDeviceWeight.put(device.getDeviceId(), device);
+        }
     }
 
     public static GatewayDevice getCacheByDeviceId(String deviceId) {
@@ -79,4 +87,9 @@
         if (null == value || "N".equals(value)) return false;
         return true;
     }
+
+
+    public static Collection<GatewayDevice> listDeviceWeight(){
+        return cacheMapDeviceWeight.values();
+    }
 }

--
Gitblit v1.9.3