手机号验证及密码修改
parent
8f6f143695
commit
6e9141d123
|
|
@ -385,21 +385,47 @@ public class UserAddExe {
|
|||
//校验手机号
|
||||
List<Integer> employmentFlagList = Arrays.asList(UserEmploymentFlagEnum.ON.getCode(), UserEmploymentFlagEnum.ENTRY_AUDIT.getCode(), UserEmploymentFlagEnum.RESIGNATION_AUDIT.getCode());
|
||||
List<UserDO> userList = userRepository.getListByPhone(userE.getPhone(),employmentFlagList);
|
||||
Boolean addFlag = true;
|
||||
UserDO userDOUpdate = null;
|
||||
if(CollUtil.isNotEmpty(userList)){
|
||||
List<UserE> userEList = userCoConvertor.convertDOsToEs(userList);
|
||||
userE.checkXGfPhone(userEList);
|
||||
if(UserFlowFlagEnum.FIXED.getCode().equals(cmd.getFlowFlag())){
|
||||
//如果在其他企业有入职,不允许新增,如果是本企业,允许新增
|
||||
userList.forEach(u -> {
|
||||
if (UserEmploymentFlagEnum.ON.getCode().equals(u.getEmploymentFlag())
|
||||
|| UserEmploymentFlagEnum.ENTRY_AUDIT.getCode().equals(u.getEmploymentFlag())
|
||||
|| UserEmploymentFlagEnum.RESIGNATION_AUDIT.getCode().equals(u.getEmploymentFlag())){
|
||||
throw new BizException("该固定用户存在未离职信息,无法入职");
|
||||
}
|
||||
});
|
||||
Optional<UserDO> optionalUserDO = userList.stream().filter(u -> u.getCorpinfoId().equals(AuthContext.getTenantId())).findFirst();
|
||||
if(optionalUserDO.isPresent()){
|
||||
addFlag = false;
|
||||
userDOUpdate = optionalUserDO.get();
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
List<UserE> userEList = userCoConvertor.convertDOsToEs(userList);
|
||||
userE.checkXGfPhone(userEList);
|
||||
}
|
||||
}
|
||||
|
||||
boolean res = false;
|
||||
try {
|
||||
res = userGateway.addXgf(userE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
if(addFlag){
|
||||
try {
|
||||
res = userGateway.addXgf(userE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!res) {
|
||||
throw new BizException("保存失败");
|
||||
}
|
||||
}else{
|
||||
//修改
|
||||
userGateway.updateByPhone(userE);
|
||||
}
|
||||
|
||||
|
||||
//页面相关保存user_corp
|
||||
/**
|
||||
* 非流动人员用户只能在一个企业,
|
||||
|
|
|
|||
|
|
@ -350,9 +350,9 @@ public class UserE extends BaseE {
|
|||
boolean flag = userEList.stream().anyMatch(userE -> userE.getCorpinfoId().equals(AuthContext.getTenantId()));
|
||||
if (flag) {
|
||||
//需要修改,不是提示
|
||||
throw new BizException("当前手机号当前企业已存在");
|
||||
throw new BizException("当前手机号当前企业已存在,请联系管理员");
|
||||
}else{
|
||||
throw new BizException("当前手机号已在其他企业存在");
|
||||
throw new BizException("当前手机号已在其他企业存在,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -360,7 +360,9 @@ public class UserE extends BaseE {
|
|||
public void checkXGfPhone(List<UserE> userEList) {
|
||||
|
||||
if(UserFlowFlagEnum.FIXED.getCode().equals(this.getFlowFlag())){
|
||||
this.checkPhone(userEList);
|
||||
// this.checkPhone(userEList);
|
||||
|
||||
|
||||
}else{
|
||||
//判断在其他企业是否是固定人员
|
||||
List<UserE> userList = userEList.stream().filter(userE -> UserFlowFlagEnum.FIXED.getCode().equals(userE.getFlowFlag())).collect(Collectors.toList());
|
||||
|
|
|
|||
Loading…
Reference in New Issue