dev:app入职相关接口
parent
f6b859b5d9
commit
8515519038
|
|
@ -25,7 +25,6 @@ import org.springframework.web.bind.annotation.*;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class AppUserController {
|
public class AppUserController {
|
||||||
private final UserServiceI userService;
|
private final UserServiceI userService;
|
||||||
private final TranslateField translateField;
|
|
||||||
|
|
||||||
@ApiOperation("验证手机号是否已注册")
|
@ApiOperation("验证手机号是否已注册")
|
||||||
@PostMapping("/verifyPhone")
|
@PostMapping("/verifyPhone")
|
||||||
|
|
@ -51,7 +50,6 @@ public class AppUserController {
|
||||||
return userService.perfectUserInfo(cmd);
|
return userService.perfectUserInfo(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("上传人脸识别图片")
|
@ApiOperation("上传人脸识别图片")
|
||||||
@PostMapping("/updateUserFaceUrl")
|
@PostMapping("/updateUserFaceUrl")
|
||||||
public Response updateUserFaceUrl(@Validated @RequestBody UserUpdateFaceUrlCmd cmd){
|
public Response updateUserFaceUrl(@Validated @RequestBody UserUpdateFaceUrlCmd cmd){
|
||||||
|
|
@ -73,7 +71,5 @@ public class AppUserController {
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,27 +2,38 @@ package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.jjb.saas.config.client.dicttree.facade.ConfDictTreeFacade;
|
import com.jjb.saas.config.client.dicttree.facade.ConfDictTreeFacade;
|
||||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.jjb.saas.message.client.message.facede.MessageFacade;
|
import com.jjb.saas.message.client.message.facede.MessageFacade;
|
||||||
|
import com.jjb.saas.message.client.message.request.MessageSendCmd;
|
||||||
|
import com.jjb.saas.message.client.message.request.MessageTargetCmd;
|
||||||
import com.zcloud.basic.info.command.convertor.UserCoConvertor;
|
import com.zcloud.basic.info.command.convertor.UserCoConvertor;
|
||||||
import com.zcloud.basic.info.command.query.CorpInfoQueryExe;
|
import com.zcloud.basic.info.command.query.CorpInfoQueryExe;
|
||||||
|
import com.zcloud.basic.info.constant.RedisConstant;
|
||||||
import com.zcloud.basic.info.domain.enums.UserFlowFlagEnum;
|
import com.zcloud.basic.info.domain.enums.UserFlowFlagEnum;
|
||||||
import com.zcloud.basic.info.domain.gateway.*;
|
import com.zcloud.basic.info.domain.gateway.*;
|
||||||
import com.zcloud.basic.info.domain.model.*;
|
import com.zcloud.basic.info.domain.model.*;
|
||||||
import com.zcloud.basic.info.dto.*;
|
import com.zcloud.basic.info.dto.*;
|
||||||
import com.zcloud.basic.info.persistence.dataobject.*;
|
import com.zcloud.basic.info.persistence.dataobject.*;
|
||||||
import com.zcloud.basic.info.persistence.repository.*;
|
import com.zcloud.basic.info.persistence.repository.*;
|
||||||
|
import com.zcloud.gbscommon.utils.DateUtil;
|
||||||
|
import com.zcloud.gbscommon.utils.UuidUtil;
|
||||||
|
import com.zcloud.gbscommon.utils.ZcloudRedisUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -42,11 +53,14 @@ public class UserAddExe {
|
||||||
private final UserRepository userRepository;
|
private final UserRepository userRepository;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ConfDictTreeFacade confDictTreeFacade;
|
private ConfDictTreeFacade confDictTreeFacade;
|
||||||
|
@DubboReference
|
||||||
|
private final MessageFacade messageFacade;
|
||||||
private final CorpInfoQueryExe corpInfoQueryExe;
|
private final CorpInfoQueryExe corpInfoQueryExe;
|
||||||
private final UserCorpGateway userCorpGateway;
|
private final UserCorpGateway userCorpGateway;
|
||||||
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;
|
||||||
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
|
@ -94,8 +108,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());
|
||||||
|
if(phoneCodeObj == null || !phoneCodeObj.toString().equals(cmd.getPhoneCode())){
|
||||||
|
throw new BizException("验证码已过期或错误");
|
||||||
|
}
|
||||||
|
|
||||||
CorpInfoDO corpInfoDO = corpInfoRepository.getCorpInfoByCorpName("相关方通用租户");
|
CorpInfoDO corpInfoDO = corpInfoRepository.getCorpInfoByCorpName("相关方通用租户");
|
||||||
if(corpInfoDO == null){
|
if(corpInfoDO == null){
|
||||||
|
|
@ -113,6 +130,8 @@ public class UserAddExe {
|
||||||
|
|
||||||
UserE userE = new UserE();
|
UserE userE = new UserE();
|
||||||
BeanUtils.copyProperties(cmd, userE);
|
BeanUtils.copyProperties(cmd, userE);
|
||||||
|
// 3-相关方
|
||||||
|
userE.setUserType(3);
|
||||||
|
|
||||||
userGateway.update(userE);
|
userGateway.update(userE);
|
||||||
|
|
||||||
|
|
@ -135,11 +154,13 @@ public class UserAddExe {
|
||||||
|
|
||||||
// 查询用户信息, 获取是否流动人员
|
// 查询用户信息, 获取是否流动人员
|
||||||
UserDO userDO = userRepository.getById(cmd.getId());
|
UserDO userDO = userRepository.getById(cmd.getId());
|
||||||
|
if(userDO == null){
|
||||||
|
throw new BizException("用户不存在");
|
||||||
|
}
|
||||||
if(userDO.getEmploymentFlag() == 1){
|
if(userDO.getEmploymentFlag() == 1){
|
||||||
// 插入user_corp表
|
// 插入user_corp表
|
||||||
UserCorpE userCorpE = new UserCorpE();
|
UserCorpE userCorpE = new UserCorpE();
|
||||||
userCorpE.setUserId(userE.getId());
|
userCorpE.setUserId(userE.getId());
|
||||||
userCorpE.setEmploymentFlag(11);
|
|
||||||
userCorpE.setCorpinfoId(userE.getCorpinfoId());
|
userCorpE.setCorpinfoId(userE.getCorpinfoId());
|
||||||
userCorpE.setDepartmentId(userE.getDepartmentId());
|
userCorpE.setDepartmentId(userE.getDepartmentId());
|
||||||
userCorpE.setPostName(userE.getPostName());
|
userCorpE.setPostName(userE.getPostName());
|
||||||
|
|
@ -159,34 +180,47 @@ public class UserAddExe {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@DubboReference
|
|
||||||
private final MessageFacade messageFacade;
|
|
||||||
|
|
||||||
// private ZcloudRedisUtil zcloudRedisUtil;
|
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean executeSendPhoneCode(UserVerifyPhoneCmd cmd) {
|
public boolean executeSendPhoneCode(UserVerifyPhoneCmd cmd) {
|
||||||
// 生成6位验证码
|
// 生成6位验证码
|
||||||
String s = RandomUtil.randomString(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次");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean sendFlag = sendMessage(cmd.getPhone(), phoneCode);
|
||||||
|
if(sendFlag){
|
||||||
|
// 发送成功
|
||||||
// 放入到redis里
|
// 放入到redis里
|
||||||
// 每天每个手机号只能发20次
|
zcloudRedisUtil.set(RedisConstant.PHONE_CODE_KEY + cmd.getPhone(), phoneCode, 60 * 15);
|
||||||
|
// 设置新的验证码发送次数
|
||||||
|
zcloudRedisUtil.set(RedisConstant.PHONE_CODE_COUNT + DateUtil.getDays() + ":" + cmd.getPhone(),
|
||||||
// MessageSendCmd messageSendCmd = new MessageSendCmd();
|
phoneCodeCountObj == null ? 1 : (Integer)phoneCodeCountObj + 1,
|
||||||
// messageSendCmd.setBusinessId(UuidUtil.get32UUID());
|
60 * 60 * 24);
|
||||||
// MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
|
||||||
// messageTargetCmd.setMobile("18603366337");
|
|
||||||
// messageSendCmd.setTargetCmd(messageTargetCmd);
|
|
||||||
// messageSendCmd.setSourceCode("MS000070");
|
|
||||||
// Map<String, Object> sendParams = new HashMap<String, Object>();
|
|
||||||
// sendParams.put("code", "77777");
|
|
||||||
// messageSendCmd.setParams(sendParams);
|
|
||||||
// SingleResponse<Boolean> d = messageFacade.send(messageSendCmd);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// 组装发送短信
|
// 组装发送短信
|
||||||
|
public boolean sendMessage(String phone, String phoneCode){
|
||||||
|
MessageSendCmd messageSendCmd = new MessageSendCmd();
|
||||||
|
messageSendCmd.setBusinessId(UuidUtil.get32UUID());
|
||||||
|
MessageTargetCmd messageTargetCmd = new MessageTargetCmd();
|
||||||
|
messageTargetCmd.setMobile(phone);
|
||||||
|
messageSendCmd.setTargetCmd(messageTargetCmd);
|
||||||
|
messageSendCmd.setSourceCode("MS000070");
|
||||||
|
Map<String, Object> sendParams = new HashMap<String, Object>();
|
||||||
|
sendParams.put("code", phoneCode);
|
||||||
|
messageSendCmd.setParams(sendParams);
|
||||||
|
SingleResponse<Boolean> d = messageFacade.send(messageSendCmd);
|
||||||
|
return d == null ? false : d.getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,8 @@ public class UserServiceImpl implements UserServiceI {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SingleResponse<UserCO> sendPhoneCode(UserVerifyPhoneCmd cmd) {
|
public SingleResponse<Boolean> sendPhoneCode(UserVerifyPhoneCmd cmd) {
|
||||||
userAddExe.executeSendPhoneCode(cmd);
|
return SingleResponse.of(userAddExe.executeSendPhoneCode(cmd));
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ public interface UserServiceI {
|
||||||
|
|
||||||
SingleResponse<UserCO> verifyPhone(UserVerifyPhoneCmd cmd);
|
SingleResponse<UserCO> verifyPhone(UserVerifyPhoneCmd cmd);
|
||||||
|
|
||||||
SingleResponse<UserCO> sendPhoneCode(UserVerifyPhoneCmd cmd);
|
SingleResponse<Boolean> sendPhoneCode(UserVerifyPhoneCmd cmd);
|
||||||
|
|
||||||
SingleResponse<UserCO> addXgf(UserXgfAddCmd cmd);
|
SingleResponse<UserCO> addXgf(UserXgfAddCmd cmd);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.zcloud.basic.info.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author SondonYong
|
||||||
|
* @description
|
||||||
|
* @date 2025/12/3/周三 16:59
|
||||||
|
*/
|
||||||
|
public class RedisConstant {
|
||||||
|
|
||||||
|
public static final String PHONE_CODE_KEY = "PHONE_CODE_KEY:";
|
||||||
|
public static final String PHONE_CODE_COUNT = "PHONE_CODE_COUNT:";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -26,10 +26,6 @@ public class AppUserInfoCmd extends Command {
|
||||||
@NotNull(message = "主键id不能为空")
|
@NotNull(message = "主键id不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户类型,1监管2企业3相关方", name = "userType", required = true)
|
|
||||||
@NotNull(message = "用户类型,1监管2企业3相关方不能为空")
|
|
||||||
private Integer userType;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "人脸照片url", name = "userAvatarUrl")
|
@ApiModelProperty(value = "人脸照片url", name = "userAvatarUrl")
|
||||||
@NotEmpty(message = "人脸照片url不能为空")
|
@NotEmpty(message = "人脸照片url不能为空")
|
||||||
private String userAvatarUrl;
|
private String userAvatarUrl;
|
||||||
|
|
@ -50,6 +46,14 @@ public class AppUserInfoCmd extends Command {
|
||||||
@NotEmpty(message = "民族名称不能为空")
|
@NotEmpty(message = "民族名称不能为空")
|
||||||
private String nationName;
|
private String nationName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "现住址", name = "currentAddress", required = true)
|
||||||
|
@NotEmpty(message = "现住址不能为空")
|
||||||
|
private String currentAddress;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "户口所在地", name = "locationAddress", required = true)
|
||||||
|
@NotEmpty(message = "户口所在地不能为空")
|
||||||
|
private String locationAddress;
|
||||||
|
|
||||||
@ApiModelProperty(value = "文化程度 数据字典", name = "culturalLevel", required = true)
|
@ApiModelProperty(value = "文化程度 数据字典", name = "culturalLevel", required = true)
|
||||||
@NotEmpty(message = "文化程度 数据字典不能为空")
|
@NotEmpty(message = "文化程度 数据字典不能为空")
|
||||||
private String culturalLevel;
|
private String culturalLevel;
|
||||||
|
|
@ -81,29 +85,5 @@ public class AppUserInfoCmd extends Command {
|
||||||
@ApiModelProperty(value = "邮箱", name = "email")
|
@ApiModelProperty(value = "邮箱", name = "email")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "人员类型编码(主要负责人等)", name = "personnelType", required = true)
|
|
||||||
private String personnelType;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "人员类型翻译", name = "personnelTypeName", required = true)
|
|
||||||
private String personnelTypeName;
|
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "现住址", name = "currentAddress")
|
|
||||||
private String currentAddress;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "户口所在地", name = "locationAddress")
|
|
||||||
private String locationAddress;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,5 +83,6 @@ public class UserCorpE extends BaseE {
|
||||||
this.setSort(userE.getSort());
|
this.setSort(userE.getSort());
|
||||||
this.setDepartmentLeaderFlag(userE.getDepartmentLeaderFlag());
|
this.setDepartmentLeaderFlag(userE.getDepartmentLeaderFlag());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue