Merge remote-tracking branch 'company/master' into company-master

master
Tuzki 1 year ago
commit 71a1d4f2bd
  1. 3
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
  3. 9
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  4. 6
      ruoyi-system/src/main/resources/mapper/system/UnitMemberMapper.xml

@ -34,8 +34,9 @@ public class SysRegisterController extends BaseController
{
return error("当前系统没有开启注册功能!");
}
if(user.getVerificationCode().equals(redisCache.getCacheObject(user.getContactNumber()))){
if(user.getVerificationCode().equals(redisCache.getCacheObject(user.getUsername()))){
String msg = registerService.register(user);
redisCache.deleteObject(user.getUsername());
return StringUtils.isEmpty(msg) ? success() : error(msg);
}else {
return error("请输入正确短信验证码");

@ -4,6 +4,7 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.system.domain.vo.ForgetThePasswordVO;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -54,7 +55,8 @@ public class SysUserController extends BaseController
@Autowired
private ISysPostService postService;
@Autowired
private RedisCache redisCache;
/**
* 获取用户列表
*/
@ -305,6 +307,7 @@ public class SysUserController extends BaseController
{
int res= userService.forgetThePassword(forgetThePasswordVO);
if(res==1){
redisCache.deleteObject(forgetThePasswordVO.getPhoneNumber());
return success("修改成功");
}else if(res==-1){
return error("修改密码失败,如有疑问请联系管理员。");

@ -6,6 +6,7 @@ import java.time.LocalTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import javax.validation.Validator;
@ -585,7 +586,7 @@ public class SysUserServiceImpl implements ISysUserService
}
String verifyCode = String.valueOf((new Random()).nextInt(899999) + 100000);
System.out.println("验证码:"+verifyCode);
String message="【创巨圆】验证码:"+verifyCode+",此验证码只用于注册验证,15分钟内有效。如非本人操作,请忽略。";
String message="【创巨圆】验证码:"+verifyCode+",此验证码只用于注册验证,5分钟内有效。如非本人操作,请忽略。";
String cacheValue = redisCache.getCacheObject(phoneNumber+"_number");
if(cacheValue != null && Integer.parseInt(cacheValue) > 29){
return -2;
@ -596,7 +597,7 @@ public class SysUserServiceImpl implements ISysUserService
LocalDateTime tomorrow = now.plusDays(1).with(LocalTime.MIN);
Duration duration = Duration.between(now, tomorrow);
long secondsUntilTomorrowMidnight = duration.getSeconds();
redisCache.setCacheObject(phoneNumber,verifyCode);
redisCache.setCacheObject(phoneNumber,verifyCode,300, TimeUnit.SECONDS);
Integer count= Integer.parseInt(redisCache.getCacheObject(phoneNumber+"_number")==null?"0":redisCache.getCacheObject(phoneNumber+"_number"));
redisCache.setCacheObject(phoneNumber+"_number",String.valueOf(count+1));
redisCache.expire(phoneNumber+"_number",(int)secondsUntilTomorrowMidnight);
@ -622,7 +623,7 @@ public class SysUserServiceImpl implements ISysUserService
return -3;
}
String verifyCode = String.valueOf((new Random()).nextInt(899999) + 100000);
String message="【创巨圆】验证码:"+verifyCode+",此验证码只用于找回密码,15分钟内有效。如非本人操作,请忽略。";
String message="【创巨圆】验证码:"+verifyCode+",此验证码只用于找回密码,5分钟内有效。如非本人操作,请忽略。";
String cacheValue = redisCache.getCacheObject(phoneNumber+"_number");
System.out.println("验证码:"+verifyCode);
if(cacheValue != null && Integer.parseInt(cacheValue) > 29){
@ -634,7 +635,7 @@ public class SysUserServiceImpl implements ISysUserService
LocalDateTime tomorrow = now.plusDays(1).with(LocalTime.MIN);
Duration duration = Duration.between(now, tomorrow);
long secondsUntilTomorrowMidnight = duration.getSeconds();
redisCache.setCacheObject(phoneNumber+"_forgetThePassword",verifyCode);
redisCache.setCacheObject(phoneNumber+"_forgetThePassword",verifyCode,300, TimeUnit.SECONDS);
Integer count= Integer.parseInt(redisCache.getCacheObject(phoneNumber+"_forgetThePassword"+"_number")==null?"0":redisCache.getCacheObject(phoneNumber+"_forgetThePassword"+"_number"));
redisCache.setCacheObject(phoneNumber+"_forgetThePassword"+"_number",String.valueOf(count+1));
redisCache.expire(phoneNumber+"_forgetThePassword"+"_number",(int)secondsUntilTomorrowMidnight);

@ -179,9 +179,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="corporate != null">#{corporate},</if>
<if test="unincorporatedOrganizations != null">#{unincorporatedOrganizations},</if>
<if test="wordUrl != null">#{wordUrl},</if>
<if test="approvalStatus != null">${approvalStatus},</if>
<if test="administrativeApprovalBureau != null">${administrativeApprovalBureau},</if>
<if test="registrationAuthorityProvince != null">${registrationAuthorityProvince},</if>
<if test="approvalStatus != null">#{approvalStatus},</if>
<if test="administrativeApprovalBureau != null">#{administrativeApprovalBureau},</if>
<if test="registrationAuthorityProvince != null">#{registrationAuthorityProvince},</if>
</trim>
</insert>

Loading…
Cancel
Save