luodangjia
2024-10-25 bdb93c5eee83971e77abb6c589f0e608cf586d75
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/TShoppingOrderServiceImpl.java
@@ -63,37 +63,37 @@
 */
@Service
public class TShoppingOrderServiceImpl extends ServiceImpl<TShoppingOrderMapper, TShoppingOrder> implements TShoppingOrderService {
    @Resource
    private TokenService tokenService;
    @Resource
    private GoodsClient goodsClient;
    @Resource
    private CouponClient couponClient;
    @Resource
    private AppUserClient appUserClient;
    @Resource
    private AppUserAddressClient appUserAddressClient;
    @Resource
    private AppCouponClient appCouponClient;
    @Resource
    private WxPaymentClient wxPaymentClient;
    @Resource
    private AliPaymentClient aliPaymentClient;
    @Resource
    private TShoppingOrderRefundService shoppingOrderRefundService;
    @Autowired
    public RedisTemplate redisTemplate;
    @Override
    public TActivityVO activityStatistics(TActivityStatisticsQuery dto) {
@@ -117,6 +117,10 @@
        BigDecimal grantVip = new BigDecimal("0");
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        for (TActivityStatisticslVO tActivityStatisticslVO : list1) {
            TAppUser data = appUserClient.getUserById(tActivityStatisticslVO.getAppUserId()).getData();
            if (data!=null){
                tActivityStatisticslVO.setPhone(data.getPhone());
            }
            // 判断享有了哪些类型
            switch (tActivityStatisticslVO.getOrderType()){
                case 1:
@@ -187,6 +191,7 @@
            }
        }
        for (TActivityStatisticslVO tActivityStatisticslVO : list) {
            // 判断享有了哪些类型
            switch (tActivityStatisticslVO.getOrderType()){
                case 1:
@@ -265,8 +270,8 @@
        res.setGrantVip(grantVip);
        return res;
    }
    /**
     * 获取小程序商城购买订单列表
     * @param query
@@ -313,8 +318,8 @@
        map.put("total", count);
        return map;
    }
    /**
     * 获取购买订单详情
     * @param id
@@ -364,8 +369,8 @@
        }
        return info;
    }
    /**
     * 取消订单
     * @param id
@@ -386,10 +391,10 @@
        if(shoppingOrder.getPaymentAmount().compareTo(bigDecimal) == 0 && shoppingOrder.getStatus() == 4){
            return AjaxResult.error("订单已取消,不能重复操作");
        }
        //退款金额
        BigDecimal refundAmount = shoppingOrder.getPaymentAmount().subtract(bigDecimal);
        //先查询第三方订单状态订单是否退款
        //支付方式(1=微信,2=支付宝)
        Integer paymentType = shoppingOrder.getPaymentType();
@@ -438,7 +443,7 @@
        shoppingOrderRefund.setRefundRemark("全额退款");
        shoppingOrderRefund.setRefundTotalAmount(refundAmount.add(bigDecimal));
        shoppingOrderRefund.setPayAmount(shoppingOrder.getPaymentAmount());
        shoppingOrder.setCancellationTime(LocalDateTime.now());
        shoppingOrder.setCancellationId(shoppingOrder.getAppUserId());
        if(1 == paymentType){
@@ -474,8 +479,8 @@
        }
        return AjaxResult.success();
    }
    /**
     * 商城订单取消订单微信退款处理
     * @param out_refund_no 退款单号
@@ -500,7 +505,7 @@
        shoppingOrder.setRefundStatus(2);
        shoppingOrder.setRefundTime(one.getRefundTime());
        this.updateById(shoppingOrder);
        //商品
        if(shoppingOrder.getOrderType() == 1){
            //redis锁 和支付使用同一个锁
@@ -541,7 +546,7 @@
        }
        return AjaxResult.success();
    }
    /**
     * 获取未开票的订单列表
     * @param query