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
067657db
authored
Dec 18, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:去除日志打印
parent
ebc05efb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
20 deletions
server-module/src/main/java/com/makeit/module/controller/wechat/alarm/PlatAlarmRecordWechatController.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
server-module/src/main/java/com/makeit/module/controller/wechat/alarm/PlatAlarmRecordWechatController.java
View file @
067657db
...
...
@@ -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/service/platform/alarm/alarmStrategy/OffBedAlarm.java
View file @
067657db
package
com
.
makeit
.
service
.
platform
.
alarm
.
alarmStrategy
;
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
;
...
...
@@ -60,26 +59,26 @@ public class OffBedAlarm implements IAlarm {
}
PlatAlarmConfig
config
=
alarmConfigCacheUtil
.
get
(
platDevice
.
getOrgId
(),
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
OFF_BED
.
getValue
());
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,7 +89,7 @@ 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
...
...
@@ -101,7 +100,6 @@ public class OffBedAlarm implements IAlarm {
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!"
);
...
...
@@ -122,7 +120,7 @@ public class OffBedAlarm implements IAlarm {
Long
firstOffBedLong
=
alarmRedisDTO
.
getStartLong
();
LocalDateTime
firstOffBedTime
=
longToTime
(
firstOffBedLong
);
log
.
info
(
"离床
告
警第一次离床时间为:"
+
firstOffBedTime
);
log
.
info
(
"离床
预
警第一次离床时间为:"
+
firstOffBedTime
);
if
(
"1"
.
equals
(
alarmRedisDTO
.
getAlarm
()))
{
log
.
info
(
"离床告警已发送预警过!"
);
return
;
...
...
@@ -197,9 +195,6 @@ public class OffBedAlarm implements IAlarm {
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
();
...
...
@@ -286,23 +281,23 @@ 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
;
}
//
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
());
...
...
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