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
4cb329da
Commit
4cb329da
authored
Jan 16, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
6be6e63e
ec65fb62
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
22 deletions
+82
-22
EventServiceImpl.java
...ain/java/net/wanji/opt/service/impl/EventServiceImpl.java
+67
-22
GreenwaveHistMapper.java
...ava/net/wanji/databus/dao/mapper/GreenwaveHistMapper.java
+3
-0
GreenwaveHistMapper.xml
wj-databus/src/main/resources/mapper/GreenwaveHistMapper.xml
+12
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/EventServiceImpl.java
View file @
4cb329da
...
@@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -7,6 +7,8 @@ import lombok.extern.slf4j.Slf4j;
import
net.wanji.common.enums.BaseEnum
;
import
net.wanji.common.enums.BaseEnum
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.databus.dao.entity.GreenwaveHistPO
;
import
net.wanji.databus.dao.mapper.GreenwaveHistMapper
;
import
net.wanji.databus.dto.EventInfoTrafficStatusDTO
;
import
net.wanji.databus.dto.EventInfoTrafficStatusDTO
;
import
net.wanji.databus.po.EventInfoTrafficStatusPO
;
import
net.wanji.databus.po.EventInfoTrafficStatusPO
;
import
net.wanji.databus.vo.EventInfoTrafficStatusVO
;
import
net.wanji.databus.vo.EventInfoTrafficStatusVO
;
...
@@ -14,28 +16,11 @@ import net.wanji.opt.common.EsDateIndexUtil;
...
@@ -14,28 +16,11 @@ import net.wanji.opt.common.EsDateIndexUtil;
import
net.wanji.opt.common.enums.EventInfoTypeEnum
;
import
net.wanji.opt.common.enums.EventInfoTypeEnum
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
import
net.wanji.opt.dao.mapper.base.BaseRidInfoMapper
;
import
net.wanji.opt.dao.mapper.base.BaseRidInfoMapper
;
import
net.wanji.opt.dao.mapper.strategy.SceneMapper
;
import
net.wanji.opt.dao.mapper.strategy.SceneStrategyMapper
;
import
net.wanji.opt.dao.mapper.strategy.StrategyMapper
;
import
net.wanji.opt.entity.EventAlarmInfo
;
import
net.wanji.opt.entity.EventAlarmInfo
;
import
net.wanji.opt.po.base.BaseRidInfo
;
import
net.wanji.opt.po.base.BaseRidInfo
;
import
net.wanji.opt.po.base.CrossLaneDataHistPoExtend
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.po.strategy.ScenePO
;
import
net.wanji.opt.po.strategy.SceneStrategyPO
;
import
net.wanji.opt.po.strategy.StrategyPO
;
import
net.wanji.opt.po.trend.EventInfoSimplePo
;
import
net.wanji.opt.po.trend.EventInfoSimplePo
;
import
net.wanji.opt.po.trend.HoloEventInfoPO
;
import
net.wanji.opt.service.EventService
;
import
net.wanji.opt.service.EventService
;
import
net.wanji.opt.service.SchemeEvaluateService
;
import
net.wanji.opt.vo.RunningEvaluateMetricsDetailVO
;
import
net.wanji.opt.vo.SchemeEvaluateCrossSchemeListVO
;
import
net.wanji.opt.vo.SchemeEvaluateCurveChartVO
;
import
net.wanji.opt.vo.SchemeEvaluateProblemSchemeVO
;
import
net.wanji.opt.vo.SchemeEvaluateSchemeDetailOverallVO
;
import
net.wanji.opt.vo.SchemeEvaluateSchemeDetailedProblemVO
;
import
net.wanji.opt.vo.SchemeEvaluateStrategyMetricMenuVO
;
import
org.jetbrains.annotations.NotNull
;
import
org.joda.time.DateTime
;
import
org.joda.time.DateTime
;
import
org.joda.time.Minutes
;
import
org.joda.time.Minutes
;
import
org.joda.time.Seconds
;
import
org.joda.time.Seconds
;
...
@@ -58,6 +43,9 @@ public class EventServiceImpl implements EventService {
...
@@ -58,6 +43,9 @@ public class EventServiceImpl implements EventService {
@Resource
@Resource
BaseRidInfoMapper
baseRidInfoMapper
;
BaseRidInfoMapper
baseRidInfoMapper
;
@Resource
GreenwaveHistMapper
greenwaveHistMapper
;
@Override
@Override
public
EventStatisticPo
findCrossEventCount
(
String
crossId
,
String
type
,
String
startTime
,
String
endTime
)
throws
DubboProviderException
{
public
EventStatisticPo
findCrossEventCount
(
String
crossId
,
String
type
,
String
startTime
,
String
endTime
)
throws
DubboProviderException
{
...
@@ -209,16 +197,40 @@ public class EventServiceImpl implements EventService {
...
@@ -209,16 +197,40 @@ public class EventServiceImpl implements EventService {
public
EventInfoTrafficStatusVO
trafficStatus
(
EventInfoTrafficStatusDTO
eventInfoTrafficStatusDTO
)
throws
DubboProviderException
{
public
EventInfoTrafficStatusVO
trafficStatus
(
EventInfoTrafficStatusDTO
eventInfoTrafficStatusDTO
)
throws
DubboProviderException
{
EventInfoTrafficStatusVO
eventInfoTrafficStatusVO
=
new
EventInfoTrafficStatusVO
();
EventInfoTrafficStatusVO
eventInfoTrafficStatusVO
=
new
EventInfoTrafficStatusVO
();
String
eventType
=
eventInfoTrafficStatusDTO
.
getEventType
();
String
eventType
=
eventInfoTrafficStatusDTO
.
getEventType
();
Integer
queryType
=
eventInfoTrafficStatusDTO
.
getQueryType
();
List
<
EventInfoTrafficStatusPO
>
eventInfoTrafficStatusPOS
=
null
;
if
(
ObjectUtil
.
equals
(
1
,
queryType
)){
//路口
//获取type
//获取type
String
type
=
EventInfoTypeEnum
.
getEventInfoTypeEnum
(
Integer
.
valueOf
(
eventType
)).
getEventType
();
String
type
=
EventInfoTypeEnum
.
getEventInfoTypeEnum
(
Integer
.
valueOf
(
eventType
)).
getEventType
();
eventInfoTrafficStatusDTO
.
setEventType
(
type
);
eventInfoTrafficStatusDTO
.
setEventType
(
type
);
List
<
EventInfoTrafficStatusPO
>
eventInfoTrafficStatusPOS
=
holoEventMapper
.
trafficStatus
(
eventInfoTrafficStatusDTO
);
eventInfoTrafficStatusPOS
=
holoEventMapper
.
trafficStatus
(
eventInfoTrafficStatusDTO
);
}
else
{
//干线
List
<
Integer
>
statusList
=
new
ArrayList
<>();
if
(
ObjectUtil
.
equals
(
"6"
,
eventType
)){
//干线缓行
statusList
.
add
(
2
);
}
else
{
//干线拥堵
statusList
.
add
(
3
);
statusList
.
add
(
4
);
}
List
<
GreenwaveHistPO
>
greenwaveHistPOS
=
greenwaveHistMapper
.
selectByIdAndType
(
Integer
.
valueOf
(
eventInfoTrafficStatusDTO
.
getId
()),
statusList
);
if
(
ObjectUtil
.
isNotEmpty
(
greenwaveHistPOS
)){
eventInfoTrafficStatusPOS
=
new
ArrayList
<
EventInfoTrafficStatusPO
>();
Map
<
Integer
,
List
<
GreenwaveHistPO
>>
collect
=
greenwaveHistPOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
x
->
x
.
getStartTime
().
getHours
()));
for
(
Map
.
Entry
<
Integer
,
List
<
GreenwaveHistPO
>>
entry
:
collect
.
entrySet
())
{
eventInfoTrafficStatusPOS
.
add
(
handerEntry
(
entry
));
}
}
}
//获取当前时间的时间轴
//获取当前时间的时间轴
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
());
eventInfoTrafficStatusVO
.
setTimeList
(
collect
);
eventInfoTrafficStatusVO
.
setTimeList
(
collect
);
//补充全部数据
//补充全部数据
if
(
ObjectUtil
.
isEmpty
(
eventInfoTrafficStatusPOS
))
{
if
(
ObjectUtil
.
isEmpty
(
eventInfoTrafficStatusPOS
))
{
...
@@ -248,6 +260,39 @@ public class EventServiceImpl implements EventService {
...
@@ -248,6 +260,39 @@ public class EventServiceImpl implements EventService {
return
eventInfoTrafficStatusVO
;
return
eventInfoTrafficStatusVO
;
}
}
/**
* @Description 干线数据处理
* @Param [entry]
* @return net.wanji.databus.po.EventInfoTrafficStatusPO
**/
private
EventInfoTrafficStatusPO
handerEntry
(
Map
.
Entry
<
Integer
,
List
<
GreenwaveHistPO
>>
entry
){
EventInfoTrafficStatusPO
eventInfoTrafficStatusPO
=
new
EventInfoTrafficStatusPO
();
Integer
hour
=
entry
.
getKey
();
String
timeAxisStart
=
null
;
if
(
hour
<=
9
){
timeAxisStart
=
"0"
+
entry
.
getKey
()
+
":00"
;
}
else
{
timeAxisStart
=
entry
.
getKey
()
+
":00"
;
}
int
count
=
0
;
List
<
GreenwaveHistPO
>
value
=
entry
.
getValue
();
for
(
int
i
=
0
;
i
<
value
.
size
();
i
++)
{
if
(
i
==
0
){
count
++;
}
else
{
if
(
value
.
get
(
i
).
getStartTime
().
getTime
()
-
value
.
get
(
i
-
1
).
getStartTime
().
getTime
()
>=
300
)
{
count
++;
}
}
}
int
duration
=
value
.
size
()*
300
;
eventInfoTrafficStatusPO
.
setDuration
(
duration
);
eventInfoTrafficStatusPO
.
setCount
(
count
);
eventInfoTrafficStatusPO
.
setTimeAxisStart
(
timeAxisStart
);
return
eventInfoTrafficStatusPO
;
}
/**
/**
* @return java.util.List<java.lang.Integer>
* @return java.util.List<java.lang.Integer>
* @Description 根据集合长度,获取默认0补充的list
* @Description 根据集合长度,获取默认0补充的list
...
...
wj-databus/src/main/java/net/wanji/databus/dao/mapper/GreenwaveHistMapper.java
View file @
4cb329da
...
@@ -22,4 +22,7 @@ public interface GreenwaveHistMapper extends BaseMapper<GreenwaveHistPO> {
...
@@ -22,4 +22,7 @@ public interface GreenwaveHistMapper extends BaseMapper<GreenwaveHistPO> {
List
<
GreenwaveHistPO
>
selectByIdAndTimeSection
(
Integer
greenwaveId
,
String
startTimeStr
,
String
endTimeStr
);
List
<
GreenwaveHistPO
>
selectByIdAndTimeSection
(
Integer
greenwaveId
,
String
startTimeStr
,
String
endTimeStr
);
int
insertBatch
(
@Param
(
"list"
)
List
<
GreenwaveHistPO
>
list
);
int
insertBatch
(
@Param
(
"list"
)
List
<
GreenwaveHistPO
>
list
);
List
<
GreenwaveHistPO
>
selectByIdAndType
(
@Param
(
"greenwaveId"
)
Integer
greenwaveId
,
@Param
(
"statusList"
)
List
<
Integer
>
statusList
);
}
}
wj-databus/src/main/resources/mapper/GreenwaveHistMapper.xml
View file @
4cb329da
...
@@ -107,4 +107,16 @@
...
@@ -107,4 +107,16 @@
gmt_modified = values(gmt_modified)
gmt_modified = values(gmt_modified)
</insert>
</insert>
<select
id=
"selectByIdAndType"
resultType=
"net.wanji.databus.dao.entity.GreenwaveHistPO"
>
select
<include
refid=
"Base_Column_List"
/>
from t_greenwave_hist
where green_id = #{greenwaveId}
and status in
<foreach
collection=
"statusList"
item=
"status"
separator=
","
open=
"("
close=
")"
>
#{status}
</foreach>
and start_time
>
= DATE_FORMAT(now(), '%Y-%m-%d 00:00:00')
order by start_time asc
</select>
</mapper>
</mapper>
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