Commit af2428c0 authored by zhouleilei's avatar zhouleilei

控制指令新增日志

parent 87055487
...@@ -300,6 +300,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -300,6 +300,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ip = IpAddressUtil.getIpAddress(request); String ip = IpAddressUtil.getIpAddress(request);
signalCommandLogPO.setIp(ip); signalCommandLogPO.setIp(ip);
log.info("服务器请求返回 信息jsonViewObject:{}",jsonViewObject);
int commandResult = 0; int commandResult = 0;
if (code == 200){ if (code == 200){
commandResult = 1; commandResult = 1;
...@@ -322,7 +323,12 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -322,7 +323,12 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
signalCommandLogPO.setLampTime(lampTime); signalCommandLogPO.setLampTime(lampTime);
} }
} }
signalCommandLogPOMapper.insert(signalCommandLogPO); int insert = signalCommandLogPOMapper.insert(signalCommandLogPO);
if (insert > 0) {
log.info("定时任务 插入t_signal_command_log成功,crossId = {},commandType = {},time = {},insert = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),insert);
}else {
log.info("定时任务 插入t_signal_command_log失败,crossId = {},commandType = {},time = {},insert = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),insert);
}
//排除查询环图接口 //排除查询环图接口
if (commandType != 10){ if (commandType != 10){
LambdaQueryWrapper<SignalCommandPO> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SignalCommandPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
...@@ -332,7 +338,12 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -332,7 +338,12 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
//插入 //插入
SignalCommandPO signalCommandPO = new SignalCommandPO(); SignalCommandPO signalCommandPO = new SignalCommandPO();
BeanUtil.copyProperties(signalCommandLogPO,signalCommandPO); BeanUtil.copyProperties(signalCommandLogPO,signalCommandPO);
signalCommandPOMapper.insert(signalCommandPO); int insert1 = signalCommandPOMapper.insert(signalCommandPO);
if (insert1 > 0) {
log.info("定时任务 插入t_signal_command成功,crossId = {},commandType = {},time = {},insert = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),insert1);
}else {
log.info("定时任务 插入t_signal_command失败,crossId = {},commandType = {},time = {},insert = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),insert1);
}
}else { }else {
//更新 //更新
SignalCommandPO signalCommandPO = signalCommandPOS.get(0); SignalCommandPO signalCommandPO = signalCommandPOS.get(0);
...@@ -343,7 +354,12 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -343,7 +354,12 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
signalCommandPO.setIp(ip); signalCommandPO.setIp(ip);
signalCommandPO.setQueryTime(queryTime); signalCommandPO.setQueryTime(queryTime);
signalCommandPO.setUpdateCount(0); signalCommandPO.setUpdateCount(0);
signalCommandPOMapper.update(signalCommandPO,lambdaQueryWrapper); int update = signalCommandPOMapper.update(signalCommandPO, lambdaQueryWrapper);
if (update > 0) {
log.info("定时任务 更新t_signal_command成功,crossId = {},commandType = {},time = {},update = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),update);
}else {
log.info("定时任务 更新t_signal_command失败,crossId = {},commandType = {},time = {},update = {}", jsonObject.getString("crossId"), commandType, LocalDateTimeUtil.formatNow(LocalDateTimeUtil.TIMEFORMATTER),update);
}
} }
} }
} }
...@@ -367,11 +383,15 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -367,11 +383,15 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
if (StringUtils.isBlank(crossId)) { if (StringUtils.isBlank(crossId)) {
return jsonViewObject.fail("路口编号不能为空"); return jsonViewObject.fail("路口编号不能为空");
} }
String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossId); try {
if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) { String manufacturerIdCode = crossInfoCache.getManufacturerCodeByCrossId(crossId);
jsonViewObject = hkControlCommandService.recoverSchedule(crossId); if (StringUtils.equals(BasicEnum.ManufacturerEnum.HK.getCode(), manufacturerIdCode)) {
} else { jsonViewObject = hkControlCommandService.recoverSchedule(crossId);
jsonViewObject = wanJiControlCommandService.recoverSchedule(crossId); } else {
jsonViewObject = wanJiControlCommandService.recoverSchedule(crossId);
}
} catch (Exception e) {
jsonViewObject = JsonViewObject.newInstance().fail(e.getMessage());
} }
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("crossId",crossId); jsonObject.put("crossId",crossId);
......
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