Commit c307cd9e by 谢海旭

202601月中版本 招聘管理:处理接口调整

1 parent abf4ef1e
......@@ -4,6 +4,7 @@ import cn.com.glsx.dj.staff.model.RecruitmentDemand;
import cn.com.glsx.dj.staff.model.RecruitmentDemandOperationLog;
import cn.com.glsx.dj.staff.model.RecruitmentOnboardingPlan;
import cn.com.glsx.dj.staff.model.RecruitmentResume;
import cn.com.glsx.dj.staff.model.RecruitmentTrialOnboarding;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -33,6 +34,9 @@ public class RecruitmentDemandDetailDTO extends RecruitmentDemand {
@ApiModelProperty(notes = "入职计划")
private List<RecruitmentOnboardingPlan> onboardingPlans;
@ApiModelProperty(notes = "试岗计划")
private List<RecruitmentTrialOnboarding> trialOnboardings;
@ApiModelProperty(notes = "操作记录")
private List<RecruitmentDemandOperationLog> logs;
......
package cn.com.glsx.dj.staff.dto.recruitment;
import cn.com.glsx.dj.staff.model.RecruitmentTrialOnboarding;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@ToString(callSuper = true)
@Data
public class RecruitmentTrialOnboardingDTO extends RecruitmentTrialOnboarding {
private static final long serialVersionUID = 1L;
}
......@@ -75,6 +75,8 @@ public class RecruitmentDemandService {
private RecruitmentResumeService recruitmentResumeService;
@Autowired
private RecruitmentOnboardingPlanService recruitmentOnboardingPlanService;
@Autowired
private RecruitmentTrialOnboardingService recruitmentTrialOnboardingService;
@Autowired
private RecruitmentOnboardingPlanMapper planMapper;
......@@ -557,13 +559,17 @@ public class RecruitmentDemandService {
public void recruitmentDemandProcess(RecruitmentDemandDetailDTO dto) {
List<RecruitmentResume> resumesAll = dto.getResumes();
List<RecruitmentOnboardingPlan> plansAll = dto.getOnboardingPlans();
if (CollectionUtils.isNotEmpty(resumesAll) && resumesAll.size() > 100 || CollectionUtils.isNotEmpty(plansAll) && plansAll.size() > 100) {
log.error("简历数量限定100以内、入职数量限定30以内");
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "简历数量限定100以内、入职数量限定30以内");
List<RecruitmentTrialOnboarding> trialsAll = dto.getTrialOnboardings();
if (CollectionUtils.isNotEmpty(resumesAll) && resumesAll.size() > 100
|| CollectionUtils.isNotEmpty(plansAll) && plansAll.size() > 30
|| CollectionUtils.isNotEmpty(trialsAll) && trialsAll.size() > 30) {
log.error("简历数量限定100以内、入职数量限定30以内、试岗人数限定30以内");
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "简历数量限定100以内、入职数量限定30以内、试岗人数限定30以内");
}
recruitmentResumeService.processResumes(dto);
recruitmentOnboardingPlanService.processPlans(dto);
recruitmentTrialOnboardingService.processTrials(dto);
RecruitmentDemandOperationLog log = new RecruitmentDemandOperationLog();
log.setDemandId(dto.getId());
......
......@@ -168,11 +168,6 @@ public class RecruitmentResumeService {
} else {
resumesEdit.add(resume);
}
if (Objects.nonNull(resume.getProcessResult())) {
resume.setProcessorName(dto.getUpdatedBy());
resume.setProcessTime(new Date());
}
}
// 处理已有的简历(部分删除或全部删除)
......@@ -191,6 +186,16 @@ public class RecruitmentResumeService {
if (CollectionUtils.isNotEmpty(resumesAdd)) {
for (RecruitmentResume resume : resumesAdd) {
if (Objects.nonNull(resume.getProcessResult())) {
resume.setProcessorName(dto.getUpdatedBy());
resume.setProcessTime(new Date());
}
if (Objects.nonNull(resume.getInterviewResult())) {
resume.setInterviewProcessorName(dto.getUpdatedBy());
resume.setInterviewProcessTime(new Date());
}
resume.setDemandId(demandId);
resume.setStatus(getStatus(resume));
resume.setMixResult(getMixResult(resume));
......@@ -212,6 +217,12 @@ public class RecruitmentResumeService {
List<RecruitmentResume> oldResumes = recruitmentResumeMapper.selectByExample(resumeExampleToUpdate);
Map<Integer, RecruitmentResume> oldResumeMap = oldResumes.stream().collect(Collectors.toMap(RecruitmentResume::getId, oldResume -> oldResume, (oldResume, newResume) -> newResume));
for (RecruitmentResume resume : resumesEdit) {
// 更新简历时入参的更新时间必传
if (resume.getUpdatedDate() == null) {
log.error("更新简历信息时“更新时间”字段必传,简历ID: {}", resume.getId());
throw new RpcServiceException(RpcErrorEnum.BUSINESS_ERROR, "更新简历信息时“更新时间”字段必传");
}
RecruitmentResume oldResume = oldResumeMap.get(resume.getId());
Byte oldProcessResult = oldResume.getProcessResult();
if (Objects.nonNull(oldProcessResult)) {
......@@ -239,6 +250,17 @@ public class RecruitmentResumeService {
if (Objects.isNull(mixResult)) {
resume.setMixResult(oldResume.getMixResult());
}
if (Objects.nonNull(resume.getProcessResult()) && Objects.isNull(oldResume.getProcessResult())) {
resume.setProcessorName(dto.getUpdatedBy());
resume.setProcessTime(new Date());
}
if (Objects.nonNull(resume.getInterviewResult()) && Objects.isNull(oldResume.getInterviewResult())) {
resume.setInterviewProcessorName(dto.getUpdatedBy());
resume.setInterviewProcessTime(new Date());
}
resume.setUpdatedBy(dto.getUpdatedBy());
resume.setUpdatedDate(new Date());
resume.setDemandId(oldResume.getDemandId());
......@@ -251,46 +273,21 @@ public class RecruitmentResumeService {
}
/**
* 是否有更新
* 是否有更新,通过比较updatedDate判断
*
* @param resume
* @param oldResume
* @return
*/
private boolean hasUpdate(RecruitmentResume resume, RecruitmentResume oldResume) {
String oldPersonName = oldResume.getPersonName();
String oldPhoneNumber = oldResume.getPhoneNumber();
String oldResumeUrl = oldResume.getResumeUrl();
Date oldInterviewTime = oldResume.getInterviewTime();
Byte oldInterviewResult = oldResume.getInterviewResult();
String oldDescription = oldResume.getDescription();
Byte oldProcessResult = oldResume.getProcessResult();
String oldChannelType = oldResume.getChannelType();
String oldRecommendedReason = oldResume.getRecommendedReason();
String personName = resume.getPersonName();
String phoneNumber = resume.getPhoneNumber();
String resumeUrl = resume.getResumeUrl();
Date interviewTime = resume.getInterviewTime();
Byte interviewResult = resume.getInterviewResult();
String description = resume.getDescription();
Byte processResult = resume.getProcessResult();
String channelType = resume.getChannelType();
String recommendedReason = resume.getRecommendedReason();
if (!Objects.equals(personName, oldPersonName)
|| !Objects.equals(phoneNumber, oldPhoneNumber)
|| !Objects.equals(resumeUrl, oldResumeUrl)
|| !Objects.equals(interviewTime, oldInterviewTime)
|| !Objects.equals(interviewResult, oldInterviewResult)
|| !Objects.equals(description, oldDescription)
|| !Objects.equals(processResult, oldProcessResult)
|| !Objects.equals(channelType, oldChannelType)
|| !Objects.equals(recommendedReason, oldRecommendedReason)
) {
return true;
} else {
Date requestUpdatedDate = resume.getUpdatedDate();
Date dbUpdatedDate = oldResume.getUpdatedDate();
// 如果入参更新时间与数据库中的更新时间不一致,则认为已被更新
if (dbUpdatedDate == null) {
return false;
}
return !Objects.equals(requestUpdatedDate, dbUpdatedDate);
}
}
package cn.com.glsx.dj.staff.service.recruitment;
import cn.com.glsx.dj.staff.dto.recruitment.RecruitmentDemandDetailDTO;
import cn.com.glsx.dj.staff.mapper.RecruitmentTrialOnboardingMapper;
import cn.com.glsx.dj.staff.model.RecruitmentTrialOnboarding;
import cn.com.glsx.framework.core.beans.BaseModel;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@Transactional(propagation = Propagation.SUPPORTS, rollbackFor = RpcServiceException.class)
public class RecruitmentTrialOnboardingService {
@Autowired
private RecruitmentTrialOnboardingMapper recruitmentTrialOnboardingMapper;
/**
* 处理试岗人员List
*
* @param dto
*/
@Transactional
public void processTrials(RecruitmentDemandDetailDTO dto) {
Integer demandId = dto.getId();
List<RecruitmentTrialOnboarding> trialsAll = dto.getTrialOnboardings();
if (CollectionUtils.isEmpty(trialsAll)) {
log.info("无试岗人员");
trialsAll = new ArrayList<>();
}
List<RecruitmentTrialOnboarding> trialsAdd = new ArrayList<>();
List<RecruitmentTrialOnboarding> trialsEdit = new ArrayList<>();
for (RecruitmentTrialOnboarding trial : trialsAll) {
if (trial.getId() == null) {
trialsAdd.add(trial);
} else {
trialsEdit.add(trial);
}
}
// 删除已有的试岗人员(部分删除或全部删除)
RecruitmentTrialOnboarding trialToDelete = new RecruitmentTrialOnboarding();
trialToDelete.setDeletedFlag(BaseModel.DeletedFlagEnum.D.name());
trialToDelete.setUpdatedBy(dto.getUpdatedBy());
trialToDelete.setUpdatedDate(new Date());
Example trialExampleToDel = new Example(RecruitmentTrialOnboarding.class);
Example.Criteria trialCriteriaToDel = trialExampleToDel.createCriteria();
trialCriteriaToDel.andEqualTo("demandId", demandId).andEqualTo("deletedFlag", BaseModel.DeletedFlagEnum.N.name());
if (CollectionUtils.isNotEmpty(trialsEdit)) {
trialCriteriaToDel.andNotIn("id", trialsEdit.stream().map(RecruitmentTrialOnboarding::getId).collect(Collectors.toList()));
}
recruitmentTrialOnboardingMapper.updateByExampleSelective(trialToDelete, trialExampleToDel);
if (CollectionUtils.isNotEmpty(trialsAdd)) {
for (RecruitmentTrialOnboarding trial : trialsAdd) {
trial.setDemandId(demandId);
trial.setCreatedBy(dto.getUpdatedBy());
trial.setCreatedDate(new Date());
trial.setUpdatedBy(dto.getUpdatedBy());
trial.setUpdatedDate(new Date());
recruitmentTrialOnboardingMapper.insertSelective(trial);
}
}
if (CollectionUtils.isNotEmpty(trialsEdit)) {
for (RecruitmentTrialOnboarding trial : trialsEdit) {
trial.setDemandId(null);
trial.setCreatedBy(null);
trial.setCreatedDate(null);
trial.setDeletedFlag(null);
trial.setUpdatedBy(dto.getUpdatedBy());
trial.setUpdatedDate(new Date());
recruitmentTrialOnboardingMapper.updateByPrimaryKeySelective(trial);
}
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!