离职入职相关

main
zhaokai 2025-12-05 11:24:56 +08:00
parent 7b841a1a5a
commit f48068496c
5 changed files with 15 additions and 10 deletions

View File

@ -32,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -137,7 +138,9 @@ public class UserAddExe {
BeanUtils.copyProperties(cmd, userE);
// 3-相关方
userE.setUserType(3);
if(UserFlowFlagEnum.FIXED.getCode().equals(cmd.getFlowFlag())){
userE.setEmploymentFlag(UserEmploymentFlagEnum.NOT_ON.getCode());
}
userGateway.update(userE);
return true;
@ -147,7 +150,8 @@ public class UserAddExe {
public boolean executeOnboarding(AppUserOnboardingCmd cmd) {
//// 如果是流动人员, 判断user_corp表是否有未离职的数据, 如果有则不能入职(1-离职)
List<UserCorpDO> userCorpDOS = userCorpRepository.listByUserIdAndCorpIdAndNoStatus(cmd.getId(), cmd.getCorpinfoId(), UserEmploymentFlagEnum.RESIGNATION.getCode());
List<Integer> statusList = Arrays.asList(UserEmploymentFlagEnum.RESIGNATION.getCode(), UserEmploymentFlagEnum.NOT_ON.getCode());
List<UserCorpDO> userCorpDOS = userCorpRepository.listByUserIdAndCorpIdAndNoStatus(cmd.getId(), cmd.getCorpinfoId(), statusList);
if(CollUtil.isNotEmpty(userCorpDOS)){
throw new BizException("该用户在当前企业存在未离职信息,无法入职");
}
@ -167,7 +171,7 @@ public class UserAddExe {
throw new BizException("用户不存在");
}
if(UserFlowFlagEnum.FLOW.getCode().equals(userDO.getFlowFlag())){
List<UserCorpDO> userCorpList = userCorpRepository.listByUserIdAndCorpIdAndStatus(cmd.getId(), cmd.getCorpinfoId(), UserEmploymentFlagEnum.RESIGNATION.getCode());
List<UserCorpDO> userCorpList = userCorpRepository.listByUserIdAndCorpIdAndStatus(cmd.getId(), cmd.getCorpinfoId(), statusList);
if(CollUtil.isNotEmpty(userCorpList)){
if(userCorpList.size() > 1){
throw new BizException("用户在当前企业存在多条离职数据,请联系管理员。");

View File

@ -103,6 +103,7 @@ public class UserQueryExe {
userCO.setRoleId(userCorpDO.getRoleId());
userCO.setSort(userCorpDO.getSort());
userCO.setCorpinfoId(userCorpDO.getCorpinfoId());
userCO.setEmploymentFlag(userCorpDO.getEmploymentFlag());
}
return SingleResponse.of(userCO);

View File

@ -21,9 +21,9 @@ public interface UserCorpRepository extends BaseRepository<UserCorpDO> {
UserCorpDO getUserCorpInfoByUserId(Long userId);
List<UserCorpDO> listByUserIdAndCorpIdAndNoStatus(Long userId, Long corpinfoId, Integer status);
List<UserCorpDO> listByUserIdAndCorpIdAndNoStatus(Long userId, Long corpinfoId, List<Integer> statusList);
List<UserCorpDO> listByUserIdAndCorpIdAndStatus(Long userId, Long corpinfoId, Integer status);
List<UserCorpDO> listByUserIdAndCorpIdAndStatus(Long userId, Long corpinfoId, List<Integer> statusList);
List<UserCorpDO> listByUserIdAndNoStatus(Long userId, Integer status);

View File

@ -54,20 +54,20 @@ public class UserCorpRepositoryImpl extends BaseRepositoryImpl<UserCorpMapper, U
}
@Override
public List<UserCorpDO> listByUserIdAndCorpIdAndNoStatus(Long userId, Long corpinfoId, Integer status) {
public List<UserCorpDO> listByUserIdAndCorpIdAndNoStatus(Long userId, Long corpinfoId, List<Integer> statusList) {
QueryWrapper<UserCorpDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
queryWrapper.eq("corpinfo_id", corpinfoId);
queryWrapper.ne("employment_flag", status);
queryWrapper.notIn("employment_flag", statusList);
return list(queryWrapper);
}
@Override
public List<UserCorpDO> listByUserIdAndCorpIdAndStatus(Long userId, Long corpinfoId, Integer status) {
public List<UserCorpDO> listByUserIdAndCorpIdAndStatus(Long userId, Long corpinfoId, List<Integer> statusList) {
QueryWrapper<UserCorpDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
queryWrapper.eq("corpinfo_id", corpinfoId);
queryWrapper.eq("employment_flag", status);
queryWrapper.in("employment_flag", statusList);
return list(queryWrapper);
}

View File

@ -240,7 +240,7 @@ public class UserRepositoryImpl extends BaseRepositoryImpl<UserMapper, UserDO> i
userDO.setSort(9999);
}
// 新增用户默认入职待审核
userDO.setEmploymentFlag(11);
// userDO.setEmploymentFlag(11);
// 默认不是主账号
userDO.setMainCorpFlag(0);
userDO.setUserId(UuidUtil.get32UUID());