Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
glsx-smart-message-channel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 5574cb33
authored
Apr 25, 2021
by
111-PC\111
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]pulsar消费服务
1 parent
79a32bda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
src/main/java/cn/com/glsx/consumer/service/DeviceService.java
src/main/java/cn/com/glsx/consumer/service/InfoService.java
src/main/java/cn/com/glsx/consumer/service/DeviceService.java
View file @
5574cb3
...
...
@@ -4,6 +4,7 @@ import cn.com.glsx.consumer.entity.DeviceVo;
import
cn.com.glsx.consumer.utils.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.stereotype.Service
;
...
...
@@ -29,6 +30,9 @@ public class DeviceService {
@Value
(
"${deleteUserDevUrl}"
)
private
String
deleteUserDevUrl
;
@Value
(
"${getDeviceNameUrl}"
)
private
String
getDeviceNameUrl
;
/**
* 设备绑定
*
...
...
@@ -59,4 +63,19 @@ public class DeviceService {
}
}
public
String
getDeviceName
(
String
devId
)
{
String
name
=
null
;
try
{
JSONObject
jsonObject
=
HttpUtil
.
sendGet
(
getDeviceNameUrl
.
replace
(
"{device_id}"
,
devId
),
null
,
new
HashMap
<>());
JSONObject
message
=
jsonObject
.
getJSONObject
(
"message"
);
if
(
message
!=
null
){
name
=
message
.
getString
(
"name"
);
}
log
.
info
(
"设备id{}名称查询结果{}"
,
devId
,
name
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
info
(
"设备id{}名称查询结果{}"
,
devId
,
e
);
}
return
name
;
}
}
src/main/java/cn/com/glsx/consumer/service/InfoService.java
View file @
5574cb3
...
...
@@ -244,7 +244,8 @@ public class InfoService {
private
DeviceVo
convervo
(
DeviceEvent
deviceEvent
)
{
DeviceVo
deviceVo
=
new
DeviceVo
();
DeviceEventDetail
bizData
=
deviceEvent
.
getBizData
();
deviceVo
.
setDeviceName
(
bizData
.
getName
());
String
name
=
deviceService
.
getDeviceName
(
bizData
.
getDevId
());
deviceVo
.
setDeviceName
(
name
);
deviceVo
.
setUid
(
bizData
.
getUid
());
deviceVo
.
setPlatformProductId
(
deviceEvent
.
getProductKey
());
deviceVo
.
setChannel
(
1
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment