| | |
| | | String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(updatePhone.getNewPhone(), ""); |
| | | String captcha = redisService.getCacheObject(verifyKey); |
| | | String[] split = captcha.split(":"); |
| | | |
| | | if (captcha == null) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |
| | | |
| | | long l = Long.parseLong(split[1]); |
| | | long l1 = System.currentTimeMillis(); |
| | | // 判断是否大于两分钟 |
| | | if (l1 - l > 2 * 60 * 1000) { |
| | | throw new CaptchaException("验证码已失效"); |
| | | } |
| | | if (captcha == null) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |
| | | captcha = split[0]; |
| | | if (!updatePhone.getCode().equalsIgnoreCase(captcha)) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |
| | |
| | | userService.updateById(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 通过公司名称和法人身份证号码查询用户信息 |
| | | */ |
| | | @GetMapping("/getUserByCompanyNameAndLegalId") |
| | | public R<User> getUserByCompanyNameAndLegalId(String companyName, String cardId) { |
| | | Company company = companyService.getOne(new LambdaQueryWrapper<Company>() |
| | | .eq(Company::getCompanyName, companyName) |
| | | .eq(Company::getIdCardNumber, cardId)); |
| | | User user = userService.getById(company.getUserId()); |
| | | return R.ok(user); |
| | | } |
| | | } |