Pu Zhibing
2025-02-26 ed76f62db481ab1a8c125cf01d5122d1e1606266
修改分佣逻辑
18个文件已修改
205 ■■■■■ 已修改文件
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/factory/AppUserGiveawayTemporaryClientFallbackFactory.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserGiveawayTemporaryClient.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopGiveawayTemporary.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopGiveawayTemporaryClientFallbackFactory.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopGiveawayTemporaryClient.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserGiveawayTemporaryController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/TaskUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopGiveawayTemporaryController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -43,7 +43,6 @@
                throw new RuntimeException("获取优惠券数量失败");
            }
            @GetMapping("/appUserShop/shop/{userId}")
            @Override
            public R<List<AppUserShop>> getAppUserShop(Long userId) {
                log.error("获取用户门店信息失败:{}", cause.getMessage());
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserGiveawayTemporaryClientFallbackFactory.java
@@ -25,8 +25,10 @@
                return R.fail("查询订单临时分佣数据失败:" + cause.getMessage());
            }
        
        };
            @Override
            public R delAppUserGiveawayTemporary(Long orderId) {
                return R.fail("删除订单临时分佣数据失败:" + cause.getMessage());
            }};
        
        
        
ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserGiveawayTemporaryClient.java
@@ -33,4 +33,13 @@
     */
    @PostMapping("/appUserGiveawayTemporary/getAppUserGiveawayTemporary")
    R<List<AppUserGiveawayTemporary>> getAppUserGiveawayTemporary(@RequestParam("orderId") Long orderId);
    /**
     * 删除订单临时分佣数据
     * @param orderId
     * @return
     */
    @PostMapping("/appUserGiveawayTemporary/delAppUserGiveawayTemporary")
    R delAppUserGiveawayTemporary(@RequestParam("orderId") Long orderId);
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ShopGiveawayTemporary.java
@@ -30,8 +30,8 @@
    private static final long serialVersionUID = 1L;
    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @TableId("id")
    private Long id;
    @ApiModelProperty(value = "门店id")
    @TableField("shop_id")
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopGiveawayTemporaryClientFallbackFactory.java
@@ -24,6 +24,9 @@
            public R<List<ShopGiveawayTemporary>> getShopGiveawayTemporary(Long orderId) {
                return R.fail("获取订单相关门店分佣临时数据失败:" + cause.getMessage());
            }
        };
            @Override
            public R delShopGiveawayTemporary(Long orderId) {
                return R.fail("删除订单相关门店分佣临时数据失败:" + cause.getMessage());
            }};
    }
}
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopGiveawayTemporaryClient.java
@@ -34,4 +34,11 @@
     */
    @PostMapping("/shopGiveawayTemporary/getShopGiveawayTemporary")
    R<List<ShopGiveawayTemporary>> getShopGiveawayTemporary(@RequestParam("orderId") Long orderId);
    /**
     * 删除订单相关门店分佣临时数据
     * @param orderId
     */
    @PostMapping("/shopGiveawayTemporary/delShopGiveawayTemporary")
    R delShopGiveawayTemporary(@RequestParam("orderId") Long orderId);
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -481,21 +481,13 @@
                .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;
        Shop shop1 = shopClient.getServiceProvider(userId).getData();
        if(null != shop1){
            user.setShopName(shop1.getName());
            user.setShopId(shop1.getId());
            }
        }
//        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);
        // 获取当前用户的所有下级
