luofl
2025-02-24 8acc98732aba58ad5c710f92d72e6fa5bf888d11
修改物流信息导入模板
27个文件已修改
5个文件已添加
839 ■■■■ 已修改文件
a.json 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/FreezeRecord.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/FreezeRecordMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/FreezeRecordService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java 159 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/FreezeRecordServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/TaskUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
a.json
New file
@@ -0,0 +1,26 @@
{
  "appointStore": 2,
  "cashPayment": 1,
  "commodityAuthority": "-1",
  "delFlag": 0,
  "detail": "<p>124</p>",
  "detailPicture": "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/ce9f63be73a64fd29449fcd1aae6ed8c.png",
  "distributionMode": "1",
  "goodsCategoryId": 21,
  "homePagePicture": "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/9655a4f62a784daa8bd46b8881020183.png",
  "id": 71,
  "idStr": "71",
  "introduction": "1111",
  "name": "面部玫瑰精油",
  "operatingCost": 20.00,
  "originalPrice": 2.00,
  "pageCurr": 1,
  "pageSize": 10,
  "pointPayment": 0,
  "purchaseLimit": -1,
  "saleNum": 0,
  "sellingPrice": 15.00,
  "shopCost": 20.00,
  "status": 2,
  "type": 2
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -133,6 +133,7 @@
            public R clearBindShop(Integer shopId) {
                return R.fail("清空绑定门店的用户门店数据失败:" + cause.getMessage());
            }
        };
    }
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -134,4 +134,5 @@
     */
    @PostMapping("/app-user/clearBindShop")
    R clearBindShop(@RequestParam("shopId") Integer shopId);
}
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java
@@ -97,6 +97,10 @@
    @ApiModelProperty(value = "推广人姓名")
    @TableField(exist = false)
    private String inviteUserName;
    @ApiModelProperty(value = "指导老师")
    @TableField(exist = false)
    private String teacher;
    @ApiModelProperty(value = "绑定门店id")
    @TableField("shop_id")
    private Integer shopId;
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/OrderClientFallbackFactory.java
@@ -48,7 +48,8 @@
            public R editOrder(Order order) {
                return R.fail("编辑订单详情失败:" + cause.getMessage());
            }
            @Override
            public R<Long> getOrderCountByAppUserId(Long appUserId) {
                return R.fail("获取用户订单数量失败:" + cause.getMessage());
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -66,6 +66,11 @@
            public R<List<Order>> byShopIdAndUserId(Long userId,Integer shopId) {
                return R.fail("通过门店和用户id查询订单失败");
            }
            @Override
            public R<List<OrderGood>> getUnDistributedOrder(Long appUserId) {
                return R.fail("获取未分配订单失败");
            }
        };
    }
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/OrderClient.java
@@ -7,6 +7,7 @@
import com.ruoyi.order.model.Order;
import com.ruoyi.order.vo.OrderSaleNum;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@@ -70,8 +71,8 @@
     */
    @PostMapping("/order/editOrder")
    R editOrder(@RequestBody Order order);
    /**
     * 获取用户订单数量
     * @param appUserId
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -63,4 +63,9 @@
    R<Price> getGoodsPrice(@RequestParam("appUserId") Long appUserId, @RequestParam("goodsId") Integer goodsId, @RequestParam("shopId") Integer shopId);
    @PostMapping("/order/getLastOrder")
    R<Order> getLastOrder(@RequestParam("appUserId") Long appUserId);
    @GetMapping("/order-good/getUnDistributedOrder")
    R<List<OrderGood>> getUnDistributedOrder(Long appUserId);
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/FreezeRecord.java
New file
@@ -0,0 +1,17 @@
package com.ruoyi.order.model;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
@Data
@TableName("freeze_record")
public class FreezeRecord {
    private Long id;
    private Long orderId;
    private Long userId;
    private Integer storeId;
    private BigDecimal freezeMoney;
    private Integer freezePoint;
}
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java
@@ -128,5 +128,4 @@
    @TableField("integral")
    private Integer integral;
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/GoodsVip.java
@@ -88,19 +88,19 @@
    @TableField("technician_points")
    private Integer technicianPoints;
    @ApiModelProperty(value = "绑定门店可获得分佣金额")
    @ApiModelProperty(value = "服务商可获得分佣金额")
    @TableField("bound_shop_charges")
    private BigDecimal boundShopCharges;
    @ApiModelProperty(value = "绑定门店可获得返佣积分")
    @ApiModelProperty(value = "服务商可获得返佣积分")
    @TableField("bound_shop_points")
    private Integer boundShopPoints;
    @ApiModelProperty(value = "绑定门店上级门店可获得分佣金额")
    @ApiModelProperty(value = "高级服务商上级门店可获得分佣金额")
    @TableField("bound_shop_superiors_charges")
    private BigDecimal boundShopSuperiorsCharges;
    @ApiModelProperty(value = "绑定门店上级门店可获得返佣积分")
    @ApiModelProperty(value = "高级服务商上级门店可获得返佣积分")
    @TableField("bound_shop_superiors_points")
    private Integer boundShopSuperiorsPoints;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -152,6 +152,7 @@
    @TableField("balance")
    private BigDecimal balance;
    @ApiModelProperty(value = "门店订单总数")
    @TableField("order_number")
    private Integer orderNumber;
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopClientFallbackFactory.java
@@ -6,6 +6,7 @@
import com.ruoyi.other.api.feignClient.ShopClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.web.bind.annotation.GetMapping;
import java.math.BigDecimal;
import java.util.List;
@@ -57,10 +58,21 @@
                return R.fail("获取所有门店失败:" + cause.getMessage());
            }
            @GetMapping("/shop/getShopStatistics")
            @Override
            public R<Map<String, BigDecimal>> getShopStatistics(Integer shopId) {
                return R.fail();
            }
            @Override
            public R<Shop> getServiceProvider(Long appUserId) {
                return R.fail("获取服务商失败");
            }
            @Override
            public R<Shop> getSuperiorServiceProvider(Long appUserId) {
                return R.fail("获取高级服务商失败");
            }
        };
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopClient.java
@@ -71,4 +71,18 @@
    @GetMapping("/shop/getShopStatistics")
    public R<Map<String, BigDecimal>> getShopStatistics(@RequestParam("shopId") Integer shopId);
    /**
     * 获取指定用户的服务商
     */
    @GetMapping("/shop/getServiceProvider")
    public R<Shop> getServiceProvider(@RequestParam("appUserId") Long appUserId);
    /**
     * 获取指定用户的高级服务商
     */
    @GetMapping("/shop/getSuperiorServiceProvider")
    public R<Shop> getSuperiorServiceProvider(@RequestParam("appUserId") Long appUserId);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -276,14 +276,30 @@
        Long userId = tokenService.getLoginUserApplet().getUserid();
        //获取绑定门店
        AppUser user = appUserService.getById(userId);
        if (user.getShopId() != null) {
            R<Shop> storeById = storeClient.getStoreById(user.getShopId());
            if (storeById.getData() != null) {
                user.setShopName(storeById.getData().getName());
                user.setShopCover(storeById.getData().getHomePicture());
                user.setShopAddress(storeById.getData().getAddress());
        //当前用户的推荐人信息(指导老师)
        List<AppUser> allSuperiors = getAllSuperiors(userId);
        //当前绑定门店的店铺信息
        for (AppUser allSuperior : allSuperiors) {
            List<Shop> shopList = shopClient.getShopByUserId(allSuperior.getId()).getData();
            if (!CollectionUtils.isEmpty(shopList)){
                user.setShopName(shopList.get(0).getName());
                user.setShopCover(shopList.get(0).getHomePicture());
                user.setShopAddress(shopList.get(0).getAddress());
                break;
            }
        }
        //指导老师
        allSuperiors.stream()
                .filter(superiors -> superiors.getVipId() != null && superiors.getVipId() > 3)
                .findFirst()
                .ifPresent(superiors -> {
                    user.setTeacher(superiors.getName());
                });
        //获取绑定上级
        if (user.getInviteUserId() != null) {
@@ -456,19 +472,29 @@
            appUserService.updateById(user);
        }
        
        //当前用户的推荐人信息
        if (user.getInviteUserId() != null) {
            AppUser inviteUser = appUserService.getById(user.getInviteUserId());
            user.setInviteUserName(inviteUser.getName());
        }
        //当前绑定门店的店铺信息
        if (user.getShopId() != null) {
            R<Shop> storeById = shopClient.getShopById(user.getShopId());
            if (storeById.getData() != null) {
                Shop shop = storeById.getData();
                user.setShopName(shop.getName());
        //指导老师
        List<AppUser> allSuperiors = getAllSuperiors(userId);
        allSuperiors.stream()
                .filter(superiors -> superiors.getVipId() != null && superiors.getVipId() > 3)
                .findFirst()
                .ifPresent(superiors -> {
                    user.setTeacher(superiors.getName());
                });
        //当前绑定门店的店铺信息(服务商)
        for (AppUser allSuperior : allSuperiors) {
            List<Shop> shopList = shopClient.getShopByUserId(allSuperior.getId()).getData();
            if (!CollectionUtils.isEmpty(shopList)){
                user.setShopName(shopList.get(0).getName());
                break;
            }
        }
//        if (user.getShopId() != null) {
//            R<Shop> storeById = shopClient.getShopById(user.getShopId());
//            if (storeById.getData() != null) {
//                Shop shop = storeById.getData();
//                user.setShopName(shop.getName());
//            }
//        }
        ArrayList<Long> userIds = new ArrayList<>();
        userIds.add(userId);
        // 获取当前用户的所有下级
@@ -517,6 +543,25 @@
        }
        return R.ok(user);
    }
    public List<AppUser> getAllSuperiors(Long userId) {
        List<AppUser> allSuperiors = new ArrayList<>();
        // 获取当前用户的直接上级
        AppUser currentUser = appUserService.getById(userId);
        if (currentUser != null && currentUser.getInviteUserId() != null) {
            AppUser superior = appUserService.getById(currentUser.getInviteUserId());
            if (superior != null) {
                allSuperiors.add(superior); // 添加直接上级
                allSuperiors.addAll(getAllSuperiors(superior.getId())); // 递归添加上级的上级
            }
        }
        return allSuperiors;
    }
    
    // 递归获取指定用户的所有下级
    public List<AppUser> getAllSubordinates(Long userId) {
@@ -1280,5 +1325,6 @@
                .set(AppUser::getUserType,1));
        return R.ok();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java
@@ -23,6 +23,8 @@
import com.ruoyi.common.core.utils.PhoneNumberValidator;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.other.api.domain.PointSetting;
import com.ruoyi.other.api.domain.VipSetting;
import com.ruoyi.other.api.enums.PointChangeType;
@@ -61,6 +63,8 @@
    private PointSettingService pointSettingService;
    @Resource
    private UserPointService userPointService;
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
@@ -72,7 +76,15 @@
        UserPointVO userPointVO = new UserPointVO();
        // todo bug说取剩余积分
        userPointVO.setTotalPoint(appUser.getLavePoint());
        R<List<OrderGood>> unDistributedOrder = remoteOrderGoodsClient.getUnDistributedOrder(userId);
        List<OrderGood> unDistributedOrderList = unDistributedOrder.getData();
        Integer totalPoint = unDistributedOrderList.stream()
                .mapToInt(OrderGood::getSuperiorRebatePoints)
                .sum();
        userPointVO.setTotalPoint(appUser.getLavePoint()+totalPoint);
        userPointVO.setConsumePoint(appUser.getAvailablePoint());
        userPointVO.setShopPoint(appUser.getShopPoint());
        userPointVO.setSharePoint(appUser.getSharePoint());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/WalletServiceImpl.java
@@ -1,6 +1,10 @@
package com.ruoyi.account.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.order.feignClient.OrderClient;
import com.ruoyi.order.feignClient.RemoteOrderGoodsClient;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.other.api.enums.WithdrawalAuditStatus;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.WithdrawalRequests;
@@ -25,6 +29,8 @@
    private RemoteVipSettingClient remoteVipSettingClient;
    @Resource
    private WithdrawalRequestsService withdrawalRequestsService;
    @Resource
    private RemoteOrderGoodsClient remoteOrderGoodsClient;
    @Override
    public WalletVO getWalletByUserId(Long userId) {
@@ -45,6 +51,15 @@
                .eq(WithdrawalRequests::getAuditStatus, WithdrawalAuditStatus.WAIT_AUDIT.getCode()));
        BigDecimal reduce = waitAuditList.stream().map(WithdrawalRequests::getWithdrawalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
        WalletVO walletVO = new WalletVO();
        R<List<OrderGood>> unDistributedOrder = remoteOrderGoodsClient.getUnDistributedOrder(userId);
        List<OrderGood> unDistributedOrderList = unDistributedOrder.getData();
        BigDecimal commissionAmount = unDistributedOrderList.stream()
                .map(OrderGood::getSuperiorSubcommission)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        walletVO.setCommissionAmount(appUser.getTotalDistributionAmount().add(commissionAmount));
        walletVO.setWithdrawalAmount(appUser.getWithdrawableAmount());
        walletVO.setWithdrawnAmount(appUser.getWithdrawnAmount().subtract(reduce));
        walletVO.setVipWithdrawalMinAmount(data.getVipWithdrawalMinAmount());
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/vo/WalletVO.java
@@ -13,6 +13,9 @@
    @ApiModelProperty(value = "账户余额")
    private BigDecimal balance;
    @ApiModelProperty(value = "分佣金额")
    private BigDecimal commissionAmount;
    @ApiModelProperty(value = "可提现金额")
    private BigDecimal withdrawalAmount;
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -5,7 +5,9 @@
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.feignClient.UserAddressClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.account.api.model.UserAddress;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.StringUtils;
@@ -25,27 +27,19 @@
import com.ruoyi.order.util.vo.MapTrackKD100Vo;
import com.ruoyi.order.vo.*;
import com.ruoyi.other.api.domain.BaseSetting;
import com.ruoyi.other.api.domain.Goods;
import com.ruoyi.other.api.feignClient.BaseSettingClient;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.feignClient.SysUserClient;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.*;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
@@ -55,7 +49,7 @@
/**
 * <p>
 *  前端控制器
 * 前端控制器
 * </p>
 *
 * @author luodangjia
@@ -81,6 +75,8 @@
    private SysUserClient sysUserClient;
    @Resource
    private RefundPassService refundPassService;
    @Resource
    private AppUserClient appUserClient;
    /**
@@ -91,7 +87,7 @@
            @ApiImplicitParam(value = "订单状态", name = "status", required = true, dataType = "int"),
    })
    @GetMapping("/getMyOrderList")
    public TableDataInfo<OrderVO> getMyOrderList(@ApiParam("订单状态") Integer status){
    public TableDataInfo<OrderVO> getMyOrderList(@ApiParam("订单状态") Integer status) {
        startPage();
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        return getDataTable(orderService.selectOrderListByUserId(status, loginUserApplet.getUserid()));
@@ -101,7 +97,7 @@
     * 通过订单ids获取订单列表
     */
    @PostMapping("/getOrderListByIds")
    public R<List<Order>> getOrderListByIds(@RequestBody List<Long> ids){
    public R<List<Order>> getOrderListByIds(@RequestBody List<Long> ids) {
        return R.ok(orderService.listByIds(ids));
    }
@@ -113,7 +109,7 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
    @GetMapping("/detail/{orderId}")
    public R<OrderDetailVO> detail(@PathVariable("orderId") Long orderId){
    public R<OrderDetailVO> detail(@PathVariable("orderId") Long orderId) {
        return R.ok(orderService.getOrderDetail(orderId));
    }
@@ -122,10 +118,10 @@
     */
    @ApiOperation(value = "扫码校验", tags = {"小程序-个人中心-门店管理"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType="query"),
            @ApiImplicitParam(value = "分享id", name = "shareId", required = true, dataType = "int", paramType = "query"),
    })
    @GetMapping("/check/{orderNumber}/{shopId}")
    public R<Boolean> check(@PathVariable("orderNumber") String orderNumber, @PathVariable("shopId") Integer shopId){
    public R<Boolean> check(@PathVariable("orderNumber") String orderNumber, @PathVariable("shopId") Integer shopId) {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        Order order = orderService.getOne(new LambdaQueryWrapper<Order>()
                .eq(Order::getOrderNumber, orderNumber));
@@ -140,7 +136,7 @@
            @ApiImplicitParam(value = "订单id", name = "id", required = true, dataType = "String"),
    })
    @GetMapping("/writeOff")
    public R<Void> writeOff(String code, Integer shopId, String technicianId){
    public R<Void> writeOff(String code, Integer shopId, String technicianId) {
        orderService.writeOff(code, shopId, technicianId);
        return R.ok();
    }
@@ -153,7 +149,7 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
    @GetMapping("/cancel/{orderId}")
    public R cancel(@PathVariable("orderId") Long orderId){
    public R cancel(@PathVariable("orderId") Long orderId) {
        return orderService.cancel(orderId);
    }
@@ -165,7 +161,7 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
    @GetMapping("/confirm/{orderId}")
    public R<Void> confirm(@PathVariable("orderId") Long orderId){
    public R<Void> confirm(@PathVariable("orderId") Long orderId) {
        R<BaseSetting> baseSettingR = baseSettingClient.getBaseSetting(5);
        if (R.isError(baseSettingR)) {
            return R.fail("售后设置获取失败");
@@ -193,9 +189,9 @@
            @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"),
    })
    @GetMapping("/changeAddress")
    public R<Void> changeAddress(@RequestParam("orderId") Long orderId, @RequestParam("addressId") Long addressId){
    public R<Void> changeAddress(@RequestParam("orderId") Long orderId, @RequestParam("addressId") Long addressId) {
        R<UserAddress> userAddressR = addressClient.getUserAddressById(addressId);
        if(R.isError(userAddressR)){
        if (R.isError(userAddressR)) {
            return R.fail("收货地址不存在");
        }
        UserAddress userAddress = userAddressR.getData();
@@ -214,7 +210,7 @@
            @ApiImplicitParam(value = "订单对象", name = "order", required = true, dataType = "Order"),
    })
    @PostMapping("/updateOrderStatus")
    public R<Void> updateOrderStatus(@RequestBody Order order){
    public R<Void> updateOrderStatus(@RequestBody Order order) {
        Order order1 = orderService.getById(order.getId());
        order1.setOrderStatus(order.getOrderStatus());
        order1.setOldOrderStatus(order.getOldOrderStatus());
@@ -227,7 +223,7 @@
     * 预约技师
     */
    @PostMapping("/subscribe")
    public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id ,@RequestParam(value = "technicianId", required = false) Integer technicianId){
    public R<Void> subscribe(@RequestParam(value = "id", required = false) Long id, @RequestParam(value = "technicianId", required = false) Integer technicianId) {
        Order order = orderService.getById(id);
        order.setTechnicianId(technicianId);
        orderService.updateById(order);
@@ -235,14 +231,14 @@
    }
    @PostMapping("/getLastOrder")
    public R<Order> getLastOrder(@RequestParam("appUserId") Long appUserId){
    public R<Order> getLastOrder(@RequestParam("appUserId") Long appUserId) {
        Order one = orderService.lambdaQuery().eq(Order::getAppUserId, appUserId).orderByDesc(Order::getCreateTime).last("limit 1").one();
        return R.ok(one);
    }
    @PostMapping("/byUserId")
    public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){
    public R<List<Order>> byUserId(@RequestParam("appUserId") Long appUserId, @RequestParam("shopId") Integer shopId) {
        List<Order> list = orderService.lambdaQuery()
                .eq(Order::getAppUserId, appUserId)
                .eq(null != shopId && -1 != shopId, Order::getShopId, shopId)
@@ -252,12 +248,14 @@
                .notIn(Order::getOrderStatus, 5, 6).list();
        return R.ok(list);
    }
    @PostMapping("/byShopId")
    public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId){
    public R<List<Order>> byShopId(@RequestParam("shopId") Integer shopId) {
        return R.ok(orderService.lambdaQuery().isNotNull(Order::getEndTime).eq(Order::getShopId, shopId).list());
    }
    @PostMapping("/byShopIdAndUserId")
    public R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId,@RequestParam("shopId") Integer shopId){
    public R<List<Order>> byShopIdAndUserId(@RequestParam("appUserId") Long appUserId, @RequestParam("shopId") Integer shopId) {
        List<Order> list = orderService.lambdaQuery().isNotNull(Order::getEndTime)
                .eq(null != shopId && -1 != shopId, Order::getShopId, shopId)
                .eq(Order::getAppUserId, appUserId)
@@ -269,43 +267,42 @@
    }
    @PostMapping("/confirmDelivery")
    @ApiOperation(value = "已发货操作", tags = {"管理后台-订单管理"})
    public R confirmDelivery(@RequestBody ConfirmDelivery confirmDelivery){
    public R confirmDelivery(@RequestBody ConfirmDelivery confirmDelivery) {
        return orderService.confirmDelivery(confirmDelivery);
    }
    @PutMapping("/cancelOrder/{orderId}")
    @ApiOperation(value = "取消订单操作", tags = {"管理后台-订单管理"})
    public R cancelOrder(@PathVariable("orderId") Long orderId){
    public R cancelOrder(@PathVariable("orderId") Long orderId) {
        return orderService.cancelOrder(orderId);
    }
    @PutMapping("/receivingOperation/{orderId}")
    @ApiOperation(value = "收货操作", tags = {"管理后台-订单管理"})
    public R receivingOperation(@PathVariable("orderId") Long orderId){
    public R receivingOperation(@PathVariable("orderId") Long orderId) {
        return orderService.receivingOperation(orderId);
    }
    @GetMapping("/getOrderInfo/{orderId}")
    @ApiOperation(value = "查询订单详情", tags = {"管理后台-订单管理"})
    public R<OrderInfoVo> getOrderInfo(@PathVariable("orderId") Long orderId){
    public R<OrderInfoVo> getOrderInfo(@PathVariable("orderId") Long orderId) {
        OrderInfoVo orderInfo = orderService.getOrderInfo(orderId);
        RefundPass one = refundPassService.getOne(new LambdaQueryWrapper<RefundPass>().eq(RefundPass::getOrderId, orderId)
                .eq(RefundPass::getDelFlag, 0).last(" order by create_time desc limit 0,1"));
        if (one!=null){
        if (one != null) {
            orderInfo.setRefundPassId(one.getId().toString());
        }
        return R.ok(orderInfo);
    }
    @GetMapping("/getOrderPageList")
//    @ApiOperation(value = "获取订单列表", tags = {"管理后台-订单管理", "门店后台-订单管理"})
    public R<PageInfo<OrderPageListVo>> getOrderPageList(OrderPageList orderPageList){
    public R<PageInfo<OrderPageListVo>> getOrderPageList(OrderPageList orderPageList) {
        return R.ok(orderService.getOrderPageList(orderPageList));
    }
@@ -315,12 +312,12 @@
    @GetMapping("/getOrderStatistics")
    @ApiOperation(value = "订单统计", tags = {"管理后台-首页统计"})
    public R<OrderStatistics> getOrderStatistics(@RequestParam("startTime") String startTime,
                                                 @RequestParam("endTime") String endTime){
                                                 @RequestParam("endTime") String endTime) {
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        List<Order> orderList = orderService.list(new LambdaQueryWrapper<Order>()
                        .ne(Order::getOrderStatus,5)
                .ne(Order::getOrderStatus, 5)
                .eq(sysUser.getRoleType() == 2, Order::getShopId, sysUser.getObjectId())
                .between(Order::getCreateTime, LocalDateTime.parse(startTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), LocalDateTime.parse(endTime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")))
                .orderByAsc(Order::getCreateTime));
@@ -348,7 +345,7 @@
                    serviceTotalMoney = serviceTotalMoney.add(order.getTotalAmount());
                    total++;
                    totalMoney = totalMoney.add(order.getTotalAmount());
                }else if (order.getOrderType().equals(2)){
                } else if (order.getOrderType().equals(2)) {
                    singleTotal++;
                    singleTotalMoney = singleTotalMoney.add(order.getTotalAmount());
                    total++;
@@ -366,11 +363,11 @@
            orderStatisticsDetails.add(orderStatisticsDetail);
        });
        Integer shopId = null;
        if(sysUser.getRoleType() == 2){
        if (sysUser.getRoleType() == 2) {
            shopId = sysUser.getObjectId();
        }
        OrderStatistics orderStatistics = orderMapper.getOrderStatistics(startTime, endTime, shopId);
        if(null != orderStatistics){
        if (null != orderStatistics) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
            List<OrderStatisticsDetail> sortedDetails = orderStatisticsDetails.stream()
                    .sorted(Comparator.comparing((OrderStatisticsDetail detail) -> {
@@ -389,15 +386,16 @@
    /**
     * 订单取消支付回退
     *
     * @param refundCallbackResult
     * @param response
     * @return
     */
    @ResponseBody
    @GetMapping("/refundPayMoneyCallback")
    public void refundPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response){
    public void refundPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response) {
        R callback = orderService.refundPayMoneyCallback(refundCallbackResult);
        if(callback.getCode() == 200){
        if (callback.getCode() == 200) {
            response.setStatus(200);
            PrintWriter out = null;
            try {
@@ -414,14 +412,15 @@
    /**
     * 取消订单快递费回退
     *
     * @param refundCallbackResult
     * @param response
     */
    @ResponseBody
    @GetMapping("/refundExpressPayMoneyCallback")
    public void refundExpressPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response){
    public void refundExpressPayMoneyCallback(RefundCallbackResult refundCallbackResult, HttpServletResponse response) {
        R callback = orderService.refundExpressPayMoneyCallback(refundCallbackResult);
        if(callback.getCode() == 200){
        if (callback.getCode() == 200) {
            response.setStatus(200);
            PrintWriter out = null;
            try {
@@ -438,31 +437,32 @@
    /**
     * 获取商品销售数量
     *
     * @param goodsId
     * @return
     */
    @PostMapping("/getGoodsSaleNum")
    public R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type){
    public R<Integer> getGoodsSaleNum(@RequestParam("goodsId") Integer goodsId, @RequestParam("type") Integer type) {
        Integer goodsSaleNum = orderService.getGoodsSaleNum(goodsId, type, null);
        return R.ok(goodsSaleNum);
    }
    /**
     * 获取门店销售订单数量
     * @param shopId    门店id
     * @param type      1:服务订单,2:单品订单
     *
     * @param shopId 门店id
     * @param type   1:服务订单,2:单品订单
     * @return
     */
    @PostMapping("/getShopSaleNum")
    public R<Integer> getShopSaleNum(@RequestParam("shopId") Integer shopId, @RequestParam("type") Integer type){
    public R<Integer> getShopSaleNum(@RequestParam("shopId") Integer shopId, @RequestParam("type") Integer type) {
        Integer shopSaleNum = orderService.getShopSaleNum(shopId, type);
        return R.ok(shopSaleNum);
    }
    @PostMapping("/getShopSaleNumByShopIds")
    public R<Integer> getShopSaleNumByShopIds(@RequestBody OrderSaleNum orderSaleNum){
    public R<Integer> getShopSaleNumByShopIds(@RequestBody OrderSaleNum orderSaleNum) {
        Integer shopSaleNum = orderService.getShopSaleNumByShopIds(orderSaleNum.getShopIds(), orderSaleNum.getType());
        return R.ok(shopSaleNum);
    }
@@ -470,29 +470,31 @@
    /**
     * 获取所有在指定门店消费的用户id
     *
     * @param shopId
     * @return
     */
    @PostMapping("/getAppUserByShoppingShop")
    public R<Set<Long>> getAppUserByShoppingShop(@RequestParam("shopId") Integer shopId){
    public R<Set<Long>> getAppUserByShoppingShop(@RequestParam("shopId") Integer shopId) {
        List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getShopId, shopId).eq(Order::getDelFlag, 0)
                .eq(Order::getPayStatus, 2).in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8)));
        Set<Long> collect = list.stream().map(Order::getAppUserId).collect(Collectors.toSet());
        return R.ok(collect);
    }
    /**
     * 获取订单快递明细
     *
     * @param id
     * @return
     */
    @GetMapping("/getOrderExpress/{id}")
    @ApiOperation(value = "获取订单快递明细", tags = {"小程序-订单管理"})
    public R<MapTrackKD100Vo> getOrderExpress(@PathVariable("id") Long id){
    public R<MapTrackKD100Vo> getOrderExpress(@PathVariable("id") Long id) {
        Order order = orderService.getById(id);
        String expressResult = order.getExpressResult();
        if(StringUtils.isNotEmpty(expressResult)){
        if (StringUtils.isNotEmpty(expressResult)) {
            MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(expressResult, MapTrackKD100Vo.class);
            return R.ok(mapTrackKD100Vo);
        }
@@ -502,11 +504,12 @@
    /**
     * 根据id获取订单详情
     *
     * @param id
     * @return
     */
    @PostMapping("/getOrderById")
    public R<Order> getOrderById(@RequestParam("id") Long id){
    public R<Order> getOrderById(@RequestParam("id") Long id) {
        Order order = orderService.getById(id);
        return R.ok(order);
    }
@@ -514,11 +517,12 @@
    /**
     * 修改订单
     *
     * @param order
     * @return
     */
    @PostMapping("/editOrder")
    public R editOrder(@RequestBody Order order){
    public R editOrder(@RequestBody Order order) {
        orderService.updateById(order);
        return R.ok();
    }
@@ -528,7 +532,7 @@
     * 导入物流信息
     */
    @PostMapping("/importExpress")
    public R importExpress(@RequestBody String url){
    public R importExpress(@RequestBody String url) {
        JSONObject jsonObject = JSONObject.parseObject(url);
        String url2 = jsonObject.getString("url");
        orderService.importExpress(url2);
@@ -539,28 +543,52 @@
     * 导出订单信息
     */
    @GetMapping("/exportExpress")
    public void exportExpress(HttpServletResponse response,OrderPageList orderPage){
        orderPage.setPageCurr(1);
        orderPage.setPageSize(Integer.MAX_VALUE);
        PageInfo<OrderPageListVo> orderPageList = orderService.getOrderPageList(orderPage);
        List<OrderPageListVo> list = orderPageList.getRecords();
        ExcelUtil<OrderPageListVo> util = new ExcelUtil<OrderPageListVo>(OrderPageListVo.class);
        util.exportExcel(response, list, "订单数据");
    public void exportExpress(HttpServletResponse response, OrderPageList orderPage) {
        List<OrderExport> orderExportList = orderMapper.getOrderExportList(orderPage);
        orderExportList.forEach(orderExport -> {
            Long appUserId = orderExport.getAppUserId();
            AppUser appUserById = appUserClient.getAppUserById(appUserId);
            if (null != appUserById){
                orderExport.setUserName(appUserById.getName());
                orderExport.setPhone(appUserById.getPhone());
            }
            String goodJson = orderExport.getGoodJson();
            if (StringUtils.isNotEmpty(goodJson) && !"NULL".equals(goodJson)) {
                Goods goods = JSONObject.parseObject(goodJson, Goods.class);
                orderExport.setGoodsName(goods.getName());
                orderExport.setCostPrice(goods.getShopCost().add(goods.getOperatingCost()));
            }
            String expressJson = orderExport.getExpressJson();
            if (StringUtils.isNotEmpty(expressJson) && !expressJson.equals("NULL")) {
                JSONObject jsonObject = JSONObject.parseObject(expressJson);
                orderExport.setExpressNum(jsonObject.getString("num"));
                orderExport.setExpressName(jsonObject.getString("com"));
            }
        });
        ExcelUtil<OrderExport> util = new ExcelUtil<OrderExport>(OrderExport.class);
        util.exportExcel(response, orderExportList, "订单数据");
    }
    /**
     * 获取用户订单数量
     *
     * @param appUserId
     * @return
     */
    @PostMapping("/getOrderCountByAppUserId")
    public R<Long> getOrderCountByAppUserId(@RequestParam("id") Long appUserId){
    public R<Long> getOrderCountByAppUserId(@RequestParam("id") Long appUserId) {
        long count = orderService.count(new LambdaQueryWrapper<Order>().eq(Order::getDelFlag, 0)
                .eq(Order::getAppUserId, appUserId).in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8))
                .eq(Order::getPayStatus, 2));
        return R.ok(count);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderGoodController.java
@@ -4,12 +4,15 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.order.model.Order;
import com.ruoyi.order.model.OrderGood;
import com.ruoyi.order.service.OrderGoodService;
import com.ruoyi.order.service.OrderService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -24,6 +27,8 @@
public class OrderGoodController extends BaseController {
    @Resource
    private OrderGoodService orderGoodService;
    @Resource
    private OrderService orderService;
    /**
     * 查询指定商品订单
@@ -40,5 +45,22 @@
    public R<List<OrderGood>> getOrderListByUserIdAndGoodsId(Long userId, Integer goodsId){
        return R.ok(orderGoodService.getOrderListByUserIdAndGoodsId(userId, goodsId));
    }
    /**
     * 获取指定用户未分销的订单
     */
    @PostMapping("/getUnDistributedOrder")
    public R<List<OrderGood>> getUnDistributedOrder(Long appUserId) {
        List<Order> list = orderService.list(new LambdaQueryWrapper<Order>()
                .eq(Order::getAppUserId, appUserId)
                .eq(Order::getIsCommission, 0)
                .eq(Order::getDelFlag, 0));
        List<Long> orderIds = list.stream().map(Order::getId).collect(Collectors.toList());
        List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
                .in(OrderGood::getOrderId, orderIds));
        return R.ok(orderGoods);
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/FreezeRecordMapper.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.order.model.FreezeRecord;
public interface FreezeRecordMapper extends BaseMapper<FreezeRecord> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/mapper/OrderMapper.java
@@ -2,10 +2,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.vo.OrderPageList;
import com.ruoyi.order.vo.OrderPageListVo;
import com.ruoyi.order.vo.OrderStatistics;
import com.ruoyi.order.vo.OrderVO;
import com.ruoyi.order.vo.*;
import com.ruoyi.order.model.Order;
import org.apache.ibatis.annotations.Param;
@@ -57,4 +54,6 @@
    Integer getShopSaleNum(@Param("shopId") Integer shopId, @Param("type") Integer type);
    Integer getShopSaleNumByShopIds(@Param("shopIds") List<Integer> shopIds, @Param("type") Integer type);
    List<OrderExport> getOrderExportList( @Param("item") OrderPageList order);
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/FreezeRecordService.java
New file
@@ -0,0 +1,7 @@
package com.ruoyi.order.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.order.model.FreezeRecord;
public interface FreezeRecordService extends IService<FreezeRecord> {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/OrderService.java
@@ -36,6 +36,13 @@
    PageInfo<OrderPageListVo> getOrderPageList(OrderPageList orderPageList);
    /**
     * 获取导出订单列表数据
     */
    List<OrderExport> getOrderExportList(OrderPageList orderPageList);
    /**
     * 小程序取消订单
     * @param orderId
     * @return
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -385,8 +385,8 @@
                }
            }
            
            //绑定门店分佣
            Shop shop1 = shopClient.getShopById(appUser.getShopId()).getData();
            //服务商分佣
            Shop shop1 = shopClient.getServiceProvider(appUser.getId()).getData();
            if(null != shop1){
                AppUser bdShopAppUser = appUserClient.getAppUserById(shop1.getAppUserId());
                if(null != bdShopAppUser){
@@ -468,88 +468,85 @@
                }
            }
    
            //上级门店分佣
            if(null != shop1){
                Integer pid = shop1.getPid();
                Shop shop2 = shopClient.getShopById(pid).getData();
                if(null != shop2){
                    AppUser sjShopAppUser = appUserClient.getAppUserById(shop2.getAppUserId());
                    if(null != sjShopAppUser){
                        BigDecimal shopBalance = shop2.getBalance();
                        Integer lavePoint = sjShopAppUser.getLavePoint();
                        Integer shopLavePoint = shop2.getLavePoint();
                        if(bdmdsj_price.compareTo(BigDecimal.ZERO) > 0){
                            //门店返佣
                            shop2.setGiveawayAllMoney(shop2.getGiveawayAllMoney().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                            shop2.setLowerLevelGiveawayMoney(shop2.getLowerLevelGiveawayMoney().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                            shop2.setCanWithdrawMoney(shop2.getCanWithdrawMoney().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                            shop2.setBalance(shop2.getBalance().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
            //高级服务商
            Shop shop2 = shopClient.getSuperiorServiceProvider(order.getAppUserId()).getData();
            if(null != shop2){
                AppUser sjShopAppUser = appUserClient.getAppUserById(shop2.getAppUserId());
                if(null != sjShopAppUser){
                    BigDecimal shopBalance = shop2.getBalance();
                    Integer lavePoint = sjShopAppUser.getLavePoint();
                    Integer shopLavePoint = shop2.getLavePoint();
                    if(bdmdsj_price.compareTo(BigDecimal.ZERO) > 0){
                        //门店返佣
                        shop2.setGiveawayAllMoney(shop2.getGiveawayAllMoney().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                        shop2.setLowerLevelGiveawayMoney(shop2.getLowerLevelGiveawayMoney().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                        shop2.setCanWithdrawMoney(shop2.getCanWithdrawMoney().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                        shop2.setBalance(shop2.getBalance().add(bdmdsj_price).setScale(2, BigDecimal.ROUND_HALF_EVEN));
                    }
                    if(bdmdsj_point > 0){
                        PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData();
                        int earnPoint1 = 0;
                        //计算可用积分比例
                        if(null != pointSetting && 1 == pointSetting.getShopSharePointOpen()){
                            earnPoint1 = new BigDecimal(bdmdsj_point).multiply(pointSetting.getShopSharePoint().divide(new BigDecimal(100))).intValue();
                        }
                        if(bdmdsj_point > 0){
                            PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData();
                            int earnPoint1 = 0;
                            //计算可用积分比例
                            if(null != pointSetting && 1 == pointSetting.getShopSharePointOpen()){
                                earnPoint1 = new BigDecimal(bdmdsj_point).multiply(pointSetting.getShopSharePoint().divide(new BigDecimal(100))).intValue();
                            }
                            sjShopAppUser.setLavePoint(sjShopAppUser.getLavePoint() + bdmdsj_point);
                            sjShopAppUser.setAvailablePoint(sjShopAppUser.getAvailablePoint() + earnPoint1);
                            sjShopAppUser.setTotalAvailablePoint(sjShopAppUser.getTotalAvailablePoint() + earnPoint1);
                            if(null != pointSetting && 1 == pointSetting.getShopSharePointGift()){
                                sjShopAppUser.setTransferablePoint(sjShopAppUser.getTransferablePoint() + earnPoint1);
                            }
                            sjShopAppUser.setTotalPoint(sjShopAppUser.getTotalPoint() + bdmdsj_point);
                            sjShopAppUser.setLowerLevelSharePoint(sjShopAppUser.getLowerLevelSharePoint() + bdmdsj_point);
                            //门店返佣
                            shop2.setShopAllPoint(shop2.getShopAllPoint() + bdmdsj_point);
                            shop2.setLowerLevelSharePoint(shop2.getLowerLevelSharePoint() + bdmdsj_point);
                            shop2.setLavePoint(shop2.getLavePoint() + bdmdsj_point);
                        sjShopAppUser.setLavePoint(sjShopAppUser.getLavePoint() + bdmdsj_point);
                        sjShopAppUser.setAvailablePoint(sjShopAppUser.getAvailablePoint() + earnPoint1);
                        sjShopAppUser.setTotalAvailablePoint(sjShopAppUser.getTotalAvailablePoint() + earnPoint1);
                        if(null != pointSetting && 1 == pointSetting.getShopSharePointGift()){
                            sjShopAppUser.setTransferablePoint(sjShopAppUser.getTransferablePoint() + earnPoint1);
                        }
                        appUserClient.editAppUserById(sjShopAppUser);
                        shopClient.updateShop(shop2);
                        //添加明细记录
                        if(!shop2.getBalance().equals(shopBalance)){
                            ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
                            shopBalanceStatement.setShopId(shop2.getId());
                            shopBalanceStatement.setType(2);
                            shopBalanceStatement.setHistoricalBalance(shopBalance);
                            shopBalanceStatement.setVariableAmount(bdmdsj_price);
                            shopBalanceStatement.setBalance(shop2.getBalance());
                            shopBalanceStatement.setCreateTime(LocalDateTime.now());
                            shopBalanceStatement.setCreateUserId(order.getAppUserId());
                            shopBalanceStatement.setObjectId(order.getId());
                            shopBalanceStatement.setExtension(order.getOrderNumber());
                            shopBalanceStatementClient.saveShopBalanceStatement(shopBalanceStatement);
                        }
                        //添加积分明细
                        if(!sjShopAppUser.getLavePoint().equals(lavePoint)){
                            UserPoint userPoint = new UserPoint();
                            userPoint.setType(14);
                            userPoint.setHistoricalPoint(lavePoint);
                            userPoint.setVariablePoint(bdmdsj_point);
                            userPoint.setBalance(sjShopAppUser.getLavePoint());
                            userPoint.setCreateTime(LocalDateTime.now());
                            userPoint.setAppUserId(sjShopAppUser.getId());
                            userPoint.setObjectId(order.getId());
                            userPoint.setExtention(order.getOrderNumber());
                            userPointClient.saveUserPoint(userPoint);
                            //变更等级
                            appUserClient.vipUpgrade(sjShopAppUser.getId());
                        }
                        sjShopAppUser.setTotalPoint(sjShopAppUser.getTotalPoint() + bdmdsj_point);
                        sjShopAppUser.setLowerLevelSharePoint(sjShopAppUser.getLowerLevelSharePoint() + bdmdsj_point);
                        //门店返佣
                        shop2.setShopAllPoint(shop2.getShopAllPoint() + bdmdsj_point);
                        shop2.setLowerLevelSharePoint(shop2.getLowerLevelSharePoint() + bdmdsj_point);
                        shop2.setLavePoint(shop2.getLavePoint() + bdmdsj_point);
                    }
                    appUserClient.editAppUserById(sjShopAppUser);
                    shopClient.updateShop(shop2);
                    //添加明细记录
                    if(!shop2.getBalance().equals(shopBalance)){
                        ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
                        shopBalanceStatement.setShopId(shop2.getId());
                        shopBalanceStatement.setType(2);
                        shopBalanceStatement.setHistoricalBalance(shopBalance);
                        shopBalanceStatement.setVariableAmount(bdmdsj_price);
                        shopBalanceStatement.setBalance(shop2.getBalance());
                        shopBalanceStatement.setCreateTime(LocalDateTime.now());
                        shopBalanceStatement.setCreateUserId(order.getAppUserId());
                        shopBalanceStatement.setObjectId(order.getId());
                        shopBalanceStatement.setExtension(order.getOrderNumber());
                        shopBalanceStatementClient.saveShopBalanceStatement(shopBalanceStatement);
                    }
                    //添加积分明细
                    if(!sjShopAppUser.getLavePoint().equals(lavePoint)){
                        UserPoint userPoint = new UserPoint();
                        userPoint.setType(14);
                        userPoint.setHistoricalPoint(lavePoint);
                        userPoint.setVariablePoint(bdmdsj_point);
                        userPoint.setBalance(sjShopAppUser.getLavePoint());
                        userPoint.setCreateTime(LocalDateTime.now());
                        userPoint.setAppUserId(sjShopAppUser.getId());
                        userPoint.setObjectId(order.getId());
                        userPoint.setExtention(order.getOrderNumber());
                        userPointClient.saveUserPoint(userPoint);
                        //变更等级
                        appUserClient.vipUpgrade(sjShopAppUser.getId());
                    }
                        if(!shop2.getLavePoint().equals(shopLavePoint)){
                            ShopPoint shopPoint = new ShopPoint();
                            shopPoint.setShopId(shop2.getId());
                            shopPoint.setType(3);
                            shopPoint.setHistoricalPoint(shopLavePoint);
                            shopPoint.setVariablePoint(bdmdsj_point);
                            shopPoint.setBalance(shop2.getLavePoint());
                            shopPoint.setCreateTime(LocalDateTime.now());
                            shopPoint.setCreateUserId(order.getAppUserId());
                            shopPoint.setObjectId(order.getId());
                            shopPoint.setOrderNum(order.getOrderNumber());
                            shopPointClient.saveShopPoint(shopPoint);
                        }
                    if(!shop2.getLavePoint().equals(shopLavePoint)){
                        ShopPoint shopPoint = new ShopPoint();
                        shopPoint.setShopId(shop2.getId());
                        shopPoint.setType(3);
                        shopPoint.setHistoricalPoint(shopLavePoint);
                        shopPoint.setVariablePoint(bdmdsj_point);
                        shopPoint.setBalance(shop2.getLavePoint());
                        shopPoint.setCreateTime(LocalDateTime.now());
                        shopPoint.setCreateUserId(order.getAppUserId());
                        shopPoint.setObjectId(order.getId());
                        shopPoint.setOrderNum(order.getOrderNumber());
                        shopPointClient.saveShopPoint(shopPoint);
                    }
                }
            }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/FreezeRecordServiceImpl.java
New file
@@ -0,0 +1,11 @@
package com.ruoyi.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.order.mapper.FreezeRecordMapper;
import com.ruoyi.order.model.FreezeRecord;
import com.ruoyi.order.service.FreezeRecordService;
import org.springframework.stereotype.Service;
@Service
public class FreezeRecordServiceImpl extends ServiceImpl<FreezeRecordMapper, FreezeRecord> implements FreezeRecordService {
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -1091,4 +1091,9 @@
    public Integer getShopSaleNumByShopIds(List<Integer> shopIds, Integer type) {
        return this.baseMapper.getShopSaleNumByShopIds(shopIds, type);
    }
    @Override
    public List<OrderExport> getOrderExportList(OrderPageList orderPageList) {
        return Collections.emptyList();
    }
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/TaskUtil.java
@@ -30,7 +30,7 @@
    @Scheduled(fixedRate = 60000)
    public void taskMonth() {
        commissionService.calculationCommission();
        commissionService.calculationCommission(); //2.18版本修改为下单后计算返佣金额
        shoppingCartService.closeOrder();
        orderService.taskExpress();
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderExport.java
@@ -1,5 +1,112 @@
package com.ruoyi.order.vo;
import com.ruoyi.common.core.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class OrderExport {
    /**
     * 订单状态
     */
    @Excel(name = "订单状态")
    private String status;
    /**
     * 订单编号
     */
    @Excel(name = "订单编号")
    private String code;
    /**
     * 订单类型
     */
    @Excel(name = "订单类型")
    private String orderType;
    /**
     * 下单时间
     */
    @Excel(name = "下单时间")
    private String createTime;
    /**
     * 下单用户
     */
    @Excel(name = "下单用户")
    private String userName;
    private Long appUserId;
    /**
     * 联系方式
     */
    @Excel(name = "联系方式")
    private String phone;
    /**
     * 商品名称
     */
    @Excel(name = "商品名称")
    private String goodsName;
    /**
     * 商品售价
     */
    @Excel(name = "商品售价")
    private BigDecimal goodsPrice;
    /**
     * 成本价
     */
    @Excel(name = "成本价")
    private BigDecimal costPrice;
    /**
     * 支付金额
     */
    @Excel(name = "支付金额")
    private String orderMoney;
    /**
     * 快递单号
     */
    @Excel(name = "快递单号")
    private String expressNum;
    private String expressJson;
    private String goodJson;
    /**
     * 快递公司
     */
    @Excel(name = "快递公司")
    private String expressName;
    /**
     * 省
     */
    @Excel(name = "省")
    private String province;
    /**
     * 省区划代码
     */
    @Excel(name = "省区划代码")
    private String provinceCode;
    /**
     * 市
     */
    @Excel(name = "市")
    private String city;
    /**
     * 市区划代码
     */
    @Excel(name = "市区划代码")
    private String cityCode;
}
ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -156,4 +156,53 @@
            and order_type = #{type}
        </if>
    </select>
    <select id="getOrderExportList" resultType="com.ruoyi.order.vo.OrderExport">
        SELECT
            o.order_status,
            o.order_number,
            o.order_type,
            o.create_time,
            o.app_user_id,
            og.goods_id,
            og.selling_price,
            og.good_json,
            og.selling_price orderMoney,
            o.express_json,
            o.deliver_province province,
            o.deliver_province_code provinceCode,
            o.deliver_city city,
            o.deliver_city_code cityCode
        FROM
            t_order_good og
                LEFT JOIN t_order o ON og.order_id = o.id
        where  o.del_flag = 0 and o.pay_status = 2
        <if test="null != item.code and '' != item.code">
            and o.order_number like CONCAT('%', #{item.code}, '%')
        </if>
        <if test="null != item.appUserIds and item.appUserIds.size() > 0">
            and o.app_user_id in
            <foreach collection="item.appUserIds" separator="," item="tem" index="index" open="(" close=")">
                #{tem}
            </foreach>
        </if>
        <if test="null != item.goodsType">
            and o.order_type = #{item.goodsType}
        </if>
        <if test="null != item.paymentType">
            and o.pay_method = #{item.paymentType}
        </if>
        <if test="null != item.status and 4 != item.status">
            and o.order_status = #{item.status}
        </if>
        <if test="null != item.status and 4 == item.status">
            and o.order_status in (4, 8)
        </if>
        <if test="null != item.shopId">
            and o.shop_id = #{item.shopId} and distribution_mode != 2
        </if>
        <if test="null != item.startTime and null != item.endTime">
            and o.create_time between #{item.startTime} and #{item.endTime}
        </if>
        order by o.create_time desc
    </select>
</mapper>
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -863,5 +863,70 @@
        return R.ok(map);
    }
    /**
     * 获取指定用户的服务商
     * @param userId
     * @return
     */
    @GetMapping("/getServiceProvider")
    public R<Shop> getServiceProvider(Long userId){
        List<AppUser> allSuperiors = getAllSuperiors(userId);
        //当前绑定门店的店铺信息(服务商)
        Shop serviceProvider = null;
        for (AppUser allSuperior : allSuperiors) {
            List<Shop> shopList = shopService.lambdaQuery().eq(Shop::getAppUserId, allSuperior.getId()).eq(Shop::getDelFlag,0).list();
            if (!CollectionUtils.isEmpty(shopList)){
                serviceProvider = shopList.get(0);
                break;
            }
        }
        return R.ok(serviceProvider);
    }
    /**
     * 获取指定用户的高级服务商
     * @return
     */
    @GetMapping("/getSuperiorServiceProvider")
    public R<Shop> getSuperiorServiceProvider(Long userId){
        List<AppUser> allSuperiors = getAllSuperiors(userId);
        Long techerId = null;
        for (AppUser allSuperior : allSuperiors) {
            List<Shop> shopList = shopService.lambdaQuery().eq(Shop::getAppUserId, allSuperior.getId()).eq(Shop::getDelFlag,0).list();
            if (!CollectionUtils.isEmpty(shopList)){
                techerId = allSuperior.getId();
                break;
            }
        }
        if (techerId == null){
            return R.fail("暂无高级服务商");
        }
        List<AppUser> allSuperiors1 = getAllSuperiors(techerId);
        for (AppUser allSuperior : allSuperiors1) {
            List<Shop> shopList = shopService.lambdaQuery().eq(Shop::getAppUserId, allSuperior.getId()).eq(Shop::getDelFlag,0).list();
            if (!CollectionUtils.isEmpty(shopList)){
                return R.ok(shopList.get(0));
            }
        }
        return R.fail("暂无高级服务商");
    }
    public List<AppUser> getAllSuperiors(Long userId) {
        List<AppUser> allSuperiors = new ArrayList<>();
        // 获取当前用户的直接上级
        AppUser currentUser = appUserClient.getAppUserById(userId);
        if (currentUser != null && currentUser.getInviteUserId() != null) {
            AppUser superior = appUserClient.getAppUserById(currentUser.getInviteUserId());
            if (superior != null) {
                allSuperiors.add(superior); // 添加直接上级
                allSuperiors.addAll(getAllSuperiors(superior.getId())); // 递归添加上级的上级
            }
        }
        return allSuperiors;
    }
}
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -424,6 +424,8 @@
        goodsVipList.forEach(item -> {
            item.setId(null);
            item.setGoodsId(id);
            item.setSuperiorType("2");
            item.setSuperiorPriceType("2");
        });
        goodsVipService.saveBatch(goodsVipList);
    }