dev:app端扫码入职流程代码修改
parent
9ae0caad52
commit
e786fecd88
|
|
@ -26,11 +26,11 @@ import org.springframework.web.bind.annotation.*;
|
||||||
public class AppUserController {
|
public class AppUserController {
|
||||||
private final UserServiceI userService;
|
private final UserServiceI userService;
|
||||||
|
|
||||||
@ApiOperation("验证手机号是否已注册")
|
// @ApiOperation("验证手机号是否已注册")
|
||||||
@PostMapping("/verifyPhone")
|
// @PostMapping("/verifyPhone")
|
||||||
public Response verifyPhone(@Validated @RequestBody UserVerifyPhoneCmd cmd) {
|
// public Response verifyPhone(@Validated @RequestBody UserVerifyPhoneCmd cmd) {
|
||||||
return userService.verifyPhone(cmd);
|
// return userService.verifyPhone(cmd);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ApiOperation("发送验证码")
|
@ApiOperation("发送验证码")
|
||||||
@PostMapping("/sendPhoneCode")
|
@PostMapping("/sendPhoneCode")
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public class UserAddExe {
|
||||||
private final UserCorpRepository userCorpRepository;
|
private final UserCorpRepository userCorpRepository;
|
||||||
private final UserChangeRecordGateway userChangeRecordGateway;
|
private final UserChangeRecordGateway userChangeRecordGateway;
|
||||||
private final UserCorpRecordGateway userCorpRecordGateway;
|
private final UserCorpRecordGateway userCorpRecordGateway;
|
||||||
private ZcloudRedisUtil zcloudRedisUtil;
|
// private ZcloudRedisUtil zcloudRedisUtil;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -109,11 +109,11 @@ public class UserAddExe {
|
||||||
UserE userE = new UserE();
|
UserE userE = new UserE();
|
||||||
userE.checkPassword(cmd.getPassword(), cmd.getConfirmPassword());
|
userE.checkPassword(cmd.getPassword(), cmd.getConfirmPassword());
|
||||||
// 获取redis验证码
|
// 获取redis验证码
|
||||||
Object phoneCodeObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
// Object phoneCodeObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
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());
|
// zcloudRedisUtil.del(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
|
||||||
CorpInfoDO corpInfoDO = corpInfoRepository.getCorpInfoByCorpName("相关方通用租户");
|
CorpInfoDO corpInfoDO = corpInfoRepository.getCorpInfoByCorpName("相关方通用租户");
|
||||||
if(corpInfoDO == null){
|
if(corpInfoDO == null){
|
||||||
|
|
@ -121,6 +121,7 @@ public class UserAddExe {
|
||||||
}
|
}
|
||||||
BeanUtils.copyProperties(cmd, userE);
|
BeanUtils.copyProperties(cmd, userE);
|
||||||
userE.setCorpinfoId(corpInfoDO.getId());
|
userE.setCorpinfoId(corpInfoDO.getId());
|
||||||
|
userE.setDepartmentId(corpInfoDO.getId());
|
||||||
userGateway.register(userE);
|
userGateway.register(userE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -185,27 +186,28 @@ public class UserAddExe {
|
||||||
public boolean executeSendPhoneCode(UserVerifyPhoneCmd cmd) {
|
public boolean executeSendPhoneCode(UserVerifyPhoneCmd cmd) {
|
||||||
// 生成6位验证码
|
// 生成6位验证码
|
||||||
String phoneCode = RandomUtil.randomNumbers(6);
|
String phoneCode = RandomUtil.randomNumbers(6);
|
||||||
Object phoneCodeCountObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone());
|
// Object phoneCodeCountObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone());
|
||||||
if(phoneCodeCountObj != null){
|
// if(phoneCodeCountObj != null){
|
||||||
Integer phoneCodeCount = (Integer) phoneCodeCountObj;
|
// Integer phoneCodeCount = (Integer) phoneCodeCountObj;
|
||||||
if(phoneCodeCount >= 20){
|
// if(phoneCodeCount >= 20){
|
||||||
throw new BizException("今天验证码已发送次数已超过20次");
|
// throw new BizException("今天验证码已发送次数已超过20次");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
boolean sendFlag = sendMessage(cmd.getPhone(), phoneCode);
|
// boolean sendFlag = sendMessage(cmd.getPhone(), phoneCode);
|
||||||
if(sendFlag){
|
// if(sendFlag){
|
||||||
// 发送成功
|
// // 发送成功
|
||||||
// 放入到redis里
|
// // 放入到redis里
|
||||||
zcloudRedisUtil.set(RedisConstant.PHONE_CODE_KEY + cmd.getPhone(), phoneCode, 60 * 15);
|
// zcloudRedisUtil.set(RedisConstant.PHONE_CODE_KEY + cmd.getPhone(), phoneCode, 60 * 15);
|
||||||
// 设置新的验证码发送次数
|
// // 设置新的验证码发送次数
|
||||||
zcloudRedisUtil.set(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone(),
|
// zcloudRedisUtil.set(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone(),
|
||||||
phoneCodeCountObj == null ? 1 : (Integer)phoneCodeCountObj + 1,
|
// phoneCodeCountObj == null ? 1 : (Integer)phoneCodeCountObj + 1,
|
||||||
60 * 60 * 24);
|
// 60 * 60 * 24);
|
||||||
return true;
|
// return true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
return false;
|
// return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装发送短信
|
// 组装发送短信
|
||||||
|
|
|
||||||
|
|
@ -123,11 +123,11 @@ public class UserUpdateExe {
|
||||||
userE.checkPassword(cmd.getPassword(), cmd.getConfirmPassword());
|
userE.checkPassword(cmd.getPassword(), cmd.getConfirmPassword());
|
||||||
|
|
||||||
// 获取redis验证码
|
// 获取redis验证码
|
||||||
Object phoneCodeObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
// Object phoneCodeObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
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());
|
// zcloudRedisUtil.del(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
|
||||||
|
|
||||||
BeanUtils.copyProperties(cmd, userE);
|
BeanUtils.copyProperties(cmd, userE);
|
||||||
userE.encryptionPassword();
|
userE.encryptionPassword();
|
||||||
|
|
|
||||||
|
|
@ -226,8 +226,8 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
||||||
userAddCmd.setAccount(userDO.getPhone());
|
userAddCmd.setAccount(userDO.getPhone());
|
||||||
userAddCmd.setMobile(userDO.getPhone());
|
userAddCmd.setMobile(userDO.getPhone());
|
||||||
RoleDeptAddCmd roleDeptAddCmd = new RoleDeptAddCmd();
|
RoleDeptAddCmd roleDeptAddCmd = new RoleDeptAddCmd();
|
||||||
roleDeptAddCmd.setRoleId(0L);
|
roleDeptAddCmd.setRoleId(1994326788804837377L);
|
||||||
roleDeptAddCmd.setDeptId(0L);
|
roleDeptAddCmd.setDeptId(userDO.getDepartmentId());
|
||||||
List<RoleDeptAddCmd> roleDeptAddCmdList = Collections.singletonList(roleDeptAddCmd);
|
List<RoleDeptAddCmd> roleDeptAddCmdList = Collections.singletonList(roleDeptAddCmd);
|
||||||
userAddCmd.setRoleDepts(roleDeptAddCmdList);
|
userAddCmd.setRoleDepts(roleDeptAddCmdList);
|
||||||
userAddCmd.setTenantId(userDO.getCorpinfoId());
|
userAddCmd.setTenantId(userDO.getCorpinfoId());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue