Commit 047af0fc authored by zhouleilei's avatar zhouleilei

临时方案下发,发送海信信号机

parent f4e905a2
......@@ -32,10 +32,10 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* @author duanruiming
......@@ -319,8 +319,8 @@ public class ControlCommandServiceImpl implements ControlCommandService {
messageContent.addElement(HttpConstants.SPLIT).setText(tempSchemeSendVO.getSplit());
//给海信发送http请求
// String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String post = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
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" +
......@@ -336,7 +336,7 @@ public class ControlCommandServiceImpl implements ControlCommandService {
" <CoordCycleStatus>160</CoordCycleStatus>\n" +
" <CoordSyncStatus>123</CoordSyncStatus>\n" +
" </messageContent>\n" +
"</systemScription>";
"</systemScription>";*/
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
if (StringUtils.isBlank(post)) {
log.error("HTTP请求 5.16. 方案优化控制 失败");
......@@ -435,11 +435,16 @@ public class ControlCommandServiceImpl implements ControlCommandService {
crossSchemeStageOptLogPO.setDataInfo(JSONObject.toJSONString(tempSchemeSendVO));
crossSchemeStageOptLogPO.setBatchTime(currentTimeMillis);
List<RingPhaseDTO> ringPhaseList = stagePhaseDTO.getRingPhaseList();
List<Integer> list = ringPhaseList.stream().map(RingPhaseDTO::getPhaseId).collect(Collectors.toList());
String phases = CollectionUtil.join(list,",");
crossSchemeStageOptLogPO.setPhaseList(phases);
List<Integer> list = new ArrayList<>();
for (RingPhaseDTO ringPhaseDTO : ringPhaseList) {
if (ObjectUtil.isNotEmpty(ringPhaseDTO)) {
list.add(ringPhaseDTO.getPhaseId());
}
}
if (ObjectUtil.isNotEmpty(list)) {
String phases = CollectionUtil.join(list, ",");
crossSchemeStageOptLogPO.setPhaseList(phases);
}
crossSchemeStageOptLogMapper.insert(crossSchemeStageOptLogPO);
}
} else {
......
......@@ -300,12 +300,12 @@ public class StaticInfoServiceImpl implements StaticInfoService {
//状态最后一次出现的1的下一个相位
int index = ringPhaseDTOS.lastIndexOf(phaseDTO) + 1;
RingPhaseDTO ringPhaseDTO = null;
/*if (index >= ringPhaseDTOS.size()) {
if (index >= ringPhaseDTOS.size()) {
firstRingPhaseDTO = ringPhaseDTOS.get(ringPhaseDTOS.size() - 1);
int phaseTime = cycle - stageTime;
firstPhaseTime = phaseTime;
minStageMap.put(i, index - 1);
} else {*/
} else {
ringPhaseDTO = ringPhaseDTOS.get(index);
//计算该相位及走过的所有时间
int totalTime = ringPhaseDTOS.stream().filter(x -> ringPhaseDTOS.indexOf(x) <= index).mapToInt(RingPhaseDTO::getPhaseTime).sum();
......@@ -326,7 +326,7 @@ public class StaticInfoServiceImpl implements StaticInfoService {
minStageMap.put(i, index);
}
}
// }
}
stageList.add(ringPhaseDTO);
} else {
......
......@@ -32,7 +32,7 @@ public class TempSchemeSendVO {
@NotBlank(message = "offset不能为空")
private String offset;
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=1 时为协调模式,Type=15(瓶颈模式,按比例调整)")
@ApiModelProperty(value = "优化模式", notes = "目前支持 Type=1(预案模式,按时间调整),Type=9 时为协调模式,Type=15(瓶颈模式,按比例调整)")
@NotBlank(message = "type不能为空")
private String type;
......
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