Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wj-datacenter-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
wj-datacenter-platform
Commits
f8243f8c
Commit
f8243f8c
authored
Jul 05, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 绿波实时数据状态优化
parent
80ab35e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
Constant.java
...src/main/java/net/wanji/datacenter/constant/Constant.java
+2
-0
LanePeriodicDataProcessServiceImpl.java
...nter/service/impl/LanePeriodicDataProcessServiceImpl.java
+17
-7
No files found.
wj-datacenter-service/src/main/java/net/wanji/datacenter/constant/Constant.java
View file @
f8243f8c
...
...
@@ -32,4 +32,6 @@ public class Constant {
public
static
final
String
REAL_TIME_TURN_DATA_TOPIC
=
"cross_real_time_turn_data"
;
public
static
final
String
REAL_TIME_CROSS_DATA_KEY
=
"crossRealTimeData"
;
public
static
final
String
REAL_TIME_CROSS_DATA_TOPIC
=
"cross_real_time_data"
;
private
Constant
()
{}
}
wj-datacenter-service/src/main/java/net/wanji/datacenter/service/impl/LanePeriodicDataProcessServiceImpl.java
View file @
f8243f8c
...
...
@@ -699,7 +699,6 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
for
(
Map
.
Entry
<
Integer
,
List
<
GreenwaveCrossPO
>>
entry
:
greenWaveInfoMap
.
entrySet
())
{
List
<
GreenwaveCrossPO
>
greenWaveCrossIds
=
entry
.
getValue
();
if
(!
CollectionUtils
.
isEmpty
(
greenWaveCrossIds
))
{
int
status
=
1
;
double
trafficIndex
=
1.0
;
Double
speedSum
=
0.0
;
Double
stopTimes
=
0.0
;
...
...
@@ -735,7 +734,6 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
String
crossIdDir
=
dirDataRealtimePO
.
getCrossId
();
Integer
dirType
=
dirDataRealtimePO
.
getDirType
();
if
(
StringUtils
.
equals
(
crossIdDir
,
crossId
)
&&
Objects
.
equals
(
inDir
,
dirType
))
{
status
=
status
>
dirDataRealtimePO
.
getStatus
()
?
status
:
dirDataRealtimePO
.
getStatus
();
trafficIndex
=
trafficIndex
>
dirDataRealtimePO
.
getTrafficIndex
()
?
trafficIndex
:
dirDataRealtimePO
.
getTrafficIndex
();
speedSum
+=
dirDataRealtimePO
.
getSpeed
();
stopTimes
+=
dirDataRealtimePO
.
getStopTimes
();
...
...
@@ -755,10 +753,10 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
noparkPassRateAvg
=
noparkPassRate
/
(
greenwaveCount
);
congRate
=
congCount
/
greenwaveCount
;
}
setTraffixIndex
(
decimalFormat
,
speedAvg
,
freeFlowSpeedAvg
,
greenwaveRealtimePO
);
// 计算交通指数,并设置status
setTraffixIndexAndStatus
(
decimalFormat
,
speedAvg
,
freeFlowSpeedAvg
,
greenwaveRealtimePO
);
greenwaveRealtimePO
.
setGreenId
(
greenWaveId
);
greenwaveRealtimePO
.
setStartTime
(
date
);
greenwaveRealtimePO
.
setStatus
(
status
);
greenwaveRealtimePO
.
setType
(
1
);
greenwaveRealtimePO
.
setSpeed
(
speedAvg
);
if
(
speedAvg
!=
0
)
{
...
...
@@ -795,7 +793,7 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
}
}
private
static
void
setTraffixIndex
(
DecimalFormat
decimalFormat
,
double
speedAvg
,
Double
freeFlowSpeedAvg
,
GreenwaveRealtimePO
greenwaveRealtimePO
)
{
private
static
void
setTraffixIndex
AndStatus
(
DecimalFormat
decimalFormat
,
double
speedAvg
,
Double
freeFlowSpeedAvg
,
GreenwaveRealtimePO
greenwaveRealtimePO
)
{
Double
greenwaveIndex
=
Double
.
valueOf
(
decimalFormat
.
format
(
freeFlowSpeedAvg
/
speedAvg
));
if
(
greenwaveIndex
>=
10
)
{
greenwaveRealtimePO
.
setTrafficIndex
(
10.0
);
...
...
@@ -804,6 +802,18 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
}
else
{
greenwaveRealtimePO
.
setTrafficIndex
(
1.0
);
}
// 根据指数设置status
int
status
=
1
;
if
(
greenwaveIndex
<=
1.8
)
{
status
=
1
;
}
else
if
(
greenwaveIndex
>
1.8
&&
greenwaveIndex
<=
2.5
)
{
status
=
2
;
}
else
if
(
greenwaveIndex
>
2.5
&&
greenwaveIndex
<=
3.5
)
{
status
=
3
;
}
else
if
(
greenwaveIndex
>
3.5
)
{
status
=
4
;
}
greenwaveRealtimePO
.
setStatus
(
status
);
}
private
static
Double
getFreeFlowSpeed
(
Double
freeFlowSpeed
,
String
crossId
,
Map
<
String
,
Double
>
crossFreeFlowSpeedMap
,
Integer
dirType
)
{
...
...
@@ -858,8 +868,8 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
// 替换干线旅行速度
po
.
setSpeed
(
lineCongestion
.
getSpeed
());
// 替换状态
String
congestion
Code
=
lineCongestion
.
getCongestionCod
e
();
if
(
EventAbnormalEnum
.
NO_CONGEST
.
getType
().
equals
(
congestion
Cod
e
))
{
String
congestion
Type
=
lineCongestion
.
getCongestionTyp
e
();
if
(
EventAbnormalEnum
.
NO_CONGEST
.
getType
().
equals
(
congestion
Typ
e
))
{
po
.
setStatus
(
1
);
}
else
{
po
.
setStatus
(
3
);
...
...
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