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