From efec12bd4827ddefd9b19ccc0eee3ca1c62908f3 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期五, 12 一月 2024 19:09:01 +0800 Subject: [PATCH] 添加手动推送粮情接口,以便第三方接口调用 --- src/main/java/com/fzzy/gateway/GatewayUtils.java | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/fzzy/gateway/GatewayUtils.java b/src/main/java/com/fzzy/gateway/GatewayUtils.java index e7da33c..7e4df85 100644 --- a/src/main/java/com/fzzy/gateway/GatewayUtils.java +++ b/src/main/java/com/fzzy/gateway/GatewayUtils.java @@ -4,7 +4,6 @@ import com.fzzy.api.data.ApiCommonDevice; import com.fzzy.api.data.GatewayDeviceType; import com.fzzy.gateway.entity.GatewayDevice; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import java.util.*; @@ -42,6 +41,13 @@ return cacheMapDeviceId.get(deviceId); } + + /** + * 閽堝涓�涓垎鏈哄寤掗棿鐨勬儏鍐� + * + * @param deviceSn + * @return + */ public static GatewayDevice getCacheByDeviceSn(String deviceSn) { Collection<GatewayDevice> list = allCacheDevice(); if (null == list || list.isEmpty()) return null; @@ -50,6 +56,16 @@ if (deviceSn.equals(device.getDeviceSn())) return device; } + return null; + } + + public static GatewayDevice getCacheByDeviceSIp(String ip) { + Collection<GatewayDevice> list = allCacheDevice(); + if (null == list || list.isEmpty()) return null; + + for (GatewayDevice device : list) { + if (ip.equals(device.getIp())) return device; + } return null; } @@ -109,4 +125,17 @@ public static Collection<GatewayDevice> listDeviceWeight() { return cacheMapDeviceWeight.values(); } + + public static GatewayDevice getCacheByDepotSysId(String depotSysId) { + + if (null == depotSysId) return null; + Collection<GatewayDevice> list = allCacheDevice(); + if (null == list || list.isEmpty()) return null; + + for (GatewayDevice device : list) { + if (null == device.getDepotIdSys()) continue; + if (depotSysId.equals(device.getDepotIdSys())) return device; + } + return null; + } } -- Gitblit v1.9.3