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
64d9b8c2
Commit
64d9b8c2
authored
Mar 17, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 海信服务添加全红黄闪控制
parent
18052482
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
5 deletions
+64
-5
HttpConstants.java
...net/wanji/utc/hisense/common/constants/HttpConstants.java
+11
-0
ControlCommandServiceImpl.java
...i/utc/hisense/service/impl/ControlCommandServiceImpl.java
+53
-5
No files found.
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/common/constants/HttpConstants.java
View file @
64d9b8c2
...
...
@@ -6,6 +6,7 @@ package net.wanji.utc.hisense.common.constants;
* @Author zhouleilei
* @Date 2024/11/3 16:47
*/
@SuppressWarnings
(
"all"
)
public
class
HttpConstants
{
//MESSAGETYPE
public
static
final
String
MESSAGETYPE
=
"messageType"
;
...
...
@@ -52,5 +53,15 @@ public class HttpConstants {
// result = 3 指令执行失败
public
static
final
String
RESULT_3
=
"3"
;
/** 关灯251 */
public
static
final
String
CLOSED_LIGHT_CONTROL
=
"251"
;
/** 全红252 */
public
static
final
String
ALL_RED_CONTROL
=
"252"
;
/** 方案选择控制253 */
public
static
final
String
SCHEME_SELECT_CONTROL
=
"253"
;
/** FREE控制-感应控制-半感应控制254 */
public
static
final
String
FREE_CONTROL
=
"254"
;
/** 黄闪255 */
public
static
final
String
YELLOW_CONTROL
=
"255"
;
}
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/service/impl/ControlCommandServiceImpl.java
View file @
64d9b8c2
...
...
@@ -32,10 +32,7 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* @author duanruiming
...
...
@@ -395,7 +392,58 @@ public class ControlCommandServiceImpl implements ControlCommandService {
@Override
public
JsonViewObject
setSignalControl
(
ControlCommandVO
commandVO
)
throws
Exception
{
return
null
;
JsonViewObject
jsonViewObject
=
JsonViewObject
.
newInstance
();
CrossInfoPOExt
crossInfoPOExt
=
crossInfoMapper
.
selectById
(
commandVO
.
getCrossCode
());
Integer
controlType
=
commandVO
.
getControlType
();
String
hisenseControlType
=
"0"
;
if
(
Objects
.
equals
(
1
,
controlType
))
{
hisenseControlType
=
HttpConstants
.
CLOSED_LIGHT_CONTROL
;
}
if
(
Objects
.
equals
(
2
,
controlType
))
{
hisenseControlType
=
HttpConstants
.
YELLOW_CONTROL
;
}
if
(
Objects
.
equals
(
3
,
controlType
))
{
hisenseControlType
=
HttpConstants
.
ALL_RED_CONTROL
;
}
Document
document
=
getDocument
(
crossInfoPOExt
,
hisenseControlType
);
//给海信发送http请求
try
{
//String post = OkHttpClientUtil.xmlPost(hisenseUrl, document.asXML());
String
post
=
OkHttpClientUtil
.
xmlPost
(
""
,
document
.
asXML
());
if
(
StringUtils
.
isNotBlank
(
post
))
{
Document
postResult
=
DocumentHelper
.
parseText
(
post
);
String
result
=
postResult
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_RESULT
).
getText
();
if
(
HttpConstants
.
RESULT_1
.
equals
(
result
)
||
HttpConstants
.
RESULT_2
.
equals
(
result
))
{
//指令下发成功
jsonViewObject
.
success
(
"远程调用海信服务-特殊控制成功"
);
}
else
{
//指令下发失败
jsonViewObject
.
fail
(
"远程调用海信服务-特殊控制成功"
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
" 手动方案控制-全红控制失败:{}"
,
e
);
return
jsonViewObject
.
fail
(
"远程调用海信服务-特殊控制成功"
);
}
return
jsonViewObject
;
}
/**
* 手动方案控制xml通用方法
* @param crossInfoPOExt
* @return
*/
private
static
Document
getDocument
(
CrossInfoPOExt
crossInfoPOExt
,
String
type
)
{
//组装document
Document
document
=
OperationBaseDom
.
generateBaseDoc
();
Element
element
=
(
Element
)
document
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION
);
element
.
addElement
(
HttpConstants
.
MESSAGETYPE
).
setText
(
HttpConstants
.
MESSAGETYPE_16
);
Element
messageContent
=
(
Element
)
document
.
selectSingleNode
(
HttpConstants
.
SYSTEMSCRIPTION_MESSAGECONTENT
);
messageContent
.
addElement
(
HttpConstants
.
SPOT
).
setText
(
crossInfoPOExt
.
getCode
());
messageContent
.
addElement
(
HttpConstants
.
PATTERN
).
setText
(
type
);
return
document
;
}
@Override
...
...
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