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
b7219371
Commit
b7219371
authored
Jan 17, 2024
by
duanruiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2b10bafe
5cd5915d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
17 deletions
+59
-17
RunningPlanServiceImpl.java
...wanji/web/service/scheme/impl/RunningPlanServiceImpl.java
+33
-17
BaseCrossSectionMapper.java
.../net/wanji/databus/dao/mapper/BaseCrossSectionMapper.java
+4
-0
RunningPlanDTO.java
...s/src/main/java/net/wanji/databus/dto/RunningPlanDTO.java
+5
-0
BaseCrossPlanMapper.xml
wj-databus/src/main/resources/mapper/BaseCrossPlanMapper.xml
+2
-0
BaseCrossSectionMapper.xml
...abus/src/main/resources/mapper/BaseCrossSectionMapper.xml
+15
-0
No files found.
signal-control-service/src/main/java/net/wanji/web/service/scheme/impl/RunningPlanServiceImpl.java
View file @
b7219371
package
net
.
wanji
.
web
.
service
.
scheme
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
net.wanji.databus.bo.CrossIdBO
;
import
net.wanji.databus.dao.entity.*
;
import
net.wanji.databus.dao.mapper.*
;
...
...
@@ -48,7 +49,7 @@ public class RunningPlanServiceImpl implements RunningPlanService {
String
crossId
=
runningPlanDTO
.
getCrossId
();
// 清空之前计划
baseCrossPlanMapper
.
deleteByCrossId
(
crossId
);
baseCrossSectionMapper
.
deleteByCrossId
(
crossId
);
deleteSections
(
runningPlanDTO
);
baseCrossSchedulesMapper
.
deleteByCrossId
(
crossId
);
baseCrossSchedulesPlanMapper
.
deleteByCrossId
(
crossId
);
// 保存计划数据
...
...
@@ -57,6 +58,16 @@ public class RunningPlanServiceImpl implements RunningPlanService {
saveCrossSchedules
(
runningPlanDTO
,
crossId
);
}
private
void
deleteSections
(
RunningPlanDTO
runningPlanDTO
)
{
List
<
RunningPlanDTO
.
DailyPlanListElement
>
dailyPlanList
=
runningPlanDTO
.
getDailyPlanList
();
for
(
RunningPlanDTO
.
DailyPlanListElement
dailyPlanListElement
:
dailyPlanList
)
{
List
<
Integer
>
deletedSectionIds
=
dailyPlanListElement
.
getDeletedSectionIds
();
if
(
CollectionUtil
.
isNotEmpty
(
deletedSectionIds
))
{
baseCrossSectionMapper
.
deleteByCrossIds
(
deletedSectionIds
);
}
}
}
@Override
public
RunningPlanDTO
listRunningPlan
(
CrossIdBO
crossIdBO
)
{
RunningPlanDTO
runningPlanDTO
=
new
RunningPlanDTO
();
...
...
@@ -244,22 +255,27 @@ public class RunningPlanServiceImpl implements RunningPlanService {
private
void
updateCrossSection
(
String
crossId
,
Integer
crossPlanId
,
Integer
schemeId
,
RunningPlanDTO
.
TimeListElement
time
)
{
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
String
[]
startEndTime
=
time
.
getStartEndTime
();
String
startTime
=
startEndTime
[
0
];
String
endTime
=
startEndTime
[
1
];
String
s
=
startTime
+
endTime
;
if
(
"23:59"
.
equals
(
endTime
))
{
endTime
=
"24:00"
;
Integer
sectionId
=
time
.
getSectionId
();
if
(
ObjectUtil
.
isEmpty
(
sectionId
))
{
CrossSectionPO
crossSectionPO
=
new
CrossSectionPO
();
String
[]
startEndTime
=
time
.
getStartEndTime
();
String
startTime
=
startEndTime
[
0
];
String
endTime
=
startEndTime
[
1
];
String
s
=
startTime
+
endTime
;
if
(
"23:59"
.
equals
(
endTime
))
{
endTime
=
"24:00"
;
}
String
sectionNo
=
s
.
replaceAll
(
":"
,
""
);
crossSectionPO
.
setSectionNo
(
sectionNo
);
crossSectionPO
.
setStartTime
(
startTime
);
crossSectionPO
.
setEndTime
(
endTime
);
crossSectionPO
.
setCrossId
(
crossId
);
crossSectionPO
.
setPlanId
(
crossPlanId
);
crossSectionPO
.
setControlMode
(
1
);
// todo 暂时只有定周期
crossSectionPO
.
setSchemeId
(
schemeId
);
baseCrossSectionMapper
.
insertOne
(
crossSectionPO
);
}
else
{
baseCrossSectionMapper
.
updateOne
(
sectionId
,
crossPlanId
,
schemeId
);
}
String
sectionNo
=
s
.
replaceAll
(
":"
,
""
);
crossSectionPO
.
setSectionNo
(
sectionNo
);
crossSectionPO
.
setStartTime
(
startTime
);
crossSectionPO
.
setEndTime
(
endTime
);
crossSectionPO
.
setCrossId
(
crossId
);
crossSectionPO
.
setPlanId
(
crossPlanId
);
crossSectionPO
.
setControlMode
(
1
);
// todo 暂时只有定周期
crossSectionPO
.
setSchemeId
(
schemeId
);
baseCrossSectionMapper
.
insertOne
(
crossSectionPO
);
}
}
wj-databus/src/main/java/net/wanji/databus/dao/mapper/BaseCrossSectionMapper.java
View file @
b7219371
...
...
@@ -44,4 +44,8 @@ public interface BaseCrossSectionMapper {
List
<
CrossSectionPOExt
>
selectByCrossIdsAndStartTime
(
String
startTime
,
List
<
String
>
crossList
);
List
<
CrossAllSchemesDTO
>
selectCrossAllSchemes
(
String
crossId
);
void
deleteByCrossIds
(
List
<
Integer
>
ids
);
void
updateOne
(
Integer
sectionId
,
Integer
crossPlanId
,
Integer
schemeId
);
}
wj-databus/src/main/java/net/wanji/databus/dto/RunningPlanDTO.java
View file @
b7219371
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -31,10 +32,14 @@ public class RunningPlanDTO {
private
String
name
;
@ApiModelProperty
(
value
=
"开始时间结束时间列表"
,
required
=
true
)
private
List
<
TimeListElement
>
timeList
;
@ApiModelProperty
(
value
=
"被删除的时段ID"
,
required
=
true
)
private
List
<
Integer
>
deletedSectionIds
=
new
ArrayList
<>();
}
@NoArgsConstructor
@Data
public
static
class
TimeListElement
{
@ApiModelProperty
(
value
=
"时段ID"
,
required
=
true
)
private
Integer
sectionId
;
@ApiModelProperty
(
value
=
"开始时间"
,
required
=
true
)
private
String
startTime
;
@ApiModelProperty
(
value
=
"结束时间"
,
required
=
true
)
...
...
wj-databus/src/main/resources/mapper/BaseCrossPlanMapper.xml
View file @
b7219371
...
...
@@ -35,6 +35,7 @@
<id
column=
"planNo"
property=
"planNo"
/>
<result
column=
"name"
property=
"name"
/>
<collection
property=
"timeList"
ofType=
"net.wanji.databus.dto.RunningPlanDTO$TimeListElement"
>
<result
column=
"sectionId"
property=
"sectionId"
/>
<result
column=
"startTime"
property=
"startTime"
/>
<result
column=
"endTime"
property=
"endTime"
/>
<result
column=
"schemeName"
property=
"schemeName"
/>
...
...
@@ -45,6 +46,7 @@
SELECT
t1.plan_no as planNo,
t1.name as name,
t2.id as sectionId,
t2.start_time as startTime,
t2.end_time as endTime,
t3.name as schemeName
...
...
wj-databus/src/main/resources/mapper/BaseCrossSectionMapper.xml
View file @
b7219371
...
...
@@ -31,12 +31,27 @@
where id = #{sectionId}
</update>
<update
id=
"updateOne"
>
update t_base_cross_section
set plan_id = #{crossPlanId} , scheme_id = #{schemeId}
where id = #{sectionId}
</update>
<delete
id=
"deleteByCrossId"
>
DELETE
FROM t_base_cross_section
WHERE cross_id = #{crossId}
</delete>
<delete
id=
"deleteByCrossIds"
>
DELETE
FROM t_base_cross_section
WHERE id in
<foreach
collection=
"ids"
item=
"id"
separator=
","
open=
"("
close=
")"
>
#{id}
</foreach>
</delete>
<select
id=
"listCrossSectionPO"
parameterType=
"net.wanji.databus.dao.entity.CrossSectionPO"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_list"
/>
...
...
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