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
c5b78da3
Commit
c5b78da3
authored
Dec 07, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 绿波绿信比流量优化
parent
9ebadf1a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
67 deletions
+78
-67
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+6
-6
GreenBeltServiceImpl.java
...anji/opt/service/signalopt/impl/GreenBeltServiceImpl.java
+70
-61
GreenBeltCrossDetailVO.java
...rc/main/java/net/wanji/opt/vo/GreenBeltCrossDetailVO.java
+2
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
c5b78da3
...
@@ -336,12 +336,12 @@ public class TrendServiceImpl implements TrendService {
...
@@ -336,12 +336,12 @@ public class TrendServiceImpl implements TrendService {
double
roundedTrafficIndex
=
Math
.
round
(
abnormalCrossListVO
.
getCongestionIndex
()
*
100.0
)
/
100.0
;
double
roundedTrafficIndex
=
Math
.
round
(
abnormalCrossListVO
.
getCongestionIndex
()
*
100.0
)
/
100.0
;
abnormalCrossListVO
.
setCongestionIndex
(
roundedTrafficIndex
);
abnormalCrossListVO
.
setCongestionIndex
(
roundedTrafficIndex
);
// todo
Double
congestionIndex
=
abnormalCrossListVO
.
getCongestionIndex
();
//
Double congestionIndex = abnormalCrossListVO.getCongestionIndex();
double
lastWeekIndex
=
getIndex
(
congestionIndex
,
crossId
,
batchTime
-
604800
);
//
double lastWeekIndex = getIndex(congestionIndex, crossId, batchTime - 604800);
double
lastPeriodIndex
=
getIndex
(
congestionIndex
,
crossId
,
batchTime
-
300
);
//
double lastPeriodIndex = getIndex(congestionIndex, crossId, batchTime - 300);
abnormalCrossListVO
.
setLastWeekIndex
(
Math
.
floor
(
lastWeekIndex
));
//
abnormalCrossListVO.setLastWeekIndex(Math.floor(lastWeekIndex));
abnormalCrossListVO
.
setLastPeriodIndex
(
Math
.
floor
(
lastPeriodIndex
));
//
abnormalCrossListVO.setLastPeriodIndex(Math.floor(lastPeriodIndex));
// 常发性偶发性 一个月内超过三次
// 常发性偶发性 一个月内超过三次
int
frequent
=
getFrequent
(
crossId
,
batchTime
);
int
frequent
=
getFrequent
(
crossId
,
batchTime
);
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/signalopt/impl/GreenBeltServiceImpl.java
View file @
c5b78da3
package
net
.
wanji
.
opt
.
service
.
signalopt
.
impl
;
package
net
.
wanji
.
opt
.
service
.
signalopt
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -91,6 +92,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
...
@@ -91,6 +92,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
Map
<
Integer
,
GreenwaveInfoPO
>
greenWaveMap
=
GreenWaveInfoCache
.
greenWaveMap
;
Map
<
Integer
,
GreenwaveInfoPO
>
greenWaveMap
=
GreenWaveInfoCache
.
greenWaveMap
;
GreenwaveInfoPO
greenwaveInfoPO
=
greenWaveMap
.
get
(
greenId
);
GreenwaveInfoPO
greenwaveInfoPO
=
greenWaveMap
.
get
(
greenId
);
greenBeltCrossDetailVO
.
setGreenName
(
greenwaveInfoPO
.
getName
());
greenBeltCrossDetailVO
.
setGreenName
(
greenwaveInfoPO
.
getName
());
greenBeltCrossDetailVO
.
setCrossNum
(
detailList
.
size
());
}
}
return
greenBeltCrossDetailVO
;
return
greenBeltCrossDetailVO
;
...
@@ -98,13 +100,15 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
...
@@ -98,13 +100,15 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
@Override
@Override
public
Map
<
String
,
List
<
GreenBeltKeyCrossFlowTimeVO
>>
greenBeltKeyCrossFlowTime
(
Integer
greenId
)
throws
Exception
{
public
Map
<
String
,
List
<
GreenBeltKeyCrossFlowTimeVO
>>
greenBeltKeyCrossFlowTime
(
Integer
greenId
)
throws
Exception
{
try
{
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
DecimalFormat
df
=
new
DecimalFormat
(
"#
.00"
);
DecimalFormat
df
=
new
DecimalFormat
(
"#0
.00"
);
List
<
GreenBeltKeyCrossFlowTimeVO
>
tempResult
=
new
ArrayList
<>();
List
<
GreenBeltKeyCrossFlowTimeVO
>
tempResult
=
new
ArrayList
<>();
List
<
GreenBeltKeyCrossFlowTimeVO
>
results
=
new
ArrayList
<>();
List
<
GreenBeltKeyCrossFlowTimeVO
>
results
=
new
ArrayList
<>();
LocalDate
currentDate
=
LocalDate
.
now
();
LocalDate
currentDate
=
LocalDate
.
now
();
LocalDate
localDate
=
currentDate
.
minusDays
(
1
);
LocalTime
startTime
=
LocalTime
.
MIDNIGHT
;
LocalTime
startTime
=
LocalTime
.
MIDNIGHT
;
LocalDateTime
startOfDay
=
LocalDateTime
.
of
(
current
Date
,
startTime
);
LocalDateTime
startOfDay
=
LocalDateTime
.
of
(
local
Date
,
startTime
);
// 绿波优化数据
// 绿波优化数据
LambdaQueryWrapper
<
StrategyGreenOptHistEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
StrategyGreenOptHistEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
...
@@ -118,7 +122,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
...
@@ -118,7 +122,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
GreenBeltKeyCrossFlowTimeVO
vo
=
new
GreenBeltKeyCrossFlowTimeVO
();
GreenBeltKeyCrossFlowTimeVO
vo
=
new
GreenBeltKeyCrossFlowTimeVO
();
String
keyCross
=
entity
.
getKeyCross
();
String
keyCross
=
entity
.
getKeyCross
();
vo
.
setCrossId
(
keyCross
);
vo
.
setCrossId
(
keyCross
);
vo
.
setDirName
(
entity
.
getDir
(
));
vo
.
setDirName
(
GreenBeltDirEnum
.
getDesc
(
entity
.
getDir
()
));
Date
controlTime
=
get5MinuteDate
(
entity
.
getControlTime
());
Date
controlTime
=
get5MinuteDate
(
entity
.
getControlTime
());
vo
.
setStartTime
(
controlTime
);
vo
.
setStartTime
(
controlTime
);
String
crossGreenDetail
=
entity
.
getCrossGreenDetail
();
String
crossGreenDetail
=
entity
.
getCrossGreenDetail
();
...
@@ -155,6 +159,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
...
@@ -155,6 +159,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
resultVO
.
setFlow
(
0
);
resultVO
.
setFlow
(
0
);
resultVO
.
setGreenTimeRatio
(
0.0
);
resultVO
.
setGreenTimeRatio
(
0.0
);
resultVO
.
setCrossId
(
tempCrossId
);
resultVO
.
setCrossId
(
tempCrossId
);
resultVO
.
setDirName
(
"未执行"
);
for
(
GreenBeltKeyCrossFlowTimeVO
result
:
tempResult
)
{
for
(
GreenBeltKeyCrossFlowTimeVO
result
:
tempResult
)
{
if
(
StringUtils
.
equalsIgnoreCase
(
tempCrossId
,
result
.
getCrossId
())
if
(
StringUtils
.
equalsIgnoreCase
(
tempCrossId
,
result
.
getCrossId
())
&&
minuteDate
.
getTime
()
==
result
.
getStartTime
().
getTime
())
{
&&
minuteDate
.
getTime
()
==
result
.
getStartTime
().
getTime
())
{
...
@@ -168,6 +173,10 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
...
@@ -168,6 +173,10 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
}
}
Map
<
String
,
List
<
GreenBeltKeyCrossFlowTimeVO
>>
map
=
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
GreenBeltKeyCrossFlowTimeVO:
:
getDirName
));
Map
<
String
,
List
<
GreenBeltKeyCrossFlowTimeVO
>>
map
=
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
GreenBeltKeyCrossFlowTimeVO:
:
getDirName
));
return
map
;
return
map
;
}
catch
(
Exception
e
)
{
log
.
error
(
"绿波关键路口流量绿信比查询异常:"
,
e
);
throw
new
RuntimeException
(
e
);
}
}
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo/GreenBeltCrossDetailVO.java
View file @
c5b78da3
...
@@ -17,6 +17,8 @@ import java.util.List;
...
@@ -17,6 +17,8 @@ import java.util.List;
public
class
GreenBeltCrossDetailVO
{
public
class
GreenBeltCrossDetailVO
{
@ApiModelProperty
(
"干线名称"
)
@ApiModelProperty
(
"干线名称"
)
private
String
greenName
;
private
String
greenName
;
@ApiModelProperty
(
"路口数量"
)
private
Integer
crossNum
;
@JsonSerialize
(
using
=
Double2TwoDecimalPlacesSerializer
.
class
)
@JsonSerialize
(
using
=
Double2TwoDecimalPlacesSerializer
.
class
)
@ApiModelProperty
(
"干线指数"
)
@ApiModelProperty
(
"干线指数"
)
private
Double
greenIndex
;
private
Double
greenIndex
;
...
...
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