Commit 90ef44c4 authored by duanruiming's avatar duanruiming

[update] 优化代码2

parent 1ba6a77c
...@@ -31,6 +31,7 @@ import java.util.stream.Collectors; ...@@ -31,6 +31,7 @@ import java.util.stream.Collectors;
*/ */
@Component @Component
@Slf4j @Slf4j
@SuppressWarnings("unused")
public class SignalStatus4StaticSchemeTask { public class SignalStatus4StaticSchemeTask {
public static final Map<String, LightsStatusVO> currentCrossLightStatusCache = new HashMap<>(); public static final Map<String, LightsStatusVO> currentCrossLightStatusCache = new HashMap<>();
...@@ -96,7 +97,7 @@ public class SignalStatus4StaticSchemeTask { ...@@ -96,7 +97,7 @@ public class SignalStatus4StaticSchemeTask {
String code = crossInfoPO.getCode(); String code = crossInfoPO.getCode();
LightsStatusVO lightsStatusVO = new LightsStatusVO(); LightsStatusVO lightsStatusVO = new LightsStatusVO();
List<CrossSectionPO> crossSectionPOS = crossSectionMapper.selectByCrossId(crossId); List<CrossSectionPO> crossSectionPOS = crossSectionMapper.selectByCrossId(crossId);
List<CrossSchedulesPO> crossSchedulesPOS = crossSchedulesMapper.selectByCrossIds(Arrays.asList(crossId)); List<CrossSchedulesPO> crossSchedulesPOS = crossSchedulesMapper.selectByCrossIds(Collections.singletonList(crossId));
if (!CollectionUtils.isEmpty(crossSchedulesPOS)) { if (!CollectionUtils.isEmpty(crossSchedulesPOS)) {
Map<Integer, List<CrossSchedulesPO>> schedulesMap = crossSchedulesPOS.stream().collect(Collectors.groupingBy(CrossSchedulesPO::getPlanId)); Map<Integer, List<CrossSchedulesPO>> schedulesMap = crossSchedulesPOS.stream().collect(Collectors.groupingBy(CrossSchedulesPO::getPlanId));
// 判断当前执行的调度,获取日计划号 // 判断当前执行的调度,获取日计划号
...@@ -148,9 +149,7 @@ public class SignalStatus4StaticSchemeTask { ...@@ -148,9 +149,7 @@ public class SignalStatus4StaticSchemeTask {
LightsStatusVO lightsStatusVO = currentCrossLightStatusCache.get(crossId); LightsStatusVO lightsStatusVO = currentCrossLightStatusCache.get(crossId);
if (Objects.nonNull(lightsStatusVO)) { if (Objects.nonNull(lightsStatusVO)) {
String currentSchemeNo = lightsStatusVO.getSchemeId(); String currentSchemeNo = lightsStatusVO.getSchemeId();
if (StringUtils.equalsIgnoreCase(schemeNo, currentSchemeNo)) { return StringUtils.equalsIgnoreCase(schemeNo, currentSchemeNo);
return true;
}
} }
} }
return false; return false;
...@@ -305,9 +304,6 @@ public class SignalStatus4StaticSchemeTask { ...@@ -305,9 +304,6 @@ public class SignalStatus4StaticSchemeTask {
if (redCountDown <= 0) { if (redCountDown <= 0) {
redCountDown = cycleLen - runtime; redCountDown = cycleLen - runtime;
} }
//if (redCountDown <= 0) {
// redCountDown = 1;
//}
if (type == 2) { // 圆饼灯 if (type == 2) { // 圆饼灯
List<Integer> dirList = Arrays.asList(1, 2, 3); List<Integer> dirList = Arrays.asList(1, 2, 3);
for (Integer commonTurn : dirList) { for (Integer commonTurn : dirList) {
...@@ -374,7 +370,6 @@ public class SignalStatus4StaticSchemeTask { ...@@ -374,7 +370,6 @@ public class SignalStatus4StaticSchemeTask {
/** /**
* 统一方向转向倒计时 * 统一方向转向倒计时
*
* @param phaseMap * @param phaseMap
* @param dir * @param dir
* @param turnCountDown * @param turnCountDown
......
...@@ -10,6 +10,7 @@ import java.text.SimpleDateFormat; ...@@ -10,6 +10,7 @@ import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@Slf4j @Slf4j
@SuppressWarnings("all")
public class DateUtils { public class DateUtils {
private static final ThreadLocal<SimpleDateFormat> threadLocal = new ThreadLocal<>(); private static final ThreadLocal<SimpleDateFormat> threadLocal = new ThreadLocal<>();
......
...@@ -20,6 +20,7 @@ import java.util.Map; ...@@ -20,6 +20,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
@Component @Component
@SuppressWarnings("all")
public class HttpRestUtil { public class HttpRestUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestUtil.class); private static final Logger LOGGER = LoggerFactory.getLogger(HttpRestUtil.class);
......
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