Commit 711382f0 by 吕明尚

自动退款后面支付成功的订单

parent 702bf887
......@@ -1617,35 +1617,37 @@ 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()));
// LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.ne(SOrder::getOrderNo,sOrder.getOrderNo());
// queryWrapper.eq(SOrder::getOrderType,OrderTypeEnum.RESERVER.getCode());
// 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)){
// //退款
// 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;
// }
logger.debug("订单查询预约时间是否干涉");
LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(SOrder::getOrderNo, sOrder.getOrderNo());
queryWrapper.eq(SOrder::getOrderType, OrderTypeEnum.RESERVER.getCode());
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)) {
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());
......
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