diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java index 05d987d..1afb091 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/cms/CmsJobController.java @@ -34,6 +34,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.collections4.CollectionUtils; +import org.dromara.easyes.core.biz.EsPageInfo; import org.quickssl.api.CryptoClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; @@ -650,4 +651,56 @@ public class CmsJobController extends BaseController } return toAjax(jobService.deleteJobByJobIds(jobIds)); } + + /** + * 附件工作 + */ + @ApiOperation("区县工作") + @PostMapping(value = "/countyJob") + public TableDataInfo countyJob(@RequestBody ESJobSearch job) + { + EsPageInfo list = jobService.sysCountyJobList(job); + List jobList = list.getList(); + list.setList(jobList); + return getTableDataInfo(list); + } + /** + * 地铁周边 + */ + @ApiOperation("地铁周边") + @PostMapping(value = "/subway") + public TableDataInfo subway(@RequestBody ESJobSearch jobQuery) + { + EsPageInfo list = jobService.sysSubway(jobQuery); + List jobList = list.getList(); + list.setList(jobList); + return getTableDataInfo(list); + } + + /** + * 商圈周边 + */ + @ApiOperation("商圈周边") + @PostMapping(value = "/commercialArea") + public TableDataInfo commercialArea(@RequestBody ESJobSearch jobQuery) + { + EsPageInfo list = jobService.sysCommercialArea(jobQuery); + List jobList = list.getList(); + list.setList(jobList); + return getTableDataInfo(list); + } + + /** + * 分页 + * @param result + * @return + */ + private TableDataInfo getTableDataInfo(EsPageInfo result){ + long total = result.getTotal(); + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(200); + rspData.setRows(result.getList()); + rspData.setTotal(total > 200 ? 200 : total); + return rspData; + } } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/IJobService.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/IJobService.java index 875f99c..490146d 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/IJobService.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/IJobService.java @@ -121,4 +121,10 @@ public interface IJobService void updateJobDown(); void selectUserRecommendJobNotic(); + + EsPageInfo sysCountyJobList(ESJobSearch job); + + EsPageInfo sysSubway(ESJobSearch jobQuery); + + EsPageInfo sysCommercialArea(ESJobSearch jobQuery); } diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/JobServiceImpl.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/JobServiceImpl.java index d204f9c..33bb2ca 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/JobServiceImpl.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/service/impl/JobServiceImpl.java @@ -579,6 +579,30 @@ public class JobServiceImpl extends ServiceImpl implements IJobSe return esJobDocumentEsPageInfo; } + @Override + public EsPageInfo sysCountyJobList(ESJobSearch job) { + EsPageInfo esJobDocumentEsPageInfo = iesJobSearchService.countyJobList(job); + List esJobDocuments = sysUserCollection(esJobDocumentEsPageInfo.getList()); + esJobDocumentEsPageInfo.setList(esJobDocuments); + return esJobDocumentEsPageInfo; + } + + @Override + public EsPageInfo sysSubway(ESJobSearch jobQuery) { + EsPageInfo esJobDocumentEsPageInfo = iesJobSearchService.subway(jobQuery); + List esJobDocuments = sysUserCollection(esJobDocumentEsPageInfo.getList()); + esJobDocumentEsPageInfo.setList(esJobDocuments); + return esJobDocumentEsPageInfo; + } + + @Override + public EsPageInfo sysCommercialArea(ESJobSearch jobQuery) { + EsPageInfo esJobDocumentEsPageInfo = iesJobSearchService.commercialArea(jobQuery); + List esJobDocuments = sysUserCollection(esJobDocumentEsPageInfo.getList()); + esJobDocumentEsPageInfo.setList(esJobDocuments); + return esJobDocumentEsPageInfo; + } + @Override public Job selectJobByJobIdApp(Long jobId) { Job job = jobMapper.selectById(jobId); @@ -1045,14 +1069,17 @@ public class JobServiceImpl extends ServiceImpl implements IJobSe private List sysUserCollection(List jobs){ if(jobs.isEmpty()){return new ArrayList<>();} if(SecurityUtils.isLogin()){ - //收藏 - Set collectionIds = jobCollectionMapper.selectList(Wrappers.lambdaQuery() - .eq(JobCollection::getUserId, SecurityUtils.getUserId()) - .in(JobCollection::getJobId, jobs.stream().map(ESJobDocument::getJobId).collect(Collectors.toList()))) - .stream().map(JobCollection::getJobId).collect(Collectors.toSet()); - for (ESJobDocument j : jobs) { - if (collectionIds.contains(j.getJobId())) { - j.setIsCollection(1); + Long userId=RoleUtils.getAppUserId(); + if(userId!=null){ + //收藏 + Set collectionIds = jobCollectionMapper.selectList(Wrappers.lambdaQuery() + .eq(JobCollection::getUserId, userId) + .in(JobCollection::getJobId, jobs.stream().map(ESJobDocument::getJobId).collect(Collectors.toList()))) + .stream().map(JobCollection::getJobId).collect(Collectors.toSet()); + for (ESJobDocument j : jobs) { + if (collectionIds.contains(j.getJobId())) { + j.setIsCollection(1); + } } } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/EncryptConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EncryptConstants.java index 9e847b8..c9ef84e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/EncryptConstants.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/constant/EncryptConstants.java @@ -51,6 +51,9 @@ public class EncryptConstants { "/getWwTjmHlwToken", "/cms/appUser/getUserInfo", "/cms/job/getAppUserYhsc", + "/cms/job/countyJob", + "/cms/job/subway", + "/cms/job/commercialArea", "/app/idCardLogin", "/app/phoneLogin", "/getInfo",