更新:1.查询岗位时添加时间段筛选,2.查询岗位不准确的问题。
This commit is contained in:
@@ -60,7 +60,7 @@ public class ESJobDocument
|
|||||||
@ApiModelProperty("工作地点区县字典代码")
|
@ApiModelProperty("工作地点区县字典代码")
|
||||||
private Integer jobLocationAreaCode;
|
private Integer jobLocationAreaCode;
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@ApiModelProperty("发布时间")
|
@ApiModelProperty("发布时间")
|
||||||
private Date postingDate;
|
private Date postingDate;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.ruoyi.cms.domain.query;
|
package com.ruoyi.cms.domain.query;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.ruoyi.cms.domain.Job;
|
import com.ruoyi.cms.domain.Job;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,4 +57,10 @@ public class ESJobSearch extends Job
|
|||||||
|
|
||||||
/*** 用户角色app角色:0企业,1求职者,2网格员 3内部政府人员*/
|
/*** 用户角色app角色:0企业,1求职者,2网格员 3内部政府人员*/
|
||||||
private String userType;
|
private String userType;
|
||||||
|
|
||||||
|
//开始时间
|
||||||
|
private Date startDate;
|
||||||
|
|
||||||
|
//结束时间
|
||||||
|
private Date endDate;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -505,14 +509,14 @@ public class ESJobSearchImpl implements IESJobSearchService
|
|||||||
// 岗位薪资范围与用户期望薪资范围有交集
|
// 岗位薪资范围与用户期望薪资范围有交集
|
||||||
// 条件:岗位最小薪资 <= 用户最大薪资 AND 岗位最大薪资 >= 用户最小薪资
|
// 条件:岗位最小薪资 <= 用户最大薪资 AND 岗位最大薪资 >= 用户最小薪资
|
||||||
if(Objects.nonNull(userMinSalary) && Objects.nonNull(userMaxSalary)){
|
if(Objects.nonNull(userMinSalary) && Objects.nonNull(userMaxSalary)){
|
||||||
wrapper.and(x->x.le(ESJobDocument::getMinSalary,userMaxSalary)
|
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,userMaxSalary)
|
||||||
.ge(ESJobDocument::getMaxSalary,userMinSalary));
|
.ge(ESJobDocument::getMinSalary,userMinSalary));
|
||||||
} else if(Objects.nonNull(userMinSalary)){
|
} else if(Objects.nonNull(userMinSalary)){
|
||||||
// 只有最小薪资:岗位最大薪资 >= 用户最小薪资
|
// 只有最小薪资:岗位最大薪资 >= 用户最小薪资
|
||||||
wrapper.and(x->x.ge(ESJobDocument::getMaxSalary,userMinSalary));
|
wrapper.and(x->x.ge(ESJobDocument::getMinSalary,userMinSalary));
|
||||||
} else if(Objects.nonNull(userMaxSalary)){
|
} else if(Objects.nonNull(userMaxSalary)){
|
||||||
// 只有最大薪资:岗位最小薪资 <= 用户最大薪资
|
// 只有最大薪资:岗位最小薪资 <= 用户最大薪资
|
||||||
wrapper.and(x->x.le(ESJobDocument::getMinSalary,userMaxSalary));
|
wrapper.and(x->x.le(ESJobDocument::getMaxSalary,userMaxSalary));
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
|
if(!StringUtil.isEmptyOrNull(esJobSearch.getExperience())){
|
||||||
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience());
|
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getExperience());
|
||||||
@@ -520,9 +524,7 @@ public class ESJobSearchImpl implements IESJobSearchService
|
|||||||
}
|
}
|
||||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){
|
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobCategory())){
|
||||||
String targetValue = esJobSearch.getJobCategory();
|
String targetValue = esJobSearch.getJobCategory();
|
||||||
wrapper.and(x -> x.match(ESJobDocument::getJobTitle, targetValue)
|
wrapper.and(x -> x.eq(ESJobDocument::getJobCategory, targetValue));
|
||||||
.or()
|
|
||||||
.match(ESJobDocument::getDescription, targetValue));
|
|
||||||
}
|
}
|
||||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getScale())){
|
if(!StringUtil.isEmptyOrNull(esJobSearch.getScale())){
|
||||||
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getScale());
|
Integer maxValue = StringUtil.findMaxValue(esJobSearch.getScale());
|
||||||
@@ -559,6 +561,17 @@ public class ESJobSearchImpl implements IESJobSearchService
|
|||||||
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobLocation())){
|
if(!StringUtil.isEmptyOrNull(esJobSearch.getJobLocation())){
|
||||||
wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation()));
|
wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation()));
|
||||||
}
|
}
|
||||||
|
//按时间段来查询数据
|
||||||
|
if(esJobSearch.getStartDate() != null){
|
||||||
|
Date startDateTime = esJobSearch.getStartDate();
|
||||||
|
String formattedStartDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startDateTime);
|
||||||
|
wrapper.and(x->x.ge(ESJobDocument::getPostingDate, formattedStartDate));
|
||||||
|
}
|
||||||
|
if(esJobSearch.getEndDate() != null){
|
||||||
|
Date endDateTime = esJobSearch.getEndDate();
|
||||||
|
String formattedEndDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endDateTime);
|
||||||
|
wrapper.and(x->x.le(ESJobDocument::getPostingDate, formattedEndDate));
|
||||||
|
}
|
||||||
if(Objects.nonNull(esJobSearch.getOrder())){
|
if(Objects.nonNull(esJobSearch.getOrder())){
|
||||||
wrapper.orderByDesc(ESJobDocument::getPostingDate);
|
wrapper.orderByDesc(ESJobDocument::getPostingDate);
|
||||||
if(esJobSearch.getOrder()==1){
|
if(esJobSearch.getOrder()==1){
|
||||||
|
|||||||
Reference in New Issue
Block a user