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
8f777483
authored
Oct 27, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:呼吸心率
parent
d1910d0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
21 deletions
server-common/src/main/java/com/makeit/module/iot/service/IotProductDeviceService.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderServiceImpl.java
server-common/src/main/java/com/makeit/module/iot/service/IotProductDeviceService.java
View file @
8f777483
...
...
@@ -14,6 +14,7 @@ import com.makeit.module.iot.vo.DeviceInstanceEntity;
import
com.makeit.module.iot.vo.DeviceOperationLogEntity
;
import
com.makeit.module.iot.vo.IotPagerResult
;
import
com.makeit.module.iot.vo.ResponseMessage
;
import
com.makeit.module.iot.vo.analysis.AnalysisVO
;
import
com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
import
com.makeit.module.iot.vo.space.DeviceInfoContentSpace
;
...
...
@@ -32,6 +33,8 @@ import java.time.*;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.stream.Collectors
;
/**
* iot产品设备相关接口
...
...
@@ -190,12 +193,53 @@ public class IotProductDeviceService extends IotCommonService {
public
List
<
DeviceInfoContentBreathe
>
getDeviceLogByTimeRangeBreathe
(
String
deviceId
,
int
pageSize
,
LocalDateTime
startTime
,
LocalDateTime
endTime
)
{
List
<
String
>
lastDayHourRange
=
getLastDayHourRange
(
startTime
);
List
<
DeviceInfoContentBreathe
>
tempList
=
Lists
.
newArrayList
();
for
(
String
hour
:
lastDayHourRange
)
{
String
[]
hourRangeArray
=
hour
.
split
(
"~"
);
List
<
DeviceOperationLogEntity
>
deviceOperationLogEntities
=
getDeviceLogByTimeRange
(
deviceId
,
REPORT_PROPERTY
,
5000
,
hourRangeArray
[
0
],
hourRangeArray
[
1
]);
List
<
DeviceInfoContentBreathe
>
deviceInfoContentBreatheList
=
StreamUtil
.
map
(
deviceOperationLogEntities
,
e
->
JsonUtil
.
toObj
((
String
)
e
.
getContent
(),
DeviceInfoContentBreathe
.
class
));
List
<
DeviceInfoContentBreathe
>
deviceInfoContentBreatheList
=
deviceOperationLogEntities
.
stream
()
.
filter
(
deviceOperationLogEntity
->
deviceOperationLogEntity
.
getType
().
contains
(
"reportProperty"
))
.
map
(
deviceOperationLogEntity
->
{
DeviceInfoContentBreathe
deviceInfoContentBreathe
=
JsonUtil
.
toObj
((
String
)
deviceOperationLogEntity
.
getContent
(),
DeviceInfoContentBreathe
.
class
);
deviceInfoContentBreathe
.
setReportTime
(
formatLongTime
(
deviceInfoContentBreathe
.
getTimestamp
()));
return
deviceInfoContentBreathe
;
})
.
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
DeviceInfoContentBreathe
>>
minuteMap
=
StreamUtil
.
groupBy
(
deviceInfoContentBreatheList
,
DeviceInfoContentBreathe:
:
getReportTime
);
List
<
DeviceInfoContentBreathe
>
deviceInfoContentBreathes
;
DeviceInfoContentBreathe
temp
;
DeviceInfoContentBreathe
.
Properties
tempProperties
;
for
(
Map
.
Entry
<
String
,
List
<
DeviceInfoContentBreathe
>>
entry
:
minuteMap
.
entrySet
())
{
deviceInfoContentBreathes
=
entry
.
getValue
();
DeviceInfoContentBreathe
.
Properties
breatheProperties
;
Integer
bodymove
=
0
;
int
br
=
0
;
int
hr
=
0
;
long
timestamp
=
0
;
for
(
DeviceInfoContentBreathe
deviceInfoContentBreathe
:
deviceInfoContentBreathes
)
{
breatheProperties
=
deviceInfoContentBreathe
.
getProperties
();
hr
+=
breatheProperties
.
getHr
();
br
+=
breatheProperties
.
getBr
();
bodymove
+=
breatheProperties
.
getBodymove
();
timestamp
=
deviceInfoContentBreathe
.
getTimestamp
();
}
temp
=
new
DeviceInfoContentBreathe
();
tempProperties
=
new
DeviceInfoContentBreathe
.
Properties
();
tempProperties
.
setHr
(
hr
/
60
);
tempProperties
.
setBr
(
br
/
60
);
tempProperties
.
setBodymove
(
bodymove
/
60
);
temp
.
setTimestamp
(
timestamp
);
temp
.
setProperties
(
tempProperties
);
tempList
.
add
(
temp
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
tempList
))
{
return
tempList
;
}
long
minute
=
1440
;
return
Lists
.
newArrayList
();
/* long minute = 1440;
List<DeviceInfoContentBreathe> breatheList = Lists.newArrayList();
DeviceInfoContentBreathe deviceInfoContentBreathe;
for (long i = 1; i <= minute; i++) {
...
...
@@ -214,25 +258,7 @@ public class IotProductDeviceService extends IotCommonService {
breatheList.add(deviceInfoContentBreathe);
}
/*
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
List<DeviceOperationLogEntity> deviceOperationLogEntityList = getDeviceLogByTimeRange(deviceId, REPORT_PROPERTY, pageSize, dateTimeFormatter.format(startTime), dateTimeFormatter.format(endTime));
List<DeviceInfoContentBreathe> deviceInfoContentBreatheList = deviceOperationLogEntityList.stream()
.filter(deviceOperationLogEntity -> deviceOperationLogEntity.getType().contains(REPORT_PROPERTY))
.map(deviceOperationLogEntity -> {
DeviceInfoContentBreathe deviceInfoContentBreathe = JsonUtil.toObj((String) deviceOperationLogEntity.getContent(), DeviceInfoContentBreathe.class);
deviceInfoContentBreathe.setReportTime(formatLongTime(deviceInfoContentBreathe.getTimestamp()));
return deviceInfoContentBreathe;
})
.collect(Collectors.toList());
Map<String, List<DeviceInfoContentBreathe>> minuteMap = StreamUtil.groupBy(deviceInfoContentBreatheList, DeviceInfoContentBreathe::getReportTime);
for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) {
}*/
return
breatheList
;
return breatheList;*/
}
public
static
void
main
(
String
[]
args
)
{
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderServiceImpl.java
View file @
8f777483
...
...
@@ -133,6 +133,7 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
return
new
QueryWrapper
<
PlatElder
>().
lambda
()
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getName
()),
PlatElder:
:
getName
,
dto
.
getName
())
.
like
(
StringUtils
.
isNotBlank
(
dto
.
getPhone
()),
PlatElder:
:
getPhone
,
dto
.
getPhone
())
.
eq
(
StringUtils
.
isNotBlank
(
dto
.
getCertificateType
()),
PlatElder:
:
getCertificateType
,
dto
.
getCertificateType
())
.
isNotNull
(
dto
.
getCheckInFlag
()
!=
null
&&
dto
.
getCheckInFlag
()
==
1
,
PlatElder:
:
getBedId
)
.
isNull
(
dto
.
getCheckInFlag
()
!=
null
&&
dto
.
getCheckInFlag
()
==
0
,
PlatElder:
:
getBedId
)
...
...
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