Commit 047af0fc authored by zhouleilei's avatar zhouleilei

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

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