Compare commits
3 Commits
854e12122f
...
683a681e10
| Author | SHA1 | Date |
|---|---|---|
|
|
683a681e10 | |
|
|
e786fecd88 | |
|
|
9ae0caad52 |
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 组装发送短信
|
// 组装发送短信
|
||||||
|
|
|
||||||
|
|
@ -136,11 +136,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();
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,11 @@ import javax.validation.constraints.NotNull;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AppUserInfoCmd extends Command {
|
public class AppUserInfoCmd extends Command {
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键id", name = "id")
|
@ApiModelProperty(value = "主键id", name = "id", required = true)
|
||||||
@NotNull(message = "主键id不能为空")
|
@NotNull(message = "主键id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "人脸照片url", name = "userAvatarUrl")
|
@ApiModelProperty(value = "人脸照片url", name = "userAvatarUrl", required = true)
|
||||||
@NotEmpty(message = "人脸照片url不能为空")
|
@NotEmpty(message = "人脸照片url不能为空")
|
||||||
private String userAvatarUrl;
|
private String userAvatarUrl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,27 +22,27 @@ import javax.validation.constraints.NotNull;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AppUserOnboardingCmd extends Command {
|
public class AppUserOnboardingCmd extends Command {
|
||||||
|
|
||||||
@ApiModelProperty(value = "主键id", name = "id")
|
@ApiModelProperty(value = "主键id", name = "id", required = true)
|
||||||
@NotNull(message = "主键id不能为空")
|
@NotNull(message = "主键id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "企业id", name = "corpinfoId")
|
@ApiModelProperty(value = "企业id", name = "corpinfoId", required = true)
|
||||||
@NotNull(message = "企业id不能为空")
|
@NotNull(message = "企业id不能为空")
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "企业名称", name = "corpinfoName")
|
@ApiModelProperty(value = "企业名称", name = "corpinfoName", required = true)
|
||||||
@NotEmpty(message = "企业名称不能为空")
|
@NotEmpty(message = "企业名称不能为空")
|
||||||
private String corpinfoName;
|
private String corpinfoName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门id", name = "departmentId")
|
@ApiModelProperty(value = "部门id", name = "departmentId", required = true)
|
||||||
@NotNull(message = "部门id不能为空")
|
@NotNull(message = "部门id不能为空")
|
||||||
private Long departmentId;
|
private Long departmentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门名称", name = "departmentName")
|
@ApiModelProperty(value = "部门名称", name = "departmentName", required = true)
|
||||||
@NotEmpty(message = "部门名称不能为空")
|
@NotEmpty(message = "部门名称不能为空")
|
||||||
private String departmentName;
|
private String departmentName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "部门名称", name = "departmentName")
|
@ApiModelProperty(value = "部门名称", name = "departmentName", required = true)
|
||||||
@NotEmpty(message = "部门名称不能为空")
|
@NotEmpty(message = "部门名称不能为空")
|
||||||
private String postName;
|
private String postName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,19 @@ import javax.validation.constraints.NotEmpty;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AppUserRegisterCmd extends Command {
|
public class AppUserRegisterCmd extends Command {
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号", name = "phone")
|
@ApiModelProperty(value = "手机号", name = "phone", required = true)
|
||||||
@NotEmpty(message = "手机号不能为空")
|
@NotEmpty(message = "手机号不能为空")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "密码", name = "password")
|
@ApiModelProperty(value = "密码", name = "password", required = true)
|
||||||
@NotEmpty(message = "密码不能为空")
|
@NotEmpty(message = "密码不能为空")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@ApiModelProperty(value = "确认密码", name = "confirmPassword")
|
@ApiModelProperty(value = "确认密码", name = "confirmPassword", required = true)
|
||||||
@NotEmpty(message = "确认密码不能为空")
|
@NotEmpty(message = "确认密码不能为空")
|
||||||
private String confirmPassword;
|
private String confirmPassword;
|
||||||
|
|
||||||
@ApiModelProperty(value = "验证码", name = "phoneCode")
|
@ApiModelProperty(value = "验证码", name = "phoneCode", required = true)
|
||||||
@NotEmpty(message = "验证码不能为空")
|
@NotEmpty(message = "验证码不能为空")
|
||||||
private String phoneCode;
|
private String phoneCode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import javax.validation.constraints.NotEmpty;
|
||||||
public class UserVerifyPhoneCmd {
|
public class UserVerifyPhoneCmd {
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号", name = "phone", required = true)
|
@ApiModelProperty(value = "手机号", name = "phone", required = true)
|
||||||
@NotEmpty
|
@NotEmpty(message = "手机号不能为空")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -228,8 +228,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