Commit 8a429f83 by 朱亚洁

bug:[1026859]系列书只有一本不展示

parent 2d52f788
......@@ -757,6 +757,18 @@ public class BookDto extends BaseDto {
* 小睿码自定义跳转链接
*/
private String jumpUrl;
/**
* 权益id
*/
private Long rightsSettingId;
public Long getRightsSettingId() {
return rightsSettingId;
}
public void setRightsSettingId(Long rightsSettingId) {
this.rightsSettingId = rightsSettingId;
}
public Integer getJumpType() {
return jumpType;
......@@ -2282,6 +2294,7 @@ public class BookDto extends BaseDto {
", edition='" + edition + '\'' +
", jumpType=" + jumpType +
", jumpUrl='" + jumpUrl + '\'' +
", rightsSettingId=" + rightsSettingId +
", bookAdviserDto=" + bookAdviserDto +
'}';
}
......
......@@ -2247,6 +2247,7 @@ public class BookBizImpl implements BookBiz {
bookDto.setSubLabelId(esBookAndAdviser.getSubLabelId());
bookDto.setAreaLabelId(esBookAndAdviser.getAreaLabelId());
bookDto.setVerLabelId(esBookAndAdviser.getVerLabelId());
bookDto.setRightsSettingId(esBookAndAdviser.getRightsSettingId());
bookDtos.add(bookDto);
}
return bookDtos;
......@@ -3597,6 +3598,8 @@ public class BookBizImpl implements BookBiz {
if (ListUtils.isEmpty(seriesBooks)) {
return map;
}
List<String> keywordList = new ArrayList<>();
Long seriesBookId = null;
for (SeriesBook seriesBook:seriesBooks){
String[] keywords = seriesBook.getSeriesBookKeyword().split(" ");
Boolean hasKeyword = true;
......@@ -3608,13 +3611,23 @@ public class BookBizImpl implements BookBiz {
}
if (hasKeyword){
isSeriesBook = true;
map.put("seriesBookId", seriesBook.getId());
seriesBookId = seriesBook.getId();
keywordList = Arrays.asList(keywords);
break;
}
}
if (isSeriesBook){
map.put("subLabelId", bookAdviserDto.getSubLabelId());
map.put("graLabelId", bookAdviserDto.getGraLabelId());
List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(keywordList, 0, 50, adviserIds, agentId, null, bookAdviserDto.getGraLabelId());
List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent();
//无系列书或只有一本,不展示切换
if (ListUtils.isEmpty(esBookAndAdvisers) || esBookAndAdvisers.size()==1) {
isSeriesBook = false;
} else {
map.put("seriesBookId", seriesBookId);
map.put("subLabelId", bookAdviserDto.getSubLabelId());
map.put("graLabelId", bookAdviserDto.getGraLabelId());
}
}
map.put("isSeriesBook", isSeriesBook);
return map;
......
......@@ -13,7 +13,9 @@ import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.book.es.repository.BookAndAdviserRepository;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.constants.RightsSettingConstant;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.book.util.properties.BookProps;
......@@ -75,6 +77,8 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
private TradeConsr tradeConsr;
@Autowired
private ErpConsr erpConsr;
@Autowired
private RightsSettingBiz rightsSettingBiz;
@ParamLog("导入全部book和bookAdviser")
@Transactional(rollbackFor = Exception.class)
......@@ -174,6 +178,18 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
if(!MapUtils.isEmpty(erpBookApprovalMap) && erpBookApprovalMap.containsKey(key)){
bookAndAdviser.setIsApproval(erpBookApprovalMap.get(key).getIsApproval());
}
//权益
Long adviserId = Long.valueOf(bookAndAdviser.getAdviserId());
Long bookId = Long.valueOf(bookAndAdviser.getBookId());
Long channelId = Long.valueOf(bookAndAdviser.getChannelId());
Long rightsSettingId = 0L;
if (adviserId>0 && bookId>0 && channelId>0){
RightsSettingDto rightsSettingDto = rightsSettingBiz.getRightsSettingByBookId4AppletHome(bookId,adviserId,channelId);
if (null != rightsSettingDto && null != rightsSettingDto.getId()){
rightsSettingId = rightsSettingDto.getId();
}
}
bookAndAdviser.setRightsSettingId(rightsSettingId);
}
}
......@@ -402,13 +418,17 @@ public class ESBookAndAdviserBizImpl implements ESBookAndAdviserBiz {
.filter(null == subLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("subLabelId", subLabelId))
.filter(null == graLabelId ? QueryBuilders.boolQuery() : QueryBuilders.termQuery("graLabelId", graLabelId))
.filter(ListUtils.isEmpty(templetIds) ? QueryBuilders.boolQuery() : QueryBuilders.termsQuery("templetId", templetIds));
//关键词
for (String keyword:keywords){
BoolQueryBuilder should = QueryBuilders.boolQuery().should(StringUtil.isEmpty(keyword) ? QueryBuilders.boolQuery() : QueryBuilders.wildcardQuery("bookName", "*" + keyword + "*"));
boolQueryBuilder.must(should);
}
BoolQueryBuilder should1 = QueryBuilders.boolQuery()
.should(QueryBuilders.termQuery("isAdviserBook",1));
//编辑书
BoolQueryBuilder should1 = QueryBuilders.boolQuery().should(QueryBuilders.termQuery("isAdviserBook",1));
boolQueryBuilder.must(should1);
//权益
BoolQueryBuilder should2 = QueryBuilders.boolQuery().mustNot(QueryBuilders.termQuery("rightsSettingId",0));
boolQueryBuilder.must(should2);
Sort sort = new Sort(Sort.Direction.DESC, "lastModifiedDate", "bookId");
PageRequest pageRequest = new PageRequest(currentPage, numPerPage, sort);
Page<ESBookAndAdviser> search = bookAndAdviserRepository.search(boolQueryBuilder, pageRequest);
......
......@@ -161,4 +161,9 @@ public class ESBookAndAdviser {
* 是否已立项
*/
private Integer isApproval;
/**
* 权益id
*/
private Long rightsSettingId;
}
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