|
@@ -11,6 +11,7 @@ import java.sql.ResultSet;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
+import java.util.concurrent.ArrayBlockingQueue;
|
|
|
|
|
|
@Slf4j
|
|
|
@Component
|
|
@@ -40,6 +41,8 @@ public class PointService {
|
|
|
return aiMap;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private Map<Integer, ArrayList<Point>> loadAiPointMap() {
|
|
|
Map<Integer, ArrayList<Point>> map = new HashMap<>();
|
|
|
aiKeyMap = new HashMap<>();
|
|
@@ -97,7 +100,7 @@ public class PointService {
|
|
|
try {
|
|
|
log.info("加载DI测点......");
|
|
|
Connection conn = db.getConnection();
|
|
|
- String sql = "select * from point where pointtype = 'DI' order by publicaddr, pointaddr";
|
|
|
+ String sql = "select * from point where pointtype = 'DI' order by publicaddr, pointaddr asc";
|
|
|
log.info("执行SQL:" + sql);
|
|
|
PreparedStatement ps = conn.prepareStatement(sql);
|
|
|
ResultSet rs = ps.executeQuery();
|
|
@@ -137,7 +140,10 @@ public class PointService {
|
|
|
aiMap = loadAiPointMap();
|
|
|
}
|
|
|
|
|
|
- return aiMap.get(addr);
|
|
|
+ if (aiMap != null)
|
|
|
+ return aiMap.get(addr);
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
public ArrayList<Point> getDiList(int addr) {
|
|
@@ -145,7 +151,10 @@ public class PointService {
|
|
|
diMap = loadDiPointMap();
|
|
|
}
|
|
|
|
|
|
- return diMap.get(addr);
|
|
|
+ if (diMap != null)
|
|
|
+ return diMap.get(addr);
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
public ArrayList<String> getAiKeys(int addr) {
|
|
@@ -153,7 +162,10 @@ public class PointService {
|
|
|
loadAiPointMap();
|
|
|
}
|
|
|
|
|
|
- return aiKeyMap.get(addr);
|
|
|
+ if (aiKeyMap != null)
|
|
|
+ return aiKeyMap.get(addr);
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
public ArrayList<String> getDiKeys(int addr) {
|
|
@@ -161,7 +173,10 @@ public class PointService {
|
|
|
loadDiPointMap();
|
|
|
}
|
|
|
|
|
|
- return diKeyMap.get(addr);
|
|
|
+ if (diKeyMap != null)
|
|
|
+ return diKeyMap.get(addr);
|
|
|
+
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
}
|