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
09734f43
Commit
09734f43
authored
Feb 10, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方案下发-信号机方案同步
parent
bbf60c16
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
6 deletions
+45
-6
PlanSendServiceImpl.java
.../java/net/wanji/web/service/impl/PlanSendServiceImpl.java
+39
-0
CrossPhaseMapper.java
.../src/main/java/net/wanji/utc/mapper/CrossPhaseMapper.java
+1
-1
HkSchemePhaseLightsServiceImpl.java
...rvice/staticinfo/impl/HkSchemePhaseLightsServiceImpl.java
+4
-4
CrossPhaseMapper.xml
...tc-service/src/main/resources/mapper/CrossPhaseMapper.xml
+1
-1
No files found.
signal-control-service/src/main/java/net/wanji/web/service/impl/PlanSendServiceImpl.java
View file @
09734f43
...
...
@@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
...
...
@@ -242,18 +243,56 @@ public class PlanSendServiceImpl implements PlanSendService {
}
List
<
CrossSchemePO
>
crossSchemeList
=
schemePhaseLightsVO
.
getCrossSchemeList
();
crossSchemeMapper
.
deleteByCrossId
(
crossId
);
// 保存旧方案ID
List
<
Integer
>
oldSchemeIds
=
crossSchemeList
.
stream
().
map
(
CrossSchemePO:
:
getId
).
collect
(
Collectors
.
toList
());;
// 保存新方案ID
crossSchemeMapper
.
insertBatch
(
crossSchemeList
);
List
<
Integer
>
newSchemeIds
=
crossSchemeList
.
stream
().
map
(
CrossSchemePO:
:
getId
).
collect
(
Collectors
.
toList
());;
// 生成新旧方案ID映射
Map
<
Integer
,
Integer
>
oldNewSchemeId
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
oldSchemeIds
.
size
();
i
++)
{
oldNewSchemeId
.
put
(
oldSchemeIds
.
get
(
i
),
newSchemeIds
.
get
(
i
));
}
List
<
CrossPhasePO
>
crossPhaseList
=
schemePhaseLightsVO
.
getCrossPhaseList
();
crossPhaseMapper
.
deleteByCrossId
(
crossId
);
// 保存旧相位ID
List
<
Integer
>
oldPhaseIds
=
crossPhaseList
.
stream
().
map
(
CrossPhasePO:
:
getId
).
collect
(
Collectors
.
toList
());
// 更新方案ID
for
(
CrossPhasePO
crossPhasePO
:
crossPhaseList
)
{
crossPhasePO
.
setPlanId
(
oldNewSchemeId
.
get
(
crossPhasePO
.
getPlanId
()));
}
// 保存新相位ID
crossPhaseMapper
.
insertBatch
(
crossPhaseList
);
List
<
Integer
>
newPhaseIds
=
crossPhaseList
.
stream
().
map
(
CrossPhasePO:
:
getId
).
collect
(
Collectors
.
toList
());
// 生成新旧相位ID映射
Map
<
Integer
,
Integer
>
oldNewPhaseId
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
oldPhaseIds
.
size
();
i
++)
{
oldNewPhaseId
.
put
(
oldPhaseIds
.
get
(
i
),
newPhaseIds
.
get
(
i
));
}
List
<
CrossLightsPO
>
crossLightsList
=
schemePhaseLightsVO
.
getCrossLightsList
();
crossLightsMapper
.
deleteByCrossId
(
crossId
);
// 保存旧灯组ID
List
<
Integer
>
oldLightsIds
=
crossLightsList
.
stream
().
map
(
CrossLightsPO:
:
getId
).
collect
(
Collectors
.
toList
());
// 保存新灯组ID
crossLightsMapper
.
insertBatch
(
crossLightsList
);
List
<
Integer
>
newLightsIds
=
crossLightsList
.
stream
().
map
(
CrossLightsPO:
:
getId
).
collect
(
Collectors
.
toList
());
// 生成新旧灯组ID映射
Map
<
Integer
,
Integer
>
oldNewLightsId
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
oldLightsIds
.
size
();
i
++)
{
oldNewLightsId
.
put
(
oldLightsIds
.
get
(
i
),
newLightsIds
.
get
(
i
));
}
List
<
CrossPhaseLightsPO
>
crossPhaseLightsPOList
=
schemePhaseLightsVO
.
getCrossPhaseLightsPOList
();
crossPhaseLightsMapper
.
deleteByCrossId
(
crossId
);
// 更新ID
for
(
CrossPhaseLightsPO
crossPhaseLightsPO
:
crossPhaseLightsPOList
)
{
Integer
oldPhaseId
=
crossPhaseLightsPO
.
getPhaseId
();
Integer
oldLightsId
=
crossPhaseLightsPO
.
getLightsId
();
crossPhaseLightsPO
.
setPhaseId
(
oldNewPhaseId
.
get
(
oldPhaseId
));
crossPhaseLightsPO
.
setLightsId
(
oldNewLightsId
.
get
(
oldLightsId
));
}
crossPhaseLightsMapper
.
insertBatch
(
crossPhaseLightsPOList
);
}
return
jsonViewObject
.
success
();
...
...
signal-utc-service/src/main/java/net/wanji/utc/mapper/CrossPhaseMapper.java
View file @
09734f43
...
...
@@ -18,7 +18,7 @@ public interface CrossPhaseMapper {
List
<
CrossPhasePO
>
selectByCrossIdAndPlanId
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"planId"
)
String
planId
);
List
<
Integer
>
selectIdsByPhaseNo
(
@Param
(
"phaseNo"
)
Integer
phaseNo
);
List
<
Integer
>
selectIdsByPhaseNo
(
String
crossId
,
@Param
(
"phaseNo"
)
Integer
phaseNo
);
List
<
CrossPhasePO
>
selectByCrossId
(
@Param
(
"crossId"
)
String
crossId
);
}
signal-utc-service/src/main/java/net/wanji/utc/service/staticinfo/impl/HkSchemePhaseLightsServiceImpl.java
View file @
09734f43
...
...
@@ -111,12 +111,12 @@ public class HkSchemePhaseLightsServiceImpl implements HkSchemePhaseLightsServic
PhaseCache
phaseCache
=
laneNoMap
.
get
(
Integer
.
parseInt
(
laneNo
));
if
(
phaseCache
!=
null
)
{
Integer
phaseNo
=
phaseCache
.
getPhaseNo
();
List
<
Integer
>
ids
=
crossPhaseMapper
.
selectIdsByPhaseNo
(
phaseNo
);
if
(
i
ds
!=
null
)
{
for
(
Integer
id
:
i
ds
)
{
List
<
Integer
>
phaseIds
=
crossPhaseMapper
.
selectIdsByPhaseNo
(
crossId
,
phaseNo
);
if
(
phaseI
ds
!=
null
)
{
for
(
Integer
phaseId
:
phaseI
ds
)
{
CrossPhaseLightsPO
crossPhaseLightsPO
=
new
CrossPhaseLightsPO
();
crossPhaseLightsPO
.
setLightsId
(
crossLightsPOId
);
crossPhaseLightsPO
.
setPhaseId
(
i
d
);
crossPhaseLightsPO
.
setPhaseId
(
phaseI
d
);
crossPhaseLightsPO
.
setCrossId
(
crossId
);
crossPhaseLightsPOSet
.
add
(
crossPhaseLightsPO
);
}
...
...
signal-utc-service/src/main/resources/mapper/CrossPhaseMapper.xml
View file @
09734f43
...
...
@@ -56,7 +56,7 @@
<select
id=
"selectIdsByPhaseNo"
resultType=
"java.lang.Integer"
>
select id from t_cross_phase
where phase_no = #{phaseNo}
where
cross_id = #{crossId} and
phase_no = #{phaseNo}
</select>
<select
id=
"selectByCrossId"
resultMap=
"BaseResultMap"
>
...
...
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