Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart-office-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
smart-office-platform
Commits
55c7d33d
Commit
55c7d33d
authored
Jun 01, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加设备上线下线通知
parent
ad20dfa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
smart-office-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceCallbackController.java
...a/com/mortals/xhx/busiz/web/DeviceCallbackController.java
+30
-1
smart-office-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
...a/com/mortals/xhx/module/device/web/DeviceController.java
+0
-2
No files found.
smart-office-manager/src/main/java/com/mortals/xhx/busiz/web/DeviceCallbackController.java
View file @
55c7d33d
...
...
@@ -59,6 +59,12 @@ public class DeviceCallbackController {
case
STOP:
deviceStop
(
req
);
break
;
case
ONLINE:
deviceOnline
(
req
);
break
;
case
OFFLINE:
deviceOffline
(
req
);
break
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"接收数据失败"
,
e
);
...
...
@@ -105,7 +111,7 @@ public class DeviceCallbackController {
if
(
ObjectUtils
.
isEmpty
(
deviceEntity
))
{
//不存在设备 则新增
this
.
deviceAdd
(
req
);
}
else
{
}
else
{
log
.
info
(
"设备更新~"
);
deviceEntity
.
setDeviceName
(
req
.
getDeviceName
());
deviceEntity
.
setDeviceCode
(
req
.
getDeviceCode
());
...
...
@@ -175,6 +181,29 @@ public class DeviceCallbackController {
deviceService
.
update
(
deviceEntity
);
}
private
void
deviceOnline
(
DeviceReq
req
)
throws
AppException
{
log
.
info
(
"【设备上线】【请求体】--> "
+
JSONObject
.
toJSONString
(
req
));
DeviceEntity
deviceEntity
=
checkDeviceExist
(
req
);
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
在线
.
getValue
());
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
1L
);
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
1L
);
deviceService
.
update
(
deviceEntity
);
}
private
void
deviceOffline
(
DeviceReq
req
)
throws
AppException
{
log
.
info
(
"【设备离线】【请求体】--> "
+
JSONObject
.
toJSONString
(
req
));
DeviceEntity
deviceEntity
=
checkDeviceExist
(
req
);
deviceEntity
.
setDeviceStatus
(
DeviceStatusEnum
.
离线
.
getValue
());
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
1L
);
deviceEntity
.
setUpdateTime
(
new
Date
());
deviceEntity
.
setUpdateUserId
(
1L
);
deviceService
.
update
(
deviceEntity
);
}
private
DeviceEntity
checkDeviceExist
(
DeviceReq
req
)
{
if
(
ObjectUtils
.
isEmpty
(
req
.
getDeviceCode
()))
{
throw
new
AppException
(
DEVICE_CODE_IS_EMPTY
,
DEVICE_CODE_IS_EMPTY_CONTENT
);
...
...
smart-office-manager/src/main/java/com/mortals/xhx/module/device/web/DeviceController.java
View file @
55c7d33d
...
...
@@ -188,8 +188,6 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
condition
.
setDeviceId
(
entity
.
getId
());
roomDeviceService
.
getDao
().
delete
(
condition
);
}
}
private
String
getToken
()
{
...
...
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