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
jinan
traffic-signal-platform
Commits
bf31bfc1
Commit
bf31bfc1
authored
Apr 28, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 策略优先级配置删除
parent
3de6c327
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
210 additions
and
63 deletions
+210
-63
StrategyPriorityController.java
...opt/controllerv2/strategy/StrategyPriorityController.java
+77
-62
StrategyPriorityMapper.java
...wanji/opt/dao/mapper/strategy/StrategyPriorityMapper.java
+32
-1
StrategyPriorityService.java
...wanji/opt/servicev2/strategy/StrategyPriorityService.java
+7
-0
StrategyPriorityServiceImpl.java
.../servicev2/strategy/impl/StrategyPriorityServiceImpl.java
+40
-0
StrategyPriorityMapper.xml
...main/resources/mapper/strategy/StrategyPriorityMapper.xml
+54
-0
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/controllerv2/strategy/StrategyPriorityController.java
View file @
bf31bfc1
This diff is collapsed.
Click to expand it.
signal-optimize-service/src/main/java/net/wanji/opt/dao/mapper/strategy/StrategyPriorityMapper.java
View file @
bf31bfc1
...
...
@@ -115,12 +115,43 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
List
<
StrategyParameterConfig
>
getGreenParamConfigData
(
@Param
(
"greenId"
)
Integer
greenId
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"strategyNo"
)
String
strategyNo
);
/**
* 通过路口编号
,分组编号查询策略
详情
* 通过路口编号
或干线编号,分组编号查询策略库
详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List
<
StrategyFactoryEntity
>
selectCrossGroupStrategyList
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"greenId"
)
Integer
greenId
,
@Param
(
"groupId"
)
Integer
groupId
);
/**
* 删除路口编号分组下策略编号
* @param crossId
* @param greenId
* @param groupId
* @param strategyNo
* @return
*/
void
deleteGreenPriorityConfig
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"greenId"
)
Integer
greenId
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"strategyNo"
)
String
strategyNo
);
/**
* 通过路口编号或干线编号,分组编号,查询优先级配置日计划详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List
<
StrategyPriorityDailyInfo
>
selectCrossGreenGroupDailyPlanList
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"greenId"
)
Integer
greenId
,
@Param
(
"groupId"
)
Integer
groupId
);
/**
* 通过路口编号或干线编号,分组编号查询策略优先级配置详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List
<
StrategyPriorityConfig
>
selectCrossGroupStrategyPriorityList
(
@Param
(
"crossId"
)
String
crossId
,
@Param
(
"greenId"
)
Integer
greenId
,
@Param
(
"groupId"
)
Integer
groupId
);
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/strategy/StrategyPriorityService.java
View file @
bf31bfc1
...
...
@@ -29,6 +29,13 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
void
savePriority
(
List
<
StrategyPriorityGroupVO
>
dataList
)
throws
Exception
;
/**
* 删除优先级配置表中策略
* @param dataList
* @throws Exception
*/
void
deletePriorityConfigList
(
List
<
StrategyPriorityGroupVO
>
dataList
)
throws
Exception
;
List
<
StrategyFactoryEntity
>
getPriorityData
(
String
crossId
,
Integer
greenId
,
Integer
type
)
throws
Exception
;
void
savePlanConfig
(
List
<
StrategyPriorityGroupVO
>
dailyPlanDetails
)
throws
Exception
;
...
...
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/strategy/impl/StrategyPriorityServiceImpl.java
View file @
bf31bfc1
...
...
@@ -186,6 +186,46 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
}
}
@Override
@Transactional
(
rollbackFor
=
RuntimeException
.
class
)
public
void
deletePriorityConfigList
(
List
<
StrategyPriorityGroupVO
>
dataList
)
throws
Exception
{
if
(
CollectionUtils
.
isNotEmpty
(
dataList
))
{
Map
<
Integer
,
List
<
StrategyPriorityGroupVO
>>
groupMap
=
dataList
.
stream
().
collect
(
Collectors
.
groupingBy
(
StrategyPriorityGroupVO:
:
getGroupId
));
for
(
Map
.
Entry
<
Integer
,
List
<
StrategyPriorityGroupVO
>>
entry
:
groupMap
.
entrySet
())
{
Integer
groupId
=
entry
.
getKey
();
List
<
StrategyPriorityGroupVO
>
value
=
entry
.
getValue
();
StrategyPriorityGroupVO
groupVO
=
value
.
get
(
0
);
List
<
String
>
crossIds
=
groupVO
.
getCrossIds
();
String
crossId
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
crossIds
))
{
crossId
=
crossIds
.
get
(
0
);
}
List
<
Integer
>
greenIds
=
groupVO
.
getGreenIds
();
Integer
greenId
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
greenIds
))
{
greenId
=
greenIds
.
get
(
0
);
}
// 当全部删除时,1.校验日计划中是否有使用;2.并且删除数量=数据库中数量
List
<
StrategyPriorityConfig
>
data4DB
=
strategyPriorityMapper
.
selectCrossGroupStrategyPriorityList
(
crossId
,
greenId
,
groupId
);
List
<
StrategyPriorityDailyInfo
>
dailyInfos
=
strategyPriorityMapper
.
selectCrossGreenGroupDailyPlanList
(
crossId
,
greenId
,
groupId
);
if
(
CollectionUtils
.
isNotEmpty
(
dailyInfos
)
&&
data4DB
.
size
()
<=
dataList
.
size
())
{
throw
new
RuntimeException
(
"日计划中已使用当前分组: "
+
groupId
+
" 不能清空!"
);
}
// 删除路口编号分组下策略编号
for
(
StrategyPriorityGroupVO
strategyPriorityGroupVO
:
value
)
{
List
<
StrategyPriorityConfig
>
data
=
strategyPriorityGroupVO
.
getData
();
if
(
CollectionUtils
.
isNotEmpty
(
data
))
{
for
(
StrategyPriorityConfig
datum
:
data
)
{
strategyPriorityMapper
.
deleteGreenPriorityConfig
(
crossId
,
greenId
,
groupId
,
datum
.
getStrategyNo
());
}
}
}
}
}
}
/*
* 策略优先级路口跟干线数据回显
* */
...
...
signal-optimize-service/src/main/resources/mapper/strategy/StrategyPriorityMapper.xml
View file @
bf31bfc1
...
...
@@ -436,6 +436,7 @@
WHERE green_id =#{greenId}
</delete>
<!-- 通过路口或者绿波编号,分组编号查询分组中策略信息详情 -->
<select
id=
"selectCrossGroupStrategyList"
resultType=
"net.wanji.opt.synthesis.pojo.StrategyFactoryEntity"
>
select t2.type, t2.scene, t2.strategy_name, t2.strategy_no, t2.method, t2.company,
t2.mark, t2.status, t2.opt_type, t2.create_time, t2.modify_time
...
...
@@ -453,7 +454,60 @@
</if>
order by t1.priority
</where>
</select>
<delete
id=
"deleteGreenPriorityConfig"
>
DELETE
FROM t_strategy_priority_config
<where>
<if
test=
"crossId != null and crossId != ''"
>
and cross_id = #{crossId}
</if>
<if
test=
"greenId!=null and greenId!=''"
>
and green_id = #{greenId}
</if>
<if
test=
"groupId != null and groupId != ''"
>
and group_id = #{groupId}
</if>
<if
test=
"strategyNo != null and strategyNo != ''"
>
and strategy_no = #{strategyNo}
</if>
</where>
</delete>
<!-- 通过路口或者绿波编号,分组编号查询日计划详情 -->
<select
id=
"selectCrossGreenGroupDailyPlanList"
resultType=
"net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"
>
select daily_plan_id, week_execute, daily_plan_details, cross_id, type, green_id, gmt_create
from t_strategy_priority_daily_info
<where>
<if
test=
"crossId != null and crossId != ''"
>
and cross_id = #{crossId}
</if>
<if
test=
"greenId!=null and greenId!=''"
>
and green_id = #{greenId}
</if>
<if
test=
"groupId != null and groupId != ''"
>
and JSON_CONTAINS(JSON_EXTRACT(daily_plan_details, '$'), JSON_OBJECT('groupId', #{groupId}))
</if>
</where>
</select>
<!-- 通过路口或者绿波编号,分组编号查询策略优先级配置详情 -->
<select
id=
"selectCrossGroupStrategyPriorityList"
resultType=
"net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"
>
select group_id, group_name, priority, strategy_no, cross_id, green_id, type, gmt_create
from t_strategy_priority_config
<where>
<if
test=
"crossId != null and crossId != ''"
>
and cross_id = #{crossId}
</if>
<if
test=
"greenId!=null and greenId!=''"
>
and green_id = #{greenId}
</if>
<if
test=
"groupId != null and groupId != ''"
>
and group_id = #{groupId}
</if>
</where>
</select>
</mapper>
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