jiazx0107@163.com
2024-01-04 013c5f28422defd9b47abbe17a827be693872a26
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;
@@ -52,6 +58,15 @@
        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;
    }
    /**
     * 针对一个通讯分机对多个仓情况