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
3306671d
Commit
3306671d
authored
Jan 30, 2023
by
hanbing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方案管理-运行计划,特殊日期和星期可同时存在
parent
386ff6e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
20 deletions
+4
-20
RunningPlanServiceImpl.java
...wanji/web/service/scheme/impl/RunningPlanServiceImpl.java
+4
-20
No files found.
signal-control-service/src/main/java/net/wanji/web/service/scheme/impl/RunningPlanServiceImpl.java
View file @
3306671d
package
net
.
wanji
.
web
.
service
.
scheme
.
impl
;
package
net
.
wanji
.
web
.
service
.
scheme
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
net.wanji.web.common.exception.WeekException
;
import
net.wanji.web.dto.CrossIdDTO
;
import
net.wanji.web.dto.CrossIdDTO
;
import
net.wanji.web.dto.RunningPlanDTO
;
import
net.wanji.web.dto.RunningPlanDTO
;
import
net.wanji.web.mapper.scheme.CrossPlanMapper
;
import
net.wanji.web.mapper.scheme.CrossPlanMapper
;
...
@@ -55,8 +54,6 @@ public class RunningPlanServiceImpl implements RunningPlanService {
...
@@ -55,8 +54,6 @@ public class RunningPlanServiceImpl implements RunningPlanService {
@Transactional
@Transactional
public
void
saveRunningPlan
(
RunningPlanDTO
runningPlanDTO
)
throws
ParseException
{
public
void
saveRunningPlan
(
RunningPlanDTO
runningPlanDTO
)
throws
ParseException
{
String
crossId
=
runningPlanDTO
.
getCrossId
();
String
crossId
=
runningPlanDTO
.
getCrossId
();
// 验证特殊日期
checkSpecialDate
(
runningPlanDTO
);
// 清空之前计划
// 清空之前计划
crossPlanMapper
.
deleteByCrossId
(
crossId
);
crossPlanMapper
.
deleteByCrossId
(
crossId
);
crossSectionMapper
.
deleteByCrossId
(
crossId
);
crossSectionMapper
.
deleteByCrossId
(
crossId
);
...
@@ -167,15 +164,16 @@ public class RunningPlanServiceImpl implements RunningPlanService {
...
@@ -167,15 +164,16 @@ public class RunningPlanServiceImpl implements RunningPlanService {
private
void
updateCrossSchedulesPlan
(
String
crossId
,
RunningPlanDTO
.
ExecListElement
schedulesPlan
,
private
void
updateCrossSchedulesPlan
(
String
crossId
,
RunningPlanDTO
.
ExecListElement
schedulesPlan
,
Integer
crossSchedulesId
,
Integer
planId
)
throws
ParseException
{
Integer
crossSchedulesId
,
Integer
planId
)
throws
ParseException
{
List
<
Integer
>
week
=
schedulesPlan
.
getWeek
();
List
<
Integer
>
week
=
schedulesPlan
.
getWeek
();
if
(
week
==
null
||
week
.
size
()
==
0
)
{
// 特殊日期
List
<
String
>
specialDateList
=
schedulesPlan
.
getSpecialDateList
();
List
<
String
>
specialDateList
=
schedulesPlan
.
getSpecialDateList
();
if
(
CollectionUtil
.
isNotEmpty
(
specialDateList
))
{
for
(
String
date
:
specialDateList
)
{
for
(
String
date
:
specialDateList
)
{
CrossSchedulesPlanPO
crossSchedulesPlanPO
=
initData
(
crossId
,
crossSchedulesId
,
planId
);
CrossSchedulesPlanPO
crossSchedulesPlanPO
=
initData
(
crossId
,
crossSchedulesId
,
planId
);
crossSchedulesPlanPO
.
setSpecialDate
(
sdf
.
parse
(
date
));
crossSchedulesPlanPO
.
setSpecialDate
(
sdf
.
parse
(
date
));
crossSchedulesPlanPO
.
setWeek
(
0
);
crossSchedulesPlanPO
.
setWeek
(
0
);
crossSchedulesPlanMapper
.
insertOne
(
crossSchedulesPlanPO
);
crossSchedulesPlanMapper
.
insertOne
(
crossSchedulesPlanPO
);
}
}
}
else
{
}
if
(
CollectionUtil
.
isNotEmpty
(
week
))
{
for
(
Integer
day
:
week
)
{
for
(
Integer
day
:
week
)
{
CrossSchedulesPlanPO
crossSchedulesPlanPO
=
initData
(
crossId
,
crossSchedulesId
,
planId
);
CrossSchedulesPlanPO
crossSchedulesPlanPO
=
initData
(
crossId
,
crossSchedulesId
,
planId
);
crossSchedulesPlanPO
.
setSpecialDate
(
new
Date
(
0
));
crossSchedulesPlanPO
.
setSpecialDate
(
new
Date
(
0
));
...
@@ -232,18 +230,4 @@ public class RunningPlanServiceImpl implements RunningPlanService {
...
@@ -232,18 +230,4 @@ public class RunningPlanServiceImpl implements RunningPlanService {
crossSectionPO
.
setSchemeId
(
schemeId
);
crossSectionPO
.
setSchemeId
(
schemeId
);
crossSectionMapper
.
insertOne
(
crossSectionPO
);
crossSectionMapper
.
insertOne
(
crossSectionPO
);
}
}
private
static
void
checkSpecialDate
(
RunningPlanDTO
runningPlanDTO
)
{
List
<
RunningPlanDTO
.
SchedulesPlanListElement
>
schedulesPlanList
=
runningPlanDTO
.
getSchedulesPlanList
();
for
(
RunningPlanDTO
.
SchedulesPlanListElement
schedulesPlan
:
schedulesPlanList
)
{
List
<
RunningPlanDTO
.
ExecListElement
>
execList
=
schedulesPlan
.
getExecList
();
for
(
RunningPlanDTO
.
ExecListElement
execListElement
:
execList
)
{
List
<
Integer
>
week
=
execListElement
.
getWeek
();
List
<
String
>
specialDateList
=
execListElement
.
getSpecialDateList
();
if
(
CollectionUtil
.
isNotEmpty
(
week
)
&&
CollectionUtil
.
isNotEmpty
(
specialDateList
))
{
throw
new
WeekException
(
"不能同时有星期选择和日期选择"
);
}
}
}
}
}
}
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