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
57a5a358
Commit
57a5a358
authored
Feb 20, 2025
by
duanruiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[add] 灯态推送易购优化;
parent
fb71083d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
SignalStatusServiceImpl.java
...nji/utc/hisense/service/impl/SignalStatusServiceImpl.java
+11
-2
OkHttpClientUtil.java
...ain/java/net/wanji/utc/hisense/util/OkHttpClientUtil.java
+6
-2
No files found.
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/service/impl/SignalStatusServiceImpl.java
View file @
57a5a358
...
...
@@ -273,9 +273,18 @@ public class SignalStatusServiceImpl implements SignalStatusService {
log
.
error
(
"海信灯态推送百度失败:{}"
,
e
.
getMessage
());
}
try
{
OkHttpClientUtil
.
jsonPost
(
yiGouUrl
,
jackson
.
writeValueAsString
(
hisenseLightStatusPojos
));
HisenseLightStatusPojo
hisenseLightStatusPojo
=
hisenseLightStatusPojos
.
get
(
0
);
String
bodyStr
=
hisenseLightStatusPojo
.
getBody
();
List
<
HisenseLightStatusPojo
.
Body
>
bodies
=
jackson
.
readValue
(
bodyStr
,
new
TypeReference
<
List
<
HisenseLightStatusPojo
.
Body
>>()
{});
for
(
HisenseLightStatusPojo
.
Body
body
:
bodies
)
{
HisenseLightStatusPojo
.
ContentBody
content
=
body
.
getContent
();
String
crossId
=
content
.
getCrossId
();
if
(
StringUtils
.
equalsIgnoreCase
(
"255136"
,
crossId
))
{
OkHttpClientUtil
.
jsonPost
(
yiGouUrl
,
jackson
.
writeValueAsString
(
hisenseLightStatusPojos
));
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"海信灯态推送易购失败:{}"
,
e
.
getMessage
()
);
log
.
error
(
"海信灯态推送易购失败:{}"
,
e
);
}
}
...
...
signal-utc-hisense-service/src/main/java/net/wanji/utc/hisense/util/OkHttpClientUtil.java
View file @
57a5a358
...
...
@@ -6,6 +6,7 @@ import net.wanji.common.utils.tool.StringUtils;
import
okhttp3.*
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
/**
* @ClassName OkHttpClient
...
...
@@ -48,7 +49,10 @@ public class OkHttpClientUtil {
return
null
;
}
// 创建 OkHttpClient 实例
OkHttpClient
client
=
new
OkHttpClient
();
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
connectTimeout
(
30
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
30
,
TimeUnit
.
SECONDS
)
.
build
();
// 创建请求体
RequestBody
body
=
RequestBody
.
create
(
json
,
MediaType
.
get
(
"application/json; charset=utf-8"
));
// 创建请求
...
...
@@ -66,7 +70,7 @@ public class OkHttpClientUtil {
}
}
catch
(
Exception
e
)
{
log
.
error
(
"OkHttpClientUtil远程服务url:{}, 调用异常:{}"
,
url
,
e
.
getMessage
());
throw
new
Exception
();
throw
new
Exception
(
e
);
}
return
null
;
}
...
...
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