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
9c792fbc
authored
Feb 05, 2024
by
罗志长
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix: 平台设备故障状态
parent
f7df7f06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletions
server-common/src/main/java/com/makeit/module/iot/vo/DeviceFaultState.java
server-common/src/main/java/com/makeit/module/iot/vo/DeviceInstanceEntity.java
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
server-common/src/main/java/com/makeit/module/iot/vo/DeviceFaultState.java
0 → 100644
View file @
9c792fbc
package
com
.
makeit
.
module
.
iot
.
vo
;
import
lombok.Data
;
@Data
public
class
DeviceFaultState
{
private
String
text
;
private
String
value
;
}
server-common/src/main/java/com/makeit/module/iot/vo/DeviceInstanceEntity.java
View file @
9c792fbc
...
...
@@ -48,6 +48,13 @@ public class DeviceInstanceEntity {
private
String
state
;
@Schema
(
description
=
"故障状态(只读) normal(正常), abnormal(故障)"
,
accessMode
=
Schema
.
AccessMode
.
READ_ONLY
,
defaultValue
=
"normal"
)
private
String
faultState
;
@Schema
(
description
=
"创建者ID(只读)"
,
accessMode
=
Schema
.
AccessMode
.
READ_ONLY
)
...
...
server-service/src/main/java/com/makeit/service/platform/device/impl/PlatDeviceServiceImpl.java
View file @
9c792fbc
...
...
@@ -951,6 +951,12 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
DeviceState
deviceState
=
JSON
.
parseObject
(
state
,
DeviceState
.
class
);
platDevice
.
setStatus
(
deviceState
.
getValue
());
String
faultState
=
iotDevice
.
getFaultState
();
DeviceFaultState
deviceFaultState
=
JSON
.
parseObject
(
faultState
,
DeviceFaultState
.
class
);
if
(
com
.
makeit
.
module
.
iot
.
enums
.
DeviceState
.
abnormal
.
getValue
().
equals
(
deviceFaultState
.
getValue
()))
{
platDevice
.
setStatus
(
deviceFaultState
.
getValue
());
}
String
categoryName
=
DeviceNameEnum
.
getNameByPrefix
(
productName
);
platDevice
.
setCategory
(
dicNameIdMap
.
get
(
categoryName
));
...
...
@@ -968,7 +974,8 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
update
(
new
UpdateWrapper
<
PlatDevice
>().
lambda
()
.
set
(
PlatDevice:
:
getStatus
,
messageType
.
toLowerCase
())
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
));
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
)
.
ne
(
PlatDevice:
:
getStatus
,
com
.
makeit
.
module
.
iot
.
enums
.
DeviceState
.
abnormal
.
getValue
()));
LambdaQueryWrapper
<
PlatDevice
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
);
...
...
@@ -1210,6 +1217,8 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
return
;
}
RedisUtil
.
set
(
key
,
faultState
);
this
.
update
(
new
UpdateWrapper
<
PlatDevice
>().
lambda
()
.
set
(
PlatDevice:
:
getStatus
,
"abnormal"
).
eq
(
PlatDevice:
:
getOriDeviceId
,
deviceId
));
log
.
info
(
"设备:{} 故障处理, 设置故障"
,
deviceId
);
}
}
else
{
...
...
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