退单
This commit is contained in:
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.CopyUtils;
|
||||
import com.peanut.common.utils.OrderUtils;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.book.service.BookBuyConfigService;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
@@ -81,6 +82,10 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
private TrainingClassService trainingClassService;
|
||||
@Autowired
|
||||
private AiVipLogService aiVipLogService;
|
||||
@Autowired
|
||||
private BuyOrderRefundService buyOrderRefundService;
|
||||
@Autowired
|
||||
private BuyOrderRefundLogService buyOrderRefundLogService;
|
||||
|
||||
@Override
|
||||
public String pay(AlipayDTO payDto) {
|
||||
@@ -367,7 +372,17 @@ public class AliPayServiceImpl implements AliPayService {
|
||||
refund.setOutTradeNo(((Map)res.get("alipay_trade_refund_response")).get("out_trade_no").toString());
|
||||
refund.setRefundFee(((Map)res.get("alipay_trade_refund_response")).get("refund_fee").toString());
|
||||
refundOrderService.save(refund);
|
||||
refundOrderService.businessOpt(order);
|
||||
if (Constants.ORDER_STATUS_REFUND.equals(order.getOrderStatus())) {
|
||||
BuyOrderRefund buyOrderRefund = buyOrderRefundService.getOne(new LambdaQueryWrapper<BuyOrderRefund>()
|
||||
.eq(BuyOrderRefund::getOrderId, order.getOrderId())
|
||||
.orderByDesc(BuyOrderRefund::getId)
|
||||
.last("limit 1"));
|
||||
if (buyOrderRefund != null) {
|
||||
buyOrderRefundLogService.insertRefundLog(buyOrderRefund.getId(),3,1);
|
||||
}
|
||||
} else {
|
||||
refundOrderService.businessOpt(order);
|
||||
}
|
||||
}
|
||||
return resJson;
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ public class WeChatPayController {
|
||||
public void refundNotify(HttpServletRequest request){
|
||||
wxpayService.refundNotify(request);
|
||||
}
|
||||
|
||||
@PostMapping("/lsRefundNotify")
|
||||
public void lsRefundNotify(HttpServletRequest request){
|
||||
wxpayService.lsRefundNotify(request);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ShiroUtils;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.book.service.BookBuyConfigService;
|
||||
import com.peanut.modules.book.service.BuyOrderService;
|
||||
import com.peanut.modules.book.service.MyUserService;
|
||||
@@ -78,6 +79,10 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
@Autowired
|
||||
private JfTransactionDetailsDao jfTransactionDetailsDao;
|
||||
@Autowired
|
||||
private BuyOrderRefundService buyOrderRefundService;
|
||||
@Autowired
|
||||
private BuyOrderRefundLogService buyOrderRefundLogService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private CouponService couponService;
|
||||
@@ -380,15 +385,15 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
w.selectAll(BuyOrder.class);
|
||||
w.leftJoin(PayWechatOrderEntity.class,PayWechatOrderEntity::getOrderSn, BuyOrder::getOrderSn);
|
||||
w.eq("t1.order_id",resourceMap.get("transaction_id").toString());
|
||||
|
||||
BuyOrder order = buyOrderService.getOne(w);
|
||||
PayRefundOrder refund = new PayRefundOrder();
|
||||
refund.setPayType("1");
|
||||
refund.setOrderId(order.getOrderId());
|
||||
refund.setTradeNo(resourceMap.get("transaction_id").toString());
|
||||
refund.setOutTradeNo(resourceMap.get("out_trade_no").toString());
|
||||
refund.setRefundFee(((Map)resourceMap.get("amount")).get("refund").toString());
|
||||
refundOrderService.save(refund);
|
||||
refundOrderService.businessOpt(order);
|
||||
BuyOrderRefund buyOrderRefund = buyOrderRefundService.getOne(new QueryWrapper<BuyOrderRefund>().eq("order_id",order.getOrderId()));
|
||||
buyOrderRefund.setStatus(1);
|
||||
buyOrderRefundService.updateById(buyOrderRefund);
|
||||
|
||||
buyOrderRefundLogService.insertRefundLog(buyOrderRefund.getId(),4,1);
|
||||
|
||||
buyOrderService.refundOrder();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
@@ -415,7 +420,17 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
refund.setOutTradeNo(resourceMap.get("out_trade_no").toString());
|
||||
refund.setRefundFee(((Map)resourceMap.get("amount")).get("refund").toString());
|
||||
refundOrderService.save(refund);
|
||||
refundOrderService.businessOpt(order);
|
||||
if (Constants.ORDER_STATUS_REFUND.equals(order.getOrderStatus())) {
|
||||
BuyOrderRefund buyOrderRefund = buyOrderRefundService.getOne(new LambdaQueryWrapper<BuyOrderRefund>()
|
||||
.eq(BuyOrderRefund::getOrderId, order.getOrderId())
|
||||
.orderByDesc(BuyOrderRefund::getId)
|
||||
.last("limit 1"));
|
||||
if (buyOrderRefund != null) {
|
||||
buyOrderRefundLogService.insertRefundLog(buyOrderRefund.getId(),4,1);
|
||||
}
|
||||
} else {
|
||||
refundOrderService.businessOpt(order);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user