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
344d6a51
authored
Nov 01, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:saas端,平台端,小程序设备读取谢日
parent
4a715455
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
11 deletions
saas-module/src/main/java/com/makeit/controller/device/SaasDeviceController.java
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceAttrWechatDTO.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
saas-module/src/main/java/com/makeit/controller/device/SaasDeviceController.java
View file @
344d6a51
...
@@ -7,8 +7,10 @@ import com.makeit.common.response.ApiResponseEntity;
...
@@ -7,8 +7,10 @@ import com.makeit.common.response.ApiResponseEntity;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.dto.platform.device.PlatDeviceDetailDTO
;
import
com.makeit.dto.saas.device.PlatDeviceEditSaasDTO
;
import
com.makeit.dto.saas.device.PlatDeviceEditSaasDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.module.iot.vo.DeviceProperties
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.saas.SaasOperationLogService
;
import
com.makeit.service.saas.SaasOperationLogService
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
...
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestBody;
...
@@ -20,6 +22,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@Api
(
tags
=
"租户管理-租户设备管理"
)
@Api
(
tags
=
"租户管理-租户设备管理"
)
@RestController
@RestController
@RequestMapping
(
"/saas/device"
)
@RequestMapping
(
"/saas/device"
)
...
@@ -55,4 +59,17 @@ public class SaasDeviceController {
...
@@ -55,4 +59,17 @@ public class SaasDeviceController {
return
ApiResponseUtils
.
success
();
return
ApiResponseUtils
.
success
();
}
}
@ApiOperation
(
"读取设备属性 主要读取usrServerInfo信息"
)
@PostMapping
(
"readDeviceProperties"
)
public
ApiResponseEntity
<
List
<
DeviceProperties
>>
readDeviceProperties
(
@RequestBody
PlatDeviceAttrWechatDTO
dto
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
readDeviceProperties
(
dto
));
}
@ApiOperation
(
"编辑设备属性 主要写入usrServerInfo信息"
)
@PostMapping
(
"editDeviceProperties"
)
public
ApiResponseEntity
<?>
editDeviceProperties
(
@RequestBody
PlatDeviceAttrWechatDTO
dto
)
{
platDeviceService
.
editDeviceProperties
(
dto
);
return
ApiResponseUtils
.
success
();
}
}
}
server-module/src/main/java/com/makeit/module/controller/device/PlatDeviceController.java
View file @
344d6a51
...
@@ -8,9 +8,11 @@ import com.makeit.common.response.ApiResponseEntity;
...
@@ -8,9 +8,11 @@ import com.makeit.common.response.ApiResponseEntity;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.dto.platform.device.PlatDeviceEditDTO
;
import
com.makeit.dto.platform.device.PlatDeviceEditDTO
;
import
com.makeit.dto.platform.device.PlatDeviceQueryDTO
;
import
com.makeit.dto.platform.device.PlatDeviceQueryDTO
;
import
com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.module.iot.vo.DeviceProperties
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.task.IotSyncTask
;
import
com.makeit.task.IotSyncTask
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
import
com.makeit.vo.platform.device.PlatDeviceListVO
;
...
@@ -80,5 +82,17 @@ public class PlatDeviceController {
...
@@ -80,5 +82,17 @@ public class PlatDeviceController {
return
ApiResponseUtils
.
success
(
platDeviceService
.
productList
(
dto
));
return
ApiResponseUtils
.
success
(
platDeviceService
.
productList
(
dto
));
}
}
@ApiOperation
(
"读取设备属性 主要读取usrServerInfo信息"
)
@PostMapping
(
"readDeviceProperties"
)
public
ApiResponseEntity
<
List
<
DeviceProperties
>>
readDeviceProperties
(
@RequestBody
PlatDeviceAttrWechatDTO
dto
)
{
return
ApiResponseUtils
.
success
(
platDeviceService
.
readDeviceProperties
(
dto
));
}
@ApiOperation
(
"编辑设备属性 主要写入usrServerInfo信息"
)
@PostMapping
(
"editDeviceProperties"
)
public
ApiResponseEntity
<?>
editDeviceProperties
(
@RequestBody
PlatDeviceAttrWechatDTO
dto
)
{
platDeviceService
.
editDeviceProperties
(
dto
);
return
ApiResponseUtils
.
success
();
}
}
}
server-service/src/main/java/com/makeit/dto/wechat/device/PlatDeviceAttrWechatDTO.java
View file @
344d6a51
...
@@ -35,14 +35,7 @@ public class PlatDeviceAttrWechatDTO {
...
@@ -35,14 +35,7 @@ public class PlatDeviceAttrWechatDTO {
private
String
readProperties
;
private
String
readProperties
;
//private String usrServerInfo;
//private String usrServerInfo;
@ApiModelProperty
(
value
=
"服务信息 {\n"
+
@ApiModelProperty
(
value
=
"服务信息 {\"password\":\"1234576\",\"secureKey\":\"kuangshi\",\"secureId\":\"kuangshi\",\"addr\":\"mqtt://121.1.1.2\",\"username\":\"kuangshi\",\"port\":1883} "
)
" \"password\": \"\",\n"
+
" \"port\": 0,\n"
+
" \"secure_key\": \"\",\n"
+
" \"secure_id\": \"\",\n"
+
" \"addr\": \"\",\n"
+
" \"username\": \"\"\n"
+
" }"
)
private
UserServerInfo
usrServerInfo
;
private
UserServerInfo
usrServerInfo
;
}
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
344d6a51
...
@@ -31,11 +31,11 @@ import com.makeit.entity.platform.space.PlatSpace;
...
@@ -31,11 +31,11 @@ import com.makeit.entity.platform.space.PlatSpace;
import
com.makeit.entity.saas.PlatTenant
;
import
com.makeit.entity.saas.PlatTenant
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.HeaderConst
;
import
com.makeit.enums.report.DeviceNameEnum
;
import
com.makeit.enums.report.DeviceNameEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.mapper.platform.device.PlatDeviceMapper
;
import
com.makeit.mapper.platform.device.PlatDeviceMapper
;
import
com.makeit.module.iot.dto.UserServerInfo
;
import
com.makeit.module.iot.service.IotDevicePropertiesOperateService
;
import
com.makeit.module.iot.service.IotDevicePropertiesOperateService
;
import
com.makeit.module.iot.service.IotOrgService
;
import
com.makeit.module.iot.service.IotOrgService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
...
@@ -403,14 +403,28 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -403,14 +403,28 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Override
@Override
public
void
editDeviceProperties
(
PlatDeviceAttrWechatDTO
dto
)
{
public
void
editDeviceProperties
(
PlatDeviceAttrWechatDTO
dto
)
{
String
deviceId
=
dto
.
getDeviceId
();
PlatDeviceOther
other
=
platDeviceOtherService
.
getOne
(
new
QueryWrapper
<
PlatDeviceOther
>().
lambda
()
.
eq
(
PlatDeviceOther:
:
getOriDeviceId
,
deviceId
));
UserServerInfo
usrServerInfo
=
dto
.
getUsrServerInfo
();
if
(
other
!=
null
&&
usrServerInfo
!=
null
)
{
other
.
setProtocolAccount
(
usrServerInfo
.
getUsername
());
other
.
setProtocolPassword
(
usrServerInfo
.
getPassword
());
other
.
setProtocolAddress
(
usrServerInfo
.
getAddr
());
other
.
setProtocolPort
(
usrServerInfo
.
getPort
()
==
null
?
""
:
usrServerInfo
.
getPort
().
toString
());
other
.
setSecureId
(
usrServerInfo
.
getSecureId
());
other
.
setSecureKey
(
usrServerInfo
.
getSecureKey
());
platDeviceOtherService
.
updateById
(
other
);
}
log
.
info
(
"写入设备属性请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
log
.
info
(
"写入设备属性请求参数:{}"
,
JSON
.
toJSONString
(
dto
));
devicePropertiesOperateService
.
deviceWrite
(
d
to
.
getDeviceId
(),
dto
.
getRadarMount
(),
dto
.
getRadarMode
(),
dto
.
getRadarHight
(),
dto
.
getUsrServerInfo
()
);
devicePropertiesOperateService
.
deviceWrite
(
d
eviceId
,
dto
.
getRadarMount
(),
dto
.
getRadarMode
(),
dto
.
getRadarHight
(),
usrServerInfo
);
if
(
dto
.
getRadarMount
()
!=
null
)
{
if
(
dto
.
getRadarMount
()
!=
null
)
{
//更新区域设置设备安装方式
//更新区域设置设备安装方式
platRegionSettingService
.
update
(
new
UpdateWrapper
<
PlatRegionSetting
>().
lambda
()
platRegionSettingService
.
update
(
new
UpdateWrapper
<
PlatRegionSetting
>().
lambda
()
.
set
(
PlatRegionSetting:
:
getInstallType
,
dto
.
getRadarMount
())
.
set
(
PlatRegionSetting:
:
getInstallType
,
dto
.
getRadarMount
())
.
eq
(
PlatRegionSetting:
:
getDeviceId
,
d
to
.
getDeviceId
()
));
.
eq
(
PlatRegionSetting:
:
getDeviceId
,
d
eviceId
));
}
}
}
}
...
...
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