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
4def243c
Commit
4def243c
authored
Oct 23, 2023
by
zhoushiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1da752b4
918a5279
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
145 additions
and
46 deletions
+145
-46
CrossDirWeekMaxFlowCache.java
.../net/wanji/datacenter/cache/CrossDirWeekMaxFlowCache.java
+5
-5
CrossRealTimeCache.java
...n/java/net/wanji/datacenter/cache/CrossRealTimeCache.java
+3
-1
CrossTurnWeekMaxFlowCache.java
...net/wanji/datacenter/cache/CrossTurnWeekMaxFlowCache.java
+78
-0
WeekFreeFlowSpeedCache.java
...va/net/wanji/datacenter/cache/WeekFreeFlowSpeedCache.java
+1
-5
Constants.java
.../src/main/java/net/wanji/datacenter/common/Constants.java
+5
-1
CrossDataIndexDTO.java
...java/net/wanji/datacenter/pojo/dto/CrossDataIndexDTO.java
+1
-0
LanePeriodicDataProcessServiceImpl.java
...nter/service/impl/LanePeriodicDataProcessServiceImpl.java
+52
-34
No files found.
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/CrossWeekMaxFlowCache.java
→
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/Cross
Dir
WeekMaxFlowCache.java
View file @
4def243c
...
...
@@ -13,9 +13,9 @@ import javax.annotation.Resource;
import
java.time.LocalDate
;
import
java.time.temporal.ChronoUnit
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -24,9 +24,9 @@ import java.util.stream.Collectors;
*/
@Component
@Slf4j
public
class
CrossWeekMaxFlowCache
implements
CommandLineRunner
{
public
class
Cross
Dir
WeekMaxFlowCache
implements
CommandLineRunner
{
public
static
final
Map
<
String
,
Integer
>
cross
WeekMaxFlowMap
=
new
Concurrent
HashMap
<>();
public
static
final
Map
<
String
,
Integer
>
cross
DirWeekMaxFlowMap
=
new
HashMap
<>();
@Resource
private
CrossDirDataHistMapper
crossDirDataHistMapper
;
...
...
@@ -50,7 +50,7 @@ public class CrossWeekMaxFlowCache implements CommandLineRunner {
Integer
dir
=
entry
.
getKey
();
List
<
CrossDirDataHistPO
>
dirDataHistPOS
=
entry
.
getValue
();
int
dirFlowMax
=
dirDataHistPOS
.
stream
().
map
(
CrossDirDataHistPO:
:
getFlow
).
mapToInt
(
Integer:
:
intValue
).
max
().
getAsInt
();
crossWeekMaxFlowMap
.
put
(
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)),
dirFlowMax
);
cross
Dir
WeekMaxFlowMap
.
put
(
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)),
dirFlowMax
);
}
}
}
...
...
@@ -65,7 +65,7 @@ public class CrossWeekMaxFlowCache implements CommandLineRunner {
log
.
error
(
"7天内路口方向最大流量获取失败"
,
e
);
throw
new
Exception
(
e
);
}
log
.
info
(
"7天内路口方向最大流量:{}"
,
crossWeekMaxFlowMap
);
log
.
info
(
"7天内路口方向最大流量:{}"
,
cross
Dir
WeekMaxFlowMap
);
}
}
\ No newline at end of file
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/CrossRealTimeCache.java
View file @
4def243c
...
...
@@ -3,7 +3,9 @@ package net.wanji.datacenter.cache;
import
net.wanji.datacenter.pojo.dto.CrossDataIndexDTO
;
import
net.wanji.datacenter.pojo.dto.CrossStatusDurationDTO
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -13,8 +15,8 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public
class
CrossRealTimeCache
{
public
static
final
Map
<
String
,
CrossDataIndexDTO
>
crossDataIndexMap
=
new
HashMap
<>();
public
static
final
Map
<
String
,
CrossStatusDurationDTO
>
crossStatusMap
=
new
HashMap
<>();
public
final
static
ConcurrentHashMap
<
String
,
Integer
>
crossPhaseCarNumsMap
=
new
ConcurrentHashMap
<>();
public
final
static
ConcurrentHashMap
<
String
,
Double
>
crossPhaseIdClearGreenMap
=
new
ConcurrentHashMap
<>();
public
final
static
ConcurrentHashMap
<
String
,
List
<
Double
>>
crossDelayTimeIndexMap
=
new
ConcurrentHashMap
<>();
}
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/CrossTurnWeekMaxFlowCache.java
0 → 100644
View file @
4def243c
package
net
.
wanji
.
datacenter
.
cache
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.databus.dao.mapper.CrossTurnDataHistMapper
;
import
net.wanji.databus.po.CrossTurnDataHistPO
;
import
net.wanji.datacenter.common.Constants
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.time.temporal.ChronoUnit
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author duanruiming
* @date 2023/10/19 15:33
*/
@Component
@Slf4j
public
class
CrossTurnWeekMaxFlowCache
implements
CommandLineRunner
{
public
static
final
Map
<
String
,
Integer
>
crossTurnWeekMaxFlowMap
=
new
HashMap
<>();
@Resource
private
CrossTurnDataHistMapper
crossTurnDataHistMapper
;
private
void
getTurnMaxFlow
()
throws
Exception
{
LocalDate
currentDate
=
LocalDate
.
now
();
LocalDate
lastDay
=
currentDate
.
minus
(
1
,
ChronoUnit
.
DAYS
);
LocalDate
lastWeek
=
currentDate
.
minus
(
1
,
ChronoUnit
.
WEEKS
);
List
<
String
>
crossIds
=
Arrays
.
asList
(
"13NF80B5QN0"
,
"13NGH0B5RC0"
,
"13NI00B5RM0"
);
for
(
String
crossId
:
crossIds
)
{
// 前一周
LambdaQueryWrapper
<
CrossTurnDataHistPO
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
CrossTurnDataHistPO:
:
getCrossId
,
crossId
);
queryWrapper
.
between
(
CrossTurnDataHistPO:
:
getStartTime
,
lastWeek
,
lastDay
);
List
<
CrossTurnDataHistPO
>
crossTurnDataHistPOS
=
crossTurnDataHistMapper
.
selectList
(
queryWrapper
);
if
(!
CollectionUtils
.
isEmpty
(
crossTurnDataHistPOS
))
{
Map
<
Integer
,
List
<
CrossTurnDataHistPO
>>
dirDataPOsMap
=
crossTurnDataHistPOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossTurnDataHistPO:
:
getInDir
));
for
(
Map
.
Entry
<
Integer
,
List
<
CrossTurnDataHistPO
>>
entry
:
dirDataPOsMap
.
entrySet
())
{
Integer
dir
=
entry
.
getKey
();
List
<
CrossTurnDataHistPO
>
dirHistPOS
=
entry
.
getValue
();
if
(!
CollectionUtils
.
isEmpty
(
dirHistPOS
))
{
Map
<
String
,
List
<
CrossTurnDataHistPO
>>
turnDataPOMap
=
dirHistPOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossTurnDataHistPO:
:
getTurnType
));
for
(
Map
.
Entry
<
String
,
List
<
CrossTurnDataHistPO
>>
turnEntry
:
turnDataPOMap
.
entrySet
())
{
String
turn
=
turnEntry
.
getKey
();
List
<
CrossTurnDataHistPO
>
turnDataHistPOList
=
turnEntry
.
getValue
();
if
(!
CollectionUtils
.
isEmpty
(
turnDataHistPOList
))
{
int
turnFlowsMax
=
turnDataHistPOList
.
stream
().
map
(
CrossTurnDataHistPO:
:
getFlow
).
mapToInt
(
Integer:
:
intValue
).
max
().
getAsInt
();
String
key
=
crossId
.
concat
(
Constants
.
underline
).
concat
(
String
.
valueOf
(
dir
)).
concat
(
Constants
.
underline
).
concat
(
turn
);
crossTurnWeekMaxFlowMap
.
put
(
key
,
turnFlowsMax
);
}
}
}
}
}
}
}
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
try
{
getTurnMaxFlow
();
}
catch
(
Exception
e
)
{
log
.
error
(
"7天内路口方向转向最大流量获取失败"
,
e
);
throw
new
Exception
(
e
);
}
log
.
info
(
"7天内路口方向转向最大流量:{}"
,
crossTurnWeekMaxFlowMap
);
}
}
\ No newline at end of file
wj-datacenter-service/src/main/java/net/wanji/datacenter/cache/WeekFreeFlowSpeedCache.java
View file @
4def243c
package
net
.
wanji
.
datacenter
.
cache
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.databus.dao.mapper.CrossDirDataHistMapper
;
import
net.wanji.databus.po.CrossDirDataHistPO
;
import
net.wanji.datacenter.kafka.ProducerHandler
;
...
...
@@ -17,7 +14,6 @@ import javax.annotation.Resource;
import
java.time.LocalDate
;
import
java.time.temporal.ChronoUnit
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -28,7 +24,7 @@ import java.util.stream.Collectors;
@Slf4j
public
class
WeekFreeFlowSpeedCache
implements
CommandLineRunner
{
public
static
final
Map
<
String
,
Double
>
crossFreeFlowSpeedMap
=
new
Concurrent
HashMap
<>();
public
static
final
Map
<
String
,
Double
>
crossFreeFlowSpeedMap
=
new
HashMap
<>();
@Resource
private
CrossDirDataHistMapper
crossDirDataHistMapper
;
...
...
wj-datacenter-service/src/main/java/net/wanji/datacenter/common/Constants.java
View file @
4def243c
package
net
.
wanji
.
datacenter
.
common
;
import
java.util.StringJoiner
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* @author duanruiming
...
...
@@ -8,4 +9,7 @@ import java.util.StringJoiner;
*/
public
class
Constants
{
public
static
final
String
underline
=
"_"
;
// 横向方向列表
public
static
final
List
<
Integer
>
X_DIR_LIST
=
Arrays
.
asList
(
2
,
3
,
6
,
7
);
}
\ No newline at end of file
wj-datacenter-service/src/main/java/net/wanji/datacenter/pojo/dto/CrossDataIndexDTO.java
View file @
4def243c
...
...
@@ -16,5 +16,6 @@ public class CrossDataIndexDTO {
private
Double
spillOverIndex
;
private
String
spillOverDirs
;
private
Double
loadBalance
;
private
Integer
status
;
}
wj-datacenter-service/src/main/java/net/wanji/datacenter/service/impl/LanePeriodicDataProcessServiceImpl.java
View file @
4def243c
This diff is collapsed.
Click to expand it.
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