From 485b09d75ac79350392e234a62521050bf6374de Mon Sep 17 00:00:00 2001 From: luofl <1442745593@qq.com> Date: 星期二, 04 三月 2025 11:00:43 +0800 Subject: [PATCH] 修改物流信息导入模板 --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 71 +++++++++++++++++++++++++++++++++++ 1 files changed, 70 insertions(+), 1 deletions(-) diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index d4e3f19..54cf198 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -678,8 +678,17 @@ @PostMapping("/getShopIdByName") public R<Set<Integer>> getShopIdByName(@RequestParam("shopName") String shopName){ List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>() - .like(Shop::getName, shopName)); + .like(Shop::getName, shopName) + .eq(Shop::getDelFlag, 0)); return R.ok(list.stream().map(Shop::getId).collect(Collectors.toSet())); + } + + @PostMapping("/getManagerByManagerName") + public R<Set<Long>> getManagerByManagerName(@RequestParam("managerName") String managerName){ + List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>() + .like(Shop::getShopManager, managerName) + .eq(Shop::getDelFlag, 0)); + return R.ok(list.stream().map(Shop::getAppUserId).collect(Collectors.toSet())); } /** @@ -863,5 +872,65 @@ return R.ok(map); } + /** + * 获取指定用户的服务商 + * @param userId + * @return + */ + @GetMapping("/getServiceProvider") + 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(appUserId); + //上级集合,防止循环关联 + Set<Long> pid = new HashSet<>(); + Shop shop = getSuperiorStore(appUser, list, 1, 1, pid); + return R.ok(shop); + } + + + + public Shop getSuperiorStore(AppUser appUser, List<Shop> list, Integer hierarchy, Integer num, Set<Long> pid){ + if(null == appUser.getInviteUserId()){ + return null; + } + if(pid.contains(appUser.getInviteUserId())){ + return null; + } + AppUser appUser1 = appUserClient.getAppUserById(appUser.getInviteUserId()); + if(null != appUser1){ + Optional<Shop> first = list.stream().filter(shop -> shop.getAppUserId().equals(appUser1.getId())).findFirst(); + if(first.isPresent()){ + if(hierarchy.equals(num)){ + return first.get(); + } + num++; + } + } + return getSuperiorStore(appUser1, list, hierarchy, num, pid); + } + + + + + + + + + /** + * 获取指定用户的高级服务商 + * @return + */ + @GetMapping("/getSuperiorServiceProvider") + 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(appUserId); + //上级集合,防止循环关联 + Set<Long> pid = new HashSet<>(); + Shop shop = getSuperiorStore(appUser, list, 2, 1, pid); + return R.ok(shop); + } + } -- Gitblit v1.7.1