|
@@ -106,11 +106,11 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
return jobAdvertisedMapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
|
- public PageResult<AppJobAdvertisedRespVO> generate() {
|
|
|
- PageResult<AppJobAdvertisedRespVO> result = new PageResult<>();
|
|
|
- List<AppJobAdvertisedRespVO> list = new ArrayList<>();
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> generate() {
|
|
|
+ PageResult<AppJobAdvertisedHomeRespVO> result = new PageResult<>();
|
|
|
+ List<AppJobAdvertisedHomeRespVO> list = new ArrayList<>();
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO1 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO1 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO1.setId(1L);
|
|
|
respVO1.setAreaId(110000L);
|
|
|
respVO1.setPositionId(1L);
|
|
@@ -128,7 +128,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
respVO1.setLogoUrl("https://www.menduner.com/static/img/loginlogo2.7924c12.png");
|
|
|
list.add(respVO1);
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO2 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO2 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO2.setId(2L);
|
|
|
respVO2.setAreaId(440100L);
|
|
|
respVO2.setPositionId(2L);
|
|
@@ -147,7 +147,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
list.add(respVO2);
|
|
|
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO3 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO3 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO3.setId(3L);
|
|
|
respVO3.setAreaId(440300L);
|
|
|
respVO3.setPositionId(3L);
|
|
@@ -165,7 +165,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
respVO3.setLogoUrl("https://www.menduner.com/static/img/loginlogo2.7924c12.png");
|
|
|
list.add(respVO3);
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO4 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO4 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO4.setId(4L);
|
|
|
respVO4.setAreaId(440600L);
|
|
|
respVO4.setPositionId(4L);
|
|
@@ -183,7 +183,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
respVO4.setLogoUrl("https://www.menduner.com/static/img/loginlogo2.7924c12.png");
|
|
|
list.add(respVO4);
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO5 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO5 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO5.setId(5L);
|
|
|
respVO5.setAreaId(441200L);
|
|
|
respVO5.setPositionId(5L);
|
|
@@ -201,7 +201,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
respVO5.setLogoUrl("https://www.menduner.com/static/img/loginlogo2.7924c12.png");
|
|
|
list.add(respVO5);
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO6 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO6 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO6.setId(6L);
|
|
|
respVO6.setAreaId(440800L);
|
|
|
respVO6.setPositionId(6L);
|
|
@@ -220,7 +220,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
list.add(respVO6);
|
|
|
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO7 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO7 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO7.setId(7L);
|
|
|
respVO7.setAreaId(441900L);
|
|
|
respVO7.setPositionId(7L);
|
|
@@ -239,7 +239,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
list.add(respVO7);
|
|
|
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO8 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO8 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO8.setId(8L);
|
|
|
respVO8.setAreaId(441700L);
|
|
|
respVO8.setPositionId(8L);
|
|
@@ -257,7 +257,7 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
respVO8.setLogoUrl("https://www.menduner.com/static/img/loginlogo2.7924c12.png");
|
|
|
list.add(respVO8);
|
|
|
|
|
|
- AppJobAdvertisedRespVO respVO9 = new AppJobAdvertisedRespVO();
|
|
|
+ AppJobAdvertisedHomeRespVO respVO9 = new AppJobAdvertisedHomeRespVO();
|
|
|
respVO9.setId(9L);
|
|
|
respVO9.setAreaId(445300L);
|
|
|
respVO9.setPositionId(9L);
|
|
@@ -282,22 +282,22 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedRespVO> getRecommendedJobPage(PageParam pageParam) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getRecommendedJobPage(PageParam pageParam) {
|
|
|
return jobAdvertisedMapper.selectPage(pageParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedRespVO> getLatestJobPage(PageParam pageParam) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getLatestJobPage(PageParam pageParam) {
|
|
|
return jobAdvertisedMapper.selectPage(pageParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedRespVO> getUrgentJobPage(PageParam pageParam) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getUrgentJobPage(PageParam pageParam) {
|
|
|
return jobAdvertisedMapper.selectPage(pageParam);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedRespVO> getAcquaintedJobAdvertised(AppJobAdvertisedPageReqVO pageReqVO) {
|
|
|
+ public PageResult<AppJobAdvertisedHomeRespVO> getAcquaintedJobAdvertised(AppJobAdvertisedPageReqVO pageReqVO) {
|
|
|
return jobAdvertisedMapper.selectPage(pageReqVO);
|
|
|
}
|
|
|
|
|
@@ -344,10 +344,10 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<AppJobAdvertisedSearchRespVO> search(AppJobAdvertisedSearchPageReqVO reqVO) {
|
|
|
+ public PageResult<AppJobAdvertisedRespVO> search(AppJobAdvertisedSearchPageReqVO reqVO) {
|
|
|
|
|
|
- PageResult<AppJobAdvertisedSearchRespVO> result = new PageResult<>();
|
|
|
- List<AppJobAdvertisedSearchRespVO> list = new ArrayList<>();
|
|
|
+ PageResult<AppJobAdvertisedRespVO> result = new PageResult<>();
|
|
|
+ List<AppJobAdvertisedRespVO> list = new ArrayList<>();
|
|
|
|
|
|
// 构建分页
|
|
|
Pageable pageable = PageRequest.of(reqVO.getPageNo() - 1, reqVO.getPageSize());
|
|
@@ -360,23 +360,38 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
// .preTags("<span style='color:red'>")
|
|
|
// .postTags("</span>").requireFieldMatch(false))
|
|
|
.withHighlightBuilder(new HighlightBuilder().field("name").field("enterpriseName")
|
|
|
- .field("enterpriseAnotherName").requireFieldMatch(Boolean.TRUE)
|
|
|
- .preTags("<span style='color:red'>")
|
|
|
+ .field("enterpriseAnotherName").requireFieldMatch(Boolean.TRUE)
|
|
|
+ .preTags("<span style='color:red'>")
|
|
|
.postTags("</span>")
|
|
|
- .numOfFragments(10000)
|
|
|
+ .numOfFragments(10000)
|
|
|
)
|
|
|
.withPageable(pageable)
|
|
|
.build();
|
|
|
SearchHits<ESJobAdvertisedMergeDO> search = elasticsearchTemplate.search(searchQuery, ESJobAdvertisedMergeDO.class);
|
|
|
log.info("NativeSearchQuery json : " + searchQuery.getQuery().toString());
|
|
|
|
|
|
+ fill(list, search);
|
|
|
+ result.setList(list);
|
|
|
+ result.setTotal(list.stream().count());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description 填充搜索结果
|
|
|
+ * @author rayson
|
|
|
+ * @param list 目标对象
|
|
|
+ * @param search 搜索结果
|
|
|
+ * @date 2024/6/4 下午2:40
|
|
|
+ * @return void
|
|
|
+ **/
|
|
|
+ private void fill(List<AppJobAdvertisedRespVO> list, SearchHits<ESJobAdvertisedMergeDO> search) {
|
|
|
search.getSearchHits().stream()
|
|
|
.forEach(searchHit -> {
|
|
|
Map<String, List<String>> highlightFields = searchHit.getHighlightFields();
|
|
|
|
|
|
- AppJobAdvertisedSearchRespVO respVO = new AppJobAdvertisedSearchRespVO();
|
|
|
+ AppJobAdvertisedRespVO respVO = new AppJobAdvertisedRespVO();
|
|
|
respVO.setJob(JobAdvertisedConvert.INSTANCE.convert(searchHit.getContent()));
|
|
|
- if (null != highlightFields.get("name")){
|
|
|
+ if (null != highlightFields.get("name")) {
|
|
|
respVO.getJob()
|
|
|
.setName(highlightFields.get("name").get(0));
|
|
|
}
|
|
@@ -395,10 +410,6 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
list.add(respVO);
|
|
|
|
|
|
});
|
|
|
-
|
|
|
- result.setList(list);
|
|
|
- result.setTotal(list.stream().count());
|
|
|
- return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -441,4 +452,5 @@ public class JobAdvertisedServiceImpl implements JobAdvertisedService {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|