Commit f194f8f5 by 吕明尚

注销订单回调退款

parent 3db8e819
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</encoder> </encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 --> <!-- 过滤的级别 -->
<level>INFO</level> <level>DEBUG</level>
<!-- 匹配时的操作:接收(记录) --> <!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) --> <!-- 不匹配时的操作:拒绝(不记录) -->
......
...@@ -194,7 +194,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -194,7 +194,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
logger.debug("修改会员用户"); logger.debug("修改会员用户");
BigDecimal balance = consumerWallet.getBalance().add(recharge.getRechargeAmount()); BigDecimal balance = consumerWallet.getBalance().add(recharge.getRechargeAmount());
if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) { if (rechargeConf.getGiveType().contains(GiveTypeEnum.AMOUNT.getIndex())) {
balance.add(rechargeConf.getGiveAmount()); balance = balance.add(rechargeConf.getGiveAmount());
consumerWallet.setBalance(balance); consumerWallet.setBalance(balance);
} else { } else {
consumerWallet.setBalance(balance); consumerWallet.setBalance(balance);
......
...@@ -362,7 +362,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -362,7 +362,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
HashMap<String, Object> summedPrice = baseMapper.sumPrice(sOrder); HashMap<String, Object> summedPrice = baseMapper.sumPrice(sOrder);
List<Long> ids = sOrderVos.stream().map(SOrderVo::getCouponId).collect(Collectors.toList()); List<Long> ids = sOrderVos.stream().map(SOrderVo::getCouponId).collect(Collectors.toList());
Map<Long, SConsumerCoupon> couponMap = new HashMap<>(); Map<Long, SConsumerCoupon> couponMap = new HashMap<>();
SConsumerCoupon sConsumerCoupon = new SConsumerCoupon(); SConsumerCoupon sConsumerCoupon = null;
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
couponMap = consumerCouponService.listByIds(ids) couponMap = consumerCouponService.listByIds(ids)
.stream().collect(Collectors.toMap(SConsumerCoupon::getId, s -> s)); .stream().collect(Collectors.toMap(SConsumerCoupon::getId, s -> s));
...@@ -401,7 +401,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -401,7 +401,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
tableDataInfo.setTotalRealRefundAmount(BigDecimal.ZERO); 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; return tableDataInfo;
...@@ -1817,65 +1821,65 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1817,65 +1821,65 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
unLockOrder(sOrder.getRoomId()); unLockOrder(sOrder.getRoomId());
ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId())); ConsumerWallet consumerWallet = consumerWalletService.getOne(new LambdaQueryWrapper<ConsumerWallet>().eq(ConsumerWallet::getConsumerId, sOrder.getConsumerId()));
ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId())); ConsumerMember consumerMember = consumerMemberService.getOne(new LambdaQueryWrapper<ConsumerMember>().eq(ConsumerMember::getConsumerId, sOrder.getConsumerId()));
logger.debug("订单查询预约时间是否干涉"); // logger.debug("订单查询预约时间是否干涉");
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(SOrder::getOrderNo, sOrder.getOrderNo()); // queryWrapper.ne(SOrder::getOrderNo, sOrder.getOrderNo());
queryWrapper.eq(SOrder::getOrderType, OrderTypeEnum.RESERVER.getCode()); // queryWrapper.eq(SOrder::getOrderType, OrderTypeEnum.RESERVER.getCode());
queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex()); // queryWrapper.eq(SOrder::getPayStatus, YesNoEnum.yes.getIndex());
queryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus()); // queryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus()); // queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
queryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex()); // queryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
queryWrapper.eq(SOrder::getStoreId, sOrder.getStoreId()); // queryWrapper.eq(SOrder::getStoreId, sOrder.getStoreId());
queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId()); // queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
queryWrapper.apply("(IFNULL(start_date,pre_start_date) BETWEEN '" // queryWrapper.apply("(IFNULL(start_date,pre_start_date) BETWEEN '"
+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sOrder.getPreStartDate()) // + 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)) + "' " + // + "' 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 '" // "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)) // + 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()) + "' )"); // + "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sOrder.getPreEndDate()) + "' )");
SOrder order = getOne(queryWrapper); // SOrder order = getOne(queryWrapper);
if (ObjectUtil.isNotEmpty(order)) { // if (ObjectUtil.isNotEmpty(order)) {
baseMapper.updateSOrder(sOrder); // baseMapper.updateSOrder(sOrder);
//延迟5秒 // //延迟5秒
try { // try {
// 延迟 5 秒 // // 延迟 5 秒
Thread.sleep(5000); // Thread.sleep(5000);
} catch (InterruptedException e) { // } catch (InterruptedException e) {
// 如果线程被中断,这里可以处理异常 // // 如果线程被中断,这里可以处理异常
e.printStackTrace(); // e.printStackTrace();
} // }
logger.debug("订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉"); // logger.debug("订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
//退款 // //退款
// AdminRefundRequest refundRequest = new AdminRefundRequest(); //// AdminRefundRequest refundRequest = new AdminRefundRequest();
// refundRequest.setOrderNo(sOrder.getOrderNo()); //// refundRequest.setOrderNo(sOrder.getOrderNo());
// refundRequest.setAmount(sOrder.getPayPrice()); //// refundRequest.setAmount(sOrder.getPayPrice());
// refundRequest.setIsClean(YesNoEnum.no.getIndex()); //// refundRequest.setIsClean(YesNoEnum.no.getIndex());
// refundRequest.setRefundCoupon(YesNoEnum.yes.getIndex()); //// refundRequest.setRefundCoupon(YesNoEnum.yes.getIndex());
// refundRequest.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉"); //// refundRequest.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
// int i = sOrderService.refundOp(refundRequest); //// int i = sOrderService.refundOp(refundRequest);
OrderRefundRequest request = new OrderRefundRequest(); // OrderRefundRequest request = new OrderRefundRequest();
request.setOrderNo(sOrder.getOrderNo()); // request.setOrderNo(sOrder.getOrderNo());
request.setAmount(sOrder.getPayPrice()); // request.setAmount(sOrder.getPayPrice());
request.setApprovalStatus(YesNoEnum.yes.getIndex()); // request.setApprovalStatus(YesNoEnum.yes.getIndex());
request.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉"); // request.setRefundReason("当前订单:" + sOrder.getOrderNo() + "和订单:" + order.getOrderNo() + "预约时间有干涉");
boolean isRefund = orderRefundService.refund(request, sOrder); // boolean isRefund = orderRefundService.refund(request, sOrder);
if (isRefund) { // if (isRefund) {
// 删除redis 缓存信息,防止退款订单自动开始及给用户发送提示短信 // // 删除redis 缓存信息,防止退款订单自动开始及给用户发送提示短信
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo()); // redisUtil.delete(ReceiptRdeisEnum.ORDER_NO.getValue() + sOrder.getOrderNo());
redisUtil.delete(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo()); // redisUtil.delete(ReceiptRdeisEnum.ORDER_NO_KEY.getValue() + sOrder.getOrderNo());
//查询是否有使用中的订单 // //查询是否有使用中的订单
LambdaQueryWrapper<SOrder> wrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<SOrder> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SOrder::getRoomId, sOrder.getRoomId()); // wrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
wrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode()); // wrapper.eq(SOrder::getStatus, OrderStatusEnum.INUSE.getCode());
List<SOrder> list = baseMapper.selectList(wrapper); // List<SOrder> list = baseMapper.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) { // if (CollectionUtils.isEmpty(list)) {
//房间断电 // //房间断电
deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5, // deviceOpService.openOrCloseDevice(sOrder.getRoomId(), sOrder.getConsumerPhone(), OpTypeEnum.CUT_ELECTRIC.getCode(), true, 5,
DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode()); // DeviceOpSourceEnum.DEVICE_SOURCE_20.getCode());
} // }
refundExtracted(consumerWallet, sOrder, consumerMember); // refundExtracted(consumerWallet, sOrder, consumerMember);
} // }
} else { // } else {
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) { if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
SRoom room = roomService.getById(sOrder.getRoomId()); SRoom room = roomService.getById(sOrder.getRoomId());
...@@ -1990,7 +1994,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -1990,7 +1994,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
smsService.sendSmsOrderPredetermine(phones, sOrder, sStore, sRoom); smsService.sendSmsOrderPredetermine(phones, sOrder, sStore, sRoom);
logger.debug("订单预订成功通知发送结束"); logger.debug("订单预订成功通知发送结束");
} }
} // }
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment