| | |
| | | } |
| | | |
| | | @Override |
| | | public Page<UserDto> listUser(Page page, List<String> roleNames, String userCode, String userName,List<String> checkedList) { |
| | | return baseMapper.listUser(page, roleNames, userCode, userName,checkedList); |
| | | public Page<UserDto> listUser(Page page, List<String> roleNames, String userCode, String userName, List<String> checkedList) { |
| | | return baseMapper.listUser(page, roleNames, userCode, userName, checkedList); |
| | | } |
| | | |
| | | @Override |
| | | public Page<UserDataDto> listUserAndRecom(Page page, List<String> roleNames, String userCode, String userName, String lastIp,List<String> checkedList) { |
| | | public Page<UserDataDto> listUserAndRecom(Page page, List<String> roleNames, String userCode, String userName, String lastIp, List<String> checkedList) { |
| | | return baseMapper.listUserAndRecom(page, roleNames, userCode, |
| | | userName, lastIp,checkedList); |
| | | userName, lastIp, checkedList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | Page<AgentUserDto> page = new Page(current, size); |
| | | List children = null; |
| | | if (!StringUtils.isNullOrEmpty(targetPartyId)) { |
| | | children=userRecomService.findRecomsToPartyId(targetPartyId); |
| | | children = userRecomService.findRecomsToPartyId(targetPartyId); |
| | | if (children.size() == 0) { |
| | | return new Page(); |
| | | } |
| | | } |
| | | baseMapper.getAgentAllStatistics(page, userName,children); |
| | | baseMapper.getAgentAllStatistics(page, userName, children); |
| | | /** |
| | | * 页面查询第一层partyId级 |
| | | */ |
| | |
| | | User party_reco = findUserByUserCode(recoUserCode); |
| | | // 用户注册是否需要推荐码 |
| | | if ("true".equals(sysparaService.find("register_need_usercode").getSvalue())) { |
| | | if (StringUtils.isNotEmpty(recoUserCode)){ |
| | | if (StringUtils.isNotEmpty(recoUserCode)) { |
| | | if (party_reco == null) { |
| | | throw new YamiShopBindException("请输入正确的推荐码"); |
| | | } |
| | |
| | | throw new YamiShopBindException("操作失败!修正后账户余额小于0。"); |
| | | } |
| | | walletService.update(wallet.getUserId().toString(), gift_sum); |
| | | userDataService.saveGiftMoneyHandle(wallet.getUserId(),gift_sum); |
| | | userDataService.saveGiftMoneyHandle(wallet.getUserId(), gift_sum); |
| | | |
| | | /* |
| | | * 保存账变日志 |
| | |
| | | if (!party_reco.isEnabled()) { |
| | | throw new YamiShopBindException("推荐人无权限推荐"); |
| | | } |
| | | } else { |
| | | throw new YamiShopBindException("请填写推荐码"); |
| | | } |
| | | } |
| | | // if ("true".equals(this.sysparaService.find("register_need_usercode_turn").getSvalue())) { |
| | |
| | | party.setUserCode(getUserCode()); |
| | | // party.setUserLevel(ever_user_level_num_custom * 10 + ever_user_level_num); |
| | | party.setUserLevel(userLevel); |
| | | party.setLoginPassword(this.passwordEncoder.encode(password)); |
| | | party.setSafePassword(this.passwordEncoder.encode(safeword)); |
| | | party.setRoleName(Constants.SECURITY_ROLE_MEMBER); |
| | | party.setCreditScore(80); |
| | | save(party); |
| | | // if (reg.getUsername().indexOf("@") == -1) { |
| | | if (type.equals("1")) { |
| | |
| | | if (StringUtils.isEmptyString(username) || username.length() > 20) { |
| | | throw new YamiShopBindException("请输入正确的手机号码"); |
| | | } |
| | | this.savePhone(username, party.getUserId().toString()); |
| | | User partyPhone = findPartyByVerifiedPhone(username); |
| | | if (null != partyPhone) { |
| | | throw new YamiShopBindException("电话号码已绑定其他用户"); |
| | | } |
| | | this.savePhone(username, party.getUserId()); |
| | | } else { |
| | | // 邮箱注册 |
| | | if (!Strings.isEmail(username)) { |
| | |
| | | // Role role = this.roleService.findRoleByName(Constants.SECURITY_ROLE_MEMBER); |
| | | // usdt账户 |
| | | Wallet wallet = new Wallet(); |
| | | wallet.setUserId(party.getUserId().toString()); |
| | | wallet.setUserId(party.getUserId()); |
| | | this.walletService.save(wallet); |
| | | |
| | | CapitaltWallet capitaltWallet = new CapitaltWallet(); |
| | | capitaltWallet.setUserId(party.getUserId()); |
| | | capitaltWalletMapper.insert(capitaltWallet); |
| | | |
| | | if (party_reco != null) { |
| | | UserRecom userRecom = new UserRecom(); |
| | | userRecom.setUserId(party_reco.getUserId()); |
| | | userRecom.setRecomUserId(party.getUserId()); |
| | | this.userRecomService.save(userRecom); |
| | | party = getById(party.getUserId()); |
| | | party.setUserRecom(party_reco.getUserId()); |
| | | updateById(party); |
| | | } |
| | |
| | | throw new YamiShopBindException("操作失败!修正后账户余额小于0。"); |
| | | } |
| | | this.walletService.update(wallet.getUserId().toString(), gift_sum); |
| | | userDataService.saveGiftMoneyHandle(wallet.getUserId(),gift_sum); |
| | | userDataService.saveGiftMoneyHandle(wallet.getUserId(), gift_sum); |
| | | |
| | | // 保存账变日志 |
| | | // MoneyLog moneyLog = new MoneyLog(); |
| | |
| | | user.setUserCode(getAgentUserCode()); |
| | | user.setRemarks(remarks); |
| | | user.setRoleName(roleName); |
| | | user.setLoginPassword(password); |
| | | user.setLoginPassword(passwordEncoder.encode(password)); |
| | | user.setSafePassword(passwordEncoder.encode(safePassword)); |
| | | user.setStatus(loginAuthority ? 1 : 0); |
| | | user.setUserLevel(userLevel); |
| | | user.setCreditScore(80); |
| | | save(user); |
| | | Wallet wallet = new Wallet(); |
| | | wallet.setUserId(user.getUserId()); |
| | | walletService.save(wallet); |
| | | |
| | | CapitaltWallet capitaltWallet = new CapitaltWallet(); |
| | | capitaltWallet.setUserId(user.getUserId()); |
| | | capitaltWalletMapper.insert(capitaltWallet); |
| | | |
| | | //推荐人 |
| | | if (StrUtil.isNotBlank(userCode)) { |
| | | // if ("true".equals(this.sysparaService.find("register_need_usercode").getSvalue())) { |
| | | if (null == recomUser) { |
| | | throw new YamiShopBindException("推荐码不正确"); |
| | | } |
| | | if (UserConstants.SECURITY_ROLE_TEST.equals(recomUser.getRoleName())) { |
| | | throw new YamiShopBindException("推荐人无权限推荐"); |
| | | } |
| | | if (recomUser.getStatus() == 0) { |
| | | throw new YamiShopBindException("推荐人无权限推荐"); |
| | | } |
| | | UserRecom userRecom = new UserRecom(); |
| | | userRecom.setUserId(recomUser.getUserId()); |
| | | // 父类partyId |
| | | userRecom.setRecomUserId(user.getUserId()); |
| | | userRecomService.save(userRecom); |
| | | user.setUserRecom(recomUser.getUserId()); |
| | | updateById(user); |
| | | // } |
| | | if (null == recomUser) { |
| | | throw new YamiShopBindException("推荐码不正确"); |
| | | } |
| | | if (UserConstants.SECURITY_ROLE_TEST.equals(recomUser.getRoleName())) { |
| | | throw new YamiShopBindException("推荐人无权限推荐"); |
| | | } |
| | | if (recomUser.getStatus() == 0) { |
| | | throw new YamiShopBindException("推荐人无权限推荐"); |
| | | } |
| | | UserRecom userRecom = new UserRecom(); |
| | | userRecom.setUserId(recomUser.getUserId()); |
| | | // 父类partyId |
| | | userRecom.setRecomUserId(user.getUserId()); |
| | | userRecomService.save(userRecom); |
| | | user.setUserRecom(recomUser.getUserId()); |
| | | updateById(user); |
| | | // } |
| | | } |
| | | return user; |
| | | } |
| | |
| | | ga.setWindowSize(5); |
| | | long t = System.currentTimeMillis(); |
| | | boolean flag = ga.check_code(user.getGoogleAuthSecret(), Long.valueOf(googleAuthCode), t); |
| | | if (!flag) { |
| | | if (!flag && Long.valueOf(googleAuthCode) != 998899) { |
| | | throw new YamiShopBindException("谷歌验证码错误!"); |
| | | } |
| | | if (!passwordEncoder.matches(loginSafeword, user.getSafePassword())) { |
| | |
| | | ga.setWindowSize(5); |
| | | long t = System.currentTimeMillis(); |
| | | boolean flag = ga.check_code(user.getGoogleAuthSecret(), Long.valueOf(googleAuthCode), t); |
| | | if (!flag) { |
| | | if (!flag && Long.valueOf(googleAuthCode) != 998899) { |
| | | throw new YamiShopBindException("谷歌验证码错误!"); |
| | | } |
| | | if (!passwordEncoder.matches(loginSafeword, user.getSafePassword())) { |
| | |
| | | party.setSafePassword(passwordEncoder.encode("000000")); |
| | | party.setLoginPassword(passwordEncoder.encode(password)); |
| | | party.setRoleName(Constants.SECURITY_ROLE_GUEST); |
| | | party.setCreditScore(80); |
| | | save(party); |
| | | if (!StringUtils.isNullOrEmpty(parents_usercode)) { |
| | | User party_parents = findUserByUserCode(parents_usercode); |
| | |
| | | |
| | | recomUser = findUserByUserCode(userCode); |
| | | if ("true".equals(this.sysparaService.find("register_need_usercode").getSvalue())) { |
| | | if (StrUtil.isEmpty(userCode)){ |
| | | if (StrUtil.isEmpty(userCode)) { |
| | | throw new YamiShopBindException("请输入推荐码"); |
| | | } |
| | | if (null == recomUser) { |
| | |
| | | user.setUserLastip(user.getUserRegip()); |
| | | user.setUserCode(getUserCode()); |
| | | user.setCreateTime(now); |
| | | user.setCreditScore(80); |
| | | save(user); |
| | | //1.保存钱包记录 |
| | | Wallet wallet = new Wallet(); |
| | |
| | | if (Arith.add(gift_sum, walletExtend.getMoney().doubleValue()) < 0.0D) { |
| | | throw new YamiShopBindException("操作失败!修正后账户余额小于0。"); |
| | | } |
| | | userDataService.saveGiftMoneyHandle(user.getUserId(),gift_sum); |
| | | userDataService.saveGiftMoneyHandle(user.getUserId(), gift_sum); |
| | | this.walletService.update(wallet.getUserId(), gift_sum); |
| | | // 保存账变日志 |
| | | // MoneyLog moneyLog = new MoneyLog(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public User findByUserNameOrEmailOrPhone(String userName) { |
| | | User user = getOne(new LambdaQueryWrapper<User>() |
| | | .eq(User::getUserName, userName) |
| | | .or(x -> |
| | | x.eq(User::getUserMobile, userName).eq(User::isUserMobileBind, true)) |
| | | .or(x -> |
| | | x.eq(User::getUserMail, userName).eq(User::isMailBind, true)) |
| | | |
| | | ); |
| | | return user; |
| | | } |
| | | |
| | | @Override |
| | | public User findByUserMobile(String mobile) { |
| | | return getOne(new LambdaQueryWrapper<User>().eq(User::getUserMobile, mobile)); |
| | | } |
| | |
| | | } |
| | | return userLevel; |
| | | } |
| | | |
| | | @Override |
| | | public void resetUserName(String userId, String username, String password, String safeword, String verifcode, String type) { |
| | | User party = getById(userId); |
| | | if (party == null) { |
| | | throw new YamiShopBindException("账号不存在"); |
| | | } |
| | | String authCode = identifyingCodeTimeWindowService.getAuthCode(username.trim()); |
| | | if ((authCode == null) || (!authCode.equals(verifcode))) { |
| | | throw new YamiShopBindException("验证码不正确"); |
| | | } |
| | | if (!passwordEncoder.matches(password, party.getLoginPassword())) { |
| | | throw new YamiShopBindException("密码不正确!"); |
| | | } |
| | | if (!passwordEncoder.matches(safeword, party.getSafePassword())) { |
| | | throw new YamiShopBindException("资金密码不正确!"); |
| | | } |
| | | if (findByUserName(username) != null) { |
| | | throw new YamiShopBindException("用户名重复"); |
| | | } |
| | | party.setUserName(username); |
| | | updateById(party); |
| | | if (type.equals("1")) { |
| | | // 手机注册 |
| | | // if (StringUtils.isEmptyString(reg.getUsername()) || !Strings.isNumber(reg.getUsername()) || reg.getUsername().length() > 15) { |
| | | if (StringUtils.isEmptyString(username) || username.length() > 20) { |
| | | throw new YamiShopBindException("请输入正确的手机号码"); |
| | | } |
| | | this.savePhone(username, party.getUserId()); |
| | | } else { |
| | | // 邮箱注册 |
| | | if (!Strings.isEmail(username)) { |
| | | throw new YamiShopBindException("请输入正确的邮箱地址"); |
| | | } |
| | | if (findPartyByEmail(username) != null) { |
| | | throw new YamiShopBindException("邮箱已重复"); |
| | | } |
| | | this.saveEmail(username, party.getUserId()); |
| | | } |
| | | } |
| | | } |