Commit 04b3bf1c authored by zhouleilei's avatar zhouleilei

海信-适配系统 步进控制-步进控制/恢复 功能

parent dcab4376
...@@ -75,30 +75,14 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -75,30 +75,14 @@ public class ControlCommandServiceImpl implements ControlCommandService {
stepNum = 0; stepNum = 0;
} }
JsonViewObject jsonViewObject = JsonViewObject.newInstance(); JsonViewObject jsonViewObject = JsonViewObject.newInstance();
//给海信发送http请求 //给海信发送http请求
for (int i = 0; i < stepNum; i++) { for (int i = 0; i < stepNum; i++) {
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML()); 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>16</messageType>\n" +
" <isRequest>1</isRequest>\n" +
" <seq>{formatted_time}</seq>\n" +
" <needResponse>1</needResponse> \n" +
" <result>1</result>\n" +
" <flag>0</flag>\n" +
" <messageContent>\n" +
" <Spot>{crossId}</Spot>\n" +
" <Pattern>0</Pattern>\n" +
" </messageContent>\n" +
" </systemScription>";
if (StringUtils.isNotBlank(post)) { if (StringUtils.isNotBlank(post)) {
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();
if (HttpConstants.RESULT_1.equals(result) || HttpConstants.RESULT_2.equals(result)) { if (HttpConstants.RESULT_1.equals(result) || HttpConstants.RESULT_2.equals(result)) {
log.info("路口号 :{},第 {} 次步进成功,result:{}", crossInfoPOExt.getCode(), i + 1, result); log.info("路口号 :{},第 {} 次步进成功,result:{}", crossInfoPOExt.getCode(), i + 1, result);
jsonViewObject = jsonViewObject.success("相位步进 - 控制成功");
} else { } else {
log.error("路口号 :{},第 {} 次步进失败,result:{}", crossInfoPOExt.getCode(), i + 1, result); log.error("路口号 :{},第 {} 次步进失败,result:{}", crossInfoPOExt.getCode(), i + 1, result);
return jsonViewObject.fail("相位步进失败,路口号:" + crossInfoPOExt.getCode()); return jsonViewObject.fail("相位步进失败,路口号:" + crossInfoPOExt.getCode());
...@@ -108,9 +92,8 @@ public class ControlCommandServiceImpl implements ControlCommandService { ...@@ -108,9 +92,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
} else { } else {
return jsonViewObject.fail("相位步进失败,路口号: " + crossInfoPOExt.getCode()); return jsonViewObject.fail("相位步进失败,路口号: " + crossInfoPOExt.getCode());
} }
} }
return jsonViewObject; return jsonViewObject.success("相位步进 - 控制成功");
} }
@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