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
da96900c
Commit
da96900c
authored
Nov 29, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
订单自动开始增加取电功能
parent
75068b31
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
18 deletions
+49
-18
VoiceEnum.java
share-common/src/main/java/share/common/enums/VoiceEnum.java
+9
-9
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+1
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+13
-5
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+26
-4
No files found.
share-common/src/main/java/share/common/enums/VoiceEnum.java
View file @
da96900c
...
...
@@ -2,29 +2,29 @@ package share.common.enums;
public
enum
VoiceEnum
{
//开门欢迎,续费提醒1,续费提醒2,续费成功提醒,送客
OPEN
(
1
,
"开门欢迎"
,
",您的好运时刻已开启,弘扬国粹文化,牌不落地,永不放弃,祝您玩的开心,找客服关注凑角微信小程序"
),
RENEWAL_REMINDER1
(
2
,
"续费提醒1"
,
"您的房间使用时间还剩15分钟,继续使用,请在小程序进行续单,或联系客服。"
),
RENEWAL_REMINDER2
(
3
,
"续费提醒2"
,
"您的房间使用时间还剩5分钟,系统届时会自动断电,提前拿好随身物品;继续使用,请在小程序进行续单,或联系客服"
),
RENEWAL_SUCCESS
(
4
,
"续费成功提醒"
,
"您的房间已成功续订,祝您玩的开心,找客服关注凑角微信小程序"
),
SEND_CUSTOMER
(
5
,
"送客"
,
",您的满意是我们最大的动力,联系客服,送您小惊喜,期待下一次的相遇"
);
private
Integer
code
;
OPEN
(
"1"
,
"开门欢迎"
,
",您的好运时刻已开启,弘扬国粹文化,牌不落地,永不放弃,祝您玩的开心,找客服关注凑角微信小程序"
),
RENEWAL_REMINDER1
(
"2"
,
"续费提醒1"
,
"您的房间使用时间还剩15分钟,继续使用,请在小程序进行续单,或联系客服。"
),
RENEWAL_REMINDER2
(
"3"
,
"续费提醒2"
,
"您的房间使用时间还剩5分钟,系统届时会自动断电,提前拿好随身物品;继续使用,请在小程序进行续单,或联系客服"
),
RENEWAL_SUCCESS
(
"4"
,
"续费成功提醒"
,
"您的房间已成功续订,祝您玩的开心,找客服关注凑角微信小程序"
),
SEND_CUSTOMER
(
"5"
,
"送客"
,
",您的满意是我们最大的动力,联系客服,送您小惊喜,期待下一次的相遇"
);
private
String
code
;
private
String
name
;
private
String
value
;
VoiceEnum
()
{
}
VoiceEnum
(
Integer
code
,
String
name
,
String
value
)
{
VoiceEnum
(
String
code
,
String
name
,
String
value
)
{
this
.
code
=
code
;
this
.
name
=
name
;
this
.
value
=
value
;
}
public
Integer
getCode
()
{
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
...
...
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
da96900c
...
...
@@ -233,6 +233,7 @@ public class OrderTask {
}
});
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 @
da96900c
...
...
@@ -47,6 +47,14 @@ public class RedisTask {
@Autowired
private
DeviceOpService
deviceOpService
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
//14分钟的常量
final
long
FOURTEEN_MINUTES
=
60
*
14
;
//5分钟的常量
final
long
FIVE_MINUTES
=
60
*
5
;
//4分钟的常量
final
long
FOUR_MINUTES
=
60
*
4
;
public
void
AuToReceiptCode
()
{
...
...
@@ -98,14 +106,14 @@ public class RedisTask {
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
//判断时间是否在15分钟到14分钟
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
if
(
expire
<
60
*
15
&&
expire
>
60
*
14
)
{
if
(
expire
<
FIFTEEN_MINUTES
&&
expire
>
FOURTEEN_MINUTES
)
{
//语音
getResult
(
o
,
jsonObject
,
VoiceEnum
.
RENEWAL_REMINDER1
.
get
Valu
e
());
getResult
(
o
,
jsonObject
,
VoiceEnum
.
RENEWAL_REMINDER1
.
get
Cod
e
());
return
;
}
//判断时间是否在5分钟到4分钟
if
(
expire
<
60
*
5
&&
expire
>
60
*
4
)
{
getResult
(
o
,
jsonObject
,
VoiceEnum
.
RENEWAL_REMINDER2
.
get
Valu
e
());
if
(
expire
<
FIVE_MINUTES
&&
expire
>
FOUR_MINUTES
)
{
getResult
(
o
,
jsonObject
,
VoiceEnum
.
RENEWAL_REMINDER2
.
get
Cod
e
());
return
;
}
...
...
@@ -150,7 +158,7 @@ public class RedisTask {
if
(
b
)
{
//删除redis中的值
redisUtil
.
delete
(
o
);
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
SEND_CUSTOMER
.
get
Valu
e
(),
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
SEND_CUSTOMER
.
get
Cod
e
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
da96900c
...
...
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.ObjectUtils
;
import
share.common.constant.Constants
;
import
share.common.core.redis.RedisUtil
;
...
...
@@ -289,6 +290,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
}
@Override
@Transactional
public
OrderPayResultResponse
createOrder
(
CreateOrderRequest
request
)
{
SConsumer
user
=
FrontTokenComponent
.
getWxSConsumerEntry
();
if
(
ObjectUtil
.
isNull
(
user
))
{
...
...
@@ -332,6 +334,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumptionRecords
.
setSign
(
SignEnum
.
BURDEN
.
getValue
());
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sConsumptionRecords
);
}
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
sOrder
.
setEndDate
(
sOrder
.
getPreEndDate
());
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
save
(
sOrder
);
return
response
;
}
...
...
@@ -607,6 +619,16 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public
void
paymentSuccessful
(
SOrder
sOrder
)
{
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
sOrder
.
setEndDate
(
sOrder
.
getPreEndDate
());
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
baseMapper
.
updateById
(
sOrder
);
Long
couponId
=
sOrder
.
getCouponId
();
if
(
couponId
!=
null
&&
couponId
>
0
)
{
...
...
@@ -807,12 +829,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
ObjectUtils
.
isEmpty
(
device2
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
SStore
sStore
=
storeService
.
getById
(
sOrder
.
getStoreId
());
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
"1"
,
//取电,语音
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
OPEN
.
getCode
(),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
cn
.
hutool
.
core
.
date
.
DateUtil
.
format
(
cn
.
hutool
.
core
.
date
.
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
//查询非当前用户,预约时间或使用时间为当前时间的订单,如果存在,房间不可开门
//开门
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
}
else
{
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
}
...
...
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