Commit eb95cab1 authored by zhouleilei's avatar zhouleilei

修改环图信息

parent 8570a381
......@@ -47,6 +47,7 @@ public class CrossSchemeRings {
* 相位列表
*/
private List<Phase> phaseList;
private List<OverLapPhase> overLapPhaseList;
@Data
public static class Phase{
......@@ -85,4 +86,12 @@ public class CrossSchemeRings {
}
@Data
public static class OverLapPhase{
private String direction;
private String includedPhases;
private String modifierPhases;
}
}
......@@ -127,7 +127,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
crossSchemeRingsDTO.setCrossId(crossId);
crossSchemeRingsDTO.setPattern(vNtcipPatternView.getNPatternNumber() + "");
//查询方案环图请求
CrossSchemeRings crossSchemeRings = crossSchemeRings(crossSchemeRingsDTO);
CrossSchemeRings crossSchemeRings = crossSchemeRingsHisen(crossSchemeRingsDTO);
if (Optional.ofNullable(crossSchemeRings).isPresent()) {
//环数
int ringCount = Integer.parseInt(crossSchemeRings.getRingCount());
......@@ -782,6 +782,86 @@ public class StaticInfoServiceImpl implements StaticInfoService {
}
messageContent.addElement(HttpConstants.PATTERN).setText(coordinationStatus.getCoordPatternStatus());
//给海信发送http请求
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
if (StringUtils.isBlank(post)) {
log.error("请求 5.15.根据方案号获取配时方案环图 失败");
return null;
}
Document postResult = DocumentHelper.parseText(post);
String result = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_RESULT).getText();
if (HttpConstants.RESULT_1.equals(result)) {
//成功
String patternRest = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("Pattern");
String cycleLen = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("CycleLen");
String ringCount = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("RingCount");
String offset = postResult.selectSingleNode(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT).valueOf("Offset");
List<Element> cycleElementList = postResult.selectNodes(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT + "/CycleList");
List<Element> phaseElementList = postResult.selectNodes(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT + "/PhaseList");
List<Element> overLapPhaseElementList = postResult.selectNodes(HttpConstants.SYSTEMSCRIPTION_MESSAGECONTENT + "/OverLapPhaseList");
CrossSchemeRings crossSchemeRings = new CrossSchemeRings();
crossSchemeRings.setSpot(crossSchemeRingsDTO.getCrossId());
crossSchemeRings.setPattern(patternRest);
crossSchemeRings.setRingCount(ringCount);
crossSchemeRings.setCycleLen(cycleLen);
crossSchemeRings.setOffset(offset);
JSONObject jsonObject = new JSONObject();
for (Element cycle : cycleElementList) {
List<Node> elements = cycle.elements();
for (Node node : elements) {
node.getName();
jsonObject.put(node.getName(), node.getText());
}
}
List<CrossSchemeRings.Phase> phaseList = new ArrayList<>();
for (Element el : phaseElementList) {
CrossSchemeRings.Phase phase = new CrossSchemeRings.Phase();
phase.setRedTime(el.valueOf("RedTime"));
phase.setYellowTime(el.valueOf("YellowTime"));
phase.setGreenTime(el.valueOf("GreenTime"));
phase.setDirection(el.valueOf("Direction"));
phase.setMinGTime(el.valueOf("MinGTime"));
phase.setMaxGTime(el.valueOf("MaxGTime"));
phase.setChannelDim(el.valueOf("ChannelDim"));
phase.setConcurrent(el.valueOf("Concurrent"));
phaseList.add(phase);
}
List<CrossSchemeRings.OverLapPhase> overLapPhaseList = new ArrayList<>();
for (Element el : overLapPhaseElementList) {
CrossSchemeRings.OverLapPhase overLapPhase = new CrossSchemeRings.OverLapPhase();
overLapPhase.setDirection(el.valueOf("Direction"));
overLapPhase.setIncludedPhases(el.valueOf("IncludedPhases"));
overLapPhase.setModifierPhases(el.valueOf("ModifierPhases"));
overLapPhaseList.add(overLapPhase);
}
crossSchemeRings.setCycleList(jsonObject);
crossSchemeRings.setPhaseList(phaseList);
crossSchemeRings.setOverLapPhaseList(overLapPhaseList);
return crossSchemeRings;
} else {
//失败
log.error("请求 5.15. 方案环图请求 失败");
}
return null;
}
/**
* @Description 获取环图请求原有的逻辑
* @Param [crossSchemeRingsDTO]
* @return net.wanji.utc.hisense.pojo.result.CrossSchemeRings
**/
public CrossSchemeRings crossSchemeRingsHisen(CrossSchemeRingsDTO crossSchemeRingsDTO) throws Exception {
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.PATTERN).setText(crossSchemeRingsDTO.getPattern());
//给海信发送http请求
String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
if (StringUtils.isBlank(post)) {
......
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