app修改密码
parent
11f36b13b0
commit
5e378fb101
|
|
@ -40,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -89,6 +90,13 @@ public class UserAddExe {
|
|||
UserE userE = new UserE();
|
||||
BeanUtils.copyProperties(cmd, 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<UserDO> userList = userRepository.getListByPhone( userE.getPhone(),null);
|
||||
|
|
@ -403,14 +411,21 @@ public class UserAddExe {
|
|||
throw new BizException("未创建默认通用角色,请联系管理员");
|
||||
}
|
||||
userE.setRoleId(roleId);
|
||||
//校验手机号
|
||||
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;
|
||||
UserDO userDOUpdate = null;
|
||||
if(CollUtil.isNotEmpty(userList)){
|
||||
if(UserFlowFlagEnum.FIXED.getCode().equals(cmd.getFlowFlag())){
|
||||
//如果在其他企业有入职,不允许新增,如果是本企业,允许新增
|
||||
userList.forEach(u -> {
|
||||
if (UserEmploymentFlagEnum.ON.getCode().equals(u.getEmploymentFlag())
|
||||
|| UserEmploymentFlagEnum.ENTRY_AUDIT.getCode().equals(u.getEmploymentFlag())
|
||||
|
|
@ -423,11 +438,14 @@ public class UserAddExe {
|
|||
addFlag = false;
|
||||
userDOUpdate = optionalUserDO.get();
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
List<UserE> userEList = userCoConvertor.convertDOsToEs(userList);
|
||||
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("保存失败");
|
||||
}
|
||||
}else{
|
||||
//修改
|
||||
//修改所有手机号的信息
|
||||
userE.resetPassword();
|
||||
userE.setEmploymentFlag(null);
|
||||
userE.setFlowFlag( null);
|
||||
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());
|
||||
SingleResponse<UserDetailCO> detail = userFacade.getDetail(userE.getId());
|
||||
log.info("executeXgf,GBS获取用户信息{}",userDOUpdate.getId());
|
||||
SingleResponse<UserDetailCO> detail = userFacade.getDetail(userDOUpdate.getId());
|
||||
log.info("executeXgf,GBS获取用户信息返回: {}", JSONUtil.toJsonStr(detail));
|
||||
if(detail.isSuccess() && detail.getData() != null && !detail.getData().getJobStatusEnum()){
|
||||
UserUpdateQuitCmd userUpdateQuitCmd = new UserUpdateQuitCmd();
|
||||
|
|
|
|||
|
|
@ -50,5 +50,6 @@ public interface UserGateway {
|
|||
Response updatePassword(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.eq("phone", userE.getPhone());
|
||||
|
||||
userRepository.update(d, updateWrapper);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean updateByIds(UserE userE, List<Long> ids) {
|
||||
UserDO d = new UserDO();
|
||||
|
|
|
|||
|
|
@ -81,10 +81,12 @@ public interface UserRepository extends BaseRepository<UserDO> {
|
|||
|
||||
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<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"))) {
|
||||
Map<String, Object> verifyParam = new HashMap<>();
|
||||
//放在提交的时候校验
|
||||
/* Map<String, Object> verifyParam = new HashMap<>();
|
||||
verifyParam.put("userIdCard", params.get("userIdCard"));
|
||||
verifyParam.put("id", params.get("id"));
|
||||
Integer count = userMapper.countUser(verifyParam);
|
||||
if (count > 0) {
|
||||
return Response.buildFailure("身份证号已经存在,请联系管理员");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return Response.buildSuccess();
|
||||
|
|
@ -533,10 +534,10 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public void checkUserIdCard(Long id, String userIdCard) {
|
||||
public void checkUserIdCard(String phone, String userIdCard) {
|
||||
Map<String, Object> verifyParam = new HashMap<>();
|
||||
verifyParam.put("userIdCard", userIdCard);
|
||||
verifyParam.put("id", id);
|
||||
verifyParam.put("phone", phone);
|
||||
Integer count = userMapper.countUser(verifyParam);
|
||||
if (count > 0) {
|
||||
throw new BizException("身份证号已经存在,请联系管理员");
|
||||
|
|
@ -554,6 +555,17 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
|
|||
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
|
||||
public List<UserCorpInfoDO> getListByUserIds(List<Long> userIds) {
|
||||
return userMapper.getListByUserIds(userIds);
|
||||
|
|
|
|||
Loading…
Reference in New Issue