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
f194f8f5
Commit
f194f8f5
authored
Aug 15, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注销订单回调退款
parent
3db8e819
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
64 deletions
+68
-64
logback.xml
share-admin/src/main/resources/logback.xml
+1
-1
ConsumerWalletServiceImpl.java
.../share/system/service/impl/ConsumerWalletServiceImpl.java
+1
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+66
-62
No files found.
share-admin/src/main/resources/logback.xml
View file @
f194f8f5
...
...
@@ -27,7 +27,7 @@
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<!-- 过滤的级别 -->
<level>
INFO
</level>
<level>
DEBUG
</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>
ACCEPT
</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
...
...
share-system/src/main/java/share/system/service/impl/ConsumerWalletServiceImpl.java
View file @
f194f8f5
...
...
@@ -194,7 +194,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
logger
.
debug
(
"修改会员用户"
);
BigDecimal
balance
=
consumerWallet
.
getBalance
().
add
(
recharge
.
getRechargeAmount
());
if
(
rechargeConf
.
getGiveType
().
contains
(
GiveTypeEnum
.
AMOUNT
.
getIndex
()))
{
balance
.
add
(
rechargeConf
.
getGiveAmount
());
balance
=
balance
.
add
(
rechargeConf
.
getGiveAmount
());
consumerWallet
.
setBalance
(
balance
);
}
else
{
consumerWallet
.
setBalance
(
balance
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
f194f8f5
...
...
@@ -362,7 +362,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
HashMap
<
String
,
Object
>
summedPrice
=
baseMapper
.
sumPrice
(
sOrder
);
List
<
Long
>
ids
=
sOrderVos
.
stream
().
map
(
SOrderVo:
:
getCouponId
).
collect
(
Collectors
.
toList
());
Map
<
Long
,
SConsumerCoupon
>
couponMap
=
new
HashMap
<>();
SConsumerCoupon
sConsumerCoupon
=
n
ew
SConsumerCoupon
()
;
SConsumerCoupon
sConsumerCoupon
=
n
ull
;
if
(
CollectionUtils
.
isNotEmpty
(
ids
))
{
couponMap
=
consumerCouponService
.
listByIds
(
ids
)
.
stream
().
collect
(
Collectors
.
toMap
(
SConsumerCoupon:
:
getId
,
s
->
s
));
...
...
@@ -401,7 +401,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
tableDataInfo
.
setTotalRealRefundAmount
(
BigDecimal
.
ZERO
);
}
tableDataInfo
.
setTotalSalesAmount
(
ObjectUtil
.
isNotEmpty
(
sConsumerCoupon
.
getCouponPayPrice
())
?
sConsumerCoupon
.
getCouponPayPrice
()
:
BigDecimal
.
ZERO
);
if
(
ObjectUtil
.
isNotEmpty
(
sConsumerCoupon
))
{
tableDataInfo
.
setTotalSalesAmount
(
sConsumerCoupon
.
getCouponPayPrice
());
}
else
{
tableDataInfo
.
setTotalSalesAmount
(
BigDecimal
.
ZERO
);
}
return
tableDataInfo
;
...
...
@@ -1817,65 +1821,65 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
unLockOrder
(
sOrder
.
getRoomId
());
ConsumerWallet
consumerWallet
=
consumerWalletService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerWallet
>().
eq
(
ConsumerWallet:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
ConsumerMember
consumerMember
=
consumerMemberService
.
getOne
(
new
LambdaQueryWrapper
<
ConsumerMember
>().
eq
(
ConsumerMember:
:
getConsumerId
,
sOrder
.
getConsumerId
()));
logger
.
debug
(
"订单查询预约时间是否干涉"
);
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
ne
(
SOrder:
:
getOrderNo
,
sOrder
.
getOrderNo
());
queryWrapper
.
eq
(
SOrder:
:
getOrderType
,
OrderTypeEnum
.
RESERVER
.
getCode
());
queryWrapper
.
eq
(
SOrder:
:
getPayStatus
,
YesNoEnum
.
yes
.
getIndex
());
queryWrapper
.
notIn
(
SOrder:
:
getRefundStatus
,
RefundStatusEnum
.
getRefundedStatus
());
queryWrapper
.
in
(
SOrder:
:
getStatus
,
OrderStatusEnum
.
getUnfinishOrderStatus
());
queryWrapper
.
eq
(
SOrder:
:
getIsDelete
,
YesNoEnum
.
no
.
getIndex
());
queryWrapper
.
eq
(
SOrder:
:
getStoreId
,
sOrder
.
getStoreId
());
queryWrapper
.
eq
(
SOrder:
:
getRoomId
,
sOrder
.
getRoomId
());
queryWrapper
.
apply
(
"(IFNULL(start_date,pre_start_date) BETWEEN '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
sOrder
.
getPreStartDate
())
+
"' AND '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
DateUtils
.
addMinutes
(
sOrder
.
getPreEndDate
(),
Constants
.
ROOM_LOCK_DELAY_MINUTE
))
+
"' "
+
"OR IFNULL(end_date,pre_end_date) BETWEEN '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
DateUtils
.
addMinutes
(
sOrder
.
getPreStartDate
(),
-
Constants
.
ROOM_LOCK_DELAY_MINUTE
))
+
"' AND '"
+
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH_MM_SS
,
sOrder
.
getPreEndDate
())
+
"' )"
);
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);
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
);
}
}
else
{
//
logger.debug("订单查询预约时间是否干涉");
//
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
//
queryWrapper.ne(SOrder::getOrderNo, sOrder.getOrderNo());
//
queryWrapper.eq(SOrder::getOrderType, OrderTypeEnum.RESERVER.getCode());
//
queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
//
queryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
//
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
//
queryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
//
queryWrapper.eq(SOrder::getStoreId, sOrder.getStoreId());
//
queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
//
queryWrapper.apply("(IFNULL(start_date,pre_start_date) BETWEEN '"
//
+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sOrder.getPreStartDate())
//
+ "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(sOrder.getPreEndDate(), Constants.ROOM_LOCK_DELAY_MINUTE)) + "' " +
//
"OR IFNULL(end_date,pre_end_date) BETWEEN '"
//
+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(sOrder.getPreStartDate(), -Constants.ROOM_LOCK_DELAY_MINUTE))
//
+ "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sOrder.getPreEndDate()) + "' )");
//
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);
//
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);
//
}
//
} else {
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
SRoom
room
=
roomService
.
getById
(
sOrder
.
getRoomId
());
...
...
@@ -1990,7 +1994,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
smsService
.
sendSmsOrderPredetermine
(
phones
,
sOrder
,
sStore
,
sRoom
);
logger
.
debug
(
"订单预订成功通知发送结束"
);
}
}
//
}
}
@Override
...
...
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