| | |
| | | shop.setDistrictCode(city); |
| | | shopService.save(shop); |
| | | |
| | | Integer shopId = shop.getId(); |
| | | |
| | | AppUserShop appUserShop = new AppUserShop(); |
| | | appUserShop.setAppUserId(appUser.getId()); |
| | | appUserShop.setShopId(shop.getId()); |
| | | appUserShop.setShopId(shopId); |
| | | R<Void> r = appUserClient.addAppUserShop(appUserShop); |
| | | if (R.isError(r)){ |
| | | throw new RuntimeException("添加失败"); |
| | |
| | | if(null != sysUser){ |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(sysUser.getUserId()); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setShopId(shopId); |
| | | userShop.setRoleType(1); |
| | | userShop.setNickName(sysUser.getNickName()); |
| | | List<UserShop> data = userShopClient.getUserShop(userShop).getData(); |
| | | if(null == data || data.size() == 0){ |
| | | userShop = new UserShop(); |
| | | userShop.setUserId(sysUser.getUserId()); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setShopId(shopId); |
| | | userShop.setRoleType(1); |
| | | userShop.setRoleId(2L); |
| | | userShop.setCreateTime(LocalDateTime.now()); |
| | |
| | | user.setStatus("0"); |
| | | user.setDelFlag("0"); |
| | | user.setRoleType(2); |
| | | user.setObjectId(shop.getId()); |
| | | user.setObjectId(shopId); |
| | | user.setAppUserId(appUser.getId()); |
| | | user.setPassword(phone.substring(5)); |
| | | user.setCreateTime(new Date()); |
| | |
| | | |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setUserId(userId); |
| | | userShop.setShopId(shop.getId()); |
| | | userShop.setShopId(shopId); |
| | | userShop.setRoleType(1); |
| | | userShop.setRoleId(2L); |
| | | userShopClient.saveUserShop(userShop); |
| | | } |
| | | |
| | | // 更换下级会员绑定门店 |
| | | R<List<AppUser>> lowerShopR = appUserClient.setLowerUserShop(appUser.getId(), shop.getId()); |
| | | R<List<AppUser>> lowerShopR = appUserClient.setLowerUserShop(appUser.getId(), shopId); |
| | | if (R.isError(lowerShopR)){ |
| | | throw new RuntimeException("更换下级会员绑定门店失败"); |
| | | } |
| | |
| | | } |
| | | } |
| | | String city = TencentMapUtil.inverseGeographicalAnalysis(shop.getLongitude(), shop.getLatitude(), false); |
| | | if(!StringUtils.hasLength(city)){ |
| | | city = "510100"; |
| | | } |
| | | shop.setProvinceCode(city.substring(0, 2) + "0000"); |
| | | shop.setCityCode(city.substring(0, 4) + "00"); |
| | | shop.setDistrictCode(city); |
| | |
| | | return R.ok(new ArrayList<>()); |
| | | } |
| | | List<Integer> shopIds = appUserShopList.stream().map(AppUserShop::getShopId).collect(Collectors.toList()); |
| | | List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); |
| | | List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0)); |
| | | long count = shopList.stream().filter(s -> s.getStatus() == 1).count(); |
| | | if(shopList.size() > 0 && count == 0){ |
| | | return R.fail("操作失败,当前门店已冻结"); |
| | | } |
| | | shopList = shopList.stream().filter(s -> s.getStatus() == 1).collect(Collectors.toList()); |
| | | if(null != appUser.getShopId()){ |
| | | Optional<Shop> first = shopList.stream().filter(s -> s.getId().equals(appUser.getShopId())).findFirst(); |
| | | if(first.isPresent()){ |