Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
41d6f23d
Commit
41d6f23d
authored
Jan 27, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序设备管理增加延时5秒
parent
e1c32830
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
17 deletions
+6
-17
DeviceController.java
...in/java/share/web/controller/system/DeviceController.java
+6
-17
No files found.
share-front/src/main/java/share/web/controller/system/DeviceController.java
View file @
41d6f23d
...
@@ -9,6 +9,7 @@ import share.common.core.controller.BaseController;
...
@@ -9,6 +9,7 @@ import share.common.core.controller.BaseController;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.domain.AjaxResult
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.common.enums.OpTypeEnum
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.PositionEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.utils.SecurityUtils
;
import
share.common.utils.SecurityUtils
;
...
@@ -20,10 +21,7 @@ import share.system.domain.vo.FrontTokenComponent;
...
@@ -20,10 +21,7 @@ import share.system.domain.vo.FrontTokenComponent;
import
share.system.domain.vo.MqttxVo
;
import
share.system.domain.vo.MqttxVo
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.mapper.SStoreConsumerMapper
;
import
share.system.mqtt.MqttGatewayComponent
;
import
share.system.mqtt.MqttGatewayComponent
;
import
share.system.service.DeviceLogService
;
import
share.system.service.*
;
import
share.system.service.DeviceService
;
import
share.system.service.MqttxService
;
import
share.system.service.SConsumerService
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,15 +36,12 @@ import java.util.List;
...
@@ -38,15 +36,12 @@ import java.util.List;
@RequestMapping
(
"/device"
)
@RequestMapping
(
"/device"
)
public
class
DeviceController
extends
BaseController
{
public
class
DeviceController
extends
BaseController
{
@Autowired
@Autowired
private
MqttxService
mqttxService
;
private
DeviceOpService
deviceOpService
;
@Autowired
private
DeviceLogService
deviceLogService
;
@Autowired
private
MqttGatewayComponent
mqttGatewayComponent
;
@Autowired
@Autowired
private
SConsumerService
consumerService
;
private
SConsumerService
consumerService
;
@Autowired
@Autowired
private
SStoreConsumerMapper
storeConsumerMapper
;
private
SStoreConsumerMapper
storeConsumerMapper
;
private
static
final
long
FIVE
=
5
;
/**
/**
...
@@ -62,14 +57,8 @@ public class DeviceController extends BaseController {
...
@@ -62,14 +57,8 @@ public class DeviceController extends BaseController {
if
(
CollectionUtils
.
isEmpty
(
longs
))
{
if
(
CollectionUtils
.
isEmpty
(
longs
))
{
throw
new
RuntimeException
(
"当前用户不是管理员"
);
throw
new
RuntimeException
(
"当前用户不是管理员"
);
}
}
// 获取mqtt的topic、payload
deviceOpService
.
openOrCloseDevice
(
deviceParam
.
getRoomId
(),
user
.
getPhone
(),
deviceParam
.
getOpType
(),
true
,
FIVE
);
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
deviceParam
.
getDevId
(),
return
toAjax
(
true
);
user
.
getAccount
(),
deviceParam
.
getOpType
());
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
int
result
=
deviceLogService
.
addDeviceLog
(
mqttxVo
,
user
.
getAccount
());
return
toAjax
(
result
);
}
}
}
}
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