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
74b5e660
Commit
74b5e660
authored
Nov 30, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单结束增加断电操作
parent
15aa66e6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
8 deletions
+51
-8
OpTypeEnum.java
...e-common/src/main/java/share/common/enums/OpTypeEnum.java
+35
-0
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+7
-1
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+2
-1
DeviceOpServiceImpl.java
...n/java/share/system/service/impl/DeviceOpServiceImpl.java
+7
-6
No files found.
share-common/src/main/java/share/common/enums/OpTypeEnum.java
0 → 100644
View file @
74b5e660
package
share
.
common
.
enums
;
public
enum
OpTypeEnum
{
//10:开门,20:取电,30:锁门,40:断电
OPEN_DOOR
(
"10"
,
"开门"
),
GET_ELECTRIC
(
"20"
,
"取电"
),
LOCK_DOOR
(
"30"
,
"锁门"
),
CUT_ELECTRIC
(
"40"
,
"断电"
);
private
String
code
;
private
String
name
;
OpTypeEnum
()
{
}
OpTypeEnum
(
String
code
,
String
name
)
{
this
.
code
=
code
;
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
}
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
74b5e660
...
...
@@ -59,6 +59,11 @@ public class OrderTask {
@Autowired
private
RedisUtil
redisUtils
;
@Autowired
private
DeviceOpService
deviceOpService
;
final
int
ZERO
=
0
;
public
void
autoCancel
()
{
String
redisKey
=
Constants
.
ORDER_AUTO_CANCEL_KEY
;
Long
size
=
redisUtil
.
getListSize
(
redisKey
);
...
...
@@ -230,10 +235,11 @@ public class OrderTask {
room
.
setUpdateTime
(
new
Date
());
}
});
//到达预定时间进行通电
deviceOpService
.
openOrCloseDevice
(
item
.
getRoomId
(),
item
.
getConsumerPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
false
,
ZERO
);
}
});
Boolean
execute
=
transactionTemplate
.
execute
(
e
->
{
//TODO 取电开始
orderService
.
updateBatchById
(
sOrders
,
sOrders
.
size
());
roomService
.
updateBatchById
(
roomList
,
roomList
.
size
());
return
true
;
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
74b5e660
...
...
@@ -161,7 +161,8 @@ public class RedisTask {
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
SEND_CUSTOMER
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
//延时5分钟断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
FIVE_MINUTES
);
}
}
});
...
...
share-system/src/main/java/share/system/service/impl/DeviceOpServiceImpl.java
View file @
74b5e660
...
...
@@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.DeviceType
;
import
share.common.enums.OpTypeEnum
;
import
share.common.utils.SecurityUtils
;
import
share.system.mqtt.MqttGatewayComponent
;
import
share.system.domain.Device
;
...
...
@@ -56,11 +57,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"
,
false
,
0L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
OpTypeEnum
.
OPEN_DOOR
.
getCode
()
,
false
,
0L
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
"20"
,
true
,
2L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
deviceParam
.
getPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
()
,
true
,
2L
);
}
}
...
...
@@ -81,11 +82,11 @@ public class DeviceOpServiceImpl implements DeviceOpService {
for
(
Device
device
:
list
)
{
if
(
DeviceType
.
DEVICE_CCEE
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 门锁
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"10"
,
false
,
0L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
OpTypeEnum
.
OPEN_DOOR
.
getCode
()
,
false
,
0L
);
}
if
(
DeviceType
.
DEVICE_0001
.
getCode
().
equals
(
device
.
getDevType
()))
{
// 取电开关
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
"20"
,
true
,
3L
);
this
.
deviceOpInit
(
device
.
getDevId
(),
phone
,
OpTypeEnum
.
GET_ELECTRIC
.
getCode
()
,
true
,
3L
);
}
}
...
...
@@ -236,9 +237,9 @@ public class DeviceOpServiceImpl implements DeviceOpService {
if
(
room
!=
null
)
{
LambdaQueryWrapper
<
Device
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
Device:
:
getRoomId
,
room
.
getId
());
if
(
"10"
.
equals
(
opType
)
||
"30"
.
equals
(
opType
))
{
if
(
OpTypeEnum
.
OPEN_DOOR
.
getCode
().
equals
(
opType
)
||
OpTypeEnum
.
LOCK_DOOR
.
getCode
()
.
equals
(
opType
))
{
queryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_CCEE
.
getCode
());
}
else
if
(
"20"
.
equals
(
opType
)
||
"40"
.
equals
(
opType
))
{
}
else
if
(
OpTypeEnum
.
GET_ELECTRIC
.
getCode
().
equals
(
opType
)
||
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
()
.
equals
(
opType
))
{
queryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_0001
.
getCode
());
}
else
{
return
;
...
...
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