Commit 5c4e63a8 authored by duanruiming's avatar duanruiming

[add] 灯态增加线程

parent 09c5fc13
...@@ -26,5 +26,5 @@ public class SignalDataCache { ...@@ -26,5 +26,5 @@ public class SignalDataCache {
public static final Map<String, LightsStatusVO> runningStateInfoCache = new ConcurrentHashMap<>(); public static final Map<String, LightsStatusVO> runningStateInfoCache = new ConcurrentHashMap<>();
// 海信推送方案相位信息,未计算灯态缓存 // 海信推送方案相位信息,未计算灯态缓存
public static final Map<String, LightsStatusVO> runningStateInfoCacheNoLamp = new ConcurrentHashMap<>(); public static final Map<String, LightsStatusVO> runningStateInfoCacheNoLamp = new ConcurrentHashMap<>();
public static final Map<String, Long> runningStatusStampMap = new HashMap<>(); public static final Map<String, Long> runningStatusStampMap = new ConcurrentHashMap<>();
} }
...@@ -19,6 +19,7 @@ import net.wanji.utc.hisense.pojo.dto.CrossSchemePhaseCountDownDTO; ...@@ -19,6 +19,7 @@ import net.wanji.utc.hisense.pojo.dto.CrossSchemePhaseCountDownDTO;
import net.wanji.utc.hisense.pojo.dto.PhaseCountDownDTO; import net.wanji.utc.hisense.pojo.dto.PhaseCountDownDTO;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -40,9 +41,12 @@ public class HisensePhaseCountDownTask { ...@@ -40,9 +41,12 @@ public class HisensePhaseCountDownTask {
private CrossSchemeMapper crossSchemeMapper; private CrossSchemeMapper crossSchemeMapper;
@Resource @Resource
private CrossLightsMapper crossLightsMapper; private CrossLightsMapper crossLightsMapper;
@Resource(name = "commonThreadPoolExecutor")
ThreadPoolTaskExecutor commonThreadPoolExecutor;
@Scheduled(fixedRate = 1000, initialDelay = 1000) @Scheduled(fixedRate = 1000, initialDelay = 1000)
public void phaseTimeCountDown() throws Exception { public void phaseTimeCountDown() throws Exception {
commonThreadPoolExecutor.execute(() -> {
try { try {
Map<String, LightsStatusVO> runningStateInfoCacheNoLamp = SignalDataCache.runningStateInfoCacheNoLamp; Map<String, LightsStatusVO> runningStateInfoCacheNoLamp = SignalDataCache.runningStateInfoCacheNoLamp;
if (!runningStateInfoCacheNoLamp.isEmpty()) { if (!runningStateInfoCacheNoLamp.isEmpty()) {
...@@ -92,8 +96,10 @@ public class HisensePhaseCountDownTask { ...@@ -92,8 +96,10 @@ public class HisensePhaseCountDownTask {
} }
} catch (Exception e) { } catch (Exception e) {
log.error("定时任务计算路口相位灯态倒计时异常", e); log.error("定时任务计算路口相位灯态倒计时异常", e);
throw new Exception(e); throw new RuntimeException(e);
} }
});
} }
private static void getRedCountDown(String crossId, LightsStatusVO lightsStatusVO, String schemeId) { private static void getRedCountDown(String crossId, LightsStatusVO lightsStatusVO, String schemeId) {
......
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