Commit 2fbdc0bc authored by duanruiming's avatar duanruiming

[add] 策略优化记录优化

parent 54813f8d
......@@ -2,6 +2,7 @@ package net.wanji.opt.synthesis.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.util.DateUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
......@@ -189,9 +190,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List<StrategyControlHistVO> results = new ArrayList<>();
LocalDate currentDate = LocalDate.now();
LocalDateTime midnight = currentDate.atStartOfDay();
try {
// 查询当前绿波历史记录
setGreenOptHist(results, midnight, format);
setCrossOptHist(results, midnight);
} catch (ParseException e) {
log.error("优化策略查询失败:", e);
JsonViewObject.newInstance().fail("优化策略查询失败");
}
List<StrategyControlHistVO> sorted = results.stream().sorted(Comparator.comparing(StrategyControlHistVO::getOptTime).reversed()).collect(Collectors.toList());
return JsonViewObject.newInstance().success(sorted);
}
......@@ -211,9 +217,13 @@ public class StrategyControlServiceImpl implements StrategyControlService {
histVO.setStrategy(resultEntity.getCurrentAlgo());
histVO.setStrategyName(StrategyCrossAlgoEnum.getDescByCode(resultEntity.getCurrentAlgo()));
Date issueTime = resultEntity.getIssueTime();
String format = net.wanji.common.utils.tool.DateUtil.format(issueTime, Constants.DATE_FORMAT.valueOf("yyyy-MM-dd HH:mm:ss"));
String format = DateUtils.format(issueTime, "yyyy-MM-dd HH:mm:ss");
histVO.setOptTime(format);
if (resultEntity.getCurrentAlgo() != 1) {
histVO.setResult(Objects.equals(200, resultEntity.getResponseCode()) ? "成功" : "失败");
} else {
histVO.setResult("成功");
}
results.add(histVO);
}
}
......
......@@ -4,11 +4,11 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.omg.CORBA.UNKNOWN;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date;
......@@ -39,13 +39,14 @@ public class CrossDataRealtimePO {
* 交通指数(1~10)
*/
@ApiModelProperty(value = "交通指数(1~10)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double trafficIndex;
/**
* 开始时间:yyyy-MM-dd HH;mm:ss
*/
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@ApiModelProperty(value = "结束时间:yyyy-MM-dd HH:mm:ss", notes = "")
......@@ -71,16 +72,19 @@ public class CrossDataRealtimePO {
* 失衡指数
*/
@ApiModelProperty(value = "失衡指数", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double unbalanceIndex;
/**
* 溢出指数
*/
@ApiModelProperty(value = "溢出指数", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double spilloverIndex;
/**
* 拥堵指数
*/
@ApiModelProperty(value = "拥堵指数", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double congestionIndex;
/**
* 路口失衡方向:1,2,3...
......@@ -106,16 +110,19 @@ public class CrossDataRealtimePO {
* 交通流率/h
*/
@ApiModelProperty(value = "交通流率/h", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double flowRate;
/**
* 平均速度(km/h)
*/
@ApiModelProperty(value = "平均速度(km/h)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double speed;
/**
* 最大排队(米)
*/
@ApiModelProperty(value = "最大排队(米)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double queueLength;
/**
* 停车次数(次)
......@@ -151,11 +158,13 @@ public class CrossDataRealtimePO {
* 红灯清空率
*/
@ApiModelProperty(value = "红灯清空率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double clearRate;
/**
* 负载均衡度
*/
@ApiModelProperty(value = "负载均衡度", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double loadBalance;
/**
* 平均未清空车辆数量
......@@ -166,25 +175,32 @@ public class CrossDataRealtimePO {
* 绿灯有效利用率
*/
@ApiModelProperty(value = "绿灯有效利用率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double greenLightEfficiency;
/**
* 溢流率
*/
@ApiModelProperty(value = "溢流率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double effusionRate;
@ApiModelProperty(name = "不停车率",notes = "")
@ApiModelProperty(name = "不停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double noStopRate;
@ApiModelProperty(name = "一次停车率",notes = "")
@ApiModelProperty(name = "一次停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double oneStopRate;
@ApiModelProperty(name = "二次停车率",notes = "")
@ApiModelProperty(name = "二次停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double twoStopRate;
@ApiModelProperty(name = "三次停车率",notes = "")
@ApiModelProperty(name = "三次停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double threeStopRate;
@ApiModelProperty(value = "非机动车流量", notes = "")
private int nonMotorFlow;
@ApiModelProperty(value = "85位速度(km/h)", notes = "")
@TableField(value = "v_85")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private double v85;
@ApiModelProperty(value = "大车流量", notes = "")
private int trafficFlowA;
......@@ -193,10 +209,14 @@ public class CrossDataRealtimePO {
@ApiModelProperty(value = "小车流量", notes = "")
private int trafficFlowC;
@ApiModelProperty(value = "时间占有率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private double timeOccupancy;
@ApiModelProperty(value = "空间占有率", notes = "平均空间密度(长度占比)")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private double vehicleLengthRatioMean;
/** add 20241123 适配神思数据 */
/**
* add 20241123 适配神思数据
*/
@ApiModelProperty(value = "执行策略 失衡 2拥堵 3溢出 4死锁 5 空放", notes = "")
private Integer strategy;
@ApiModelProperty(value = "策略执行持续时间;单位:s", notes = "")
......
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