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
7da69ca4
authored
Nov 02, 2023
by
李小龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:
parent
887b4201
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/FallAlarm.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-service/src/main/java/com/makeit/service/platform/alarm/alarmStrategy/FallAlarm.java
View file @
7da69ca4
...
...
@@ -155,7 +155,9 @@ public class FallAlarm implements IAlarm {
if
(
duration1
!=
0
)
{
alarmRedisDTO
.
setAlarm
(
CommonEnum
.
YES
.
getValue
());
RedisUtil
.
set
(
RedisConst
.
ALARM_DEVICE_BEHAVIOR_ID
+
deviceId
,
alarmRedisDTO
);
notice
(
platAlarmCheckDTO
);
PlatAlarmCheckDTO
platAlarmCheckDTO_behavior
=
BeanDtoVoUtils
.
convert
(
platAlarmCheckDTO
,
PlatAlarmCheckDTO
.
class
);
platAlarmCheckDTO_behavior
.
setPlatAlarmConfig
(
config
);
notice
(
platAlarmCheckDTO_behavior
);
}
else
{
return
;
}
...
...
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
7da69ca4
...
...
@@ -171,23 +171,28 @@ public class PushCallback implements MqttCallback {
}
@Transactional
@TenantIdIgnore
public
void
updateDeviceStatus
(
String
messageType
,
String
deviceId
,
String
iot_tenantId
)
{
if
(
StringUtils
.
equalsAnyIgnoreCase
(
messageType
,
DeviceState
.
offline
.
getValue
(),
DeviceState
.
online
.
getValue
())){
try
{
if
(
StringUtils
.
equalsAnyIgnoreCase
(
messageType
,
DeviceState
.
offline
.
getValue
(),
DeviceState
.
online
.
getValue
()))
{
platDeviceService
.
update
(
new
UpdateWrapper
<
PlatDevice
>().
lambda
()
.
set
(
PlatDevice:
:
getStatus
,
messageType
.
toLowerCase
())
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
));
platDeviceService
.
update
(
new
UpdateWrapper
<
PlatDevice
>().
lambda
()
.
set
(
PlatDevice:
:
getStatus
,
messageType
.
toLowerCase
())
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
));
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
);
List
<
PlatDevice
>
deviceList
=
platDeviceService
.
list
(
deviceLambdaQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceList
)){
return
;
}
for
(
PlatDevice
platDevice
:
deviceList
)
{
platDevice
.
setStatus
(
messageType
.
toLowerCase
());
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
);
List
<
PlatDevice
>
deviceList
=
platDeviceService
.
list
(
deviceLambdaQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
return
;
}
for
(
PlatDevice
platDevice
:
deviceList
)
{
platDevice
.
setStatus
(
messageType
.
toLowerCase
());
}
deviceCacheUtil
.
putAll
(
deviceList
);
}
deviceCacheUtil
.
putAll
(
deviceList
);
}
catch
(
Exception
e
){
logger
.
error
(
"更新设备状态:"
,
e
);
}
}
...
...
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