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
0e334a27
authored
Dec 19, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
af47bb8a
06ca2800
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
61 deletions
server-module/src/main/java/com/makeit/module/controller/wechat/alarm/PlatAlarmRecordWechatController.java
server-service/src/main/java/com/makeit/mapper/platform/alarm/PlatAlarmConfigMapper.java
server-service/src/main/java/com/makeit/service/platform/alarm/PlatAlarmConfigService.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmConfigServiceImpl.java
server-service/src/main/resources/mappers/PlatAlarmConfigMapper.xml
server-service/src/main/resources/mappers/PlatDeviceMapper.xml
server-module/src/main/java/com/makeit/module/controller/wechat/alarm/PlatAlarmRecordWechatController.java
View file @
0e334a27
...
...
@@ -12,6 +12,7 @@ import com.makeit.dto.platform.alarm.PlatAlarmRecordQueryDTO;
import
com.makeit.enums.report.PlatformTypeEnum
;
import
com.makeit.global.annotation.AuthIgnore
;
import
com.makeit.service.platform.alarm.PlatAlarmRecordService
;
import
com.makeit.utils.user.common.CommonUserUtil
;
import
com.makeit.vo.platform.alarm.PlatAlarmRecordVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -36,7 +37,8 @@ public class PlatAlarmRecordWechatController {
@AuthIgnore
public
ApiResponseEntity
<
Map
<
String
,
Object
>>
page
(
@RequestBody
PageReqDTO
<
PlatAlarmRecordQueryDTO
>
dto
)
{
//小程序告警记录只看到发给自己的告警
String
userId
=
"1700085146788667394"
;
String
userId
=
CommonUserUtil
.
getUserId
();
// String userId = "1700085146788667394";
PlatAlarmRecordQueryDTO
data
=
dto
.
getData
();
data
.
setNotifyUser
(
userId
);
...
...
server-service/src/main/java/com/makeit/mapper/platform/alarm/PlatAlarmConfigMapper.java
View file @
0e334a27
...
...
@@ -3,6 +3,7 @@ package com.makeit.mapper.platform.alarm;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.makeit.dto.platform.alarm.PlatHealthConfigDTO
;
import
com.makeit.entity.platform.alarm.PlatAlarmConfig
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
...
...
@@ -21,4 +22,6 @@ public interface PlatAlarmConfigMapper extends BaseMapper<PlatAlarmConfig> {
* @return
*/
List
<
PlatHealthConfigDTO
>
getHealthConfigList
();
List
<
PlatAlarmConfig
>
listOffBed
(
@Param
(
"orgDeviceId"
)
String
orgDeviceId
);
}
server-service/src/main/java/com/makeit/service/platform/alarm/PlatAlarmConfigService.java
View file @
0e334a27
...
...
@@ -42,4 +42,6 @@ public interface PlatAlarmConfigService extends IService<PlatAlarmConfig> {
List
<
PlatHealthConfigDTO
>
getHealthConfigList
();
void
initData
();
List
<
PlatAlarmConfig
>
listOfBed
(
String
orgId
);
}
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
View file @
0e334a27
package
com
.
makeit
.
service
.
platform
.
alarm
.
alarmStrategy
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.makeit.dto.platform.alarm.PlatAlarmCheckDTO
;
import
com.makeit.dto.platform.alarm.PlatAlarmConfigOffBedDTOVO
;
...
...
@@ -12,6 +12,7 @@ import com.makeit.entity.platform.elder.PlatElder;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.platform.alarm.PlatAlarmConfigEnum
;
import
com.makeit.enums.redis.RedisConst
;
import
com.makeit.service.platform.alarm.PlatAlarmConfigService
;
import
com.makeit.service.platform.alarm.PlatAlarmRecordService
;
import
com.makeit.utils.AlarmConfigCacheUtil
;
import
com.makeit.utils.AlarmRedisDTO
;
...
...
@@ -20,6 +21,7 @@ import com.makeit.utils.redis.RedisUtil;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
...
...
@@ -37,6 +39,8 @@ public class OffBedAlarm implements IAlarm {
private
final
PlatAlarmConfigEnum
.
AlarmTypeEnum
alarmTypeEnum
=
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
OFF_BED
;
@Resource
private
AlarmConfigCacheUtil
alarmConfigCacheUtil
;
@Autowired
private
PlatAlarmConfigService
platAlarmConfigService
;
@Override
public
boolean
support
(
String
alarmType
)
{
...
...
@@ -58,28 +62,41 @@ public class OffBedAlarm implements IAlarm {
log
.
error
(
"离床告警心率设备未关联长者,设备plat_id:"
+
platAlarmCheckDTO
.
getPlatDevice
().
getId
());
return
;
}
PlatAlarmConfig
config
=
alarmConfigCacheUtil
.
get
(
platDevice
.
getOrgId
(),
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
OFF_BED
.
getValue
());
// PlatAlarmConfig config = alarmConfigCacheUtil.get(platDevice.getOrgId(), PlatAlarmConfigEnum.AlarmTypeEnum.OFF_BED.getValue());
// PlatAlarmConfig platAlarmConfig = platAlarmCheckDTO.getPlatAlarmConfig();
List
<
PlatAlarmConfig
>
configList
=
platAlarmConfigService
.
listOfBed
(
platDevice
.
getId
());
if
(
CollUtil
.
isNotEmpty
(
configList
))
{
configList
.
forEach
(
c
->
{
log
.
info
(
"离床告警dto,org_config:{},设备id:{}"
,
c
.
getRuleConfig
(),
platDevice
.
getId
());
offBedCheckAlarm
(
c
,
platAlarmCheckDTO
,
platDevice
);
});
}
}
private
void
offBedCheckAlarm
(
PlatAlarmConfig
config
,
PlatAlarmCheckDTO
platAlarmCheckDTO
,
PlatDevice
platDevice
)
{
if
(
config
==
null
||
StringUtils
.
isBlank
(
config
.
getRuleConfig
())
||
!
"5"
.
equals
(
config
.
getAlarmType
()))
{
log
.
error
(
"离床告警配置不存在,config:{}"
,
JSONUtil
.
toJsonStr
(
config
));
//
log.error("离床告警配置不存在,config:{}", JSONUtil.toJsonStr(config));
return
;
}
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"离床告警配置为禁用,告警配置id:"
+
config
.
getId
());
//
log.error("离床告警配置为禁用,告警配置id:" + config.getId());
return
;
}
// String ruleConfigStr = "{\"offBedStart\":\"23:07:00\",\"offBedEnd\":\"00:00:00\",\"duration\":\"1\"}";
String
ruleConfigStr
=
config
.
getRuleConfig
();
if
(
StringUtils
.
isBlank
(
ruleConfigStr
))
{
log
.
error
(
"离床告警配置未配置,告警配置id:"
+
config
.
getId
());
//
log.error("离床告警配置未配置,告警配置id:" + config.getId());
return
;
}
PlatAlarmConfigOffBedDTOVO
ruleConfig
=
JsonUtil
.
toObj
(
ruleConfigStr
,
PlatAlarmConfigOffBedDTOVO
.
class
);
if
(
ruleConfig
==
null
)
{
log
.
error
(
"离床告警配置解析失败,config:{}"
,
JSONUtil
.
toJsonStr
(
config
));
//
log.error("离床告警配置解析失败,config:{}", JSONUtil.toJsonStr(config));
return
;
}
if
(
ruleConfig
.
getOffBedStart
()
==
null
||
ruleConfig
.
getOffBedEnd
()
==
null
)
{
log
.
error
(
"离床告警配置时间不能为空,config:{}"
,
JSONUtil
.
toJsonStr
(
config
));
//
log.error("离床告警配置时间不能为空,config:{}", JSONUtil.toJsonStr(config));
return
;
}
JSONObject
properties
=
platAlarmCheckDTO
.
getProperties
();
...
...
@@ -90,28 +107,26 @@ public class OffBedAlarm implements IAlarm {
LocalTime
startTime
=
ruleConfig
.
getOffBedStart
();
LocalTime
endTime
=
ruleConfig
.
getOffBedEnd
();
if
(
startTime
==
null
||
endTime
==
null
||
startTime
.
equals
(
endTime
))
{
log
.
error
(
"离床告警配置时间段解析失败,config:{}"
,
JSONUtil
.
toJsonStr
(
ruleConfig
));
//
log.error("离床告警配置时间段解析失败,config:{}", JSONUtil.toJsonStr(ruleConfig));
return
;
}
// 00:00 -> 23:59:59999
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-无人
log
.
info
(
"离床告警config:{}"
,
JSONUtil
.
toJsonStr
(
properties
));
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
)
{
...
...
@@ -119,52 +134,51 @@ 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
);
}
}
}
/**
* 处理跨天业务
*
* @param alarmRedisDTO
* @param ruleConfig
* @param platAlarmCheckDTO
* @param config
* @param deviceId
*/
private
void
handleCrossDay
(
AlarmRedisDTO
alarmRedisDTO
,
PlatAlarmConfigOffBedDTOVO
ruleConfig
,
PlatAlarmCheckDTO
platAlarmCheckDTO
,
PlatAlarmConfig
config
,
String
deviceId
)
{
log
.
info
(
"cross_config:{},第一次离床时间:{}"
,
config
.
getRuleConfig
(),
longToTime
(
alarmRedisDTO
.
getStartLong
()));
Integer
duration
=
ruleConfig
.
getDuration
();
LocalTime
startTime
=
ruleConfig
.
getOffBedStart
();
LocalTime
endTime
=
ruleConfig
.
getOffBedEnd
();
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
();
LocalTime
firstTime
=
longToTime
(
firstOffBedLong
).
toLocalTime
();
boolean
isInTime
=
firstTime
.
isAfter
(
startTime
)
||
firstTime
.
isBefore
(
endTime
);
// LocalTime endTimeLimit = endTime.plusMinutes(-duration);
// 离床时间在范围内
if
(
isInTime
&&
isOverTime
)
{
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
currentTimeMillis
-
firstOffBedLong
));
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
log
.
info
(
"cross离床告警离床时间在范围时间内,配置:{}"
,
config
.
getRuleConfig
());
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
return
;
}
...
...
@@ -175,8 +189,8 @@ public class OffBedAlarm implements IAlarm {
boolean
noInOverTime
=
mills
>=
duration
*
60
;
if
(
noInOverTime
)
{
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
currentTimeMillis
-
firstOffBedLong
));
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
log
.
info
(
"cross离床告警第一次离床时间在范围前,配置:{}"
,
config
.
getRuleConfig
());
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
}
else
{
log
.
info
(
"cross离床告警,第一次离床时间在范围前,未预警,配置:{},时间持续:{},start:{}"
,
config
.
getRuleConfig
(),
mills
,
startLocalDteTime
);
...
...
@@ -188,27 +202,30 @@ 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
,
String
deviceId
)
{
log
.
info
(
"uncross_config:{},第一次离床时间:{}"
,
config
.
getRuleConfig
(),
longToTime
(
alarmRedisDTO
.
getStartLong
()));
Integer
duration
=
ruleConfig
.
getDuration
();
LocalTime
startTime
=
ruleConfig
.
getOffBedStart
();
LocalDateTime
startLocalDteTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
LocalTime
endTime
=
ruleConfig
.
getOffBedEnd
();
if
(
LocalTime
.
MIN
.
equals
(
endTime
))
{
endTime
=
LocalTime
.
MAX
;
}
// 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
();
LocalTime
firstTime
=
longToTime
(
firstOffBedLong
).
toLocalTime
();
boolean
isInTime
=
firstTime
.
isAfter
(
startTime
)
&&
firstTime
.
isBefore
(
endTime
);
LocalTime
endTimeLimit
=
endTime
.
plusMinutes
(-
duration
);
...
...
@@ -226,14 +243,14 @@ public class OffBedAlarm implements IAlarm {
}
LocalDateTime
now
=
currentTime
();
LocalTime
localTime
=
LocalTime
.
now
();
LocalTime
localTime
=
LocalTime
.
now
()
.
plusHours
(
12
)
;
if
(!
isInTime
&&
localTime
.
isAfter
(
startTime
)
&&
localTime
.
isBefore
(
endTime
))
{
long
mills
=
Duration
.
between
(
startLocalDteTime
,
now
).
toMillis
()
/
1000
;
boolean
noInOverTime
=
mills
>=
duration
*
60
;
if
(
noInOverTime
)
{
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
currentTimeMillis
-
firstOffBedLong
));
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
log
.
info
(
"uncross离床告警第一次离床时间在范围前,配置:{}"
,
config
.
getRuleConfig
());
platAlarmCheckDTO
.
setPlatAlarmConfig
(
config
);
noticeAlarm
(
alarmRedisDTO
,
platAlarmCheckDTO
,
deviceId
);
}
else
{
log
.
info
(
"uncross离床告警第一次离床时间在范围前,未预警,配置:{},时间持续:{},start:{}"
,
config
.
getRuleConfig
(),
mills
,
startLocalDteTime
);
...
...
@@ -245,23 +262,15 @@ public class OffBedAlarm implements IAlarm {
private
void
sendToRedis
(
AlarmRedisDTO
alarmRedisDTO
,
String
deviceId
)
{
Date
now
=
toDate
();
// Date now = new Date();
long
endLong
=
now
.
getTime
();
// 第一次上报
if
(
alarmRedisDTO
==
null
)
{
alarmRedisDTO
=
new
AlarmRedisDTO
();
alarmRedisDTO
.
setAlarm
(
CommonEnum
.
NO
.
getValue
());
alarmRedisDTO
.
setStart
(
now
);
endLong
=
currentLong
();
alarmRedisDTO
.
setStartLong
(
endLong
);
alarmRedisDTO
.
setStartLong
(
currentLong
());
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
,
alarmRedisDTO
);
log
.
info
(
"离床告警 离床设备存储redis,第一次上报时间:{},开始上报时间:{},是否上报:{}"
,
alarmRedisDTO
.
getStartLong
(),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
}
else
{
//
alarmRedisDTO
.
setStart
(
now
);
log
.
info
(
"离床告警离床更新redis,第一次上报时间:{},更新时间:{},是否上报:{}"
,
longToTime
(
alarmRedisDTO
.
getStartLong
()),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
,
alarmRedisDTO
);
}
}
...
...
@@ -275,8 +284,9 @@ public class OffBedAlarm implements IAlarm {
alarmRedisDTO
.
setStart
(
new
Date
());
alarmRedisDTO
.
setAlarm
(
CommonEnum
.
YES
.
getValue
());
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
deviceId
,
alarmRedisDTO
);
log
.
info
(
"离床告警推送离床消息,第一次上报时间:{},开始上报时间:{},是否上报:{}"
,
longToTime
(
alarmRedisDTO
.
getStartLong
()),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
());
log
.
info
(
"离床告警推送离床消息,第一次上报时间:{},开始上报时间:{},是否上报:{},上报的config:{}"
,
longToTime
(
alarmRedisDTO
.
getStartLong
()),
alarmRedisDTO
.
getStart
(),
alarmRedisDTO
.
getAlarm
()
,
platAlarmConfig
.
getRuleConfig
());
}
@Override
...
...
@@ -286,23 +296,19 @@ public class OffBedAlarm implements IAlarm {
List
<
PlatElder
>
platElderList
=
platAlarmCheckDTO
.
getPlatElderList
();
PlatAlarmConfig
config
=
platAlarmCheckDTO
.
getPlatAlarmConfig
();
if
(
CommonEnum
.
NO
.
getValue
().
equals
(
config
.
getStatus
()))
{
log
.
error
(
"离床告警配置为禁用,告警配置id:"
+
config
.
getId
());
//
log.error("离床告警配置为禁用,告警配置id:" + config.getId());
return
;
}
if
(
StringUtils
.
isBlank
(
config
.
getRuleConfig
()))
{
log
.
error
(
"离床告警配置未配置,告警配置id:"
+
config
.
getId
());
//
log.error("离床告警配置未配置,告警配置id:" + config.getId());
return
;
}
if
(
CollectionUtils
.
isEmpty
(
platElderList
))
{
log
.
error
(
"离床告警配置未关联长者,设备plat_id:"
+
platDevice
.
getId
());
//
log.error("离床告警配置未关联长者,设备plat_id:" + platDevice.getId());
return
;
}
// 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
());
...
...
@@ -322,7 +328,7 @@ public class OffBedAlarm implements IAlarm {
}
private
LocalDateTime
currentTime
()
{
return
LocalDateTime
.
now
().
plusHours
(
6
);
return
LocalDateTime
.
now
().
plusHours
(
12
);
// return LocalDateTime.now();
}
...
...
@@ -330,7 +336,7 @@ public class OffBedAlarm implements IAlarm {
return
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
longTime
),
ZoneOffset
.
of
(
"+8"
));
}
private
Date
toDate
(){
private
Date
toDate
()
{
ZoneId
zoneId
=
ZoneId
.
systemDefault
();
ZonedDateTime
zdt
=
currentTime
().
atZone
(
zoneId
);
return
Date
.
from
(
zdt
.
toInstant
());
...
...
server-service/src/main/java/com/makeit/service/platform/alarm/impl/PlatAlarmConfigServiceImpl.java
View file @
0e334a27
...
...
@@ -16,6 +16,7 @@ import com.makeit.enums.CodeMessageEnum;
import
com.makeit.enums.CommonEnum
;
import
com.makeit.enums.id.IdConst
;
import
com.makeit.exception.BusinessException
;
import
com.makeit.global.aspect.tenant.TenantIdIgnore
;
import
com.makeit.global.aspect.tenant.TenantIdUtil
;
import
com.makeit.mapper.platform.alarm.PlatAlarmConfigMapper
;
import
com.makeit.service.platform.alarm.PlatAlarmConfigService
;
...
...
@@ -57,6 +58,8 @@ public class PlatAlarmConfigServiceImpl extends ServiceImpl<PlatAlarmConfigMappe
private
AlarmConfigCacheUtil
alarmConfigUtil
;
@Resource
private
PlatOrgService
platOrgService
;
@Resource
private
PlatAlarmConfigMapper
configMapper
;
@Override
public
List
<
PlatAlarmConfigListVO
>
list
(
PlatAlarmConfigQueryDTO
dto
)
{
...
...
@@ -256,4 +259,10 @@ public class PlatAlarmConfigServiceImpl extends ServiceImpl<PlatAlarmConfigMappe
saveBatch
(
saveList
);
}
}
@Override
@TenantIdIgnore
public
List
<
PlatAlarmConfig
>
listOfBed
(
String
orgDeviceId
)
{
return
configMapper
.
listOffBed
(
orgDeviceId
);
}
}
server-service/src/main/resources/mappers/PlatAlarmConfigMapper.xml
View file @
0e334a27
...
...
@@ -21,4 +21,13 @@
and pehi.respiratory_exception_time != '' and pehi.respiratory_rate != '')
)
</select>
<select
id=
"listOffBed"
resultType=
"com.makeit.entity.platform.alarm.PlatAlarmConfig"
>
select *
from plat_alarm_config
where org_id in (
select org_id from plat_device where id = #{orgDeviceId} and del_flag = 0)
and alarm_type = 5 and tenant_id != 0
</select>
</mapper>
server-service/src/main/resources/mappers/PlatDeviceMapper.xml
View file @
0e334a27
...
...
@@ -62,7 +62,6 @@
<select
id=
"getDeviceIdsBySpaceIdAndElder"
resultType=
"com.makeit.vo.platform.device.PlatDeviceListVO"
>
select
distinct
pd.*,
ps.parent_path as spaceParentPath,
ps.name as spaceName,
...
...
@@ -118,6 +117,7 @@
</if>
</where>
GROUP BY pd.ori_device_id
order by pd.update_date desc,pd.id desc
</select>
...
...
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