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
8b62f4fa
Commit
8b62f4fa
authored
Apr 18, 2025
by
wangyecheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
策略管理参数配置推送神思
parent
b08bf513
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
194 additions
and
7 deletions
+194
-7
SchedulingParamPush.java
...va/net/wanji/opt/entity/strategy/SchedulingParamPush.java
+18
-0
StrategyParamDetailsPush.java
...t/wanji/opt/entity/strategy/StrategyParamDetailsPush.java
+24
-0
StrategyParameterPush.java
.../net/wanji/opt/entity/strategy/StrategyParameterPush.java
+32
-0
StrategyPriorityGroup.java
.../wanji/opt/entity/strategy/dto/StrategyPriorityGroup.java
+6
-0
StrategyPriorityService.java
...wanji/opt/servicev2/strategy/StrategyPriorityService.java
+1
-1
StrategyPriorityServiceImpl.java
.../servicev2/strategy/impl/StrategyPriorityServiceImpl.java
+70
-1
PushStrategyControlService.java
...nji/opt/synthesis/service/PushStrategyControlService.java
+9
-0
PushStrategyControlServiceImpl.java
...ynthesis/service/impl/PushStrategyControlServiceImpl.java
+30
-1
StrategyPriorityMapper.xml
...main/resources/mapper/strategy/StrategyPriorityMapper.xml
+4
-4
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/entity/strategy/SchedulingParamPush.java
0 → 100644
View file @
8b62f4fa
package
net
.
wanji
.
opt
.
entity
.
strategy
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.List
;
/*
* 调度参数配置推送神思
* */
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
SchedulingParamPush
{
//开始参数
private
List
<
StrategySchedulingItem
>
start
;
//停止参数
private
List
<
StrategySchedulingItem
>
end
;
}
signal-optimize-service/src/main/java/net/wanji/opt/entity/strategy/StrategyParamDetailsPush.java
0 → 100644
View file @
8b62f4fa
package
net
.
wanji
.
opt
.
entity
.
strategy
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/*
* 参数配置详情推送神思
* */
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
StrategyParamDetailsPush
{
//参数中文名称
private
String
paramCN
;
//参数英文名称
private
String
paramEN
;
//参数数据类型
private
String
dataType
;
//参数描述
private
String
description
;
//参数阈值[1,3]
private
String
threshold
;
//参数值
private
String
value
;
}
signal-optimize-service/src/main/java/net/wanji/opt/entity/strategy/StrategyParameterPush.java
0 → 100644
View file @
8b62f4fa
package
net
.
wanji
.
opt
.
entity
.
strategy
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.List
;
/*
* 参数配置推送神思最外层
* */
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
StrategyParameterPush
{
//1-路口;2干线
private
int
type
;
//干线编号
private
List
<
Integer
>
greenId
;
//路口编号
private
List
<
String
>
crossId
;
//策略唯一编号
private
String
strategyNo
;
//策略名称
private
String
strategyName
;
//场景 编号
private
Integer
scene
;
//场景名称
private
String
method
;
//参数配置
private
List
<
StrategyParamDetailsPush
>
paramDetails
;
//策略调度参数启停
private
SchedulingParamPush
schedulingParam
;
}
signal-optimize-service/src/main/java/net/wanji/opt/entity/strategy/dto/StrategyPriorityGroup.java
View file @
8b62f4fa
...
@@ -45,6 +45,12 @@ public class StrategyPriorityGroup {
...
@@ -45,6 +45,12 @@ public class StrategyPriorityGroup {
//干线 IDs
//干线 IDs
private
List
<
Integer
>
greenIds
;
private
List
<
Integer
>
greenIds
;
//策略名称 参数配置神思用
private
String
strategyName
;
//场景 参数配置神思用
private
String
method
;
//场景code 参数配置神思用
private
Integer
scene
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/strategy/StrategyPriorityService.java
View file @
8b62f4fa
...
@@ -42,7 +42,7 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
...
@@ -42,7 +42,7 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
List
<
StrategyPriorityDailyInfo
>
getPlanConfigData
(
String
crossId
,
Integer
greenId
,
Integer
type
);
List
<
StrategyPriorityDailyInfo
>
getPlanConfigData
(
String
crossId
,
Integer
greenId
,
Integer
type
);
void
saveParamterConfig
(
StrategyPriorityGroup
strategyPriorityGroup
)
throws
JsonProcessing
Exception
;
void
saveParamterConfig
(
StrategyPriorityGroup
strategyPriorityGroup
)
throws
Exception
;
List
<
StrategyParameterConfig
>
getParamConfigData
(
String
crossId
,
Integer
greenId
,
Integer
type
);
List
<
StrategyParameterConfig
>
getParamConfigData
(
String
crossId
,
Integer
greenId
,
Integer
type
);
...
...
signal-optimize-service/src/main/java/net/wanji/opt/servicev2/strategy/impl/StrategyPriorityServiceImpl.java
View file @
8b62f4fa
...
@@ -333,7 +333,7 @@ import java.util.stream.Collectors;
...
@@ -333,7 +333,7 @@ import java.util.stream.Collectors;
* */
* */
@Override
@Override
@Transactional
@Transactional
public
void
saveParamterConfig
(
StrategyPriorityGroup
group
)
throws
JsonProcessing
Exception
{
public
void
saveParamterConfig
(
StrategyPriorityGroup
group
)
throws
Exception
{
try
{
try
{
List
<
StrategyParameterConfig
>
savePlanList
=
new
ArrayList
<>();
List
<
StrategyParameterConfig
>
savePlanList
=
new
ArrayList
<>();
...
@@ -402,6 +402,10 @@ import java.util.stream.Collectors;
...
@@ -402,6 +402,10 @@ import java.util.stream.Collectors;
}
}
strategyPriorityMapper
.
saveParamConfig
(
savePlanList
);
strategyPriorityMapper
.
saveParamConfig
(
savePlanList
);
//组装神思需要的参数配置接口
StrategyParameterPush
strategyParameterPush
=
pushStrategyPriorityParam
(
group
);
//推送神思
//Result result = pushStrategyControlService.StartegyPriorityParameterPush(strategyParameterPush);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"{} saveParamterConfig"
,
this
.
getClass
().
getSimpleName
(),
e
);
log
.
error
(
"{} saveParamterConfig"
,
this
.
getClass
().
getSimpleName
(),
e
);
throw
e
;
throw
e
;
...
@@ -652,4 +656,69 @@ import java.util.stream.Collectors;
...
@@ -652,4 +656,69 @@ import java.util.stream.Collectors;
return
strategyPriorityPlanPush
;
return
strategyPriorityPlanPush
;
}
}
/*参数配置神思推送*/
private
StrategyParameterPush
pushStrategyPriorityParam
(
StrategyPriorityGroup
group
)
{
//推送神思接口
StrategyParameterPush
strategyParameterPush
=
new
StrategyParameterPush
();
//类型:1路口 2 干线
Integer
type
=
group
.
getType
();
//路口id
List
<
String
>
crossIds
=
group
.
getCrossIds
();
//干线id
List
<
Integer
>
greenIds
=
group
.
getGreenIds
();
//策略编号
String
strategyNo
=
group
.
getStrategyNo
();
//策略名称
String
strategyName
=
group
.
getStrategyName
();
//场景编号
Integer
scene
=
group
.
getScene
();
//场景名称
String
method
=
group
.
getMethod
();
//1 路口 2干线
if
(
type
==
1
){
strategyParameterPush
.
setType
(
1
);
strategyParameterPush
.
setGreenId
(
null
);
strategyParameterPush
.
setCrossId
(
crossIds
);
}
else
{
strategyParameterPush
.
setType
(
2
);
strategyParameterPush
.
setGreenId
(
greenIds
);
strategyParameterPush
.
setCrossId
(
null
);
}
strategyParameterPush
.
setStrategyNo
(
strategyNo
);
strategyParameterPush
.
setStrategyName
(
strategyName
);
strategyParameterPush
.
setScene
(
scene
);
strategyParameterPush
.
setMethod
(
method
);
//参数详情
List
<
StrategyParamDetailsPush
>
strategyParamDetailsList
=
new
ArrayList
<>();
//参数详情
List
<
StrategyPriorityParamter
>
parameterConfigList
=
group
.
getParameterConfigList
();
for
(
StrategyPriorityParamter
item:
parameterConfigList
){
StrategyParamDetailsPush
strategyParamDetailsPush
=
new
StrategyParamDetailsPush
();
strategyParamDetailsPush
.
setParamEN
(
item
.
getParamEN
());
strategyParamDetailsPush
.
setParamCN
(
item
.
getParamCN
());
strategyParamDetailsPush
.
setDescription
(
item
.
getDescription
());
strategyParamDetailsPush
.
setDataType
(
item
.
getDataType
());
strategyParamDetailsPush
.
setThreshold
(
item
.
getThreshold
());
strategyParamDetailsPush
.
setValue
(
item
.
getValue
());
strategyParamDetailsList
.
add
(
strategyParamDetailsPush
);
}
strategyParameterPush
.
setParamDetails
(
strategyParamDetailsList
);
if
(
type
==
1
){
//取出调度详情
StrategySchedulingParam
schedulingParamters
=
group
.
getSchedulingParamters
();
List
<
StrategySchedulingItem
>
start
=
schedulingParamters
.
getStart
();
List
<
StrategySchedulingItem
>
end
=
schedulingParamters
.
getEnd
();
//组装调度详情
SchedulingParamPush
schedulingParamPush
=
new
SchedulingParamPush
();
schedulingParamPush
.
setStart
(
start
);
schedulingParamPush
.
setEnd
(
end
);
strategyParameterPush
.
setSchedulingParam
(
schedulingParamPush
);
}
else
{
strategyParameterPush
.
setSchedulingParam
(
null
);
}
return
strategyParameterPush
;
}
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/PushStrategyControlService.java
View file @
8b62f4fa
package
net
.
wanji
.
opt
.
synthesis
.
service
;
package
net
.
wanji
.
opt
.
synthesis
.
service
;
import
net.wanji.opt.entity.strategy.StrategyParameterPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityConfigPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityConfigPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityPlanPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityPlanPush
;
import
net.wanji.opt.synthesis.pojo.Result
;
import
net.wanji.opt.synthesis.pojo.Result
;
...
@@ -44,5 +45,13 @@ public interface PushStrategyControlService {
...
@@ -44,5 +45,13 @@ public interface PushStrategyControlService {
* @throws Exception
* @throws Exception
*/
*/
Result
StartegyPriorityPlanPush
(
StrategyPriorityPlanPush
req
)
throws
Exception
;
Result
StartegyPriorityPlanPush
(
StrategyPriorityPlanPush
req
)
throws
Exception
;
/**
* 策略管理参数配置推送
* @param req
* @return
* @throws Exception
*/
Result
StartegyPriorityParameterPush
(
StrategyParameterPush
req
)
throws
Exception
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/PushStrategyControlServiceImpl.java
View file @
8b62f4fa
...
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
...
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.tool.resttool.RestTemplateTool
;
import
net.wanji.common.tool.resttool.RestTemplateTool
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.common.utils.tool.JacksonUtils
;
import
net.wanji.opt.entity.strategy.StrategyParameterPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityConfigPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityConfigPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityPlanPush
;
import
net.wanji.opt.entity.strategy.StrategyPriorityPlanPush
;
import
net.wanji.opt.synthesis.pojo.Result
;
import
net.wanji.opt.synthesis.pojo.Result
;
...
@@ -106,7 +107,6 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
...
@@ -106,7 +107,6 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
System
.
out
.
println
(
"req~~"
+
req
);
System
.
out
.
println
(
"req~~"
+
req
);
// 序列化请求参数
// 序列化请求参数
String
jsonReq
=
mapper
.
writeValueAsString
(
req
);
String
jsonReq
=
mapper
.
writeValueAsString
(
req
);
System
.
out
.
println
(
"请求参数: "
+
jsonReq
);
String
resultStr
=
RestTemplateTool
.
post
(
switchUrl
,
jsonReq
);
String
resultStr
=
RestTemplateTool
.
post
(
switchUrl
,
jsonReq
);
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
log
.
info
(
"下发神思策略管理日计划配置推送成功,内容: {}"
,
req
);
log
.
info
(
"下发神思策略管理日计划配置推送成功,内容: {}"
,
req
);
...
@@ -121,4 +121,33 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
...
@@ -121,4 +121,33 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
throw
new
Exception
(
e
);
throw
new
Exception
(
e
);
}
}
}
}
/**
* 策略管理参数配置推送
* @param req
* @return
* @throws Exception
*/
@Override
public
Result
StartegyPriorityParameterPush
(
StrategyParameterPush
req
)
throws
Exception
{
try
{
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
System
.
out
.
println
(
"req~~"
+
req
);
// 序列化请求参数
String
jsonReq
=
mapper
.
writeValueAsString
(
req
);
String
resultStr
=
RestTemplateTool
.
post
(
switchUrl
,
jsonReq
);
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
log
.
info
(
"下发神思策略管理参数配置推送成功,内容: {}"
,
req
);
Result
result
=
mapper
.
readValue
(
resultStr
,
Result
.
class
);
return
result
;
}
else
{
log
.
error
(
"策略管理参数配置推送url:{}失败:返回数据异常"
,
switchUrl
);
return
new
Result
(
"500"
,
"服务调用失败"
,
null
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"策略理参数配置推送url:{},失败:{}"
,
switchUrl
,
e
);
throw
new
Exception
(
e
);
}
}
}
}
signal-optimize-service/src/main/resources/mapper/strategy/StrategyPriorityMapper.xml
View file @
8b62f4fa
...
@@ -392,10 +392,10 @@
...
@@ -392,10 +392,10 @@
SELECT t1.green_id as greenId, t4.name as waveName, t1.cross_id as crossId,
SELECT t1.green_id as greenId, t4.name as waveName, t1.cross_id as crossId,
t3.name as crossName,t1.sort,
t3.name as crossName,t1.sort,
t2.daily_plan_details as dailyPlanDetails
t2.daily_plan_details as dailyPlanDetails
FROM
t_greenwave_cross t1
FROM
t_greenwave_info t4
LEFT JOIN t_strategy_priority_daily_info t2 on t1.cross_id = t2.cross_id and t2.type=2
LEFT JOIN t_greenwave_cross t1 on t1.green_id = t4.id
LEFT JOIN t_base_cross_info t3 on t1.cross_id = t3.id
LEFT JOIN t_strategy_priority_daily_info t2 on t1.cross_id = t2.cross_id and t2.type=2
LEFT JOIN t_greenwave_info t4 on t1.green_id = t4
.id
LEFT JOIN t_base_cross_info t3 on t1.cross_id = t3
.id
</select>
</select>
<select
id=
"selectGreenPriorityTable"
parameterType=
"map"
resultType=
"net.wanji.opt.entity.strategy.StrategyPriorityConfig"
>
<select
id=
"selectGreenPriorityTable"
parameterType=
"map"
resultType=
"net.wanji.opt.entity.strategy.StrategyPriorityConfig"
>
select
select
...
...
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