添加es初始化是企业对象
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
RedisCache redisCache = SpringUtils.getBean(RedisCache.class);
|
||||
JSONArray cacheObject = redisCache.getCacheObject(jobKey);
|
||||
List<Long> jobList = new ArrayList<>();
|
||||
if(Objects.isNull(cacheObject)){
|
||||
ArrayList<Long> longs = new ArrayList<>();
|
||||
jobList =longs;
|
||||
}else {
|
||||
jobList = cacheObject.toList(Long.class);
|
||||
}
|
||||
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);
|
||||
jobList = new ArrayList<>();
|
||||
if(Objects.isNull(cacheObject)){
|
||||
ArrayList<Long> longs = new ArrayList<>();
|
||||
jobList =longs;
|
||||
}else {
|
||||
jobList = cacheObject.toList(Long.class);
|
||||
}
|
||||
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()));
|
||||
redisCache.setCacheObject(jobKey,jobList);
|
||||
if(StringUtils.isNotEmpty(jobKey)){
|
||||
redisCache.setCacheObject(jobKey,jobList);
|
||||
}
|
||||
List<ESJobDocument> esJobDocuments = sysUserCollection(jobListResult);
|
||||
return esJobDocuments;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user