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
b3be9964
Commit
b3be9964
authored
Jun 28, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] review-优化常量字段名称
parent
d3372495
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
16 additions
and
13 deletions
+16
-13
CrossDirWeekAvgFlowCache.java
.../net/wanji/datacenter/cache/CrossDirWeekAvgFlowCache.java
+5
-2
CrossDirWeekMaxFlowCache.java
.../net/wanji/datacenter/cache/CrossDirWeekMaxFlowCache.java
+1
-1
CrossTurnWeekMaxFlowCache.java
...net/wanji/datacenter/cache/CrossTurnWeekMaxFlowCache.java
+1
-1
WeekDirFreeFlowSpeedCache.java
...net/wanji/datacenter/cache/WeekDirFreeFlowSpeedCache.java
+1
-1
WeekTurnFreeFlowSpeedCache.java
...et/wanji/datacenter/cache/WeekTurnFreeFlowSpeedCache.java
+1
-1
Constants.java
.../src/main/java/net/wanji/datacenter/common/Constants.java
+1
-1
LanePeriodicDataProcessServiceImpl.java
...nter/service/impl/LanePeriodicDataProcessServiceImpl.java
+6
-6
No files found.
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/CrossDirWeekAvgFlowCache.java
View file @
b3be9964
...
...
@@ -12,7 +12,10 @@ import org.springframework.util.CollectionUtils;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.OptionalDouble
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -51,7 +54,7 @@ public class CrossDirWeekAvgFlowCache implements CommandLineRunner {
if
(
average
.
isPresent
())
{
dirFlowAvg
=
average
.
getAsDouble
()
==
0.0
?
1.0
:
average
.
getAsDouble
();
}
crossDirWeekAvgFlowMap
.
put
(
currentCrossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)),
dirFlowAvg
);
crossDirWeekAvgFlowMap
.
put
(
currentCrossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)),
dirFlowAvg
);
}
}
}
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/CrossDirWeekMaxFlowCache.java
View file @
b3be9964
...
...
@@ -50,7 +50,7 @@ public class CrossDirWeekMaxFlowCache implements CommandLineRunner {
List
<
CrossDirDataHistPO
>
dirDataHistPOS
=
entry
.
getValue
();
String
currentCrossId
=
dirDataHistPOS
.
get
(
0
).
getCrossId
();
int
dirFlowMax
=
dirDataHistPOS
.
stream
().
map
(
CrossDirDataHistPO:
:
getFlow
).
mapToInt
(
Integer:
:
intValue
).
max
().
getAsInt
();
crossDirWeekMaxFlowMap
.
put
(
currentCrossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)),
dirFlowMax
);
crossDirWeekMaxFlowMap
.
put
(
currentCrossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)),
dirFlowMax
);
}
}
}
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/CrossTurnWeekMaxFlowCache.java
View file @
b3be9964
...
...
@@ -55,7 +55,7 @@ public class CrossTurnWeekMaxFlowCache implements CommandLineRunner {
if
(!
CollectionUtils
.
isEmpty
(
turnDataHistPOList
))
{
OptionalInt
max
=
turnDataHistPOList
.
stream
().
map
(
CrossTurnDataHistPO:
:
getFlow
).
mapToInt
(
Integer:
:
intValue
).
max
();
if
(
max
.
isPresent
())
{
String
key
=
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)).
concat
(
Constants
.
underline
).
concat
(
turn
);
String
key
=
crossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)).
concat
(
Constants
.
UNDERLINE
).
concat
(
turn
);
crossTurnWeekMaxFlowMap
.
put
(
key
,
max
.
getAsInt
());
}
}
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/WeekDirFreeFlowSpeedCache.java
View file @
b3be9964
...
...
@@ -60,7 +60,7 @@ public class WeekDirFreeFlowSpeedCache implements CommandLineRunner {
if
(
freeFlowSpeed
==
0.0
)
{
freeFlowSpeed
=
60.0
;
}
crossDirFreeFlowSpeedMap
.
put
(
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)),
freeFlowSpeed
);
crossDirFreeFlowSpeedMap
.
put
(
crossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)),
freeFlowSpeed
);
CrossDirFreeFlowSpeedDTO
crossDirFreeFlowSpeedDTO
=
new
CrossDirFreeFlowSpeedDTO
();
crossDirFreeFlowSpeedDTO
.
setCrossId
(
crossId
);
crossDirFreeFlowSpeedDTO
.
setDir
(
dir
);
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/WeekTurnFreeFlowSpeedCache.java
View file @
b3be9964
...
...
@@ -62,7 +62,7 @@ public class WeekTurnFreeFlowSpeedCache implements CommandLineRunner {
OptionalDouble
average
=
weekTurnSpeeds
.
subList
(
startIndex
,
endIndex
).
stream
().
mapToDouble
(
Double:
:
doubleValue
).
average
();
if
(
average
.
isPresent
())
{
double
turnFreeFlowSpeed
=
average
.
getAsDouble
();
String
key
=
currentCrossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)).
concat
(
Constants
.
underline
).
concat
(
turn
);
String
key
=
currentCrossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)).
concat
(
Constants
.
UNDERLINE
).
concat
(
turn
);
crossTurnFreeFlowSpeedMap
.
put
(
key
,
turnFreeFlowSpeed
);
}
}
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/common/Constants.java
View file @
b3be9964
...
...
@@ -8,7 +8,7 @@ import java.util.List;
* @date 2023/09/22 9:50
*/
public
class
Constants
{
public
static
final
String
underline
=
"_"
;
public
static
final
String
UNDERLINE
=
"_"
;
// 横向方向列表
public
static
final
List
<
Integer
>
X_DIR_LIST
=
Arrays
.
asList
(
2
,
3
,
6
,
7
);
public
static
final
String
LANE_SNAPSHOT_DATA_ES_INDEX
=
"datacenter_lane_snapshot_data"
;
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/service/impl/LanePeriodicDataProcessServiceImpl.java
View file @
b3be9964
...
...
@@ -252,8 +252,8 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
speedLaneCount
=
1
;
}
StringJoiner
stringJoiner
=
new
StringJoiner
(
""
);
String
crossTurnId
=
stringJoiner
.
add
(
crossId
).
add
(
Constants
.
underline
).
add
(
String
.
valueOf
(
inDir
))
.
add
(
Constants
.
underline
).
add
(
turnType
).
toString
();
String
crossTurnId
=
stringJoiner
.
add
(
crossId
).
add
(
Constants
.
UNDERLINE
).
add
(
String
.
valueOf
(
inDir
))
.
add
(
Constants
.
UNDERLINE
).
add
(
turnType
).
toString
();
crossTurnDataRealTimePO
.
setId
(
crossTurnId
);
crossTurnDataRealTimePO
.
setCrossId
(
crossId
);
crossTurnDataRealTimePO
.
setTurnType
(
turnType
);
...
...
@@ -374,7 +374,7 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
Double
dirSaturation
=
0.0
;
// 通过方向七天流量最大值计算饱和度
Map
<
String
,
Integer
>
crossWeekMaxFlowMap
=
CrossDirWeekMaxFlowCache
.
crossDirWeekMaxFlowMap
;
if
(
Objects
.
nonNull
(
crossWeekMaxFlowMap
)
&&
!
crossWeekMaxFlowMap
.
isEmpty
())
{
Integer
dirMaxFlow
=
crossWeekMaxFlowMap
.
get
(
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)));
Integer
dirMaxFlow
=
crossWeekMaxFlowMap
.
get
(
crossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)));
if
(
Objects
.
isNull
(
dirMaxFlow
)
||
dirMaxFlow
==
0
)
{
dirMaxFlow
=
100
;
}
...
...
@@ -382,7 +382,7 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
}
crossDirDataRealTimePO
.
setSturation
((
Double
.
valueOf
(
decimalFormat
.
format
(
dirSaturation
))));
// 平均饱和度
Double
dirFlowAvg
=
CrossDirWeekAvgFlowCache
.
crossDirWeekAvgFlowMap
.
get
(
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)));
Double
dirFlowAvg
=
CrossDirWeekAvgFlowCache
.
crossDirWeekAvgFlowMap
.
get
(
crossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)));
if
(
Objects
.
nonNull
(
dirFlowAvg
))
{
saturationAverage
=
flow
/
dirFlowAvg
;
}
...
...
@@ -390,7 +390,7 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
// 所有方向饱和度平方后求和
saturationSum
+=
(
dirSaturation
-
saturationAverage
)
*
(
dirSaturation
-
saturationAverage
);
StringJoiner
stringJoiner
=
new
StringJoiner
(
""
);
stringJoiner
.
add
(
crossId
).
add
(
Constants
.
underline
).
add
(
String
.
valueOf
(
dir
)).
add
(
Constants
.
underline
).
add
(
"1"
).
add
(
Constants
.
underline
).
add
(
"1"
);
stringJoiner
.
add
(
crossId
).
add
(
Constants
.
UNDERLINE
).
add
(
String
.
valueOf
(
dir
)).
add
(
Constants
.
UNDERLINE
).
add
(
"1"
).
add
(
Constants
.
UNDERLINE
).
add
(
"1"
);
crossDirDataRealTimePO
.
setId
(
stringJoiner
.
toString
());
crossDirDataRealTimePO
.
setCrossId
(
crossId
);
crossDirDataRealTimePO
.
setDirType
(
dir
);
...
...
@@ -425,7 +425,7 @@ public class LanePeriodicDataProcessServiceImpl implements DataProcessService {
if
(
Constants
.
X_DIR_LIST
.
contains
(
dir
))
{
// 东西方向自由流计算延时指数
Map
<
String
,
Double
>
crossFreeFlowSpeedMap
=
WeekDirFreeFlowSpeedCache
.
crossDirFreeFlowSpeedMap
;
if
(!
crossFreeFlowSpeedMap
.
isEmpty
())
{
Double
freeFlowSpeed
=
crossFreeFlowSpeedMap
.
get
(
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)));
Double
freeFlowSpeed
=
crossFreeFlowSpeedMap
.
get
(
crossId
.
concat
(
Constants
.
UNDERLINE
).
concat
(
String
.
valueOf
(
dir
)));
if
(
Objects
.
isNull
(
freeFlowSpeed
)
||
freeFlowSpeed
==
0.0
)
{
freeFlowSpeed
=
60.0
;
}
...
...
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