dev: 扫码入职流程优化
parent
a8898ff40d
commit
968dbeffbc
|
|
@ -178,9 +178,10 @@ public class UserAddExe {
|
|||
/**
|
||||
* 1. 根据id,查询用户信息
|
||||
* 2. 如果该用户没有企业id,则正常入职
|
||||
* 3. 如果该用户有企业id,并且在当前企业没有账号,则创建一条新user数据
|
||||
* 3.1 如果在当前企业有账号,则判断有未离职信息则提示
|
||||
* 4. 新user数据的基础信息通过手机号查询该用户的其他全的信息获取过来(有身份证信息的取第一个)
|
||||
* 3. 如果该用户有企业id
|
||||
* 3.1 如果在当前企业有账号,则判断有未离职信息则提示,如果已离职,则将离职状态改为入职待审批
|
||||
* 3.2 如果在当前企业没有账号,则创建一条新user数据
|
||||
* 4. 新user数据的基础信息通过手机号查询该用户的其他全的信息获取过来(有身份证号信息的取第一个)
|
||||
*/
|
||||
|
||||
UserDO userDO = userRepository.getById(cmd.getId());
|
||||
|
|
@ -191,18 +192,16 @@ public class UserAddExe {
|
|||
|
||||
UserE userE = new UserE();
|
||||
|
||||
|
||||
if(userDO.getCorpinfoId() == null){
|
||||
BeanUtils.copyProperties(cmd, userE);
|
||||
|
||||
// user表状态变为入职待审核
|
||||
userE.setEmploymentFlag(UserEmploymentFlagEnum.ENTRY_AUDIT.getCode());
|
||||
userGateway.update(userE);
|
||||
|
||||
|
||||
}else {
|
||||
String username = userDO.getUsername();
|
||||
List<UserDO> userDOS = userRepository.listByPhone(username);
|
||||
// 在当前企业是否有账号标识,false-没有,true-有
|
||||
boolean corpFlag = false;
|
||||
for (UserDO u : userDOS) {
|
||||
if(cmd.getCorpinfoId().equals(u.getCorpinfoId())){
|
||||
|
|
@ -213,6 +212,8 @@ public class UserAddExe {
|
|||
// user表状态变为入职待审核
|
||||
u.setEmploymentFlag(UserEmploymentFlagEnum.ENTRY_AUDIT.getCode());
|
||||
BeanUtils.copyProperties(u, userE);
|
||||
userE.setDepartmentId(cmd.getDepartmentId());
|
||||
userE.setPostName(cmd.getPostName());
|
||||
userGateway.update(userE);
|
||||
corpFlag = true;
|
||||
break;
|
||||
|
|
@ -252,63 +253,6 @@ public class UserAddExe {
|
|||
userChangeRecordE.initUserAddFromApp(userE, cmd.getCorpinfoName(), cmd.getDepartmentName());
|
||||
userChangeRecordGateway.add(userChangeRecordE);
|
||||
|
||||
|
||||
|
||||
// 判断user表是否有未离职的数据, 如果有则不能入职(1-离职)
|
||||
// List<Integer> statusList = Arrays.asList(UserEmploymentFlagEnum.RESIGNATION.getCode(), UserEmploymentFlagEnum.NOT_ON.getCode());
|
||||
|
||||
// 12.29,不校验userCorp表
|
||||
// List<UserCorpDO> userCorpDOS = userCorpRepository.listByUserIdAndCorpIdAndNoStatus(cmd.getId(), cmd.getCorpinfoId(), statusList);
|
||||
// if(CollUtil.isNotEmpty(userCorpDOS)){
|
||||
// throw new BizException("该用户在当前企业存在未离职信息,无法入职");
|
||||
// }
|
||||
|
||||
// 把user表相关企业,部门,岗位数据补充完整
|
||||
|
||||
|
||||
|
||||
// 12.29 相关方逻辑修改,暂时注释,后续无用再删除
|
||||
// // 查询用户信息, 获取是否流动人员
|
||||
// if(UserFlowFlagEnum.FLOW.getCode().equals(userDO.getFlowFlag())){
|
||||
//// List<UserCorpDO> userCorpList = userCorpRepository.listByUserIdAndCorpIdAndStatus(cmd.getId(), cmd.getCorpinfoId(), statusList);
|
||||
// if(CollUtil.isNotEmpty(userCorpList)){
|
||||
// if(userCorpList.size() > 1){
|
||||
// throw new BizException("用户在当前企业存在多条离职数据,请联系管理员。");
|
||||
// }
|
||||
// UserCorpDO userCorpDO = userCorpList.get(0);
|
||||
// if(userCorpDO.getEmploymentFlag() != null && UserEmploymentFlagEnum.ON.getCode().equals(userCorpDO.getEmploymentFlag()) ){
|
||||
// throw new BizException("该用户在当前企业已入职,无法入职");
|
||||
// }
|
||||
// userCorpDO.setEmploymentFlag(UserEmploymentFlagEnum.ENTRY_AUDIT.getCode());
|
||||
// UserCorpE userCorpE = new UserCorpE();
|
||||
// BeanUtils.copyProperties(userCorpDO, userCorpE);
|
||||
// userCorpGateway.update(userCorpE);
|
||||
// }else {
|
||||
// // 插入user_corp表
|
||||
// UserCorpE userCorpE = new UserCorpE();
|
||||
// userCorpE.setUserId(userE.getId());
|
||||
// userCorpE.setCorpinfoId(userE.getCorpinfoId());
|
||||
// userCorpE.setDepartmentId(userE.getDepartmentId());
|
||||
// userCorpE.setPostName(userE.getPostName());
|
||||
// userCorpE.setRoleId(userE.getRoleId());
|
||||
// userCorpE.setDepartmentLeaderFlag(0);
|
||||
// userCorpE.setSort(9999);
|
||||
// userCorpE.setEmploymentFlag(UserEmploymentFlagEnum.ENTRY_AUDIT.getCode());
|
||||
// userCorpGateway.add(userCorpE);
|
||||
// }
|
||||
// }else{
|
||||
// if(userDO.getCorpinfoId() != null ){
|
||||
// throw new BizException("固定用户在当前企业已入职,无法入职");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// userE.setEmploymentFlag(UserEmploymentFlagEnum.ENTRY_AUDIT.getCode());
|
||||
// // 扫码入职时, 固定人员user表企业id变为入职的企业
|
||||
// userE.setCorpinfoId(cmd.getCorpinfoId());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue