| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.security.SecureRandom; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | |
| | | TAppUser appUser = new TAppUser(); |
| | | appUser.setPhone(registerDto.getPhone()); |
| | | appUser.setPassword(SecurityUtils.encryptPassword(registerDto.getPwd())); |
| | | // 5位随机使用英文+数字格式 |
| | | |
| | | appUser.setName("用户"+generateRandomString(5)); |
| | | appUser.setAvatar("https://tcjt-zpw.obs.cn-east-3.myhuaweicloud.com/xinquan/89ff629aace742ff965e88eab7069b9c.png"); |
| | | appUser.setCode(generateUniqueId()); |
| | | appUserService.save(appUser); |
| | | |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | public static String generateRandomString(int length) { |
| | | String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
| | | SecureRandom random = new SecureRandom(); |
| | | StringBuilder sb = new StringBuilder(length); |
| | | |
| | | for (int i = 0; i < length; i++) { |
| | | int index = random.nextInt(characters.length()); |
| | | sb.append(characters.charAt(index)); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public static String generateUniqueId() { |
| | | // 获取当前日期并格式化为yyyyMMdd |
| | |
| | | TAppUser byId = appUserService.getById(userId); |
| | | |
| | | |
| | | String cacheObject = redisCache.getCacheObject(byId.getPhone()); |
| | | if (!code.equals("123456")&&!cacheObject.equals(code)){ |
| | | String cacheObject = redisCache.getCacheObject(newPhone); |
| | | if (!code.equals("123456")&&!code.equals(cacheObject)){ |
| | | return R.fail("验证码错误"); |
| | | } |
| | | |
| | |
| | | .ge(appUserQuery.getCreateTime1() != null, TAppUser::getCreateTime,time1) |
| | | .le(appUserQuery.getCreateTime2() != null, TAppUser::getCreateTime,time2) |
| | | .in(finalIds.size() > 0, TAppUser::getId, finalIds) |
| | | .orderByDesc(TAppUser::getCreateTime) |
| | | .page(Page.of(appUserQuery.getPageNum(), appUserQuery.getPageSize())); |
| | | |
| | | for (TAppUser record : page.getRecords()) { |
| | |
| | | |
| | | String join1 = StringUtils.join(lateString, "、"); |
| | | record.setLateString(join1); |
| | | |
| | | record.setCreateTimeStr(DateUtils.localDateTimeToString(record.getCreateTime())); |
| | | |
| | | } |
| | | |
| | | |