Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
traffic-signal-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
signal
traffic-signal-platform
Commits
2fbdc0bc
Commit
2fbdc0bc
authored
Jan 02, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 策略优化记录优化
parent
54813f8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
13 deletions
+43
-13
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+15
-5
CrossDataRealtimePO.java
...c/main/java/net/wanji/databus/po/CrossDataRealtimePO.java
+28
-8
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
2fbdc0bc
...
@@ -2,6 +2,7 @@ package net.wanji.opt.synthesis.service.impl;
...
@@ -2,6 +2,7 @@ package net.wanji.opt.synthesis.service.impl;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.excel.util.DateUtils
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
...
@@ -189,9 +190,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -189,9 +190,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List
<
StrategyControlHistVO
>
results
=
new
ArrayList
<>();
List
<
StrategyControlHistVO
>
results
=
new
ArrayList
<>();
LocalDate
currentDate
=
LocalDate
.
now
();
LocalDate
currentDate
=
LocalDate
.
now
();
LocalDateTime
midnight
=
currentDate
.
atStartOfDay
();
LocalDateTime
midnight
=
currentDate
.
atStartOfDay
();
// 查询当前绿波历史记录
try
{
setGreenOptHist
(
results
,
midnight
,
format
);
// 查询当前绿波历史记录
setCrossOptHist
(
results
,
midnight
);
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
());
List
<
StrategyControlHistVO
>
sorted
=
results
.
stream
().
sorted
(
Comparator
.
comparing
(
StrategyControlHistVO:
:
getOptTime
).
reversed
()).
collect
(
Collectors
.
toList
());
return
JsonViewObject
.
newInstance
().
success
(
sorted
);
return
JsonViewObject
.
newInstance
().
success
(
sorted
);
}
}
...
@@ -211,9 +217,13 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -211,9 +217,13 @@ public class StrategyControlServiceImpl implements StrategyControlService {
histVO
.
setStrategy
(
resultEntity
.
getCurrentAlgo
());
histVO
.
setStrategy
(
resultEntity
.
getCurrentAlgo
());
histVO
.
setStrategyName
(
StrategyCrossAlgoEnum
.
getDescByCode
(
resultEntity
.
getCurrentAlgo
()));
histVO
.
setStrategyName
(
StrategyCrossAlgoEnum
.
getDescByCode
(
resultEntity
.
getCurrentAlgo
()));
Date
issueTime
=
resultEntity
.
getIssueTime
();
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
);
histVO
.
setOptTime
(
format
);
histVO
.
setResult
(
Objects
.
equals
(
200
,
resultEntity
.
getResponseCode
())
?
"成功"
:
"失败"
);
if
(
resultEntity
.
getCurrentAlgo
()
!=
1
)
{
histVO
.
setResult
(
Objects
.
equals
(
200
,
resultEntity
.
getResponseCode
())
?
"成功"
:
"失败"
);
}
else
{
histVO
.
setResult
(
"成功"
);
}
results
.
add
(
histVO
);
results
.
add
(
histVO
);
}
}
}
}
...
...
wj-databus/src/main/java/net/wanji/databus/po/CrossDataRealtimePO.java
View file @
2fbdc0bc
...
@@ -4,11 +4,11 @@ import com.alibaba.fastjson.annotation.JSONField;
...
@@ -4,11 +4,11 @@ import com.alibaba.fastjson.annotation.JSONField;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
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.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.omg.CORBA.UNKNOWN
;
import
net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -39,13 +39,14 @@ public class CrossDataRealtimePO {
...
@@ -39,13 +39,14 @@ public class CrossDataRealtimePO {
* 交通指数(1~10)
* 交通指数(1~10)
*/
*/
@ApiModelProperty
(
value
=
"交通指数(1~10)"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"交通指数(1~10)"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
trafficIndex
;
private
Double
trafficIndex
;
/**
/**
* 开始时间:yyyy-MM-dd HH;mm:ss
* 开始时间:yyyy-MM-dd HH;mm:ss
*/
*/
@ApiModelProperty
(
value
=
"开始时间:yyyy-MM-dd HH:mm:ss"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"开始时间:yyyy-MM-dd HH:mm:ss"
,
notes
=
""
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@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
;
private
Date
startTime
;
@ApiModelProperty
(
value
=
"结束时间:yyyy-MM-dd HH:mm:ss"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"结束时间:yyyy-MM-dd HH:mm:ss"
,
notes
=
""
)
...
@@ -71,16 +72,19 @@ public class CrossDataRealtimePO {
...
@@ -71,16 +72,19 @@ public class CrossDataRealtimePO {
* 失衡指数
* 失衡指数
*/
*/
@ApiModelProperty
(
value
=
"失衡指数"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"失衡指数"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
unbalanceIndex
;
private
Double
unbalanceIndex
;
/**
/**
* 溢出指数
* 溢出指数
*/
*/
@ApiModelProperty
(
value
=
"溢出指数"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"溢出指数"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
spilloverIndex
;
private
Double
spilloverIndex
;
/**
/**
* 拥堵指数
* 拥堵指数
*/
*/
@ApiModelProperty
(
value
=
"拥堵指数"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"拥堵指数"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
congestionIndex
;
private
Double
congestionIndex
;
/**
/**
* 路口失衡方向:1,2,3...
* 路口失衡方向:1,2,3...
...
@@ -106,16 +110,19 @@ public class CrossDataRealtimePO {
...
@@ -106,16 +110,19 @@ public class CrossDataRealtimePO {
* 交通流率/h
* 交通流率/h
*/
*/
@ApiModelProperty
(
value
=
"交通流率/h"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"交通流率/h"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
flowRate
;
private
Double
flowRate
;
/**
/**
* 平均速度(km/h)
* 平均速度(km/h)
*/
*/
@ApiModelProperty
(
value
=
"平均速度(km/h)"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"平均速度(km/h)"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
speed
;
private
Double
speed
;
/**
/**
* 最大排队(米)
* 最大排队(米)
*/
*/
@ApiModelProperty
(
value
=
"最大排队(米)"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"最大排队(米)"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
queueLength
;
private
Double
queueLength
;
/**
/**
* 停车次数(次)
* 停车次数(次)
...
@@ -151,11 +158,13 @@ public class CrossDataRealtimePO {
...
@@ -151,11 +158,13 @@ public class CrossDataRealtimePO {
* 红灯清空率
* 红灯清空率
*/
*/
@ApiModelProperty
(
value
=
"红灯清空率"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"红灯清空率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
clearRate
;
private
Double
clearRate
;
/**
/**
* 负载均衡度
* 负载均衡度
*/
*/
@ApiModelProperty
(
value
=
"负载均衡度"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"负载均衡度"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
loadBalance
;
private
Double
loadBalance
;
/**
/**
* 平均未清空车辆数量
* 平均未清空车辆数量
...
@@ -166,25 +175,32 @@ public class CrossDataRealtimePO {
...
@@ -166,25 +175,32 @@ public class CrossDataRealtimePO {
* 绿灯有效利用率
* 绿灯有效利用率
*/
*/
@ApiModelProperty
(
value
=
"绿灯有效利用率"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"绿灯有效利用率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
greenLightEfficiency
;
private
Double
greenLightEfficiency
;
/**
/**
* 溢流率
* 溢流率
*/
*/
@ApiModelProperty
(
value
=
"溢流率"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"溢流率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
Double
effusionRate
;
private
Double
effusionRate
;
@ApiModelProperty
(
name
=
"不停车率"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"不停车率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
public
Double
noStopRate
;
public
Double
noStopRate
;
@ApiModelProperty
(
name
=
"一次停车率"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"一次停车率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
public
Double
oneStopRate
;
public
Double
oneStopRate
;
@ApiModelProperty
(
name
=
"二次停车率"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"二次停车率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
public
Double
twoStopRate
;
public
Double
twoStopRate
;
@ApiModelProperty
(
name
=
"三次停车率"
,
notes
=
""
)
@ApiModelProperty
(
name
=
"三次停车率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
public
Double
threeStopRate
;
public
Double
threeStopRate
;
@ApiModelProperty
(
value
=
"非机动车流量"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"非机动车流量"
,
notes
=
""
)
private
int
nonMotorFlow
;
private
int
nonMotorFlow
;
@ApiModelProperty
(
value
=
"85位速度(km/h)"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"85位速度(km/h)"
,
notes
=
""
)
@TableField
(
value
=
"v_85"
)
@TableField
(
value
=
"v_85"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
double
v85
;
private
double
v85
;
@ApiModelProperty
(
value
=
"大车流量"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"大车流量"
,
notes
=
""
)
private
int
trafficFlowA
;
private
int
trafficFlowA
;
...
@@ -193,10 +209,14 @@ public class CrossDataRealtimePO {
...
@@ -193,10 +209,14 @@ public class CrossDataRealtimePO {
@ApiModelProperty
(
value
=
"小车流量"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"小车流量"
,
notes
=
""
)
private
int
trafficFlowC
;
private
int
trafficFlowC
;
@ApiModelProperty
(
value
=
"时间占有率"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"时间占有率"
,
notes
=
""
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
double
timeOccupancy
;
private
double
timeOccupancy
;
@ApiModelProperty
(
value
=
"空间占有率"
,
notes
=
"平均空间密度(长度占比)"
)
@ApiModelProperty
(
value
=
"空间占有率"
,
notes
=
"平均空间密度(长度占比)"
)
@JsonSerialize
(
using
=
DoubleToTwoDecimalPlacesSerializer
.
class
)
private
double
vehicleLengthRatioMean
;
private
double
vehicleLengthRatioMean
;
/** add 20241123 适配神思数据 */
/**
* add 20241123 适配神思数据
*/
@ApiModelProperty
(
value
=
"执行策略 失衡 2拥堵 3溢出 4死锁 5 空放"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"执行策略 失衡 2拥堵 3溢出 4死锁 5 空放"
,
notes
=
""
)
private
Integer
strategy
;
private
Integer
strategy
;
@ApiModelProperty
(
value
=
"策略执行持续时间;单位:s"
,
notes
=
""
)
@ApiModelProperty
(
value
=
"策略执行持续时间;单位:s"
,
notes
=
""
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment