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
8d763929
authored
Oct 10, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 改成十分钟同步一次
parent
14312720
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
32 deletions
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderRealTimeServiceImpl.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 @
8d763929
...
...
@@ -10,6 +10,7 @@ import com.makeit.enums.platform.elder.PlatElderRealtimeReportEnum;
import
com.makeit.module.iot.enums.DeviceInfoContentBreatheEnum
;
import
com.makeit.module.iot.enums.DeviceInfoContentFallEnum
;
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.vo.breathe.DeviceInfoContentBreathe
;
import
com.makeit.module.iot.vo.fall.DeviceInfoContentFall
;
...
...
@@ -131,6 +132,9 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
if
(
platDevice
==
null
)
{
return
null
;
}
if
(!
platDevice
.
getStatus
().
equals
(
DeviceState
.
online
.
getValue
()))
{
return
null
;
}
DeviceInfoContentBreathe
deviceInfoContentBreathe
=
iotProductDeviceService
.
getLastDeviceLogBreathe
(
platDevice
.
getOriDeviceId
(),
10
);
...
...
@@ -343,8 +347,8 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
}
else
{
int
hrRange
=
RandomUtils
.
nextInt
(
1
,
11
)
-
5
;
int
brRange
=
RandomUtils
.
nextInt
(
1
,
7
)
-
3
;
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
heartRate
+
hrRange
);
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
respiratoryRate
+
brRange
);
platElderRealTimeHeartRespiratoryVO
.
setHeartRate
(
Math
.
max
(
heartRate
+
hrRange
,
0
)
);
platElderRealTimeHeartRespiratoryVO
.
setRespiratoryRate
(
Math
.
max
(
respiratoryRate
+
brRange
,
0
)
);
}
redisTemplate
.
opsForList
().
leftPush
(
ELDER_BR_HR
+
platElderIdDTO
.
getElderId
(),
JSON
.
toJSONString
(
platElderRealTimeHeartRespiratoryVO
));
}
...
...
@@ -433,49 +437,47 @@ public class PlatElderRealTimeServiceImpl implements PlatElderRealTimeService {
List
<
PlatDevice
>
deviceListFall
=
getFallDevice
(
platElderIdDTO
.
getElderId
(),
platElderIdDTO
.
getDeviceId
());
if
(
CollectionUtils
.
isEmpty
(
deviceListSpace
)
&&
CollectionUtils
.
isNotEmpty
(
deviceListFall
))
{
return
voList
;
}
deviceListSpace
.
forEach
(
e
->
{
DeviceInfoContentSpace
i
=
iotProductDeviceService
.
getLastDeviceLogSpace
(
e
.
getOriDeviceId
(),
10
);
if
(
i
==
null
)
{
return
;
}
if
(
CollectionUtils
.
isNotEmpty
(
deviceListSpace
))
{
deviceListSpace
.
forEach
(
e
->
{
DeviceInfoContentSpace
i
=
iotProductDeviceService
.
getLastDeviceLogSpace
(
e
.
getOriDeviceId
(),
10
);
if
(
i
==
null
)
{
return
;
}
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
vo
.
setDeviceId
(
e
.
getId
());
vo
.
setOriDeviceId
(
e
.
getOriDeviceId
());
vo
.
setDeviceId
(
e
.
getId
());
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.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
.
setAngle
(
i
.
getProperties
().
getAngle
());
vo
.
setDistance
(
i
.
getProperties
().
getDistance
());
vo
.
setAngle
(
i
.
getProperties
().
getAngle
());
voList
.
add
(
vo
);
voList
.
add
(
vo
);
});
deviceListFall
.
forEach
(
e
->
{
DeviceInfoContentFall
i
=
iotProductDeviceService
.
getLastDeviceLogFall
(
e
.
getOriDeviceId
(),
10
);
if
(
i
==
null
)
{
return
;
}
PlatElderCoordinateVO
vo
=
new
PlatElderCoordinateVO
();
});
}
vo
.
setDeviceId
(
e
.
getId
());
vo
.
setOriDeviceId
(
e
.
getOriDeviceId
());
if
(
CollectionUtils
.
isNotEmpty
(
deviceListFall
))
{
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
;
}
...
...
server-service/src/main/java/com/makeit/task/IotSyncTask.java
View file @
8d763929
...
...
@@ -14,6 +14,7 @@ import com.makeit.module.iot.vo.DeviceState;
import
com.makeit.module.system.service.SysDictionaryCategoryService
;
import
com.makeit.module.system.vo.DictionaryVo
;
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.saas.PlatTenantService
;
import
com.makeit.utils.DeviceCacheUtil
;
...
...
@@ -47,13 +48,15 @@ public class IotSyncTask {
private
DeviceCacheUtil
deviceCacheUtil
;
@Autowired
private
PlatElderSleepService
platElderSleepService
;
@Autowired
private
PlatElderDayReportDayService
platElderDayReportDayService
;
/**
* 一小时同步一次
* 启用状态的租户才同步
* 新增和更新平台端设备表
*/
@Scheduled
(
cron
=
"0 0
*/1 * * ?
"
)
@Scheduled
(
cron
=
"0 0
/10 * * * *
"
)
public
void
syncEquipmentInfo
()
{
savePlatDevice
();
}
...
...
@@ -158,4 +161,13 @@ public class IotSyncTask {
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