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
f2689c4a
Commit
f2689c4a
authored
Feb 13, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 策略控制优化
parent
5f9303d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
22 deletions
+30
-22
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+30
-22
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
f2689c4a
...
@@ -331,7 +331,12 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -331,7 +331,12 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List
<
StrategyControlDataEntity
>
results
=
new
ArrayList
<>();
List
<
StrategyControlDataEntity
>
results
=
new
ArrayList
<>();
List
<
StrategyControlDataEntity
>
entities
=
getCurrentStrateInfoList
(
type
);
List
<
StrategyControlDataEntity
>
entities
=
getCurrentStrateInfoList
(
type
);
List
<
StrategyControlDataEntity
>
runList
=
entities
.
stream
().
filter
(
entity
->
Objects
.
equals
(
1
,
entity
.
getStatus
())).
collect
(
Collectors
.
toList
());
List
<
StrategyControlDataEntity
>
runList
=
entities
.
stream
().
filter
(
entity
->
Objects
.
equals
(
1
,
entity
.
getStatus
())).
collect
(
Collectors
.
toList
());
Map
<
String
,
StrategyControlDataEntity
>
map
=
runList
.
stream
().
collect
(
Collectors
.
toMap
(
StrategyControlDataEntity:
:
getBizId
,
entity
->
entity
));
Map
<
String
,
StrategyControlDataEntity
>
map
=
runList
.
stream
()
.
collect
(
Collectors
.
toMap
(
StrategyControlDataEntity:
:
getBizId
,
entity
->
entity
,
(
existing
,
replacement
)
->
existing
.
getId
()
>
replacement
.
getId
()
?
existing
:
replacement
));
// 路口
// 路口
if
(
Objects
.
equals
(
0
,
type
))
{
if
(
Objects
.
equals
(
0
,
type
))
{
List
<
AbnormalCrossListVO
>
abnormalCrossListVOS
=
crossDataRealtimeMapper
.
selectAbnormalCross
(
null
,
null
,
null
);
List
<
AbnormalCrossListVO
>
abnormalCrossListVOS
=
crossDataRealtimeMapper
.
selectAbnormalCross
(
null
,
null
,
null
);
...
@@ -461,8 +466,9 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -461,8 +466,9 @@ public class StrategyControlServiceImpl implements StrategyControlService {
LambdaQueryWrapper
<
StrategyControlDataEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
StrategyControlDataEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
Date
current
=
new
Date
();
Date
current
=
new
Date
();
queryWrapper
.
eq
(
StrategyControlDataEntity:
:
getBizType
,
type
);
queryWrapper
.
eq
(
StrategyControlDataEntity:
:
getBizType
,
type
);
queryWrapper
.
ge
(
StrategyControlDataEntity:
:
getScheduleStart
,
current
);
queryWrapper
.
le
(
StrategyControlDataEntity:
:
getScheduleStart
,
current
);
queryWrapper
.
le
(
StrategyControlDataEntity:
:
getScheduleEnd
,
current
);
queryWrapper
.
ge
(
StrategyControlDataEntity:
:
getScheduleEnd
,
current
);
queryWrapper
.
orderByAsc
(
StrategyControlDataEntity:
:
getId
);
List
<
StrategyControlDataEntity
>
entities
=
strategyControlInfoMapper
.
selectList
(
queryWrapper
);
List
<
StrategyControlDataEntity
>
entities
=
strategyControlInfoMapper
.
selectList
(
queryWrapper
);
List
<
StrategyControlDataEntity
>
results
=
new
ArrayList
<>(
entities
.
size
());
List
<
StrategyControlDataEntity
>
results
=
new
ArrayList
<>(
entities
.
size
());
for
(
StrategyControlDataEntity
entity
:
entities
)
{
for
(
StrategyControlDataEntity
entity
:
entities
)
{
...
@@ -587,7 +593,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -587,7 +593,7 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
}
}
}
results
.
s
ort
(
Comparator
.
comparing
(
StrategyControlDataExt:
:
getStatus
).
reversed
());
results
.
s
tream
().
distinct
().
sorted
(
Comparator
.
comparing
(
StrategyControlDataExt:
:
getStatus
).
reversed
()).
collect
(
Collectors
.
toList
());
return
results
;
return
results
;
}
}
...
@@ -755,6 +761,9 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -755,6 +761,9 @@ public class StrategyControlServiceImpl implements StrategyControlService {
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
List
<
StrategyControlDetailList
.
ExecutePlan
>
plans
=
list
.
getPlans
();
List
<
StrategyControlDetailList
.
ExecutePlan
>
plans
=
list
.
getPlans
();
if
(!
CollectionUtils
.
isEmpty
(
plans
))
{
if
(!
CollectionUtils
.
isEmpty
(
plans
))
{
StrategyControlDetailList
.
ExecutePlan
executePlan
=
plans
.
get
(
0
);
LambdaQueryWrapper
<
StrategyPlanInfoEntity
>
planDel
=
new
LambdaQueryWrapper
<>();
planDel
.
eq
(
StrategyPlanInfoEntity:
:
getCrossId
,
executePlan
.
getCrossId
());
for
(
StrategyControlDetailList
.
ExecutePlan
plan
:
plans
)
{
for
(
StrategyControlDetailList
.
ExecutePlan
plan
:
plans
)
{
StrategyPlanInfoEntity
planInfoEntity
=
new
StrategyPlanInfoEntity
();
StrategyPlanInfoEntity
planInfoEntity
=
new
StrategyPlanInfoEntity
();
planInfoEntity
.
setPlanId
(
plan
.
getPlanId
());
planInfoEntity
.
setPlanId
(
plan
.
getPlanId
());
...
@@ -765,30 +774,29 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -765,30 +774,29 @@ public class StrategyControlServiceImpl implements StrategyControlService {
planInfoEntity
.
setCompany
(
plan
.
getCompany
());
planInfoEntity
.
setCompany
(
plan
.
getCompany
());
planInfoEntity
.
setName
(
plan
.
getName
());
planInfoEntity
.
setName
(
plan
.
getName
());
planInfoEntity
.
setPlanDetails
(
mapper
.
writeValueAsString
(
plan
.
getPlanDetails
()));
planInfoEntity
.
setPlanDetails
(
mapper
.
writeValueAsString
(
plan
.
getPlanDetails
()));
LambdaQueryWrapper
<
StrategyPlanInfoEntity
>
planDel
=
new
LambdaQueryWrapper
<>();
planDel
.
eq
(
StrategyPlanInfoEntity:
:
getCrossId
,
plan
.
getCrossId
());
planDel
.
eq
(
StrategyPlanInfoEntity:
:
getPlanId
,
plan
.
getPlanId
());
strategyPlanInfoMapper
.
delete
(
planDel
);
strategyPlanInfoMapper
.
delete
(
planDel
);
strategyPlanInfoMapper
.
insert
(
planInfoEntity
);
strategyPlanInfoMapper
.
insert
(
planInfoEntity
);
}
}
}
}
List
<
StrategyControlDetailList
.
DailyPlan
>
dailyPlans
=
list
.
getDailyPlans
();
List
<
StrategyControlDetailList
.
DailyPlan
>
dailyPlans
=
list
.
getDailyPlans
();
for
(
StrategyControlDetailList
.
DailyPlan
dailyPlan
:
dailyPlans
)
{
if
(!
CollectionUtils
.
isEmpty
(
dailyPlans
))
{
Integer
dailyPlanId
=
dailyPlan
.
getDailyPlanId
();
StrategyControlDetailList
.
DailyPlan
dailyPlan1
=
dailyPlans
.
get
(
0
);
String
crossId
=
dailyPlan
.
getCrossId
();
LambdaQueryWrapper
<
StrategyDailyPlanInfoEntity
>
delete
=
new
LambdaQueryWrapper
<>();
List
<
StrategyControlDetailList
.
DailyPlan
.
DailyPlanDetail
>
dailyPlanDetails
=
dailyPlan
.
getDailyPlanDetails
();
delete
.
eq
(
StrategyDailyPlanInfoEntity:
:
getCrossId
,
dailyPlan1
.
getCrossId
());
StrategyDailyPlanInfoEntity
dailyPlanInfoEntity
=
new
StrategyDailyPlanInfoEntity
();
strategyDailyPlanInfoMapper
.
delete
(
delete
);
dailyPlanInfoEntity
.
setCrossId
(
crossId
);
for
(
StrategyControlDetailList
.
DailyPlan
dailyPlan
:
dailyPlans
)
{
dailyPlanInfoEntity
.
setDailyPlanId
(
dailyPlanId
);
Integer
dailyPlanId
=
dailyPlan
.
getDailyPlanId
();
dailyPlanInfoEntity
.
setName
(
dailyPlan
.
getName
());
String
crossId
=
dailyPlan
.
getCrossId
();
LambdaQueryWrapper
<
StrategyDailyPlanInfoEntity
>
delete
=
new
LambdaQueryWrapper
<>();
List
<
StrategyControlDetailList
.
DailyPlan
.
DailyPlanDetail
>
dailyPlanDetails
=
dailyPlan
.
getDailyPlanDetails
();
delete
.
eq
(
StrategyDailyPlanInfoEntity:
:
getCrossId
,
crossId
);
StrategyDailyPlanInfoEntity
dailyPlanInfoEntity
=
new
StrategyDailyPlanInfoEntity
();
delete
.
eq
(
StrategyDailyPlanInfoEntity:
:
getDailyPlanId
,
dailyPlanId
);
dailyPlanInfoEntity
.
setCrossId
(
crossId
);
strategyDailyPlanInfoMapper
.
delete
(
delete
);
dailyPlanInfoEntity
.
setDailyPlanId
(
dailyPlanId
);
dailyPlanInfoEntity
.
setDailyPlanDetails
(
mapper
.
writeValueAsString
(
dailyPlanDetails
));
dailyPlanInfoEntity
.
setName
(
dailyPlan
.
getName
());
strategyDailyPlanInfoMapper
.
insert
(
dailyPlanInfoEntity
);
dailyPlanInfoEntity
.
setDailyPlanDetails
(
mapper
.
writeValueAsString
(
dailyPlanDetails
));
}
strategyDailyPlanInfoMapper
.
insert
(
dailyPlanInfoEntity
);
}
}
}
}
StrategyControlVO
strategyControlVO
=
convertDataList
(
list
);
StrategyControlVO
strategyControlVO
=
convertDataList
(
list
);
StrategyControlReq
req
=
convertReq
(
strategyControlVO
);
StrategyControlReq
req
=
convertReq
(
strategyControlVO
);
...
...
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