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
c77769cd
authored
Dec 07, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 接口新增license标识
parent
70a867dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
171 deletions
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDTO.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-service/src/main/java/com/makeit/vo/platform/elder/realtime/PlatElderCoordinateVO.java
server-service/src/main/java/com/makeit/dto/platform/device/PlatDeviceDTO.java
View file @
c77769cd
...
...
@@ -39,5 +39,12 @@ public class PlatDeviceDTO {
@ApiModelProperty
(
value
=
"设备类型 0-呼吸心率雷达 1-空间人体雷达 2-跌倒检测雷达"
)
private
String
category
;
@ApiModelProperty
(
value
=
"许可证"
)
private
String
deviceLicense
;
@ApiModelProperty
(
value
=
"许可证信息"
)
private
String
licenseInfo
;
@ApiModelProperty
(
value
=
"过期时间"
)
private
Long
expireTime
;
@ApiModelProperty
(
value
=
"激活时间"
)
private
Long
activationTime
;
}
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
c77769cd
...
...
@@ -202,120 +202,6 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
private
void
nowStatusOut
(
PlatElderRealTimeNowVO
platElderRealTimeNowVO
,
PlatElderIdDTO
platElderIdDTO
)
{
List
<
DeviceInfoContentSpace
>
deviceInfoContentSpaceList
=
getNowDataSpace
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
List
<
DeviceInfoContentFall
>
deviceInfoContentFallList
=
getNowDataFall
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
if
(
CollectionUtils
.
isEmpty
(
deviceInfoContentSpaceList
)
&&
CollectionUtils
.
isEmpty
(
deviceInfoContentFallList
))
{
return
;
}
// if (StreamUtil.allMatch(deviceInfoContentSpaceList, e -> DeviceInfoContentSpaceEnum.PersonStateEnum.NOBODY.getValue().equals(e.getProperties().getPersonState()))) {
// platElderRealTimeNowVO.setStatus(PlatElderRealtimeReportEnum.NowStatus.OUT.getValue());
// }
Boolean
spaceFlag
=
null
;
Boolean
fallFlag
=
null
;
if
(
CollectionUtils
.
isNotEmpty
(
deviceInfoContentSpaceList
))
{
spaceFlag
=
StreamUtil
.
allMatch
(
deviceInfoContentSpaceList
,
e
->
DeviceInfoContentSpaceEnum
.
PersonStateEnum
.
NOBODY
.
getValue
().
equals
(
e
.
getProperties
().
getPersonState
()));
}
if
(
CollectionUtils
.
isNotEmpty
(
deviceInfoContentFallList
))
{
fallFlag
=
StreamUtil
.
allMatch
(
deviceInfoContentFallList
,
e
->
DeviceInfoContentFallEnum
.
PersonStateEnum
.
NOBODY
.
getValue
().
equals
(
e
.
getProperties
().
getPersonState
()));
}
List
<
Boolean
>
flagList
=
Stream
.
of
(
spaceFlag
,
fallFlag
).
filter
(
Objects:
:
nonNull
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
flagList
)
&&
StreamUtil
.
allMatch
(
flagList
,
Boolean
.
TRUE
::
equals
))
{
platElderRealTimeNowVO
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
OUT
.
getValue
());
}
}
private
void
nowStatusRun
(
PlatElderRealTimeNowVO
platElderRealTimeNowVO
,
PlatElderIdDTO
platElderIdDTO
,
DeviceInfoContentBreathe
nowDataBreathe
,
List
<
PlatElderCoordinateVO
>
coordinateList
)
{
if
(
nowDataBreathe
==
null
)
{
return
;
}
boolean
flag
=
DeviceInfoContentBreatheEnum
.
PersonStateEnum
.
NOBODY
.
getValue
().
equals
(
nowDataBreathe
.
getProperties
().
getPersonState
()
+
""
);
if
(!
flag
)
{
return
;
}
if
(
CollectionUtils
.
isNotEmpty
(
coordinateList
))
{
Double
[]
doubleArr
=
coordinateList
.
stream
().
map
(
e
->
e
.
getDistance
().
doubleValue
()).
toArray
(
Double
[]::
new
);
double
v
=
StandardDeviationUtil
.
variance
(
doubleArr
);
if
(
new
BigDecimal
(
v
+
""
).
compareTo
(
new
BigDecimal
(
2
))
>
0
)
{
platElderRealTimeNowVO
.
setStatus
((
PlatElderRealtimeReportEnum
.
NowStatus
.
RUN
.
getValue
()));
}
}
}
private
void
nowStatusRest
(
PlatElderRealTimeNowVO
platElderRealTimeNowVO
,
PlatElderIdDTO
platElderIdDTO
,
DeviceInfoContentBreathe
nowDataBreathe
,
List
<
PlatElderCoordinateVO
>
coordinateList
)
{
if
(
nowDataBreathe
==
null
)
{
return
;
}
boolean
flag
=
DeviceInfoContentBreatheEnum
.
PersonStateEnum
.
NOBODY
.
getValue
().
equals
(
nowDataBreathe
.
getProperties
().
getPersonState
()
+
""
);
if
(!
flag
)
{
return
;
}
if
(
CollectionUtils
.
isNotEmpty
(
coordinateList
))
{
double
v
=
StandardDeviationUtil
.
average
(
StreamUtil
.
map
(
coordinateList
,
e
->
e
.
getDistance
().
doubleValue
()));
if
(
new
BigDecimal
(
v
+
""
).
compareTo
(
new
BigDecimal
(
2
))
<=
0
)
{
platElderRealTimeNowVO
.
setStatus
((
PlatElderRealtimeReportEnum
.
NowStatus
.
RUN
.
getValue
()));
}
}
}
private
void
nowStatusSleepAndBed
(
PlatElderRealTimeNowVO
platElderRealTimeNowVO
,
PlatElderIdDTO
platElderIdDTO
,
DeviceInfoContentBreathe
nowDataBreathe
)
{
if
(
nowDataBreathe
==
null
)
{
return
;
}
boolean
flag
=
!
DeviceInfoContentBreatheEnum
.
PersonStateEnum
.
NOBODY
.
getValue
().
equals
(
nowDataBreathe
.
getProperties
().
getPersonState
()
+
""
);
if
(!
flag
)
{
return
;
}
SaasSleepAnalysisModel
analysisModel
=
saasSleepAnalysisModelService
.
getOne
(
new
QueryWrapper
<
SaasSleepAnalysisModel
>().
lambda
()
.
orderByDesc
(
BaseEntity:
:
getCreateBy
)
.
last
(
"limit 1"
));
if
(
analysisModel
==
null
)
{
return
;
}
BigDecimal
sleepTimeActionDuration
=
new
BigDecimal
(
analysisModel
.
getSleepTimeActionDuration
()
+
""
);
BigDecimal
sleepTimeActionThreshold
=
new
BigDecimal
(
analysisModel
.
getSleepTimeActionThreshold
()
+
""
);
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
start
=
now
.
minusMinutes
(
sleepTimeActionDuration
.
multiply
(
new
BigDecimal
(
60
).
setScale
(
0
,
RoundingMode
.
HALF_UP
)).
intValue
());
PlatDevice
platDevice
=
getBreathDevice
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
List
<
DeviceInfoContentBreathe
>
breatheList
=
iotProductDeviceService
.
getDeviceLogByTimeRangeBreathe
(
platDevice
.
getOriDeviceId
(),
2
*
24
*
3600
,
start
,
now
);
if
(
CollectionUtils
.
isNotEmpty
(
breatheList
))
{
if
(
StreamUtil
.
allMatch
(
breatheList
,
e
->
new
BigDecimal
(
e
.
getProperties
().
getBodymove
()).
compareTo
(
sleepTimeActionThreshold
)
<=
0
))
{
platElderRealTimeNowVO
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
SLEEP
.
getValue
());
}
}
platElderRealTimeNowVO
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
BED
.
getValue
());
}
@Override
public
PlatElderRealTimeNowVO
nowStatus
(
PlatElderIdDTO
platElderIdDTO
)
{
...
...
@@ -425,10 +311,11 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
vo
.
setX
(
CollectionUtils
.
isNotEmpty
(
list
)
?
new
BigDecimal
(
list
.
get
(
1
))
:
BigDecimal
.
ZERO
);
vo
.
setY
(
CollectionUtils
.
isNotEmpty
(
list
)
?
new
BigDecimal
(
list
.
get
(
2
)):
BigDecimal
.
ZERO
);
vo
.
setPersonState
(
Integer
.
valueOf
(
result
.
getString
(
"personState"
)));
vo
.
setPerson
(
Integer
.
valueOf
(
result
.
getString
(
"person"
)));
return
vo
;
}).
collect
(
Collectors
.
toList
());
boolean
noPersonFlag
=
voList
.
stream
().
allMatch
(
e
->
e
.
getPerson
State
()
==
0
);
boolean
noPersonFlag
=
voList
.
stream
().
allMatch
(
e
->
e
.
getPerson
()
==
0
);
if
(
noPersonFlag
)
{
log
.
info
(
"当前属于外出:"
+
platElderIdDTO
.
getElderId
());
platElderRealTimeNowVO
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
OUT
.
getValue
());
...
...
@@ -457,6 +344,11 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
return
platElderRealTimeNowVO
;
}
public
static
void
main
(
String
[]
args
)
{
boolean
b
=
new
BigDecimal
(
5
).
compareTo
(
new
BigDecimal
(
2
))
>
0
;
System
.
out
.
println
(
b
);
}
private
Long
getSleepTimeActionDuration
()
{
String
sleepTimeActionDuration
=
""
;
String
result
=
redisTemplate
.
opsForValue
().
get
(
SLEEP_ANALYSIS_KEY
);
...
...
@@ -510,70 +402,15 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
vo
.
setHeartRate
(
0
);
vo
.
setRespiratoryRate
(
0
);
vo
.
setBody
(
0
);
vo
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
RUN
.
getValue
());
}
else
{
vo
.
setHeartRate
(
Integer
.
valueOf
(
jsonObject
.
getString
(
"hr"
)));
vo
.
setRespiratoryRate
(
Integer
.
valueOf
(
jsonObject
.
getString
(
"br"
)));
vo
.
setBody
(
Integer
.
valueOf
(
jsonObject
.
getString
(
"bodymove"
)));
vo
.
setStatus
(
PlatElderRealtimeReportEnum
.
NowStatus
.
BED
.
getValue
());
}
}
return
vo
;
}
return
vo
;
/* DeviceInfoContentBreathe deviceInfoContentBreathe = getNowDataBreathe(platElderIdDTO.getElderId(), platElderIdDTO.getDeviceId());
if (deviceInfoContentBreathe == null) {
return vo;
}
int heartRate = deviceInfoContentBreathe.getProperties().getHr();
int respiratoryRate = deviceInfoContentBreathe.getProperties().getBr();
int body = deviceInfoContentBreathe.getProperties().getBodymove();
int person = deviceInfoContentBreathe.getProperties().getPerson();
if (heartRate == 0) {
vo.setHeartRate(0);
} else {
int hrRange = RandomUtils.nextInt(1, 11) - 5;
vo.setHeartRate(Math.max(heartRate + hrRange,0));
}
if (respiratoryRate == 0) {
vo.setRespiratoryRate(0);
} else {
int brRange = RandomUtils.nextInt(1, 7) - 3;
vo.setRespiratoryRate(Math.max(respiratoryRate + brRange,0));
}
if (body == 0) {
vo.setBody(body);
} else {
int hrRange = RandomUtils.nextInt(1, 11) - 5;
vo.setBody(Math.max(body + hrRange,0));
}
vo.setStatus(person == 1 ? PlatElderRealtimeReportEnum.NowStatus.BED.getValue() : PlatElderRealtimeReportEnum.NowStatus.RUN.getValue());
return vo;*/
/* String brResult = redisTemplate.opsForList().rightPop(ELDER_BR_HR + platElderIdDTO.getElderId());
if (brResult != null) {
return JSON.parseObject(brResult,PlatElderRealTimeHeartRespiratoryVO.class);
}
if (deviceInfoContentBreathe == null) {
return new PlatElderRealTimeHeartRespiratoryVO();
}
int count = 10;
for (int i = 0; i < count; i++) {
}
redisTemplate.opsForList().leftPush(ELDER_BR_HR + platElderIdDTO.getElderId(),JSON.toJSONString(platElderRealTimeHeartRespiratoryVO));
}
return JSON.parseObject(redisTemplate.opsForList().rightPop(ELDER_BR_HR + platElderIdDTO.getElderId()),PlatElderRealTimeHeartRespiratoryVO.class);*/
/*
PlatElderRealTimeHeartRespiratoryVO platElderRealTimeHeartRespiratoryVO = new PlatElderRealTimeHeartRespiratoryVO();
platElderRealTimeHeartRespiratoryVO.setTime(LocalDateTime.now());
platElderRealTimeHeartRespiratoryVO.setHeartRate(deviceInfoContentBreathe.getProperties().getHr());
platElderRealTimeHeartRespiratoryVO.setRespiratoryRate(deviceInfoContentBreathe.getProperties().getBr());*/
//return platElderRealTimeHeartRespiratoryVO;
}
@Override
...
...
server-service/src/main/java/com/makeit/vo/platform/elder/realtime/PlatElderCoordinateVO.java
View file @
c77769cd
...
...
@@ -19,6 +19,8 @@ public class PlatElderCoordinateVO {
private
Integer
distance
;
@ApiModelProperty
(
"空间人感:0表示无人,1表示活动, 2表示微动 ,3表示静止 ,跌倒设备:0无人,1跌倒"
)
private
Integer
personState
;
@ApiModelProperty
(
"跌倒设备:0无人,1跌倒"
)
private
Integer
person
;
@ApiModelProperty
(
"1 表示空间, 2 表示跌倒"
)
private
Integer
type
;
...
...
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