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
d4de4782
authored
Dec 20, 2023
by
汪志阳
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:离线删除设备
parent
eb151a19
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
6 deletions
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/OffBedAlarm.java
View file @
d4de4782
...
...
@@ -236,10 +236,13 @@ public class OffBedAlarm implements IAlarm {
return
;
}
LocalTime
localTime
=
LocalTime
.
now
().
plusHours
(
7
)
.
plusMinutes
(
30
)
;
LocalTime
localTime
=
LocalTime
.
now
().
plusHours
(
7
);
if
(!
isInTime
&&
localTime
.
isAfter
(
startTime
)
&&
localTime
.
isBefore
(
endTime
))
{
LocalDateTime
dateTime
=
LocalDateTime
.
of
(
LocalDate
.
now
(),
startTime
);
long
mills
=
Duration
.
between
(
dateTime
,
currentTime
()).
toMillis
()
/
1000
;
if
(
mills
>=
86400
)
{
mills
=
mills
-
86400
;
}
boolean
noInOverTime
=
mills
>=
duration
*
60
;
if
(
noInOverTime
)
{
platAlarmCheckDTO
.
setAbnormalValue
(
String
.
valueOf
(
currentTimeMillis
-
firstOffBedLong
));
...
...
@@ -324,7 +327,7 @@ public class OffBedAlarm implements IAlarm {
}
private
static
LocalDateTime
currentTime
()
{
return
LocalDateTime
.
now
().
plusHours
(
7
)
.
plusMinutes
(
30
)
;
return
LocalDateTime
.
now
().
plusHours
(
7
);
// return LocalDateTime.now();
}
...
...
server-service/src/main/java/com/makeit/service/platform/space/impl/PlatSpaceServiceImpl.java
View file @
d4de4782
...
...
@@ -154,7 +154,6 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
if
(
parentSpace
!=
null
&&
parentSpace
.
getParentPath
()!=
null
&&
parentSpace
.
getParentPath
().
contains
(
dto
.
getId
()))
{
throw
new
BusinessException
(
CodeMessageEnum
.
PLATFORM_ERROR_SPACE_NOT_AUTH_PARENT
);
}
// todo 编辑后层级大于4,不允许编辑 脏数据太多,待校验
checkAndUpdateSonSpace
(
space
);
this
.
updateById
(
space
);
List
<
String
>
lastSpaceIds
=
recursionLastSpaceIds
(
space
.
getId
(),
new
ArrayList
<>());
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
d4de4782
...
...
@@ -272,6 +272,11 @@ public class PushCallback implements MqttCallback {
String
alarmType
=
PlatAlarmConfigEnum
.
AlarmTypeEnum
.
OFF_BED
.
getValue
();
List
<
String
>
type
=
Lists
.
newArrayList
(
"OFFLINE"
,
"DISCONNECT"
);
platDeviceList
.
forEach
(
device
->
{
if
(
StrUtil
.
isBlank
(
messageType
)
||
type
.
contains
(
messageType
)
||
DeviceState
.
offline
.
getValue
().
equals
(
device
.
getStatus
()))
{
logger
.
info
(
"离线清除离床预警缓存!"
);
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
device
.
getId
());
}
for
(
IAlarm
alarm
:
alarmList
)
{
if
(
alarm
.
support
(
alarmType
))
{
PlatAlarmConfig
config
=
configMap
.
get
(
device
.
getOrgId
());
...
...
@@ -289,9 +294,6 @@ public class PushCallback implements MqttCallback {
platAlarmCheckDTO
.
setProperties
(
properties
);
//设备状态
platAlarmCheckDTO
.
setMessageType
(
messageType
);
if
(
StrUtil
.
isBlank
(
messageType
)
||
type
.
contains
(
messageType
))
{
RedisUtil
.
delete
(
RedisConst
.
ALARM_DEVICE_OFF_BED_ID
+
device
.
getId
());
}
alarm
.
checkConfig
(
platAlarmCheckDTO
);
}
}
...
...
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