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
f4376f1c
Commit
f4376f1c
authored
Jun 28, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 微观大数据平台-溢出事件优化
parent
3284549b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
4 deletions
+124
-4
TrendController.java
...c/main/java/net/wanji/opt/controller/TrendController.java
+12
-0
CrossLaneSnapshotDataDTO.java
...main/java/net/wanji/opt/dto/CrossLaneSnapshotDataDTO.java
+1
-1
TrendService.java
...ice/src/main/java/net/wanji/opt/service/TrendService.java
+1
-0
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+51
-2
OverflowEvent.java
...service/src/main/java/net/wanji/opt/vo/OverflowEvent.java
+58
-0
TableQueryVO.java
...-service/src/main/java/net/wanji/opt/vo/TableQueryVO.java
+1
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controller/TrendController.java
View file @
f4376f1c
...
@@ -303,6 +303,18 @@ public class TrendController {
...
@@ -303,6 +303,18 @@ public class TrendController {
return
JsonViewObject
.
newInstance
().
success
(
result
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
}
@ApiOperation
(
value
=
"溢出事件"
,
notes
=
"溢出事件"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/overFlowEvent"
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@ApiResponses
({
@ApiResponse
(
code
=
200
,
message
=
"OK"
,
response
=
TableQueryVO
.
RealTimeDataElement
.
class
),
})
public
JsonViewObject
overFlowEvent
(
@RequestBody
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
List
<
OverflowEvent
>
result
=
trendService
.
overFlowEvent
(
laneSnapshotIndexVO
);
return
JsonViewObject
.
newInstance
().
success
(
result
);
}
@ApiOperation
(
value
=
"车道周期转向数据"
,
notes
=
"车道周期转向数据"
,
response
=
JsonViewObject
.
class
,
@ApiOperation
(
value
=
"车道周期转向数据"
,
notes
=
"车道周期转向数据"
,
response
=
JsonViewObject
.
class
,
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
produces
=
MediaType
.
APPLICATION_JSON
,
consumes
=
MediaType
.
APPLICATION_JSON
)
@PostMapping
(
value
=
"/lanePeriodTurnData"
,
@PostMapping
(
value
=
"/lanePeriodTurnData"
,
...
...
signal-optimize-service/src/main/java/net/wanji/opt/dto/CrossLaneSnapshotDataDTO.java
View file @
f4376f1c
...
@@ -100,5 +100,5 @@ public class CrossLaneSnapshotDataDTO {
...
@@ -100,5 +100,5 @@ public class CrossLaneSnapshotDataDTO {
/**
/**
* 溢出区车辆数
* 溢出区车辆数
*/
*/
private
String
overflowNums
;
private
int
overflowNums
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/service/TrendService.java
View file @
f4376f1c
...
@@ -63,6 +63,7 @@ public interface TrendService {
...
@@ -63,6 +63,7 @@ public interface TrendService {
List
<
TableQueryVO
.
CycleDataElement
>
laneTrafficIndex
(
CommonCrossIdDateTimeVO
crossIdDateTimeVO
)
throws
Exception
;
List
<
TableQueryVO
.
CycleDataElement
>
laneTrafficIndex
(
CommonCrossIdDateTimeVO
crossIdDateTimeVO
)
throws
Exception
;
List
<
TableQueryVO
.
RealTimeDataElement
>
laneSnapshotIndex
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
;
List
<
TableQueryVO
.
RealTimeDataElement
>
laneSnapshotIndex
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
;
List
<
OverflowEvent
>
overFlowEvent
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
;
List
<
AnalysisRidTurnIndicators
>
lanePeriodTurnData
(
LanePeriodTurnVO
lanePeriodTurnVO
)
throws
Exception
;
List
<
AnalysisRidTurnIndicators
>
lanePeriodTurnData
(
LanePeriodTurnVO
lanePeriodTurnVO
)
throws
Exception
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
f4376f1c
...
@@ -38,7 +38,6 @@ import net.wanji.opt.dto.CrossEventDTO;
...
@@ -38,7 +38,6 @@ import net.wanji.opt.dto.CrossEventDTO;
import
net.wanji.opt.dto.CrossLaneSnapshotDataDTO
;
import
net.wanji.opt.dto.CrossLaneSnapshotDataDTO
;
import
net.wanji.opt.dto.LineCongestion
;
import
net.wanji.opt.dto.LineCongestion
;
import
net.wanji.opt.dto.LineSchemeDTO
;
import
net.wanji.opt.dto.LineSchemeDTO
;
import
net.wanji.opt.dto.PhaseEmptyResult
;
import
net.wanji.opt.dto.trend.AbnormalCrossListDTO
;
import
net.wanji.opt.dto.trend.AbnormalCrossListDTO
;
import
net.wanji.opt.dto.trend.GreenwaveListDTO
;
import
net.wanji.opt.dto.trend.GreenwaveListDTO
;
import
net.wanji.opt.po.base.CrossSchemeOptLogPO
;
import
net.wanji.opt.po.base.CrossSchemeOptLogPO
;
...
@@ -61,7 +60,6 @@ import org.springframework.util.CollectionUtils;
...
@@ -61,7 +60,6 @@ import org.springframework.util.CollectionUtils;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.math.RoundingMode
;
import
java.text.NumberFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.*
;
import
java.time.*
;
...
@@ -1973,6 +1971,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1973,6 +1971,7 @@ public class TrendServiceImpl implements TrendService {
}
}
}
}
@Override
@Override
public
List
<
TableQueryVO
.
RealTimeDataElement
>
laneSnapshotIndex
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
public
List
<
TableQueryVO
.
RealTimeDataElement
>
laneSnapshotIndex
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
try
{
try
{
...
@@ -1998,6 +1997,56 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1998,6 +1997,56 @@ public class TrendServiceImpl implements TrendService {
}
}
}
}
@Override
public
List
<
OverflowEvent
>
overFlowEvent
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
try
{
int
start
=
(
int
)
(
laneSnapshotIndexVO
.
getStart
().
getTime
()
/
1000
);
int
end
=
(
int
)
(
laneSnapshotIndexVO
.
getEnd
().
getTime
()
/
1000
);
int
pageNum
=
laneSnapshotIndexVO
.
getPageNum
();
boolean
overFlow
=
laneSnapshotIndexVO
.
isOverFlow
();
List
<
OverflowEvent
>
resultList
=
new
ArrayList
<>();
// 查询秒级数据
List
<
CrossLaneSnapshotDataDTO
>
dtoList
=
laneSnapshotDataQueryService
.
queryByCrossIdAndTimeSpan
(
null
,
start
,
end
,
pageNum
,
null
,
overFlow
);
if
(!
CollectionUtils
.
isEmpty
(
dtoList
))
{
Map
<
String
,
List
<
CrossLaneSnapshotDataDTO
>>
timeMap
=
dtoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossLaneSnapshotDataDTO:
:
getTimeStamp
));
for
(
Map
.
Entry
<
String
,
List
<
CrossLaneSnapshotDataDTO
>>
timeEntry
:
timeMap
.
entrySet
())
{
String
time
=
timeEntry
.
getKey
();
List
<
CrossLaneSnapshotDataDTO
>
timeList
=
timeEntry
.
getValue
();
if
(!
CollectionUtil
.
isNotEmpty
(
timeList
))
{
Map
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirMap
=
timeList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossLaneSnapshotDataDTO:
:
getDir
));
for
(
Map
.
Entry
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirEntry
:
dirMap
.
entrySet
())
{
Integer
dir
=
dirEntry
.
getKey
();
List
<
CrossLaneSnapshotDataDTO
>
dirList
=
dirEntry
.
getValue
();
OverflowEvent
resultPojo
=
new
OverflowEvent
();
int
overflowNums
=
0
;
double
vehicleLengthRatio
=
0.0
;
double
meanV
=
0.0
;
for
(
CrossLaneSnapshotDataDTO
dto
:
dirList
)
{
overflowNums
+=
dto
.
getOverflowNums
();
vehicleLengthRatio
+=
dto
.
getVehicleLengthRatio
();
meanV
+=
dto
.
getMeanV
();
}
resultPojo
.
setStartTime
(
new
Date
(
Long
.
parseLong
(
time
)));
resultPojo
.
setEndTime
(
new
Date
(
Long
.
parseLong
(
time
)));
resultPojo
.
setDirName
(
BaseEnum
.
SignalDirectionEnum
.
getNameByCode
(
dir
));
resultPojo
.
setOverflowId
(
String
.
valueOf
(
dir
));
resultPojo
.
setOverflowNums
(
overflowNums
);
resultPojo
.
setSpeed
(
Math
.
round
(
meanV
/
dirList
.
size
()
*
100
)
/
100
);
resultPojo
.
setVehicleLengthRatio
(
Math
.
round
(
vehicleLengthRatio
/
dirList
.
size
()
*
100
)
/
100
);
resultList
.
add
(
resultPojo
);
}
}
}
}
return
resultList
;
}
catch
(
Exception
e
)
{
log
.
error
(
"车道快照数据查询异常:"
,
e
);
throw
new
Exception
(
e
);
}
}
@Override
@Override
public
List
<
AnalysisRidTurnIndicators
>
lanePeriodTurnData
(
LanePeriodTurnVO
lanePeriodTurnVO
)
throws
Exception
{
public
List
<
AnalysisRidTurnIndicators
>
lanePeriodTurnData
(
LanePeriodTurnVO
lanePeriodTurnVO
)
throws
Exception
{
try
{
try
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/vo/OverflowEvent.java
0 → 100644
View file @
f4376f1c
package
net
.
wanji
.
opt
.
vo
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
/**
* @author duanruiming
* @date 2024/06/28 17:03
*/
@Data
@NoArgsConstructor
@ApiModel
(
value
=
"OverflowEvent"
,
description
=
"溢出事件实体"
)
public
class
OverflowEvent
{
@ApiModelProperty
(
value
=
"时间 格式 yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ExcelProperty
(
"开始时间"
)
private
Date
startTime
;
@ApiModelProperty
(
value
=
"时间 格式 yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@ExcelProperty
(
"结束时间"
)
private
Date
endTime
;
@ApiModelProperty
(
value
=
"持续时长"
)
@ExcelProperty
(
"持续时长"
)
private
Integer
duration
;
@ApiModelProperty
(
value
=
"方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北"
)
@ExcelIgnore
private
Integer
dir
;
@ApiModelProperty
(
value
=
"方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北"
)
@ExcelProperty
(
"位置"
)
private
String
dirName
;
@ApiModelProperty
(
value
=
"溢出区编号"
)
@ExcelProperty
(
"溢出区编号"
)
private
String
overflowId
;
@ApiModelProperty
(
value
=
"溢出区车辆数"
)
@ExcelProperty
(
"溢出区车辆数"
)
private
int
overflowNums
;
@ApiModelProperty
(
value
=
"空间长度占比"
)
@ExcelProperty
(
"空间占有率%"
)
private
double
vehicleLengthRatio
;
@ApiModelProperty
(
value
=
"平均速度"
)
@ExcelProperty
(
"平均速度"
)
private
double
speed
;
}
signal-optimize-service/src/main/java/net/wanji/opt/vo/TableQueryVO.java
View file @
f4376f1c
...
@@ -102,7 +102,7 @@ public class TableQueryVO {
...
@@ -102,7 +102,7 @@ public class TableQueryVO {
@ApiModelProperty
(
value
=
"溢出区车辆数"
)
@ApiModelProperty
(
value
=
"溢出区车辆数"
)
@ExcelProperty
(
"溢出区车辆数"
)
@ExcelProperty
(
"溢出区车辆数"
)
private
String
overflowNums
;
private
int
overflowNums
;
}
}
...
...
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