Commit 03350324 authored by duanruiming's avatar duanruiming

[add] AI路口干线优化

parent f145ee10
...@@ -202,6 +202,9 @@ public class TrendServiceImpl implements TrendService { ...@@ -202,6 +202,9 @@ public class TrendServiceImpl implements TrendService {
Integer greenId = entry.getKey(); Integer greenId = entry.getKey();
List<GreenwaveListVO> value = entry.getValue(); List<GreenwaveListVO> value = entry.getValue();
if (Objects.equals(1, value.size())) { if (Objects.equals(1, value.size())) {
value.forEach(vo -> {
vo.setType("单向绿波");
});
greenwaveListVOList.addAll(value); greenwaveListVOList.addAll(value);
} }
if (Objects.equals(2, value.size())) { if (Objects.equals(2, value.size())) {
...@@ -227,6 +230,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -227,6 +230,7 @@ public class TrendServiceImpl implements TrendService {
wDirVo.setStopTimes((int) (stopTimes / 2)); wDirVo.setStopTimes((int) (stopTimes / 2));
wDirVo.setTrafficIndex(trafficIndex / 2 < 1 ? 1 : trafficIndex / 2); wDirVo.setTrafficIndex(trafficIndex / 2 < 1 ? 1 : trafficIndex / 2);
wDirVo.setTravelTime(travelTime / 2); wDirVo.setTravelTime(travelTime / 2);
wDirVo.setType("双向绿波");
greenwaveListVOList.add(wDirVo); greenwaveListVOList.add(wDirVo);
} }
......
...@@ -7,8 +7,8 @@ import io.swagger.annotations.ApiResponses; ...@@ -7,8 +7,8 @@ import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity; import net.wanji.opt.synthesis.pojo.StrategyControlDataEntity;
import net.wanji.opt.synthesis.pojo.StrategyControlDetailList; import net.wanji.opt.synthesis.pojo.StrategyControlDetailList;
import net.wanji.opt.synthesis.pojo.vo.StrategyControlVO;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity; import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import net.wanji.opt.synthesis.pojo.vo.StrategyControlVO;
import net.wanji.opt.synthesis.service.StrategyControlService; import net.wanji.opt.synthesis.service.StrategyControlService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
...@@ -352,8 +352,7 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -352,8 +352,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
StrategyControlDataEntity result = new StrategyControlDataEntity(); StrategyControlDataEntity result = new StrategyControlDataEntity();
BeanUtils.copyProperties(entity, result); BeanUtils.copyProperties(entity, result);
String time = entity.getTime(); String time = entity.getTime();
List<StrategyControlDataVO.TimeTable> timeTables = instance.readValue(time, new TypeReference<List<StrategyControlDataVO.TimeTable>>() { List<StrategyControlDataVO.TimeTable> timeTables = instance.readValue(time, new TypeReference<List<StrategyControlDataVO.TimeTable>>() {});
});
for (StrategyControlDataVO.TimeTable timeTable : timeTables) { for (StrategyControlDataVO.TimeTable timeTable : timeTables) {
int currentWeek = DateUtil.thisDayOfWeek() - 1; int currentWeek = DateUtil.thisDayOfWeek() - 1;
String[] timeList = timeTable.getTimeList(); String[] timeList = timeTable.getTimeList();
...@@ -370,12 +369,13 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -370,12 +369,13 @@ public class StrategyControlServiceImpl implements StrategyControlService {
DateTime currentTime = DateUtil.parse(format, "HH:mm"); DateTime currentTime = DateUtil.parse(format, "HH:mm");
DateTime startHourDate = DateUtil.parse(startHour, "HH:mm"); DateTime startHourDate = DateUtil.parse(startHour, "HH:mm");
DateTime endHourDate = DateUtil.parse(entHour, "HH:mm"); DateTime endHourDate = DateUtil.parse(entHour, "HH:mm");
if (currentTime.after(startHourDate) && currentTime.before(endHourDate)) { if (currentTime.isAfter(startHourDate) && currentTime.isBefore(endHourDate)) {
result.setTime(hour); result.setTime(hour);
result.setStatus(1); result.setStatus(1);
} else { } else {
// 如果有调度策略在执行,设置为开启,否则关闭,提供前端过滤配置和未配置 // 如果有调度策略在执行,设置为开启,否则关闭,提供前端过滤配置和未配置
result.setStatus(0); result.setStatus(0);
result.setTime(null);
} }
} }
} }
......
...@@ -18,6 +18,8 @@ import java.util.List; ...@@ -18,6 +18,8 @@ import java.util.List;
public class GreenwaveListVO { public class GreenwaveListVO {
@ApiModelProperty(value = "绿波ID") @ApiModelProperty(value = "绿波ID")
private Integer id; private Integer id;
@ApiModelProperty(value = "绿波方向类型")
private String type;
@ApiModelProperty(value = "子区名称") @ApiModelProperty(value = "子区名称")
private String name; private String name;
@ApiModelProperty(value = "协调方式:0未开启;1相位差优化;2选择方案") @ApiModelProperty(value = "协调方式:0未开启;1相位差优化;2选择方案")
......
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