@@ -891,11 +883,9 @@
        Long userid = tokenService.getLoginUser().getUserid();
        SysUser sysUser = sysUserClient.getSysUser(userid).getData();
        AppUser byId = appUserService.getById(id);
        if (byId.getShopId() != null) {
            R<Shop> shopById = shopClient.getShopById(Integer.parseInt(String.valueOf(byId.getShopId())));
            if (shopById.getData() != null) {
                byId.setShopName(shopById.getData().getName());
            }
        Shop shop1 = shopClient.getServiceProvider(id).getData();
        if(null != shop1){
            byId.setShopName(shop1.getName());
        }
        R<List<Shop>> shopByUserId = shopClient.getShopByUserId(id);
        if (shopByUserId.getData() != null) {
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserGiveawayTemporaryController.java
@@ -38,4 +38,16 @@
        List<AppUserGiveawayTemporary> list = appUserGiveawayTemporaryService.list(new LambdaQueryWrapper<AppUserGiveawayTemporary>().eq(AppUserGiveawayTemporary::getOrderId, orderId));
        return R.ok(list);
    }
    /**
     * 删除订单临时分佣数据
     * @param orderId
     * @return
     */
    @PostMapping("/delAppUserGiveawayTemporary")
    public R delAppUserGiveawayTemporary(@RequestParam("orderId") Long orderId){
        appUserGiveawayTemporaryService.remove(new LambdaQueryWrapper<AppUserGiveawayTemporary>().eq(AppUserGiveawayTemporary::getOrderId, orderId));
        return R.ok();
    }
}
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java
@@ -131,7 +131,7 @@
    }
    
    
    @DeleteMapping("/getUserPointCopy")
    @PostMapping("/getUserPointCopy")
    public R<List<UserPointCopy>> getUserPointCopy(@RequestParam("orderId") Long orderId, @RequestParam("type") List<Integer> type) {
        List<UserPointCopy> list = userPointCopyMapper.selectList(new LambdaQueryWrapper<UserPointCopy>().in(UserPointCopy::getType, type)
                .eq(UserPointCopy::getObjectId, orderId));
ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserPointMapper.xml
@@ -90,6 +90,6 @@
            <if test="null != type">
                and type = #{type}
            </if>
        ) as a order by a.create_time desc
        ) as a order by a.createTime desc
    </select>
