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
b3346a1e
Commit
b3346a1e
authored
Jan 15, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方向处理
parent
ec7a762a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
EventServiceImpl.java
...ain/java/net/wanji/opt/service/impl/EventServiceImpl.java
+12
-4
HoloEventMapper.xml
...ize-service/src/main/resources/mapper/HoloEventMapper.xml
+1
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/EventServiceImpl.java
View file @
b3346a1e
package
net
.
wanji
.
opt
.
service
.
impl
;
package
net
.
wanji
.
opt
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.framework.exception.DubboProviderException
;
...
@@ -72,9 +73,14 @@ public class EventServiceImpl implements EventService {
...
@@ -72,9 +73,14 @@ public class EventServiceImpl implements EventService {
Map
<
String
,
Long
>
countMap
=
null
;
Map
<
String
,
Long
>
countMap
=
null
;
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
dirs
))
{
if
(
Objects
.
nonNull
(
dirs
))
{
String
[]
sps
=
dirs
.
split
(
","
);
String
[]
dirList
=
dirs
.
split
(
"@"
);
List
<
String
>
allDirList
=
new
ArrayList
<>();
for
(
String
dirArr
:
dirList
)
{
List
<
String
>
jsonArray
=
JSONArray
.
parseArray
(
dirArr
,
String
.
class
);
allDirList
.
addAll
(
jsonArray
.
stream
().
map
(
o
->(
Integer
.
valueOf
(
o
).
toString
())).
distinct
().
collect
(
Collectors
.
toList
()));
}
//统计每个方向发生的次数
//统计每个方向发生的次数
countMap
=
Arrays
.
stream
(
sps
).
collect
(
Collectors
.
groupingBy
(
String:
:
valueOf
,
Collectors
.
counting
()));
countMap
=
allDirList
.
stream
(
).
collect
(
Collectors
.
groupingBy
(
String:
:
valueOf
,
Collectors
.
counting
()));
countMap
.
entrySet
().
forEach
(
o
->
{
countMap
.
entrySet
().
forEach
(
o
->
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"dir"
,
o
.
getKey
());
map
.
put
(
"dir"
,
o
.
getKey
());
...
@@ -208,7 +214,7 @@ public class EventServiceImpl implements EventService {
...
@@ -208,7 +214,7 @@ public class EventServiceImpl implements EventService {
List
<
EventInfoTrafficStatusPO
>
eventInfoTrafficStatusPOS
=
holoEventMapper
.
trafficStatus
(
eventInfoTrafficStatusDTO
);
List
<
EventInfoTrafficStatusPO
>
eventInfoTrafficStatusPOS
=
holoEventMapper
.
trafficStatus
(
eventInfoTrafficStatusDTO
);
//获取当前时间的时间轴
//获取当前时间的时间轴
Set
<
String
>
timeScopeList
=
getTimeScopeList
(
DateTime
.
now
().
withTimeAtStartOfDay
(),
new
DateTime
(),
EsDateIndexUtil
.
H_FORMATTER
);
Set
<
String
>
timeScopeList
=
getTimeScopeList
(
DateTime
.
now
().
withTimeAtStartOfDay
(),
new
DateTime
(),
EsDateIndexUtil
.
H_FORMATTER
);
if
(
ObjectUtil
.
isNotEmpty
(
timeScopeList
)){
if
(
ObjectUtil
.
isNotEmpty
(
timeScopeList
))
{
ArrayList
<
String
>
arrayList
=
timeScopeList
.
stream
().
collect
(
Collectors
.
toCollection
(
ArrayList:
:
new
));
ArrayList
<
String
>
arrayList
=
timeScopeList
.
stream
().
collect
(
Collectors
.
toCollection
(
ArrayList:
:
new
));
List
<
String
>
collect
=
arrayList
.
stream
().
sorted
(
Comparator
.
comparing
(
time
->
Integer
.
valueOf
(
time
.
split
(
":"
)[
0
]))).
collect
(
Collectors
.
toList
());
List
<
String
>
collect
=
arrayList
.
stream
().
sorted
(
Comparator
.
comparing
(
time
->
Integer
.
valueOf
(
time
.
split
(
":"
)[
0
]))).
collect
(
Collectors
.
toList
());
...
@@ -223,7 +229,7 @@ public class EventServiceImpl implements EventService {
...
@@ -223,7 +229,7 @@ public class EventServiceImpl implements EventService {
List
<
String
>
timeList
=
eventInfoTrafficStatusPOS
.
stream
().
map
(
EventInfoTrafficStatusPO:
:
getTimeAxisStart
).
collect
(
Collectors
.
toList
());
List
<
String
>
timeList
=
eventInfoTrafficStatusPOS
.
stream
().
map
(
EventInfoTrafficStatusPO:
:
getTimeAxisStart
).
collect
(
Collectors
.
toList
());
//补充缺少时段数据
//补充缺少时段数据
for
(
String
s
:
timeScopeList
)
{
for
(
String
s
:
timeScopeList
)
{
if
(!
timeList
.
contains
(
s
)){
if
(!
timeList
.
contains
(
s
))
{
EventInfoTrafficStatusPO
eventInfoTrafficStatusPO
=
new
EventInfoTrafficStatusPO
();
EventInfoTrafficStatusPO
eventInfoTrafficStatusPO
=
new
EventInfoTrafficStatusPO
();
eventInfoTrafficStatusPO
.
setDuration
(
0
);
eventInfoTrafficStatusPO
.
setDuration
(
0
);
eventInfoTrafficStatusPO
.
setCount
(
0
);
eventInfoTrafficStatusPO
.
setCount
(
0
);
...
@@ -240,6 +246,7 @@ public class EventServiceImpl implements EventService {
...
@@ -240,6 +246,7 @@ public class EventServiceImpl implements EventService {
}
}
return
eventInfoTrafficStatusVO
;
return
eventInfoTrafficStatusVO
;
}
}
/**
/**
* @return java.util.List<java.lang.Integer>
* @return java.util.List<java.lang.Integer>
* @Description 根据集合长度,获取默认0补充的list
* @Description 根据集合长度,获取默认0补充的list
...
@@ -252,6 +259,7 @@ public class EventServiceImpl implements EventService {
...
@@ -252,6 +259,7 @@ public class EventServiceImpl implements EventService {
}
}
return
list
;
return
list
;
}
}
@Override
@Override
public
List
<
EventAlarmInfo
>
findEventAlarmInfo
(
String
realtimeType
,
String
eventType
,
String
name
)
throws
DubboProviderException
{
public
List
<
EventAlarmInfo
>
findEventAlarmInfo
(
String
realtimeType
,
String
eventType
,
String
name
)
throws
DubboProviderException
{
//获取数据库数据
//获取数据库数据
...
...
signal-optimize-service/src/main/resources/mapper/HoloEventMapper.xml
View file @
b3346a1e
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
<!-- 查看路口事件数量 -->
<!-- 查看路口事件数量 -->
<select
id=
"findCrossEventCount"
resultType=
"net.wanji.opt.po.base.EventStatisticPo"
>
<select
id=
"findCrossEventCount"
resultType=
"net.wanji.opt.po.base.EventStatisticPo"
>
select cross_id, type as event_type,count(*) event_count,group_concat(dir) dirs,b.label as event_type_desc
select cross_id, type as event_type,count(*) event_count,group_concat(dir
SEPARATOR '@'
) dirs,b.label as event_type_desc
from t_event_info a left join t_config_event_category b on a.type=b.event_type
from t_event_info a left join t_config_event_category b on a.type=b.event_type
where 1=1
where 1=1
<if
test=
"crossId !=null and crossId !=''"
>
<if
test=
"crossId !=null and crossId !=''"
>
...
...
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