feat: Add job nature field to job and related database migrations

This commit is contained in:
2026-07-16 10:58:57 +08:00
parent 1e7853b9a4
commit 3f1624da3a
10 changed files with 355 additions and 18 deletions

View File

@@ -120,6 +120,9 @@ public class ESJobDocument
@IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_SMART)
private String jobCategory;
@ApiModelProperty("岗位性质,对应业务字典 job_nature")
private String jobNature;
@JsonIgnore
@ApiModelProperty("学历要求 对应字典education int类型 es方便查询")
private Integer education_int;

View File

@@ -148,6 +148,10 @@ public class Job extends BaseEntity
@ApiModelProperty("岗位分类")
private String jobCategory;
@Excel(name = "岗位性质")
@ApiModelProperty("岗位性质,对应业务字典 job_nature")
private String jobNature;
@TableField(exist = false)
@ApiModelProperty("公司性质")
private String companyNature;

View File

@@ -242,6 +242,7 @@ public class BussinessDictTypeServiceImpl implements IBussinessDictTypeService
filed.put("data_source","数据来源");
filed.put("job_url","岗位url连接");
filed.put("job_category",jobTitleMapper.selectList(null).stream().map(JobTitle::getJobName).collect(Collectors.toList()));
filed.put("job_nature",this.selectDictDataByType("job_nature").stream().map(BussinessDictData::getDictLabel).collect(Collectors.toList()));
return filed;
}
}

View File

@@ -439,26 +439,13 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
{
LocalDateTime now = LocalDateTime.now();
String formattedDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
Job existingJob = jobMapper.selectById(job.getJobId());
//修改岗位状态
if(job.getIsPublish()!=null) {
if(job.getIsPublish()==1){
job.setPostingDate(formattedDate);
//修改es缓存
iesJobSearchService.updateJob(job.getJobId());
//添加岗位上新
Job parmJob=null;
if(job.getCompanyId()==null){
//传递job消息不完整
parmJob=jobMapper.getJobInfo(job.getJobId());
}
List<AppUser> users=companyCollectionMapper.selectAppuserList(parmJob.getCompanyId());
if(users!=null&&users.size()>0){
List<Notice> notices= NoticeUtils.createGwsxNotice(users,parmJob);
noticeMapper.batchInsert(notices);
}
}else {
job.setPostingDate(null);
iesJobSearchService.deleteJob(job.getJobId());
}
}
int i=jobMapper.updateById(job);
@@ -468,6 +455,25 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
handleJobContact(job);
//添加附件
handleJobFile(job);
// 数据库更新成功后再同步 ES确保岗位性质等最新字段能立即反映到 PC 岗位卡片。
if (Integer.valueOf(1).equals(job.getIsPublish())
|| (job.getIsPublish() == null && existingJob != null
&& Integer.valueOf(1).equals(existingJob.getIsPublish()))) {
iesJobSearchService.updateJob(job.getJobId());
// 添加岗位上新通知,始终使用数据库中的完整岗位信息。
Job publishedJob = jobMapper.getJobInfo(job.getJobId());
if (publishedJob != null && publishedJob.getCompanyId() != null) {
List<AppUser> users = companyCollectionMapper.selectAppuserList(publishedJob.getCompanyId());
if(users != null && !users.isEmpty()){
List<Notice> notices = NoticeUtils.createGwsxNotice(users, publishedJob);
noticeMapper.batchInsert(notices);
}
}
} else if (Integer.valueOf(0).equals(job.getIsPublish())) {
iesJobSearchService.deleteJob(job.getJobId());
}
}
return i;
}