Commit 1f7be484 authored by duanruiming's avatar duanruiming

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

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