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
Show 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;
...
@@ -5,8 +5,8 @@ package net.wanji.opt.common.exception;
* @date 2023/03/03 13:47
* @date 2023/03/03 13:47
*/
*/
public
class
OptServiceException
extends
RuntimeException
{
public
class
OptServiceException
extends
RuntimeException
{
public
OptServiceException
()
{
public
OptServiceException
(
Exception
e
)
{
super
();
super
(
e
);
}
}
public
OptServiceException
(
String
message
)
{
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;
...
@@ -25,6 +25,7 @@ import net.wanji.opt.cache.BaseCrossInfoCache;
import
net.wanji.opt.common.ExcelExportUtils
;
import
net.wanji.opt.common.ExcelExportUtils
;
import
net.wanji.opt.common.KafkaConsumerUtil
;
import
net.wanji.opt.common.KafkaConsumerUtil
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.common.RedisUtils
;
import
net.wanji.opt.common.exception.OptServiceException
;
import
net.wanji.opt.config.DirectionMappingsConfig
;
import
net.wanji.opt.config.DirectionMappingsConfig
;
import
net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper
;
import
net.wanji.opt.dao.mapper.CrossSchemeOptLogMapper
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
import
net.wanji.opt.dao.mapper.HoloEventMapper
;
...
@@ -849,7 +850,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -849,7 +850,7 @@ public class TrendServiceImpl implements TrendService {
greenwaveCross
.
setCrossId
(
crossId
);
greenwaveCross
.
setCrossId
(
crossId
);
BaseCrossInfoPO
baseCrossInfoPO
=
baseCrossInfoMapper
.
selectById
(
crossId
);
BaseCrossInfoPO
baseCrossInfoPO
=
baseCrossInfoMapper
.
selectById
(
crossId
);
if
(
baseCrossInfoPO
==
null
)
{
if
(
baseCrossInfoPO
==
null
)
{
throw
new
Runtim
eException
(
"无此路口基础信息"
);
throw
new
OptServic
eException
(
"无此路口基础信息"
);
}
}
greenwaveCross
.
setCrossName
(
baseCrossInfoPO
.
getName
());
greenwaveCross
.
setCrossName
(
baseCrossInfoPO
.
getName
());
greenwaveCross
.
setIsKeyRoute
(
greenwaveCrossPO
.
getIsKeyRoute
());
greenwaveCross
.
setIsKeyRoute
(
greenwaveCrossPO
.
getIsKeyRoute
());
...
@@ -876,7 +877,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -876,7 +877,7 @@ public class TrendServiceImpl implements TrendService {
CrossSectionPO
crossSectionPO
=
baseCrossSectionMapper
.
CrossSectionPO
crossSectionPO
=
baseCrossSectionMapper
.
selectbyStartTimeCrossIdPlanId
(
startTime
,
crossId
,
planId
);
selectbyStartTimeCrossIdPlanId
(
startTime
,
crossId
,
planId
);
if
(
crossSectionPO
==
null
)
{
if
(
crossSectionPO
==
null
)
{
throw
new
Runtim
eException
(
"无当前时段方案信息"
);
throw
new
OptServic
eException
(
"无当前时段方案信息"
);
}
}
Integer
currentSchemeId
=
crossSectionPO
.
getSchemeId
();
Integer
currentSchemeId
=
crossSectionPO
.
getSchemeId
();
BaseCrossSchemePO
baseCrossSchemePO
=
baseCrossSchemeMapper
.
selectById
(
currentSchemeId
);
BaseCrossSchemePO
baseCrossSchemePO
=
baseCrossSchemeMapper
.
selectById
(
currentSchemeId
);
...
@@ -1119,7 +1120,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1119,7 +1120,7 @@ public class TrendServiceImpl implements TrendService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"获取绿波旅行时间异常:"
,
e
);
log
.
error
(
"获取绿波旅行时间异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
return
0
;
return
0
;
}
}
...
@@ -1231,7 +1232,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1231,7 +1232,7 @@ public class TrendServiceImpl implements TrendService {
List
<
MainlineSchemeAnalysisVO
.
GreenwaveData
>
greenwaveData
=
mainlineSchemeAnalysisVO
.
getGreenwaveData
();
List
<
MainlineSchemeAnalysisVO
.
GreenwaveData
>
greenwaveData
=
mainlineSchemeAnalysisVO
.
getGreenwaveData
();
MainlineSchemeAnalysisVO
.
GreenwaveData
matchingData
=
findMatchingData
(
greenwaveData
);
MainlineSchemeAnalysisVO
.
GreenwaveData
matchingData
=
findMatchingData
(
greenwaveData
);
if
(
ObjectUtil
.
isEmpty
(
matchingData
))
{
if
(
ObjectUtil
.
isEmpty
(
matchingData
))
{
throw
new
Runtim
eException
(
"无当天绿波历史数据"
);
throw
new
OptServic
eException
(
"无当天绿波历史数据"
);
}
}
String
lineSchemeName
=
matchingData
.
getName
();
String
lineSchemeName
=
matchingData
.
getName
();
GreenwaveDetailBO
greenwaveDetailBO
=
new
GreenwaveDetailBO
();
GreenwaveDetailBO
greenwaveDetailBO
=
new
GreenwaveDetailBO
();
...
@@ -1766,7 +1767,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1766,7 +1767,7 @@ public class TrendServiceImpl implements TrendService {
return
hotspotCrossVOS
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
return
hotspotCrossVOS
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"重点路口监测异常:"
,
e
);
log
.
error
(
"重点路口监测异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
}
}
...
@@ -1814,7 +1815,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1814,7 +1815,7 @@ public class TrendServiceImpl implements TrendService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"路口转向排队长度异常"
,
e
);
log
.
error
(
"路口转向排队长度异常"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
return
results
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossTurnVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
return
results
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossTurnVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
}
}
...
@@ -1860,7 +1861,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1860,7 +1861,7 @@ public class TrendServiceImpl implements TrendService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"路口车道数据异常:"
,
e
);
log
.
error
(
"路口车道数据异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
return
results
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossLaneVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
return
results
.
stream
().
sorted
(
Comparator
.
comparing
(
HotspotCrossLaneVO:
:
getTimeStamp
)).
collect
(
Collectors
.
toList
());
}
}
...
@@ -1898,7 +1899,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1898,7 +1899,7 @@ public class TrendServiceImpl implements TrendService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"全天流量监测异常:"
,
e
);
log
.
error
(
"全天流量监测异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
return
hotspotCrossVOS
;
return
hotspotCrossVOS
;
}
}
...
@@ -1950,7 +1951,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1950,7 +1951,7 @@ public class TrendServiceImpl implements TrendService {
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"交通状态时间比例异常:"
,
e
);
log
.
error
(
"交通状态时间比例异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
return
crossStatusTimeRateVO
;
return
crossStatusTimeRateVO
;
}
}
...
@@ -1967,7 +1968,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1967,7 +1968,7 @@ public class TrendServiceImpl implements TrendService {
return
buildCycleData
(
crossId
,
poExtList
);
return
buildCycleData
(
crossId
,
poExtList
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"车道数据查询异常:"
,
e
);
log
.
error
(
"车道数据查询异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
}
}
...
@@ -1993,22 +1994,15 @@ public class TrendServiceImpl implements TrendService {
...
@@ -1993,22 +1994,15 @@ public class TrendServiceImpl implements TrendService {
return
sorts
;
return
sorts
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"车道快照数据查询异常:"
,
e
);
log
.
error
(
"车道快照数据查询异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
}
}
@Override
@Override
public
List
<
OverflowEvent
>
overFlowEvent
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
public
List
<
OverflowEvent
>
overFlowEvent
(
LaneSnapshotIndexVO
laneSnapshotIndexVO
)
throws
Exception
{
try
{
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
<
OverflowEvent
>
resultList
=
new
ArrayList
<>();
// 查询秒级数据
List
<
CrossLaneSnapshotDataDTO
>
dtoList
=
getCrossLaneSnapshotDataDTOS
(
laneSnapshotIndexVO
);
List
<
CrossLaneSnapshotDataDTO
>
dtoList
=
laneSnapshotDataQueryService
.
queryByCrossIdAndTimeSpan
(
crossId
,
start
,
end
,
pageNum
,
null
,
overFlow
);
if
(!
CollectionUtils
.
isEmpty
(
dtoList
))
{
if
(!
CollectionUtils
.
isEmpty
(
dtoList
))
{
Map
<
String
,
List
<
CrossLaneSnapshotDataDTO
>>
timeMap
=
dtoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossLaneSnapshotDataDTO:
:
getTimeStamp
));
Map
<
String
,
List
<
CrossLaneSnapshotDataDTO
>>
timeMap
=
dtoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossLaneSnapshotDataDTO:
:
getTimeStamp
));
for
(
Map
.
Entry
<
String
,
List
<
CrossLaneSnapshotDataDTO
>>
timeEntry
:
timeMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
CrossLaneSnapshotDataDTO
>>
timeEntry
:
timeMap
.
entrySet
())
{
...
@@ -2016,8 +2010,21 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2016,8 +2010,21 @@ public class TrendServiceImpl implements TrendService {
List
<
CrossLaneSnapshotDataDTO
>
timeList
=
timeEntry
.
getValue
();
List
<
CrossLaneSnapshotDataDTO
>
timeList
=
timeEntry
.
getValue
();
if
(
CollectionUtil
.
isNotEmpty
(
timeList
))
{
if
(
CollectionUtil
.
isNotEmpty
(
timeList
))
{
Map
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirMap
=
timeList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossLaneSnapshotDataDTO:
:
getDir
));
Map
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirMap
=
timeList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CrossLaneSnapshotDataDTO:
:
getDir
));
for
(
Map
.
Entry
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirEntry
:
dirMap
.
entrySet
())
{
for
(
Map
.
Entry
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirEntry
:
dirMap
.
entrySet
())
{
OverflowEvent
resultPojo
=
getOverflowEvent
(
time
,
dirEntry
);
resultList
.
add
(
resultPojo
);
}
}
}
}
return
resultList
;
}
catch
(
Exception
e
)
{
log
.
error
(
"车道快照数据查询异常:"
,
e
);
throw
new
OptServiceException
(
e
);
}
}
private
static
OverflowEvent
getOverflowEvent
(
String
time
,
Map
.
Entry
<
Integer
,
List
<
CrossLaneSnapshotDataDTO
>>
dirEntry
)
{
Integer
dir
=
dirEntry
.
getKey
();
Integer
dir
=
dirEntry
.
getKey
();
List
<
CrossLaneSnapshotDataDTO
>
dirList
=
dirEntry
.
getValue
();
List
<
CrossLaneSnapshotDataDTO
>
dirList
=
dirEntry
.
getValue
();
OverflowEvent
resultPojo
=
new
OverflowEvent
();
OverflowEvent
resultPojo
=
new
OverflowEvent
();
...
@@ -2036,17 +2043,20 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2036,17 +2043,20 @@ public class TrendServiceImpl implements TrendService {
resultPojo
.
setOverflowId
(
String
.
valueOf
(
dir
));
resultPojo
.
setOverflowId
(
String
.
valueOf
(
dir
));
resultPojo
.
setOverflowNums
(
overflowNums
);
resultPojo
.
setOverflowNums
(
overflowNums
);
resultPojo
.
setSpeed
(
Math
.
round
(
meanV
/
dirList
.
size
()
*
100
)
/
100
);
resultPojo
.
setSpeed
(
Math
.
round
(
meanV
/
dirList
.
size
()
*
100
)
/
100
);
resultPojo
.
setVehicleLengthRatio
(
Math
.
round
(
vehicleLengthRatio
/
dirList
.
size
()
*
100
)
/
100
);
resultPojo
.
setVehicleLengthRatio
(
Math
.
round
(
vehicleLengthRatio
/
dirList
.
size
()
*
100
));
resultList
.
add
(
resultPojo
);
return
resultPojo
;
}
}
}
}
return
resultList
;
}
catch
(
Exception
e
)
{
log
.
error
(
"车道快照数据查询异常:"
,
e
);
throw
new
Exception
(
e
);
}
}
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
@Override
...
@@ -2067,7 +2077,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2067,7 +2077,7 @@ public class TrendServiceImpl implements TrendService {
return
ridTurnIndicatorsMapper
.
selectList
(
queryWrapper
);
return
ridTurnIndicatorsMapper
.
selectList
(
queryWrapper
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"全是周期车道数据方向转向查询异常:"
,
e
);
log
.
error
(
"全是周期车道数据方向转向查询异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
}
}
...
@@ -2105,7 +2115,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2105,7 +2115,7 @@ public class TrendServiceImpl implements TrendService {
return
results
;
return
results
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"全息事件查询异常:"
,
e
);
log
.
error
(
"全息事件查询异常:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
}
}
...
@@ -2133,7 +2143,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2133,7 +2143,7 @@ public class TrendServiceImpl implements TrendService {
return
laneIdAliasNameVOS
;
return
laneIdAliasNameVOS
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"车道基本信息查询失败:"
,
e
);
log
.
error
(
"车道基本信息查询失败:"
,
e
);
throw
new
Exception
(
e
);
throw
new
OptService
Exception
(
e
);
}
}
}
}
...
@@ -2256,7 +2266,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2256,7 +2266,7 @@ public class TrendServiceImpl implements TrendService {
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"转向周期数据"
),
TurnDataIndexExcelVO
.
class
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
result
,
crossName
.
concat
(
"转向周期数据"
),
TurnDataIndexExcelVO
.
class
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"导出转向数据异常:"
,
e
);
log
.
error
(
"导出转向数据异常:"
,
e
);
throw
new
Runtim
eException
(
e
);
throw
new
OptServic
eException
(
e
);
}
}
}
}
...
@@ -2284,7 +2294,7 @@ public class TrendServiceImpl implements TrendService {
...
@@ -2284,7 +2294,7 @@ public class TrendServiceImpl implements TrendService {
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
dataList
,
crossName
.
concat
(
"车道快照数据"
),
TableQueryVO
.
RealTimeDataElement
.
class
);
ExcelExportUtils
.
exportExcel
(
response
,
startStr
,
endStr
,
dataList
,
crossName
.
concat
(
"车道快照数据"
),
TableQueryVO
.
RealTimeDataElement
.
class
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"快照数据导出失败:"
,
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