Commit 0771d199 authored by zhouleilei's avatar zhouleilei

海信-去掉测试数据

parent 6e1fb6a6
......@@ -70,37 +70,18 @@ public class ControlCommandServiceImpl implements ControlCommandService {
@Override
public JsonViewObject recoverSchedule(String code) throws Exception {
//TODO 暂时注释
// CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(tempSchemeSendVO.getCrossCode());
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(code);
//组装document
Document document = OperationBaseDom.generateBaseDoc();
Element element = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION);
element.addElement(HttpConstants.MESSAGETYPE).setText(HttpConstants.MESSAGETYPE_16);
Element messageContent = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT);
//TODO 暂时不处理
messageContent.addElement(HttpConstants.SPOT).setText(code);
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
//暂时按照神思的写死
messageContent.addElement(HttpConstants.PATTERN).setText("0");
//给海信发送http请求
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
" <isRequest>0</isRequest>\n" +
" <seq>20241103155205549244</seq>\n" +
" <needResponse>1</needResponse>\n" +
" <result>1</result>\n" +
" <flag>0</flag>\n" +
" <tStamp>1730691481618</tStamp>\n" +
" <messageContent>\n" +
" <Spot>882530</Spot>\n" +
" <CoordPatternStatus>22</CoordPatternStatus>\n" +
" <CoordCycleStatus>180</CoordCycleStatus>\n" +
" <CoordSyncStatus>79</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(post)) {
log.error("5.10. 手动方案控制- 恢复固定配时 失败");
......@@ -137,15 +118,13 @@ public class ControlCommandServiceImpl implements ControlCommandService {
@Override
public JsonViewObject tempSchemeDetail(TempSchemeSendVO tempSchemeSendVO) throws Exception {
//TODO 暂时注释
// CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(tempSchemeSendVO.getCrossCode());
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(tempSchemeSendVO.getCrossCode());
//组装document
Document document = OperationBaseDom.generateBaseDoc();
Element element = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION);
element.addElement(HttpConstants.MESSAGETYPE).setText(HttpConstants.MESSAGETYPE_39);
Element messageContent = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT);
//TODO 暂时不处理
messageContent.addElement(HttpConstants.SPOT).setText(tempSchemeSendVO.getCrossCode());
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.PATTERN).setText(tempSchemeSendVO.getPattern());
messageContent.addElement(HttpConstants.CYCLE).setText(tempSchemeSendVO.getCycle());
//暂时按照神思的写死
......@@ -154,24 +133,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
messageContent.addElement(HttpConstants.SPLIT).setText("40,0,0,40,50,50,0,0,0,0,0,0,0,0,0,0");
//给海信发送http请求
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
" <isRequest>0</isRequest>\n" +
" <seq>20241103155205549244</seq>\n" +
" <needResponse>1</needResponse>\n" +
" <result>1</result>\n" +
" <flag>0</flag>\n" +
" <tStamp>1730691481618</tStamp>\n" +
" <messageContent>\n" +
" <Spot>882530</Spot>\n" +
" <CoordPatternStatus>22</CoordPatternStatus>\n" +
" <CoordCycleStatus>180</CoordCycleStatus>\n" +
" <CoordSyncStatus>79</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(post)) {
log.error("HTTP请求 5.16. 方案优化控制 失败");
......@@ -198,39 +160,19 @@ public class ControlCommandServiceImpl implements ControlCommandService {
@Override
public JsonViewObject extendPhase(ExtendPhaseDTO extendPhaseDTO) throws Exception {
//TODO 暂时注释
// CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(extendPhaseDTO.getCrossId());
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(extendPhaseDTO.getCrossId());
//组装document
Document document = OperationBaseDom.generateBaseDoc();
Element element = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION);
element.addElement(HttpConstants.MESSAGETYPE).setText(HttpConstants.MESSAGETYPE_22);
Element messageContent = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT);
//TODO 暂时不处理
// messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.SPOT).setText(extendPhaseDTO.getCrossId());
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
//暂时按照神思的写死
messageContent.addElement(HttpConstants.COMMAND).setText("1");
messageContent.addElement(HttpConstants.CTRLSTEP).setText("0");
//给海信发送http请求
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
" <isRequest>0</isRequest>\n" +
" <seq>20241103155205549244</seq>\n" +
" <needResponse>1</needResponse>\n" +
" <result>1</result>\n" +
" <flag>0</flag>\n" +
" <tStamp>1730691481618</tStamp>\n" +
" <messageContent>\n" +
" <Spot>882530</Spot>\n" +
" <CoordPatternStatus>22</CoordPatternStatus>\n" +
" <CoordCycleStatus>180</CoordCycleStatus>\n" +
" <CoordSyncStatus>79</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(post)) {
log.error("HTTP请求 5.12. 步进及取消控制 失败");
......@@ -238,31 +180,13 @@ public class ControlCommandServiceImpl implements ControlCommandService {
}
Document postResult = DocumentHelper.parseText(post);
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
//解除步进
messageContent.selectSingleNode(HttpConstants.COMMAND).setText("0");
if (HttpConstants.RESULT_1.equals(result) || HttpConstants.RESULT_2.equals(result)) {
//执行成功,开始延长
Thread.sleep(extendPhaseDTO.getExtendTime() * 1000);
//给海信发送http请求
// String post1 = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
" <isRequest>0</isRequest>\n" +
" <seq>20241103155205549244</seq>\n" +
" <needResponse>1</needResponse>\n" +
" <result>1</result>\n" +
" <flag>0</flag>\n" +
" <tStamp>1730691481618</tStamp>\n" +
" <messageContent>\n" +
" <Spot>882530</Spot>\n" +
" <CoordPatternStatus>22</CoordPatternStatus>\n" +
" <CoordCycleStatus>180</CoordCycleStatus>\n" +
" <CoordSyncStatus>79</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
String post1 = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
if (StringUtils.isNotBlank(post1)) {
Document extendPost = DocumentHelper.parseText(post1);
String extendResult = extendPost.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
......@@ -308,24 +232,20 @@ public class ControlCommandServiceImpl implements ControlCommandService {
//默认步进1次
stepingPhaseDTO.setStepCount(1);
}
//TODO 暂时注释
// CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(stepingPhaseDTO.getCrossId());
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(stepingPhaseDTO.getCrossId());
//组装document
Document document = OperationBaseDom.generateBaseDoc();
Element element = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION);
element.addElement(HttpConstants.MESSAGETYPE).setText(HttpConstants.MESSAGETYPE_22);
Element messageContent = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT);
//TODO 暂时不处理
// messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.SPOT).setText(stepingPhaseDTO.getCrossId());
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
//暂时按照神思的写死
messageContent.addElement(HttpConstants.COMMAND).setText("1");
messageContent.addElement(HttpConstants.CTRLSTEP).setText("0");
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//TODO 真实逻辑,测试先去掉
//给海信发送http请求
/* for (int i = 0; i < stepingPhaseDTO.getStepCount(); i++) {
for (int i = 0; i < stepingPhaseDTO.getStepCount(); i++) {
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
if (StringUtils.isNotBlank(post)){
Document postResult = DocumentHelper.parseText(post);
......@@ -343,37 +263,6 @@ public class ControlCommandServiceImpl implements ControlCommandService {
return jsonViewObject.fail("相位步进失败,路口号: "+stepingPhaseDTO.getCrossId());
}
}*/
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
" <subSystem>Hisense</subSystem>\n" +
" <messageType>12</messageType>\n" +
" <isRequest>0</isRequest>\n" +
" <seq>20241103155205549244</seq>\n" +
" <needResponse>1</needResponse>\n" +
" <result>1</result>\n" +
" <flag>0</flag>\n" +
" <tStamp>1730691481618</tStamp>\n" +
" <messageContent>\n" +
" <Spot>882530</Spot>\n" +
" <CoordPatternStatus>22</CoordPatternStatus>\n" +
" <CoordCycleStatus>180</CoordCycleStatus>\n" +
" <CoordSyncStatus>79</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
if (StringUtils.isNotBlank(post)){
Document postResult = DocumentHelper.parseText(post);
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
if (HttpConstants.RESULT_1.equals(result) || HttpConstants.RESULT_2.equals(result)) {
log.info("路口号 :{},步进成功,result:{}", stepingPhaseDTO.getCrossId(), result);
jsonViewObject = jsonViewObject.success("相位步进 - 控制成功");
}else {
log.error("路口号 :{},步进失败,result:{}", stepingPhaseDTO.getCrossId(), result);
return jsonViewObject.fail("相位步进失败,路口号 : "+stepingPhaseDTO.getCrossId());
}
}else {
return jsonViewObject.fail("相位步进失败,路口号:"+ stepingPhaseDTO.getCrossId());
}
return jsonViewObject;
}
......
......@@ -103,53 +103,16 @@ public class StaticInfoServiceImpl implements StaticInfoService {
@Override
public CrossSchemeRings crossSchemeRings(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
//TODO 暂时注释
// CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(crossId);
CrossInfoPOExt crossInfoPOExt = crossInfoMapper.selectById(crossSchemeRingsDTO.getCrossId());
//组装document
Document document = OperationBaseDom.generateBaseDoc();
Element element = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION);
element.addElement(HttpConstants.MESSAGETYPE).setText(HttpConstants.MESSAGETYPE_30);
Element messageContent = (Element) document.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT);
// messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.SPOT).setText(crossSchemeRingsDTO.getCrossId());
messageContent.addElement(HttpConstants.SPOT).setText(crossInfoPOExt.getCode());
messageContent.addElement(HttpConstants.PATTERN).setText(crossSchemeRingsDTO.getPattern());
//给海信发送http请求
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
"<systemScription System=\"TCIP\" Version=\"1.0\">\n" +
"<subSystem>Hisense</subSystem>\n" +
"<messageType>30</messageType>\n" +
"<isRequest>0</isRequest>\n" +
"<seq>20190806160612000678</seq>\n" +
"<needResponse>0</needResponse>\n" +
"<result>1</result>\n" +
"<flag>0</flag>\n" +
"<tStamp>1567142534</tStamp>\n" +
"<messageContent>\n" +
"<Spot>102494</Spot>\n" +
"<Pattern>1</Pattern>\n" +
"<CycleLen>138</CycleLen>\n" +
"<RingCount>3</RingCount>\n" +
"<CycleList>\n" +
"<Cycle1>1 2 3 4_</Cycle1>\n" +
"<Cycle2>5 6 7 8_</Cycle2>\n" +
"<Cycle3>9 12 10 11_</Cycle3>\n" +
"</CycleList>\n" +
"<PhaseList>\n" +
"<RedTime>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</RedTime>\n" +
"<YellowTime>3 3 3 3 3 3 3 3 3 3 0 0 0 0 0 0</YellowTime>\n" +
"<GreenTime>32 25 22 47 37 20 50 19 52 64 8 8 0 0 0 0</GreenTime>\n" +
"<Direction>37 17 39 19 33 21 35 23 0 0 0 0 0 0 0 0</Direction>\n" +
"<MinGTime>14 10 14 14 14 1 14 10 14 5 8 8 0 0 0 0</MinGTime>\n" +
"<MaxGTime>60 60 60 60 60 60 60 60 60 60 60 60 0 0 0 0</MaxGTime>\n" +
"<ChannelDim>28066 33 2993634 97 60194 161 98 225 10707747 10707747 236 \n" +
"236 0 0 0 0</ChannelDim>\n" +
"<Concurrent>4080 4080 4080 4080 3855 3855 3855 3855 255 255 255 255 0 0 0 \n" +
"0</Concurrent>\n" +
"</PhaseList>\n" +
"</messageContent>\n" +
"</systemScription>";
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
if (StringUtils.isBlank(post)){
log.error("请求 5.15.根据方案号获取配时方案环图 失败");
return null;
......@@ -176,7 +139,6 @@ public class StaticInfoServiceImpl implements StaticInfoService {
for (Node node : elements) {
node.getName();
jsonObject.put(node.getName(), node.getText());
}
}
List<CrossSchemeRings.Phase> phaseList = new ArrayList<>();
......@@ -200,7 +162,6 @@ public class StaticInfoServiceImpl implements StaticInfoService {
//失败
log.error("请求 5.15. 方案环图请求 失败");
}
return null;
}
}
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