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
ce67b6eb
authored
Dec 15, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:bug修复
parent
edafdbd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 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 @
ce67b6eb
...
@@ -151,7 +151,7 @@ public class OffBedAlarm implements IAlarm {
...
@@ -151,7 +151,7 @@ public class OffBedAlarm implements IAlarm {
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
LocalDateTime
nowTest
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
4
0
);
LocalDateTime
nowTest
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
2
0
);
currentTimeMillis
=
nowTest
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
currentTimeMillis
=
nowTest
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
log
.
info
(
"handleCrossDay,测试当前的时间:{},时间戳:{}"
,
nowTest
,
currentTimeMillis
);
log
.
info
(
"handleCrossDay,测试当前的时间:{},时间戳:{}"
,
nowTest
,
currentTimeMillis
);
boolean
isOverTime
=
(
currentTimeMillis
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
boolean
isOverTime
=
(
currentTimeMillis
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
...
@@ -174,7 +174,7 @@ public class OffBedAlarm implements IAlarm {
...
@@ -174,7 +174,7 @@ public class OffBedAlarm implements IAlarm {
return
;
return
;
}
}
// LocalDateTime now = LocalDateTime.now();
// LocalDateTime now = LocalDateTime.now();
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
4
0
);;
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
2
0
);;
LocalDateTime
startLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
LocalDateTime
startLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
if
(!
isInTime
)
{
if
(!
isInTime
)
{
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
...
@@ -195,7 +195,7 @@ public class OffBedAlarm implements IAlarm {
...
@@ -195,7 +195,7 @@ public class OffBedAlarm implements IAlarm {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
4
0
);
LocalDateTime
now
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
2
0
);
System
.
out
.
println
(
now
);
System
.
out
.
println
(
now
);
}
}
...
@@ -211,7 +211,10 @@ public class OffBedAlarm implements IAlarm {
...
@@ -211,7 +211,10 @@ public class OffBedAlarm implements IAlarm {
LocalDateTime
endLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
endTime
);
LocalDateTime
endLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
endTime
);
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
boolean
isOverTime
=
(
System
.
currentTimeMillis
()
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
long
currentTimeMillis
=
System
.
currentTimeMillis
();
LocalDateTime
nowTest
=
LocalDateTime
.
now
().
plusHours
(
7
).
plusMinutes
(
20
);
currentTimeMillis
=
nowTest
.
toInstant
(
ZoneOffset
.
of
(
"+8"
)).
toEpochMilli
();
boolean
isOverTime
=
(
currentTimeMillis
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
...
@@ -229,19 +232,19 @@ public class OffBedAlarm implements IAlarm {
...
@@ -229,19 +232,19 @@ public class OffBedAlarm implements IAlarm {
log
.
info
(
"handleUnCrossDay第一次离床时间,{}+持续时间:{}将超过范围,{}"
,
firstTime
,
duration
,
endTime
);
log
.
info
(
"handleUnCrossDay第一次离床时间,{}+持续时间:{}将超过范围,{}"
,
firstTime
,
duration
,
endTime
);
return
;
return
;
}
}
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
System
.
currentTimeMillis
()
-
firstOffBedLong
));
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
currentTimeMillis
-
firstOffBedLong
));
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
log
.
info
(
"uncross离床告警离床时间在范围时间内,配置:{}"
,
config
.
getRuleConfig
());
log
.
info
(
"uncross离床告警离床时间在范围时间内,配置:{}"
,
config
.
getRuleConfig
());
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
return
;
return
;
}
}
LocalDateTime
now
=
LocalDateTime
.
now
();
LocalDateTime
now
=
LocalDateTime
.
now
()
.
plusHours
(
7
).
plusMinutes
(
20
)
;
if
(!
isInTime
&&
now
.
isAfter
(
startLocalDteTime
)
&&
now
.
isBefore
(
endLocalDteTime
))
{
if
(!
isInTime
&&
now
.
isAfter
(
startLocalDteTime
)
&&
now
.
isBefore
(
endLocalDteTime
))
{
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
boolean
noInOverTime
=
mills
>=
duration
*
60
;
boolean
noInOverTime
=
mills
>=
duration
*
60
;
if
(
noInOverTime
)
{
if
(
noInOverTime
)
{
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
System
.
currentTimeMillis
()
-
firstOffBedLong
));
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
currentTimeMillis
-
firstOffBedLong
));
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
log
.
info
(
"uncross离床告警第一次离床时间在范围前,配置:{}"
,
config
.
getRuleConfig
());
log
.
info
(
"uncross离床告警第一次离床时间在范围前,配置:{}"
,
config
.
getRuleConfig
());
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
...
...
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