dev:app端扫码入职流程代码修改

main
SondonYong 2025-12-05 08:29:09 +08:00
parent 9b6dc266d8
commit 0860cba729
4 changed files with 32 additions and 22 deletions

View File

@ -61,7 +61,7 @@ public class UserAddExe {
private final UserCorpRepository userCorpRepository;
private final UserChangeRecordGateway userChangeRecordGateway;
private final UserCorpRecordGateway userCorpRecordGateway;
// private ZcloudRedisUtil zcloudRedisUtil;
private ZcloudRedisUtil zcloudRedisUtil;
@Transactional(rollbackFor = Exception.class)
@ -205,28 +205,27 @@ public class UserAddExe {
public boolean executeSendPhoneCode(UserVerifyPhoneCmd cmd) {
// 生成6位验证码
String phoneCode = RandomUtil.randomNumbers(6);
// Object phoneCodeCountObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone());
// if(phoneCodeCountObj != null){
// Integer phoneCodeCount = (Integer) phoneCodeCountObj;
// if(phoneCodeCount >= 20){
// throw new BizException("今天验证码已发送次数已超过20次");
// }
// }
Object phoneCodeCountObj = zcloudRedisUtil.get(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone());
if(phoneCodeCountObj != null){
Integer phoneCodeCount = (Integer) phoneCodeCountObj;
if(phoneCodeCount >= 20){
throw new BizException("今天验证码已发送次数已超过20次");
}
}
// boolean sendFlag = sendMessage(cmd.getPhone(), phoneCode);
// if(sendFlag){
// // 发送成功
// // 放入到redis里
// zcloudRedisUtil.set(RedisConstant.PHONE_CODE_KEY + cmd.getPhone(), phoneCode, 60 * 15);
// // 设置新的验证码发送次数
// zcloudRedisUtil.set(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone(),
// phoneCodeCountObj == null ? 1 : (Integer)phoneCodeCountObj + 1,
// 60 * 60 * 24);
// return true;
// }
boolean sendFlag = sendMessage(cmd.getPhone(), phoneCode);
if(sendFlag){
// 发送成功
// 放入到redis里
zcloudRedisUtil.set(RedisConstant.PHONE_CODE_KEY + cmd.getPhone(), phoneCode, 60 * 15);
// 设置新的验证码发送次数
zcloudRedisUtil.set(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone(),
phoneCodeCountObj == null ? 1 : (Integer)phoneCodeCountObj + 1,
60 * 60 * 24);
return true;
}
// return false;
return true;
return false;
}
// 组装发送短信

View File

@ -130,7 +130,8 @@ public class UserUpdateExe {
@Transactional(rollbackFor = Exception.class)
public boolean execute(AppUserRegisterCmd cmd) {
// 根据手机号查询用户信息
UserDO userDO = userRepository.getByPhone(cmd.getPhone());
UserE userE = new UserE();
userE.checkPassword(cmd.getNewPassword(), cmd.getConfirmPassword());
@ -143,6 +144,7 @@ public class UserUpdateExe {
// zcloudRedisUtil.del(RedisConstant.PHONE_CODE_KEY + cmd.getPhone());
BeanUtils.copyProperties(cmd, userE);
userE.setId(userDO.getId());
userE.encryptionPassword();
userGateway.updatePassword(userE);

View File

@ -75,5 +75,7 @@ public interface UserRepository extends BaseRepository<UserDO> {
PageResponse<UserDO> listXgf(Map<String, Object> params);
void sendResignationMq(Long userId, Long corpinfoId);
UserDO getByPhone(String phone);
}

View File

@ -426,5 +426,12 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
}
}
@Override
public UserDO getByPhone(String phone) {
QueryWrapper<UserDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("phone", phone);
return getOne(queryWrapper);
}
}