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
09820db4
Commit
09820db4
authored
Jan 21, 2025
by
zhoushiguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
60049dc9
f2520cc0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
2 deletions
+73
-2
StrategyControlDetailList.java
...t/wanji/opt/synthesis/pojo/StrategyControlDetailList.java
+1
-0
StrategyControlSwitchReq.java
...et/wanji/opt/synthesis/pojo/StrategyControlSwitchReq.java
+33
-0
PushStrategyControlService.java
...nji/opt/synthesis/service/PushStrategyControlService.java
+15
-0
PushStrategyControlServiceImpl.java
...ynthesis/service/impl/PushStrategyControlServiceImpl.java
+22
-0
StrategyControlServiceImpl.java
...pt/synthesis/service/impl/StrategyControlServiceImpl.java
+2
-2
No files found.
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlDetailList.java
View file @
09820db4
...
@@ -48,6 +48,7 @@ public class StrategyControlDetailList {
...
@@ -48,6 +48,7 @@ public class StrategyControlDetailList {
@Data
@Data
public
static
class
DailyPlanDetail
{
public
static
class
DailyPlanDetail
{
private
Integer
strategy
;
private
Integer
strategy
;
private
String
strategyName
;
private
List
<
String
>
times
;
private
List
<
String
>
times
;
}
}
}
}
...
...
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/pojo/StrategyControlSwitchReq.java
0 → 100644
View file @
09820db4
package
net
.
wanji
.
opt
.
synthesis
.
pojo
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author duanruiming
* @date 2025/01/18 13:46
*/
@Data
public
class
StrategyControlSwitchReq
{
private
List
<
Detail
>
req
;
@Data
public
static
class
Detail
{
/**
* 路口干线Id
*/
private
String
biz_id
;
/**
* 类型 0-路口 1-干线
*/
private
Integer
biz_type
;
/**
* 策略类型 0-绿波带 1-失衡 2-溢出 3-空放
*/
private
Integer
strategy
;
/**
* 状态(1=开启,0=停止)
*/
private
Integer
status
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/PushStrategyControlService.java
View file @
09820db4
...
@@ -2,11 +2,26 @@ package net.wanji.opt.synthesis.service;
...
@@ -2,11 +2,26 @@ package net.wanji.opt.synthesis.service;
import
net.wanji.opt.synthesis.pojo.Result
;
import
net.wanji.opt.synthesis.pojo.Result
;
import
net.wanji.opt.synthesis.pojo.StrategyControlReq
;
import
net.wanji.opt.synthesis.pojo.StrategyControlReq
;
import
net.wanji.opt.synthesis.pojo.StrategyControlSwitchReq
;
/**
/**
* @author duanruiming
* @author duanruiming
* @date 2024/11/03 14:06
* @date 2024/11/03 14:06
*/
*/
public
interface
PushStrategyControlService
{
public
interface
PushStrategyControlService
{
/**
* 策略详情推送
* @param req
* @return
* @throws Exception
*/
Result
push
(
StrategyControlReq
req
)
throws
Exception
;
Result
push
(
StrategyControlReq
req
)
throws
Exception
;
/**
* 策略控制开关推送
* @param req
* @return
* @throws Exception
*/
Result
switchPush
(
StrategyControlSwitchReq
req
)
throws
Exception
;
}
}
signal-optimize-service/src/main/java/net/wanji/opt/synthesis/service/impl/PushStrategyControlServiceImpl.java
View file @
09820db4
...
@@ -6,6 +6,7 @@ import net.wanji.common.tool.resttool.RestTemplateTool;
...
@@ -6,6 +6,7 @@ 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.synthesis.pojo.Result
;
import
net.wanji.opt.synthesis.pojo.Result
;
import
net.wanji.opt.synthesis.pojo.StrategyControlReq
;
import
net.wanji.opt.synthesis.pojo.StrategyControlReq
;
import
net.wanji.opt.synthesis.pojo.StrategyControlSwitchReq
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
net.wanji.opt.synthesis.service.PushStrategyControlService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -21,6 +22,8 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
...
@@ -21,6 +22,8 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
@Value
(
"${synthesis.strategyUrl}"
)
@Value
(
"${synthesis.strategyUrl}"
)
private
String
url
;
private
String
url
;
@Value
(
"${synthesis.strategySwitchUrl}"
)
private
String
switchUrl
;
@Override
@Override
public
Result
push
(
StrategyControlReq
req
)
throws
Exception
{
public
Result
push
(
StrategyControlReq
req
)
throws
Exception
{
//String url = "http://37.12.182.50:8082/api/traffic/strategy/info";
//String url = "http://37.12.182.50:8082/api/traffic/strategy/info";
...
@@ -39,4 +42,23 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
...
@@ -39,4 +42,23 @@ public class PushStrategyControlServiceImpl implements PushStrategyControlServic
throw
new
Exception
(
e
);
throw
new
Exception
(
e
);
}
}
}
}
@Override
public
Result
switchPush
(
StrategyControlSwitchReq
req
)
throws
Exception
{
String
switchUrl
=
"http://37.12.182.50:8082/api/traffic/strategy/control"
;
try
{
ObjectMapper
mapper
=
JacksonUtils
.
getInstance
();
String
resultStr
=
RestTemplateTool
.
post
(
switchUrl
,
mapper
.
writeValueAsString
(
req
));
if
(
StringUtils
.
isNotBlank
(
resultStr
))
{
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/java/net/wanji/opt/synthesis/service/impl/StrategyControlServiceImpl.java
View file @
09820db4
...
@@ -746,8 +746,8 @@ public class StrategyControlServiceImpl implements StrategyControlService {
...
@@ -746,8 +746,8 @@ public class StrategyControlServiceImpl implements StrategyControlService {
}
}
log
.
error
(
"下发神思策略信息详情: {}"
,
JacksonUtils
.
getInstance
().
writeValueAsString
(
req
));
log
.
error
(
"下发神思策略信息详情: {}"
,
JacksonUtils
.
getInstance
().
writeValueAsString
(
req
));
//
Result result = pushStrategyControlService.push(req);
Result
result
=
pushStrategyControlService
.
push
(
req
);
Result
result
=
new
Result
(
"200"
,
"成功"
,
null
);
//
Result result = new Result("200", "成功", null);
if
(
Objects
.
nonNull
(
result
))
{
if
(
Objects
.
nonNull
(
result
))
{
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
jsonViewObject
.
setCode
(
Integer
.
valueOf
(
result
.
getCode
()));
jsonViewObject
.
setCode
(
Integer
.
valueOf
(
result
.
getCode
()));
...
...
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