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
aa3ee3fa
authored
Feb 26, 2024
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 平台端小程序居家统计设备列表
parent
a8f3504a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
0 deletions
server-service/src/main/java/com/makeit/service/wechat/impl/PlatElderCenterWechatServiceImpl.java
server-service/src/main/java/com/makeit/service/wechat/impl/PlatElderCenterWechatServiceImpl.java
View file @
aa3ee3fa
package
com
.
makeit
.
service
.
wechat
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.common.collect.Lists
;
import
com.makeit.common.entity.BaseEntity
;
import
com.makeit.dto.platform.elder.PlatElderIdDTO
;
import
com.makeit.dto.platform.workstation.WorkStationQueryDTO
;
import
com.makeit.dto.wechat.elder.PlatElderCenterQueryDTO
;
import
com.makeit.entity.platform.alarm.PlatAlarmConfig
;
import
com.makeit.entity.platform.alarm.PlatAlarmRecord
;
import
com.makeit.entity.platform.device.PlatDevice
;
import
com.makeit.entity.platform.elder.PlatElder
;
import
com.makeit.entity.platform.space.PlatRoomBedDevice
;
import
com.makeit.entity.platform.space.PlatSpace
;
import
com.makeit.entity.saas.analysis.SaasModelManage
;
import
com.makeit.entity.saas.analysis.SaasSleepAnalysisModel
;
...
...
@@ -16,10 +20,12 @@ import com.makeit.enums.saas.ModelManageTypeEnum;
import
com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum
;
import
com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe
;
import
com.makeit.service.platform.alarm.PlatAlarmRecordService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.elder.PlatElderDayReportDayService
;
import
com.makeit.service.platform.elder.PlatElderRealTimeService
;
import
com.makeit.service.platform.elder.PlatElderService
;
import
com.makeit.service.platform.space.PlatBedService
;
import
com.makeit.service.platform.space.PlatRoomBedDeviceService
;
import
com.makeit.service.platform.space.PlatRoomService
;
import
com.makeit.service.platform.space.PlatSpaceService
;
import
com.makeit.service.platform.workstation.WorkStationService
;
...
...
@@ -27,6 +33,7 @@ import com.makeit.service.saas.SaasModelManageService;
import
com.makeit.service.saas.SaasSleepAnalysisModelService
;
import
com.makeit.service.wechat.PlatElderCenterWechatService
;
import
com.makeit.utils.data.convert.StreamUtil
;
import
com.makeit.utils.data.validate.CollectionUtils
;
import
com.makeit.utils.old.StringUtils
;
import
com.makeit.utils.sql.join.JoinUtil
;
import
com.makeit.vo.platform.elder.realtime.PlatElderCoordinateVO
;
...
...
@@ -74,6 +81,10 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
private
SaasSleepAnalysisModelService
saasSleepAnalysisModelService
;
@Autowired
private
PlatElderDayReportDayService
platElderDayReportDayService
;
@Autowired
private
PlatRoomBedDeviceService
platRoomBedDeviceService
;
@Autowired
private
PlatDeviceService
platDeviceService
;
@Override
public
PlatElderCenterHomeVo
homeStatistics
(
PlatElderCenterQueryDTO
dto
)
{
...
...
@@ -106,13 +117,37 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
queryDTO
.
setSpaceIds
(
spaceIds
);
// queryDTO.setElderIds(elderIds);
List
<
WorkStationHomeBedVO
>
list
=
platBedService
.
selectByCondition
(
queryDTO
);
List
<
String
>
roomIds
=
list
.
stream
().
map
(
WorkStationHomeBedVO:
:
getRoomId
).
collect
(
Collectors
.
toList
());
JoinUtil
.
joinSplit
(
list
,
platSpaceService
,
WorkStationHomeBedVO:
:
getSpacePath
,
PlatSpace:
:
getId
,
(
e
,
l
)
->
{
e
.
setPathName
(
StreamUtil
.
join
(
l
,
Objects:
:
nonNull
,
PlatSpace:
:
getName
,
"-"
));
});
List
<
PlatRoomBedDevice
>
platRoomDevices
=
platRoomBedDeviceService
.
list
(
new
QueryWrapper
<
PlatRoomBedDevice
>().
lambda
()
.
in
(
PlatRoomBedDevice:
:
getRoomId
,
roomIds
)
.
isNull
(
PlatRoomBedDevice:
:
getBedId
));
List
<
PlatRoomBedDevice
>
platBedDevices
=
platRoomBedDeviceService
.
list
(
new
QueryWrapper
<
PlatRoomBedDevice
>().
lambda
()
.
in
(
PlatRoomBedDevice:
:
getRoomId
,
roomIds
)
.
isNotNull
(
PlatRoomBedDevice:
:
getBedId
));
Map
<
String
,
List
<
PlatRoomBedDevice
>>
roomDeviceMap
=
StreamUtil
.
groupBy
(
platRoomDevices
,
PlatRoomBedDevice:
:
getRoomId
);
Map
<
String
,
PlatRoomBedDevice
>
bedDeviceMap
=
StreamUtil
.
toMap
(
platBedDevices
,
PlatRoomBedDevice:
:
getBedId
);
List
<
PlatDevice
>
platDeviceList
=
platDeviceService
.
list
();
Map
<
String
,
PlatDevice
>
deviceMap
=
StreamUtil
.
toMap
(
platDeviceList
,
BaseEntity:
:
getId
);
for
(
WorkStationHomeBedVO
vo
:
list
){
vo
.
setPathName
(
vo
.
getPathName
()
+
"-"
+
vo
.
getRoomName
());
List
<
PlatDevice
>
deviceList
=
Lists
.
newArrayList
();
List
<
PlatRoomBedDevice
>
platRoomBedDevices
=
roomDeviceMap
.
get
(
vo
.
getRoomId
());
if
(
CollectionUtils
.
isNotEmpty
(
platRoomBedDevices
))
{
List
<
String
>
tempDeviceIdList
=
StreamUtil
.
map
(
platRoomBedDevices
,
PlatRoomBedDevice:
:
getDeviceId
);
for
(
String
s
:
tempDeviceIdList
)
{
PlatDevice
platDevice
=
deviceMap
.
get
(
s
);
if
(
platDevice
!=
null
)
{
deviceList
.
add
(
platDevice
);
}
}
}
if
(
StringUtil
.
isNotEmpty
(
vo
.
getElderId
())
)
{
if
(
elderAlarmTypeMap
.
containsKey
(
vo
.
getElderId
())){
vo
.
setAlarmTypeMap
(
elderAlarmTypeMap
.
get
(
vo
.
getElderId
()));
...
...
@@ -125,6 +160,15 @@ public class PlatElderCenterWechatServiceImpl implements PlatElderCenterWechatSe
vo
.
setElderStatus
(
realTimeNowVO
.
getStatus
());
vo
.
setHeartRate
(
heartRespiratoryVO
.
getHeartRate
());
vo
.
setRespiratoryRate
(
heartRespiratoryVO
.
getRespiratoryRate
());
PlatRoomBedDevice
platRoomBedDevice
=
bedDeviceMap
.
get
(
vo
.
getBedId
());
if
(
platRoomBedDevice
!=
null
)
{
PlatDevice
platDevice
=
deviceMap
.
get
(
platRoomBedDevice
.
getDeviceId
());
if
(
platDevice
!=
null
)
{
deviceList
.
add
(
platDevice
);
}
}
vo
.
setDeviceList
(
deviceList
);
}
}
homeVo
.
setElderNumber
(
elders
.
size
());
...
...
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