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;
}

View File

@@ -31,6 +31,7 @@
<result property="jobUrl" column="job_url" />
<result property="rowId" column="row_id" />
<result property="jobCategory" column="job_category" />
<result property="jobNature" column="job_nature" />
<result property="isExplain" column="is_explain" />
<result property="explainUrl" column="explain_url" />
<result property="cover" column="cover" />
@@ -74,6 +75,7 @@
<result property="jobUrl" column="job_url" />
<result property="rowId" column="row_id" />
<result property="jobCategory" column="job_category" />
<result property="jobNature" column="job_nature" />
<result property="isExplain" column="is_explain" />
<result property="explainUrl" column="explain_url" />
<result property="cover" column="cover" />
@@ -112,7 +114,7 @@
</resultMap>
<sql id="selectJobVo">
select job_id, job_title, min_salary, max_salary, education, experience, company_name, job_location, posting_date, vacancies, del_flag, create_by, create_time, update_by, update_time, remark, latitude, longitude, "view", company_id , is_hot ,is_urgent,apply_num,is_publish, description,job_location_area_code,data_source,job_url,job_category,is_explain,explain_url,cover,job_type,job_address, review_status,is_key_populations,key_populations from job
select job_id, job_title, min_salary, max_salary, education, experience, company_name, job_location, posting_date, vacancies, del_flag, create_by, create_time, update_by, update_time, remark, latitude, longitude, "view", company_id , is_hot ,is_urgent,apply_num,is_publish, description,job_location_area_code,data_source,job_url,job_category,job_nature,is_explain,explain_url,cover,job_type,job_address, review_status,is_key_populations,key_populations from job
</sql>
<insert id="insertBatchRowWork">
INSERT INTO row_work (
@@ -142,7 +144,7 @@
job_title, min_salary, max_salary, education, experience, company_name, job_location,
job_location_area_code, posting_date, vacancies, latitude, longitude, "view", company_id,
is_hot, is_urgent, apply_num, description, is_publish, data_source, job_url, remark, del_flag,
create_by, create_time, row_id, job_category,job_type,job_address,job_status,is_key_populations,
create_by, create_time, row_id, job_category,job_nature,job_type,job_address,job_status,is_key_populations,
key_populations
) VALUES
<foreach collection="list" item="job" separator=",">
@@ -152,7 +154,7 @@
#{job.vacancies}, #{job.latitude}, #{job.longitude}, #{job.view}, #{job.companyId},
#{job.isHot}, #{job.isUrgent}, #{job.applyNum}, #{job.description}, #{job.isPublish}, #{job.dataSource},
#{job.jobUrl}, #{job.remark}, #{job.delFlag}, #{job.createBy}, #{job.createTime},
#{job.rowId}, #{job.jobCategory},#{job.jobType},#{job.jobAddress},#{job.jobStatus},#{job.isKeyPopulations},#{job.keyPopulations}
#{job.rowId}, #{job.jobCategory},#{job.jobNature},#{job.jobType},#{job.jobAddress},#{job.jobStatus},#{job.isKeyPopulations},#{job.keyPopulations}
)
</foreach>
</insert>

View File

@@ -167,7 +167,7 @@
<select id="selectJobListByJobFairIdAndCompanyId" resultType="com.ruoyi.cms.domain.Job">
select pfj.id as fair_relation_id, j.job_id, j.job_title, j.min_salary, j.max_salary, j.education, j.experience,
j.company_name, j.job_location, j.job_location_area_code, j.posting_date, j.vacancies,
j.company_id, j.description, j.job_category, j.job_address
j.company_id, j.description, j.job_category, j.job_nature, j.job_address
from public_job_fair_job pfj
inner join job j on pfj.job_id = j.job_id
where pfj.job_fair_id = #{jobFairId} and pfj.company_id = #{companyId} and pfj.del_flag = '0' and j.del_flag = '0'