Commit 1f7be484 authored by duanruiming's avatar duanruiming

[add] 信控控制指令日志;排查锁定问题

parent 018866b7
...@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service; ...@@ -33,6 +33,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -235,9 +236,9 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -235,9 +236,9 @@ public class ControlCommandServiceImpl implements ControlCommandService {
// boolean isOk = true; // boolean isOk = true;
if (isOk) { if (isOk) {
return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,取消步进成功,路口号: " + code); return jsonViewObject.fail("第 "+ (i+1) +" 次相位步进失败,取消步进成功,路口号: " + code);
} else { } else {
return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,取消步进失败,路口号: " + code); return jsonViewObject.fail("第 "+ (i+1) +" 次相位步进失败,取消步进失败,路口号: " + code);
} }
} }
//停顿10ms //停顿10ms
...@@ -252,9 +253,9 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -252,9 +253,9 @@ public class ControlCommandServiceImpl implements ControlCommandService {
// boolean isOk = true; // boolean isOk = true;
if (isOk) { if (isOk) {
return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,但取消步进成功,路口号: " + code); return jsonViewObject.fail("第 "+(i+1)+" 次相位步进失败,但取消步进成功,路口号: " + code);
} else { } else {
return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,取消步进失败,路口号: " + code); return jsonViewObject.fail("第 "+(i+1)+" 次相位步进失败,取消步进失败,路口号: " + code);
} }
} }
......
...@@ -52,26 +52,32 @@ public class CommandFaildTask { ...@@ -52,26 +52,32 @@ public class CommandFaildTask {
@Scheduled(cron = "0/5 * * * * ?") @Scheduled(cron = "0/5 * * * * ?")
public void commandFaildTask() throws Exception { public void commandFaildTask() throws Exception {
LambdaQueryWrapper<SignalCommandPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); try {
lambdaQueryWrapper.eq(SignalCommandPO::getCommandResult, 2); LambdaQueryWrapper<SignalCommandPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
List<SignalCommandPO> crossInfoPOList = signalCommandPOMapper.selectList(lambdaQueryWrapper); lambdaQueryWrapper.eq(SignalCommandPO::getCommandResult, 2);
log.info("定时任务恢复控制指令,需要执行恢复路口集合crossInfoPOList = {}", crossInfoPOList); List<SignalCommandPO> crossInfoPOList = signalCommandPOMapper.selectList(lambdaQueryWrapper);
if (ObjectUtil.isNotEmpty(crossInfoPOList)) { log.info("定时任务恢复控制指令,需要执行恢复路口集合size:{}, crossInfoPOList = {}", crossInfoPOList.size(), crossInfoPOList);
for (SignalCommandPO signalCommandPO : crossInfoPOList) { if (ObjectUtil.isNotEmpty(crossInfoPOList)) {
String crossId = signalCommandPO.getCrossId(); for (SignalCommandPO signalCommandPO : crossInfoPOList) {
Integer commandType = signalCommandPO.getCommandType(); String crossId = signalCommandPO.getCrossId();
Integer updateCount = signalCommandPO.getUpdateCount(); Integer commandType = signalCommandPO.getCommandType();
if (ObjectUtil.isNull(updateCount)) { Integer updateCount = signalCommandPO.getUpdateCount();
updateCount = 0; if (ObjectUtil.isNull(updateCount)) {
} updateCount = 0;
try { }
log.info("定时任务自动恢复开始执行(不保证恢复成功),crossId={},commandType={},updateCount={}", crossId, commandType, updateCount); try {
//处理数据 log.info("定时任务自动恢复开始执行(不保证恢复成功),crossId={},commandType={},updateCount={}", crossId, commandType, updateCount);
handlerCommand(crossId, commandType, updateCount); //处理数据
} catch (Exception e) { handlerCommand(crossId, commandType, updateCount);
log.error("定时任务自动恢复报错,crossId={},commandType={},updateCount={}", crossId, commandType, updateCount); } catch (Exception e) {
log.error("定时任务自动恢复报错,crossId={},commandType={},updateCount={}", crossId, commandType, updateCount);
throw new Exception(e);
}
} }
} }
} catch (Exception e) {
log.error("commandFaildTask定时任务执行异常:", e);
throw new RuntimeException(e);
} }
} }
...@@ -254,6 +260,8 @@ public class CommandFaildTask { ...@@ -254,6 +260,8 @@ public class CommandFaildTask {
}else { }else {
log.info("定时任务 更新t_signal_command失败,crossId = {},commandType = {},time = {},update = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),update); log.info("定时任务 更新t_signal_command失败,crossId = {},commandType = {},time = {},update = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),update);
} }
List<SignalCommandPO> signalCommandPOS = signalCommandPOMapper.selectList(lambdaQueryWrapper);
log.error("定时任务 更新t_signal_command成功,数据库中查询结果集:{}", signalCommandPOS);
} }
} }
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