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
835ab649
authored
Dec 18, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:模拟测试夜间时间
parent
3242daaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
View file @
835ab649
...
@@ -242,7 +242,9 @@ public class OffBedAlarm implements IAlarm {
...
@@ -242,7 +242,9 @@ public class OffBedAlarm implements IAlarm {
}
}
private
void
sendToRedis
(
AlarmRedisDTO
alarmRedisDTO
,
String
deviceId
)
{
private
void
sendToRedis
(
AlarmRedisDTO
alarmRedisDTO
,
String
deviceId
)
{
Date
now
=
new
Date
();
// todo 模拟时间
Date
now
=
toDate
();
// Date now = new Date();
long
endLong
=
now
.
getTime
();
long
endLong
=
now
.
getTime
();
// 第一次上报
// 第一次上报
if
(
alarmRedisDTO
==
null
)
{
if
(
alarmRedisDTO
==
null
)
{
...
@@ -256,6 +258,7 @@ public class OffBedAlarm implements IAlarm {
...
@@ -256,6 +258,7 @@ public class OffBedAlarm implements IAlarm {
log
.
info
(
"离床告警 离床设备存储redis,第一次上报时间:{},开始上报时间:{},是否上报:{}"
,
log
.
info
(
"离床告警 离床设备存储redis,第一次上报时间:{},开始上报时间:{},是否上报:{}"
,
alarmRedisDTO
.
getStartLong
(),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
alarmRedisDTO
.
getStartLong
(),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
}
else
{
}
else
{
//
alarmRedisDTO
.
setStart
(
now
);
alarmRedisDTO
.
setStart
(
now
);
log
.
info
(
"离床告警离床更新redis,第一次上报时间:{},更新时间:{},是否上报:{}"
,
log
.
info
(
"离床告警离床更新redis,第一次上报时间:{},更新时间:{},是否上报:{}"
,
longToTime
(
alarmRedisDTO
.
getStartLong
()),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
longToTime
(
alarmRedisDTO
.
getStartLong
()),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
...
@@ -319,11 +322,17 @@ public class OffBedAlarm implements IAlarm {
...
@@ -319,11 +322,17 @@ public class OffBedAlarm implements IAlarm {
}
}
private
LocalDateTime
currentTime
()
{
private
LocalDateTime
currentTime
()
{
return
LocalDateTime
.
now
().
plusHours
(
9
).
plusMinutes
(
10
);
return
LocalDateTime
.
now
().
plusHours
(
8
);
}
}
private
LocalDateTime
longToTime
(
Long
longTime
)
{
private
LocalDateTime
longToTime
(
Long
longTime
)
{
return
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
longTime
),
ZoneOffset
.
of
(
"+8"
));
return
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
longTime
),
ZoneOffset
.
of
(
"+8"
));
}
}
private
Date
toDate
(){
ZoneId
zoneId
=
ZoneId
.
systemDefault
();
ZonedDateTime
zdt
=
currentTime
().
atZone
(
zoneId
);
return
Date
.
from
(
zdt
.
toInstant
());
}
}
}
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