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
a5db060c
authored
Oct 26, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复设备写入问题,工作台问题
parent
31c2b005
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
7 deletions
server-common/src/main/java/com/makeit/module/iot/service/IotDevicePropertiesOperateService.java
server-module/src/main/java/com/makeit/module/controller/elder/PlatElderSleepController.java
server-service/src/main/java/com/makeit/mapper/platform/space/PlatSpaceMapper.java
server-service/src/main/java/com/makeit/service/platform/space/PlatSpaceService.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
server-service/src/main/resources/mappers/PlatSpaceMapper.xml
server-common/src/main/java/com/makeit/module/iot/service/IotDevicePropertiesOperateService.java
View file @
a5db060c
...
...
@@ -62,15 +62,18 @@ public class IotDevicePropertiesOperateService extends IotCommonService {
if
(
radarHight
!=
null
)
{
map
.
put
(
"radarHight"
,
radarHight
);
}
String
body
=
JsonUtil
.
toJson
(
map
);
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
map
.
entrySet
())
{
String
body
=
JsonUtil
.
toJson
(
entry
);
HttpRequest
request
=
buildRequest
(
url
,
body
);
try
{
ResponseMessage
responseMessage
=
sendPut
(
url
,
request
);
log
.
error
(
"写入设备属性信息:{}"
,
responseMessage
.
getMessage
());
log
.
info
(
"写入设备属性信息:{}"
,
responseMessage
.
getMessage
());
}
catch
(
IOException
e
)
{
log
.
error
(
"调用:{}接口异常:{}"
,
url
,
e
.
getMessage
());
}
}
return
Lists
.
newArrayList
();
}
...
...
server-module/src/main/java/com/makeit/module/controller/elder/PlatElderSleepController.java
View file @
a5db060c
...
...
@@ -3,14 +3,17 @@ package com.makeit.module.controller.elder;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.dto.wechat.device.PlatDeviceAttrWechatDTO
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.elder.PlatElderSleepService
;
import
com.makeit.task.IotSyncTask
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -31,7 +34,8 @@ public class PlatElderSleepController {
private
IotSyncTask
iotSyncTask
;
@Autowired
private
PlatElderSleepService
platElderSleepService
;
@Autowired
private
PlatDeviceService
platDeviceService
;
@ApiOperation
(
"测试"
)
@PostMapping
(
"test"
)
@AuthIgnore
...
...
@@ -51,6 +55,14 @@ public class PlatElderSleepController {
}
@ApiOperation
(
"编辑设备属性"
)
@PostMapping
(
"editDeviceProperties"
)
@AuthIgnore
@TenantIdIgnore
public
ApiResponseEntity
<?>
editDeviceProperties
(
@RequestBody
PlatDeviceAttrWechatDTO
dto
)
{
platDeviceService
.
editDeviceProperties
(
dto
);
return
ApiResponseUtils
.
success
();
}
}
server-service/src/main/java/com/makeit/mapper/platform/space/PlatSpaceMapper.java
View file @
a5db060c
package
com
.
makeit
.
mapper
.
platform
.
space
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.makeit.dto.platform.space.PlatSpaceQueryDTO
;
import
com.makeit.entity.platform.space.PlatSpace
;
import
com.makeit.vo.platform.space.PlatSpaceAndRoomVO
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -18,4 +17,6 @@ public interface PlatSpaceMapper extends BaseMapper<PlatSpace> {
List
<
PlatSpaceAndRoomVO
>
spaceListExcludeLast
(
@Param
(
"orgIds"
)
List
<
String
>
orgIds
);
List
<
PlatSpace
>
listChild
(
@Param
(
"spaceIds"
)
List
<
String
>
spaceIds
);
List
<
PlatSpace
>
listChildAndOrgIds
(
@Param
(
"spaceIds"
)
List
<
String
>
spaceIds
,
@Param
(
"orgIds"
)
List
<
String
>
orgIds
);
}
server-service/src/main/java/com/makeit/service/platform/space/PlatSpaceService.java
View file @
a5db060c
...
...
@@ -93,4 +93,5 @@ public interface PlatSpaceService extends IService<PlatSpace> {
List
<
PlatSpaceVO
>
listBedTreeByElderGroup
(
PlatSpaceQueryDTO
dto
,
boolean
flag
);
List
<
PlatSpace
>
listChildAndOrgIds
(
List
<
String
>
spaceIds
,
List
<
String
>
orgIds
);
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
a5db060c
...
...
@@ -330,6 +330,11 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
}
@Override
public
List
<
PlatSpace
>
listChildAndOrgIds
(
List
<
String
>
spaceIds
,
List
<
String
>
orgIds
)
{
return
baseMapper
.
listChildAndOrgIds
(
spaceIds
,
orgIds
);
}
@Override
public
List
<
PlatSpaceAddDTO
>
oneLevelList
(
BaseIdDTO
dto
)
{
List
<
PlatSpace
>
spaces
=
list
(
new
QueryWrapper
<
PlatSpace
>().
lambda
()
...
...
server-service/src/main/java/com/makeit/service/platform/workstation/impl/WorkStationServiceImpl.java
View file @
a5db060c
...
...
@@ -498,18 +498,22 @@ public class WorkStationServiceImpl implements WorkStationService {
spaces
=
platSpaceService
.
list
(
new
QueryWrapper
<
PlatSpace
>().
lambda
()
.
in
(
PlatSpace:
:
getOrgId
,
dto
.
getOrgIds
()));
if
(
spaces
.
isEmpty
())
{
return
new
PageVO
<>();
}
List
<
String
>
spaceIds
=
spaces
.
stream
().
map
(
PlatSpace:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setSpaceIds
(
spaceIds
);
}
else
{
//获取父级的所有子级空间
if
(
CollectionUtils
.
isNotEmpty
(
dto
.
getOrgIds
()))
{
spaces
=
platSpaceService
.
listChildAndOrgIds
(
dto
.
getSpaceIds
(),
dto
.
getOrgIds
());
}
else
{
spaces
=
platSpaceService
.
listChild
(
dto
.
getSpaceIds
());
}
List
<
String
>
spaceIds
=
spaces
.
stream
().
map
(
PlatSpace:
:
getId
).
collect
(
Collectors
.
toList
());
dto
.
setSpaceIds
(
spaceIds
);
}
if
(
spaces
.
isEmpty
())
{
return
new
PageVO
<>();
}
List
<
String
>
elderIdList
=
new
ArrayList
<>();
List
<
PlatAlarmRecord
>
alarmRecords
=
platAlarmRecordService
.
list
(
new
QueryWrapper
<
PlatAlarmRecord
>().
lambda
()
...
...
server-service/src/main/resources/mappers/PlatSpaceMapper.xml
View file @
a5db060c
...
...
@@ -32,4 +32,26 @@
</where>
</select>
<select
id=
"listChildAndOrgIds"
resultType=
"com.makeit.entity.platform.space.PlatSpace"
>
SELECT id,name,parent_id,type,address,longitude,latitude,parent_path,tenant_id,org_id,attribute
FROM plat_space
<where>
del_flag = 0
<if
test=
"spaceIds != null and spaceIds.size() > 0 "
>
AND (
<foreach
collection=
"spaceIds"
item=
"item"
separator=
"or"
open=
""
close=
""
index=
""
>
FIND_IN_SET(#{item},parent_path) OR id = #{item}
</foreach>
)
</if>
<if
test=
"orgIds != null and orgIds.size() > 0 "
>
AND org_id in
<foreach
collection=
"orgIds"
item=
"item"
separator=
","
open=
"("
close=
")"
index=
""
>
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
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