dev:app端忘记密码
parent
8515519038
commit
ac54d25ab4
|
|
@ -38,6 +38,12 @@ public class AppUserController {
|
||||||
return userService.sendPhoneCode(cmd);
|
return userService.sendPhoneCode(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("密码找回")
|
||||||
|
@PostMapping("/passwordRecover")
|
||||||
|
public SingleResponse<UserCO> passwordRecover(@Validated @RequestBody AppUserRegisterCmd cmd) {
|
||||||
|
return userService.passwordRecover(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("注册用户")
|
@ApiOperation("注册用户")
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public SingleResponse<UserCO> register(@Validated @RequestBody AppUserRegisterCmd cmd) {
|
public SingleResponse<UserCO> register(@Validated @RequestBody AppUserRegisterCmd cmd) {
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ public class UserAddExe {
|
||||||
if(phoneCodeObj == null || !phoneCodeObj.toString().equals(cmd.getPhoneCode())){
|
if(phoneCodeObj == null || !phoneCodeObj.toString().equals(cmd.getPhoneCode())){
|
||||||
throw new BizException("验证码已过期或错误");
|
throw new BizException("验证码已过期或错误");
|
||||||
}
|
}
|
||||||
|
zcloudRedisUtil.del(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
|
||||||
CorpInfoDO corpInfoDO = corpInfoRepository.getCorpInfoByCorpName("相关方通用租户");
|
CorpInfoDO corpInfoDO = corpInfoRepository.getCorpInfoByCorpName("相关方通用租户");
|
||||||
if(corpInfoDO == null){
|
if(corpInfoDO == null){
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.alibaba.cola.dto.Response;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||||
|
import com.zcloud.basic.info.constant.RedisConstant;
|
||||||
import com.zcloud.basic.info.domain.enums.UserChangeRecordStatusEnum;
|
import com.zcloud.basic.info.domain.enums.UserChangeRecordStatusEnum;
|
||||||
import com.zcloud.basic.info.domain.enums.UserEmploymentFlagEnum;
|
import com.zcloud.basic.info.domain.enums.UserEmploymentFlagEnum;
|
||||||
import com.zcloud.basic.info.domain.enums.UserFlowFlagEnum;
|
import com.zcloud.basic.info.domain.enums.UserFlowFlagEnum;
|
||||||
|
|
@ -52,6 +53,7 @@ public class UserUpdateExe {
|
||||||
private final UserCorpRecordGateway userCorpRecordGateway;
|
private final UserCorpRecordGateway userCorpRecordGateway;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private UserFacade userFacade;
|
private UserFacade userFacade;
|
||||||
|
private ZcloudRedisUtil zcloudRedisUtil;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void execute(UserUpdateCmd userUpdateCmd) {
|
public void execute(UserUpdateCmd userUpdateCmd) {
|
||||||
|
|
@ -109,6 +111,26 @@ public class UserUpdateExe {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean execute(AppUserRegisterCmd cmd) {
|
||||||
|
|
||||||
|
UserE userE = new UserE();
|
||||||
|
userE.checkPassword(cmd.getPassword(), cmd.getConfirmPassword());
|
||||||
|
// 获取redis验证码
|
||||||
|
Object phoneCodeObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
if(phoneCodeObj == null || !phoneCodeObj.toString().equals(cmd.getPhoneCode())){
|
||||||
|
throw new BizException("验证码已过期或错误");
|
||||||
|
}
|
||||||
|
zcloudRedisUtil.del(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
|
||||||
|
|
||||||
|
BeanUtils.copyProperties(cmd, userE);
|
||||||
|
userE.encryptionPassword();
|
||||||
|
userGateway.updatePassword(userE);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void executeChangePassword(Long id) {
|
public void executeChangePassword(Long id) {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,12 @@ public class UserServiceImpl implements UserServiceI {
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse<UserCO> passwordRecover(AppUserRegisterCmd cmd) {
|
||||||
|
userUpdateExe.execute(cmd);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<UserCO> perfectUserInfo(AppUserInfoCmd cmd) {
|
public SingleResponse<UserCO> perfectUserInfo(AppUserInfoCmd cmd) {
|
||||||
userAddExe.execute(cmd);
|
userAddExe.execute(cmd);
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ public interface UserServiceI {
|
||||||
|
|
||||||
SingleResponse<UserCO> register(AppUserRegisterCmd cmd);
|
SingleResponse<UserCO> register(AppUserRegisterCmd cmd);
|
||||||
|
|
||||||
|
SingleResponse<UserCO> passwordRecover(AppUserRegisterCmd cmd);
|
||||||
|
|
||||||
SingleResponse<UserCO> perfectUserInfo(AppUserInfoCmd cmd);
|
SingleResponse<UserCO> perfectUserInfo(AppUserInfoCmd cmd);
|
||||||
|
|
||||||
SingleResponse<UserCO> onboarding(AppUserOnboardingCmd cmd);
|
SingleResponse<UserCO> onboarding(AppUserOnboardingCmd cmd);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue