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
5248fa5c
authored
Nov 03, 2023
by
huangjy
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix:修复bug
parent
4ea26e5f
Show 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/device/PlatDeviceService.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
server-service/src/main/java/com/makeit/service/platform/device/PlatDeviceService.java
View file @
5248fa5c
...
@@ -74,5 +74,5 @@ public interface PlatDeviceService extends IService<PlatDevice> {
...
@@ -74,5 +74,5 @@ public interface PlatDeviceService extends IService<PlatDevice> {
void
batchEditProperties
(
PlatDeviceAttrDTO
dto
);
void
batchEditProperties
(
PlatDeviceAttrDTO
dto
);
void
updateDeviceStatus
(
String
messageType
,
String
deviceId
,
String
iot_tenantId
);
boolean
updateDeviceStatus
(
String
messageType
,
String
deviceId
,
String
iot_tenantId
);
}
}
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
5248fa5c
...
@@ -607,7 +607,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -607,7 +607,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
@Override
@Override
@TenantIdIgnore
@TenantIdIgnore
public
void
updateDeviceStatus
(
String
messageType
,
String
deviceId
,
String
iot_tenantId
)
{
public
boolean
updateDeviceStatus
(
String
messageType
,
String
deviceId
,
String
iot_tenantId
)
{
try
{
try
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
equalsAnyIgnoreCase
(
messageType
,
com
.
makeit
.
module
.
iot
.
enums
.
DeviceState
.
offline
.
getValue
(),
com
.
makeit
.
module
.
iot
.
enums
.
DeviceState
.
online
.
getValue
()))
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
equalsAnyIgnoreCase
(
messageType
,
com
.
makeit
.
module
.
iot
.
enums
.
DeviceState
.
offline
.
getValue
(),
com
.
makeit
.
module
.
iot
.
enums
.
DeviceState
.
online
.
getValue
()))
{
...
@@ -618,16 +618,17 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
...
@@ -618,16 +618,17 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
);
deviceLambdaQueryWrapper
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
);
List
<
PlatDevice
>
deviceList
=
list
(
deviceLambdaQueryWrapper
);
List
<
PlatDevice
>
deviceList
=
list
(
deviceLambdaQueryWrapper
);
if
(
CollectionUtils
.
isEmpty
(
deviceList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
deviceList
))
{
return
;
}
for
(
PlatDevice
platDevice
:
deviceList
)
{
for
(
PlatDevice
platDevice
:
deviceList
)
{
platDevice
.
setStatus
(
messageType
.
toLowerCase
());
platDevice
.
setStatus
(
messageType
.
toLowerCase
());
}
}
deviceCacheUtil
.
putAll
(
deviceList
);
deviceCacheUtil
.
putAll
(
deviceList
);
}
}
return
true
;
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"更新设备状态:"
,
e
);
log
.
error
(
"更新设备状态:"
,
e
);
}
}
return
false
;
}
}
}
}
server-web/src/main/java/com/makeit/mqtt/PushCallback.java
View file @
5248fa5c
...
@@ -116,7 +116,10 @@ public class PushCallback implements MqttCallback {
...
@@ -116,7 +116,10 @@ public class PushCallback implements MqttCallback {
String
deviceId
=
device
.
getDeviceId
();
String
deviceId
=
device
.
getDeviceId
();
String
messageType
=
device
.
getMessageType
();
String
messageType
=
device
.
getMessageType
();
//更新设备状态
//更新设备状态
platDeviceService
.
updateDeviceStatus
(
messageType
,
deviceId
,
""
);
boolean
statusFlag
=
platDeviceService
.
updateDeviceStatus
(
messageType
,
deviceId
,
""
);
if
(
statusFlag
)
{
return
;
}
for
(
HeaderInfo
.
Bind
binding
:
bindings
)
{
for
(
HeaderInfo
.
Bind
binding
:
bindings
)
{
try
{
try
{
String
iot_tenantId
=
binding
.
getId
();
String
iot_tenantId
=
binding
.
getId
();
...
...
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