Commit 44b1bd2b authored by zhouleilei's avatar zhouleilei

步进/取消步进、锁相/解锁、恢复固定配置、临时方案下发等下发失败时,后台恢复

parent c6314d4e
...@@ -123,7 +123,7 @@ public class StaticInfoController { ...@@ -123,7 +123,7 @@ public class StaticInfoController {
if (ObjectUtils.isNotEmpty(crossSchemeRings)) { if (ObjectUtils.isNotEmpty(crossSchemeRings)) {
return JsonViewObject.newInstance().success(crossSchemeRings); return JsonViewObject.newInstance().success(crossSchemeRings);
} else { } else {
return JsonViewObject.newInstance().fail("获取方案环图请求 失败"); return JsonViewObject.newInstance().fail("请求海信 方案环图请求 失败");
} }
} }
......
...@@ -93,6 +93,7 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -93,6 +93,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
} }
//相位驻留 //相位驻留
String xmlPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML()); String xmlPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
log.info("第一次锁相/解锁 海信返回msg:{}",xmlPost);
/*String xmlPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + /*String xmlPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" + "<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" + " <subSystem>Hisense</subSystem>\n" +
...@@ -118,14 +119,21 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -118,14 +119,21 @@ public class ControlCommandServiceImpl implements ControlCommandService {
Integer duration = commandVO.getDuration(); Integer duration = commandVO.getDuration();
Thread.sleep(duration * 1000); Thread.sleep(duration * 1000);
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0"); messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML()); boolean isOk = sendMesIsOk(document.asXML());
if (isOk) {
return jsonViewObject.success("相位锁定/解锁 - 控制成功" );
} else {
return jsonViewObject.fail("相位锁定/解锁 - 控制失败 - 相位锁定成功,但解锁失败 ");
}
} }
return jsonViewObject.success("相位锁定/解锁 - 控制成功"); return jsonViewObject.success("相位锁定/解锁 - 控制成功");
} else { } else {
return jsonViewObject.fail("相位锁定/解锁 - 控制失败"); return jsonViewObject.fail("相位锁定/解锁 - 控制失败 - 第一次给海信下发指令失败");
} }
}else {
return jsonViewObject.fail("相位锁定/解锁 - 控制失败 - 第一次给海信下发指令失败");
} }
return jsonViewObject.fail("相位锁定/解锁 - 控制失败"); // return jsonViewObject.fail("相位锁定/解锁 - 控制失败");
} }
@Override @Override
...@@ -163,7 +171,7 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -163,7 +171,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
String xmlPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML()); String xmlPost = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
log.info("相位驻留 耗时: {} ms", end - start); log.info("相位驻留 耗时: {} ms,msg:{}", end - start,xmlPost);
/*String xmlPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + /*String xmlPost = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" + "<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" + " <subSystem>Hisense</subSystem>\n" +
...@@ -192,7 +200,7 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -192,7 +200,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML()); String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
long e = System.currentTimeMillis(); long e = System.currentTimeMillis();
log.info("相位步进 耗时: {} ms", e - s); log.info("相位步进 耗时: {} ms,msg:{}", e - s,post);
/*String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + /*String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" + "<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" + " <subSystem>Hisense</subSystem>\n" +
...@@ -227,9 +235,9 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -227,9 +235,9 @@ public class ControlCommandServiceImpl implements ControlCommandService {
// boolean isOk = true; // boolean isOk = true;
if (isOk) { if (isOk) {
return jsonViewObject.fail("相位步进失败,取消步进成功,路口号: " + code); return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,取消步进成功,路口号: " + code);
} else { } else {
return jsonViewObject.fail("相位步进失败,取消步进失败,路口号: " + code); return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,取消步进失败,路口号: " + code);
} }
} }
//停顿10ms //停顿10ms
...@@ -240,13 +248,13 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -240,13 +248,13 @@ public class ControlCommandServiceImpl implements ControlCommandService {
long s1 = System.currentTimeMillis(); long s1 = System.currentTimeMillis();
boolean isOk = sendMesIsOk(document.asXML()); boolean isOk = sendMesIsOk(document.asXML());
long e1 = System.currentTimeMillis(); long e1 = System.currentTimeMillis();
log.info("取消 相位步进 耗时: {} ms", e1 - s1); log.info("取消 相位步进 耗时: {} ms,isOK:{}", e1 - s1,isOk);
// boolean isOk = true; // boolean isOk = true;
if (isOk) { if (isOk) {
return jsonViewObject.fail("相位步进失败,取消步进成功,路口号: " + code); return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,但取消步进成功,路口号: " + code);
} else { } else {
return jsonViewObject.fail("相位步进失败,取消步进失败,路口号: " + code); return jsonViewObject.fail("第 "+i+1+" 次相位步进失败,取消步进失败,路口号: " + code);
} }
} }
...@@ -256,20 +264,22 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -256,20 +264,22 @@ public class ControlCommandServiceImpl implements ControlCommandService {
long s1 = System.currentTimeMillis(); long s1 = System.currentTimeMillis();
boolean isOk = sendMesIsOk(document.asXML()); boolean isOk = sendMesIsOk(document.asXML());
long e1 = System.currentTimeMillis(); long e1 = System.currentTimeMillis();
log.info("取消 相位步进 耗时: {} ms", e1 - s1); log.info("取消 相位步进 耗时: {} ms,isOK:{}", e1 - s1,isOk);
// boolean isOk = true; // boolean isOk = true;
if (isOk) { if (isOk) {
return jsonViewObject.success("相位步进成功,路口号: " + code); return jsonViewObject.success("相位步进成功,路口号: " + code);
} else { } else {
return jsonViewObject.fail("相位步进成功,但取消步进失败,路口号: " + code); return jsonViewObject.fail("相位步进成功,但取消步进失败,路口号: " + code);
} }
}else {
return jsonViewObject.fail("相位步进 - 控制失败 - 相位驻留失败");
} }
} else { } else {
return jsonViewObject.fail("相位步进 - 控制失败"); return jsonViewObject.fail("相位步进 - 控制失败 - 相位驻留失败");
} }
} }
return jsonViewObject.fail("相位步进 - 控制失败"); return jsonViewObject.fail("相位步进 - 控制失败 - 第一次请求海信接口报错");
} }
...@@ -420,8 +430,8 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -420,8 +430,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
"</systemScription>";*/ "</systemScription>";*/
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(post)) { if (StringUtils.isBlank(post)) {
log.error("5.10. 手动方案控制- 恢复固定配时 失败"); log.error(" 手动方案控制- 恢复固定配时 失败");
return jsonViewObject.fail("5.10. 手动方案控制- 恢复固定配时 失败"); return jsonViewObject.fail(" 手动方案控制- 恢复固定配时 失败");
} }
Document postResult = DocumentHelper.parseText(post); Document postResult = DocumentHelper.parseText(post);
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText(); String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
......
...@@ -821,7 +821,7 @@ public class StaticInfoServiceImpl implements StaticInfoService { ...@@ -821,7 +821,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
//给海信发送http请求 //给海信发送http请求
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML()); String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
if (StringUtils.isBlank(post)) { if (StringUtils.isBlank(post)) {
log.error("请求 5.15.根据方案号获取配时方案环图 失败"); log.error("请求 5.15.根据方案号获取配时方案环图 失败,");
return null; return null;
} }
Document postResult = DocumentHelper.parseText(post); Document postResult = DocumentHelper.parseText(post);
......
package net.wanji.utc.service.control.impl; package net.wanji.utc.service.control.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
...@@ -65,6 +67,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -65,6 +67,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
private final CrossLightsMapper crossLightsMapper; private final CrossLightsMapper crossLightsMapper;
private final CrossPhaseLightsMapper crossPhaseLightsMapper; private final CrossPhaseLightsMapper crossPhaseLightsMapper;
private final SignalCommandLogPOMapper signalCommandLogPOMapper; private final SignalCommandLogPOMapper signalCommandLogPOMapper;
private final SignalCommandPOMapper signalCommandPOMapper;
private final CrossPhaseDirTurnCache crossPhaseDirTurnCache; private final CrossPhaseDirTurnCache crossPhaseDirTurnCache;
private final CrossSchemePhaseTimeCountCache crossSchemePhaseTimeCountCache; private final CrossSchemePhaseTimeCountCache crossSchemePhaseTimeCountCache;
...@@ -287,7 +290,6 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -287,7 +290,6 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
* @Param jsonObject 参数 * @Param jsonObject 参数
* @return void * @return void
**/ **/
public void insertCommandLog(String queryTime,JsonViewObject jsonViewObject, JSONObject jsonObject,int commandType){ public void insertCommandLog(String queryTime,JsonViewObject jsonViewObject, JSONObject jsonObject,int commandType){
SignalCommandLogPO signalCommandLogPO = new SignalCommandLogPO(); SignalCommandLogPO signalCommandLogPO = new SignalCommandLogPO();
signalCommandLogPO.setCrossId(jsonObject.getString("crossId")); signalCommandLogPO.setCrossId(jsonObject.getString("crossId"));
...@@ -313,12 +315,21 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy ...@@ -313,12 +315,21 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
String runMode = lightsStatusVO2.getRunMode(); String runMode = lightsStatusVO2.getRunMode();
String lampTime = lightsStatusVO2.getTimeStamp(); String lampTime = lightsStatusVO2.getTimeStamp();
//时间转换 //时间转换
lampTime = LocalDateTimeUtil.formatTimeStamp(Long.valueOf(lampTime), LocalDateTimeUtil.TIMEFORMATTER); // lampTime = LocalDateTimeUtil.formatTimeStamp(Long.valueOf(lampTime), LocalDateTimeUtil.TIMEFORMATTER);
signalCommandLogPO.setRunMode(runMode); signalCommandLogPO.setRunMode(runMode);
signalCommandLogPO.setLampTime(lampTime); signalCommandLogPO.setLampTime(lampTime);
} }
} }
signalCommandLogPOMapper.insert(signalCommandLogPO); signalCommandLogPOMapper.insert(signalCommandLogPO);
//排除查询环图接口
if (commandType != 10){
LambdaQueryWrapper<SignalCommandPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SignalCommandPO::getCrossId,jsonObject.getString("crossId"));
signalCommandPOMapper.delete(lambdaQueryWrapper);
SignalCommandPO signalCommandPO = new SignalCommandPO();
BeanUtil.copyProperties(signalCommandLogPO,signalCommandPO);
signalCommandPOMapper.insert(signalCommandPO);
}
} }
@Override @Override
......
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