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
jinan
traffic-signal-platform
Commits
938ea54a
Commit
938ea54a
authored
Mar 24, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 态势监测-策略推荐优化
parent
0ef365f2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
35 deletions
+115
-35
TrendControllerV2.java
...in/java/net/wanji/opt/controllerv2/TrendControllerV2.java
+1
-1
TrendServiceV2.java
...src/main/java/net/wanji/opt/servicev2/TrendServiceV2.java
+1
-1
TrendServiceV2Impl.java
...va/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
+78
-33
StrategyFactoryEntity.java
...a/net/wanji/opt/synthesis/pojo/StrategyFactoryEntity.java
+6
-0
OptStrategyResultInfoVO.java
.../main/java/net/wanji/opt/vo2/OptStrategyResultInfoVO.java
+29
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controllerv2/TrendControllerV2.java
View file @
938ea54a
...
...
@@ -242,7 +242,7 @@ public class TrendControllerV2 {
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
String
.
class
),
})
public
JsonViewObject
optStrategyResultInfo
(
String
id
,
String
date
)
throws
Exception
{
String
result
=
"均衡调控-专家方案"
;
OptStrategyResultInfoVO
result
=
new
OptStrategyResultInfoVO
()
;
try
{
result
=
trendServiceV2
.
optStrategyResultInfo
(
id
,
date
);
}
catch
(
Exception
e
)
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/TrendServiceV2.java
View file @
938ea54a
...
...
@@ -30,7 +30,7 @@ public interface TrendServiceV2 {
PageInfo
<
StatisticsEventTypeCountTimeVO
>
selectCrossGreenHistList
(
int
pageNo
,
int
pageSize
)
throws
Exception
;
String
optStrategyResultInfo
(
String
id
,
String
date
)
throws
Exception
;
OptStrategyResultInfoVO
optStrategyResultInfo
(
String
id
,
String
date
)
throws
Exception
;
GreenOptCrossOffsetVO
optStrategyCrossOffsetList
(
Integer
id
,
String
date
)
throws
Exception
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/implv2/TrendServiceV2Impl.java
View file @
938ea54a
...
...
@@ -27,13 +27,11 @@ import net.wanji.opt.cache.BaseCrossInfoCache;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.common.enums.EventInfoTypeEnum
;
import
net.wanji.opt.common.enums.GreenBeltDirEnum
;
import
net.wanji.opt.dao.mapper.GreenWaveRealTimeMapperV2Mapper
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
import
net.wanji.opt.dao.mapper.StrategyCrossResultMapper
;
import
net.wanji.opt.dao.mapper.StrategyGreenOptHistMapper
;
import
net.wanji.opt.dao.mapper.*
;
import
net.wanji.opt.po.StrategyGreenOptHistEntity
;
import
net.wanji.opt.servicev2.TrendServiceV2
;
import
net.wanji.opt.synthesis.pojo.StrategyCrossResultEntity
;
import
net.wanji.opt.synthesis.pojo.StrategyFactoryEntity
;
import
net.wanji.opt.vo.GreenBeltInfoVO
;
import
net.wanji.opt.vo2.*
;
import
net.wanji.opt.vo2.dto.CrossLastOptResultDTO
;
...
...
@@ -81,6 +79,8 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
private
BaseCrossInfoCache
baseCrossInfoCache
;
@Resource
private
UtcFeignClients
utcFeignClients
;
@Resource
private
StrategyFactoryMapper
strategyFactoryMapper
;
private
static
List
<
OptMonitoringVO
>
greenListCache
=
new
ArrayList
<>(
10
);
private
static
List
<
OptMonitoringVO
>
crossListCache
=
new
ArrayList
<>(
80
);
...
...
@@ -359,24 +359,44 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
}
@Override
public
String
optStrategyResultInfo
(
String
id
,
String
dateStr
)
throws
Exception
{
StringBuilder
sb
=
new
StringBuilder
();
String
result
=
"均衡调控-专家方案"
;
public
OptStrategyResultInfoVO
optStrategyResultInfo
(
String
id
,
String
dateStr
)
throws
Exception
{
OptStrategyResultInfoVO
result
=
new
OptStrategyResultInfoVO
();
Date
date
=
new
Date
();
if
(!
StringUtils
.
isEmpty
(
dateStr
))
{
date
=
DateUtil
.
parse
(
dateStr
,
Constants
.
DATE_FORMAT
.
E_DATE_FORMAT_SECOND
);
}
if
(
net
.
wanji
.
common
.
utils
.
tool
.
StringUtils
.
isNotBlank
(
id
))
{
if
(
id
.
length
()
>
1
)
{
result
=
getOptCrossResult
(
id
,
sb
,
date
);
if
(
id
.
length
()
>
2
)
{
result
=
getOptCrossResult
(
id
,
date
);
}
else
{
result
=
getOptGreenResult
(
id
,
sb
,
date
);
result
=
getOptGreenResult
(
id
,
date
);
}
}
return
result
;
}
private
String
getOptGreenResult
(
String
id
,
StringBuilder
sb
,
Date
date
)
throws
Exception
{
private
OptStrategyResultInfoVO
getOptGreenResult
(
String
id
,
Date
date
)
throws
Exception
{
OptStrategyResultInfoVO
optStrategyResultInfoVO
=
new
OptStrategyResultInfoVO
();
LambdaQueryWrapper
<
StrategyFactoryEntity
>
strategyQueryWrapper
=
new
LambdaQueryWrapper
<>();
strategyQueryWrapper
.
eq
(
StrategyFactoryEntity:
:
getStatus
,
1
);
strategyQueryWrapper
.
eq
(
StrategyFactoryEntity:
:
getType
,
2
);
List
<
StrategyFactoryEntity
>
strategyFactoryEntities
=
strategyFactoryMapper
.
selectList
(
strategyQueryWrapper
);
List
<
OptStrategyResultInfoVO
.
Detail
>
details
=
new
ArrayList
<>();
for
(
StrategyFactoryEntity
factory
:
strategyFactoryEntities
)
{
OptStrategyResultInfoVO
.
Detail
detail
=
new
OptStrategyResultInfoVO
.
Detail
();
Integer
optType
=
factory
.
getOptType
();
String
strategyName
=
factory
.
getStrategyName
();
String
method
=
factory
.
getMethod
();
String
company
=
factory
.
getCompany
();
detail
.
setOptType
(
optType
);
String
str
=
String
.
join
(
"-"
,
method
,
strategyName
,
company
);
detail
.
setStrategyName
(
str
);
details
.
add
(
detail
);
}
optStrategyResultInfoVO
.
setDetails
(
details
);
LambdaQueryWrapper
<
StrategyGreenOptHistEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
StrategyGreenOptHistEntity:
:
getGreenId
,
id
);
queryWrapper
.
le
(
StrategyGreenOptHistEntity:
:
getControlTime
,
date
);
...
...
@@ -390,14 +410,40 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
Date
parse
=
DateUtil
.
parse
(
controlTime
,
Constants
.
DATE_FORMAT
.
E_DATE_FORMAT_SECOND
);
long
controlOptTime
=
parse
.
getTime
();
if
(
date
.
getTime
()
-
controlOptTime
<
30
*
60
*
1000
)
{
sb
.
append
(
"动态绿波"
).
append
(
"-"
).
append
(
"均衡调控"
).
append
(
"-"
).
append
(
"神思策略"
);
}
else
{
sb
.
append
(
"均衡调控"
).
append
(
"-"
).
append
(
"专家方案"
);
optStrategyResultInfoVO
.
setCurOptType
(
4
);
}
return
sb
.
toString
();
for
(
OptStrategyResultInfoVO
.
Detail
detail
:
details
)
{
Integer
optType
=
detail
.
getOptType
();
if
(
Objects
.
equals
(
optType
,
optStrategyResultInfoVO
.
getCurOptType
()))
{
optStrategyResultInfoVO
.
setCurStrategyName
(
detail
.
getStrategyName
());
}
}
return
optStrategyResultInfoVO
;
}
private
String
getOptCrossResult
(
String
id
,
StringBuilder
sb
,
Date
date
)
{
private
OptStrategyResultInfoVO
getOptCrossResult
(
String
id
,
Date
date
)
{
OptStrategyResultInfoVO
optStrategyResultInfoVO
=
new
OptStrategyResultInfoVO
();
LambdaQueryWrapper
<
StrategyFactoryEntity
>
strategyQueryWrapper
=
new
LambdaQueryWrapper
<>();
strategyQueryWrapper
.
eq
(
StrategyFactoryEntity:
:
getStatus
,
1
);
strategyQueryWrapper
.
eq
(
StrategyFactoryEntity:
:
getType
,
1
);
List
<
StrategyFactoryEntity
>
strategyFactoryEntities
=
strategyFactoryMapper
.
selectList
(
strategyQueryWrapper
);
List
<
OptStrategyResultInfoVO
.
Detail
>
details
=
new
ArrayList
<>();
for
(
StrategyFactoryEntity
factory
:
strategyFactoryEntities
)
{
OptStrategyResultInfoVO
.
Detail
detail
=
new
OptStrategyResultInfoVO
.
Detail
();
Integer
optType
=
factory
.
getOptType
();
String
strategyName
=
factory
.
getStrategyName
();
String
method
=
factory
.
getMethod
();
String
company
=
factory
.
getCompany
();
detail
.
setOptType
(
optType
);
String
str
=
String
.
join
(
"-"
,
method
,
strategyName
,
company
);
detail
.
setStrategyName
(
str
);
details
.
add
(
detail
);
}
optStrategyResultInfoVO
.
setDetails
(
details
);
LambdaQueryWrapper
<
StrategyCrossResultEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
StrategyCrossResultEntity:
:
getCrossId
,
id
);
queryWrapper
.
le
(
StrategyCrossResultEntity:
:
getIssueTime
,
date
);
...
...
@@ -408,27 +454,26 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
for
(
StrategyCrossResultEntity
result
:
results
)
{
Integer
currentAlgo
=
result
.
getCurrentAlgo
();
Date
issueTime
=
result
.
getIssueTime
();
Integer
countDown
=
Math
.
abs
(
result
.
getCountDown
());
Integer
duration
=
result
.
getDuration
();
long
optTime
=
issueTime
.
getTime
();
long
paraTime
=
date
.
getTime
();
if
(
paraTime
-
optTime
<
10
*
60
*
1000
)
{
if
(
Objects
.
equals
(
1
,
currentAlgo
))
{
sb
.
append
(
"相位空放"
).
append
(
"-"
).
append
(
"均衡调控"
).
append
(
"-"
).
append
(
"神思策略"
);
}
if
(
Objects
.
equals
(
2
,
currentAlgo
))
{
sb
.
append
(
"路口失衡"
).
append
(
"-"
).
append
(
"效率提升"
).
append
(
"-"
).
append
(
"神思策略"
);
}
if
(
Objects
.
equals
(
3
,
currentAlgo
))
{
sb
.
append
(
"路口溢出"
).
append
(
"-"
).
append
(
"均衡调控"
).
append
(
"-"
).
append
(
"神思策略"
);
}
if
(
Objects
.
equals
(
4
,
currentAlgo
))
{
sb
.
append
(
"路口拥堵"
).
append
(
"-"
).
append
(
"均衡调控"
).
append
(
"-"
).
append
(
"神思策略"
);
}
long
paramTime
=
date
.
getTime
();
// 空放
if
(
Objects
.
equals
(
1
,
currentAlgo
)
&&
paramTime
-
optTime
<
countDown
*
1000
)
{
optStrategyResultInfoVO
.
setCurOptType
(
1
);
}
else
if
(
paramTime
-
optTime
<
duration
*
1000
)
{
optStrategyResultInfoVO
.
setCurOptType
(
currentAlgo
);
}
}
}
else
{
sb
.
append
(
"均衡调控-专家方案"
);
}
return
sb
.
toString
();
for
(
OptStrategyResultInfoVO
.
Detail
detail
:
details
)
{
Integer
optType
=
detail
.
getOptType
();
if
(
Objects
.
equals
(
optType
,
optStrategyResultInfoVO
.
getCurOptType
()))
{
optStrategyResultInfoVO
.
setCurStrategyName
(
detail
.
getStrategyName
());
}
}
return
optStrategyResultInfoVO
;
}
@Override
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyFactoryEntity.java
View file @
938ea54a
...
...
@@ -40,4 +40,10 @@ public class StrategyFactoryEntity {
@ApiModelProperty
(
"策略详情"
)
@TableField
(
"mark"
)
private
String
mark
;
@ApiModelProperty
(
"开启开关"
)
@TableField
(
"status"
)
private
Integer
status
;
@ApiModelProperty
(
"优化类型"
)
@TableField
(
"opt_type"
)
private
Integer
optType
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo2/OptStrategyResultInfoVO.java
0 → 100644
View file @
938ea54a
package
net
.
wanji
.
opt
.
vo2
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/03/24 14:56
*/
@Data
@ApiModel
(
value
=
"OptStrategyResultInfoVO"
,
description
=
"态势监测-策略推荐-优化策略-返回实体"
)
public
class
OptStrategyResultInfoVO
{
@ApiModelProperty
(
value
=
"当前策略名称"
)
private
String
curStrategyName
;
@ApiModelProperty
(
value
=
"当前策略编号"
)
private
Integer
curOptType
;
private
List
<
Detail
>
details
;
@Data
public
static
class
Detail
{
@ApiModelProperty
(
value
=
"策略名称"
)
private
String
strategyName
;
@ApiModelProperty
(
value
=
"策略编号"
)
private
Integer
optType
;
}
}
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