zhibing.pu
2024-08-28 f08a70b0a1e2cd49075c5d5d3f63d07d0b56cef9
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -24,6 +24,9 @@
import com.ruoyi.other.api.domain.TGoods;
import com.ruoyi.other.api.feignClient.CouponClient;
import com.ruoyi.other.api.feignClient.GoodsClient;
import com.ruoyi.payment.api.feignClient.AliPaymentClient;
import com.ruoyi.payment.api.feignClient.WxPaymentClient;
import com.ruoyi.payment.api.vo.NotifyV3PayDecodeRespBody;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@@ -59,6 +62,12 @@
    private AppUserAddressClient appUserAddressClient;
    @Resource
    private AppCouponClient appCouponClient;
    @Resource
    private WxPaymentClient wxPaymentClient;
    @Resource
    private AliPaymentClient aliPaymentClient;
    
    
    
@@ -270,7 +279,20 @@
        //支付方式(1=微信,2=支付宝) todo 待完善
        Integer paymentType = shoppingOrder.getPaymentType();
        if(1 == paymentType){
            NotifyV3PayDecodeRespBody data = wxPaymentClient.queryOrderInfo(shoppingOrder.getCode()).getData();
            String trade_state = data.getTrade_state();
            if("NOTPAY".equals(trade_state) || "REVOKED".equals(trade_state) || "PAYERROR".equals(trade_state)){
                return AjaxResult.error("订单还未支付,不能操作退款");
            }
            if("CLOSED".equals(trade_state)){
                return AjaxResult.error("订单支付已关闭,不能操作退款");
            }
            if("USERPAYING".equals(trade_state)){
                return AjaxResult.error("订单正在支付中,不能操作退款");
            }
            if("REFUND".equals(trade_state)){
                return AjaxResult.error("订单已退款,不能操作退款");
            }
        }
        if(2 == paymentType){