This commit is contained in:
chenyanchang
2026-06-01 16:17:08 +08:00

View File

@@ -15,7 +15,9 @@ import com.ruoyi.cms.util.StringUtil;
import com.ruoyi.common.core.domain.entity.Company; import com.ruoyi.common.core.domain.entity.Company;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SiteSecurityUtils; import com.ruoyi.common.utils.SiteSecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.common.utils.bean.BeanUtils;
import org.dromara.easyes.core.biz.EsPageInfo; import org.dromara.easyes.core.biz.EsPageInfo;
import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper; import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper;
@@ -202,6 +204,10 @@ public class ESJobSearchImpl implements IESJobSearchService
if(StringUtil.isEmptyOrNull(job.getCompanyNature())){ if(StringUtil.isEmptyOrNull(job.getCompanyNature())){
esJobDocument.setCompanyNature("6"); esJobDocument.setCompanyNature("6");
} }
if (StringUtils.isNotEmpty(job.getPostingDate())) {
Date date = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,job.getPostingDate());
esJobDocument.setPostingDate(date);
}
esJobDocumentList.add(esJobDocument); esJobDocumentList.add(esJobDocument);
} }
@@ -554,15 +560,16 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation())); wrapper.and(x->x.like(ESJobDocument::getJobLocation,esJobSearch.getJobLocation()));
} }
if(Objects.nonNull(esJobSearch.getOrder())){ if(Objects.nonNull(esJobSearch.getOrder())){
wrapper.orderByDesc(ESJobDocument::getPostingDate);
if(esJobSearch.getOrder()==1){ if(esJobSearch.getOrder()==1){
wrapper.orderByDesc(ESJobDocument::getIsHot); wrapper.orderByDesc(ESJobDocument::getIsHot);
} }
if(esJobSearch.getOrder()==2){
wrapper.orderByDesc(ESJobDocument::getPostingDate);
}
if(esJobSearch.getOrder()==3){ if(esJobSearch.getOrder()==3){
wrapper.orderByDesc(ESJobDocument::getMaxSalary); wrapper.orderByDesc(ESJobDocument::getMaxSalary);
} }
}else{
//默认按照发布时间倒叙
wrapper.orderByDesc(ESJobDocument::getPostingDate);
} }
//企业用户排除es去除jobIds //企业用户排除es去除jobIds
boolean isCompanyUser = StringUtil.IS_COMPANY_USER.equals(esJobSearch.getUserType()); boolean isCompanyUser = StringUtil.IS_COMPANY_USER.equals(esJobSearch.getUserType());
@@ -631,14 +638,15 @@ public class ESJobSearchImpl implements IESJobSearchService
wrapper.and(a->a.eq(ESJobDocument::getType,jobQuery.getType().trim())); wrapper.and(a->a.eq(ESJobDocument::getType,jobQuery.getType().trim()));
} }
if(Objects.nonNull(jobQuery.getOrder())){ if(Objects.nonNull(jobQuery.getOrder())){
if (jobQuery.getOrder()==2){ wrapper.orderByDesc(ESJobDocument::getPostingDate);
wrapper.orderByDesc(ESJobDocument::getPostingDate);
}
if (jobQuery.getOrder()==1){ if (jobQuery.getOrder()==1){
wrapper.orderByDesc(ESJobDocument::getIsHot); wrapper.orderByDesc(ESJobDocument::getIsHot);
wrapper.orderByDesc(ESJobDocument::getApplyNum); wrapper.orderByDesc(ESJobDocument::getApplyNum);
wrapper.orderByDesc(ESJobDocument::getView); wrapper.orderByDesc(ESJobDocument::getView);
} }
}else{
//默认按照发布时间倒叙
wrapper.orderByDesc(ESJobDocument::getPostingDate);
} }
EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize); EsPageInfo<ESJobDocument> esJobDocumentEsPageInfo = esJobDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
return esJobDocumentEsPageInfo; return esJobDocumentEsPageInfo;