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
b1d2260a
authored
Oct 10, 2023
by
朱淼
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'dev' of
http://git.xmmakeit.com/huangjiay/iot-platform-server
into dev
parents
a8912075
6b0cf2fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
36 deletions
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderServiceImpl.java
server-service/src/main/java/com/makeit/task/IotSyncTask.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.java
View file @
b1d2260a
...
@@ -10,6 +10,7 @@ import com.makeit.enums.platform.elder.PlatElderRealtimeReportEnum;
...
@@ -10,6 +10,7 @@ import com.makeit.enums.platform.elder.PlatElderRealtimeReportEnum;
import
com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum
;
import
com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum
;
import
com.makeit.module.iot.enums.DeviceInfoContentFallEnum
;
import
com.makeit.module.iot.enums.DeviceInfoContentFallEnum
;
import
com.makeit.module.iot.enums.DeviceInfoContentSpaceEnum
;
import
com.makeit.module.iot.enums.DeviceInfoContentSpaceEnum
;
import
com.makeit.module.iot.enums.DeviceState
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.service.IotProductDeviceService
;
import
com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe
;
import
com.makeit.module.iot.vo.breathe.DeviceInfoContentBreathe
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
...
@@ -131,6 +132,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -131,6 +132,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
if
(
platDevice
==
null
)
{
if
(
platDevice
==
null
)
{
return
null
;
return
null
;
}
}
if
(!
platDevice
.
getStatus
().
equals
(
DeviceState
.
online
.
getValue
()))
{
return
null
;
}
DeviceInfoContentBreathe
deviceInfoContentBreathe
=
iotProductDeviceService
.
getLastDeviceLogBreathe
(
platDevice
.
getOriDeviceId
(),
10
);
DeviceInfoContentBreathe
deviceInfoContentBreathe
=
iotProductDeviceService
.
getLastDeviceLogBreathe
(
platDevice
.
getOriDeviceId
(),
10
);
...
@@ -341,10 +345,19 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -341,10 +345,19 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
heartRate
);
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
heartRate
);
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
respiratoryRate
);
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
respiratoryRate
);
}
else
{
}
else
{
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
if
(
heartRate
==
0
)
{
int
brRange
=
RandomUtils
.
nextInt
(
1
,
7
)
-
3
;
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
0
);
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
heartRate
+
hrRange
);
}
else
{
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
respiratoryRate
+
brRange
);
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
Math
.
max
(
heartRate
+
hrRange
,
0
));
}
if
(
respiratoryRate
==
0
)
{
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
0
);
}
else
{
int
brRange
=
RandomUtils
.
nextInt
(
1
,
7
)
-
3
;
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
Math
.
max
(
respiratoryRate
+
brRange
,
0
));
}
}
}
redisTemplate
.
opsForList
().
leftPush
(
ELDER_BR_HR
+
platElderIdDTO
.
getElderId
(),
JSON
.
toJSONString
(
platElderRealTimeHeartRespiratoryVO
));
redisTemplate
.
opsForList
().
leftPush
(
ELDER_BR_HR
+
platElderIdDTO
.
getElderId
(),
JSON
.
toJSONString
(
platElderRealTimeHeartRespiratoryVO
));
}
}
...
@@ -380,8 +393,13 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -380,8 +393,13 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
if
(
i
==
0
)
{
if
(
i
==
0
)
{
platElderRealTimeBodyVO
.
setBodyMovementIndex
(
body
);
platElderRealTimeBodyVO
.
setBodyMovementIndex
(
body
);
}
else
{
}
else
{
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
if
(
body
==
0
)
{
platElderRealTimeBodyVO
.
setBodyMovementIndex
(
Math
.
max
(
body
+
hrRange
,
0
));
platElderRealTimeBodyVO
.
setBodyMovementIndex
(
0
);
}
else
{
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
platElderRealTimeBodyVO
.
setBodyMovementIndex
(
Math
.
max
(
body
+
hrRange
,
0
));
}
}
}
redisTemplate
.
opsForList
().
leftPush
(
ELDER_MOVE
+
platElderIdDTO
.
getElderId
(),
JSON
.
toJSONString
(
platElderRealTimeBodyVO
));
redisTemplate
.
opsForList
().
leftPush
(
ELDER_MOVE
+
platElderIdDTO
.
getElderId
(),
JSON
.
toJSONString
(
platElderRealTimeBodyVO
));
}
}
...
@@ -433,49 +451,47 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
...
@@ -433,49 +451,47 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
List
<
PlatDevice
>
deviceListFall
=
getFallDevice
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
List
<
PlatDevice
>
deviceListFall
=
getFallDevice
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
if
(
CollectionUtils
.
isEmpty
(
deviceListSpace
)
&&
CollectionUtils
.
isNotEmpty
(
deviceListFall
))
{
if
(
CollectionUtils
.
isNotEmpty
(
deviceListSpace
))
{
return
voList
;
deviceListSpace
.
forEach
(
e
->
{
}
DeviceInfoContentSpace
i
=
iotProductDeviceService
.
getLastDeviceLogSpace
(
e
.
getOriDeviceId
(),
10
);
if
(
i
==
null
)
{
deviceListSpace
.
forEach
(
e
->
{
return
;
DeviceInfoContentSpace
i
=
iotProductDeviceService
.
getLastDeviceLogSpace
(
e
.
getOriDeviceId
(),
10
);
}
if
(
i
==
null
)
{
return
;
}
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
vo
.
setDeviceId
(
e
.
getId
());
vo
.
setDeviceId
(
e
.
getId
());
vo
.
setOriDeviceId
(
e
.
getOriDeviceId
());
vo
.
setOriDeviceId
(
e
.
getOriDeviceId
());
// vo.setX(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
// vo.setX(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.cos(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
// vo.setY(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
// vo.setY(new BigDecimal(i.getProperties().getDistance()).multiply(new BigDecimal(Math.sin(i.getProperties().getAngle()) + "")).setScale(2, RoundingMode.HALF_UP));
vo
.
setDistance
(
i
.
getProperties
().
getDistance
());
vo
.
setDistance
(
i
.
getProperties
().
getDistance
());
vo
.
setAngle
(
i
.
getProperties
().
getAngle
());
vo
.
setAngle
(
i
.
getProperties
().
getAngle
());
voList
.
add
(
vo
);
});
deviceListFall
.
forEach
(
e
->
{
voList
.
add
(
vo
);
DeviceInfoContentFall
i
=
iotProductDeviceService
.
getLastDeviceLogFall
(
e
.
getOriDeviceId
(),
10
);
if
(
i
==
null
)
{
return
;
}
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
});
}
vo
.
setDeviceId
(
e
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
deviceListFall
))
{
vo
.
setOriDeviceId
(
e
.
getOriDeviceId
());
deviceListFall
.
forEach
(
e
->
{
DeviceInfoContentFall
i
=
iotProductDeviceService
.
getLastDeviceLogFall
(
e
.
getOriDeviceId
(),
10
);
if
(
i
==
null
)
{
return
;
}
vo
.
setTrack
(
i
.
getProperties
().
getTrack
()
);
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
(
);
voList
.
add
(
vo
);
vo
.
setDeviceId
(
e
.
getId
());
vo
.
setOriDeviceId
(
e
.
getOriDeviceId
());
}
);
vo
.
setTrack
(
i
.
getProperties
().
getTrack
()
);
voList
.
add
(
vo
);
});
}
return
voList
;
return
voList
;
}
}
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderServiceImpl.java
View file @
b1d2260a
...
@@ -892,6 +892,9 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
...
@@ -892,6 +892,9 @@ public class PlatElderServiceImpl extends ServiceImpl<PlatElderMapper, PlatElder
public
List
<
PlatDevice
>
getSpaceDevice
(
String
id
)
{
public
List
<
PlatDevice
>
getSpaceDevice
(
String
id
)
{
PlatElder
platElder
=
getById
(
id
);
PlatElder
platElder
=
getById
(
id
);
if
(
platElder
==
null
)
{
return
null
;
}
if
(
StringUtils
.
isBlank
(
platElder
.
getBedId
()))
{
if
(
StringUtils
.
isBlank
(
platElder
.
getBedId
()))
{
return
null
;
return
null
;
}
}
...
...
server-service/src/main/java/com/makeit/task/IotSyncTask.java
View file @
b1d2260a
...
@@ -14,6 +14,7 @@ import com.makeit.module.iot.vo.DeviceState;
...
@@ -14,6 +14,7 @@ import com.makeit.module.iot.vo.DeviceState;
import
com.makeit.module.system.service.SysDictionaryCategoryService
;
import
com.makeit.module.system.service.SysDictionaryCategoryService
;
import
com.makeit.module.system.vo.DictionaryVo
;
import
com.makeit.module.system.vo.DictionaryVo
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.device.PlatDeviceService
;
import
com.makeit.service.platform.elder.PlatElderDayReportDayService
;
import
com.makeit.service.platform.elder.PlatElderSleepService
;
import
com.makeit.service.platform.elder.PlatElderSleepService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.service.saas.PlatTenantService
;
import
com.makeit.utils.DeviceCacheUtil
;
import
com.makeit.utils.DeviceCacheUtil
;
...
@@ -47,13 +48,15 @@ public class IotSyncTask {
...
@@ -47,13 +48,15 @@ public class IotSyncTask {
private
DeviceCacheUtil
deviceCacheUtil
;
private
DeviceCacheUtil
deviceCacheUtil
;
@Autowired
@Autowired
private
PlatElderSleepService
platElderSleepService
;
private
PlatElderSleepService
platElderSleepService
;
@Autowired
private
PlatElderDayReportDayService
platElderDayReportDayService
;
/**
/**
* 一小时同步一次
* 一小时同步一次
* 启用状态的租户才同步
* 启用状态的租户才同步
* 新增和更新平台端设备表
* 新增和更新平台端设备表
*/
*/
@Scheduled
(
cron
=
"0 0
*/1 * * ?
"
)
@Scheduled
(
cron
=
"0 0
/10 * * * *
"
)
public
void
syncEquipmentInfo
()
{
public
void
syncEquipmentInfo
()
{
savePlatDevice
();
savePlatDevice
();
}
}
...
@@ -158,4 +161,13 @@ public class IotSyncTask {
...
@@ -158,4 +161,13 @@ public class IotSyncTask {
log
.
info
(
"定时分析长者睡眠质量结束"
);
log
.
info
(
"定时分析长者睡眠质量结束"
);
}
}
/* @Scheduled(cron = "0 0 1 * * ?")
@TenantIdIgnore
public void elderCoordinateListAnalysisTask() {
log.info("开始定时分析24小时热力图");
platElderDayReportDayService.elderCoordinateListAnalysisTask();
log.info("定时分析长者24小时热力图");
}*/
}
}
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