添加es初始化是企业对象

This commit is contained in:
sh
2025-10-31 13:41:27 +08:00
parent 2e6785b34d
commit 680ca8aa44
3 changed files with 18 additions and 15 deletions

View File

@@ -152,7 +152,7 @@ public class ESJobDocument
@ApiModelProperty("信用代码")
private String code;
/*@TableField(exist = false)
@TableField(exist = false)
@ApiModelProperty("公司信息")
private CompanyVo companyVo;*/
private CompanyVo companyVo;
}

View File

@@ -12,7 +12,6 @@ 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.text.Convert;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SiteSecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import org.dromara.easyes.core.biz.EsPageInfo;

View File

@@ -25,6 +25,7 @@ import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SiteSecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import org.dromara.easyes.core.biz.EsPageInfo;
@@ -834,26 +835,29 @@ public class JobServiceImpl extends ServiceImpl<JobMapper,Job> implements IJobSe
@Override
public List<ESJobDocument> sysRecommend(ESJobSearch esJobSearch) {
Long userId=SecurityUtils.isLogin()?SecurityUtils.getUserId():null;
String jobKey=CacheConstants.SYS_JOB_IDS+ userId;
List<Long> jobList=new ArrayList<>();
String jobKey="";
AppUser appUser=null;
if(userId!=null){
jobKey=CacheConstants.SYS_JOB_IDS+ userId;
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
JSONArray cacheObject = redisCache.getCacheObject(jobKey);
List<Long> jobList = new ArrayList<>();
jobList = new ArrayList<>();
if(Objects.isNull(cacheObject)){
ArrayList<Long> longs = new ArrayList<>();
jobList =longs;
}else {
jobList = cacheObject.toList(Long.class);
}
AppUser appUser=null;
if(userId!=null){
appUser=appUserService.selectAppuserByIdcard(RoleUtils.getCurrentUseridCard());
}
//从es中查询
List<ESJobDocument> jobListResult = iesJobSearchService.selectSysTextListExceptJobId(esJobSearch,jobList,appUser);
//存入当前session中查看的岗位 避免重复 todo 定时删除 key上保存用户信息
jobList.addAll(jobListResult.stream().map(ESJobDocument::getJobId).collect(Collectors.toList()));
if(StringUtils.isNotEmpty(jobKey)){
redisCache.setCacheObject(jobKey,jobList);
}
List<ESJobDocument> esJobDocuments = sysUserCollection(jobListResult);
return esJobDocuments;
}