From 403e43944ea7f70c44ad6541888deca5ed114ea0 Mon Sep 17 00:00:00 2001 From: sh Date: Mon, 30 Mar 2026 20:06:00 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E9=94=81=E6=97=B6=E9=97=B4?= =?UTF-8?q?=202.=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD=E4=BC=81=E4=B8=9A?= =?UTF-8?q?=E4=B8=8D=E7=BB=B4=E6=8A=A4=E6=97=B6=EF=BC=8C=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/cms/service/impl/ESJobSearchImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 8657664..45d11af 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 @@ -58,9 +58,9 @@ public class ESJobSearchImpl implements IESJobSearchService // 锁的key(唯一标识ES索引初始化) private static final String ES_INIT_LOCK_KEY = "es:job_document:init:lock"; // 锁过期时间(30分钟,确保初始化完成) - private static final Integer LOCK_EXPIRE_SECONDS = 1800; + private static final Integer LOCK_EXPIRE_SECONDS = 600;//1800 // 等待锁时间(5分钟,避免无限等待) - private static final Integer WAIT_LOCK_SECONDS = 300; + private static final Integer WAIT_LOCK_SECONDS = 1;//300 @Autowired @@ -114,7 +114,7 @@ public class ESJobSearchImpl implements IESJobSearchService */ private void releaseDistributedLock() { try { - redisCache.deleteObject(ES_INIT_LOCK_KEY); + //redisCache.deleteObject(ES_INIT_LOCK_KEY);//不删除锁,30分钟自动过期 logger.info("已释放ES初始化分布式锁,key:{}", ES_INIT_LOCK_KEY); } catch (Exception e) { logger.error("释放ES初始化锁异常", e); @@ -225,10 +225,15 @@ public class ESJobSearchImpl implements IESJobSearchService ESJobSearch newSearch = new ESJobSearch(); BeanUtils.copyProperties(esJobSearch,newSearch); - boolean isCompanyUser = StringUtil.IS_COMPANY_USER.equals(esJobSearch.getUserType()); + boolean isCompanyUser = false; //查询 if(SiteSecurityUtils.isLogin()){ AppUser appUser = appUserService.selectAppUserByUserId(SiteSecurityUtils.getUserId()); + //判断为企业并且code为空时,返回null + isCompanyUser=StringUtil.IS_COMPANY_USER.equals(appUser.getIsCompanyUser()); + if (isCompanyUser && StringUtil.isEmptyOrNull(esJobSearch.getCode())) { + return new ArrayList<>(); + } if (!StringUtil.isEmptyOrNull(esJobSearch.getCode())) { newSearch.setCode(esJobSearch.getCode()); }