重置密码以及手机号验证码请求体拆分处理

master
shijie 4 years ago
parent 65ecebc84d
commit 822a0d9c1b
  1. 3
      dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java
  2. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java
  3. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java
  4. 3
      dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java
  5. 34
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/ResetPwdRequest.java
  6. 10
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java

@ -1,6 +1,7 @@
package com.daqing.financial.hrauth; package com.daqing.financial.hrauth;
import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.ResetPwdRequest;
import com.daqing.framework.domain.hrms.request.UpdatePwdRequest; import com.daqing.framework.domain.hrms.request.UpdatePwdRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
@ -23,7 +24,7 @@ public interface UserLoginControllerApi {
ResponseResult verifyMobile(UserLoginRequest user); ResponseResult verifyMobile(UserLoginRequest user);
@ApiOperation(value = "重置密码") @ApiOperation(value = "重置密码")
ResponseResult getBackPwd(UserLoginRequest user); ResponseResult getBackPwd(ResetPwdRequest user);
@ApiOperation(value = "登录") @ApiOperation(value = "登录")
ResponseResult login(LoginRequest loginRequest); ResponseResult login(LoginRequest loginRequest);

@ -3,6 +3,7 @@ package com.daqing.financial.hrauth.controller;
import com.daqing.financial.hrauth.UserLoginControllerApi; import com.daqing.financial.hrauth.UserLoginControllerApi;
import com.daqing.financial.hrauth.service.UserLoginService; import com.daqing.financial.hrauth.service.UserLoginService;
import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.ResetPwdRequest;
import com.daqing.framework.domain.hrms.request.UpdatePwdRequest; import com.daqing.framework.domain.hrms.request.UpdatePwdRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
@ -47,7 +48,7 @@ public class UserLoginController implements UserLoginControllerApi {
@PostMapping("/getBackPwd") @PostMapping("/getBackPwd")
@ApiOperation(value = "重置密码") @ApiOperation(value = "重置密码")
public ResponseResult getBackPwd(@RequestBody @Valid UserLoginRequest user){ public ResponseResult getBackPwd(@RequestBody @Valid ResetPwdRequest user){
boolean result = userLoginService.getBackPwd(user); boolean result = userLoginService.getBackPwd(user);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
} }

@ -3,6 +3,7 @@ package com.daqing.financial.hrauth.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.domain.hrms.UserEntity; import com.daqing.framework.domain.hrms.UserEntity;
import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.ResetPwdRequest;
import com.daqing.framework.domain.hrms.request.UpdatePwdRequest; import com.daqing.framework.domain.hrms.request.UpdatePwdRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
@ -12,7 +13,7 @@ import com.daqing.framework.model.response.ResponseResult;
* @date 2020/9/22 15:00 * @date 2020/9/22 15:00
*/ */
public interface UserLoginService extends IService<UserEntity> { public interface UserLoginService extends IService<UserEntity> {
Boolean getBackPwd(UserLoginRequest user); Boolean getBackPwd(ResetPwdRequest user);
UserLoginRequest verifyMobile(UserLoginRequest user); UserLoginRequest verifyMobile(UserLoginRequest user);
//登录 //登录

@ -10,6 +10,7 @@ import com.daqing.framework.domain.hrms.LoginLog;
import com.daqing.framework.domain.hrms.Token; import com.daqing.framework.domain.hrms.Token;
import com.daqing.framework.domain.hrms.UserEntity; import com.daqing.framework.domain.hrms.UserEntity;
import com.daqing.framework.domain.hrms.request.LoginRequest; import com.daqing.framework.domain.hrms.request.LoginRequest;
import com.daqing.framework.domain.hrms.request.ResetPwdRequest;
import com.daqing.framework.domain.hrms.request.UpdatePwdRequest; import com.daqing.framework.domain.hrms.request.UpdatePwdRequest;
import com.daqing.framework.domain.hrms.request.UserLoginRequest; import com.daqing.framework.domain.hrms.request.UserLoginRequest;
import com.daqing.framework.domain.hrms.response.HrmsCode; import com.daqing.framework.domain.hrms.response.HrmsCode;
@ -84,7 +85,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UserLoginDao, UserEntity>
* 重置密码 * 重置密码
*/ */
@Override @Override
public Boolean getBackPwd(UserLoginRequest user){ public Boolean getBackPwd(ResetPwdRequest user){
if(!user.getConfirmPwd().equals(user.getNewPwd())){ if(!user.getConfirmPwd().equals(user.getNewPwd())){
ExceptionCast.cast(HrmsCode.TWICE_PWD_DIFFERENT); ExceptionCast.cast(HrmsCode.TWICE_PWD_DIFFERENT);
} }

@ -0,0 +1,34 @@
package com.daqing.framework.domain.hrms.request;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
/**
* 重置密码请求体对象
*
* @author gongsj
* @email gongsj@gmail.com
* @date 2020-09-07 17:12:14
*/
@Data
public class ResetPwdRequest implements Serializable {
/**
* 新密码
*/
@Pattern(regexp = "^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$",message = "密码格式不正确!")
@NotBlank(message = "新密码不能为空!")
private String newPwd;
/**
* 确认密码
*/
@NotBlank(message = "确认密码不能为空!")
private String confirmPwd;
/**
* 手机账号
*/
@Pattern(regexp = "^1(3([0-35-9]\\d|4[1-8])|4[14-9]\\d|5([0125689]\\d|7[1-79])|66\\d|7[2-35-8]\\d|8\\d{2}|9[13589]\\d)\\d{7}$",message = "手机号格式不正确!")
private String phoneAccount;
}

@ -31,12 +31,12 @@ public class UserLoginRequest implements Serializable {
/** /**
* 新密码 * 新密码
*/ */
@Pattern(regexp = "^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$",message = "密码格式不正确!") //@Pattern(regexp = "^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$",message = "密码格式不正确!")
@NotBlank(message = "新密码不能为空!") //@NotBlank(message = "新密码不能为空!")
private String newPwd; //private String newPwd;
/** /**
* 确认密码 * 确认密码
*/ */
@NotBlank(message = "确认密码不能为空!") //@NotBlank(message = "确认密码不能为空!")
private String confirmPwd; //private String confirmPwd;
} }

Loading…
Cancel
Save