This commit is contained in:
chenyanchang
2026-06-27 03:06:33 +08:00
9 changed files with 98 additions and 15 deletions

1
.gitignore vendored
View File

@@ -54,3 +54,4 @@ nbdist/
.local/
local.sh
.claude

View File

@@ -82,6 +82,9 @@ public class ESJobDocument
@ApiModelProperty("是否火")
private Integer isHot;
@ApiModelProperty("是否急聘")
private Integer isUrgent;
@ApiModelProperty("申请次数")
private Integer applyNum;

View File

@@ -103,6 +103,9 @@ public class Job extends BaseEntity
@ApiModelProperty("是否火")
private Integer isHot;
@ApiModelProperty("是否急聘 0否 1是")
private Integer isUrgent;
@ApiModelProperty("申请次数")
@JsonIgnore
private Integer applyNum;

View File

@@ -346,6 +346,13 @@ public class ESJobSearchImpl implements IESJobSearchService
if(!StringUtil.isEmptyOrNull(appUser.getSalaryMin())){
newSearch.setMinSalary(Long.valueOf(appUser.getSalaryMin()));
}
// 请求参数覆盖用户资料中的薪资偏好
if(Objects.nonNull(esJobSearch.getSalaryMin()) || Objects.nonNull(esJobSearch.getMinSalary())){
newSearch.setMinSalary(Objects.nonNull(esJobSearch.getSalaryMin()) ? esJobSearch.getSalaryMin() : esJobSearch.getMinSalary());
}
if(Objects.nonNull(esJobSearch.getSalaryMax()) || Objects.nonNull(esJobSearch.getMaxSalary())){
newSearch.setMaxSalary(Objects.nonNull(esJobSearch.getSalaryMax()) ? esJobSearch.getSalaryMax() : esJobSearch.getMaxSalary());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobType())){
newSearch.setJobType(esJobSearch.getJobType());
}
@@ -891,8 +898,16 @@ public class ESJobSearchImpl implements IESJobSearchService
ESJobSearch newSearch = new ESJobSearch();
BeanUtils.copyProperties(esJobSearch,newSearch);
//查询
if(appUser!=null){
// 判断是否为用户主动搜索(有明确的搜索条件),而非纯推荐场景
boolean isExplicitSearch = !StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())
|| !StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())
|| !StringUtil.isEmptyOrNull(esJobSearch.getCompanyName())
|| !StringUtil.isEmptyOrNull(esJobSearch.getDescription());
// 用户资料偏好仅在"纯推荐"场景下作为个性化过滤条件;
// 用户主动搜索时不应被资料中的薪资/学历/经验/区域等偏好缩小结果范围
if(appUser != null && !isExplicitSearch){
if(!ListUtil.isEmptyOrNull(appUser.getJobTitle())){
List<String> jobTitle = appUser.getJobTitle();
newSearch.setJobTitle(String.join(",", jobTitle));
@@ -906,9 +921,6 @@ public class ESJobSearchImpl implements IESJobSearchService
if(!StringUtil.isEmptyOrNull(appUser.getWorkExperience())){
newSearch.setExperience(appUser.getWorkExperience());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
newSearch.setExperience(esJobSearch.getExperience());
}
if(!StringUtil.isEmptyOrNull(appUser.getSalaryMax())){
newSearch.setMaxSalary(Long.valueOf(appUser.getSalaryMax()));
}
@@ -917,12 +929,22 @@ public class ESJobSearchImpl implements IESJobSearchService
}
}
// 请求参数始终优先于用户资料偏好
if(Objects.nonNull(esJobSearch.getSalaryMin()) || Objects.nonNull(esJobSearch.getMinSalary())){
newSearch.setMinSalary(Objects.nonNull(esJobSearch.getSalaryMin()) ? esJobSearch.getSalaryMin() : esJobSearch.getMinSalary());
}
if(Objects.nonNull(esJobSearch.getSalaryMax()) || Objects.nonNull(esJobSearch.getMaxSalary())){
newSearch.setMaxSalary(Objects.nonNull(esJobSearch.getSalaryMax()) ? esJobSearch.getSalaryMax() : esJobSearch.getMaxSalary());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getArea())){
newSearch.setArea(esJobSearch.getArea());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getEducation())){
newSearch.setEducation(esJobSearch.getEducation());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
newSearch.setExperience(esJobSearch.getExperience());
}
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobTitle())){
newSearch.setJobTitle(esJobSearch.getJobTitle());
}

View File

@@ -35,15 +35,20 @@ import org.dromara.easyes.core.biz.EsPageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.sql.DataSource;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Connection;
import java.sql.Statement;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -97,6 +102,34 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
@Autowired
private NoticeMapper noticeMapper;
@Autowired
private DataSource dataSource;
/**
* 应用启动后自动迁移:添加 is_urgent 列(幂等)
*/
@EventListener(ApplicationReadyEvent.class)
public void migrateIsUrgentColumn() {
try (Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement()) {
String checkSql = "SELECT COUNT(*) FROM information_schema.columns WHERE table_name='job' AND column_name='is_urgent'";
java.sql.ResultSet rs = stmt.executeQuery(checkSql);
boolean exists = false;
if (rs.next()) {
exists = rs.getInt(1) > 0;
}
rs.close();
if (!exists) {
stmt.execute("ALTER TABLE job ADD COLUMN is_urgent CHAR(1) DEFAULT '0'");
logger.info("急聘功能迁移: 成功添加 job.is_urgent 列");
} else {
logger.info("急聘功能迁移: job.is_urgent 列已存在,跳过");
}
} catch (Exception e) {
logger.error("急聘功能迁移失败: {}", e.getMessage());
}
}
/**
* 更新工作地址的经纬度信息
*/

View File

@@ -141,13 +141,24 @@
and latest_ii.job_id = a.job_id
and latest_ii.del_flag = '0'
where a.del_flag='0'
<if test="company != null and company.jobTitle != null and company.jobTitle != ''"> and b.job_title like concat('%', cast(#{company.jobTitle, jdbcType=VARCHAR} as varchar), '%')</if>
<if test="company != null and company.education != null and company.education != ''"> and b.education = #{company.education}</if>
<if test="company != null and company.experience != null and company.experience != ''"> and b.experience = #{company.experience}</if>
<if test="company != null and company.companyName != null and company.companyName != ''"> and b.company_name like concat('%', cast(#{company.companyName, jdbcType=VARCHAR} as varchar), '%')</if>
<if test="company != null and company.companyId != null "> and b.company_id = #{company.companyId}</if>
<if test="company != null and company.code != null "> and l.code =#{company.code}</if>
<if test="name != null and name != '' "> and b.job_title like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 求职者用户名搜索 -->
<if test="name != null and name != ''"> and e.name like concat('%', cast(#{name, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 手机号搜索 -->
<if test="phone != null and phone != ''"> and e.phone like concat('%', cast(#{phone, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 学历筛选 -->
<if test="education != null and education != ''"> and e.education = #{education}</if>
<!-- 性别筛选 -->
<if test="sex != null and sex != ''"> and e.sex = #{sex}</if>
<!-- 区域筛选 -->
<if test="area != null and area != ''"> and e.area = #{area}</if>
<!-- 政治面貌筛选 -->
<if test="politicalAffiliation != null and politicalAffiliation != ''"> and e.political_affiliation = #{politicalAffiliation}</if>
<!-- 身份证搜索 -->
<if test="idCard != null and idCard != ''"> and e.id_card like concat('%', cast(#{idCard, jdbcType=VARCHAR} as varchar), '%')</if>
<!-- 出生日期筛选 -->
<if test="birthDate != null and birthDate != ''"> and e.birth_date = #{birthDate}</if>
<!-- 职位名称搜索 -->
<if test="jobName != null and jobName != ''"> and b.job_title like concat('%', cast(#{jobName, jdbcType=VARCHAR} as varchar), '%')</if>
</select>
<select id="selectJobApplyListJob" parameterType="JobApply" resultType="com.ruoyi.cms.domain.Job">

View File

@@ -26,6 +26,7 @@
<result property="view" column="view" />
<result property="companyId" column="company_id" />
<result property="isHot" column="is_hot" />
<result property="isUrgent" column="is_urgent" />
<result property="dataSource" column="data_source" />
<result property="jobUrl" column="job_url" />
<result property="rowId" column="row_id" />
@@ -61,6 +62,7 @@
<result property="view" column="view" />
<result property="companyId" column="company_id" />
<result property="isHot" column="is_hot" />
<result property="isUrgent" column="is_urgent" />
<result property="applyNum" column="apply_num" />
<result property="dataSource" column="data_source" />
<result property="jobLocationAreaCode" column="job_location_area_code" />
@@ -99,7 +101,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 ,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 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,is_explain,explain_url,cover,job_type,job_address, review_status from job
</sql>
<insert id="insertBatchRowWork">
INSERT INTO row_work (
@@ -128,7 +130,7 @@
INSERT INTO job (
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, apply_num, description, is_publish, data_source, job_url, remark, del_flag,
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
) VALUES
<foreach collection="list" item="job" separator=",">
@@ -136,7 +138,7 @@
#{job.jobTitle}, #{job.minSalary}, #{job.maxSalary}, #{job.education}, #{job.experience},
#{job.companyName}, #{job.jobLocation}, #{job.jobLocationAreaCode}, #{job.postingDate},
#{job.vacancies}, #{job.latitude}, #{job.longitude}, #{job.view}, #{job.companyId},
#{job.isHot}, #{job.applyNum}, #{job.description}, #{job.isPublish}, #{job.dataSource},
#{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}
)

View File

@@ -104,6 +104,10 @@ public class AppUser extends BaseEntity
@ApiModelProperty("期望岗位列表")
private List<String> jobTitle;
@TableField(exist = false)
@ApiModelProperty("职位名称(搜索用)")
private String jobName;
@ApiModelProperty("身份证")
private String idCard;

View File

@@ -0,0 +1,4 @@
-- 急聘功能:给 job 表添加 is_urgent 字段
-- 0 = 非急聘默认1 = 急聘
ALTER TABLE "ks_db3"."job" ADD COLUMN "is_urgent" CHAR(1) DEFAULT '0';
COMMENT ON COLUMN "ks_db3"."job"."is_urgent" IS '是否急聘 0否 1是';