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
19f472cf
Commit
19f472cf
authored
Jan 13, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化海康相位控制服务,增加相位列表参数
parent
4f627088
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
17 deletions
+41
-17
HKControlCommandServiceImpl.java
...utc/service/control/impl/HKControlCommandServiceImpl.java
+37
-14
ControlCommandVO.java
...vice/src/main/java/net/wanji/utc/vo/ControlCommandVO.java
+4
-3
No files found.
signal-utc-service/src/main/java/net/wanji/utc/service/control/impl/HKControlCommandServiceImpl.java
View file @
19f472cf
...
...
@@ -24,6 +24,7 @@ import net.wanji.utc.util.FieldUtil;
import
net.wanji.utc.util.PathUtil
;
import
net.wanji.utc.vo.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.*
;
...
...
@@ -264,34 +265,56 @@ public class HKControlCommandServiceImpl implements ControlCommandService {
if
(
commandVO
.
getCommand
().
equals
(
TRUE
))
{
Map
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>()
{
{
//put("crossCode", commandVO.getCrossCode());
put
(
"crossCode"
,
manufacturerInfoPO
.
getName
());
put
(
"controlType"
,
LOCK_RUNNING_CONTROL
);
}
};
// 获取某一路口下海康相位和车道关系
//Map<Integer, JSONArray> laneArrayMap = getPhaseRelationLanes(commandVO.getCrossCode());
Map
<
Integer
,
JSONArray
>
laneArrayMap
=
getPhaseRelationLanes
(
manufacturerInfoPO
.
getName
());
// 控制命令为灯态锁定时,设置相关车道参数信息
//List<SignalRunring> runrings = getSignalInfoVos(commandVO.getCrossCode()).get(0).getRunrings();
// HK 为单环
// 获取当前运行方案的相位id
LightsStatusVO
statusVO
=
getSignalInfoVos
(
manufacturerInfoPO
.
getName
()).
get
(
0
);
Integer
phaseId
=
Integer
.
valueOf
(
statusVO
.
getPhaseId
());
// 获取某一路口下海康相位和车道关系
//Map<Integer, JSONArray> laneArrayMap = getPhaseRelationLanes(commandVO.getCrossCode());
Map
<
Integer
,
JSONArray
>
laneArrayMap
=
getPhaseRelationLanes
(
manufacturerInfoPO
.
getName
());
JSONArray
jsonArray
=
laneArrayMap
.
get
(
phaseId
);
Integer
phaseId
;
List
<
Map
<
String
,
Object
>>
laneList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Map
<
String
,
Object
>
laneMap
=
new
HashMap
<>();
laneMap
.
put
(
"laneNo"
,
jsonObject
.
getInteger
(
"laneNo"
));
laneMap
.
put
(
"turn"
,
jsonObject
.
getInteger
(
"turn"
));
laneMap
.
put
(
"direction"
,
jsonObject
.
getInteger
(
"direction"
));
laneList
.
add
(
laneMap
);
if
(
CollectionUtils
.
isEmpty
(
commandVO
.
getPhaseList
()))
{
LightsStatusVO
statusVO
=
getSignalInfoVos
(
manufacturerInfoPO
.
getName
()).
get
(
0
);
phaseId
=
Integer
.
valueOf
(
statusVO
.
getPhaseId
());
JSONArray
jsonArray
=
laneArrayMap
.
get
(
phaseId
);
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Map
<
String
,
Object
>
laneMap
=
new
HashMap
<>();
laneMap
.
put
(
"laneNo"
,
jsonObject
.
getInteger
(
"laneNo"
));
laneMap
.
put
(
"turn"
,
jsonObject
.
getInteger
(
"turn"
));
laneMap
.
put
(
"direction"
,
jsonObject
.
getInteger
(
"direction"
));
laneList
.
add
(
laneMap
);
}
param
.
put
(
"laneInfos"
,
laneList
);
param
.
put
(
"controlNo"
,
0
);
// 控制时长,单位 s,0 则持续控制
param
.
put
(
"duration"
,
Objects
.
isNull
(
commandVO
.
getDuration
())
||
commandVO
.
getDuration
()
==
0
?
999
:
commandVO
.
getDuration
());
}
else
{
List
<
Integer
>
phaseList
=
commandVO
.
getPhaseList
();
for
(
Integer
phaseNo
:
phaseList
)
{
phaseId
=
phaseNo
;
JSONArray
jsonArray
=
laneArrayMap
.
get
(
phaseId
);
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Map
<
String
,
Object
>
laneMap
=
new
HashMap
<>();
laneMap
.
put
(
"laneNo"
,
jsonObject
.
getInteger
(
"laneNo"
));
laneMap
.
put
(
"turn"
,
jsonObject
.
getInteger
(
"turn"
));
laneMap
.
put
(
"direction"
,
jsonObject
.
getInteger
(
"direction"
));
laneList
.
add
(
laneMap
);
}
}
}
param
.
put
(
"laneInfos"
,
laneList
);
param
.
put
(
"controlNo"
,
0
);
// 控制时长,单位 s,0 则持续控制
param
.
put
(
"duration"
,
Objects
.
isNull
(
commandVO
.
getDuration
())
||
commandVO
.
getDuration
()
==
0
?
999
:
commandVO
.
getDuration
());
String
strResult
=
ArtemisHttpUtil
.
doPostStringArtemis
(
artemisConfig
,
PathUtil
.
getPathMapByApiCode
(
"setSignalControl"
),
JSON
.
toJSONString
(
param
),
null
,
null
,
"application/json"
,
null
);
...
...
signal-utc-service/src/main/java/net/wanji/utc/vo/ControlCommandVO.java
View file @
19f472cf
...
...
@@ -8,6 +8,7 @@ import javax.validation.constraints.Max;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
/**
* 控制指令VO
...
...
@@ -23,9 +24,6 @@ public class ControlCommandVO {
@NotBlank
(
message
=
"路口编号不可为空"
)
private
String
crossCode
;
/**
* 1 锁定; 0 取消
*/
@ApiModelProperty
(
value
=
"1是;0否"
)
@NotNull
(
message
=
"控制类型不可为空,1是;0否"
)
@Max
(
value
=
1
,
message
=
"控制类型:1是;0否"
)
...
...
@@ -35,4 +33,7 @@ public class ControlCommandVO {
@ApiModelProperty
(
value
=
"持续时间"
)
private
Integer
duration
;
@ApiModelProperty
(
value
=
"锁定相位列表"
)
private
List
<
Integer
>
phaseList
;
}
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