diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java index 570e1f8a..132515d9 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrauth/UserLoginControllerApi.java @@ -1,6 +1,7 @@ package com.daqing.financial.hrauth; 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.UserLoginRequest; import com.daqing.framework.model.response.ResponseResult; @@ -23,7 +24,7 @@ public interface UserLoginControllerApi { ResponseResult verifyMobile(UserLoginRequest user); @ApiOperation(value = "重置密码") - ResponseResult getBackPwd(UserLoginRequest user); + ResponseResult getBackPwd(ResetPwdRequest user); @ApiOperation(value = "登录") ResponseResult login(LoginRequest loginRequest); diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java index 2c258c50..19236ee1 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java @@ -3,6 +3,7 @@ package com.daqing.financial.hrauth.controller; import com.daqing.financial.hrauth.UserLoginControllerApi; import com.daqing.financial.hrauth.service.UserLoginService; 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.UserLoginRequest; import com.daqing.framework.model.response.ResponseResult; @@ -47,7 +48,7 @@ public class UserLoginController implements UserLoginControllerApi { @PostMapping("/getBackPwd") @ApiOperation(value = "重置密码") - public ResponseResult getBackPwd(@RequestBody @Valid UserLoginRequest user){ + public ResponseResult getBackPwd(@RequestBody @Valid ResetPwdRequest user){ boolean result = userLoginService.getBackPwd(user); return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java index 23e2d2b4..7943de24 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java @@ -3,6 +3,7 @@ package com.daqing.financial.hrauth.service; import com.baomidou.mybatisplus.extension.service.IService; import com.daqing.framework.domain.hrms.UserEntity; 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.UserLoginRequest; import com.daqing.framework.model.response.ResponseResult; @@ -12,7 +13,7 @@ import com.daqing.framework.model.response.ResponseResult; * @date 2020/9/22 15:00 */ public interface UserLoginService extends IService { - Boolean getBackPwd(UserLoginRequest user); + Boolean getBackPwd(ResetPwdRequest user); UserLoginRequest verifyMobile(UserLoginRequest user); //登录 diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java index 904e1be5..5081a61c 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java @@ -10,6 +10,7 @@ import com.daqing.framework.domain.hrms.LoginLog; import com.daqing.framework.domain.hrms.Token; import com.daqing.framework.domain.hrms.UserEntity; 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.UserLoginRequest; import com.daqing.framework.domain.hrms.response.HrmsCode; @@ -84,7 +85,7 @@ public class UserLoginServiceImpl extends ServiceImpl * 重置密码 */ @Override - public Boolean getBackPwd(UserLoginRequest user){ + public Boolean getBackPwd(ResetPwdRequest user){ if(!user.getConfirmPwd().equals(user.getNewPwd())){ ExceptionCast.cast(HrmsCode.TWICE_PWD_DIFFERENT); } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/ResetPwdRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/ResetPwdRequest.java new file mode 100644 index 00000000..96accb61 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/ResetPwdRequest.java @@ -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; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java index 68dfb88f..ff5434a0 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/request/UserLoginRequest.java @@ -31,12 +31,12 @@ public class UserLoginRequest implements Serializable { /** * 新密码 */ - @Pattern(regexp = "^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$",message = "密码格式不正确!") - @NotBlank(message = "新密码不能为空!") - private String newPwd; + //@Pattern(regexp = "^(?=.*[0-9].*)(?=.*[A-Z].*)(?=.*[a-z].*).{6,20}$",message = "密码格式不正确!") + //@NotBlank(message = "新密码不能为空!") + //private String newPwd; /** * 确认密码 */ - @NotBlank(message = "确认密码不能为空!") - private String confirmPwd; + //@NotBlank(message = "确认密码不能为空!") + //private String confirmPwd; }