Pu Zhibing
2025-01-04 a015e7c916474bb51b33c228f690aa17f30c746c
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -230,9 +230,6 @@
        if (!check){
            throw new ServiceException("订单不存在");
        }
        order.setOrderStatus(OrderStatus.COMPLETED.getCode());
        orderMapper.updateById(order);
        Integer orderType = order.getOrderType();
        // 售后设置
        R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5);
@@ -246,9 +243,11 @@
        String content = baseSetting.getContent();
        JSONObject jsonObject = JSONObject.parseObject(content);
        Long days = jsonObject.getLong("days");
        if (days != null && days > 0){
            commissionService.addToCommissionDelayQueue(order.getId(), LocalDateTime.now().plusDays(days));
        }
        order.setOrderStatus(OrderStatus.COMPLETED.getCode());
        order.setIsCommission(0);
        order.setAfterSaleTime(LocalDateTime.now().plusDays(days));
        order.setEndTime(LocalDateTime.now());
        orderMapper.updateById(order);
    }
    
    
@@ -309,7 +308,7 @@
     * @return
     */
    @Override
    public R confirmDelivery(String orderId, String code) {
    public R confirmDelivery(Long orderId, String code) {
        Order order = this.getById(orderId);
        if(1 == order.getPayStatus()){
            return R.fail("订单还未完成支付");
@@ -362,8 +361,10 @@
            //余额退款
            OrderBalancePayment orderBalancePayment = orderBalancePaymentService.getOne(new LambdaQueryWrapper<OrderBalancePayment>().eq(OrderBalancePayment::getOrderId, order.getId()));
            BigDecimal balance = appUser.getBalance();
            appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN));
            if(null != orderBalancePayment){
                appUser.setTotalRedPacketAmount(appUser.getTotalRedPacketAmount().add(orderBalancePayment.getRedPacketAmount()).setScale(2, RoundingMode.HALF_EVEN));
                appUser.setTotalDistributionAmount(appUser.getTotalDistributionAmount().add(orderBalancePayment.getDistributionAmount()).setScale(2, RoundingMode.HALF_EVEN));
            }
            appUser.setBalance(balance.add(paymentAmount).setScale(2, RoundingMode.HALF_EVEN));
            appUser.setShopAmount(appUser.getShopAmount().subtract(paymentAmount).setScale(2, RoundingMode.HALF_EVEN));
        
@@ -418,7 +419,7 @@
        PointSetting pointSetting = pointSettingClient.getPointSetting(vipDemotion ? appUser.getVipId() - 1 : appUser.getVipId()).getData();
        int earnPoint1 = getPoint;
        if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){
            earnPoint1 = getPoint / (100 - pointSetting.getBuyPoint());
            earnPoint1 = new BigDecimal(getPoint).divide(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue();
        }
        appUser.setLavePoint(lavePoint - getPoint);
        appUser.setShopPoint(appUser.getShopPoint() - earnPoint1);
@@ -452,10 +453,7 @@
        VipSetting vipSetting = vipSettingClient.getVipSetting(vipId).getData();
        Integer vipLevelUpShopRole = vipSetting.getVipLevelUpShopRole();
        Integer vipLevelUpShop = vipSetting.getVipLevelUpShop();
        if(1 == vipLevelUpShopRole && shopPoint < vipLevelUpShop){
            return true;
        }
        return false;
        return 1 == vipLevelUpShopRole && shopPoint < vipLevelUpShop;
    }