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
702b03ce
Commit
702b03ce
authored
Mar 09, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 诊断优化,优化日志根据相位号去重
parent
fad4219a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
DiagnoServiceImpl.java
...in/java/net/wanji/opt/service/impl/DiagnoServiceImpl.java
+11
-3
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/service/impl/DiagnoServiceImpl.java
View file @
702b03ce
...
...
@@ -44,11 +44,14 @@ import net.wanji.opt.vo.SchemeOptVO;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -159,6 +162,10 @@ public class DiagnoServiceImpl implements DiagnoService {
schemeOptVO
.
setCrossId
(
crossId
);
// 选择数据批次时间最大的记录
List
<
CrossSchemeOptLogPO
>
maxList
=
crossSchemeOptLogMapper
.
selectMaxByCrossId
(
crossId
);
// 根据相位去重
TreeSet
<
CrossSchemeOptLogPO
>
collect
=
maxList
.
stream
()
.
collect
(
Collectors
.
toCollection
(
()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CrossSchemeOptLogPO:
:
getPhaseNo
))));
CrossSchemeOptLogPO
crossSchemeOptLogPO
=
maxList
.
get
(
0
);
String
optType
=
crossSchemeOptLogPO
.
getOptType
();
schemeOptVO
.
setOptType
(
Integer
.
parseInt
(
optType
));
...
...
@@ -168,7 +175,7 @@ public class DiagnoServiceImpl implements DiagnoService {
schemeOptVO
.
setSchemeId
(
crossSchemePO
.
getId
());
schemeOptVO
.
setOffset
(
crossSchemeOptLogPO
.
getOffset
());
// 构造调整时间列表
List
<
SchemeOptVO
.
PhaseOptTime
>
phaseOptTimeList
=
buildPhaseOptTimeList
(
maxLis
t
);
List
<
SchemeOptVO
.
PhaseOptTime
>
phaseOptTimeList
=
buildPhaseOptTimeList
(
collec
t
);
schemeOptVO
.
setPhaseOptTimeList
(
phaseOptTimeList
);
return
schemeOptVO
;
}
...
...
@@ -315,7 +322,7 @@ public class DiagnoServiceImpl implements DiagnoService {
try
{
crossSchemeOptLogPO
=
maxList
.
get
(
0
);
}
catch
(
IndexOutOfBoundsException
e
)
{
throw
new
RuntimeException
(
"
优化日志数据库中无此路口记录
"
);
throw
new
RuntimeException
(
"
没有该路口优化日志数据
"
);
}
String
dataExtend
=
crossSchemeOptLogPO
.
getDataExtend
();
OptDataExtend
optDataExtend
=
gson
.
fromJson
(
dataExtend
,
OptDataExtend
.
class
);
...
...
@@ -428,7 +435,8 @@ public class DiagnoServiceImpl implements DiagnoService {
}
private
List
<
SchemeOptVO
.
PhaseOptTime
>
buildPhaseOptTimeList
(
List
<
CrossSchemeOptLogPO
>
crossSchemeOptLogPOList
)
{
private
List
<
SchemeOptVO
.
PhaseOptTime
>
buildPhaseOptTimeList
(
Collection
<
CrossSchemeOptLogPO
>
crossSchemeOptLogPOList
)
{
List
<
SchemeOptVO
.
PhaseOptTime
>
phaseOptTimeList
=
new
ArrayList
<>();
for
(
CrossSchemeOptLogPO
crossSchemeOptLogPO
:
crossSchemeOptLogPOList
)
{
SchemeOptVO
.
PhaseOptTime
phaseOptTime
=
new
SchemeOptVO
.
PhaseOptTime
();
...
...
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