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
2913816b
Commit
2913816b
authored
Jan 14, 2025
by
zhouleilei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add]路口监测、干线监测-交通状态
parent
a9d2f8a1
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
256 additions
and
137 deletions
+256
-137
EventInfoTypeEnum.java
...in/java/net/wanji/opt/common/enums/EventInfoTypeEnum.java
+15
-0
EventController.java
...c/main/java/net/wanji/opt/controller/EventController.java
+23
-18
HoloEventMapper.java
...c/main/java/net/wanji/opt/dao/mapper/HoloEventMapper.java
+4
-1
EventService.java
...ice/src/main/java/net/wanji/opt/service/EventService.java
+10
-40
EventServiceImpl.java
...ain/java/net/wanji/opt/service/impl/EventServiceImpl.java
+63
-77
HoloEventMapper.xml
...ize-service/src/main/resources/mapper/HoloEventMapper.xml
+23
-0
ControlCommandStrategyServiceImpl.java
...rvice/control/impl/ControlCommandStrategyServiceImpl.java
+1
-1
EventInfoTrafficStatusDTO.java
...java/net/wanji/databus/dto/EventInfoTrafficStatusDTO.java
+32
-0
EventInfoTrafficStatusPO.java
...n/java/net/wanji/databus/po/EventInfoTrafficStatusPO.java
+61
-0
EventInfoTrafficStatusVO.java
...n/java/net/wanji/databus/vo/EventInfoTrafficStatusVO.java
+24
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/common/enums/EventInfoTypeEnum.java
View file @
2913816b
package
net
.
wanji
.
opt
.
common
.
enums
;
package
net
.
wanji
.
opt
.
common
.
enums
;
import
cn.hutool.core.util.ObjectUtil
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.Getter
;
import
net.wanji.common.utils.tool.StringUtils
;
import
net.wanji.common.utils.tool.StringUtils
;
...
@@ -37,4 +38,18 @@ public enum EventInfoTypeEnum {
...
@@ -37,4 +38,18 @@ public enum EventInfoTypeEnum {
}
}
return
null
;
return
null
;
}
}
/**
* 通过optType获取枚举值
* @param optType
* @return
*/
public
static
EventInfoTypeEnum
getEventInfoTypeEnum
(
int
optType
)
{
for
(
EventInfoTypeEnum
value
:
EventInfoTypeEnum
.
values
())
{
if
(
ObjectUtil
.
equals
(
value
.
getOptType
(),
optType
)){
return
value
;
}
}
return
null
;
}
}
}
signal-optimize-service/src/main/java/net/wanji/opt/controller/EventController.java
View file @
2913816b
package
net
.
wanji
.
opt
.
controller
;
package
net
.
wanji
.
opt
.
controller
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.*
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
io.swagger.annotations.ResponseHeader
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.common.framework.rest.JsonViewObject
;
import
net.wanji.opt.dto.CrossIdAndMinutesDTO
;
import
net.wanji.databus.dto.EventInfoTrafficStatusDTO
;
import
net.wanji.databus.vo.EventInfoTrafficStatusVO
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.service.EvaluateService
;
import
net.wanji.opt.service.EventService
;
import
net.wanji.opt.service.EventService
;
import
net.wanji.opt.vo.EvaluateCrossDetailVO
;
import
org.springframework.web.bind.annotation.*
;
import
net.wanji.opt.vo.EvaluateMetricsVO
;
import
net.wanji.opt.vo.GreenWaveRunStateVO
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.
ws.rs.core.MediaType
;
import
javax.
validation.Valid
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -89,4 +76,22 @@ public class EventController {
...
@@ -89,4 +76,22 @@ public class EventController {
}
}
@PostMapping
(
"/trafficStatus"
)
@ApiOperation
(
value
=
"路口监测、干线监测-交通状态"
,
notes
=
""
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"成功"
,
response
=
EventStatisticPo
.
class
,
responseHeaders
=
{
@ResponseHeader
(
name
=
"Content-Type"
,
description
=
"application/json"
)})
})
public
JsonViewObject
trafficStatus
(
@RequestBody
@Valid
EventInfoTrafficStatusDTO
eventInfoTrafficStatusDTO
)
{
try
{
EventInfoTrafficStatusVO
result
=
eventService
.
trafficStatus
(
eventInfoTrafficStatusDTO
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
catch
(
DubboProviderException
e
)
{
e
.
printStackTrace
();
return
JsonViewObject
.
newInstance
().
fail
(
e
);
}
}
}
}
\ No newline at end of file
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/HoloEventMapper.java
View file @
2913816b
package
net
.
wanji
.
opt
.
dao
.
mapper
;
package
net
.
wanji
.
opt
.
dao
.
mapper
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
net.wanji.databus.dto.EventInfoTrafficStatusDTO
;
import
net.wanji.databus.po.EventInfoTrafficStatusPO
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.po.base.EventStatisticPo
;
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.po.trend.HoloEventInfoPO
;
...
@@ -28,4 +29,6 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
...
@@ -28,4 +29,6 @@ public interface HoloEventMapper extends BaseMapper<HoloEventInfoPO> {
EventStatisticPo
findCrossEventCount
(
Map
<
String
,
Object
>
params
);
EventStatisticPo
findCrossEventCount
(
Map
<
String
,
Object
>
params
);
List
<
EventInfoSimplePo
>
findEventDistribute
(
Map
<
String
,
Object
>
params
);
List
<
EventInfoSimplePo
>
findEventDistribute
(
Map
<
String
,
Object
>
params
);
List
<
EventInfoTrafficStatusPO
>
trafficStatus
(
EventInfoTrafficStatusDTO
eventInfoTrafficStatusDTO
);
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/EventService.java
View file @
2913816b
package
net
.
wanji
.
opt
.
service
;
package
net
.
wanji
.
opt
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.dto.EventInfoTrafficStatusDTO
;
import
net.wanji.databus.vo.GreenwaveListVO
;
import
net.wanji.databus.vo.EventInfoTrafficStatusVO
;
import
net.wanji.opt.bo.CrossIdAndIsFirstBO
;
import
net.wanji.opt.bo.CrossIdAndTimeSpanBO
;
import
net.wanji.opt.bo.GreenwaveDetailBO
;
import
net.wanji.opt.bo.GreenwaveIdAndTimeStampBO
;
import
net.wanji.opt.bo.GreenwaveIdBO
;
import
net.wanji.opt.bo.SaveGreenwaveStrategyBO
;
import
net.wanji.opt.dto.trend.AbnormalCrossListDTO
;
import
net.wanji.opt.dto.trend.GreenwaveListDTO
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.po.base.EventStatisticPo
;
import
net.wanji.opt.po.trend.AnalysisRidTurnIndicators
;
import
net.wanji.opt.po.trend.HoloEventInfoPO
;
import
net.wanji.opt.vo.AbnormalCrossDetailVO
;
import
net.wanji.opt.vo.AbnormalCrossVO
;
import
net.wanji.opt.vo.CommonCrossIdDateTimeVO
;
import
net.wanji.opt.vo.CommonCrossIdVO
;
import
net.wanji.opt.vo.CountRealTimeVO
;
import
net.wanji.opt.vo.CrossStatusTimeRateVO
;
import
net.wanji.opt.vo.EventAlarmVO
;
import
net.wanji.opt.vo.GreenStatusTimeRateVO
;
import
net.wanji.opt.vo.GreenWaveCrossMonitorVO
;
import
net.wanji.opt.vo.GreenwaveCrossMetricsVO
;
import
net.wanji.opt.vo.GreenwaveDetailVO
;
import
net.wanji.opt.vo.GreenwaveRunMonitorVO
;
import
net.wanji.opt.vo.GreenwaveStats
;
import
net.wanji.opt.vo.HoloEventVO
;
import
net.wanji.opt.vo.HotspotCrossLaneVO
;
import
net.wanji.opt.vo.HotspotCrossTurnVO
;
import
net.wanji.opt.vo.HotspotCrossVO
;
import
net.wanji.opt.vo.LaneIdAliasNameVO
;
import
net.wanji.opt.vo.LanePeriodTurnVO
;
import
net.wanji.opt.vo.LaneSnapshotIndexVO
;
import
net.wanji.opt.vo.OptTypeVO
;
import
net.wanji.opt.vo.OverflowEvent
;
import
net.wanji.opt.vo.TableQueryVO
;
import
net.wanji.opt.vo.Top5IndexVO
;
import
javax.servlet.http.HttpServletResponse
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -69,4 +31,12 @@ public interface EventService {
...
@@ -69,4 +31,12 @@ public interface EventService {
* @return
* @return
*/
*/
List
<
Map
<
String
,
Object
>>
findEventDistribute
(
String
crossId
,
String
startTime
,
String
endTime
)
throws
DubboProviderException
;
List
<
Map
<
String
,
Object
>>
findEventDistribute
(
String
crossId
,
String
startTime
,
String
endTime
)
throws
DubboProviderException
;
/**
* 路口监测、干线监测-交通状态
* @param eventInfoTrafficStatusDTO
* @return
*/
EventInfoTrafficStatusVO
trafficStatus
(
EventInfoTrafficStatusDTO
eventInfoTrafficStatusDTO
)
throws
DubboProviderException
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/EventServiceImpl.java
View file @
2913816b
package
net
.
wanji
.
opt
.
service
.
impl
;
package
net
.
wanji
.
opt
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSONObject
;
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.enums.BaseEnum
;
import
net.wanji.common.enums.CrossInOutEnum
;
import
net.wanji.common.enums.StrategyAndMetricsEnum
;
import
net.wanji.common.enums.TurnConvertEnum
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.framework.exception.DubboProviderException
;
import
net.wanji.common.utils.tool.CrossUtil
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.DateUtil
;
import
net.wanji.common.utils.tool.TimeArrayUtil
;
import
net.wanji.databus.dto.EventInfoTrafficStatusDTO
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.po.EventInfoTrafficStatusPO
;
import
net.wanji.databus.dao.entity.BaseCrossSchedulesPO
;
import
net.wanji.databus.vo.EventInfoTrafficStatusVO
;
import
net.wanji.databus.dao.entity.BaseCrossSchedulesPlanPO
;
import
net.wanji.databus.dao.entity.BaseCrossSchemePO
;
import
net.wanji.databus.dao.entity.CrossSectionPO
;
import
net.wanji.databus.dao.mapper.BaseCrossDirInfoMapper
;
import
net.wanji.databus.dao.mapper.BaseCrossSchedulesMapper
;
import
net.wanji.databus.dao.mapper.BaseCrossSchedulesPlanMapper
;
import
net.wanji.databus.dao.mapper.BaseCrossSchemeMapper
;
import
net.wanji.databus.dao.mapper.BaseCrossSectionMapper
;
import
net.wanji.databus.dao.mapper.BaseCrossTurnInfoMapper
;
import
net.wanji.databus.dao.mapper.CrossDataHistMapper
;
import
net.wanji.databus.dao.mapper.CrossDataRealtimeMapper
;
import
net.wanji.databus.dao.mapper.CrossDirDataHistMapper
;
import
net.wanji.databus.dao.mapper.CrossTurnDataHistMapper
;
import
net.wanji.databus.po.CrossDataHistPO
;
import
net.wanji.databus.po.CrossDirDataHistPO
;
import
net.wanji.databus.po.CrossDirDataHistPOExt
;
import
net.wanji.databus.po.CrossTurnDataHistPO
;
import
net.wanji.databus.po.CrossTurnDataHistPOExt
;
import
net.wanji.opt.bo.CrossSchemeListBO
;
import
net.wanji.opt.bo.CurveChartBO
;
import
net.wanji.opt.bo.CurveChartBO.DirTurn
;
import
net.wanji.opt.bo.ProblemSchemeBO
;
import
net.wanji.opt.bo.SchemeDetailOverallBO
;
import
net.wanji.opt.common.EsDateIndexUtil
;
import
net.wanji.opt.common.EsDateIndexUtil
;
import
net.wanji.opt.common.enums.
TimeGranularity
Enum
;
import
net.wanji.opt.common.enums.
EventInfoType
Enum
;
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.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
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormat
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.OptionalDouble
;
import
java.util.OptionalInt
;
import
java.util.Set
;
import
java.util.TreeMap
;
import
java.util.TreeSet
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -224,9 +155,9 @@ public class EventServiceImpl implements EventService {
...
@@ -224,9 +155,9 @@ public class EventServiceImpl implements EventService {
}
}
});
});
});
});
List
<
EventInfoSimplePo
>
sortList
=
tmpList
.
stream
().
sorted
(
Comparator
.
comparing
(
o
->
o
.
getStartTime
())).
collect
(
Collectors
.
toList
());
List
<
EventInfoSimplePo
>
sortList
=
tmpList
.
stream
().
sorted
(
Comparator
.
comparing
(
o
->
o
.
getStartTime
())).
collect
(
Collectors
.
toList
());
sortList
.
forEach
(
po
->
{
sortList
.
forEach
(
po
->
{
String
axis
=
DateUtil
.
formatDate
(
po
.
getStartTime
(),
"M/d"
)
+
","
+
DateUtil
.
formatDate
(
po
.
getStartTime
(),
"HH:mm:ss"
)
+
","
+
po
.
getEventType
();
String
axis
=
DateUtil
.
formatDate
(
po
.
getStartTime
(),
"M/d"
)
+
","
+
DateUtil
.
formatDate
(
po
.
getStartTime
(),
"HH:mm:ss"
)
+
","
+
po
.
getEventType
();
dataserList
.
add
(
axis
);
dataserList
.
add
(
axis
);
});
});
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -249,8 +180,63 @@ public class EventServiceImpl implements EventService {
...
@@ -249,8 +180,63 @@ public class EventServiceImpl implements EventService {
return
retList
;
return
retList
;
}
}
@Override
public
EventInfoTrafficStatusVO
trafficStatus
(
EventInfoTrafficStatusDTO
eventInfoTrafficStatusDTO
)
throws
DubboProviderException
{
EventInfoTrafficStatusVO
eventInfoTrafficStatusVO
=
new
EventInfoTrafficStatusVO
();
String
eventType
=
eventInfoTrafficStatusDTO
.
getEventType
();
//获取type
String
type
=
EventInfoTypeEnum
.
getEventInfoTypeEnum
(
Integer
.
valueOf
(
eventType
)).
getEventType
();
eventInfoTrafficStatusDTO
.
setEventType
(
type
);
List
<
EventInfoTrafficStatusPO
>
eventInfoTrafficStatusPOS
=
holoEventMapper
.
trafficStatus
(
eventInfoTrafficStatusDTO
);
//获取当前时间的时间轴
Set
<
String
>
timeScopeList
=
getTimeScopeList
(
DateTime
.
now
().
withTimeAtStartOfDay
(),
new
DateTime
(),
EsDateIndexUtil
.
H_FORMATTER
);
if
(
ObjectUtil
.
isNotEmpty
(
timeScopeList
)){
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
());
eventInfoTrafficStatusVO
.
setTimeList
(
collect
);
//补充全部数据
if
(
ObjectUtil
.
isEmpty
(
eventInfoTrafficStatusPOS
))
{
int
size
=
timeScopeList
.
size
();
List
<
Integer
>
list
=
getDefaultList
(
size
);
eventInfoTrafficStatusVO
.
setEventCount
(
list
);
eventInfoTrafficStatusVO
.
setDurationTime
(
list
);
}
else
{
List
<
String
>
timeList
=
eventInfoTrafficStatusPOS
.
stream
().
map
(
EventInfoTrafficStatusPO:
:
getTimeAxisStart
).
collect
(
Collectors
.
toList
());
//补充缺少时段数据
for
(
String
s
:
timeScopeList
)
{
if
(!
timeList
.
contains
(
s
)){
EventInfoTrafficStatusPO
eventInfoTrafficStatusPO
=
new
EventInfoTrafficStatusPO
();
eventInfoTrafficStatusPO
.
setDuration
(
0
);
eventInfoTrafficStatusPO
.
setCount
(
0
);
eventInfoTrafficStatusPO
.
setTimeAxisStart
(
s
);
eventInfoTrafficStatusPOS
.
add
(
eventInfoTrafficStatusPO
);
}
}
List
<
EventInfoTrafficStatusPO
>
trafficStatusPOS
=
eventInfoTrafficStatusPOS
.
stream
().
sorted
(
Comparator
.
comparing
(
time
->
Integer
.
valueOf
(
time
.
getTimeAxisStart
().
split
(
":"
)[
0
]))).
collect
(
Collectors
.
toList
());
List
<
Integer
>
durationList
=
trafficStatusPOS
.
stream
().
map
(
x
->
x
.
getDuration
()).
collect
(
Collectors
.
toList
());
List
<
Integer
>
countList
=
trafficStatusPOS
.
stream
().
map
(
x
->
x
.
getCount
()).
collect
(
Collectors
.
toList
());
eventInfoTrafficStatusVO
.
setEventCount
(
countList
);
eventInfoTrafficStatusVO
.
setDurationTime
(
durationList
);
}
}
return
eventInfoTrafficStatusVO
;
}
/**
* @return java.util.List<java.lang.Integer>
* @Description 根据集合长度,获取默认0补充的list
* @Param [size] 长度
**/
private
List
<
Integer
>
getDefaultList
(
int
size
)
{
List
<
Integer
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
list
.
add
(
0
);
}
return
list
;
}
public
Set
<
String
>
getTimeScopeList
(
DateTime
start
,
DateTime
end
,
String
dateFormat
)
{
public
static
Set
<
String
>
getTimeScopeList
(
DateTime
start
,
DateTime
end
,
String
dateFormat
)
{
Set
<
String
>
indexList
=
new
HashSet
<>();
Set
<
String
>
indexList
=
new
HashSet
<>();
int
diffNum
=
Minutes
.
minutesBetween
(
start
,
end
).
getMinutes
();
int
diffNum
=
Minutes
.
minutesBetween
(
start
,
end
).
getMinutes
();
int
unitTime
=
5
;
int
unitTime
=
5
;
...
...
signal-optimize-service/src/main/resources/mapper/HoloEventMapper.xml
View file @
2913816b
...
@@ -85,6 +85,29 @@
...
@@ -85,6 +85,29 @@
GROUP BY cross_id,type
GROUP BY cross_id,type
</select>
</select>
<!-- 查看路口事件数量 -->
<select
id=
"trafficStatus"
resultType=
"net.wanji.databus.po.EventInfoTrafficStatusPO"
>
SELECT cross_id, dt,type AS event_type,start_time,ifnull(end_time,now()) end_time,
sum( TIMESTAMPDIFF( SECOND, start_time, ifnull( end_time, now())) ) duration,
count(*) as count,
DATE_FORMAT( start_time, '%H:00' ) time_axis_start
FROM
t_event_info
WHERE
type =#{eventType}
<if
test=
"queryType == 1"
>
and cross_id = #{id}
</if>
<if
test=
"queryType == 2"
>
and green_id = #{id}
</if>
AND dt = DATE_FORMAT( NOW(), '%Y%m%d' )
GROUP BY
time_axis_start
ORDER BY
start_time
</select>
</mapper>
</mapper>
\ No newline at end of file
signal-utc-service/src/main/java/net/wanji/utc/service/control/impl/ControlCommandStrategyServiceImpl.java
View file @
2913816b
...
@@ -327,7 +327,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
...
@@ -327,7 +327,7 @@ public class ControlCommandStrategyServiceImpl implements ControlCommandStrategy
jsonViewObject
.
setCode
(
HttpCode
.
NOT_IMPLEMENTED
.
value
());
jsonViewObject
.
setCode
(
HttpCode
.
NOT_IMPLEMENTED
.
value
());
}
else
if
(
"31"
.
equals
(
runMode
))
{
}
else
if
(
"31"
.
equals
(
runMode
))
{
jsonViewObject
=
JsonViewObject
.
newInstance
().
fail
(
"该路口控制模式为手动控制,禁止执行指令"
);
jsonViewObject
=
JsonViewObject
.
newInstance
().
fail
(
"该路口控制模式为手动控制,禁止执行指令"
);
jsonViewObject
.
setCode
(
HttpCode
.
NOT_
IMPLEMENT
ED
.
value
());
jsonViewObject
.
setCode
(
HttpCode
.
NOT_
EXTEND
ED
.
value
());
}
}
}
}
}
}
...
...
wj-databus/src/main/java/net/wanji/databus/dto/EventInfoTrafficStatusDTO.java
0 → 100644
View file @
2913816b
package
net
.
wanji
.
databus
.
dto
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Range
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotNull
;
/**
* @ClassName EventInfoPO
* @Description 路口监测、干线监测-交通状态 查询DTO
* @Author zhouleilei
* @Date 2025/1/14 10:50
*/
@Data
@Valid
public
class
EventInfoTrafficStatusDTO
{
@ApiModelProperty
(
value
=
"路口/干线ID"
,
notes
=
""
)
@NotNull
(
message
=
"id 不能为空"
)
private
String
id
;
@ApiModelProperty
(
value
=
"查询类型:1-路口,2-干线"
,
notes
=
""
)
@Range
(
min
=
1
,
max
=
2
,
message
=
"queryType 区间 1 - 2"
)
@NotNull
(
message
=
"queryType 不能为空"
)
private
Integer
queryType
;
@ApiModelProperty
(
value
=
"事件类型:1-路口失衡,2-路口拥堵,3-路口溢出,4-路口死锁,5-相位空放,6-干线-缓行,7-干线-拥堵"
,
notes
=
""
)
@Range
(
min
=
1
,
max
=
7
,
message
=
"eventType 区间1-7"
)
@NotNull
(
message
=
"eventType 不能为空"
)
private
String
eventType
;
}
wj-databus/src/main/java/net/wanji/databus/po/EventInfoTrafficStatusPO.java
0 → 100644
View file @
2913816b
package
net
.
wanji
.
databus
.
po
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* @ClassName EventInfoTrafficStatusPO
* @Description 路口监测、干线监测-交通状态
* @Author zhouleilei
* @Date 2025/1/14 15:14
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"t_event_info"
)
@ApiModel
(
value
=
"EventInfoTrafficStatusPO"
,
description
=
"交通事件信息"
)
public
class
EventInfoTrafficStatusPO
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"路口编号"
)
@JsonProperty
(
"crossId"
)
//@JSONField(name = "eventType")
private
String
crossId
;
@ApiModelProperty
(
value
=
"日期/天"
)
@JsonProperty
(
"dt"
)
//@JSONField(name = "eventType")
private
String
dt
;
@ApiModelProperty
(
value
=
"二级类别"
)
@JsonProperty
(
"eventType"
)
//@JSONField(name = "eventType")
private
String
eventType
;
@ApiModelProperty
(
value
=
"事件发生时间"
)
@JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"事件结束时间"
)
//@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"事件持续时长,单位秒"
)
private
Integer
duration
;
@ApiModelProperty
(
value
=
"事件发生次数"
)
private
Integer
count
=
1
;
@ApiModelProperty
(
value
=
"横轴时间轴start"
,
notes
=
""
)
private
String
timeAxisStart
;
}
wj-databus/src/main/java/net/wanji/databus/vo/EventInfoTrafficStatusVO.java
0 → 100644
View file @
2913816b
package
net
.
wanji
.
databus
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @ClassName EventInfoTrafficStatusVO
* @Description 路口监测、干线监测-交通状态VO
* @Author zhouleilei
* @Date 2025/1/14 11:25
*/
@Data
public
class
EventInfoTrafficStatusVO
{
@ApiModelProperty
(
value
=
"时间轴,小时"
,
notes
=
""
)
private
List
<
String
>
timeList
;
@ApiModelProperty
(
value
=
"事件次数"
,
notes
=
""
)
private
List
<
Integer
>
eventCount
;
@ApiModelProperty
(
value
=
"事件持续时间,单位:秒"
,
notes
=
""
)
private
List
<
Integer
>
durationTime
;
}
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