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
a9a1ddb7
Commit
a9a1ddb7
authored
Jul 01, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 微观大数据平台-异常优化
parent
29916b6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
48 deletions
+58
-48
OptServiceException.java
...a/net/wanji/opt/common/exception/OptServiceException.java
+2
-2
TrendServiceImpl.java
...ain/java/net/wanji/opt/service/impl/TrendServiceImpl.java
+56
-46
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/common/exception/OptServiceException.java
View file @
a9a1ddb7
...
...
@@ -5,8 +5,8 @@ package net.wanji.opt.common.exception;
* @date 2023/03/03 13:47
*/
public
class
OptServiceException
extends
RuntimeException
{
public
OptServiceException
()
{
super
();
public
OptServiceException
(
Exception
e
)
{
super
(
e
);
}
public
OptServiceException
(
String
message
)
{
...
...
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/TrendServiceImpl.java
View file @
a9a1ddb7
...
...
@@ -25,6 +25,7 @@ import net.wanji.opt.cache.BaseCrossInfoCache;
import
net.wanji.opt.common.ExcelExportUtils
;
import
net.wanji.opt.common.KafkaConsumerUtil
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.common.exception.OptServiceException
;
import
net.wanji.opt.config.DirectionMappingsConfig
;
import
net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
...
...
@@ -849,7 +850,7 @@ public class TrendServiceImpl implements TrendService {
greenwaveCross
.
setCrossId
(
crossId
);
BaseCrossInfoPO
baseCrossInfoPO
=
baseCrossInfoMapper
.
selectById
(
crossId
);
if
(
baseCrossInfoPO
==
null
)
{
throw
new
Runtim
eException
(
"无此路口基础信息"
);
throw
new
OptServic
eException
(
"无此路口基础信息"
);
}
greenwaveCross
.
setCrossName
(
baseCrossInfoPO
.
getName
());
greenwaveCross
.
setIsKeyRoute
(
greenwaveCrossPO
.
getIsKeyRoute
());
...
...
@@ -876,7 +877,7 @@ public class TrendServiceImpl implements TrendService {
CrossSectionPO
crossSectionPO
=
baseCrossSectionMapper
.
selectbyStartTimeCrossIdPlanId
(
startTime
,
crossId
,
planId
);
if
(
crossSectionPO
==
null
)
{
throw
new
Runtim
eException
(
"无当前时段方案信息"
);
throw
new
OptServic
eException
(
"无当前时段方案信息"
);
}
Integer
currentSchemeId
=
crossSectionPO
.
getSchemeId
();
BaseCrossSchemePO
baseCrossSchemePO
=
baseCrossSchemeMapper
.
selectById
(
currentSchemeId
);
...
...
@@ -1119,7 +1120,7 @@ public class TrendServiceImpl implements TrendService {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"获取绿波旅行时间异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
return
0
;
}
...
...
@@ -1231,7 +1232,7 @@ public class TrendServiceImpl implements TrendService {
List
<
MainlineSchemeAnalysisVO
.
GreenwaveData
>
greenwaveData
=
mainlineSchemeAnalysisVO
.
getGreenwaveData
();
MainlineSchemeAnalysisVO
.
GreenwaveData
matchingData
=
findMatchingData
(
greenwaveData
);
if
(
ObjectUtil
.
isEmpty
(
matchingData
))
{
throw
new
Runtim
eException
(
"无当天绿波历史数据"
);
throw
new
OptServic
eException
(
"无当天绿波历史数据"
);
}
String
lineSchemeName
=
matchingData
.
getName
();
GreenwaveDetailBO
greenwaveDetailBO
=
new
GreenwaveDetailBO
();
...
...
@@ -1766,7 +1767,7 @@ public class TrendServiceImpl implements TrendService {
return
hotspotCrossVOS
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
log
.
error
(
"重点路口监测异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
...
...
@@ -1814,7 +1815,7 @@ public class TrendServiceImpl implements TrendService {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"路口转向排队长度异常"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
return
results
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossTurnVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
}
...
...
@@ -1860,7 +1861,7 @@ public class TrendServiceImpl implements TrendService {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"路口车道数据异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
return
results
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossLaneVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
}
...
...
@@ -1898,7 +1899,7 @@ public class TrendServiceImpl implements TrendService {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"全天流量监测异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
return
hotspotCrossVOS
;
}
...
...
@@ -1950,7 +1951,7 @@ public class TrendServiceImpl implements TrendService {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"交通状态时间比例异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
return
crossStatusTimeRateVO
;
}
...
...
@@ -1967,7 +1968,7 @@ public class TrendServiceImpl implements TrendService {
return
buildCycleData
(
crossId
,
poExtList
);
}
catch
(
Exception
e
)
{
log
.
error
(
"车道数据查询异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
...
...
@@ -1993,22 +1994,15 @@ public class TrendServiceImpl implements TrendService {
return
sorts
;
}
catch
(
Exception
e
)
{
log
.
error
(
"车道快照数据查询异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
@Override
public
List
<
OverflowEvent
>
overFlowEvent
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
try
{
String
crossId
=
laneSnapshotIndexVO
.
getCrossId
();
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
(
crossId
,
start
,
end
,
pageNum
,
null
,
overFlow
);
List
<
CrossLaneSnapshotDataDTO
>
dtoList
=
getCrossLaneSnapshotDataDTOS
(
laneSnapshotIndexVO
);
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
())
{
...
...
@@ -2016,27 +2010,8 @@ public class TrendServiceImpl implements TrendService {
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
.
setDir
(
dir
);
resultPojo
.
setStartTime
(
new
Date
(
Long
.
parseLong
(
time
)
*
1000
));
resultPojo
.
setEndTime
(
new
Date
(
Long
.
parseLong
(
time
)
*
1000
));
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
);
OverflowEvent
resultPojo
=
getOverflowEvent
(
time
,
dirEntry
);
resultList
.
add
(
resultPojo
);
}
}
...
...
@@ -2045,8 +2020,43 @@ public class TrendServiceImpl implements TrendService {
return
resultList
;
}
catch
(
Exception
e
)
{
log
.
error
(
"车道快照数据查询异常:"
,
e
);
throw
new
Exception
(
e
);
}
throw
new
OptServiceException
(
e
);
}
}
private
static
OverflowEvent
getOverflowEvent
(
String
time
,
Map
.
Entry
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirEntry
)
{
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
.
setDir
(
dir
);
resultPojo
.
setStartTime
(
new
Date
(
Long
.
parseLong
(
time
)
*
1000
));
resultPojo
.
setEndTime
(
new
Date
(
Long
.
parseLong
(
time
)
*
1000
));
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
));
return
resultPojo
;
}
private
List
<
CrossLaneSnapshotDataDTO
>
getCrossLaneSnapshotDataDTOS
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
String
crossId
=
laneSnapshotIndexVO
.
getCrossId
();
int
start
=
(
int
)
(
laneSnapshotIndexVO
.
getStart
().
getTime
()
/
1000
);
int
end
=
(
int
)
(
laneSnapshotIndexVO
.
getEnd
().
getTime
()
/
1000
);
int
pageNum
=
laneSnapshotIndexVO
.
getPageNum
();
boolean
overFlow
=
laneSnapshotIndexVO
.
isOverFlow
();
// 查询秒级数据
List
<
CrossLaneSnapshotDataDTO
>
dtoList
=
laneSnapshotDataQueryService
.
queryByCrossIdAndTimeSpan
(
crossId
,
start
,
end
,
pageNum
,
null
,
overFlow
);
return
dtoList
;
}
@Override
...
...
@@ -2067,7 +2077,7 @@ public class TrendServiceImpl implements TrendService {
return
ridTurnIndicatorsMapper
.
selectList
(
queryWrapper
);
}
catch
(
Exception
e
)
{
log
.
error
(
"全是周期车道数据方向转向查询异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
...
...
@@ -2105,7 +2115,7 @@ public class TrendServiceImpl implements TrendService {
return
results
;
}
catch
(
Exception
e
)
{
log
.
error
(
"全息事件查询异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
...
...
@@ -2133,7 +2143,7 @@ public class TrendServiceImpl implements TrendService {
return
laneIdAliasNameVOS
;
}
catch
(
Exception
e
)
{
log
.
error
(
"车道基本信息查询失败:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
...
...
@@ -2256,7 +2266,7 @@ public class TrendServiceImpl implements TrendService {
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"转向周期数据"
),
TurnDataIndexExcelVO
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"导出转向数据异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
...
...
@@ -2284,7 +2294,7 @@ public class TrendServiceImpl implements TrendService {
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
dataList
,
crossName
.
concat
(
"车道快照数据"
),
TableQueryVO
.
RealTimeDataElement
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"快照数据导出失败:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
...
...
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