| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.api.model.*; |
| | | import com.ruoyi.account.dto.ApplyForAdmissionDTO; |
| | | import com.ruoyi.account.mapper.AppUserMapper; |
| | | import com.ruoyi.account.service.*; |
| | | import com.ruoyi.account.util.GeodesyUtil; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | private static final String DEFAULT_AVATAR_URL = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/58084a0ce8c34dc79f9d8b4c0bc3774a.png"; |
| | | |
| | | |
| | | /** |
| | | * 小程序一键登录 |
| | |
| | | } |
| | | String openid = map.get("openid").toString(); |
| | | String sessionKey = map.get("sessionKey").toString(); |
| | | //查询用户是否注册,没有注册则跳转到注册页面 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getWxOpenid, openid).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | //获取手机号 |
| | | String decrypt = WXCore.decrypt(appletLogin.getEncryptedData_phone(), sessionKey, appletLogin.getIv_phone()); |
| | | if (StringUtils.isEmpty(decrypt)) { |
| | | return R.fail("获取手机信息失败"); |
| | | } |
| | | JSONObject phone = JSON.parseObject(decrypt); |
| | | String purePhoneNumber = phone.getString("phoneNumber"); |
| | | //查询用户是否注册,没有注册则注册 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, purePhoneNumber).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | | if(null == appUser){ |
| | | String decrypt = WXCore.decrypt(appletLogin.getEncryptedData_phone(), sessionKey, appletLogin.getIv_phone()); |
| | | if (StringUtils.isEmpty(decrypt)) { |
| | | return R.fail("获取手机信息失败"); |
| | | } |
| | | JSONObject phone = JSON.parseObject(decrypt); |
| | | String purePhoneNumber = phone.getString("purePhoneNumber"); |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(2); |
| | | loginVo.setPhone(purePhoneNumber); |
| | | return R.ok(loginVo); |
| | | appUser = new AppUser(); |
| | | //注册 |
| | | //新用户默认信息 |
| | | appUser.setName(purePhoneNumber.substring(0, 3) + "****" + purePhoneNumber.substring(7)); |
| | | appUser.setPhone(purePhoneNumber); |
| | | appUser.setAvatar( DEFAULT_AVATAR_URL); |
| | | appUser.setWxOpenid(openid); |
| | | appUser.setStatus(1); |
| | | appUser.setDelFlag(false); |
| | | appUser.setCreateTime(LocalDateTime.now()); |
| | | this.save(appUser); |
| | | } |
| | | //账户被冻结,给出提示 |
| | | if(2 == appUser.getStatus()){ |
| | | return R.fail("账户已被冻结,请联系管理员!"); |
| | | } |
| | | |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | | loginVo.setFirstTime(false); |
| | | loginVo.setPhone(appUser.getPhone()); |
| | | //构建token |
| | | LoginUser loginUser = new LoginUser(); |
| | |
| | | return R.fail("验证码错误"); |
| | | } |
| | | } |
| | | |
| | | //查询用户是否注册,没有注册则跳转到注册页面 |
| | | AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()) |
| | | .ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); |
| | |
| | | loginVo.setPhone(mobileLogin.getPhone()); |
| | | return R.ok(loginVo); |
| | | } |
| | | //查询用户是否注册,没有注册则系统注册 |
| | | /*if(null == appUser){ |
| | | appUser=new AppUser(); |
| | | //注册 |
| | | //使用jscode获取微信openid |
| | | Map<String, Object> map = weChatUtil.code2Session(mobileLogin.getJscode()); |
| | | Integer errcode = Integer.valueOf(map.get("errcode").toString()); |
| | | if(0 != errcode){ |
| | | return R.fail(map.get("msg").toString()); |
| | | } |
| | | String openid = map.get("openid").toString(); |
| | | //设置默认信息 |
| | | appUser.setName(mobileLogin.getPhone().substring(0, 3) + "****" + mobileLogin.getPhone().substring(7)); |
| | | appUser.setPhone(mobileLogin.getPhone()); |
| | | appUser.setAvatar( DEFAULT_AVATAR_URL); |
| | | appUser.setWxOpenid(openid); |
| | | appUser.setStatus(1); |
| | | appUser.setDelFlag(false); |
| | | //调用地图获取省市区数据 |
| | | String citycode = TencentMapUtil.inverseGeographicalAnalysis(mobileLogin.getLongitude(), mobileLogin.getLatitude(), false); |
| | | if(null != citycode){ |
| | | Region region = regionClient.getRegionBiCode(citycode).getData(); |
| | | appUser.setDistrict(region.getName()); |
| | | appUser.setDistrictCode(citycode); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 4) + "00").getData(); |
| | | appUser.setCity(region.getName()); |
| | | appUser.setCityCode(region.getCode()); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 2) + "0000").getData(); |
| | | appUser.setProvince(region.getName()); |
| | | appUser.setProvinceCode(region.getCode()); |
| | | } |
| | | |
| | | this.save(appUser); |
| | | }*/ |
| | | //账户被冻结,给出提示 |
| | | if(2 == appUser.getStatus()){ |
| | | return R.fail("账户已被冻结,请联系管理员!"); |
| | | } |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | | loginVo.setFirstTime(false); |
| | | loginVo.setPhone(appUser.getPhone()); |
| | | //构建token |
| | | LoginUser loginUser = new LoginUser(); |
| | |
| | | |
| | | /** |
| | | * 注册账号 |
| | | * @param registerAccount |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R<LoginVo> registerAccount(RegisterAccount registerAccount) { |
| | | //校验验证码 |
| | | // String code = redisService.getCacheObject(registerAccount.getPhone()); |
| | | // if(!"999999".equals(registerAccount.getCode())){ |
| | | // if(null == code || !code.equals(registerAccount.getCode())){ |
| | | // return R.fail("验证码错误"); |
| | | // } |
| | | // } |
| | | /* String code = redisService.getCacheObject(registerAccount.getPhone()); |
| | | if(!"999999".equals(registerAccount.getCode())){ |
| | | if(null == code || !code.equals(registerAccount.getCode())){ |
| | | return R.fail("验证码错误"); |
| | | } |
| | | }*/ |
| | | //使用jscode获取微信openid |
| | | Map<String, Object> map = weChatUtil.code2Session(registerAccount.getJscode()); |
| | | Integer errcode = Integer.valueOf(map.get("errcode").toString()); |
| | |
| | | if(null != appUser1 && StringUtils.isNotEmpty(appUser1.getWxOpenid())){ |
| | | return R.fail("手机号已注册,请直接登录!"); |
| | | } |
| | | if(null != appUser1 && appUser1.getStatus() == 2){ |
| | | if(null != appUser1 && appUser1.getStatus() == 1){ |
| | | return R.fail("手机号已注册,请直接登录!"); |
| | | } |
| | | |
| | | String avatar = registerAccount.getAvatar(); |
| | | if (StringUtils.isEmpty(avatar)){ |
| | | avatar = "http://qijishenghuiyuan.obs.cn-southwest-2.myhuaweicloud.com/admin/aedfbbb41280471f8d9fa7905298b65f.png"; |
| | | avatar = DEFAULT_AVATAR_URL; |
| | | } |
| | | |
| | | //如果手机号已注册,但是没有微信号,则将微信号添加到已有账户上 |
| | |
| | | appUser.setPhone(registerAccount.getPhone()); |
| | | appUser.setWxOpenid(openid); |
| | | //注册默认为普通会员 |
| | | appUser.setVipId(1); |
| | | appUser.setStatus(1); |
| | | appUser.setCreateTime(LocalDateTime.now()); |
| | | appUser.setDelFlag(false); |
| | | appUser.setFirstAdd(1); |
| | | appUser.setLastLoginTime(LocalDateTime.now()); |
| | | //绑定门店为推荐人绑定的门店 |
| | | AppUser appUser2 = this.getById(registerAccount.getPromoter()); |
| | | appUser.setInviteUserId(registerAccount.getPromoter()); |
| | | appUser.setShopId(appUser2.getShopId()); |
| | | appUser.setPartPoint(0); |
| | | appUser.setPartGrowPoint(0); |
| | | appUser.setShopPoint(0); |
| | | appUser.setSharePoint(0); |
| | | appUser.setShopAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawableAmount(BigDecimal.ZERO); |
| | | appUser.setWithdrawnAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRechargeAmount(BigDecimal.ZERO); |
| | | appUser.setTotalRedPacketAmount(BigDecimal.ZERO); |
| | | appUser.setTotalDistributionAmount(BigDecimal.ZERO); |
| | | appUser.setBalance(BigDecimal.ZERO); |
| | | //新用户才能奖励积分,老用户注销重新注册没有 |
| | | long old = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, registerAccount.getPhone()).eq(AppUser::getDelFlag, 0)); |
| | | R<PointSetting> pointSettingR = pointSettingClient.getPointSetting(1); |
| | | if (R.isError(pointSettingR)){ |
| | | throw new RuntimeException("获取积分设置失败"); |
| | | } |
| | | PointSetting pointSetting = pointSettingR.getData(); |
| | | if (pointSetting == null){ |
| | | throw new RuntimeException("积分设置不存在"); |
| | | } |
| | | Integer regisPoint = pointSetting.getRegisPoint(); |
| | | if(0 == old){ |
| | | Integer regisPoint1 = 0; |
| | | //计算可用积分比例 |
| | | if(1 == pointSetting.getGetRegisPointOpen()){ |
| | | regisPoint1 = new BigDecimal(regisPoint).multiply(pointSetting.getGetRegisPoint().divide(new BigDecimal(100))).intValue(); |
| | | } |
| | | appUser.setLavePoint(regisPoint); |
| | | appUser.setAvailablePoint(regisPoint1); |
| | | appUser.setTotalAvailablePoint(regisPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ |
| | | appUser.setTransferablePoint(regisPoint1); |
| | | } |
| | | appUser.setTotalRegisterPoint(regisPoint); |
| | | appUser.setTotalPoint(regisPoint); |
| | | } |
| | | //根据平台的配置未达标,则标注为可修改推广人 |
| | | appUser.setChangePromoter(0); |
| | | appUser.setLongitude(registerAccount.getLongitude()); |
| | | appUser.setLatitude(registerAccount.getLatitude()); |
| | | //调用地图获取省市区数据 |
| | |
| | | appUser.setProvinceCode(region.getCode()); |
| | | } |
| | | this.save(appUser); |
| | | |
| | | //增加积分变动记录 |
| | | if(0 == old && regisPoint > 0){ |
| | | //构建积分流水记录 |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(7); |
| | | userPoint.setHistoricalPoint(0); |
| | | userPoint.setVariablePoint(regisPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | |
| | | //拉新分佣 |
| | | if(0 == old && null != appUser2){ |
| | | pointSetting = pointSettingClient.getPointSetting(appUser2.getVipId()).getData(); |
| | | Integer newPoint = pointSetting.getNewPoint(); |
| | | Integer newPoint1 = 0; |
| | | if(1 == pointSetting.getGetNewPointOpen()){ |
| | | newPoint1 = new BigDecimal(newPoint).multiply(pointSetting.getGetNewPoint().divide(new BigDecimal(100))).intValue(); |
| | | } |
| | | appUser2.setLavePoint(appUser2.getLavePoint() + newPoint); |
| | | appUser2.setAvailablePoint(appUser2.getAvailablePoint() + newPoint1); |
| | | appUser2.setTotalAvailablePoint(appUser2.getTotalAvailablePoint() + newPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getGetNewPointGift()){ |
| | | appUser2.setTransferablePoint(appUser2.getTransferablePoint() + newPoint1); |
| | | } |
| | | appUser2.setTotalInvitePoint(appUser2.getTotalInvitePoint() + newPoint); |
| | | appUser2.setTotalPoint(appUser2.getTotalPoint() + newPoint); |
| | | this.updateById(appUser2); |
| | | if(newPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(3); |
| | | userPoint.setHistoricalPoint(appUser2.getLavePoint() - newPoint); |
| | | userPoint.setVariablePoint(newPoint); |
| | | userPoint.setBalance(appUser2.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser2.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | |
| | | if(null != appUser2.getInviteUserId()){ |
| | | AppUser appUser3 = this.getById(appUser2.getInviteUserId()); |
| | | appUser3.setLavePoint(appUser3.getLavePoint() + newPoint); |
| | | appUser3.setAvailablePoint(appUser3.getAvailablePoint() + newPoint1); |
| | | appUser3.setTotalAvailablePoint(appUser3.getTotalAvailablePoint() + newPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ |
| | | appUser3.setTransferablePoint(appUser3.getTransferablePoint() + newPoint1); |
| | | } |
| | | appUser3.setTotalInvitePoint(appUser3.getTotalInvitePoint() + newPoint); |
| | | appUser3.setTotalPoint(appUser3.getTotalPoint() + newPoint); |
| | | this.updateById(appUser3); |
| | | if(newPoint > 0){ |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(3); |
| | | userPoint.setHistoricalPoint(appUser3.getLavePoint() - newPoint); |
| | | userPoint.setVariablePoint(newPoint); |
| | | userPoint.setBalance(appUser3.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser3.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //获取微信推广二维码 |
| | | String fileName = UUID.randomUUID() + ".jpg"; |
| | | String getwxacodeunlimit = weChatUtil.getwxacodeunlimit("pages/start/start", "id=" + appUser.getId(), EnvVersion.RELEASE, filePath + fileName); |
| | | appUser.setQrCode(getwxacodeunlimit); |
| | | this.updateById(appUser); |
| | | |
| | | } |
| | | LoginVo loginVo = new LoginVo(); |
| | | loginVo.setSkipPage(1); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<AppUser> getUserAncestorList(Long id, List<AppUser> list) { |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | |
| | | Set<Long> visitedIds = new HashSet<>(); |
| | | Long currentId = id; |
| | | |
| | | while (currentId != null && !visitedIds.contains(currentId)) { |
| | | AppUser appUser = getById(currentId); |
| | | if (appUser == null) { |
| | | break; // 如果用户不存在,终止循环 |
| | | } |
| | | |
| | | Long inviteUserId = appUser.getInviteUserId(); |
| | | if (inviteUserId != null) { |
| | | AppUser invitedUser = getById(inviteUserId); |
| | | if (invitedUser != null) { |
| | | list.add(invitedUser); |
| | | visitedIds.add(currentId); |
| | | currentId = inviteUserId; |
| | | } else { |
| | | break; // 如果邀请用户不存在,终止循环 |
| | | } |
| | | } else { |
| | | break; // 如果没有邀请用户,终止循环 |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public AppUser getSuperiorLeader(Long id) { |
| | | AppUser appUser = getById(id); |
| | | Long inviteUserId = appUser.getInviteUserId(); |
| | | AppUser inviteUser = getById(inviteUserId); |
| | | if (inviteUser == null){ |
| | | return null; |
| | | } |
| | | if (inviteUser.getVipId() > 3) { |
| | | return inviteUser; |
| | | }else { |
| | | return getSuperiorLeader(inviteUserId); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时解绑推广人 |
| | | */ |
| | | @Override |
| | | public void unbindThePromoter() { |
| | | //注册X天后没有升级成黄金会员则自动解绑推广人 |
| | | //解绑推广人 |
| | | Set<Long> unbind_promoter = redisTemplate.opsForZSet().rangeByScore("unbind_promoter", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)); |
| | | if(unbind_promoter.size() > 0){ |
| | | List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 1).eq(AppUser::getDelFlag, 0).isNotNull(AppUser::getInviteUserId) |
| | | .eq(AppUser::getStatus, 1).in(AppUser::getId, unbind_promoter)); |
| | | for (AppUser appUser : list) { |
| | | UpdateWrapper<AppUser> updateWrapper = new UpdateWrapper<>(); |
| | | updateWrapper.set("invite_user_id", null).set("shop_id", null).eq("id", appUser.getId()); |
| | | this.update(updateWrapper); |
| | | } |
| | | redisTemplate.opsForZSet().remove("unbind_promoter", unbind_promoter.toArray()); |
| | | } |
| | | //可更换推广人 |
| | | Set<Long> replaceable = redisTemplate.opsForZSet().rangeByScore("replaceable", 0, LocalDateTime.now().toEpochSecond(ZoneOffset.UTC)); |
| | | if(replaceable.size() > 0){ |
| | | List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getChangePromoter, 0) |
| | | .eq(AppUser::getStatus, 1).in(AppUser::getId, replaceable)); |
| | | for (AppUser appUser : list) { |
| | | Long data = orderClient.getOrderCountByAppUserId(appUser.getId()).getData(); |
| | | if(data == 0L){ |
| | | appUser.setChangePromoter(1); |
| | | this.updateById(appUser); |
| | | } |
| | | } |
| | | redisTemplate.opsForZSet().remove("replaceable", replaceable.toArray()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 在线记录操作,用于赠送积分 |
| | | */ |
| | | @Override |
| | | public void onlineRecord() { |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | Object cacheObject = redisService.getCacheObject("ONLINE_" + userid); |
| | | if(null == cacheObject){ |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", System.currentTimeMillis()); |
| | | jsonObject.put("online", 0); |
| | | redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS); |
| | | }else{ |
| | | JSONObject jsonObject = (JSONObject) cacheObject; |
| | | long time = System.currentTimeMillis() - jsonObject.getInteger("time"); |
| | | Integer online = jsonObject.getInteger("online"); |
| | | online++; |
| | | //时间满足1小时,并且次数记录满足6次(10分钟记录一次) |
| | | if(time >= 3600000 && 6 <= online){ |
| | | jsonObject.put("time", System.currentTimeMillis()); |
| | | jsonObject.put("online", 0); |
| | | redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS); |
| | | AppUser appUser = this.getById(userid); |
| | | PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); |
| | | if(null != pointSetting){ |
| | | int hourPoint = pointSetting.getHourPoint().intValue(); |
| | | int hourPoint1 = 0; |
| | | if(1 == pointSetting.getWorkPointOpen()){ |
| | | hourPoint1 = new BigDecimal(hourPoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); |
| | | } |
| | | //添加积分变动记录 |
| | | if(hourPoint > 0){ |
| | | Integer lavePoint = appUser.getLavePoint(); |
| | | appUser.setTotalPoint(appUser.getTotalPoint() + hourPoint); |
| | | appUser.setLavePoint(appUser.getLavePoint() + hourPoint); |
| | | appUser.setAvailablePoint(appUser.getAvailablePoint() + hourPoint1); |
| | | appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + hourPoint1); |
| | | if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ |
| | | appUser.setTransferablePoint(appUser.getTransferablePoint() + hourPoint1); |
| | | } |
| | | appUser.setTotalHourPoint(appUser.getTotalHourPoint() + hourPoint); |
| | | this.updateById(appUser); |
| | | |
| | | UserPoint userPoint = new UserPoint(); |
| | | userPoint.setType(6); |
| | | userPoint.setHistoricalPoint(lavePoint); |
| | | userPoint.setVariablePoint(hourPoint); |
| | | userPoint.setBalance(appUser.getLavePoint()); |
| | | userPoint.setCreateTime(LocalDateTime.now()); |
| | | userPoint.setAppUserId(appUser.getId()); |
| | | userPointService.save(userPoint); |
| | | } |
| | | } |
| | | }else{ |
| | | jsonObject.put("online", online); |
| | | redisService.setCacheObject("ONLINE_" + userid, jsonObject, 1L, TimeUnit.HOURS); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<AppUser> getAppuserPage(Integer pageNum, Integer pageSize, AppUser appUser, Integer shopId, Set<Long> userId) { |
| | |
| | | public List<AppUser> getAppUserByPhoneNoFilter(String phone) { |
| | | return this.baseMapper.getAppUserByPhoneNoFilter(phone); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 小程序-个人中心 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public AppUser index() { |
| | | Long userId = tokenService.getLoginUserApplet().getUserid(); |
| | | //当前用户信息 |
| | | AppUser user = this.getById(userId); |
| | | //查询门店,如果门店被冻结 |
| | | List<Shop> shopList = shopClient.getShopByUserId(userId).getData(); |
| | | user.setShopStatus(0);//未拥有门店 |
| | | |
| | | if (shopList != null && !shopList.isEmpty()) { |
| | | //走进来代表有门店 ,先设置为冻结中 |
| | | user.setShopStatus(2);//门店都被冻结 |
| | | for (Shop shop : shopList) { |
| | | if (shop.getStatus()==1) { |
| | | user.setShopStatus(1);//门店状态 |
| | | } |
| | | if(null==user.getShopIds()){ |
| | | Set<Integer> integers = new HashSet<>(); |
| | | user.setShopIds(integers); |
| | | } |
| | | user.getShopIds().add(shop.getId()); |
| | | user.setShopIds(user.getShopIds()); |
| | | |
| | | } |
| | | } |
| | | return user; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<UserPointStatisticsVO> getUserPointPageList(String name, Integer pageCurr, Integer pageSize) { |
| | | PageInfo<UserPointStatisticsVO> pageInfo=new PageInfo<>(pageCurr,pageSize); |
| | | List<UserPointStatisticsVO> list=baseMapper.getUserPointPageList(pageInfo, name); |
| | | list.forEach(x->{ |
| | | x.setIdStr(String.valueOf(x.getId())); |
| | | }); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |