Commit f6fed476 authored by duanruiming's avatar duanruiming

[add] 路网优化检测AI优化历史优化

parent 074627fc
...@@ -28,7 +28,7 @@ public class GreenBeltController { ...@@ -28,7 +28,7 @@ public class GreenBeltController {
@Resource @Resource
private GreenBeltInfoService greenBeltInfoService; private GreenBeltInfoService greenBeltInfoService;
@ApiOperation(value = "绿波协调方向流量停车次数", notes = "绿波协调方向流量停车次数", response = JsonViewObject.class, @ApiOperation(value = "绿波协调方向路口流量停车次数", notes = "绿波协调方向路口流量停车次数", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/greenBeltCrossDetailHist") @GetMapping(value = "/greenBeltCrossDetailHist")
@ApiResponses({ @ApiResponses({
......
...@@ -31,15 +31,10 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService { ...@@ -31,15 +31,10 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
@Override @Override
public List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) { public List<GreenBeltFlowStopTimeVO> greenBeltCrossDetailHist(Integer greenId) {
List<String> crossIds = greenwaveInfoMapper.selectCrossIdsById(greenId); List<String> crossIds = greenwaveInfoMapper.selectCrossIdsById(greenId);
LocalDate currentDate = LocalDate.now(); long currentTimeMillis = System.currentTimeMillis();
LocalTime startTime = LocalTime.MIDNIGHT; // 00:00 int startSecond = (int) (currentTimeMillis / 1000 - 3600);
LocalDateTime startOfDay = LocalDateTime.of(currentDate, startTime); int endSecond = (int) (currentTimeMillis / 1000);
LocalDate nextDate = currentDate.plusDays(1); List<CrossDataHistPO> crossDataHistPOS = crossDataHistMapper.selectByCrossIdsAndTimestamp(crossIds, startSecond , endSecond);
LocalTime endTime = LocalTime.MIDNIGHT; // 00:00 of the next day
LocalDateTime endOfDay = LocalDateTime.of(nextDate, endTime);
long startSecond = startOfDay.toEpochSecond(ZoneOffset.of("+8")) + 5 * 600;
long endSecond = endOfDay.toEpochSecond(ZoneOffset.of("+8"));
List<CrossDataHistPO> crossDataHistPOS = crossDataHistMapper.selectByCrossIdsAndTimestamp(crossIds, (int) startSecond , (int) endSecond);
if (!CollectionUtils.isEmpty(crossDataHistPOS)) { if (!CollectionUtils.isEmpty(crossDataHistPOS)) {
List<GreenBeltFlowStopTimeVO> results = new ArrayList<>(); List<GreenBeltFlowStopTimeVO> results = new ArrayList<>();
Map<Date, List<CrossDataHistPO>> startTimeMap = crossDataHistPOS.stream().collect(Collectors.groupingBy(CrossDataHistPO::getStartTime)); Map<Date, List<CrossDataHistPO>> startTimeMap = crossDataHistPOS.stream().collect(Collectors.groupingBy(CrossDataHistPO::getStartTime));
...@@ -55,6 +50,8 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService { ...@@ -55,6 +50,8 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
flowStopTimeDetail.setFlow(crossDataHistPO.getFlow()); flowStopTimeDetail.setFlow(crossDataHistPO.getFlow());
flowStopTimeDetail.setStopTimes(crossDataHistPO.getStopTimes()); flowStopTimeDetail.setStopTimes(crossDataHistPO.getStopTimes());
flowStopTimeDetail.setCrossId(crossDataHistPO.getCrossId()); flowStopTimeDetail.setCrossId(crossDataHistPO.getCrossId());
// todo 先删除,后续通过路口距离/速度计算 距离通过卫博发送数据
flowStopTimeDetail.setTravelTime(0.0);
crossList.add(flowStopTimeDetail); crossList.add(flowStopTimeDetail);
} }
} }
......
...@@ -77,7 +77,18 @@ public class StrategyControlController { ...@@ -77,7 +77,18 @@ public class StrategyControlController {
} }
@ApiOperation(value = "路网优化监测", notes = "路网优化监测", @ApiOperation(value = "AI优化次数优化时长", notes = "路网优化检测-AI优化次数优化时长",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/strategyOptTimes")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyControlDataEntity.class),
})
public JsonViewObject strategyOptTimes() throws Exception {
return strategyControlService.strategyOptTimes();
}
@ApiOperation(value = "路网优化监测-接口干线列表", notes = "路网优化监测-AI路口-AI干线",
response = JsonViewObject.class, response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/crossOptInfoList") @GetMapping(value = "/crossOptInfoList")
......
...@@ -24,7 +24,7 @@ import java.util.List; ...@@ -24,7 +24,7 @@ import java.util.List;
* @date 2024/11/19 20:10 * @date 2024/11/19 20:10
* @description 神思推送绿波时序图 * @description 神思推送绿波时序图
*/ */
@Api(value = "StrategyGreenBeltController", description = "策略绿波带") @Api(value = "StrategyGreenBeltController", description = "策略绿波带弹窗")
@RequestMapping("/strategyBelt") @RequestMapping("/strategyBelt")
@RestController @RestController
public class StrategyGreenBeltController { public class StrategyGreenBeltController {
......
package net.wanji.opt.synthesis.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author duanruiming
* @date 2024/12/04 13:58
*/
@Data
@ApiModel("AI优化次数优化时长返回实体")
public class StrategyOptTimesVO {
@ApiModelProperty("优化次数")
private Integer count;
@ApiModelProperty("优化时长")
private Integer times;
}
...@@ -15,6 +15,7 @@ public interface StrategyControlService { ...@@ -15,6 +15,7 @@ public interface StrategyControlService {
JsonViewObject strategyInfoPageList(StrategyControlDataEntity entity) throws Exception; JsonViewObject strategyInfoPageList(StrategyControlDataEntity entity) throws Exception;
JsonViewObject crossStrategyInfoList(Integer type) throws Exception; JsonViewObject crossStrategyInfoList(Integer type) throws Exception;
JsonViewObject strategyOptTimes() throws Exception;
JsonViewObject crossStrategyHistList() throws Exception; JsonViewObject crossStrategyHistList() throws Exception;
JsonViewObject crossOptInfoList(Integer type) throws Exception; JsonViewObject crossOptInfoList(Integer type) throws Exception;
......
...@@ -86,6 +86,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -86,6 +86,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
vo.setHourMinute(DateUtils.format(greenwaveHistPO.getStartTime(), "HH:mm")); vo.setHourMinute(DateUtils.format(greenwaveHistPO.getStartTime(), "HH:mm"));
vo.setStopTimes(greenwaveHistPO.getStopTimes()); vo.setStopTimes(greenwaveHistPO.getStopTimes());
vo.setCordQueueRatio(greenwaveHistPO.getCordQueueRatio() * 100); vo.setCordQueueRatio(greenwaveHistPO.getCordQueueRatio() * 100);
vo.setTravelTime(greenwaveHistPO.getTrvalTime());
results.add(vo); results.add(vo);
} }
} }
......
...@@ -29,5 +29,7 @@ public class GreenBeltFlowStopTimeVO { ...@@ -29,5 +29,7 @@ public class GreenBeltFlowStopTimeVO {
private Integer flow; private Integer flow;
@ApiModelProperty("停车次数") @ApiModelProperty("停车次数")
private Double stopTimes; private Double stopTimes;
@ApiModelProperty("行程时间")
private Double travelTime;
} }
} }
...@@ -27,4 +27,6 @@ public class GreenBeltStopTimesQueueLengthVO { ...@@ -27,4 +27,6 @@ public class GreenBeltStopTimesQueueLengthVO {
private Double stopTimes; private Double stopTimes;
@ApiModelProperty("空间占比") @ApiModelProperty("空间占比")
private Double cordQueueRatio; private Double cordQueueRatio;
@ApiModelProperty("行程时间")
private Integer travelTime;
} }
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