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
87d2654a
authored
Sep 06, 2023
by
lzy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
选择设备
parent
eac35281
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
102 additions
and
3 deletions
server-common/src/main/resources/locale/business_messages.properties
server-module/src/main/java/com/makeit/module/controller/space/PlatBedController.java
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDTO.java
server-service/src/main/java/com/makeit/entity/platform/device/PlatDevice.java
server-service/src/main/java/com/makeit/enums/platform/device/PlatDeviceEnum.java
server-service/src/main/java/com/makeit/service/platform/space/PlatBedService.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatBedServiceImpl.java
server-common/src/main/resources/locale/business_messages.properties
View file @
87d2654a
...
@@ -95,4 +95,4 @@ PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除
...
@@ -95,4 +95,4 @@ PLATFORM.ERROR.SPACE.NOT.DEL=该空间下存在下级或者房间,不可删除
PLATFORM.ERROR.ROOM.EXIT.BAD
=
房间中存在床位,不可删除
PLATFORM.ERROR.ROOM.EXIT.BAD
=
房间中存在床位,不可删除
PLATFORM.ERROR.ROOM.BAD.NUMBER.NOT.AUTH
=
床位数量不能改小
PLATFORM.ERROR.ROOM.BAD.NUMBER.NOT.AUTH
=
床位数量不能改小
PLATFORM.ERROR.BAD.NAME.EXIT
=
床位名称已存在
PLATFORM.ERROR.BAD.NAME.EXIT
=
床位名称已存在
PLATFORM.ERROR.BAD.NOT.DEL
=
床位已绑定长者,不可删除
PLATFORM.ERROR.BAD.NOT.DEL
=
床位已绑定长者或设备,不可删除
\ No newline at end of file
\ No newline at end of file
server-module/src/main/java/com/makeit/module/controller/space/PlatBedController.java
View file @
87d2654a
...
@@ -5,9 +5,11 @@ import com.makeit.common.page.PageReqDTO;
...
@@ -5,9 +5,11 @@ import com.makeit.common.page.PageReqDTO;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseEntity
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.common.response.ApiResponseUtils
;
import
com.makeit.dto.platform.device.PlatDeviceDTO
;
import
com.makeit.dto.platform.space.PlatBedEditDTO
;
import
com.makeit.dto.platform.space.PlatBedEditDTO
;
import
com.makeit.dto.platform.space.PlatBedQueryDTO
;
import
com.makeit.dto.platform.space.PlatBedQueryDTO
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
...
@@ -45,7 +47,6 @@ public class PlatBedController {
...
@@ -45,7 +47,6 @@ public class PlatBedController {
return
ApiResponseUtils
.
success
(
data
);
return
ApiResponseUtils
.
success
(
data
);
}
}
@ApiOperation
(
"编辑"
)
@ApiOperation
(
"编辑"
)
@PostMapping
(
"edit"
)
@PostMapping
(
"edit"
)
public
ApiResponseEntity
<?>
edit
(
@Validated
@RequestBody
PlatBedEditDTO
dto
)
{
public
ApiResponseEntity
<?>
edit
(
@Validated
@RequestBody
PlatBedEditDTO
dto
)
{
...
@@ -60,4 +61,11 @@ public class PlatBedController {
...
@@ -60,4 +61,11 @@ public class PlatBedController {
return
ApiResponseUtils
.
success
();
return
ApiResponseUtils
.
success
();
}
}
@ApiOperation
(
"设备列表(选择设备)"
)
@PostMapping
(
"pageDevice"
)
public
ApiResponseEntity
<
PageVO
<
PlatDeviceDTO
>>
pageDevice
(
@RequestBody
PageReqDTO
<
PlatDeviceDTO
>
page
)
{
PageVO
<
PlatDeviceDTO
>
data
=
platBedService
.
pageDevice
(
page
);
return
ApiResponseUtils
.
success
(
data
);
}
}
}
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDTO.java
0 → 100644
View file @
87d2654a
package
com
.
makeit
.
dto
.
platform
.
device
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Author:lzy
* @Date:2023/9/6 15:09
* @Describe:
*/
@Data
@ApiModel
(
"PlatDeviceDTO 模型"
)
public
class
PlatDeviceDTO
{
@ApiModelProperty
(
value
=
"原始设备ID"
)
private
String
oriDeviceId
;
@ApiModelProperty
(
value
=
"设备名称"
)
private
String
name
;
@ApiModelProperty
(
value
=
"产品名称"
)
private
String
productName
;
@ApiModelProperty
(
value
=
"状态 数据字典 1 在线 0离线"
)
private
String
status
;
}
server-service/src/main/java/com/makeit/entity/platform/device/PlatDevice.java
View file @
87d2654a
...
@@ -65,5 +65,8 @@ public class PlatDevice extends BaseBusEntity {
...
@@ -65,5 +65,8 @@ public class PlatDevice extends BaseBusEntity {
@ApiModelProperty
(
value
=
"组织路径"
)
@ApiModelProperty
(
value
=
"组织路径"
)
private
String
orgPath
;
private
String
orgPath
;
@ApiModelProperty
(
value
=
"设备类型 0-呼吸心率雷达 1-空间人体雷达 2-跌倒检测雷达"
)
private
String
category
;
}
}
server-service/src/main/java/com/makeit/enums/platform/device/PlatDeviceEnum.java
View file @
87d2654a
...
@@ -18,4 +18,18 @@ public class PlatDeviceEnum {
...
@@ -18,4 +18,18 @@ public class PlatDeviceEnum {
}
}
}
}
public
enum
CategoryEnum
implements
BaseEnum
{
HEART
(
"device.category.heart"
),
FALL
(
"device.status.fall"
),
SPACE
(
"device.status.space"
);
private
String
code
;
CategoryEnum
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getValue
()
{
return
SysDictUtil
.
getValue
(
code
);
}
}
}
}
server-service/src/main/java/com/makeit/service/platform/space/PlatBedService.java
View file @
87d2654a
...
@@ -3,6 +3,7 @@ package com.makeit.service.platform.space;
...
@@ -3,6 +3,7 @@ package com.makeit.service.platform.space;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.device.PlatDeviceDTO
;
import
com.makeit.dto.platform.space.PlatBedEditDTO
;
import
com.makeit.dto.platform.space.PlatBedEditDTO
;
import
com.makeit.dto.platform.space.PlatBedQueryDTO
;
import
com.makeit.dto.platform.space.PlatBedQueryDTO
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatBed
;
...
@@ -47,5 +48,12 @@ public interface PlatBedService extends IService<PlatBed> {
...
@@ -47,5 +48,12 @@ public interface PlatBedService extends IService<PlatBed> {
*/
*/
void
del
(
String
id
);
void
del
(
String
id
);
/**
* 未绑定设备列表
* @param pageReqDTO
* @return
*/
PageVO
<
PlatDeviceDTO
>
pageDevice
(
PageReqDTO
<
PlatDeviceDTO
>
pageReqDTO
);
}
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatBedServiceImpl.java
View file @
87d2654a
...
@@ -5,22 +5,29 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -5,22 +5,29 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageReqDTO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.common.page.PageVO
;
import
com.makeit.dto.platform.device.PlatDeviceDTO
;
import
com.makeit.dto.platform.space.PlatBedEditDTO
;
import
com.makeit.dto.platform.space.PlatBedEditDTO
;
import
com.makeit.dto.platform.space.PlatBedQueryDTO
;
import
com.makeit.dto.platform.space.PlatBedQueryDTO
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatBed
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.entity.platform.space.PlatRoom
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.platform.device.PlatDeviceEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.mapper.platform.space.PlatBedMapper
;
import
com.makeit.mapper.platform.space.PlatBedMapper
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
jodd.util.StringUtil
;
import
jodd.util.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* @Author:lzy
* @Author:lzy
...
@@ -30,6 +37,9 @@ import java.util.List;
...
@@ -30,6 +37,9 @@ import java.util.List;
@Service
@Service
public
class
PlatBedServiceImpl
extends
ServiceImpl
<
PlatBedMapper
,
PlatBed
>
implements
PlatBedService
{
public
class
PlatBedServiceImpl
extends
ServiceImpl
<
PlatBedMapper
,
PlatBed
>
implements
PlatBedService
{
@Autowired
private
PlatDeviceService
platDeviceService
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
add
(
PlatRoom
platRoom
)
{
public
void
add
(
PlatRoom
platRoom
)
{
...
@@ -106,6 +116,35 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
...
@@ -106,6 +116,35 @@ public class PlatBedServiceImpl extends ServiceImpl<PlatBedMapper, PlatBed> impl
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
platBed
.
getStatus
())){
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
platBed
.
getStatus
())){
throw
new
BusinessException
(
CodeMessageEnum
.
PLATFORM_ERROR_BAD_NOT_DEL
);
throw
new
BusinessException
(
CodeMessageEnum
.
PLATFORM_ERROR_BAD_NOT_DEL
);
}
}
if
(
StringUtil
.
isNotEmpty
(
platBed
.
getEquipmentId
())){
throw
new
BusinessException
(
CodeMessageEnum
.
PLATFORM_ERROR_BAD_NOT_DEL
);
}
removeById
(
id
);
removeById
(
id
);
}
}
@Override
public
PageVO
<
PlatDeviceDTO
>
pageDevice
(
PageReqDTO
<
PlatDeviceDTO
>
pageReqDTO
)
{
LambdaQueryWrapper
<
PlatBed
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
select
(
PlatBed:
:
getEquipmentId
);
queryWrapper1
.
isNotNull
(
PlatBed:
:
getEquipmentId
);
List
<
PlatBed
>
listBed
=
list
(
queryWrapper1
);
List
<
String
>
listEquipmentIds
=
listBed
.
stream
().
map
(
item
->
item
.
getEquipmentId
()).
collect
(
Collectors
.
toList
());
PlatDeviceDTO
dto
=
pageReqDTO
.
getData
();
Page
<
PlatDevice
>
p
=
PageUtil
.
toMpPage
(
pageReqDTO
);
LambdaQueryWrapper
<
PlatDevice
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
PlatDevice:
:
getCategory
,
PlatDeviceEnum
.
CategoryEnum
.
HEART
);
queryWrapper
.
notIn
(
PlatDevice:
:
getId
,
listEquipmentIds
);
queryWrapper
.
like
(
StringUtil
.
isNotEmpty
(
dto
.
getOriDeviceId
()),
PlatDevice:
:
getOriDeviceId
,
dto
.
getOriDeviceId
());
queryWrapper
.
like
(
StringUtil
.
isNotEmpty
(
dto
.
getName
()),
PlatDevice:
:
getName
,
dto
.
getName
());
queryWrapper
.
like
(
StringUtil
.
isNotEmpty
(
dto
.
getProductName
()),
PlatDevice:
:
getProductName
,
dto
.
getProductName
());
queryWrapper
.
eq
(
StringUtil
.
isNotEmpty
(
dto
.
getStatus
()),
PlatDevice:
:
getStatus
,
dto
.
getStatus
());
Page
<
PlatDevice
>
pages
=
platDeviceService
.
page
(
p
,
queryWrapper
);
List
<
PlatDeviceDTO
>
listRecord
=
BeanDtoVoUtils
.
listVo
(
pages
.
getRecords
(),
PlatDeviceDTO
.
class
);
return
PageUtil
.
toPageVO
(
listRecord
,
pages
);
}
}
}
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