</mapper>
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -176,7 +176,6 @@
        Long days = jsonObject.getLong("days");
        Order order = orderService.getById(orderId);
        order.setAfterSaleTime(LocalDateTime.now().plusDays(days));
        order.setIsCommission(0);
        order.setOrderStatus(OrderStatus.COMPLETED.getCode());
        orderService.updateById(order);
        return R.ok();
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/CommissionService.java
@@ -14,12 +14,12 @@
    /**
     * 构建个人分佣临时数据
     */
    void calculationCommissionUser();
    void calculationCommissionUser(Long orderId);
    
    /**
     * 构建门店及技师分佣临时数据
     */
    void calculationCommissionShop();
    void calculationCommissionShop(Long orderId);
    
}
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java
@@ -90,7 +90,7 @@
                    Integer totalAvailablePoint = 0;
                    Integer transferablePoint = 0;
                    for (AppUserGiveawayTemporary datum : data) {
                        if(datum.getAppUserId().longValue() != appUserId){
                        if(datum.getAppUserId().longValue() == appUserId){
                            sharePoint += datum.getSharePoint();
                            balance = balance.add(datum.getBalance());
                            withdrawableAmount = withdrawableAmount.add(datum.getWithdrawableAmount());
@@ -180,43 +180,54 @@
            
            //开始处理明细流水
            List<BalanceChangeRecordCopy> data2 = balanceChangeRecordClient.getBalanceChangeRecordCopy(order.getId(), Arrays.asList(4)).getData();
            if(null != data2){
            for(BalanceChangeRecordCopy item : data2){
                BalanceChangeRecord changeRecord = new BalanceChangeRecord();
                BeanUtil.copyProperties(item, changeRecord);
                changeRecord.setId(null);
                balanceChangeRecordClient.saveBalanceChangeRecord(changeRecord);
            }
            }
            balanceChangeRecordClient.deleteBalanceChangeRecordCopy(order.getId(), Arrays.asList(4));
            
            List<UserPointCopy> data3 = userPointClient.getUserPointCopy(order.getId(), Arrays.asList(2,8,9,10,14)).getData();
            if(null != data3){
            for(UserPointCopy item : data3){
                UserPoint userPoint = new UserPoint();
                BeanUtil.copyProperties(item, userPoint);
                userPoint.setId(null);
                userPointClient.saveUserPoint(userPoint);
            }
            }
            userPointClient.deleteUserPointCopy(order.getId(), Arrays.asList(2,8,9,10,14));
            
            
            List<ShopBalanceStatementCopy> data4 = shopBalanceStatementClient.getShopBalanceStatementCopy(order.getId(), Arrays.asList(1,2,3)).getData();
            if(null != data4){
            for(ShopBalanceStatementCopy item : data4){
                ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement();
                BeanUtil.copyProperties(item, shopBalanceStatement);
                shopBalanceStatement.setId(null);
                shopBalanceStatementClient.saveShopBalanceStatement(shopBalanceStatement);
            }
            }
            shopBalanceStatementClient.deleteShopBalanceStatementCopy(order.getId(), Arrays.asList(1,2,3));
            
            List<ShopPointCopy> data5 = shopPointClient.getShopPointCopy(order.getId(), Arrays.asList(1,2,3)).getData();
            if(null != data5){
            for(ShopPointCopy item : data5){
                ShopPoint shopPoint = new ShopPoint();
                BeanUtil.copyProperties(item, shopPoint);
                shopPoint.setId(null);
                shopPointClient.saveShopPoint(shopPoint);
            }
            }
            shopPointClient.deleteShopPointCopy(order.getId(), Arrays.asList(1,2,3));
            order.setIsCommission(3);
            orderService.updateById(order);
            appUserGiveawayTemporaryClient.delAppUserGiveawayTemporary(order.getId());
            shopGiveawayTemporaryClient.delShopGiveawayTemporary(order.getId());
        }
        
    }
@@ -225,20 +236,14 @@
    
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void calculationCommissionUser() {
        List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().ne(Order::getIsCommission, 1).isNotNull(Order::getAfterSaleTime)
                .eq(Order::getDelFlag, 0).ne(Order::getPayMethod, 3).last(" and after_sale_time <= now()"));
        List<Long> collect = list.stream().map(Order::getId).collect(Collectors.toList());
        if(collect.size() == 0){
            return;
        }
        for (Order order : list) {
    public void calculationCommissionUser(Long orderId) {
        Order order = orderService.getById(orderId);
            List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
                    .eq(OrderGood::getOrderId, order.getId()));
            AppUser appUser = appUserClient.getAppUserById(order.getAppUserId());
            if(null == appUser){
                continue;
            log.error("无效的用户数据");
            return;
            }
            //指导老师分佣金额
            BigDecimal zdls_price = BigDecimal.ZERO;
@@ -272,6 +277,9 @@
            //直帮上级
            AppUser superiorLeader = appUserClient.getSuperiorLeader(appUser.getId()).getData();
        if(null == superiorLeader){
            log.error("指导老师查询失败");
        }
            if(null != superiorLeader){
                BigDecimal balance = superiorLeader.getBalance();
                Integer lavePoint = superiorLeader.getLavePoint();
@@ -355,8 +363,14 @@
            //服务商分佣
            Shop shop1 = shopClient.getServiceProvider(appUser.getId()).getData();
        if(null == shop1){
            log.error("服务商查询失败");
        }
            if(null != shop1){
                AppUser bdShopAppUser = appUserClient.getAppUserById(shop1.getAppUserId());
            if(null == bdShopAppUser){
                log.error("服务商用户查询失败");
            }
                if(null != bdShopAppUser){
                    BigDecimal shopBalance = shop1.getBalance();
                    Integer lavePoint = bdShopAppUser.getLavePoint();
@@ -471,8 +485,14 @@
            //高级服务商
            Shop shop2 = shopClient.getSuperiorServiceProvider(order.getAppUserId()).getData();
        if(null == shop2){
            log.error("高级服务商查询失败");
        }
            if(null != shop2){
                AppUser sjShopAppUser = appUserClient.getAppUserById(shop2.getAppUserId());
            if(null == sjShopAppUser){
                log.error("高级服务商用户查询失败");
            }
                if(null != sjShopAppUser){
                    BigDecimal shopBalance = shop2.getBalance();
                    Integer lavePoint = sjShopAppUser.getLavePoint();
@@ -589,28 +609,25 @@
                }
            }
        //自提单品和服务需要走线下核销流程
        if(order.getOrderType() == 2 && order.getDistributionMode() == 2){
            order.setIsCommission(2);
        }else{
            order.setIsCommission(1);
            orderService.updateById(order);
        }
        orderService.updateById(order);
    }
    
    
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void calculationCommissionShop() {
        List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().ne(Order::getIsCommission, 2).isNotNull(Order::getAfterSaleTime)
                .eq(Order::getDelFlag, 0).ne(Order::getPayMethod, 3).last(" and after_sale_time <= now()"));
        List<Long> collect = list.stream().map(Order::getId).collect(Collectors.toList());
        if(collect.size() == 0){
            return;
        }
        for (Order order : list) {
    public void calculationCommissionShop(Long orderId) {
        Order order = orderService.getById(orderId);
            List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>()
                    .eq(OrderGood::getOrderId, order.getId()));
            AppUser appUser = appUserClient.getAppUserById(order.getAppUserId());
            if(null == appUser){
                continue;
            return;
            }
            //核销门店分佣金额
            BigDecimal hxmd_price = BigDecimal.ZERO;
@@ -632,6 +649,9 @@
            //核销门店
            Shop shop = shopClient.getShopById(order.getShopId()).getData();
            AppUser shopAppUser = appUserClient.getAppUserById(shop.getAppUserId());
        if(null == shopAppUser){
            log.error("核销门店用户查询失败");
        }
            if(null != shopAppUser){
                BigDecimal shopBalance = shop.getBalance();
                Integer lavePoint = shopAppUser.getLavePoint();
@@ -715,7 +735,7 @@
                    shopBalanceStatementClient.saveShopBalanceStatementCopy(shopBalanceStatementCopy);
                }
                //添加积分明细
                if(!shopAppUser.getLavePoint().equals(lavePoint)){
            if(hxmd_point > 0){
                    UserPointCopy userPointCopy = new UserPointCopy();
                    userPointCopy.setType(8);
                    userPointCopy.setHistoricalPoint(lavePoint);
@@ -730,7 +750,7 @@
//                    appUserClient.vipUpgrade(shopAppUser.getId());
                }
                
                if(!shop.getLavePoint().equals(shopLavePoint)){
            if(hxmd_point > 0){
                    ShopPointCopy shopPointCopy = new ShopPointCopy();
                    shopPointCopy.setShopId(shop.getId());
                    shopPointCopy.setType(1);
@@ -748,6 +768,9 @@
            //技师服务积分
            if(order.getOrderType() == 1){
                Technician technician = technicianClient.shopdetail(order.getTechnicianId()).getData();
            if(null == technician){
                log.error("技师查询失败");
            }
                if(null != technician){
                    AppUser technicianAppUser = appUserClient.getAppUserById(technician.getAppUserId());
                    if(null != technicianAppUser){
@@ -785,7 +808,7 @@
                        }
//                        appUserClient.editAppUserById(technicianAppUser);
                        //添加积分明细
                        if(!technicianAppUser.getLavePoint().equals(lavePoint)){
                    if(js_point > 0){
                            UserPointCopy userPointCopy = new UserPointCopy();
                            userPointCopy.setType(10);
                            userPointCopy.setHistoricalPoint(lavePoint);
@@ -806,7 +829,6 @@
            
            order.setIsCommission(2);
            orderService.updateById(order);
        }
    }
    
    
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -133,6 +133,10 @@
    @Resource
    private RegionClient regionClient;
    @Resource
    private AppUserGiveawayTemporaryClient appUserGiveawayTemporaryClient;
    @Resource
    private ShopGiveawayTemporaryClient shopGiveawayTemporaryClient;
    @Override
@@ -293,15 +297,14 @@
        JSONObject jsonObject = JSONObject.parseObject(content);
        Long days = jsonObject.getLong("days");
        order.setOrderStatus(OrderStatus.COMPLETED.getCode());
        order.setIsCommission(0);
        order.setAfterSaleTime(LocalDateTime.now().plusDays(days));
        order.setEndTime(LocalDateTime.now());
        order.setCancellerAppUserId(loginUserApplet.getUserid());
        if (StringUtils.isNotEmpty(technicianId) && !"null".equals(technicianId)) {
            order.setTechnicianId(Integer.valueOf(technicianId));
        }
        // TODO
        orderMapper.updateById(order);
        commissionService.calculationCommissionShop(order.getId());
    }
@@ -456,6 +459,8 @@
            throw new RuntimeException("订单取消失败");
        }
        shopPointClient.deleteShopPointCopy(orderId, Arrays.asList(1,2,3));
        appUserGiveawayTemporaryClient.delAppUserGiveawayTemporary(orderId);
        shopGiveawayTemporaryClient.delShopGiveawayTemporary(orderId);
        return r;
    }
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -1435,15 +1435,7 @@
            orderBalancePaymentService.save(orderBalancePayment);
        }
        
        //异步线程执行分佣临时数据构建
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), new ThreadPoolExecutor.DiscardPolicy());
        threadPoolExecutor.execute(new Runnable() {
            @Override
            public void run() {
                commissionService.calculationCommissionUser();
                commissionService.calculationCommissionShop();
            }
        });
        commissionService.calculationCommissionUser(order.getId());
        return R.ok(order.getId().toString());
    }
@@ -1548,15 +1540,7 @@
            goodsClient.editGoodsNum(goodsId, 1);
        }
        
        //异步线程执行分佣临时数据构建
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), new ThreadPoolExecutor.DiscardPolicy());
        threadPoolExecutor.execute(new Runnable() {
            @Override
            public void run() {
                commissionService.calculationCommissionUser();
                commissionService.calculationCommissionShop();
            }
        });
        commissionService.calculationCommissionUser(order.getId());
        return R.ok();
    }
    
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(); //2.18版本修改为下单后计算返佣金额
        commissionService.calculationCommission();
        shoppingCartService.closeOrder();
        orderService.taskExpress();
    }
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -869,10 +869,10 @@
     * @return
     */
    @GetMapping("/getServiceProvider")
    public R<Shop> getServiceProvider(Long userId){
    public R<Shop> getServiceProvider(@RequestParam("appUserId") Long appUserId){
        //向上找获取第一个开店的门店
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        AppUser appUser = appUserClient.getAppUserById(userId);
        AppUser appUser = appUserClient.getAppUserById(appUserId);
        //上级集合,防止循环关联
        Set<Long> pid = new HashSet<>();
        Shop shop = getSuperiorStore(appUser, list, 1, 1, pid);
@@ -913,10 +913,10 @@
     * @return
     */
    @GetMapping("/getSuperiorServiceProvider")
    public R<Shop> getSuperiorServiceProvider(Long userId){
    public R<Shop> getSuperiorServiceProvider(@RequestParam("appUserId") Long appUserId){
        //向上找获取第一个开店的门店
        List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1));
        AppUser appUser = appUserClient.getAppUserById(userId);
        AppUser appUser = appUserClient.getAppUserById(appUserId);
        //上级集合,防止循环关联
        Set<Long> pid = new HashSet<>();
        Shop shop = getSuperiorStore(appUser, list, 2, 1, pid);
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopGiveawayTemporaryController.java
@@ -42,4 +42,15 @@
        List<ShopGiveawayTemporary> list = shopGiveawayTemporaryService.list(new LambdaQueryWrapper<ShopGiveawayTemporary>().eq(ShopGiveawayTemporary::getOrderId, orderId));
        return R.ok(list);
    }
    /**
     * 删除订单相关门店分佣临时数据
     * @param orderId
     */
    @PostMapping("/delShopGiveawayTemporary")
    public R delShopGiveawayTemporary(@RequestParam("orderId") Long orderId){
        shopGiveawayTemporaryService.remove(new LambdaQueryWrapper<ShopGiveawayTemporary>().eq(ShopGiveawayTemporary::getOrderId, orderId));
        return R.ok();
    }
}