huliguo
2 天以前 0cf3e63218f09805c19763d3b828537ef3a895cc
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -1998,6 +1998,21 @@
        if (shop.getShopType()==2){
            //经销商转加盟商:  先解绑该经销商下所有加盟商
            shopMapper.setBelongShopIdNull(shopId);
        } else {
            //该加盟商所属区域下的加盟商 改为该新转换的经销商
            List<String> areaCodes = Optional.ofNullable(shop.getSignAreaCode())
                    .map(codes -> codes.split(";"))
                    .map(Arrays::asList)
                    .orElse(Collections.emptyList());//签约区域
            if (!areaCodes.isEmpty()){
                // 1. 查询符合条件的加盟商列表
                List<Long> shopIds = shopMapper.getShopListBySignAreaCodes(areaCodes);
                // 2. 批量更新(优化性能,避免循环中单条更新)
                if(null != shopIds && !shopIds.isEmpty()){
                    shopMapper.updateBelongShopIdBatch(shopIds,shop.getShopId());
                }
            }
        }
        shop.setUpdateUserId(SecurityUtils.getUserId());
        shopMapper.updateById(shop);
@@ -2052,11 +2067,24 @@
                        .setDelFlag(0));
            }
        }
        shopFileService.saveBatch(coverUrlList);
        shopFileService.saveBatch(bannerList);
        //批量修改门店信息
        oneClinkSyncing.setShopIdList(shopIdList);
        shopMapper.updateShopByOneClinkSyncing(oneClinkSyncing);
        return R.ok();
    }
    @Override
    public List<String> getRelUserShop(Long userId) {
        List<ShopRelUser> shopRelUserList = shopRelUserService.getByUserId(userId);
        List<Long> shopIds = shopRelUserList.stream().map(ShopRelUser::getShopId).collect(Collectors.toList());
        if(!shopIds.isEmpty()){
            List<Shop> shops = shopMapper.selectList(new LambdaQueryWrapper<Shop>()
                    .ne(Shop::getShopStatus,-1)
                    .in(Shop::getShopId,shopIds));
            return shops.stream().map(Shop::getShopName).collect(Collectors.toList());
        }
        return null;
    }
}