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
c288bcef
authored
Sep 26, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix bug
parent
a4a753c7
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
175 additions
and
17 deletions
server-module/src/main/java/com/makeit/module/controller/space/PlatRegionSettingController.java
server-module/src/main/java/com/makeit/module/controller/space/PlatRoomController.java
server-module/src/main/java/com/makeit/module/controller/space/PlatSpaceController.java
server-module/src/main/java/com/makeit/module/controller/wechat/space/PlatRegionSettingWechatController.java
server-module/src/main/java/com/makeit/module/controller/wechat/space/PlatRoomWechatController.java
server-service/src/main/java/com/makeit/dto/platform/space/PlatRegionSettingDTO.java
server-service/src/main/java/com/makeit/service/platform/space/PlatRegionSettingService.java
server-service/src/main/java/com/makeit/service/platform/space/PlatSpaceService.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRoomServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
server-module/src/main/java/com/makeit/module/controller/space/PlatRegionSettingController.java
View file @
c288bcef
...
@@ -6,9 +6,9 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
...
@@ -6,9 +6,9 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import
com.makeit.dto.platform.space.PlatRegionSettingListDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingListDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -60,6 +60,13 @@ public class PlatRegionSettingController {
...
@@ -60,6 +60,13 @@ public class PlatRegionSettingController {
return
ApiResponseUtils
.
success
(
list
);
return
ApiResponseUtils
.
success
(
list
);
}
}
@ApiOperation
(
"跌倒设备定位(时间范围内定位)"
)
@PostMapping
(
"fallDeviceLocate"
)
public
ApiResponseEntity
<
List
<
DeviceInfoContentFall
.
Properties
>>
fallDeviceLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
List
<
DeviceInfoContentFall
.
Properties
>
list
=
platRegionSettingService
.
fallDeviceLocate
(
dto
);
return
ApiResponseUtils
.
success
(
list
);
}
@ApiOperation
(
"实时定位"
)
@ApiOperation
(
"实时定位"
)
@PostMapping
(
"nowDataLocate"
)
@PostMapping
(
"nowDataLocate"
)
public
ApiResponseEntity
<
DeviceInfoContentSpace
.
Properties
>
nowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
public
ApiResponseEntity
<
DeviceInfoContentSpace
.
Properties
>
nowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
...
@@ -67,4 +74,11 @@ public class PlatRegionSettingController {
...
@@ -67,4 +74,11 @@ public class PlatRegionSettingController {
return
ApiResponseUtils
.
success
(
vo
);
return
ApiResponseUtils
.
success
(
vo
);
}
}
@ApiOperation
(
"跌倒设备实时定位"
)
@PostMapping
(
"fallDeviceNowDataLocate"
)
public
ApiResponseEntity
<
DeviceInfoContentFall
.
Properties
>
fallDeviceNowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
DeviceInfoContentFall
.
Properties
vo
=
platRegionSettingService
.
fallDeviceNowDataLocate
(
dto
);
return
ApiResponseUtils
.
success
(
vo
);
}
}
}
server-module/src/main/java/com/makeit/module/controller/space/PlatRoomController.java
View file @
c288bcef
...
@@ -48,7 +48,7 @@ public class PlatRoomController {
...
@@ -48,7 +48,7 @@ public class PlatRoomController {
@ApiOperation
(
"详情"
)
@ApiOperation
(
"详情"
)
@PostMapping
(
"view"
)
@PostMapping
(
"view"
)
public
ApiResponseEntity
<
PlatRoomDTO
>
edit
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
public
ApiResponseEntity
<
PlatRoomDTO
>
view
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
PlatRoomDTO
data
=
platRoomService
.
view
(
baseIdDTO
.
getId
());
PlatRoomDTO
data
=
platRoomService
.
view
(
baseIdDTO
.
getId
());
return
ApiResponseUtils
.
success
(
data
);
return
ApiResponseUtils
.
success
(
data
);
}
}
...
...
server-module/src/main/java/com/makeit/module/controller/space/PlatSpaceController.java
View file @
c288bcef
...
@@ -80,10 +80,17 @@ public class PlatSpaceController {
...
@@ -80,10 +80,17 @@ public class PlatSpaceController {
return
ApiResponseUtils
.
success
(
data
);
return
ApiResponseUtils
.
success
(
data
);
}
}
@ApiOperation
(
"树-
无权限-到床位
"
)
@ApiOperation
(
"树-
到床位(已住人床位)
"
)
@PostMapping
(
"listTreeAuthIgnoreByBed"
)
@PostMapping
(
"listTreeAuthIgnoreByBed"
)
public
ApiResponseEntity
<
List
<
PlatSpaceVO
>>
listTreeAuthIgnoreByBed
(
@RequestBody
PlatSpaceQueryDTO
dto
)
{
public
ApiResponseEntity
<
List
<
PlatSpaceVO
>>
listTreeAuthIgnoreByBed
(
@RequestBody
PlatSpaceQueryDTO
dto
)
{
List
<
PlatSpaceVO
>
data
=
spaceService
.
treeByBed
(
dto
);
List
<
PlatSpaceVO
>
data
=
spaceService
.
listBedTree
(
dto
,
true
);
return
ApiResponseUtils
.
success
(
data
);
}
@ApiOperation
(
"树-到床位"
)
@PostMapping
(
"listBedTree"
)
public
ApiResponseEntity
<
List
<
PlatSpaceVO
>>
listBedTreeAuthIgnore
(
@RequestBody
PlatSpaceQueryDTO
dto
)
{
List
<
PlatSpaceVO
>
data
=
spaceService
.
listBedTree
(
dto
,
false
);
return
ApiResponseUtils
.
success
(
data
);
return
ApiResponseUtils
.
success
(
data
);
}
}
...
...
server-module/src/main/java/com/makeit/module/controller/wechat/space/PlatRegionSettingWechatController.java
View file @
c288bcef
...
@@ -6,6 +6,7 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
...
@@ -6,6 +6,7 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import
com.makeit.dto.platform.space.PlatRegionSettingListDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingListDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
...
@@ -61,10 +62,24 @@ public class PlatRegionSettingWechatController {
...
@@ -61,10 +62,24 @@ public class PlatRegionSettingWechatController {
return
ApiResponseUtils
.
success
(
list
);
return
ApiResponseUtils
.
success
(
list
);
}
}
@ApiOperation
(
"跌倒设备定位(时间范围内定位)"
)
@PostMapping
(
"fallDeviceLocate"
)
public
ApiResponseEntity
<
List
<
DeviceInfoContentFall
.
Properties
>>
fallDeviceLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
List
<
DeviceInfoContentFall
.
Properties
>
list
=
platRegionSettingService
.
fallDeviceLocate
(
dto
);
return
ApiResponseUtils
.
success
(
list
);
}
@ApiOperation
(
"实时定位"
)
@ApiOperation
(
"实时定位"
)
@PostMapping
(
"nowDataLocate"
)
@PostMapping
(
"nowDataLocate"
)
public
ApiResponseEntity
<
DeviceInfoContentSpace
.
Properties
>
nowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
public
ApiResponseEntity
<
DeviceInfoContentSpace
.
Properties
>
nowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
DeviceInfoContentSpace
.
Properties
vo
=
platRegionSettingService
.
nowDataLocate
(
dto
);
DeviceInfoContentSpace
.
Properties
vo
=
platRegionSettingService
.
nowDataLocate
(
dto
);
return
ApiResponseUtils
.
success
(
vo
);
return
ApiResponseUtils
.
success
(
vo
);
}
}
@ApiOperation
(
"跌倒设备实时定位"
)
@PostMapping
(
"fallDeviceNowDataLocate"
)
public
ApiResponseEntity
<
DeviceInfoContentFall
.
Properties
>
fallDeviceNowDataLocate
(
@RequestBody
PlatRegionSettingLocateDTO
dto
)
{
DeviceInfoContentFall
.
Properties
vo
=
platRegionSettingService
.
fallDeviceNowDataLocate
(
dto
);
return
ApiResponseUtils
.
success
(
vo
);
}
}
}
server-module/src/main/java/com/makeit/module/controller/wechat/space/PlatRoomWechatController.java
View file @
c288bcef
...
@@ -48,7 +48,7 @@ public class PlatRoomWechatController {
...
@@ -48,7 +48,7 @@ public class PlatRoomWechatController {
@ApiOperation
(
"详情"
)
@ApiOperation
(
"详情"
)
@PostMapping
(
"view"
)
@PostMapping
(
"view"
)
public
ApiResponseEntity
<
PlatRoomDTO
>
edit
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
public
ApiResponseEntity
<
PlatRoomDTO
>
view
(
@RequestBody
BaseIdDTO
baseIdDTO
)
{
PlatRoomDTO
data
=
platRoomService
.
view
(
baseIdDTO
.
getId
());
PlatRoomDTO
data
=
platRoomService
.
view
(
baseIdDTO
.
getId
());
return
ApiResponseUtils
.
success
(
data
);
return
ApiResponseUtils
.
success
(
data
);
}
}
...
...
server-service/src/main/java/com/makeit/dto/platform/space/PlatRegionSettingDTO.java
View file @
c288bcef
...
@@ -43,4 +43,7 @@ public class PlatRegionSettingDTO extends BaseIdDTO {
...
@@ -43,4 +43,7 @@ public class PlatRegionSettingDTO extends BaseIdDTO {
@ApiModelProperty
(
"设备名称"
)
@ApiModelProperty
(
"设备名称"
)
private
String
deviceName
;
private
String
deviceName
;
@ApiModelProperty
(
"0-呼吸心率雷达 1-空间人体雷达 2-跌倒检测雷达"
)
private
String
category
;
}
}
server-service/src/main/java/com/makeit/service/platform/space/PlatRegionSettingService.java
View file @
c288bcef
...
@@ -5,8 +5,8 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
...
@@ -5,8 +5,8 @@ import com.makeit.dto.platform.space.PlatRegionSettingDTO;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingLocateDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.dto.platform.space.PlatRegionSettingQueryDTO
;
import
com.makeit.entity.platform.space.PlatRegionSetting
;
import
com.makeit.entity.platform.space.PlatRegionSetting
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
import
java.util.List
;
import
java.util.List
;
...
@@ -49,4 +49,8 @@ public interface PlatRegionSettingService extends IService<PlatRegionSetting> {
...
@@ -49,4 +49,8 @@ public interface PlatRegionSettingService extends IService<PlatRegionSetting> {
List
<
DeviceInfoContentSpace
.
Properties
>
locate
(
PlatRegionSettingLocateDTO
dto
);
List
<
DeviceInfoContentSpace
.
Properties
>
locate
(
PlatRegionSettingLocateDTO
dto
);
DeviceInfoContentSpace
.
Properties
nowDataLocate
(
PlatRegionSettingLocateDTO
dto
);
DeviceInfoContentSpace
.
Properties
nowDataLocate
(
PlatRegionSettingLocateDTO
dto
);
DeviceInfoContentFall
.
Properties
fallDeviceNowDataLocate
(
PlatRegionSettingLocateDTO
dto
);
List
<
DeviceInfoContentFall
.
Properties
>
fallDeviceLocate
(
PlatRegionSettingLocateDTO
dto
);
}
}
server-service/src/main/java/com/makeit/service/platform/space/PlatSpaceService.java
View file @
c288bcef
...
@@ -80,4 +80,6 @@ public interface PlatSpaceService extends IService<PlatSpace> {
...
@@ -80,4 +80,6 @@ public interface PlatSpaceService extends IService<PlatSpace> {
ExcelImportVo
importSpaceExcel
(
MultipartFile
excelFile
);
ExcelImportVo
importSpaceExcel
(
MultipartFile
excelFile
);
List
<
PlatSpaceVO
>
parentListTree
(
PlatSpaceQueryDTO
dto
);
List
<
PlatSpaceVO
>
parentListTree
(
PlatSpaceQueryDTO
dto
);
List
<
PlatSpaceVO
>
listBedTree
(
PlatSpaceQueryDTO
dto
,
boolean
flag
);
}
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRegionSettingServiceImpl.java
View file @
c288bcef
...
@@ -13,22 +13,21 @@ import com.makeit.enums.platform.device.PlatDeviceEnum;
...
@@ -13,22 +13,21 @@ import com.makeit.enums.platform.device.PlatDeviceEnum;
import
com.makeit.mapper.platform.space.PlatRegionSettingMapper
;
import
com.makeit.mapper.platform.space.PlatRegionSettingMapper
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.vo.DeviceOperationLogEntity
;
import
com.makeit.module.iot.vo.DeviceOperationLogEntity
;
import
com.makeit.module.iot.vo.
breathe.DeviceInfoContentBreathe
;
import
com.makeit.module.iot.vo.
fall.DeviceInfoContentFall
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceOtherService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.service.platform.space.PlatRegionSettingService
;
import
com.makeit.utils.LongTimestampUtil
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.JsonUtil
;
import
com.makeit.utils.data.convert.JsonUtil
;
import
com.makeit.utils.data.validate.CollectionUtils
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
import
jodd.util.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.math.BigDecimal
;
import
java.time.Duration
;
import
java.math.RoundingMode
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -108,14 +107,16 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
...
@@ -108,14 +107,16 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
List
<
String
>
listDeviceIds
=
data
.
stream
().
map
(
item
->
item
.
getDeviceId
()).
collect
(
Collectors
.
toList
());
List
<
String
>
listDeviceIds
=
data
.
stream
().
map
(
item
->
item
.
getDeviceId
()).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
PlatDevice
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PlatDevice
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
queryWrapper1
.
in
(
PlatDevice:
:
getId
,
listDeviceIds
);
queryWrapper1
.
in
(
PlatDevice:
:
getId
,
listDeviceIds
);
queryWrapper1
.
select
(
PlatDevice:
:
getId
,
PlatDevice:
:
getName
,
PlatDevice:
:
getOriDeviceId
);
queryWrapper1
.
select
(
PlatDevice:
:
getId
,
PlatDevice:
:
getName
,
PlatDevice:
:
getOriDeviceId
,
PlatDevice:
:
getCategory
);
List
<
PlatDevice
>
devices
=
platDeviceService
.
list
(
queryWrapper1
);
List
<
PlatDevice
>
devices
=
platDeviceService
.
list
(
queryWrapper1
);
Map
<
String
,
String
>
map
=
devices
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDevice:
:
getId
,
PlatDevice:
:
getName
,(
k1
,
k2
)->
k1
));
Map
<
String
,
String
>
map
=
devices
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDevice:
:
getId
,
PlatDevice:
:
getName
,(
k1
,
k2
)->
k1
));
Map
<
String
,
String
>
oriDeviceIdMap
=
devices
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDevice:
:
getId
,
PlatDevice:
:
getOriDeviceId
,(
k1
,
k2
)->
k1
));
Map
<
String
,
String
>
oriDeviceIdMap
=
devices
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDevice:
:
getId
,
PlatDevice:
:
getOriDeviceId
,(
k1
,
k2
)->
k1
));
Map
<
String
,
String
>
categoryMap
=
devices
.
stream
().
collect
(
Collectors
.
toMap
(
PlatDevice:
:
getId
,
PlatDevice:
:
getCategory
,(
k1
,
k2
)->
k1
));
List
<
String
>
deviceIds
=
devices
.
stream
().
map
(
PlatDevice:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
String
>
deviceIds
=
devices
.
stream
().
map
(
PlatDevice:
:
getId
).
collect
(
Collectors
.
toList
());
data
.
forEach
(
item
->{
data
.
forEach
(
item
->{
item
.
setDeviceName
(
map
.
get
(
item
.
getDeviceId
()));
item
.
setDeviceName
(
map
.
get
(
item
.
getDeviceId
()));
item
.
setOriDeviceId
(
oriDeviceIdMap
.
get
(
item
.
getDeviceId
()));
item
.
setOriDeviceId
(
oriDeviceIdMap
.
get
(
item
.
getDeviceId
()));
item
.
setCategory
(
categoryMap
.
get
(
item
.
getDeviceId
()));
});
});
//过滤删除的设备
//过滤删除的设备
data
=
data
.
stream
().
filter
(
t
->
deviceIds
.
contains
(
t
.
getDeviceId
())).
collect
(
Collectors
.
toList
());
data
=
data
.
stream
().
filter
(
t
->
deviceIds
.
contains
(
t
.
getDeviceId
())).
collect
(
Collectors
.
toList
());
...
@@ -188,4 +189,35 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
...
@@ -188,4 +189,35 @@ public class PlatRegionSettingServiceImpl extends ServiceImpl<PlatRegionSettingM
return
space
.
getProperties
();
return
space
.
getProperties
();
}
}
@Override
public
DeviceInfoContentFall
.
Properties
fallDeviceNowDataLocate
(
PlatRegionSettingLocateDTO
dto
)
{
DeviceOperationLogEntity
deviceOperationLogEntity
=
iotProductDeviceService
.
getLastDeviceLogByType
(
dto
.
getDeviceId
(),
"reportProperty"
);
if
(
deviceOperationLogEntity
==
null
)
{
return
null
;
}
DeviceInfoContentFall
space
=
JsonUtil
.
toObj
((
String
)
deviceOperationLogEntity
.
getContent
(),
DeviceInfoContentFall
.
class
);
LocalDateTime
time
=
LongTimestampUtil
.
toLocalDateTime
(
space
.
getTimestamp
());
if
(
Duration
.
between
(
time
,
LocalDateTime
.
now
()).
getSeconds
()
>
10
)
{
return
null
;
}
return
space
.
getProperties
();
}
@Override
public
List
<
DeviceInfoContentFall
.
Properties
>
fallDeviceLocate
(
PlatRegionSettingLocateDTO
dto
)
{
List
<
DeviceInfoContentFall
.
Properties
>
vos
=
new
ArrayList
<>();
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
DeviceInfoContentFall
>
list
=
iotProductDeviceService
.
getDeviceLogByTimeRangeFall
(
dto
.
getDeviceId
(),
100
,
LocalDateTime
.
parse
(
dto
.
getStartTime
(),
df
),
LocalDateTime
.
parse
(
dto
.
getEndTime
(),
df
));
for
(
DeviceInfoContentFall
log
:
list
){
if
(
log
.
getProperties
()!=
null
&&
log
.
getProperties
().
getPerson
()!=
null
&&
log
.
getProperties
().
getPerson
()>
0
){
vos
.
add
(
log
.
getProperties
());
}
}
return
vos
;
}
}
}
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatRoomServiceImpl.java
View file @
c288bcef
...
@@ -11,14 +11,18 @@ import com.makeit.dto.platform.space.PlatRoomQueryDTO;
...
@@ -11,14 +11,18 @@ import com.makeit.dto.platform.space.PlatRoomQueryDTO;
import
com.makeit.dto.platform.workstation.WorkStationQueryDTO
;
import
com.makeit.dto.platform.workstation.WorkStationQueryDTO
;
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.entity.platform.space.PlatSpace
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CodeMessageEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.mapper.platform.space.PlatRoomMapper
;
import
com.makeit.mapper.platform.space.PlatRoomMapper
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.BeanDtoVoUtils
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.PageUtil
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
com.makeit.utils.sql.join.JoinUtil
;
import
com.makeit.vo.platform.space.PlatSpaceAndRoomVO
;
import
com.makeit.vo.platform.space.PlatSpaceAndRoomVO
;
import
com.makeit.vo.platform.workstation.WorkStationInstitutionRoomVO
;
import
com.makeit.vo.platform.workstation.WorkStationInstitutionRoomVO
;
import
jodd.util.StringUtil
;
import
jodd.util.StringUtil
;
...
@@ -26,7 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -26,7 +30,9 @@ 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.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
/**
/**
* @Author:lzy
* @Author:lzy
...
@@ -38,6 +44,8 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
...
@@ -38,6 +44,8 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
@Autowired
@Autowired
private
PlatBedService
platBedService
;
private
PlatBedService
platBedService
;
@Autowired
private
PlatSpaceService
platSpaceService
;
private
void
checkName
(
PlatRoom
platRoom
){
private
void
checkName
(
PlatRoom
platRoom
){
...
@@ -89,6 +97,12 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
...
@@ -89,6 +97,12 @@ public class PlatRoomServiceImpl extends ServiceImpl<PlatRoomMapper, PlatRoom> i
public
PlatRoomDTO
view
(
String
id
)
{
public
PlatRoomDTO
view
(
String
id
)
{
PlatRoom
room
=
getById
(
id
);
PlatRoom
room
=
getById
(
id
);
PlatRoomDTO
data
=
BeanDtoVoUtils
.
convert
(
room
,
PlatRoomDTO
.
class
);
PlatRoomDTO
data
=
BeanDtoVoUtils
.
convert
(
room
,
PlatRoomDTO
.
class
);
JoinUtil
.
joinSplit
(
Arrays
.
asList
(
data
),
platSpaceService
,
PlatRoomDTO:
:
getSpacePath
,
PlatSpace:
:
getId
,
(
e
,
l
)
->
{
e
.
setSpacePathName
(
StreamUtil
.
join
(
l
,
Objects:
:
nonNull
,
PlatSpace:
:
getName
,
"-"
));
});
if
(
StringUtil
.
isNotEmpty
(
data
.
getSpacePathName
())){
data
.
setSpacePathName
(
data
.
getSpacePathName
()
+
"-"
+
data
.
getName
());
}
return
data
;
return
data
;
}
}
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
c288bcef
...
@@ -34,10 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -34,10 +34,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.BiConsumer
;
import
java.util.function.BiConsumer
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -566,6 +563,76 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
...
@@ -566,6 +563,76 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
return
data
;
return
data
;
}
}
@Override
public
List
<
PlatSpaceVO
>
listBedTree
(
PlatSpaceQueryDTO
dto
,
boolean
flag
)
{
List
<
PlatOrg
>
platOrgs
=
platOrgService
.
belongToScopeList
(
new
PlatOrg
());
if
(
platOrgs
.
isEmpty
()){
return
new
ArrayList
<>();
}
List
<
String
>
orgIds
=
platOrgs
.
stream
().
map
(
PlatOrg:
:
getId
).
collect
(
Collectors
.
toList
());
//床位
LambdaQueryWrapper
<
PlatBed
>
queryWrapper1
=
new
LambdaQueryWrapper
<>();
if
(
flag
){
queryWrapper1
.
eq
(
PlatBed:
:
getStatus
,
CommonEnum
.
YES
.
getValue
());
}
List
<
PlatBed
>
listBeds
=
platBedService
.
list
(
queryWrapper1
);
if
(
listBeds
.
isEmpty
()){
return
new
ArrayList
<>();
}
List
<
String
>
roomIds
=
listBeds
.
stream
().
map
(
PlatBed:
:
getRoomId
).
collect
(
Collectors
.
toList
());
List
<
PlatRoom
>
listRoom
=
platRoomService
.
list
(
new
QueryWrapper
<
PlatRoom
>().
lambda
()
.
in
(
PlatRoom:
:
getId
,
roomIds
));
List
<
String
>
spaceIds
=
listRoom
.
stream
().
map
(
PlatRoom:
:
getSpacePath
).
collect
(
Collectors
.
toList
());
Set
<
String
>
spaceIdList
=
new
HashSet
<>();
for
(
String
spaceId
:
spaceIds
){
spaceIdList
.
addAll
(
Arrays
.
asList
(
spaceId
.
split
(
","
)));
}
spaceIdList
.
add
(
"-1"
);
List
<
PlatSpaceVO
>
listRoomVo
=
new
ArrayList
<>();
listRoom
.
forEach
(
item
->
{
PlatSpaceVO
vo
=
new
PlatSpaceVO
();
vo
.
setId
(
item
.
getId
());
vo
.
setName
(
item
.
getName
());
vo
.
setParentId
(
item
.
getSpaceId
());
listRoomVo
.
add
(
vo
);
});
listBeds
.
forEach
(
item
->
{
PlatSpaceVO
vo
=
new
PlatSpaceVO
();
vo
.
setId
(
item
.
getId
());
vo
.
setName
(
item
.
getName
());
vo
.
setParentId
(
item
.
getRoomId
());
listRoomVo
.
add
(
vo
);
});
LambdaQueryWrapper
<
PlatSpace
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
like
(
StringUtil
.
isNotEmpty
(
dto
.
getName
()),
PlatSpace:
:
getName
,
dto
.
getName
());
queryWrapper
.
in
(
PlatSpace:
:
getId
,
spaceIdList
);
queryWrapper
.
in
(
PlatSpace:
:
getOrgId
,
orgIds
);
List
<
PlatSpace
>
list
=
this
.
list
(
queryWrapper
);
List
<
PlatSpaceVO
>
listSpaceVo
=
BeanDtoVoUtils
.
listVo
(
list
,
PlatSpaceVO
.
class
);
listSpaceVo
.
addAll
(
listRoomVo
);
//父级
List
<
PlatSpaceVO
>
listParent
=
listSpaceVo
.
stream
().
filter
(
item
->
StringUtil
.
isEmpty
(
item
.
getParentId
())).
collect
(
Collectors
.
toList
());
//子集
List
<
PlatSpaceVO
>
listChild
=
listSpaceVo
.
stream
().
filter
(
item
->
item
.
getParentId
()
!=
null
).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
PlatSpaceVO
>>
map
=
listChild
.
stream
().
collect
(
Collectors
.
groupingBy
(
PlatSpaceVO:
:
getParentId
));
List
<
PlatSpaceVO
>
data
=
new
ArrayList
<>();
for
(
PlatSpaceVO
space
:
listParent
)
{
space
=
childVo
(
space
,
map
);
data
.
add
(
space
);
}
return
data
;
}
}
}
...
...
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