app修改密码
parent
11f36b13b0
commit
5e378fb101
|
|
@ -40,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -89,6 +90,13 @@ public class UserAddExe {
|
||||||
UserE userE = new UserE();
|
UserE userE = new UserE();
|
||||||
BeanUtils.copyProperties(cmd, userE);
|
BeanUtils.copyProperties(cmd, userE);
|
||||||
userE.initAdd(tenantId, userE);
|
userE.initAdd(tenantId, userE);
|
||||||
|
userRepository.checkUserIdCard(userE.getPhone(), userE.getUserIdCard());
|
||||||
|
//校验身份证是否存在
|
||||||
|
List<UserDO> userDOList = userRepository.getByIdCard(userE.getUserIdCard(),null);
|
||||||
|
if(CollUtil.isNotEmpty(userDOList)){
|
||||||
|
List<UserE> userEList = userCoConvertor.convertDOsToEs(userDOList);
|
||||||
|
userE.checkIdCardExist(userEList);
|
||||||
|
}
|
||||||
//校验手机号
|
//校验手机号
|
||||||
// List<Integer> employmentFlagList = Arrays.asList(UserEmploymentFlagEnum.ON.getCode(), UserEmploymentFlagEnum.ENTRY_AUDIT.getCode(), UserEmploymentFlagEnum.RESIGNATION_AUDIT.getCode());
|
// List<Integer> employmentFlagList = Arrays.asList(UserEmploymentFlagEnum.ON.getCode(), UserEmploymentFlagEnum.ENTRY_AUDIT.getCode(), UserEmploymentFlagEnum.RESIGNATION_AUDIT.getCode());
|
||||||
List<UserDO> userList = userRepository.getListByPhone( userE.getPhone(),null);
|
List<UserDO> userList = userRepository.getListByPhone( userE.getPhone(),null);
|
||||||
|
|
@ -403,14 +411,21 @@ public class UserAddExe {
|
||||||
throw new BizException("未创建默认通用角色,请联系管理员");
|
throw new BizException("未创建默认通用角色,请联系管理员");
|
||||||
}
|
}
|
||||||
userE.setRoleId(roleId);
|
userE.setRoleId(roleId);
|
||||||
//校验手机号
|
|
||||||
List<Integer> employmentFlagList = Arrays.asList(UserEmploymentFlagEnum.ON.getCode(), UserEmploymentFlagEnum.ENTRY_AUDIT.getCode(), UserEmploymentFlagEnum.RESIGNATION_AUDIT.getCode());
|
List<Integer> employmentFlagList = Arrays.asList(UserEmploymentFlagEnum.ON.getCode(), UserEmploymentFlagEnum.ENTRY_AUDIT.getCode(), UserEmploymentFlagEnum.RESIGNATION_AUDIT.getCode());
|
||||||
List<UserDO> userList = userRepository.getListByPhone(userE.getPhone(),employmentFlagList);
|
|
||||||
|
//校验身份证是否存在
|
||||||
|
List<UserDO> userDOList = userRepository.getByIdCard(userE.getUserIdCard(),null);
|
||||||
|
if(CollUtil.isNotEmpty(userDOList)){
|
||||||
|
List<UserE> userEList = userCoConvertor.convertDOsToEs(userDOList);
|
||||||
|
userE.checkIdCardExist(userEList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//校验手机号
|
||||||
|
List<UserDO> userList = userRepository.getListByPhone(userE.getPhone(),null);
|
||||||
Boolean addFlag = true;
|
Boolean addFlag = true;
|
||||||
UserDO userDOUpdate = null;
|
UserDO userDOUpdate = null;
|
||||||
if(CollUtil.isNotEmpty(userList)){
|
if(CollUtil.isNotEmpty(userList)){
|
||||||
if(UserFlowFlagEnum.FIXED.getCode().equals(cmd.getFlowFlag())){
|
if(UserFlowFlagEnum.FIXED.getCode().equals(cmd.getFlowFlag())){
|
||||||
//如果在其他企业有入职,不允许新增,如果是本企业,允许新增
|
|
||||||
userList.forEach(u -> {
|
userList.forEach(u -> {
|
||||||
if (UserEmploymentFlagEnum.ON.getCode().equals(u.getEmploymentFlag())
|
if (UserEmploymentFlagEnum.ON.getCode().equals(u.getEmploymentFlag())
|
||||||
|| UserEmploymentFlagEnum.ENTRY_AUDIT.getCode().equals(u.getEmploymentFlag())
|
|| UserEmploymentFlagEnum.ENTRY_AUDIT.getCode().equals(u.getEmploymentFlag())
|
||||||
|
|
@ -423,11 +438,14 @@ public class UserAddExe {
|
||||||
addFlag = false;
|
addFlag = false;
|
||||||
userDOUpdate = optionalUserDO.get();
|
userDOUpdate = optionalUserDO.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
List<UserE> userEList = userCoConvertor.convertDOsToEs(userList);
|
List<UserE> userEList = userCoConvertor.convertDOsToEs(userList);
|
||||||
userE.checkXGfPhone(userEList);
|
userE.checkXGfPhone(userEList);
|
||||||
|
Optional<UserDO> optionalUserDO = userList.stream().filter(u -> u.getCorpinfoId().equals(AuthContext.getTenantId())).findFirst();
|
||||||
|
if(optionalUserDO.isPresent()){
|
||||||
|
addFlag = false;
|
||||||
|
userDOUpdate = optionalUserDO.get();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -442,11 +460,20 @@ public class UserAddExe {
|
||||||
throw new BizException("保存失败");
|
throw new BizException("保存失败");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
//修改
|
//修改所有手机号的信息
|
||||||
|
userE.resetPassword();
|
||||||
|
userE.setEmploymentFlag(null);
|
||||||
|
userE.setFlowFlag( null);
|
||||||
userGateway.updateByPhone(userE);
|
userGateway.updateByPhone(userE);
|
||||||
|
//修改.状态为在职
|
||||||
|
userE.setId(userDOUpdate.getId());
|
||||||
|
userE.setEmploymentFlag(UserEmploymentFlagEnum.ON.getCode());
|
||||||
|
userE.setFlowFlag( cmd.getFlowFlag());
|
||||||
|
userGateway.update(userE);
|
||||||
|
|
||||||
//调用底座重新入职
|
//调用底座重新入职
|
||||||
log.info("executeXgf,GBS获取用户信息{}",userE.getId());
|
log.info("executeXgf,GBS获取用户信息{}",userDOUpdate.getId());
|
||||||
SingleResponse<UserDetailCO> detail = userFacade.getDetail(userE.getId());
|
SingleResponse<UserDetailCO> detail = userFacade.getDetail(userDOUpdate.getId());
|
||||||
log.info("executeXgf,GBS获取用户信息返回: {}", JSONUtil.toJsonStr(detail));
|
log.info("executeXgf,GBS获取用户信息返回: {}", JSONUtil.toJsonStr(detail));
|
||||||
if(detail.isSuccess() && detail.getData() != null && !detail.getData().getJobStatusEnum()){
|
if(detail.isSuccess() && detail.getData() != null && !detail.getData().getJobStatusEnum()){
|
||||||
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,6 @@ public interface UserGateway {
|
||||||
Response updatePassword(UserE userE);
|
Response updatePassword(UserE userE);
|
||||||
|
|
||||||
boolean addXgf(UserE userE);
|
boolean addXgf(UserE userE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -377,5 +377,15 @@ public class UserE extends BaseE {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkIdCardExist(List<UserE> userEList) {
|
||||||
|
//判断this.getPhone()在userList中有不一样的,判定已存在
|
||||||
|
//过滤掉this.phone不在userList中的值
|
||||||
|
List<UserE> userList = userEList.stream().filter(userE -> !userE.getPhone().equals(this.getPhone())).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(userList)) {
|
||||||
|
throw new BizException("当前身份证号已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,12 @@ public class UserGatewayImpl implements UserGateway {
|
||||||
|
|
||||||
UpdateWrapper<UserDO> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<UserDO> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("phone", userE.getPhone());
|
updateWrapper.eq("phone", userE.getPhone());
|
||||||
|
|
||||||
userRepository.update(d, updateWrapper);
|
userRepository.update(d, updateWrapper);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateByIds(UserE userE, List<Long> ids) {
|
public Boolean updateByIds(UserE userE, List<Long> ids) {
|
||||||
UserDO d = new UserDO();
|
UserDO d = new UserDO();
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,12 @@ public interface UserRepository extends BaseRepository<UserDO> {
|
||||||
|
|
||||||
UserDO getByPhoneAndIdCard(String phone, String idCardNumber);
|
UserDO getByPhoneAndIdCard(String phone, String idCardNumber);
|
||||||
|
|
||||||
void checkUserIdCard(@NotNull(message = "主键id不能为空") Long id, String userIdCard);
|
void checkUserIdCard(@NotNull(message = "手机号不能为空") String phone, String userIdCard);
|
||||||
|
|
||||||
List<UserDO> getListByPhone(String phone,List<Integer> employmentFlagList);
|
List<UserDO> getListByPhone(String phone,List<Integer> employmentFlagList);
|
||||||
|
|
||||||
List<UserCorpInfoDO> getListByUserIds(List<Long> userIds);
|
List<UserCorpInfoDO> getListByUserIds(List<Long> userIds);
|
||||||
|
|
||||||
|
List<UserDO> getByIdCard(String userIdCard, List<Integer> employmentFlagList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,13 +208,14 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (!ObjectUtils.isEmpty(params.get("userIdCard"))) {
|
if (!ObjectUtils.isEmpty(params.get("userIdCard"))) {
|
||||||
Map<String, Object> verifyParam = new HashMap<>();
|
//放在提交的时候校验
|
||||||
|
/* Map<String, Object> verifyParam = new HashMap<>();
|
||||||
verifyParam.put("userIdCard", params.get("userIdCard"));
|
verifyParam.put("userIdCard", params.get("userIdCard"));
|
||||||
verifyParam.put("id", params.get("id"));
|
verifyParam.put("id", params.get("id"));
|
||||||
Integer count = userMapper.countUser(verifyParam);
|
Integer count = userMapper.countUser(verifyParam);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
return Response.buildFailure("身份证号已经存在,请联系管理员");
|
return Response.buildFailure("身份证号已经存在,请联系管理员");
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
return Response.buildSuccess();
|
return Response.buildSuccess();
|
||||||
|
|
@ -533,10 +534,10 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void checkUserIdCard(Long id, String userIdCard) {
|
public void checkUserIdCard(String phone, String userIdCard) {
|
||||||
Map<String, Object> verifyParam = new HashMap<>();
|
Map<String, Object> verifyParam = new HashMap<>();
|
||||||
verifyParam.put("userIdCard", userIdCard);
|
verifyParam.put("userIdCard", userIdCard);
|
||||||
verifyParam.put("id", id);
|
verifyParam.put("phone", phone);
|
||||||
Integer count = userMapper.countUser(verifyParam);
|
Integer count = userMapper.countUser(verifyParam);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
throw new BizException("身份证号已经存在,请联系管理员");
|
throw new BizException("身份证号已经存在,请联系管理员");
|
||||||
|
|
@ -554,6 +555,17 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
||||||
return list(queryWrapper);
|
return list(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserDO> getByIdCard(String userIdCard, List<Integer> employmentFlagList) {
|
||||||
|
QueryWrapper<UserDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
if (CollUtil.isNotEmpty(employmentFlagList)) {
|
||||||
|
queryWrapper.in("employment_flag", employmentFlagList);
|
||||||
|
}
|
||||||
|
queryWrapper.eq("user_id_card", userIdCard);
|
||||||
|
queryWrapper.orderByAsc("create_time");
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UserCorpInfoDO> getListByUserIds(List<Long> userIds) {
|
public List<UserCorpInfoDO> getListByUserIds(List<Long> userIds) {
|
||||||
return userMapper.getListByUserIds(userIds);
|
return userMapper.getListByUserIds(userIds);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue