Commit 65991591 authored by duanruiming's avatar duanruiming

[add] 绿波策略列表优化,添加周期状态

parent e13aa51d
...@@ -17,16 +17,14 @@ import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper; ...@@ -17,16 +17,14 @@ import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.dao.mapper.GreenwaveInfoMapper; import net.wanji.databus.dao.mapper.GreenwaveInfoMapper;
import net.wanji.databus.po.BaseCrossInfoPO; import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.databus.vo.AbnormalCrossListVO; import net.wanji.databus.vo.AbnormalCrossListVO;
import net.wanji.databus.vo.GreenwaveListVO;
import net.wanji.opt.cache.BaseCrossInfoCache; import net.wanji.opt.cache.BaseCrossInfoCache;
import net.wanji.opt.cache.GreenWaveInfoCache; import net.wanji.opt.cache.GreenWaveInfoCache;
import net.wanji.opt.common.enums.EventStatusEnum;
import net.wanji.opt.common.enums.GreenBeltDirEnum; import net.wanji.opt.common.enums.GreenBeltDirEnum;
import net.wanji.opt.common.enums.StrategyControlEnum; import net.wanji.opt.common.enums.StrategyControlEnum;
import net.wanji.opt.dao.mapper.*; import net.wanji.opt.dao.mapper.*;
import net.wanji.opt.dto.StrategyOptCountDTO;
import net.wanji.opt.dto.StrategyOptTimesDTO; import net.wanji.opt.dto.StrategyOptTimesDTO;
import net.wanji.opt.po.StrategyGreenOptHistEntity; import net.wanji.opt.po.StrategyGreenOptHistEntity;
import net.wanji.opt.po.trend.HoloEventInfoPO;
import net.wanji.opt.synthesis.enums.StrategyCrossAlgoEnum; import net.wanji.opt.synthesis.enums.StrategyCrossAlgoEnum;
import net.wanji.opt.synthesis.pojo.*; import net.wanji.opt.synthesis.pojo.*;
import net.wanji.opt.synthesis.pojo.vo.*; import net.wanji.opt.synthesis.pojo.vo.*;
...@@ -358,24 +356,33 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -358,24 +356,33 @@ public class StrategyControlServiceImpl implements StrategyControlService {
} }
} // 干线 } // 干线
if (Objects.equals(1, type)) { if (Objects.equals(1, type)) {
List<GreenwaveInfoPO> greenwaveInfoPOS = greenwaveInfoMapper.selectAll(); List<GreenwaveListVO> greenwaveListVOS = greenwaveInfoMapper.listGreenwave(null, null, null);
if (!CollectionUtils.isEmpty(greenwaveInfoPOS)) { Map<Integer, Optional<GreenwaveListVO>> groupMap = greenwaveListVOS.stream().collect(Collectors.groupingBy(GreenwaveListVO::getId, Collectors.maxBy(Comparator.comparingInt(GreenwaveListVO::getRealtimeStatus))));
for (GreenwaveInfoPO greenwaveInfoPO : greenwaveInfoPOS) { String currenGreenId = null;
StrategyControlDataEntity strategyControlDataEntity = new StrategyControlDataEntity(); Integer currentStatus = 0;
String greenId = String.valueOf(greenwaveInfoPO.getId()); for (Map.Entry<Integer, Optional<GreenwaveListVO>> entry : groupMap.entrySet()) {
strategyControlDataEntity.setBizType(1);
strategyControlDataEntity.setBizId(String.valueOf(greenId)); Optional<GreenwaveListVO> value = entry.getValue();
strategyControlDataEntity.setStrategy(8); GreenwaveListVO greenwaveListVO = value.get();
strategyControlDataEntity.setTime(null); String greenId = String.valueOf(entry.getKey());
strategyControlDataEntity.setStatus(0); StrategyControlDataEntity strategyControlDataEntity = new StrategyControlDataEntity();
if (map.containsKey(greenId)) { Integer status = greenwaveListVO.getRealtimeStatus();
strategyControlDataEntity = map.get(greenId); if (map.containsKey(greenId)) {
} strategyControlDataEntity = map.get(greenId);
strategyControlDataEntity.setCrossName(greenwaveInfoPO.getName()); }
strategyControlDataEntity.setWkt(greenwaveInfoPO.getWkt()); strategyControlDataEntity.setStatus(status);
strategyControlDataEntity.setOptMethod("效率提升"); if (StringUtils.equals(greenId, currenGreenId) && status > currentStatus) {
results.add(strategyControlDataEntity); strategyControlDataEntity.setStatus(greenwaveListVO.getRealtimeStatus());
} }
strategyControlDataEntity.setBizType(1);
strategyControlDataEntity.setBizId(String.valueOf(greenId));
strategyControlDataEntity.setStrategy(8);
strategyControlDataEntity.setCrossName(greenwaveListVO.getName());
strategyControlDataEntity.setWkt(greenwaveListVO.getWkt());
strategyControlDataEntity.setOptMethod("效率提升");
results.add(strategyControlDataEntity);
currenGreenId = greenId;
currentStatus = status;
} }
} }
return JsonViewObject.newInstance().success(results); return JsonViewObject.newInstance().success(results);
...@@ -386,7 +393,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -386,7 +393,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
} }
@Override @Override
public JsonViewObject strategyOptTimes() throws Exception { public JsonViewObject strategyOptTimes() throws Exception {
String timeUrl = "http://37.12.182.29:15020/decisionPage/MonitorStrategyOptimizationInfo/getData"; String timeUrl = "http://37.12.182.29:15020/decisionPage/MonitorStrategyOptimizationInfo/getData";
String timeResult = OkHttpClientUtil.get(timeUrl); String timeResult = OkHttpClientUtil.get(timeUrl);
ObjectMapper mapper = JacksonUtils.getInstance(); ObjectMapper mapper = JacksonUtils.getInstance();
...@@ -499,10 +506,10 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -499,10 +506,10 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Integer controlMethod = entity.getControlMethod(); Integer controlMethod = entity.getControlMethod();
if (Objects.equals(-1, controlMethod)) { if (Objects.equals(-1, controlMethod)) {
ext.setStatus(0); ext.setStatus(0);
ext.setOptStatus("优化中"); ext.setOptStatus("未优化");
} else { } else {
ext.setStatus(1); ext.setStatus(1);
ext.setOptStatus("未优化"); ext.setOptStatus("优化中");
} }
Map<Integer, GreenwaveInfoPO> greenWaveMap = GreenWaveInfoCache.greenWaveMap; Map<Integer, GreenwaveInfoPO> greenWaveMap = GreenWaveInfoCache.greenWaveMap;
GreenwaveInfoPO greenwaveInfoPO = greenWaveMap.get(greenId); GreenwaveInfoPO greenwaveInfoPO = greenWaveMap.get(greenId);
......
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