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
dba9312e
Commit
dba9312e
authored
Jun 25, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 优化相位转化逻辑,阶段号就是相位号
parent
21ce3fd2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
46 deletions
+66
-46
SchemeInfoPojo.java
...ain/java/net/wanji/com/pojo/dtconvert/SchemeInfoPojo.java
+1
-0
DTStaticInfoServiceImpl.java
.../com/service/controller/impl/DTStaticInfoServiceImpl.java
+65
-46
No files found.
signal-utc-dt-service/src/main/java/net/wanji/com/pojo/dtconvert/SchemeInfoPojo.java
View file @
dba9312e
...
@@ -38,6 +38,7 @@ public class SchemeInfoPojo {
...
@@ -38,6 +38,7 @@ public class SchemeInfoPojo {
List
<
SchemeStagePojo
>
schemeStagePojos
=
new
ArrayList
<>();
List
<
SchemeStagePojo
>
schemeStagePojos
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
schemeInfoPojo
.
getPhaseStageChain
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
schemeInfoPojo
.
getPhaseStageChain
().
size
();
i
++)
{
SchemeStagePojo
schemeStagePojo
=
new
SchemeStagePojo
();
SchemeStagePojo
schemeStagePojo
=
new
SchemeStagePojo
();
schemeStagePojo
.
setSchemeId
(
schemeInfoPojo
.
getSchemeId
());
schemeStagePojo
.
setPhaseStageId
(
schemeInfoPojo
.
getPhaseStageChain
().
get
(
i
));
schemeStagePojo
.
setPhaseStageId
(
schemeInfoPojo
.
getPhaseStageChain
().
get
(
i
));
schemeStagePojo
.
setPhaseStageTime
(
schemeInfoPojo
.
getPhaseStageTimeChain
().
get
(
i
));
schemeStagePojo
.
setPhaseStageTime
(
schemeInfoPojo
.
getPhaseStageTimeChain
().
get
(
i
));
schemeStagePojo
.
setPhaseStageType
(
schemeInfoPojo
.
getPhaseStageTypeChain
().
get
(
i
));
schemeStagePojo
.
setPhaseStageType
(
schemeInfoPojo
.
getPhaseStageTypeChain
().
get
(
i
));
...
...
signal-utc-dt-service/src/main/java/net/wanji/com/service/controller/impl/DTStaticInfoServiceImpl.java
View file @
dba9312e
...
@@ -69,7 +69,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -69,7 +69,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
List
<
BaseCrossSchemePO
>
crossSchemeList
=
getCrossSchemeList
(
crossId
,
schemeInfoPojos
);
List
<
BaseCrossSchemePO
>
crossSchemeList
=
getCrossSchemeList
(
crossId
,
schemeInfoPojos
);
List
<
CrossPhasePO
>
crossPhaseList
=
getCrossPhaseList
(
crossId
,
phaseInfoPojos
,
phaseStageInfoPojos
,
schemeInfoPojos
);
List
<
CrossPhasePO
>
crossPhaseList
=
getCrossPhaseList
(
crossId
,
phaseInfoPojos
,
phaseStageInfoPojos
,
schemeInfoPojos
);
List
<
CrossLightsPO
>
crossLightsList
=
getCrossLightsList
(
crossId
,
crossPhaseList
,
phaseInfoPojos
,
lightsInfoPojos
);
List
<
CrossLightsPO
>
crossLightsList
=
getCrossLightsList
(
crossId
,
crossPhaseList
,
phaseInfoPojos
,
lightsInfoPojos
);
List
<
CrossPhaseLightsPO
>
crossPhaseLightsPOList
=
getCrossPhaseLightsList
(
crossId
,
crossPhaseList
,
phaseInfoPojos
);
List
<
CrossPhaseLightsPO
>
crossPhaseLightsPOList
=
getCrossPhaseLightsList
(
crossId
,
crossPhaseList
,
phaseInfoPojos
,
phaseStageInfoPojos
);
schemePhaseLightsVO
.
setCrossPhaseLightsPOList
(
crossPhaseLightsPOList
);
schemePhaseLightsVO
.
setCrossPhaseLightsPOList
(
crossPhaseLightsPOList
);
schemePhaseLightsVO
.
setCrossPhaseList
(
crossPhaseList
);
schemePhaseLightsVO
.
setCrossPhaseList
(
crossPhaseList
);
schemePhaseLightsVO
.
setCrossLightsList
(
crossLightsList
);
schemePhaseLightsVO
.
setCrossLightsList
(
crossLightsList
);
...
@@ -77,13 +77,20 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -77,13 +77,20 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
return
schemePhaseLightsVO
;
return
schemePhaseLightsVO
;
}
}
private
List
<
CrossPhaseLightsPO
>
getCrossPhaseLightsList
(
String
crossId
,
List
<
CrossPhasePO
>
crossPhaseList
,
List
<
PhaseInfoPojo
>
phaseInfoPojos
)
{
private
List
<
CrossPhaseLightsPO
>
getCrossPhaseLightsList
(
String
crossId
,
List
<
CrossPhasePO
>
crossPhaseList
,
List
<
PhaseInfoPojo
>
phaseInfoPojos
,
List
<
PhaseStageInfoPojo
>
phaseStageInfoPojos
)
{
List
<
CrossPhaseLightsPO
>
crossPhaseLightsList
=
new
ArrayList
<>(
crossPhaseList
.
size
());
List
<
CrossPhaseLightsPO
>
crossPhaseLightsList
=
new
ArrayList
<>(
crossPhaseList
.
size
());
for
(
CrossPhasePO
crossPhasePO
:
crossPhaseList
)
{
for
(
CrossPhasePO
crossPhasePO
:
crossPhaseList
)
{
// 当前相位号为阶段号
String
phaseNo
=
crossPhasePO
.
getPhaseNo
();
List
<
Integer
>
phaseList
=
new
ArrayList
<>();
for
(
PhaseStageInfoPojo
phaseStageInfoPojo
:
phaseStageInfoPojos
)
{
if
(
StringUtils
.
equals
(
phaseNo
,
String
.
valueOf
(
phaseStageInfoPojo
.
getPhaseStageId
())))
{
phaseList
=
phaseStageInfoPojo
.
getPhaseList
();
}
}
for
(
PhaseInfoPojo
phaseInfoPojo
:
phaseInfoPojos
)
{
for
(
PhaseInfoPojo
phaseInfoPojo
:
phaseInfoPojos
)
{
if
(
StringUtils
.
equals
(
crossPhasePO
.
getPhaseNo
(),
String
.
valueOf
(
phaseInfoPojo
.
getPhaseId
()
)))
{
if
(
phaseList
.
contains
(
phaseInfoPojo
.
getPhaseId
(
)))
{
CrossPhaseLightsPO
crossPhaseLightsPO
=
new
CrossPhaseLightsPO
();
CrossPhaseLightsPO
crossPhaseLightsPO
=
new
CrossPhaseLightsPO
();
crossPhaseLightsPO
.
setPhaseId
(
phaseInfoPojo
.
getPhaseId
(
));
crossPhaseLightsPO
.
setPhaseId
(
Integer
.
valueOf
(
phaseNo
));
crossPhaseLightsPO
.
setLightsId
(
phaseInfoPojo
.
getLightsId
());
crossPhaseLightsPO
.
setLightsId
(
phaseInfoPojo
.
getLightsId
());
crossPhaseLightsPO
.
setCrossId
(
crossId
);
crossPhaseLightsPO
.
setCrossId
(
crossId
);
crossPhaseLightsList
.
add
(
crossPhaseLightsPO
);
crossPhaseLightsList
.
add
(
crossPhaseLightsPO
);
...
@@ -125,49 +132,60 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -125,49 +132,60 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
return
crossLightsList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
return
crossLightsList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
}
/**
* 转化为万集单环模式,阶段号就是相位号
*
* @param crossId
* @param phaseInfoPojos
* @param phaseStageInfoPojos
* @param schemeInfoPojos
* @return
*/
private
List
<
CrossPhasePO
>
getCrossPhaseList
(
String
crossId
,
List
<
PhaseInfoPojo
>
phaseInfoPojos
,
List
<
PhaseStageInfoPojo
>
phaseStageInfoPojos
,
List
<
SchemeInfoPojo
>
schemeInfoPojos
)
{
private
List
<
CrossPhasePO
>
getCrossPhaseList
(
String
crossId
,
List
<
PhaseInfoPojo
>
phaseInfoPojos
,
List
<
PhaseStageInfoPojo
>
phaseStageInfoPojos
,
List
<
SchemeInfoPojo
>
schemeInfoPojos
)
{
List
<
CrossPhasePO
>
crossPhaseList
=
new
ArrayList
<>();
List
<
CrossPhasePO
>
crossPhaseList
=
new
ArrayList
<>();
int
sort
=
0
;
for
(
PhaseStageInfoPojo
phaseStageInfoPojo
:
phaseStageInfoPojos
)
{
for
(
SchemeInfoPojo
schemeInfoPojo
:
schemeInfoPojos
)
{
int
sort
=
0
;
List
<
SchemeInfoPojo
.
SchemeStagePojo
>
stageInfoList
=
SchemeInfoPojo
.
getStageInfoList
(
schemeInfoPojo
);
Integer
phaseStageId
=
phaseStageInfoPojo
.
getPhaseStageId
();
for
(
SchemeInfoPojo
.
SchemeStagePojo
schemeStagePojo
:
stageInfoList
)
{
Integer
schemeId
=
0
;
Integer
phaseStageId
=
schemeStagePojo
.
getPhaseStageId
();
Integer
phaseStageTime
=
0
;
Integer
phaseStageTime
=
schemeStagePojo
.
getPhaseStageTime
();
for
(
SchemeInfoPojo
schemeInfoPojo
:
schemeInfoPojos
)
{
for
(
PhaseStageInfoPojo
phaseStageInfoPojo
:
phaseStageInfoPojos
)
{
List
<
SchemeInfoPojo
.
SchemeStagePojo
>
stageInfoList
=
SchemeInfoPojo
.
getStageInfoList
(
schemeInfoPojo
);
if
(
Objects
.
equals
(
phaseStageId
,
phaseStageInfoPojo
.
getPhaseStageId
()))
{
for
(
SchemeInfoPojo
.
SchemeStagePojo
schemeStagePojo
:
stageInfoList
)
{
List
<
Integer
>
phaseList
=
phaseStageInfoPojo
.
getPhaseList
();
if
(
Objects
.
equals
(
phaseStageId
,
schemeStagePojo
.
getPhaseStageId
()))
{
int
ringNo
=
0
;
sort
=
stageInfoList
.
indexOf
(
schemeStagePojo
)
+
1
;
for
(
Integer
phaseId
:
phaseList
)
{
schemeId
=
schemeStagePojo
.
getSchemeId
();
CrossPhasePO
crossPhasePO
=
new
CrossPhasePO
();
phaseStageTime
=
schemeStagePojo
.
getPhaseStageTime
();
crossPhasePO
.
setCrossId
(
crossId
);
crossPhasePO
.
setPhaseNo
(
String
.
valueOf
(
phaseId
));
crossPhasePO
.
setName
(
StringUtils
.
join
(
"相位"
,
phaseId
));
++
sort
;
crossPhasePO
.
setSort
(
sort
);
crossPhasePO
.
setPlanId
(
schemeInfoPojo
.
getSchemeId
());
crossPhasePO
.
setRingNo
(++
ringNo
);
crossPhasePO
.
setGroupNo
(
1
);
crossPhasePO
.
setPhaseTime
(
phaseStageTime
);
crossPhasePO
.
setControlMode
(
1
);
crossPhasePO
.
setPhaseTime
(
schemeStagePojo
.
getPhaseStageTime
());
PhaseInfoPojo
phaseInfoPojo
=
PhaseInfoPojo
.
getPhaseInfoPojoByPhaseId
(
phaseId
,
phaseInfoPojos
);
if
(
Objects
.
nonNull
(
phaseInfoPojo
))
{
crossPhasePO
.
setGreenTime
(
phaseInfoPojo
.
getGreenTime
());
crossPhasePO
.
setGreenFlashTime
(
phaseInfoPojo
.
getGreenFlashTime
());
crossPhasePO
.
setYellowFlashTime
(
phaseInfoPojo
.
getYellowFlashTime
());
crossPhasePO
.
setYellowTime
(
phaseInfoPojo
.
getYellowTime
());
crossPhasePO
.
setRedTime
(
phaseInfoPojo
.
getRedTime
());
crossPhasePO
.
setMinGreenTime
(
phaseInfoPojo
.
getMinGreenTime
());
crossPhasePO
.
setMaxGreenTime
(
phaseInfoPojo
.
getMaxGreenTime
());
}
crossPhaseList
.
add
(
crossPhasePO
);
}
}
}
}
}
}
}
List
<
Integer
>
phaseList
=
phaseStageInfoPojo
.
getPhaseList
();
CrossPhasePO
crossPhasePO
=
new
CrossPhasePO
();
for
(
Integer
phaseId
:
phaseList
)
{
crossPhasePO
.
setCrossId
(
crossId
);
crossPhasePO
.
setPhaseNo
(
String
.
valueOf
(
phaseStageId
));
crossPhasePO
.
setName
(
StringUtils
.
join
(
"相位"
,
phaseStageId
));
crossPhasePO
.
setSort
(
sort
);
crossPhasePO
.
setPlanId
(
schemeId
);
crossPhasePO
.
setRingNo
(
1
);
crossPhasePO
.
setGroupNo
(
1
);
crossPhasePO
.
setPhaseTime
(
phaseStageTime
);
crossPhasePO
.
setControlMode
(
1
);
crossPhasePO
.
setPhaseType
(
1
);
crossPhasePO
.
setPhaseTime
(
phaseStageTime
);
PhaseInfoPojo
phaseInfoPojo
=
PhaseInfoPojo
.
getPhaseInfoPojoByPhaseId
(
phaseId
,
phaseInfoPojos
);
if
(
Objects
.
nonNull
(
phaseInfoPojo
))
{
crossPhasePO
.
setGreenTime
(
phaseInfoPojo
.
getGreenTime
());
crossPhasePO
.
setGreenFlashTime
(
phaseInfoPojo
.
getGreenFlashTime
());
crossPhasePO
.
setYellowFlashTime
(
phaseInfoPojo
.
getYellowFlashTime
());
crossPhasePO
.
setYellowTime
(
phaseInfoPojo
.
getYellowTime
());
crossPhasePO
.
setRedTime
(
phaseInfoPojo
.
getRedTime
());
crossPhasePO
.
setMinGreenTime
(
phaseInfoPojo
.
getMinGreenTime
());
crossPhasePO
.
setMaxGreenTime
(
phaseInfoPojo
.
getMaxGreenTime
());
}
crossPhaseList
.
add
(
crossPhasePO
);
}
}
}
return
crossPhaseList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
return
crossPhaseList
;
}
}
private
List
<
BaseCrossSchemePO
>
getCrossSchemeList
(
String
crossId
,
List
<
SchemeInfoPojo
>
schemeInfoPojos
)
{
private
List
<
BaseCrossSchemePO
>
getCrossSchemeList
(
String
crossId
,
List
<
SchemeInfoPojo
>
schemeInfoPojos
)
{
...
@@ -251,6 +269,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -251,6 +269,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
list
.
add
(
HexUtil
.
hexToInt
(
phaseTypeHex
));
list
.
add
(
HexUtil
.
hexToInt
(
phaseTypeHex
));
}
}
}
}
Collections
.
reverse
(
list
);
return
list
;
return
list
;
}
}
...
@@ -469,7 +488,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -469,7 +488,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
List
<
CrossSectionPO
>
crossSectionPOList
=
new
ArrayList
<>();
List
<
CrossSectionPO
>
crossSectionPOList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
startTimeChain
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
startTimeChain
.
size
();
i
++)
{
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
crossSectionPO
.
setSectionNo
(
String
.
valueOf
(
i
+
1
));
crossSectionPO
.
setSectionNo
(
String
.
valueOf
(
i
+
1
));
crossSectionPO
.
setStartTime
(
startTimeChain
.
get
(
i
));
crossSectionPO
.
setStartTime
(
startTimeChain
.
get
(
i
));
if
(
i
+
1
<
startTimeChain
.
size
())
{
if
(
i
+
1
<
startTimeChain
.
size
())
{
crossSectionPO
.
setEndTime
(
startTimeChain
.
get
(
i
+
1
));
crossSectionPO
.
setEndTime
(
startTimeChain
.
get
(
i
+
1
));
...
@@ -576,7 +595,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -576,7 +595,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
return
getCrossSchedulesPOs
(
crossId
,
scheduleInfoPojos
);
return
getCrossSchedulesPOs
(
crossId
,
scheduleInfoPojos
);
}
}
private
List
<
CrossSchedulesPO
>
getCrossSchedulesPOs
(
String
crossId
,
List
<
ScheduleInfoPojo
>
scheduleInfoPojos
)
throws
Exception
{
private
List
<
CrossSchedulesPO
>
getCrossSchedulesPOs
(
String
crossId
,
List
<
ScheduleInfoPojo
>
scheduleInfoPojos
)
throws
Exception
{
List
<
CrossSchedulesPO
>
crossSchedulesPOS
=
new
ArrayList
<>(
scheduleInfoPojos
.
size
());
List
<
CrossSchedulesPO
>
crossSchedulesPOS
=
new
ArrayList
<>(
scheduleInfoPojos
.
size
());
for
(
ScheduleInfoPojo
scheduleInfoPojo
:
scheduleInfoPojos
)
{
for
(
ScheduleInfoPojo
scheduleInfoPojo
:
scheduleInfoPojos
)
{
List
<
Integer
>
week
=
scheduleInfoPojo
.
getWeek
();
List
<
Integer
>
week
=
scheduleInfoPojo
.
getWeek
();
...
@@ -589,7 +608,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -589,7 +608,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
crossSchedulesPO
.
setWeek
(
weekday
);
crossSchedulesPO
.
setWeek
(
weekday
);
crossSchedulesPOS
.
add
(
crossSchedulesPO
);
crossSchedulesPOS
.
add
(
crossSchedulesPO
);
}
}
if
(
week
.
size
()
!=
7
)
{
if
(
week
.
size
()
!=
7
)
{
List
<
Integer
>
month
=
scheduleInfoPojo
.
getMonth
();
List
<
Integer
>
month
=
scheduleInfoPojo
.
getMonth
();
for
(
Integer
currentMonth
:
month
)
{
for
(
Integer
currentMonth
:
month
)
{
LocalDate
currentDate
=
LocalDate
.
now
();
LocalDate
currentDate
=
LocalDate
.
now
();
...
@@ -600,7 +619,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
...
@@ -600,7 +619,7 @@ public class DTStaticInfoServiceImpl implements StaticInfoService {
crossSchedulesPO
.
setName
(
StringUtils
.
join
(
"调度"
,
scheduleInfoPojo
.
getScheduleId
()));
crossSchedulesPO
.
setName
(
StringUtils
.
join
(
"调度"
,
scheduleInfoPojo
.
getScheduleId
()));
crossSchedulesPO
.
setCrossId
(
crossId
);
crossSchedulesPO
.
setCrossId
(
crossId
);
crossSchedulesPO
.
setPlanId
(
scheduleInfoPojo
.
getDailyPlanId
());
crossSchedulesPO
.
setPlanId
(
scheduleInfoPojo
.
getDailyPlanId
());
Date
date
=
DateUtil
.
parse
(
StringUtils
.
join
(
currentYear
,
"-"
,
currentMonth
,
"-"
,
day
),
DateStyle
.
YYYY_MM_DD
.
getValue
());
Date
date
=
DateUtil
.
parse
(
StringUtils
.
join
(
currentYear
,
"-"
,
currentMonth
,
"-"
,
day
),
DateStyle
.
YYYY_MM_DD
.
getValue
());
crossSchedulesPO
.
setSpecialDate
(
date
);
crossSchedulesPO
.
setSpecialDate
(
date
);
crossSchedulesPOS
.
add
(
crossSchedulesPO
);
crossSchedulesPOS
.
add
(
crossSchedulesPO
);
}
}
...
...
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