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
b2380b31
Commit
b2380b31
authored
Jul 25, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'refs/heads/dev' into test
parents
89cf7903
97abafa3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
107 deletions
+134
-107
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+134
-107
No files found.
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
b2380b31
...
...
@@ -1636,119 +1636,146 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SOrder
order
=
getOne
(
queryWrapper
);
if
(
ObjectUtil
.
isNotEmpty
(
order
))
{
baseMapper
.
updateSOrder
(
sOrder
);
//延迟5秒
try
{
// 延迟 5 秒
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
// 如果线程被中断,这里可以处理异常
e
.
printStackTrace
();
}
logger
.
debug
(
"订单:"
+
sOrder
.
getOrderNo
()
+
"和订单:"
+
order
.
getOrderNo
()
+
"预约时间有干涉"
);
//退款
AdminRefundRequest
refundRequest
=
new
AdminRefundRequest
();
refundRequest
.
setOrderNo
(
sOrder
.
getOrderNo
());
refundRequest
.
setAmount
(
sOrder
.
getPayPrice
());
refundRequest
.
setIsClean
(
YesNoEnum
.
no
.
getIndex
());
refundRequest
.
setRefundCoupon
(
YesNoEnum
.
yes
.
getIndex
());
refundRequest
.
setRefundReason
(
"当前订单:"
+
sOrder
.
getOrderNo
()
+
"和订单:"
+
order
.
getOrderNo
()
+
"预约时间有干涉"
);
int
i
=
sOrderService
.
refundOp
(
refundRequest
);
if
(
i
==
1
)
{
sOrderService
.
removeById
(
sOrder
);
}
return
;
}
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
SRoom
room
=
roomService
.
getById
(
sOrder
.
getRoomId
());
if
(
room
.
getStatus
().
equals
(
RoomStatusEnum
.
FREE
.
getValue
()))
{
room
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
roomService
.
updateById
(
room
);
}
SCleanRecords
sCleanRecords
=
isCleanRecordsService
.
getOne
(
new
LambdaQueryWrapper
<
SCleanRecords
>()
.
eq
(
SCleanRecords:
:
getRoomId
,
sOrder
.
getRoomId
())
.
ne
(
SCleanRecords:
:
getStatus
,
CleaningStatusEnum
.
CLEANED
.
getCode
())
);
if
(
ObjectUtil
.
isNotEmpty
(
sCleanRecords
))
{
sCleanRecords
.
setStartDate
(
new
Date
());
sCleanRecords
.
setEndDate
(
new
Date
());
sCleanRecords
.
setStatus
(
CleaningStatusEnum
.
CLEANED
.
getCode
());
isCleanRecordsService
.
updateById
(
sCleanRecords
);
}
wechatNewService
.
sendMiniSubscribeMessage
(
sOrder
,
MessageReminderEnum
.
RESERVER
);
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
sOrder
.
setEndDate
(
sOrder
.
getPreEndDate
());
sOrder
.
setArrivalTime
(
new
Date
());
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
}
else
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
wechatNewService
.
sendMiniSubscribeMessage
(
sOrder
,
MessageReminderEnum
.
RESERVER
);
}
if
(
sOrder
.
getIsDelete
().
equals
(
YesNoEnum
.
yes
.
getIndex
())
&&
sOrder
.
getPayStatus
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
sOrder
.
setIsDelete
(
YesNoEnum
.
no
.
getIndex
());
}
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
baseMapper
.
updateSOrder
(
sOrder
);
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
else
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
Long
couponId
=
sOrder
.
getCouponId
();
SStore
sStore
=
storeService
.
getById
(
sOrder
.
getStoreId
());
SRoom
sRoom
=
roomService
.
getById
(
sOrder
.
getRoomId
());
if
(
couponId
!=
null
&&
couponId
>
0
)
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
couponId
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerCoupon
))
{
if
(
consumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
consumerCoupon
.
setUseDate
(
new
Date
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCouponService
.
updateById
(
consumerCoupon
);
// AdminRefundRequest refundRequest = new AdminRefundRequest();
// refundRequest.setOrderNo(sOrder.getOrderNo());
// refundRequest.setAmount(sOrder.getPayPrice());
// refundRequest.setIsClean(YesNoEnum.no.getIndex());
// refundRequest.setRefundCoupon(YesNoEnum.yes.getIndex());
// refundRequest.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
// int i = sOrderService.refundOp(refundRequest);
OrderRefundRequest
request
=
new
OrderRefundRequest
();
request
.
setOrderNo
(
sOrder
.
getOrderNo
());
request
.
setAmount
(
sOrder
.
getPayPrice
());
request
.
setApprovalStatus
(
YesNoEnum
.
yes
.
getIndex
());
request
.
setRefundReason
(
"当前订单:"
+
sOrder
.
getOrderNo
()
+
"和订单:"
+
order
.
getOrderNo
()
+
"预约时间有干涉"
);
boolean
isRefund
=
orderRefundService
.
refund
(
request
,
sOrder
);
if
(
isRefund
)
{
// 删除redis 缓存信息,防止退款订单自动开始及给用户发送提示短信
redisUtil
.
delete
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
());
redisUtil
.
delete
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
());
//查询是否有使用中的订单
LambdaQueryWrapper
<
SOrder
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
SOrder:
:
getRoomId
,
sOrder
.
getRoomId
());
wrapper
.
eq
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
INUSE
.
getCode
());
List
<
SOrder
>
list
=
baseMapper
.
selectList
(
wrapper
);
if
(
CollectionUtils
.
isEmpty
(
list
))
{
//房间断电
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
CUT_ELECTRIC
.
getCode
(),
true
,
5
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
refundExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
}
}
//续费成功语音播报
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
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"
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
//通知保洁人员
sConsumerService
.
selectListByStoreId
(
sOrder
.
getStoreId
()).
stream
().
forEach
(
item
->
{
// 循环发送短信提示门店保洁打扫卫生
smsService
.
sendSmsCleanRecordsStopRemind
(
item
.
getPhone
(),
sStore
,
sRoom
);
});
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
true
,
5L
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sOrder
);
// 订单预定成功, 发送短信通知运维客服
List
<
String
>
phones
=
new
ArrayList
<>();
SConsumerVo
sConsumer
=
new
SConsumerVo
();
sConsumer
.
setStoreId
(
sStore
.
getId
());
sConsumer
.
setPosition
(
3
);
List
<
SConsumer
>
consumers
=
sConsumerService
.
selectAllocatedList
(
sConsumer
);
if
(
consumers
.
size
()
>
0
)
{
List
<
Long
>
sconsumerIds
=
consumers
.
stream
().
map
(
SConsumer:
:
getId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
SStoreConsumer
>
consumerMap
=
storeConsumerMapper
.
selectList
(
new
LambdaQueryWrapper
<
SStoreConsumer
>()
.
in
(
SStoreConsumer:
:
getConsumerId
,
sconsumerIds
)
.
eq
(
SStoreConsumer:
:
getPosition
,
PositionEnum
.
CUSTOMER_SERVICE
.
getCode
())
.
eq
(
SStoreConsumer:
:
getStoreId
,
sOrder
.
getStoreId
())
).
stream
().
collect
(
Collectors
.
toMap
(
SStoreConsumer:
:
getConsumerId
,
Function
.
identity
()));
logger
.
debug
(
"订单预订成功通知发送开始"
);
consumers
.
forEach
(
o
->{
SStoreConsumer
sStoreConsumer
=
consumerMap
.
get
(
o
.
getId
());
if
(
ObjectUtil
.
isNotEmpty
(
sStoreConsumer
))
{
if
(
sStoreConsumer
.
getGating
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
phones
.
add
(
o
.
getPhone
());
}
if
(
sStoreConsumer
.
getController
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
//公众号发送订单预订成功通知
wechatNewService
.
sendPublicTemplateMessage
(
sOrder
,
MessageReminderEnum
.
ORDER_RESERVE
,
o
.
getId
());
}
else
{
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
SRoom
room
=
roomService
.
getById
(
sOrder
.
getRoomId
());
if
(
room
.
getStatus
().
equals
(
RoomStatusEnum
.
FREE
.
getValue
()))
{
room
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
roomService
.
updateById
(
room
);
}
SCleanRecords
sCleanRecords
=
isCleanRecordsService
.
getOne
(
new
LambdaQueryWrapper
<
SCleanRecords
>()
.
eq
(
SCleanRecords:
:
getRoomId
,
sOrder
.
getRoomId
())
.
ne
(
SCleanRecords:
:
getStatus
,
CleaningStatusEnum
.
CLEANED
.
getCode
())
);
if
(
ObjectUtil
.
isNotEmpty
(
sCleanRecords
))
{
sCleanRecords
.
setStartDate
(
new
Date
());
sCleanRecords
.
setEndDate
(
new
Date
());
sCleanRecords
.
setStatus
(
CleaningStatusEnum
.
CLEANED
.
getCode
());
isCleanRecordsService
.
updateById
(
sCleanRecords
);
}
wechatNewService
.
sendMiniSubscribeMessage
(
sOrder
,
MessageReminderEnum
.
RESERVER
);
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
sOrder
.
setEndDate
(
sOrder
.
getPreEndDate
());
sOrder
.
setArrivalTime
(
new
Date
());
sOrder
.
setStatus
(
OrderStatusEnum
.
INUSE
.
getCode
());
}
else
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
wechatNewService
.
sendMiniSubscribeMessage
(
sOrder
,
MessageReminderEnum
.
RESERVER
);
}
if
(
sOrder
.
getIsDelete
().
equals
(
YesNoEnum
.
yes
.
getIndex
())
&&
sOrder
.
getPayStatus
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
sOrder
.
setIsDelete
(
YesNoEnum
.
no
.
getIndex
());
}
creatExtracted
(
consumerWallet
,
sOrder
,
consumerMember
);
baseMapper
.
updateSOrder
(
sOrder
);
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
else
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtil
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
Long
couponId
=
sOrder
.
getCouponId
();
SStore
sStore
=
storeService
.
getById
(
sOrder
.
getStoreId
());
SRoom
sRoom
=
roomService
.
getById
(
sOrder
.
getRoomId
());
if
(
couponId
!=
null
&&
couponId
>
0
)
{
SConsumerCoupon
consumerCoupon
=
consumerCouponService
.
getById
(
couponId
);
if
(
ObjectUtil
.
isNotEmpty
(
consumerCoupon
))
{
if
(
consumerCoupon
.
getUseStatus
().
equals
(
UserStatusEnum
.
UNUSED
.
getCode
()))
{
consumerCoupon
.
setUseDate
(
new
Date
());
consumerCoupon
.
setUseStatus
(
UserStatusEnum
.
USED
.
getCode
());
consumerCouponService
.
updateById
(
consumerCoupon
);
}
}
});
smsService
.
sendSmsOrderPredetermine
(
phones
,
sOrder
,
sStore
,
sRoom
);
logger
.
debug
(
"订单预订成功通知发送结束"
);
}
//续费成功语音播报
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_SUCCESS
.
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"
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
//通知保洁人员
sConsumerService
.
selectListByStoreId
(
sOrder
.
getStoreId
()).
stream
().
forEach
(
item
->
{
// 循环发送短信提示门店保洁打扫卫生
smsService
.
sendSmsCleanRecordsStopRemind
(
item
.
getPhone
(),
sStore
,
sRoom
);
});
deviceOpService
.
openOrCloseDevice
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
true
,
5L
,
DeviceOpSourceEnum
.
DEVICE_SOURCE_20
.
getCode
());
}
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sOrder
);
// 订单预定成功, 发送短信通知运维客服
List
<
String
>
phones
=
new
ArrayList
<>();
SConsumerVo
sConsumer
=
new
SConsumerVo
();
sConsumer
.
setStoreId
(
sStore
.
getId
());
sConsumer
.
setPosition
(
3
);
List
<
SConsumer
>
consumers
=
sConsumerService
.
selectAllocatedList
(
sConsumer
);
if
(
consumers
.
size
()
>
0
)
{
List
<
Long
>
sconsumerIds
=
consumers
.
stream
().
map
(
SConsumer:
:
getId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
SStoreConsumer
>
consumerMap
=
storeConsumerMapper
.
selectList
(
new
LambdaQueryWrapper
<
SStoreConsumer
>()
.
in
(
SStoreConsumer:
:
getConsumerId
,
sconsumerIds
)
.
eq
(
SStoreConsumer:
:
getPosition
,
PositionEnum
.
CUSTOMER_SERVICE
.
getCode
())
.
eq
(
SStoreConsumer:
:
getStoreId
,
sOrder
.
getStoreId
())
).
stream
().
collect
(
Collectors
.
toMap
(
SStoreConsumer:
:
getConsumerId
,
Function
.
identity
()));
logger
.
debug
(
"订单预订成功通知发送开始"
);
consumers
.
forEach
(
o
->
{
SStoreConsumer
sStoreConsumer
=
consumerMap
.
get
(
o
.
getId
());
if
(
ObjectUtil
.
isNotEmpty
(
sStoreConsumer
))
{
if
(
sStoreConsumer
.
getGating
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
phones
.
add
(
o
.
getPhone
());
}
if
(
sStoreConsumer
.
getController
().
equals
(
YesNoEnum
.
yes
.
getIndex
()))
{
//公众号发送订单预订成功通知
wechatNewService
.
sendPublicTemplateMessage
(
sOrder
,
MessageReminderEnum
.
ORDER_RESERVE
,
o
.
getId
());
}
}
});
smsService
.
sendSmsOrderPredetermine
(
phones
,
sOrder
,
sStore
,
sRoom
);
logger
.
debug
(
"订单预订成功通知发送结束"
);
}
}
}
...
...
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