ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -95,6 +95,11 @@ } @Override public R<List<AppUser>> setLowerUserShop(Long userId, Integer shopId) { return R.fail(); } @Override public List<AppUser> listByIds(List<Long> list) { log.error("获取用户失败: "+cause.getMessage()); return Collections.emptyList(); ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -81,6 +81,14 @@ @PostMapping("/app-user/getAppUserByPhone1") R<AppUser> getAppUserByPhone1(@RequestParam("phone") String phone); /** * 获得指定用户的下级用户 * @param userId * @return */ @PutMapping("/app-user/setLowerUserShop") R<List<AppUser>> setLowerUserShop(@RequestParam("userId") Long userId,@RequestParam("shopId") Integer shopId); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -654,6 +654,19 @@ return R.ok(appUser); } /** * 设置指定用户的下级用户绑定门店 */ @PutMapping("setLowerUserShop") public R<Void> setLowerUserShop(@RequestParam("userId") Long userId,@RequestParam("shopId") Integer shopId) { appUserService.update(new LambdaUpdateWrapper<AppUser>() .set(AppUser::getShopId,shopId) .eq(AppUser::getInviteUserId, userId)); return R.ok(); } /** * 用户统计 */ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -94,10 +94,10 @@ @Transactional(rollbackFor = Exception.class) public R<Void> add(@RequestBody Shop shop){ String phone = shop.getPhone(); if (!shopService.cheUserByPhone(phone)) { AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); if (appUser == null){ return R.fail("该手机号未注册"); } AppUser appUser = appUserClient.getAppUserByPhone1(phone).getData(); shop.setShopAllPoint(0); shop.setLowerLevelSharePoint(0); shop.setSharePoint(0); @@ -173,6 +173,12 @@ userShop.setRoleId(2L); userShopClient.saveUserShop(userShop); } // 更换下级会员绑定门店 R<List<AppUser>> lowerShopR = appUserClient.setLowerUserShop(appUser.getId(), shop.getId()); if (R.isError(lowerShopR)){ throw new RuntimeException("更换下级会员绑定门店失败"); } return R.ok(); }