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
5d960feb
authored
Dec 14, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:离床预警时间范围前配置
parent
90cdebd5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 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 @
5d960feb
...
...
@@ -132,7 +132,8 @@ public class OffBedAlarm implements IAlarm {
// 第一次离床时间在范围前,则已范围开始时间起始算
if
(
firstOffBedTime
.
isBefore
(
startTime
))
{
boolean
over
=
(
Math
.
abs
(
Duration
.
between
(
LocalDateTime
.
now
(),
startTime
).
toMillis
()))
/
1000
>=
duration
*
60
;
if
(
over
)
{
LocalDateTime
warmTime
=
startTime
.
plusMinutes
(
duration
);
if
(
over
&&
LocalDateTime
.
now
().
isAfter
(
warmTime
))
{
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
localDateLong
-
firstOffBedLong
));
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
log
.
info
(
"离床告警离床时间在范围前,发送预警,配置:{}"
,
config
);
...
...
@@ -180,6 +181,18 @@ public class OffBedAlarm implements IAlarm {
}
}
public
static
void
main
(
String
[]
args
)
{
LocalDateTime
startTime
=
LocalDateTime
.
of
(
2023
,
12
,
14
,
18
,
00
);
LocalDateTime
localDateTime
=
startTime
.
plusMinutes
(
1
);
System
.
out
.
println
(
localDateTime
);
LocalDateTime
startTime2
=
LocalDateTime
.
of
(
2023
,
12
,
14
,
18
,
01
,
34
);
System
.
out
.
println
(
startTime2
.
isAfter
(
localDateTime
));
System
.
out
.
println
(
localDateTime
.
equals
(
LocalDateTime
.
now
()));
}
private
void
noticeAlarm
(
AlarmRedisDTO
alarmRedisDTO
,
PlatAlarmCheckDTO
platAlarmCheckDTO
,
String
deviceId
)
{
notice
(
platAlarmCheckDTO
);
alarmRedisDTO
.
setStart
(
new
Date
());
...
...
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