| | |
| | | Shop shop = shopService.getById(id); |
| | | shop.setDelFlag(1); |
| | | shopService.updateById(shop); |
| | | //获取门店的员工数据 |
| | | UserShop userShop = new UserShop(); |
| | | userShop.setShopId(shop.getId()); |
| | | List<UserShop> data = userShopClient.getUserShop(userShop).getData(); |
| | |
| | | sysUserClient.delShopUser(shop.getId(), 2); |
| | | //修改小程序用户类型和门店数据 |
| | | for (SysUser sysUser : sysUserList) { |
| | | String userName = sysUser.getUserName(); |
| | | //通过电话号码查询小程序用户和门店关系数据 |
| | | AppUser appUser = appUserClient.getAppUserByPhone1(userName).getData(); |
| | | AppUser appUser = appUserClient.getAppUserByPhone1(sysUser.getUserName()).getData(); |
| | | //需要先判断用户是否没有关联任何门店 |
| | | List<AppUserShop> userShops = appUserShopClient.getAppUserShop(appUser.getId()).getData(); |
| | | if(userShops.size() == 1 && userShops.get(0).getShopId().equals(shop.getId())){ |
| | | appUser.setUserType(1); |
| | | appUserClient.editAppUserById(appUser); |
| | | } |
| | | |
| | | //删除用户门店关系表数据 |
| | | AppUserShop appUserShop = new AppUserShop(); |
| | | appUserShop.setAppUserId(appUser.getId()); |
| | | appUserShop.setShopId(shop.getId()); |
| | | appUserShopClient.delAppUserShop(appUserShop); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @ApiOperation(value = "绑定门店", tags = {"小程序-个人中心"}) |
| | | public R<Void> bindShop(@ApiParam("门店id") @RequestParam Integer shopId) { |
| | | AppUser appUser = appUserClient.getAppUserById(SecurityUtils.getUserId()); |
| | | if(null != appUser.getShopId()){ |
| | | return R.fail("不能重复绑定门店"); |
| | | } |
| | | appUser.setShopId(shopId); |
| | | return appUserClient.editAppUserById(appUser); |
| | | } |