Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
黄嘉阳
/
iot-platform-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
40ea5954
authored
Oct 30, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:设备属性写入
parent
77c23ac1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
server-common/src/main/java/com/makeit/module/iot/dto/UserServerInfo.java
server-common/src/main/java/com/makeit/module/iot/service/IotDevicePropertiesOperateService.java
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceAttrWechatDTO.java
server-web/src/main/java/com/makeit/mqtt/MqttController.java
server-common/src/main/java/com/makeit/module/iot/dto/UserServerInfo.java
0 → 100644
View file @
40ea5954
package
com
.
makeit
.
module
.
iot
.
dto
;
import
lombok.Data
;
@Data
public
class
UserServerInfo
{
private
String
password
;
private
String
secureKey
;
private
String
secureId
;
private
String
addr
;
private
String
username
;
private
Integer
port
;
}
server-common/src/main/java/com/makeit/module/iot/service/IotDevicePropertiesOperateService.java
View file @
40ea5954
...
@@ -3,6 +3,7 @@ package com.makeit.module.iot.service;
...
@@ -3,6 +3,7 @@ package com.makeit.module.iot.service;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.makeit.module.iot.dto.UserServerInfo
;
import
com.makeit.module.iot.util.HttpRequest
;
import
com.makeit.module.iot.util.HttpRequest
;
import
com.makeit.module.iot.util.SimpleHttpRequest
;
import
com.makeit.module.iot.util.SimpleHttpRequest
;
import
com.makeit.module.iot.vo.DeviceInstanceEntity
;
import
com.makeit.module.iot.vo.DeviceInstanceEntity
;
...
@@ -48,7 +49,7 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
...
@@ -48,7 +49,7 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
* 把设备写入属性
* 把设备写入属性
*/
*/
@Async
@Async
public
List
<
DeviceInstanceEntity
>
deviceWrite
(
String
deviceId
,
Integer
radarMount
,
Integer
radarMode
,
Integer
radarHight
)
{
public
List
<
DeviceInstanceEntity
>
deviceWrite
(
String
deviceId
,
Integer
radarMount
,
Integer
radarMode
,
Integer
radarHight
,
UserServerInfo
usrServerInfo
)
{
String
url
=
iotUrl
+
DEVICE_PREFIX_URL
+
deviceId
+
"/property"
;
String
url
=
iotUrl
+
DEVICE_PREFIX_URL
+
deviceId
+
"/property"
;
// 条件可以自己改
// 条件可以自己改
...
@@ -62,7 +63,9 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
...
@@ -62,7 +63,9 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
if
(
radarHight
!=
null
)
{
if
(
radarHight
!=
null
)
{
map
.
put
(
"radarHight"
,
radarHight
);
map
.
put
(
"radarHight"
,
radarHight
);
}
}
if
(
usrServerInfo
!=
null
)
{
map
.
put
(
"usrServerInfo"
,
JSON
.
toJSONString
(
usrServerInfo
));
}
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
())
{
String
body
=
JsonUtil
.
toJson
(
entry
);
String
body
=
JsonUtil
.
toJson
(
entry
);
...
...
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceAttrWechatDTO.java
View file @
40ea5954
package
com
.
makeit
.
dto
.
wechat
.
device
;
package
com
.
makeit
.
dto
.
wechat
.
device
;
import
com.makeit.module.iot.dto.UserServerInfo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -32,6 +33,8 @@ public class PlatDeviceAttrWechatDTO {
...
@@ -32,6 +33,8 @@ public class PlatDeviceAttrWechatDTO {
@ApiModelProperty
(
value
=
"读取硬件的系统参数,主要读取服务信息和雷达信息,多个逗号隔开"
)
@ApiModelProperty
(
value
=
"读取硬件的系统参数,主要读取服务信息和雷达信息,多个逗号隔开"
)
private
String
readProperties
;
private
String
readProperties
;
//private String usrServerInfo;
@ApiModelProperty
(
value
=
"服务信息 {\n"
+
@ApiModelProperty
(
value
=
"服务信息 {\n"
+
" \"password\": \"\",\n"
+
" \"password\": \"\",\n"
+
" \"port\": 0,\n"
+
" \"port\": 0,\n"
+
...
@@ -40,6 +43,6 @@ public class PlatDeviceAttrWechatDTO {
...
@@ -40,6 +43,6 @@ public class PlatDeviceAttrWechatDTO {
" \"addr\": \"\",\n"
+
" \"addr\": \"\",\n"
+
" \"username\": \"\"\n"
+
" \"username\": \"\"\n"
+
" }"
)
" }"
)
private
String
usrServerInfo
;
private
UserServerInfo
usrServerInfo
;
}
}
server-web/src/main/java/com/makeit/mqtt/MqttController.java
View file @
40ea5954
...
@@ -28,7 +28,7 @@ public class MqttController {
...
@@ -28,7 +28,7 @@ public class MqttController {
@AuthIgnore
@AuthIgnore
@TenantIdIgnore
@TenantIdIgnore
public
ApiResponseEntity
<
Void
>
testMqtt
()
{
public
ApiResponseEntity
<
Void
>
testMqtt
()
{
devicePropertiesOperateService
.
deviceWrite
(
"1701240048151490560"
,
1
,
1
,
1
);
devicePropertiesOperateService
.
deviceWrite
(
"1701240048151490560"
,
1
,
1
,
1
,
null
);
return
ApiResponseUtils
.
success
();
return
ApiResponseUtils
.
success
();
}
}
...
...
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