Commit 24068f46 authored by duanruiming's avatar duanruiming

态势检测-信号机状态优化

parent 0d1db110
......@@ -20,7 +20,7 @@ import java.util.Objects;
@RequestMapping("/controlCommand")
@RestController
@SuppressWarnings("all")
public class SignalServiceController {
public class SignalCommandController {
@Autowired
private UtcFeignClients utcFeignClients;
......
......@@ -44,7 +44,7 @@ public class CommonEventWarnTask {
@Autowired
private TDeviceStatusMapper tDeviceStatusMapper;
@Scheduled(fixedRate = 60 * 1000)
@Scheduled(fixedRate = 1 * 60 * 1000)
public void pushEvenWarnData() {
try {
ConcurrentHashMap<String, CommonEventWarnWebSocketServer> evenWarnWebSocketMap = CommonEventWarnWebSocketServer.getEvenWarnWebSocketMap();
......
......@@ -38,22 +38,24 @@ public class SignalStatusTask {
return;
}
List<Map<String, Object>> content = (List<Map<String, Object>>) jsonViewObject.getContent();
Map<String, Object> result = content.get(0);
String signalId = (String) result.get("signalId");
Integer currentSignalStatus = result.get("status") == null ? 0 : (Integer) result.get("status");
Integer currentFaultType = result.get("faultType") == null ? 0 : (Integer) result.get("faultType");
content.forEach(map -> {
Map<String, Object> result = map;
String signalId = (String) result.get("signalId");
Integer currentSignalStatus = result.get("status") == null ? 0 : (Integer) result.get("status");
Integer currentFaultType = result.get("faultType") == null ? 0 : (Integer) result.get("faultType");
// 当前服务数据库状态
LambdaQueryWrapper<TDeviceStatusInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(signalId)) {
lambdaQueryWrapper.eq(TDeviceStatusInfo::getCode, signalId);
TDeviceStatusInfo tDeviceStatusInfo = tDeviceStatusMapper.selectOne(lambdaQueryWrapper);
if (isExucuteUpdate(currentSignalStatus, currentFaultType, tDeviceStatusInfo)) {
tDeviceStatusInfo.setStatus(currentSignalStatus);
tDeviceStatusInfo.setFaultType(currentFaultType);
tDeviceStatusMapper.updateById(tDeviceStatusInfo);
// 当前服务数据库状态
LambdaQueryWrapper<TDeviceStatusInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotEmpty(signalId)) {
lambdaQueryWrapper.eq(TDeviceStatusInfo::getCode, signalId);
TDeviceStatusInfo tDeviceStatusInfo = tDeviceStatusMapper.selectOne(lambdaQueryWrapper);
if (isExucuteUpdate(currentSignalStatus, currentFaultType, tDeviceStatusInfo)) {
tDeviceStatusInfo.setStatus(currentSignalStatus);
tDeviceStatusInfo.setFaultType(currentFaultType);
tDeviceStatusMapper.updateById(tDeviceStatusInfo);
}
}
}
});
} catch (Exception e) {
log.error("定时任务同步信号机设备状态远程utcService调用异常", e);
}
......
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