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
385c825c
authored
Dec 18, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:删除不必要的日志
parent
067657db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
22 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 @
385c825c
...
...
@@ -48,7 +48,7 @@ public class OffBedAlarm implements IAlarm {
* @param platAlarmCheckDTO
*/
@Override
public
void
checkConfig
(
PlatAlarmCheckDTO
platAlarmCheckDTO
)
{
public
synchronized
void
checkConfig
(
PlatAlarmCheckDTO
platAlarmCheckDTO
)
{
PlatDevice
platDevice
=
platAlarmCheckDTO
.
getPlatDevice
();
platAlarmRecordService
.
getElderListByDeviceId
(
platAlarmCheckDTO
);
log
.
info
(
"执行离床checkConfig方法:"
);
...
...
@@ -96,20 +96,19 @@ public class OffBedAlarm implements IAlarm {
if
(
endTime
.
getHour
()
==
0
&&
endTime
.
getMinute
()
==
0
)
{
ruleConfig
.
setOffBedEnd
(
LocalTime
.
MAX
);
}
log
.
info
(
"离床预警时间范围,begin:{},end:{}"
,
startTime
,
endTime
);
String
personState
=
Convert
.
toStr
(
properties
.
get
(
"person"
));
boolean
isOffBed
=
"0"
.
equals
(
personState
);
// 1-有人 0-无人
AlarmRedisDTO
alarmRedisDTO
=
RedisUtil
.
get
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
);
if
(!
isOffBed
&&
alarmRedisDTO
!=
null
)
{
log
.
info
(
"离床告警有人状态下,删除redis
!"
);
log
.
info
(
"离床告警有人状态下,删除redis
,deviceId:{}"
,
deviceId
);
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
);
return
;
}
// 设备无人,在范围内上报存储redis,超过离床持续时间,则预警
String
messageType
=
platAlarmCheckDTO
.
getMessageType
();
if
(
StringUtils
.
equalsAnyIgnoreCase
(
messageType
,
"OFFLINE"
,
"DISCONNECT"
))
{
log
.
info
(
"离床告警设备下线,删除redis off_bed 预警
"
);
log
.
info
(
"离床告警设备下线,删除redis off_bed 预警
,deviceId:{}"
,
deviceId
);
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
);
}
if
(
isOffBed
)
{
...
...
@@ -117,21 +116,16 @@ public class OffBedAlarm implements IAlarm {
sendToRedis
(
alarmRedisDTO
,
deviceId
);
alarmRedisDTO
=
RedisUtil
.
get
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
);
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
LocalDateTime
firstOffBedTime
=
longToTime
(
firstOffBedLong
);
log
.
info
(
"离床预警第一次离床时间为:"
+
firstOffBedTime
);
if
(
"1"
.
equals
(
alarmRedisDTO
.
getAlarm
()))
{
log
.
info
(
"离床告警已发送预警过
!"
);
log
.
info
(
"离床告警已发送预警过
,第一次遇见时间:{}"
,
longToTime
(
alarmRedisDTO
.
getStartLong
())
);
return
;
}
// 是否跨天 xxx-0:00,未跨天
boolean
isCrossDay
=
startTime
.
isAfter
(
endTime
)
&&
!
endTime
.
equals
(
LocalTime
.
MIN
);
if
(
isCrossDay
)
{
log
.
info
(
"离床预警跨天处理:config:{}"
,
config
.
getRuleConfig
());
handleCrossDay
(
alarmRedisDTO
,
ruleConfig
,
platAlarmCheckDTO
,
config
,
deviceId
);
}
else
{
log
.
info
(
"离床预警未跨天处理:config:{}"
,
config
.
getRuleConfig
());
handleUnCrossDay
(
alarmRedisDTO
,
ruleConfig
,
platAlarmCheckDTO
,
config
,
deviceId
);
}
...
...
@@ -140,6 +134,14 @@ public class OffBedAlarm implements IAlarm {
}
/**
* 处理跨天业务
* @param alarmRedisDTO
* @param ruleConfig
* @param platAlarmCheckDTO
* @param config
* @param deviceId
*/
private
void
handleCrossDay
(
AlarmRedisDTO
alarmRedisDTO
,
PlatAlarmConfigOffBedDTOVO
ruleConfig
,
PlatAlarmCheckDTO
platAlarmCheckDTO
,
PlatAlarmConfig
config
,
...
...
@@ -186,6 +188,14 @@ public class OffBedAlarm implements IAlarm {
}
/**
* 处理跨天业务
* @param alarmRedisDTO
* @param ruleConfig
* @param platAlarmCheckDTO
* @param config
* @param deviceId
*/
private
void
handleUnCrossDay
(
AlarmRedisDTO
alarmRedisDTO
,
PlatAlarmConfigOffBedDTOVO
ruleConfig
,
PlatAlarmCheckDTO
platAlarmCheckDTO
,
PlatAlarmConfig
config
,
...
...
@@ -198,8 +208,7 @@ public class OffBedAlarm implements IAlarm {
// LocalDateTime endLocalDteTime = LocalDateTime.of(LocalDate.now(), endTime);
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
long
currentTimeMillis
=
System
.
currentTimeMillis
();
currentTimeMillis
=
currentLong
();
long
currentTimeMillis
=
currentLong
();
boolean
isOverTime
=
(
currentTimeMillis
-
firstOffBedLong
)
/
1000
>=
duration
*
60
;
LocalDateTime
firstOffBedTime
=
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
firstOffBedLong
),
ZoneOffset
.
of
(
"+8"
));
LocalTime
firstTime
=
firstOffBedTime
.
toLocalTime
();
...
...
@@ -250,13 +259,12 @@ public class OffBedAlarm implements IAlarm {
endLong
=
currentLong
();
alarmRedisDTO
.
setStartLong
(
endLong
);
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
,
alarmRedisDTO
);
log
.
info
(
"离床告警 离床设备存储redis,第一次上报时间:{},开始上报时间:{},是否上报:{}"
,
alarmRedisDTO
.
getStartLong
(),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
//
log.info("离床告警 离床设备存储redis,第一次上报时间:{},开始上报时间:{},是否上报:{}",
//
alarmRedisDTO.getStartLong(), alarmRedisDTO.getStart(), alarmRedisDTO.getAlarm());
}
else
{
//
alarmRedisDTO
.
setStart
(
now
);
log
.
info
(
"离床告警离床更新redis,第一次上报时间:{},更新时间:{},是否上报:{}"
,
longToTime
(
alarmRedisDTO
.
getStartLong
()),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
//
log.info("离床告警离床更新redis,第一次上报时间:{},更新时间:{},是否上报:{}",
//
longToTime(alarmRedisDTO.getStartLong()), alarmRedisDTO.getStart(), alarmRedisDTO.getAlarm());
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
,
alarmRedisDTO
);
}
}
...
...
@@ -294,10 +302,6 @@ public class OffBedAlarm implements IAlarm {
}
// PlatRoom platRoom = platAlarmCheckDTO.getPlatRoom();
for
(
PlatElder
platElder
:
platElderList
)
{
// if (!platElder.getOrgId().equals(config.getOrgId())) {
// log.info("长者不再配置组织内:长者:{},config:{}", platElder.getName(), config.getRuleConfig());
// continue;
// }
List
<
String
>
param
=
new
ArrayList
<>();
// param.add(platRoom.getName());
param
.
add
(
platElder
.
getName
());
...
...
@@ -317,7 +321,7 @@ public class OffBedAlarm implements IAlarm {
}
private
LocalDateTime
currentTime
()
{
return
LocalDateTime
.
now
().
plusHours
(
6
);
return
LocalDateTime
.
now
().
plusHours
(
5
);
// return LocalDateTime.now();
}
...
...
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