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
7c4b0748
authored
Mar 22, 2024
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
modify:bug 修改
parent
1f4b369f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
63 additions
and
3 deletions
server-module/src/main/java/com/makeit/module/controller/elder/PlatElderSleepController.java
server-service/src/main/java/com/makeit/service/platform/elder/PlatElderSleepService.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/DeviceLogServiceImpl.java
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
server-service/src/main/resources/mappers/PlatOrgMapper.xml
server-web/src/main/resources/application-dev.yml
server-module/src/main/java/com/makeit/module/controller/elder/PlatElderSleepController.java
View file @
7c4b0748
...
@@ -88,6 +88,16 @@ public class PlatElderSleepController {
...
@@ -88,6 +88,16 @@ public class PlatElderSleepController {
}
}
@ApiOperation
(
"测试"
)
@ApiOperation
(
"测试"
)
@GetMapping
(
"test44"
)
@AuthIgnore
@TenantIdIgnore
public
ApiResponseEntity
<
Void
>
test44
(
@RequestParam
Integer
month
,
@RequestParam
Integer
day
)
{
platElderSleepService
.
test44
(
month
,
day
);
return
ApiResponseUtils
.
success
();
}
@ApiOperation
(
"测试"
)
@PostMapping
(
"test5"
)
@PostMapping
(
"test5"
)
@AuthIgnore
@AuthIgnore
@TenantIdIgnore
@TenantIdIgnore
...
...
server-service/src/main/java/com/makeit/service/platform/elder/PlatElderSleepService.java
View file @
7c4b0748
...
@@ -22,4 +22,5 @@ public interface PlatElderSleepService extends IService<PlatElderSleep> {
...
@@ -22,4 +22,5 @@ public interface PlatElderSleepService extends IService<PlatElderSleep> {
String
calculateScores
(
long
daySleepTime
,
long
dayRestTime
,
long
deepTime
,
long
soberTime
,
long
lightTime
,
String
calculateScores
(
long
daySleepTime
,
long
dayRestTime
,
long
deepTime
,
long
soberTime
,
long
lightTime
,
SaasSleepEvaluateStandardReport
evaluateStandardReport
);
SaasSleepEvaluateStandardReport
evaluateStandardReport
);
void
test44
(
Integer
month
,
Integer
day
);
}
}
server-service/src/main/java/com/makeit/service/platform/elder/impl/DeviceLogServiceImpl.java
View file @
7c4b0748
...
@@ -99,7 +99,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
...
@@ -99,7 +99,7 @@ public class DeviceLogServiceImpl implements DeviceLogService {
TreeMap
<
String
,
AnalysisVO
>
result
=
new
TreeMap
<>();
TreeMap
<
String
,
AnalysisVO
>
result
=
new
TreeMap
<>();
collect1
.
forEach
(
result:
:
put
);
collect1
.
forEach
(
result:
:
put
);
getDayMinute
(
1
,
10
).
forEach
(
minute
->
{
getDayMinute
(
3
,
21
).
forEach
(
minute
->
{
boolean
key
=
result
.
containsKey
(
minute
);
boolean
key
=
result
.
containsKey
(
minute
);
if
(!
key
)
{
if
(!
key
)
{
AnalysisVO
analysisVO
=
buildDefaultData
(
minute
);
AnalysisVO
analysisVO
=
buildDefaultData
(
minute
);
...
...
server-service/src/main/java/com/makeit/service/platform/elder/impl/PlatElderSleepServiceImpl.java
View file @
7c4b0748
...
@@ -240,8 +240,9 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -240,8 +240,9 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
for
(
Map
.
Entry
<
String
,
AnalysisVO
>
entry
:
totalMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
AnalysisVO
>
entry
:
totalMap
.
entrySet
())
{
AnalysisVO
analysisVO
=
entry
.
getValue
();
AnalysisVO
analysisVO
=
entry
.
getValue
();
boolean
isValid
=
analysisVO
.
getAvgBr
()
==
255
&&
analysisVO
.
getAvgHr
()
==
255
;
// 非离床且体动值<20
// 非离床且体动值<20
if
(!
analysisVO
.
getIsAction
()
&&
!
analysisVO
.
getIsMoveBed
())
{
if
(!
analysisVO
.
getIsAction
()
&&
!
analysisVO
.
getIsMoveBed
()
&&
!
isValid
)
{
if
(
StrUtil
.
isBlank
(
startSleepTime
))
{
if
(
StrUtil
.
isBlank
(
startSleepTime
))
{
startSleepTime
=
entry
.
getKey
();
startSleepTime
=
entry
.
getKey
();
}
}
...
@@ -955,6 +956,44 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -955,6 +956,44 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
return
result
;
return
result
;
}
}
/**
* iot线上机器数据插入表,方便分析睡眠
* @param month
* @param day
*/
@Override
public
void
test44
(
Integer
month
,
Integer
day
)
{
List
<
String
>
dayHourRangeList
=
getLastDayHourRange
(
month
,
day
);
String
oriDeviceId
=
"H6V01241050037T"
;
SaasSleepAnalysisModel
analysisModel
=
saasSleepAnalysisModelService
.
getOne
(
new
QueryWrapper
<
SaasSleepAnalysisModel
>().
lambda
()
.
orderByDesc
(
BaseEntity:
:
getCreateBy
)
.
last
(
"limit 1"
));
for
(
String
hourRange
:
dayHourRangeList
)
{
String
[]
hourRangeArray
=
hourRange
.
split
(
"~"
);
List
<
DeviceOperationLogEntity
>
deviceOperationLogEntities
=
productDeviceService
.
getDeviceLogByTimeRange
(
oriDeviceId
,
"reportProperty"
,
10000
,
hourRangeArray
[
0
],
hourRangeArray
[
1
]);
if
(
CollUtil
.
isEmpty
(
deviceOperationLogEntities
))
{
continue
;
}
List
<
DeviceInfoContentBreathe
>
deviceInfoContentBreatheList
=
deviceOperationLogEntities
.
stream
()
.
filter
(
deviceOperationLogEntity
->
deviceOperationLogEntity
.
getType
().
contains
(
"reportProperty"
))
.
map
(
deviceOperationLogEntity
->
{
DeviceInfoContentBreathe
deviceInfoContentBreathe
=
JsonUtil
.
toObj
((
String
)
deviceOperationLogEntity
.
getContent
(),
DeviceInfoContentBreathe
.
class
);
assert
deviceInfoContentBreathe
!=
null
;
deviceInfoContentBreathe
.
setReportTime
(
formatLongTime
(
deviceInfoContentBreathe
.
getTimestamp
()));
return
deviceInfoContentBreathe
;
}).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
DeviceInfoContentBreathe
>>
minuteMap
=
StreamUtil
.
groupBy
(
deviceInfoContentBreatheList
,
DeviceInfoContentBreathe:
:
getReportTime
);
deviceLogService
.
save
(
deviceOperationLogEntities
);
deviceOperationLogEntities
.
clear
();
TreeMap
<
String
,
AnalysisVO
>
statisticsMap
=
getPerMinuteData
(
minuteMap
,
analysisModel
);
if
(
CollUtil
.
isNotEmpty
(
statisticsMap
))
{
//测试环境数据 device_minute_info
deviceLogService
.
saveEntity
(
statisticsMap
,
"1765616197461037058"
);
}
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@TenantIdIgnore
@TenantIdIgnore
...
@@ -1024,6 +1063,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
...
@@ -1024,6 +1063,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
if
(
CollUtil
.
isEmpty
(
totalMap
))
{
if
(
CollUtil
.
isEmpty
(
totalMap
))
{
continue
;
continue
;
}
}
// 测试环境数据 device_minute_info totalMap = deviceLogService.getData();
// 没有上报数据的时间,填默认值
// 没有上报数据的时间,填默认值
deviceLogService
.
fillDefaultData
(
totalMap
,
month
,
day
);
deviceLogService
.
fillDefaultData
(
totalMap
,
month
,
day
);
// 记录长者不同类型的睡眠时间
// 记录长者不同类型的睡眠时间
...
...
server-service/src/main/resources/mappers/PlatOrgMapper.xml
View file @
7c4b0748
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
</insert>
</insert>
<select
id=
"getData"
resultType=
"com.makeit.module.iot.vo.analysis.AnalysisVO"
>
<select
id=
"getData"
resultType=
"com.makeit.module.iot.vo.analysis.AnalysisVO"
>
select * from device_minute_info where device_id = '17
32647368962203650
' order by created_time
select * from device_minute_info where device_id = '17
65616197461037058
' order by created_time
</select>
</select>
...
...
server-web/src/main/resources/application-dev.yml
View file @
7c4b0748
...
@@ -117,6 +117,15 @@ iot:
...
@@ -117,6 +117,15 @@ iot:
sync
:
sync
:
enable
:
false
enable
:
false
# 线上iot
#iot:
# url: https://iot.quanthium.com.cn/api/
# uploadUrl: https://saas.qa.insightica.cn/api/saas/device/devicePushLog
# clientId: SGtXMT3nXNjDrexH
# secureKey: SK48ztMZDMEs8FmaPHjGQGmQBA4CjrPt
# sync:
# enable: false
mqtt
:
mqtt
:
username
:
admin|1693982115969
username
:
admin|1693982115969
password
:
8e3795ef7b5e95869fa8c323b865b3a9
password
:
8e3795ef7b5e95869fa8c323b865b3a9
...
...
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