Commit 6687380e by Administrator

Merge branch 'feature/1003754-01' into 'master'

feat: [1003754] 答案搜索优化

See merge request rays/pcloud-book!1038
parents e6f3fc17 4a7b64b7
...@@ -105,6 +105,7 @@ import com.pcloud.book.group.entity.BookGroup; ...@@ -105,6 +105,7 @@ import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupServe; import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.enums.JoinGroupTypeEnum; import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.mq.producer.BookMQProducer; import com.pcloud.book.mq.producer.BookMQProducer;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
import com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper; import com.pcloud.book.rightsSetting.mapper.RightsSettingBookRelationMapper;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums; import com.pcloud.book.util.common.YesOrNoEnums;
...@@ -3421,8 +3422,12 @@ public class BookBizImpl implements BookBiz { ...@@ -3421,8 +3422,12 @@ public class BookBizImpl implements BookBiz {
Long graLabelId = bookSearchParamVO.getGraLabelId(); Long graLabelId = bookSearchParamVO.getGraLabelId();
Long subLabelId = bookSearchParamVO.getSubLabelId(); Long subLabelId = bookSearchParamVO.getSubLabelId();
Long verLabelId = bookSearchParamVO.getVerLabelId(); Long verLabelId = bookSearchParamVO.getVerLabelId();
List<Long> templetIds = new ArrayList<>();
if (null != graLabelId || null != subLabelId || null != verLabelId){
templetIds = Arrays.asList(RightsSettingConstant.K12_VOLUME_ID);
}
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getESAdviserBooks4Answer(bookSearchParamVO.getGrayStatus(), bookSearchParamVO.getKeyword(), Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getESAdviserBooks4Answer(bookSearchParamVO.getGrayStatus(), bookSearchParamVO.getKeyword(),
graLabelId, subLabelId, verLabelId, 0, 3); graLabelId, subLabelId, verLabelId, 0, 3, templetIds);
List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent(); List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent();
if (ListUtils.isEmpty(esBookAndAdvisers)) { if (ListUtils.isEmpty(esBookAndAdvisers)) {
return new ArrayList<>(); return new ArrayList<>();
......
...@@ -30,5 +30,5 @@ public interface ESBookAndAdviserBiz { ...@@ -30,5 +30,5 @@ public interface ESBookAndAdviserBiz {
* * @param null * * @param null
*/ */
Page<ESBookAndAdviser> getESAdviserBooks4Answer(String grayStatus, String keyword, Long graLabelId, Long subLabelId, Long verLabelId, Page<ESBookAndAdviser> getESAdviserBooks4Answer(String grayStatus, String keyword, Long graLabelId, Long subLabelId, Long verLabelId,
Integer currentPage, Integer numPerPage); Integer currentPage, Integer numPerPage, List<Long> templetIds);
} }
...@@ -320,10 +320,11 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz { ...@@ -320,10 +320,11 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
@Override @Override
public Page<ESBookAndAdviser> getESAdviserBooks4Answer(String grayStatus, String keyword, Long graLabelId, Long subLabelId, Long verLabelId, Integer currentPage, Integer numPerPage) { public Page<ESBookAndAdviser> getESAdviserBooks4Answer(String grayStatus, String keyword, Long graLabelId, Long subLabelId, Long verLabelId, Integer currentPage, Integer numPerPage, List<Long> templetIds) {
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery() BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery()
.filter(QueryBuilders.termQuery("isBookDelete", 0)) .filter(QueryBuilders.termQuery("isBookDelete", 0))
.filter(QueryBuilders.termQuery("isBookAdviserDelete", 0)) .filter(QueryBuilders.termQuery("isBookAdviserDelete", 0))
.filter(ListUtils.isEmpty(templetIds) ? QueryBuilders.boolQuery() : QueryBuilders.termsQuery("templetId", templetIds))
.filter(null == graLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("graLabelId", graLabelId)) .filter(null == graLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("graLabelId", graLabelId))
.filter(null == subLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("subLabelId", subLabelId)) .filter(null == subLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("subLabelId", subLabelId))
.filter(null == verLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("verLabelId", verLabelId)); .filter(null == verLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("verLabelId", verLabelId));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment