This commit is contained in:
577732344@qq.com
2025-09-24 12:57:39 +08:00
parent 6588d1115e
commit 3b42f1ac0f
3 changed files with 50 additions and 0 deletions

View File

@@ -63,4 +63,8 @@ public interface IESJobSearchService
ESJobDocument selectById(Long jobId); ESJobDocument selectById(Long jobId);
void fix(); void fix();
void updateJob(Long jobId);
void deleteJob(Long jobId);
} }

View File

@@ -497,4 +497,47 @@ public class ESJobSearchImpl implements IESJobSearchService
jobMapper.insert(job); jobMapper.insert(job);
} }
} }
@Override
public void deleteJob(Long jobId) {
LambdaEsQueryWrapper<ESJobDocument> lambdaEsQueryWrapper = new LambdaEsQueryWrapper();
lambdaEsQueryWrapper.eq(ESJobDocument::getJobId,jobId);
esJobDocumentMapper.delete(lambdaEsQueryWrapper);
}
@Override
public void updateJob(Long jobId) {
ESJobDocument esJobDocument = new ESJobDocument();
Job job = jobMapper.selectById(jobId);
BeanUtils.copyBeanProp(esJobDocument, job);
esJobDocument.setAppJobUrl("https://ks.zhaopinzao8dian.com/app#/packageA/pages/post/post?jobId="+ Base64.getEncoder().encodeToString(String.valueOf(job.getJobId()).getBytes()));
if(!StringUtil.isEmptyOrNull(job.getScale())){
esJobDocument.setScale(Integer.valueOf(job.getScale()));
}else {
esJobDocument.setScale(0);
}
if(!StringUtil.isEmptyOrNull(job.getExperience())){
esJobDocument.setExperience_int(Integer.valueOf(job.getExperience()));
}else {
esJobDocument.setExperience("0");
esJobDocument.setExperience_int(0);
}
if(!StringUtil.isEmptyOrNull(job.getEducation())){
esJobDocument.setEducation_int(Integer.valueOf(job.getEducation()));
}else {
esJobDocument.setEducation("-1");
esJobDocument.setEducation_int(-1);
}
if (esJobDocument.getLatitude() != null) {
esJobDocument.setLatAndLon(esJobDocument.getLatitude().toString() + "," + esJobDocument.getLongitude().toString());
}
if(StringUtil.isEmptyOrNull(job.getCompanyNature())){
esJobDocument.setCompanyNature("6");
}
LambdaEsQueryWrapper<ESJobDocument> lambdaEsQueryWrapper = new LambdaEsQueryWrapper();
lambdaEsQueryWrapper.eq(ESJobDocument::getJobId,job.getJobId());
esJobDocumentMapper.delete(lambdaEsQueryWrapper);
esJobDocumentMapper.insert(esJobDocument);
}
} }

View File

@@ -258,11 +258,14 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
//修改岗位状态 //修改岗位状态
//修改岗位状态
if(job.getIsPublish()!=null) { if(job.getIsPublish()!=null) {
if(job.getIsPublish()==1){ if(job.getIsPublish()==1){
job.setPostingDate(formattedDate); job.setPostingDate(formattedDate);
iesJobSearchService.updateJob(job.getJobId());
}else { }else {
job.setPostingDate(null); job.setPostingDate(null);
iesJobSearchService.deleteJob(job.getJobId());
} }
} }
return jobMapper.updateById(job); return jobMapper.updateById(job);