Commit fffcfd32 authored by duanruiming's avatar duanruiming

[add] 海信灯态倒计时优化

parent 775e21e3
......@@ -44,6 +44,7 @@ import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
/**
* 订阅信号运行状态、告警、灯态
......@@ -99,18 +100,18 @@ public class SignalStatusTask {
if (!evenWarnWebSocketMap.isEmpty()) {
Map<String, List<Map.Entry<String, RealTimeDataWebSocket>>> crossEntryMap = getCrossEntryMap(evenWarnWebSocketMap);
for (Map.Entry<String, List<Map.Entry<String, RealTimeDataWebSocket>>> entry : crossEntryMap.entrySet()) {
//commonThreadPoolExecutor.execute(() -> {
ObjectMapper mapper = JacksonUtils.getInstance();
String crossId = entry.getKey();
CrossInfoPO crossInfoPO = crossInfoMapper.selectByPrimaryKey(crossId);
if (Objects.isNull(crossInfoPO)) {
continue;
}
List<LightsStatusVO> lightsStatusVOS = getLightsStatusVOS(mapper, crossId, crossInfoPO);
saveAndSendLightsStatus(mapper, crossId, lightsStatusVOS, entry);
//});
commonThreadPoolExecutor.execute(() -> {
long start = System.currentTimeMillis();
ObjectMapper mapper = JacksonUtils.getInstance();
String crossId = entry.getKey();
CrossInfoPO crossInfoPO = crossInfoMapper.selectByPrimaryKey(crossId);
if (Objects.nonNull(crossInfoPO)) {
List<LightsStatusVO> lightsStatusVOS = getLightsStatusVOS(mapper, crossId, crossInfoPO);
saveAndSendLightsStatus(mapper, crossId, lightsStatusVOS, entry);
long end = System.currentTimeMillis();
log.error("当前路口:{}, 获取灯态时间:{}ms", crossId, end-start);
}
});
}
sendKafka();
//sendElastic();
......@@ -376,7 +377,7 @@ public class SignalStatusTask {
String[] split = crossIdStr.split(",");
crossId = split[0];
}
List<Map.Entry<String, RealTimeDataWebSocket>> socketList = new ArrayList<>();
List<Map.Entry<String, RealTimeDataWebSocket>> socketList = new CopyOnWriteArrayList<>();
if (tempMap.containsKey(crossId)) {
socketList = tempMap.get(crossId);
socketList.add(item);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment