From 83ac495842d37fc2f0ca98f97d70b65537ef965d Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Fri, 24 Jul 2026 13:43:39 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A1=8C=E4=B8=BA?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/HrUserBehaviorRecordController.java | 73 +++++++++++++++++++ .../cms/domain/msg/HrUserBehaviorRecord.java | 59 +++++++++++++++ .../msg/HrUserBehaviorRecordMapper.java | 11 +++ .../msg/HrUserBehaviorRecordService.java | 39 ++++++++++ .../impl/HrUserBehaviorRecordServiceImpl.java | 60 +++++++++++++++ .../mapper/msg/HrUserBehaviorRecordMapper.xml | 63 ++++++++++++++++ .../ruoyi/common/utils/SiteSecurityUtils.java | 11 +++ 7 files changed, 316 insertions(+) create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/msg/HrUserBehaviorRecord.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/msg/HrUserBehaviorRecordMapper.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/HrUserBehaviorRecordService.java create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/impl/HrUserBehaviorRecordServiceImpl.java create mode 100644 ruoyi-bussiness/src/main/resources/mapper/msg/HrUserBehaviorRecordMapper.xml diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java new file mode 100644 index 0000000..1b6fd42 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java @@ -0,0 +1,73 @@ +package com.ruoyi.cms.controller.app; + +import com.ruoyi.cms.domain.msg.HrUserBehaviorRecord; +import com.ruoyi.cms.service.msg.HrUserBehaviorRecordService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SiteSecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/app/behavior") +@Api(tags = "移动端:行为记录") +public class HrUserBehaviorRecordController extends BaseController { + + @Autowired + private HrUserBehaviorRecordService hrUserBehaviorRecordService; + + /** + * 查询行为记录列表 + */ + @GetMapping("/list") + @ApiOperation("查询行为记录列表") + public TableDataInfo list(HrUserBehaviorRecord hrUserBehaviorRecord) { + if (!SiteSecurityUtils.isLogin()) { + throw new ServiceException("用户未登录"); + } + Long userId = SiteSecurityUtils.getUserId(); + boolean admin = SiteSecurityUtils.isAdmin(userId); + if (!admin) { + hrUserBehaviorRecord.setActorId(userId); + } else { + hrUserBehaviorRecord.setActorId(null); + } + startPage(); + List list = hrUserBehaviorRecordService.selectBehaviorRecordList(hrUserBehaviorRecord); + return getDataTable(list); + } + + /** + * 上报浏览行为/投递行为 + */ + @ApiOperation("上报浏览行为/投递行为") + @PostMapping("/report") + public AjaxResult reportBehavior(@RequestBody HrUserBehaviorRecord record) { + HrUserBehaviorRecord exist = hrUserBehaviorRecordService.getExistViewRecord( + record.getActorType(), + record.getActorId(), + record.getTargetType(), + record.getTargetId() + ); + if (exist == null) { + record.setViewNum(1); + hrUserBehaviorRecordService.save(record); + } else { + if (record.getViewDuration() > 0) { + // 页面离开上报:累加时长 + exist.setViewDuration(exist.getViewDuration() + record.getViewDuration()); + } else { + // 页面进入上报:次数+1 + exist.setViewNum(exist.getViewNum() + 1); + } + hrUserBehaviorRecordService.updateById(exist); + } + return success(); + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/msg/HrUserBehaviorRecord.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/msg/HrUserBehaviorRecord.java new file mode 100644 index 0000000..878927e --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/msg/HrUserBehaviorRecord.java @@ -0,0 +1,59 @@ +package com.ruoyi.cms.domain.msg; + +import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("求职招聘双方行为记录表") +@TableName("hr_user_behavior_record") +public class HrUserBehaviorRecord extends BaseEntity { + + @TableField(exist = false) + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + /** 操作人类型:1求职者 2招聘方 */ + @ApiModelProperty("操作人类型:1求职者 2招聘方") + private Integer actorType; + + /** 操作人ID(求职者ID/企业用户ID) */ + @ApiModelProperty("操作人ID(求职者ID/企业用户ID) ") + private Long actorId; + + /** 浏览目标类型:1简历 2岗位 */ + @ApiModelProperty("浏览目标类型:1简历 2岗位") + private Integer targetType; + + /** 目标ID(简历ID/岗位ID) */ + @ApiModelProperty("目标ID(简历ID/岗位ID)") + private Long targetId; + + /** 行为类型:1阅览 2投递简历 */ + @ApiModelProperty("行为类型:1阅览 2投递简历") + private Integer behaviorType; + + /** 阅览时长(单位:秒) */ + @ApiModelProperty("阅览时长(单位:秒)") + private Integer viewDuration; + + /** 阅览次数,多次打开累加 */ + @ApiModelProperty("阅览次数,多次打开累加") + private Integer viewNum; + + /** 状态:1正常 */ + @ApiModelProperty("状态:1正常") + private Integer behaviorStatus; + + /**开始时间*/ + @TableField(exist = false) + private String beginTime; + + /**截至时间*/ + @TableField(exist = false) + private String endTime; +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/msg/HrUserBehaviorRecordMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/msg/HrUserBehaviorRecordMapper.java new file mode 100644 index 0000000..9ebf011 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/msg/HrUserBehaviorRecordMapper.java @@ -0,0 +1,11 @@ +package com.ruoyi.cms.mapper.msg; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.cms.domain.msg.HrUserBehaviorRecord; + +import java.util.List; + +public interface HrUserBehaviorRecordMapper extends BaseMapper { + + List selectBehaviorRecordList(HrUserBehaviorRecord hrUserBehaviorRecord); +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/HrUserBehaviorRecordService.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/HrUserBehaviorRecordService.java new file mode 100644 index 0000000..790c735 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/HrUserBehaviorRecordService.java @@ -0,0 +1,39 @@ +package com.ruoyi.cms.service.msg; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ruoyi.cms.domain.msg.HrUserBehaviorRecord; + +import java.util.List; + +public interface HrUserBehaviorRecordService extends IService { + + /** + * 查询行为记录列表 + */ + List selectBehaviorRecordList(HrUserBehaviorRecord queryVo); + + /** + * 新增行为记录 + */ + int insertBehaviorRecord(HrUserBehaviorRecord record); + + /** + * 修改行为记录 + */ + int updateBehaviorRecord(HrUserBehaviorRecord record); + + /** + * 批量删除 + */ + int deleteBehaviorRecordByIds(Long[] ids); + + /** + * 根据ID查询 + */ + HrUserBehaviorRecord selectBehaviorRecordById(Long id); + + /** + * 【业务埋点】查找同一主体同一目标当天浏览记录(用于累加次数、时长) + */ + HrUserBehaviorRecord getExistViewRecord(Integer actorType, Long actorId, Integer targetType, Long targetId); +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/impl/HrUserBehaviorRecordServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/impl/HrUserBehaviorRecordServiceImpl.java new file mode 100644 index 0000000..a1ad2a1 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/msg/impl/HrUserBehaviorRecordServiceImpl.java @@ -0,0 +1,60 @@ +package com.ruoyi.cms.service.msg.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.cms.domain.msg.HrUserBehaviorRecord; +import com.ruoyi.cms.mapper.msg.HrUserBehaviorRecordMapper; +import com.ruoyi.cms.service.msg.HrUserBehaviorRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.util.Arrays; +import java.util.List; + +@Service +public class HrUserBehaviorRecordServiceImpl extends ServiceImpl + implements HrUserBehaviorRecordService { + + @Autowired + private HrUserBehaviorRecordMapper hrUserBehaviorRecordMapper; + + @Override + public List selectBehaviorRecordList(HrUserBehaviorRecord hrUserBehaviorRecord) { + return hrUserBehaviorRecordMapper.selectBehaviorRecordList(hrUserBehaviorRecord); + } + + @Override + public int insertBehaviorRecord(HrUserBehaviorRecord record) { + return hrUserBehaviorRecordMapper.insert(record); + } + + @Override + public int updateBehaviorRecord(HrUserBehaviorRecord record) { + return hrUserBehaviorRecordMapper.updateById(record); + } + + @Override + public int deleteBehaviorRecordByIds(Long[] ids) { + return hrUserBehaviorRecordMapper.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public HrUserBehaviorRecord selectBehaviorRecordById(Long id) { + return hrUserBehaviorRecordMapper.selectById(id); + } + + @Override + public HrUserBehaviorRecord getExistViewRecord(Integer actorType, Long actorId, Integer targetType, Long targetId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(HrUserBehaviorRecord::getActorType, actorType); + wrapper.eq(HrUserBehaviorRecord::getActorId, actorId); + wrapper.eq(HrUserBehaviorRecord::getTargetType, targetType); + wrapper.eq(HrUserBehaviorRecord::getTargetId, targetId); + LocalDate today = LocalDate.now(); + wrapper.ge(HrUserBehaviorRecord::getCreateTime, today.atStartOfDay()); + wrapper.le(HrUserBehaviorRecord::getCreateTime, today.atTime(23,59,59)); + wrapper.last("limit 1"); + return baseMapper.selectOne(wrapper); + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/msg/HrUserBehaviorRecordMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/msg/HrUserBehaviorRecordMapper.xml new file mode 100644 index 0000000..4fbf208 --- /dev/null +++ b/ruoyi-bussiness/src/main/resources/mapper/msg/HrUserBehaviorRecordMapper.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + SELECT id, actor_type, actor_id, target_type, target_id, behavior_type, + view_duration, view_times, behavior_status, del_flag, + create_by, create_time, update_by, update_time, remark + FROM hr_user_behavior_record + + + + + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SiteSecurityUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SiteSecurityUtils.java index 0630df5..727f387 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SiteSecurityUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SiteSecurityUtils.java @@ -150,4 +150,15 @@ public class SiteSecurityUtils throw new ServiceException("获取用户ID异常", HttpStatus.UNAUTHORIZED); } } + + /** + * 是否为管理员 + * + * @param userId 用户ID + * @return 结果 + */ + public static boolean isAdmin(Long userId) + { + return userId != null && 1L == userId; + } } From 7ce8ea524decfb8f1c93492b41177d9e0c8e4898 Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Fri, 24 Jul 2026 16:29:42 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E8=81=94=E7=B3=BB=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/service/impl/CompanyServiceImpl.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java index 9e0393a..2aef2e6 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/CompanyServiceImpl.java @@ -166,20 +166,17 @@ public class CompanyServiceImpl extends ServiceImpl impl } int i=companyMapper.updateById(company); if(i>0){ - companyContactMapper.update(null,Wrappers.lambdaUpdate() - .eq(CompanyContact::getCompanyId, company.getCompanyId()) - .set(CompanyContact::getDelFlag, Constants.Del_FLAG_DELETE)); - List contactList = company.getCompanyContactList(); - if (!Objects.isNull(contactList)) { - for (CompanyContact x : contactList) { - if (x.getId() != null) { - companyContactMapper.updateById(x); - } else { - x.setCompanyId(company.getCompanyId()); - companyContactMapper.insert(x); + List contactList = company.getCompanyContactList(); + if (!Objects.isNull(contactList)) { + for (CompanyContact x : contactList) { + if (x.getId() != null) { + companyContactMapper.updateById(x); + } else { + x.setCompanyId(company.getCompanyId()); + companyContactMapper.insert(x); + } } } - } if (companyNatureChanged) { List jobIds = jobMapper.selectList(Wrappers.lambdaQuery() .eq(Job::getCompanyId, company.getCompanyId())) From d65f8d0d5c74e61af8f890a9e1870df71c47fd1d Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Fri, 24 Jul 2026 17:28:06 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=B2=97=E4=BD=8D=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=B2=97=E4=BD=8D=E7=89=B9=E5=BE=81=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/cms/domain/ESJobDocument.java | 3 +++ .../src/main/java/com/ruoyi/cms/domain/Job.java | 3 +++ .../src/main/resources/mapper/app/JobMapper.xml | 7 +++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ESJobDocument.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ESJobDocument.java index 62003a9..6e1c0bc 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ESJobDocument.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/ESJobDocument.java @@ -173,4 +173,7 @@ public class ESJobDocument @ApiModelProperty("重点人群-1农民工、2团场职工、3失业人员、4零就业家庭、5零工人员、6退役军人") private String keyPopulations; + + @ApiModelProperty("岗位特征:(行政、后勤、管理、技术、销售等字典job_feature添加)") + private String jobFeature; } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/Job.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/Job.java index 61aa3ab..a8b2fd3 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/Job.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/Job.java @@ -254,6 +254,9 @@ public class Job extends BaseEntity @ApiModelProperty("状态 0上架,1下架") private String jobStatus; + @ApiModelProperty("岗位特征:(行政、后勤、管理、技术、销售等字典job_feature添加)") + private String jobFeature; + @TableField(exist = false) @ApiModelProperty("户外招聘会岗位审核状态") private String fairReviewStatus; diff --git a/ruoyi-bussiness/src/main/resources/mapper/app/JobMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/app/JobMapper.xml index a396ce3..f793cd7 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/app/JobMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/app/JobMapper.xml @@ -45,6 +45,7 @@ + @@ -94,6 +95,7 @@ + @@ -155,7 +157,7 @@ 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, - key_populations + key_populations,job_feature ) VALUES ( @@ -164,7 +166,8 @@ #{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.jobType},#{job.jobAddress},#{job.jobStatus},#{job.isKeyPopulations}, + #{job.keyPopulations},#{job.jobFeature} ) From 49d138b6c44b3228356f5670205b507bc62fc4b7 Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Fri, 24 Jul 2026 18:03:39 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8F=E8=A7=88?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=9A=84=E8=AE=B0=E5=BD=95=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=92=8C=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/HrUserBehaviorRecordController.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java index 1b6fd42..daefd3f 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/HrUserBehaviorRecordController.java @@ -59,13 +59,8 @@ public class HrUserBehaviorRecordController extends BaseController { record.setViewNum(1); hrUserBehaviorRecordService.save(record); } else { - if (record.getViewDuration() > 0) { - // 页面离开上报:累加时长 - exist.setViewDuration(exist.getViewDuration() + record.getViewDuration()); - } else { - // 页面进入上报:次数+1 - exist.setViewNum(exist.getViewNum() + 1); - } + exist.setViewNum(exist.getViewNum() + 1); + exist.setViewDuration(exist.getViewDuration() + record.getViewDuration()); hrUserBehaviorRecordService.updateById(exist); } return success(); From ee04c6d8e2fe059962c13d8971050f1c9c559377 Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Fri, 24 Jul 2026 18:46:32 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E6=B5=8F=E8=A7=88=E6=B1=82=E8=81=8C=E8=80=85?= =?UTF-8?q?=E7=AE=80=E5=8E=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CmsHrUserBehaviorRecordController.java | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java new file mode 100644 index 0000000..097ce26 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java @@ -0,0 +1,74 @@ +package com.ruoyi.cms.controller.cms; + +import com.ruoyi.cms.domain.msg.HrUserBehaviorRecord; +import com.ruoyi.cms.service.msg.HrUserBehaviorRecordService; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.SiteSecurityUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/cms/behavior") +@Api(tags = "后台:行为记录") +public class CmsHrUserBehaviorRecordController extends BaseController { + + @Autowired + private HrUserBehaviorRecordService hrUserBehaviorRecordService; + + /** + * 查询行为记录列表 + */ + @GetMapping("/list") + @PreAuthorize("@ss.hasPermi('cms:behavior:list')") + @ApiOperation("查询行为记录列表") + public TableDataInfo list(HrUserBehaviorRecord hrUserBehaviorRecord) { + if (!SiteSecurityUtils.isLogin()) { + throw new ServiceException("用户未登录"); + } + Long userId = SiteSecurityUtils.getUserId(); + boolean admin = SiteSecurityUtils.isAdmin(userId); + if (!admin) { + hrUserBehaviorRecord.setActorId(userId); + } else { + hrUserBehaviorRecord.setActorId(null); + } + startPage(); + List list = hrUserBehaviorRecordService.selectBehaviorRecordList(hrUserBehaviorRecord); + return getDataTable(list); + } + + /** + * 上报浏览行为/投递行为 + */ + @ApiOperation("上报浏览行为/投递行为") + @PreAuthorize("@ss.hasPermi('cms:behavior:report')") + @Log(title = "用户培训经历", businessType = BusinessType.INSERT) + @PostMapping("/report") + public AjaxResult reportBehavior(@RequestBody HrUserBehaviorRecord record) { + HrUserBehaviorRecord exist = hrUserBehaviorRecordService.getExistViewRecord( + record.getActorType(), + record.getActorId(), + record.getTargetType(), + record.getTargetId() + ); + if (exist == null) { + record.setViewNum(1); + hrUserBehaviorRecordService.save(record); + } else { + exist.setViewNum(exist.getViewNum() + 1); + exist.setViewDuration(exist.getViewDuration() + record.getViewDuration()); + hrUserBehaviorRecordService.updateById(exist); + } + return success(); + } +} \ No newline at end of file From 69ddabd0418320196de93a2b1870bb91d3deffeb Mon Sep 17 00:00:00 2001 From: francis-fh Date: Fri, 24 Jul 2026 19:27:49 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=A2=9E=E5=8A=A0=E5=9F=B9=E8=AE=AD=E7=BB=8F?= =?UTF-8?q?=E5=8E=86=E3=80=81=E6=95=99=E8=82=B2=E7=BB=8F=E5=8E=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/cms/service/impl/AppUserServiceImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AppUserServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AppUserServiceImpl.java index c074148..6b31961 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AppUserServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/AppUserServiceImpl.java @@ -598,6 +598,14 @@ public class AppUserServiceImpl extends ServiceImpl imple List skillList=appSkillMapper.getList(parmsk); appUser.setAppSkillsList(skillList); + //查询教育经历 + List educationsList=appUserEducationMapper.selectEducationListByUserId(appUser.getUserId()); + appUser.setEducationsList(educationsList); + + //查询培训经历 + List trainsList=appUserTrainMapper.selectTrainListByUserId(appUser.getUserId()); + appUser.setTrainsList(trainsList); + //查询附件 File fileParm=new File(); fileParm.setBussinessid(appUser.getUserId()); From c8fc1c8f9e3141458fb7b7cb341f0071de20decd Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Fri, 24 Jul 2026 20:27:21 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9pc=E7=AB=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=B5=8F=E8=A7=88=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms/controller/cms/CmsHrUserBehaviorRecordController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java index 097ce26..abedcbc 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsHrUserBehaviorRecordController.java @@ -51,8 +51,8 @@ public class CmsHrUserBehaviorRecordController extends BaseController { * 上报浏览行为/投递行为 */ @ApiOperation("上报浏览行为/投递行为") - @PreAuthorize("@ss.hasPermi('cms:behavior:report')") - @Log(title = "用户培训经历", businessType = BusinessType.INSERT) + //@PreAuthorize("@ss.hasPermi('cms:behavior:report')") + @Log(title = "浏览行为", businessType = BusinessType.INSERT) @PostMapping("/report") public AjaxResult reportBehavior(@RequestBody HrUserBehaviorRecord record) { HrUserBehaviorRecord exist = hrUserBehaviorRecordService.getExistViewRecord( From 5e9c776abdbcf555b2ceb6cee0414377e091d157 Mon Sep 17 00:00:00 2001 From: chenshaohua <635616957@qq.com> Date: Sat, 25 Jul 2026 18:44:20 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A8=E8=8D=90?= =?UTF-8?q?=E5=B2=97=E4=BD=8D=E5=AE=8C=E6=88=90=E4=B8=80=E4=B8=8B=E5=87=A0?= =?UTF-8?q?=E7=82=B9=EF=BC=9A=201.=E6=A0=B9=E6=8D=AE=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=BB=8F=E9=AA=8C=E6=8E=A8=E8=8D=90=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?=E5=B2=97=E4=BD=8D4.0=E5=88=86=202.=E6=A0=B9=E6=8D=AE=E6=8A=95?= =?UTF-8?q?=E9=80=92=E8=AE=B0=E5=BD=95=E6=8E=A8=E8=8D=90=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E7=9A=84=E5=B2=97=E4=BD=8D3.0=E5=88=86=203.=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E6=94=B6=E8=97=8F=E8=AE=B0=E5=BD=95=E6=8E=A8=E8=8D=90=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=B2=97=E4=BD=8D2.0=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/cms/domain/query/ESJobSearch.java | 11 +- .../com/ruoyi/cms/mapper/JobApplyMapper.java | 2 + .../ruoyi/cms/mapper/JobCollectionMapper.java | 3 + .../cms/service/impl/ESJobSearchImpl.java | 78 ++++++-- .../cms/util/remommend/JobRecommendUtil.java | 177 ++++++++++++++++++ .../resources/mapper/app/JobApplyMapper.xml | 6 + .../mapper/app/JobCollectionMapper.xml | 7 + 7 files changed, 270 insertions(+), 14 deletions(-) create mode 100644 ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/remommend/JobRecommendUtil.java diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/query/ESJobSearch.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/query/ESJobSearch.java index e8c162c..8c671c8 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/query/ESJobSearch.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/domain/query/ESJobSearch.java @@ -1,7 +1,7 @@ package com.ruoyi.cms.domain.query; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.cms.domain.Job; +import com.ruoyi.common.core.domain.entity.UserWorkExperiences; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -63,4 +63,13 @@ public class ESJobSearch extends Job //结束时间 private Date endDate; + + /**岗位收藏集合*/ + private List collectNames; + + /**岗位申请集合*/ + private List applyNames; + + /**工作经历*/ + private List userWorkExperiences; } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobApplyMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobApplyMapper.java index 6927d6d..25182ea 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobApplyMapper.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobApplyMapper.java @@ -42,4 +42,6 @@ public interface JobApplyMapper extends BaseMapper int updateJobZphApply(JobApply jobApply); JobApply selectByJobIdAndUserId(@Param("jobId") Long jobId, @Param("userId") Long userId); + + List queryApplyNames(@Param("userId") Long userId); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobCollectionMapper.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobCollectionMapper.java index b8184aa..0672ae6 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobCollectionMapper.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/mapper/JobCollectionMapper.java @@ -5,6 +5,7 @@ import java.util.List; import com.ruoyi.cms.domain.Job; import com.ruoyi.cms.domain.JobCollection; +import org.apache.ibatis.annotations.Param; /** * 用户岗位收藏Mapper接口 @@ -24,4 +25,6 @@ public interface JobCollectionMapper extends BaseMapper List collectionJob(Long userId); public List selectJobCollectionListJob(JobCollection jobCollection); + + List queryCollectNames(@Param("userId") Long userId); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java index 77b992b..037ca8c 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/ESJobSearchImpl.java @@ -2,21 +2,20 @@ package com.ruoyi.cms.service.impl; import com.alibaba.fastjson.JSON; import com.ruoyi.cms.domain.vo.CompanyVo; -import com.ruoyi.cms.mapper.AppUserBlockCompanyMapper; -import com.ruoyi.cms.mapper.CompanyMapper; +import com.ruoyi.cms.mapper.*; import com.ruoyi.cms.service.ICompanyService; +import com.ruoyi.cms.util.remommend.JobRecommendUtil; import com.ruoyi.common.core.domain.entity.AppUser; import com.ruoyi.cms.domain.ESJobDocument; import com.ruoyi.cms.domain.Job; import com.ruoyi.cms.domain.query.ESJobSearch; import com.ruoyi.cms.mapper.es.EsJobDocumentMapper; -import com.ruoyi.cms.mapper.JobMapper; -import com.ruoyi.cms.mapper.JobTitleMapper; import com.ruoyi.cms.service.IESJobSearchService; import com.ruoyi.common.core.domain.entity.JobTitle; import com.ruoyi.cms.util.ListUtil; import com.ruoyi.cms.util.StringUtil; import com.ruoyi.common.core.domain.entity.Company; +import com.ruoyi.common.core.domain.entity.UserWorkExperiences; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.DateUtils; @@ -62,6 +61,12 @@ public class ESJobSearchImpl implements IESJobSearchService private RedisCache redisCache; @Autowired private AppUserBlockCompanyMapper appUserBlockCompanyMapper; + @Autowired + private JobApplyMapper jobApplyMapper; + @Autowired + private JobCollectionMapper jobCollectionMapper; + @Autowired + private UserWorkExperiencesMapper userWorkExperiencesMapper; // 锁的key(唯一标识ES索引初始化) private static final String ES_INIT_LOCK_KEY = "es:job_document:init:lock"; @@ -245,15 +250,12 @@ public class ESJobSearchImpl implements IESJobSearchService //查询 if(SiteSecurityUtils.isLogin()){ AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId()); - List jobs=appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId()); - if (jobs != null) { - jobIds.addAll(jobs.stream().distinct().collect(Collectors.toList())); - } if (!StringUtil.isEmptyOrNull(esJobSearch.getCode())) { newSearch.setCode(esJobSearch.getCode()); } + //求职者 if (!isCompanyUser) { - setJobSeekerParams(appUser, esJobSearch, newSearch); + setJobSeekerParams(appUser, esJobSearch, newSearch,jobIds); } } @@ -327,7 +329,7 @@ public class ESJobSearchImpl implements IESJobSearchService * @param esJobSearch * @param newSearch */ - private void setJobSeekerParams(AppUser appUser, ESJobSearch esJobSearch, ESJobSearch newSearch) { + private void setJobSeekerParams(AppUser appUser, ESJobSearch esJobSearch, ESJobSearch newSearch,List jobIds) { if(!ListUtil.isEmptyOrNull(appUser.getJobTitle())){ List jobTitle = appUser.getJobTitle(); newSearch.setJobTitle(String.join(",", jobTitle)); @@ -348,9 +350,10 @@ public class ESJobSearchImpl implements IESJobSearchService if(!StringUtil.isEmptyOrNull(esJobSearch.getArea())){ newSearch.setArea(esJobSearch.getArea()); } - if(!StringUtil.isEmptyOrNull(appUser.getWorkExperience())){ - newSearch.setExperience(appUser.getWorkExperience()); - } + //影响后面按照经验打分,先注释 +// if(!StringUtil.isEmptyOrNull(appUser.getWorkExperience())){ +// newSearch.setExperience(appUser.getWorkExperience()); +// } if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){ newSearch.setExperience(esJobSearch.getExperience()); } @@ -379,6 +382,22 @@ public class ESJobSearchImpl implements IESJobSearchService if(!StringUtil.isEmptyOrNull(esJobSearch.getCompanyNature())){ newSearch.setCompanyNature(esJobSearch.getCompanyNature()); } + //屏蔽企业集合 + List jobs=appUserBlockCompanyMapper.selectBlockCompanyIdsByUserIdJobs(appUser.getUserId()); + if (jobs != null) { + jobIds.addAll(jobs.stream().distinct().collect(Collectors.toList())); + } + //查询投递集合 + List applyNames=jobApplyMapper.queryApplyNames(appUser.getUserId()); + newSearch.setApplyNames(applyNames); + //查询收藏集合 + List collectNames=jobCollectionMapper.queryCollectNames(appUser.getUserId()); + newSearch.setCollectNames(collectNames); + //工作经历集合 + UserWorkExperiences expQuery = new UserWorkExperiences(); + expQuery.setUserId(appUser.getUserId()); + List userWorkExperiences=userWorkExperiencesMapper.getWorkExperiencesList(expQuery); + newSearch.setUserWorkExperiences(userWorkExperiences); } /** @@ -644,6 +663,13 @@ public class ESJobSearchImpl implements IESJobSearchService if(!StringUtil.isEmptyOrNull(esJobSearch.getCompanyName())){ wrapper.and(x->x.like(ESJobDocument::getCompanyName,esJobSearch.getCompanyName())); } + // 1.简历工作经历(最高权重) + JobRecommendUtil.appendWorkExpMatch(wrapper, esJobSearch.getUserWorkExperiences()); + //投递记录 + JobRecommendUtil.appendJobTitleMatch(wrapper, esJobSearch.getApplyNames(), JobRecommendUtil.APPLY_TITLE_BOOST); + //收藏记录 + JobRecommendUtil.appendJobTitleMatch(wrapper, esJobSearch.getCollectNames(), JobRecommendUtil.COLLECT_TITLE_BOOST); + //按时间段来查询数据 Date startDate = esJobSearch.getStartDate(); Date endDate = esJobSearch.getEndDate(); @@ -1030,6 +1056,17 @@ public class ESJobSearchImpl implements IESJobSearchService if(!StringUtil.isEmptyOrNull(appUser.getSalaryMin())){ newSearch.setMinSalary(Long.valueOf(appUser.getSalaryMin())); } + //查询投递集合 + List applyNames=jobApplyMapper.queryApplyNames(appUser.getUserId()); + newSearch.setApplyNames(applyNames); + //查询收藏集合 + List collectNames=jobCollectionMapper.queryCollectNames(appUser.getUserId()); + newSearch.setCollectNames(collectNames); + //工作经历集合 + UserWorkExperiences expQuery = new UserWorkExperiences(); + expQuery.setUserId(appUser.getUserId()); + List userWorkExperiences=userWorkExperiencesMapper.getWorkExperiencesList(expQuery); + newSearch.setUserWorkExperiences(userWorkExperiences); } // 请求参数始终优先于用户资料偏好 @@ -1263,4 +1300,19 @@ public class ESJobSearchImpl implements IESJobSearchService return -1; } } + + /** + * 岗位名称推荐 + * @param wrapper + * @param nameList + * @param boost + */ + /*private void appendJobTitleMatch(LambdaEsQueryWrapper wrapper, List nameList, Float boost) { + if (CollUtil.isEmpty(nameList)) { + return; + } + for (String title : nameList) { + wrapper.should(w -> w.match(ESJobDocument::getJobTitle, title, boost)); + } + }*/ } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/remommend/JobRecommendUtil.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/remommend/JobRecommendUtil.java new file mode 100644 index 0000000..60916a7 --- /dev/null +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/util/remommend/JobRecommendUtil.java @@ -0,0 +1,177 @@ +package com.ruoyi.cms.util.remommend; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.ruoyi.cms.domain.ESJobDocument; +import com.ruoyi.common.core.domain.entity.UserWorkExperiences; +import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper; + +import java.time.LocalDate; +import java.time.Period; +import java.util.*; + +/** + * 岗位推荐查询条件工具类 + * 权重规则: + * 简历岗位名称(4/6/7) > 投递名称(3) > 收藏名称(2) + * 经验区间字典: + * 0=经验不限,1=实习生,2=应届毕业生,3=1年以下,4=1-3年,5=3-5年,6=5-10年,7=10年以上 + */ +public class JobRecommendUtil { + + // =====================权重常量,集中调参===================== + /** 工作经历岗位名称:任职不足1年 */ + public static final Float POS_BOOST_SHORT = 4F; + /** 工作经历岗位名称:1~3年 */ + public static final Float POS_BOOST_MID = 6F; + /** 工作经历岗位名称:>=3年 */ + public static final Float POS_BOOST_LONG = 7F; + + /** 投递岗位名称权重 */ + public static final Float APPLY_TITLE_BOOST = 3F; + /** 收藏岗位名称权重 */ + public static final Float COLLECT_TITLE_BOOST = 2F; + + /** 经验区间匹配权重 */ + public static final Float EXP_MATCH_SELF = 3F; + public static final Float EXP_MATCH_LOW1 = 2F; + public static final Float EXP_MATCH_LOWER = 1F; + + // =====================基础计算方法===================== + + /** + * 计算单条工作经历时长(月) + * @param startDateStr 开始年月 yyyy-MM + * @param endDateStr 结束年月 yyyy-MM;null代表至今在职 + */ + public static int calcWorkMonth(String startDateStr, String endDateStr) { + if (StrUtil.isBlank(startDateStr)) { + return 0; + } + LocalDate start = LocalDate.parse(startDateStr + "-01"); + LocalDate end; + if (StrUtil.isBlank(endDateStr)) { + end = LocalDate.now(); + } else { + end = LocalDate.parse(endDateStr + "-01"); + } + Period period = Period.between(start, end); + return period.getYears() * 12 + period.getMonths(); + } + + /** + * 计算全部工作经历总月数(简单累加,不处理时间重叠) + */ + public static int calcTotalWorkMonth(List expList) { + if (CollUtil.isEmpty(expList)) { + return 0; + } + return expList.stream() + .mapToInt(exp -> calcWorkMonth(exp.getStartDate(), exp.getEndDate())) + .sum(); + } + + /** + * 总工作月数 → 转换经验编码 + */ + public static Integer convertMonthToExpCode(int totalMonth) { + if (totalMonth <= 0) { + // 无工作经历:应届生 + return 2; + } + double year = totalMonth / 12.0; + if (year < 1) { + return 3; + } else if (year <= 3) { + return 4; + } else if (year <= 5) { + return 5; + } else if (year <= 10) { + return 6; + } else { + return 7; + } + } + + /** + * 追加简历工作经历匹配条件 + * 1.岗位名称匹配 + * 2.经验等级匹配 + */ + public static void appendWorkExpMatch(LambdaEsQueryWrapper wrapper, List expList) { + if (CollUtil.isEmpty(expList)) { + return; + } + + Map posBoostMap = new HashMap<>(); + for (UserWorkExperiences exp : expList) { + String position = exp.getPosition(); + if (StrUtil.isBlank(position)) { + continue; + } + int month = calcWorkMonth(exp.getStartDate(), exp.getEndDate()); + Float boost; + if (month >= 36) { + boost = POS_BOOST_LONG; + } else if (month >= 12) { + boost = POS_BOOST_MID; + } else { + boost = POS_BOOST_SHORT; + } + posBoostMap.compute(position, (k, old) -> old == null ? boost : Math.max(old, boost)); + } + + // 名称拼接,带上对应权重 + for (Map.Entry entry : posBoostMap.entrySet()) { + String title = entry.getKey(); + Float boost = entry.getValue(); + wrapper.should(w -> w.match("jobTitle", title, boost)); + } + + // 经验区间梯度加权 + int totalMonth = calcTotalWorkMonth(expList); + Integer userExpCode = convertMonthToExpCode(totalMonth); + appendExpCodeMatch(wrapper, userExpCode); + } + + /** + * 根据用户经验编码,追加经验等级should条件 + */ + private static void appendExpCodeMatch(LambdaEsQueryWrapper wrapper, Integer userExpCode) { + // 应届生 / 实习生 + if (userExpCode <= 2) { + wrapper.should(w -> w.match("experience_int", 0, EXP_MATCH_SELF)); + wrapper.should(w -> w.match("experience_int", 1, EXP_MATCH_SELF)); + wrapper.should(w -> w.match("experience_int", 2, EXP_MATCH_SELF)); + return; + } + int selfCode = userExpCode; + int lower1 = selfCode - 1; + List lowerAll = new ArrayList<>(); + for (int i = 0; i < lower1; i++) { + lowerAll.add(i); + } + // 完全匹配自身经验区间,最高权重 + wrapper.should(w -> w.match("experience_int", selfCode, EXP_MATCH_SELF)); + // 低一档经验,次权重 + wrapper.should(w -> w.match("experience_int", lower1, EXP_MATCH_LOW1)); + // 低两档及经验不限,最低权重 + for (Integer code : lowerAll) { + wrapper.should(w -> w.match("experience_int", code, EXP_MATCH_LOWER)); + } + } + + /** + * 批量追加岗位名称match(投递/收藏通用) + * @param nameList 岗位名称集合 + * @param boost 权重 + */ + public static void appendJobTitleMatch(LambdaEsQueryWrapper wrapper, List nameList, Float boost) { + if (CollUtil.isEmpty(nameList)) { + return; + } + for (String title : nameList) { + wrapper.should(w -> w.match(ESJobDocument::getJobTitle, title, boost)); + } + } +} \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/app/JobApplyMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/app/JobApplyMapper.xml index b12efb0..5290572 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/app/JobApplyMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/app/JobApplyMapper.xml @@ -200,4 +200,10 @@ + + \ No newline at end of file diff --git a/ruoyi-bussiness/src/main/resources/mapper/app/JobCollectionMapper.xml b/ruoyi-bussiness/src/main/resources/mapper/app/JobCollectionMapper.xml index da06995..5a12285 100644 --- a/ruoyi-bussiness/src/main/resources/mapper/app/JobCollectionMapper.xml +++ b/ruoyi-bussiness/src/main/resources/mapper/app/JobCollectionMapper.xml @@ -44,4 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.user_id = #{userId} + + \ No newline at end of file