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
7541bfe3
Commit
7541bfe3
authored
Jul 10, 2023
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[update] 统一使用jackson
parent
d6753799
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
SignalStatusTask.java
...ce/src/main/java/net/wanji/utc/task/SignalStatusTask.java
+5
-9
No files found.
signal-utc-service/src/main/java/net/wanji/utc/task/SignalStatusTask.java
View file @
7541bfe3
package
net
.
wanji
.
utc
.
task
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
net.wanji.common.framework.rest.JsonViewObject
;
...
...
@@ -75,6 +73,7 @@ public class SignalStatusTask {
if
(!
evenWarnWebSocketMap
.
isEmpty
())
{
for
(
Map
.
Entry
<
String
,
RealTimeDataWebSocket
>
entry
:
evenWarnWebSocketMap
.
entrySet
())
{
commonThreadPoolExecutor
.
execute
(()
->
{
ObjectMapper
mapper
=
new
ObjectMapper
();
String
crossId
=
null
;
String
crossIdStr
=
entry
.
getKey
();
if
(
StringUtils
.
isNotBlank
(
crossIdStr
))
{
...
...
@@ -90,14 +89,11 @@ public class SignalStatusTask {
lightsStatusVOS
=
hkLightsStatusService
.
getHkLightsStatus
(
crossId
);
}
else
if
(
StringUtils
.
equals
(
BasicEnum
.
ManufacturerEnum
.
DT
.
getCode
(),
manufacturerInfoPO
.
getCode
())){
JsonViewObject
jsonViewObject
=
utcDTFeignClients
.
lightStatus
(
crossId
);
lightsStatusVOS
=
JSON
.
parseObject
((
String
)
jsonViewObject
.
getContent
(),
new
com
.
alibaba
.
fastjson
.
TypeReference
<
List
<
LightsStatusVO
>>()
{});
lightsStatusVOS
=
mapper
.
convertValue
(
jsonViewObject
.
getContent
(),
new
TypeReference
<
List
<
LightsStatusVO
>>()
{});
}
else
if
(
StringUtils
.
equals
(
BasicEnum
.
ManufacturerEnum
.
HISENSE
.
getCode
(),
manufacturerInfoPO
.
getCode
())){
JsonViewObject
jsonViewObject
=
utcHisenseFeignClients
.
lightStatus
(
crossId
);
ObjectMapper
mapper
=
new
ObjectMapper
();
lightsStatusVOS
=
mapper
.
convertValue
(
jsonViewObject
.
getContent
(),
new
com
.
fasterxml
.
jackson
.
core
.
type
.
TypeReference
<
List
<
LightsStatusVO
>>()
{
});
lightsStatusVOS
=
mapper
.
convertValue
(
jsonViewObject
.
getContent
(),
new
TypeReference
<
List
<
LightsStatusVO
>>()
{});
}
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"当前路口编号:{},海康返回灯态时间:{}ms"
,
crossId
,
(
end
-
start
));
...
...
@@ -122,7 +118,7 @@ public class SignalStatusTask {
Constants
.
controlModeMap
.
put
(
crossId
,
lightsStatusVO
.
getRunMode
());
try
{
log
.
error
(
"{}路口倒计时:{}"
,
crossId
,
lightsStatusVOS
.
get
(
0
).
getCycleCountDown
());
webSocket
.
sendInfo
(
JSONObject
.
toJSONString
(
lightsStatusVOS
,
SerializerFeature
.
WriteMapNullValue
),
crossIdStr
);
webSocket
.
sendInfo
(
mapper
.
writeValueAsString
(
lightsStatusVOS
),
crossIdStr
);
}
catch
(
Exception
e
)
{
log
.
error
(
"RealTimeDataWebSocket发送异常,异常信息:"
,
e
);
}
...
...
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