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
42043a14
Commit
42043a14
authored
Aug 23, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 新信号评价-运行评价-详细指标查询-指标信息
parent
9a33412d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
RunningEvaluateServiceImpl.java
...et/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
+28
-1
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/RunningEvaluateServiceImpl.java
View file @
42043a14
...
...
@@ -420,7 +420,34 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
problemStatus
.
setDurationMinutes
(
duration1
);
res
.
add
(
problemStatus
);
}
return
res
;
// 合并时间区间
// 先按 status 排序,status 相同再按 startTime 排序
List
<
RunningEvaluateMetricsDetailVO
.
ProblemStatus
>
sortedList
=
res
.
stream
()
.
sorted
(
Comparator
.
comparingInt
(
RunningEvaluateMetricsDetailVO
.
ProblemStatus
::
getStatus
)
.
thenComparing
(
RunningEvaluateMetricsDetailVO
.
ProblemStatus
::
getStartTime
))
.
collect
(
Collectors
.
toList
());
List
<
RunningEvaluateMetricsDetailVO
.
ProblemStatus
>
mergedList
=
new
ArrayList
<>();
RunningEvaluateMetricsDetailVO
.
ProblemStatus
current
=
sortedList
.
get
(
0
);
for
(
int
i
=
1
;
i
<
sortedList
.
size
();
i
++)
{
RunningEvaluateMetricsDetailVO
.
ProblemStatus
next
=
sortedList
.
get
(
i
);
if
(
Objects
.
equals
(
current
.
getStatus
(),
next
.
getStatus
())
&&
!
current
.
getEndTime
().
before
(
next
.
getStartTime
()))
{
// 如果有交叉,则合并记录
current
.
setEndTime
(
new
Date
(
Math
.
max
(
current
.
getEndTime
().
getTime
(),
next
.
getEndTime
().
getTime
())));
current
.
setDurationMinutes
(
(
int
)
((
current
.
getEndTime
().
getTime
()
-
current
.
getStartTime
().
getTime
())
/
(
60
*
1000
)));
}
else
{
// 否则,将当前记录添加到结果列表中,并更新当前记录
mergedList
.
add
(
current
);
current
=
next
;
}
}
mergedList
.
add
(
current
);
// 添加最后一个记录
return
mergedList
;
}
private
boolean
isDataValid
(
List
<
MetricHistDTO
>
metricHistDTOList
)
{
...
...
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