shjung 3 years ago
parent
commit
4f276b60cd

+ 16 - 5
src/main/java/com/its/api/its/global/TbNodeManager.java

@@ -1,6 +1,5 @@
 package com.its.api.its.global;
 package com.its.api.its.global;
 
 
-import com.its.api.its.model.dto.node.TbNodeDto;
 import com.its.api.its.model.entity.node.TbNode;
 import com.its.api.its.model.entity.node.TbNode;
 import com.its.api.its.repository.node.TbNodeRepository;
 import com.its.api.its.repository.node.TbNodeRepository;
 import lombok.Getter;
 import lombok.Getter;
@@ -20,7 +19,7 @@ public class TbNodeManager {
 
 
     private final TbNodeRepository repo;
     private final TbNodeRepository repo;
 
 
-    private static final ConcurrentHashMap<Long, TbNodeDto> nodeMap = new ConcurrentHashMap<>();
+    private static final ConcurrentHashMap<Long, TbNode> nodeMap = new ConcurrentHashMap<>();
 
 
     @PostConstruct
     @PostConstruct
     void init() {
     void init() {
@@ -31,20 +30,32 @@ public class TbNodeManager {
 
 
         List<TbNode> lists = repo.findAll();
         List<TbNode> lists = repo.findAll();
         for (TbNode obj : lists) {
         for (TbNode obj : lists) {
-            nodeMap.put(obj.getNodeId(), obj.toDto());
+            nodeMap.put(obj.getNodeId(), obj);
         }
         }
         //log.info("=== {}", nodeMap);
         //log.info("=== {}", nodeMap);
     }
     }
 
 
+    public static TbNode get(Long id) {
+        if (id == null) {
+            return null;
+        }
+        return nodeMap.get(id);
+    }
     public static String getNodeName(Long NODE_ID) {
     public static String getNodeName(Long NODE_ID) {
-        TbNodeDto obj = nodeMap.get(NODE_ID);
+        if (NODE_ID == null) {
+            return "x";
+        }
+        TbNode obj = nodeMap.get(NODE_ID);
         if (obj != null) {
         if (obj != null) {
             return "[" + NODE_ID + "] " + obj.getNodeName();
             return "[" + NODE_ID + "] " + obj.getNodeName();
         }
         }
         return "[" + NODE_ID + "] ?";
         return "[" + NODE_ID + "] ?";
     }
     }
     public static String getNodeNameInteger(Long NODE_ID) {
     public static String getNodeNameInteger(Long NODE_ID) {
-        TbNodeDto obj = nodeMap.get(NODE_ID);
+        if (NODE_ID == null) {
+            return "x";
+        }
+        TbNode obj = nodeMap.get(NODE_ID);
         if (obj != null) {
         if (obj != null) {
             return obj.getNodeName();
             return obj.getNodeName();
         }
         }

+ 3 - 0
src/main/java/com/its/api/its/global/UnitSystManager.java

@@ -36,6 +36,9 @@ public class UnitSystManager {
     }
     }
 
 
     public static TbUnitSyst get(String id) {
     public static TbUnitSyst get(String id) {
+        if (id == null) {
+            return null;
+        }
         return objMap.get(id);
         return objMap.get(id);
     }
     }
 }
 }

+ 3 - 0
src/main/java/com/its/api/its/global/VdsManager.java

@@ -36,6 +36,9 @@ public class VdsManager {
     }
     }
 
 
     public static TbVdsCtlr get(String id) {
     public static TbVdsCtlr get(String id) {
+        if (id == null) {
+            return null;
+        }
         return objMap.get(id);
         return objMap.get(id);
     }
     }
 }
 }

+ 3 - 0
src/main/java/com/its/api/its/global/VmsManager.java

@@ -36,6 +36,9 @@ public class VmsManager {
     }
     }
 
 
     public static TbVmsCtlr get(Long id) {
     public static TbVmsCtlr get(Long id) {
+        if (id == null) {
+            return null;
+        }
         return objMap.get(id);
         return objMap.get(id);
     }
     }
 }
 }

+ 9 - 0
src/main/java/com/its/api/its/global/VmsSymbLibManager.java

@@ -53,10 +53,16 @@ public class VmsSymbLibManager {
     }
     }
 
 
     public static TbVmsSymbLib get(Integer id) {
     public static TbVmsSymbLib get(Integer id) {
+        if (id == null) {
+            return null;
+        }
         return lib.get(id);
         return lib.get(id);
     }
     }
 
 
     public static TbVmsSymbIfsc getIfsc(Integer id) {
     public static TbVmsSymbIfsc getIfsc(Integer id) {
+        if (id == null) {
+            return null;
+        }
         Map<Integer, TbVmsSymbIfsc> ifscMap = ifsc.get(id);
         Map<Integer, TbVmsSymbIfsc> ifscMap = ifsc.get(id);
         if (ifscMap != null) {
         if (ifscMap != null) {
             return ifscMap.get(1);
             return ifscMap.get(1);
@@ -65,6 +71,9 @@ public class VmsSymbLibManager {
     }
     }
 
 
     public static Map<Integer, TbVmsSymbIfsc> getIfscMap(Integer id) {
     public static Map<Integer, TbVmsSymbIfsc> getIfscMap(Integer id) {
+        if (id == null) {
+            return null;
+        }
         return ifsc.get(id);
         return ifsc.get(id);
     }
     }