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
0bffcdb7
Commit
0bffcdb7
authored
Nov 30, 2023
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
延时执行开门关门取电接口
parent
66bae630
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
9 deletions
+29
-9
DeviceOpService.java
...m/src/main/java/share/system/service/DeviceOpService.java
+2
-2
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+25
-5
SConsumerMapper.xml
...stem/src/main/resources/mapper/system/SConsumerMapper.xml
+2
-2
No files found.
share-system/src/main/java/share/system/service/DeviceOpService.java
View file @
0bffcdb7
...
...
@@ -12,13 +12,13 @@ import share.system.domain.vo.MqttxVo;
public
interface
DeviceOpService
{
/**
* 小程序订单开门
* 小程序订单开门
、通电
* @param deviceParam
*/
void
openDoor
(
DeviceParamVo
deviceParam
);
/**
* 小程序订单开门
* 小程序订单开门
、通电
* @param roomId 房间id
* @param phone 操作用户
*/
...
...
share-system/src/main/java/share/system/service/impl/DeviceOpServiceImpl.java
View file @
0bffcdb7
...
...
@@ -56,11 +56,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"10"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"10"
,
false
,
0L
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
,
true
,
2L
);
}
}
...
...
@@ -81,24 +81,44 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
,
false
,
0L
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
,
true
,
2L
);
}
}
}
}
private
void
deviceOpInit
(
String
devId
,
String
phone
,
String
opType
)
{
private
void
deviceOpInit
(
String
devId
,
String
phone
,
String
opType
,
boolean
isASync
,
long
m
)
{
if
(
isASync
)
{
// 异步执行
CompletableFuture
.
supplyAsync
(()
->
{
// 延时执行操作
try
{
Thread
.
sleep
(
m
*
1000
);
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
devId
,
phone
,
opType
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
,
phone
);
logger
.
info
(
"延时执行开门、取电操作完成!"
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
return
"Result: devId="
+
devId
;
});
}
else
{
// 获取mqtt的topic、payload
MqttxVo
mqttxVo
=
mqttxService
.
openOrCloseDevice
(
devId
,
phone
,
opType
);
// 发送mqtt消息
mqttGatewayComponent
.
sendToMqtt
(
mqttxVo
.
getTopic
(),
0
,
mqttxVo
.
getPayload
());
// 写日志记录
deviceLogService
.
addDeviceLog
(
mqttxVo
,
phone
);
}
}
/**
...
...
share-system/src/main/resources/mapper/system/SConsumerMapper.xml
View file @
0bffcdb7
...
...
@@ -66,8 +66,8 @@
select t1.id, t1.account, t1.nick_name, t1.avatar, t1.phone, t1.level, t1.role_type, t1.sex, t1.addres, t1.amount,
t1.free_amount, t1.total_times, t1.duration, t1.status, t1.pwd, t1.create_time, t1.last_login_time
from s_consumer t1
left join s_store_consumer t2 on t2.consumer_id = t1.id
where t1.role_type = '1'
and t1.id not in (select consumer_id from s_store_consumer where store_id = #{storeId})
where t1.role_type = '1'
and t1.id not in (select consumer_id from s_store_consumer where store_id = #{storeId})
<if
test=
"nickName != null and nickName != ''"
>
AND t1.nick_name like concat('%', #{nickName}, '%')
</if>
...
...
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