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
29f8fa76
authored
Nov 16, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:呼吸率和心率告警问题
parent
2110f403
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BreathAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/HeartAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/BreathAlarm.java
View file @
29f8fa76
...
...
@@ -95,6 +95,7 @@ public class BreathAlarm implements IAlarm {
int
hasPerson
=
(
int
)
properties
.
get
(
"person"
);
if
(
0
==
hasPerson
)
{
log
.
info
(
"当前上报数据无人,不需要告警"
);
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_BR_ID
+
deviceId
);
return
;
}
...
...
@@ -125,7 +126,7 @@ public class BreathAlarm implements IAlarm {
}
Long
startLong
=
alarmRedisDTO
.
getStartLong
();
long
count
=
endLong
-
startLong
;
if
(
count
/
1000
>=
duration
)
{
if
(
duration
+
5
>=
count
/
1000
&&
count
/
1000
>=
duration
)
{
if
(
StringUtils
.
equals
(
alarmRedisDTO
.
getAlarm
(),
CommonEnum
.
YES
.
getValue
()))
{
log
.
error
(
"呼吸已告警,设备plat_id:"
+
platDevice
.
getId
());
return
;
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/HeartAlarm.java
View file @
29f8fa76
...
...
@@ -99,6 +99,7 @@ public class HeartAlarm implements IAlarm {
int
hasPerson
=
(
int
)
properties
.
get
(
"person"
);
if
(
0
==
hasPerson
)
{
log
.
info
(
"当前上报数据无人,不需要告警"
);
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_HR_ID
+
deviceId
);
return
;
}
...
...
@@ -114,7 +115,7 @@ public class HeartAlarm implements IAlarm {
}
Long
startLong
=
alarmRedisDTO
.
getStartLong
();
long
count
=
endLong
-
startLong
;
if
(
count
/
1000
>=
duration
)
{
if
(
duration
+
5
>=
count
/
1000
&&
count
/
1000
>=
duration
)
{
//todo 如果每台服务器都能收到上报消息 加redis锁
//RLock lock = RedisLockUtil.lock(RedisConst.LOCK_ALARM + deviceId);
if
(
StringUtils
.
equals
(
alarmRedisDTO
.
getAlarm
(),
CommonEnum
.
YES
.
getValue
()))
{
...
...
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