Commit c9900f50 by 李传峰

book 索引对接

parent e7d70560
...@@ -3728,13 +3728,13 @@ public class BookBizImpl implements BookBiz { ...@@ -3728,13 +3728,13 @@ public class BookBizImpl implements BookBiz {
return new ArrayList<>(); return new ArrayList<>();
} }
//系列书关键词 //系列书关键词
String[] keywords = seriesBook.getSeriesBookKeyword().split(" "); // String[] keywords = seriesBook.getSeriesBookKeyword().split(" ");
List<String> keywordList = new ArrayList<String>(Arrays.asList(keywords)); // List<String> keywordList = new ArrayList<String>(Arrays.asList(keywords));
//编辑id //编辑id
List<Long> adviserIds = adviserConsr.getByAgentId(seriesBook.getAgentId()); List<Long> adviserIds = adviserConsr.getByAgentId(seriesBook.getAgentId());
Integer currentPage = 0; Integer currentPage = 0;
Integer numPerPage = 50; Integer numPerPage = 50;
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(keywordList, currentPage, numPerPage, adviserIds, seriesBook.getAgentId(), null, graLabelId, seriesBook.getSerialNumber(), null, null); Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(seriesBook.getSeriesBookKeyword(), currentPage, numPerPage, adviserIds, seriesBook.getAgentId(), null, graLabelId, seriesBook.getSerialNumber(), null, null);
List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent(); List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent();
if (ListUtils.isEmpty(esBookAndAdvisers)) { if (ListUtils.isEmpty(esBookAndAdvisers)) {
return new ArrayList<>(); return new ArrayList<>();
...@@ -3800,7 +3800,7 @@ public class BookBizImpl implements BookBiz { ...@@ -3800,7 +3800,7 @@ public class BookBizImpl implements BookBiz {
} }
if (isSeriesBook){ if (isSeriesBook){
List<Long> adviserIds = adviserConsr.getByAgentId(agentId); List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(keywordList, 0, 50, adviserIds, agentId, null, bookAdviserDto.getGraLabelId(), serialNumber, null, null); Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(StringUtils.join(keywordList, ' '), 0, 50, adviserIds, agentId, null, bookAdviserDto.getGraLabelId(), serialNumber, null, null);
List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent(); List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent();
List<Long> subjectLabels = new ArrayList<>(); List<Long> subjectLabels = new ArrayList<>();
if (!ListUtils.isEmpty(esBookAndAdvisers)) { if (!ListUtils.isEmpty(esBookAndAdvisers)) {
...@@ -3829,15 +3829,15 @@ public class BookBizImpl implements BookBiz { ...@@ -3829,15 +3829,15 @@ public class BookBizImpl implements BookBiz {
return new PageBeanNew<>(); return new PageBeanNew<>();
} }
//系列书关键词 //系列书关键词
String[] keywords = seriesBook.getSeriesBookKeyword().split(" "); // String[] keywords = seriesBook.getSeriesBookKeyword().split(" ");
List<String> keywordList = new ArrayList<String>(Arrays.asList(keywords)); // List<String> keywordList = new ArrayList<String>(Arrays.asList(keywords));
//编辑id //编辑id
List<Long> adviserIds = adviserConsr.getByAgentId(seriesBook.getAgentId()); List<Long> adviserIds = adviserConsr.getByAgentId(seriesBook.getAgentId());
if(!NumberUtil.isNumber(currentPage) || !NumberUtil.isNumber(numPerPage)){ if(!NumberUtil.isNumber(currentPage) || !NumberUtil.isNumber(numPerPage)){
currentPage = 0; currentPage = 0;
numPerPage = 50; numPerPage = 50;
} }
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(keywordList, currentPage, numPerPage, adviserIds, Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getAdviserBooks4SeriesBook(seriesBook.getSeriesBookKeyword(), currentPage, numPerPage, adviserIds,
seriesBook.getAgentId(), subLabelId, graLabelId, seriesBook.getSerialNumber(), verLabelId, volLabelId); seriesBook.getAgentId(), subLabelId, graLabelId, seriesBook.getSerialNumber(), verLabelId, volLabelId);
List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent(); List<ESBookAndAdviser> esBookAndAdvisers = esPage.getContent();
if (ListUtils.isEmpty(esBookAndAdvisers)) { if (ListUtils.isEmpty(esBookAndAdvisers)) {
......
...@@ -8,9 +8,9 @@ import com.pcloud.book.book.dto.BookFundDto; ...@@ -8,9 +8,9 @@ import com.pcloud.book.book.dto.BookFundDto;
import com.pcloud.book.book.dto.BookTypeDto; import com.pcloud.book.book.dto.BookTypeDto;
import com.pcloud.book.consumer.book.elasticsearch.BookElasticSearchConsr; import com.pcloud.book.consumer.book.elasticsearch.BookElasticSearchConsr;
import com.pcloud.book.consumer.user.PartyConsr; import com.pcloud.book.consumer.user.PartyConsr;
import com.pcloud.book.elasticsearch7.entity.Es7Book; import com.pcloud.book.elasticsearch7.domain.dto.param.PlatformSearchDto;
import com.pcloud.book.elasticsearch7.entity.Es7BookFreeze; import com.pcloud.book.elasticsearch7.domain.entity.Es7Book;
import com.pcloud.book.elasticsearch7.search.domain.dto.param.PlatformSearchDto; import com.pcloud.book.elasticsearch7.domain.entity.Es7BookFreeze;
import com.pcloud.book.util.common.Converter; import com.pcloud.book.util.common.Converter;
import com.pcloud.common.core.constant.SystemCode; import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
......
...@@ -19,7 +19,7 @@ import com.pcloud.book.book.vo.request.BookQualifyInfoVO; ...@@ -19,7 +19,7 @@ import com.pcloud.book.book.vo.request.BookQualifyInfoVO;
import com.pcloud.book.book.vo.request.BookSearchParamVO; import com.pcloud.book.book.vo.request.BookSearchParamVO;
import com.pcloud.book.book.vo.request.SyncRelateDataToRaysVO; import com.pcloud.book.book.vo.request.SyncRelateDataToRaysVO;
import com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto; import com.pcloud.book.book.vo.request.UpdateBookRobotProcessDto;
import com.pcloud.book.elasticsearch7.search.domain.dto.param.PlatformSearchDto; import com.pcloud.book.elasticsearch7.domain.dto.param.PlatformSearchDto;
import com.pcloud.common.core.constant.SystemCode; import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
......
...@@ -23,10 +23,6 @@ public interface ESBookAndAdviserBiz { ...@@ -23,10 +23,6 @@ public interface ESBookAndAdviserBiz {
Page<ESBookAndAdviser> getESAdviserBooks4AppletV2(String grayStatus, String keyword, List<Long> templetIds, List<Long> graLabelIds, List<Long> subLabelIds, Integer currentPage, Integer numPerPage, List<Long> scecondTempletIds, List<Long> adviserIds, Long agentId); Page<ESBookAndAdviser> getESAdviserBooks4AppletV2(String grayStatus, String keyword, List<Long> templetIds, List<Long> graLabelIds, List<Long> subLabelIds, Integer currentPage, Integer numPerPage, List<Long> scecondTempletIds, List<Long> adviserIds, Long agentId);
void deleteAdviserBooks4ES();
void deleteChoosedAdviserBooks4ES(String keyword);
/** /**
* 答案,搜索全平台书刊 * 答案,搜索全平台书刊
* @author:zhuyajie * @author:zhuyajie
...@@ -40,14 +36,12 @@ public interface ESBookAndAdviserBiz { ...@@ -40,14 +36,12 @@ public interface ESBookAndAdviserBiz {
* @date:2020/11/23 17:26 * @date:2020/11/23 17:26
* * @param null * * @param null
*/ */
Page<ESBookAndAdviser> getAdviserBooks4SeriesBook(List<String> keywords, Integer currentPage, Integer numPerPage, List<Long> adviserIds, Long agentId, Long subLabelId, Long graLabelId, String serialNumber, Long verLabelId, Long volLabelId); Page<ESBookAndAdviser> getAdviserBooks4SeriesBook(String keyword, Integer currentPage, Integer numPerPage, List<Long> adviserIds, Long agentId, Long subLabelId, Long graLabelId, String serialNumber, Long verLabelId, Long volLabelId);
Map<String, Object> getNotFoundBookId(String lastBookId)throws Exception; Map<String, Object> getNotFoundBookId(String lastBookId)throws Exception;
void stopNotFoundBookId(); void stopNotFoundBookId();
void updateTempletId();
/** /**
* 查所有书刊,选中的在前 * 查所有书刊,选中的在前
* @author:zhuyajie * @author:zhuyajie
...@@ -56,8 +50,4 @@ public interface ESBookAndAdviserBiz { ...@@ -56,8 +50,4 @@ public interface ESBookAndAdviserBiz {
*/ */
Page<ESBookAndAdviser> getESBooksOrderByChose(String keyword, List<Long> choseBookIdList, Integer currentPage, Integer numPerPage); Page<ESBookAndAdviser> getESBooksOrderByChose(String keyword, List<Long> choseBookIdList, Integer currentPage, Integer numPerPage);
/**
* 获取编辑书刊列表(ERP项目用)
*/
Page<ESBookAndAdviser> getESBooks4Erp(String isbn, String uniqueNumber, List<String> listName, List<Long> adviserIdList, Integer currentPage, Integer numPerPage);
} }
package com.pcloud.book.es.entity; package com.pcloud.book.es.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
...@@ -18,14 +11,12 @@ import java.util.Date; ...@@ -18,14 +11,12 @@ import java.util.Date;
* @Date 2020/4/13 14:29 * @Date 2020/4/13 14:29
**/ **/
@Data @Data
@Document(indexName = "book", type = "book_and_adviser")
public class ESBookAndAdviser { public class ESBookAndAdviser {
/** /**
* 书籍标识 * 书籍标识
*/ */
@Id
private String bookId; private String bookId;
/** /**
...@@ -71,19 +62,16 @@ public class ESBookAndAdviser { ...@@ -71,19 +62,16 @@ public class ESBookAndAdviser {
/** /**
* 书籍ISBN码 * 书籍ISBN码
*/ */
@Field(type = FieldType.String, index = FieldIndex.not_analyzed)
private String isbn; private String isbn;
/** /**
* 书籍名称 * 书籍名称
*/ */
@Field(type = FieldType.String, index = FieldIndex.not_analyzed)
private String bookName; private String bookName;
/** /**
* 书籍名称,同上面bookName,ES按分词存储,主要用于分词搜索 * 书籍名称,同上面bookName,ES按分词存储,主要用于分词搜索
*/ */
@Field(type = FieldType.String, index = FieldIndex.analyzed, analyzer = "ik_max_word", searchAnalyzer = "ik_max_word")
private String ikBookName; private String ikBookName;
/** /**
...@@ -99,13 +87,11 @@ public class ESBookAndAdviser { ...@@ -99,13 +87,11 @@ public class ESBookAndAdviser {
/** /**
* 最后更新时间 * 最后更新时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date lastModifiedDate; private Date lastModifiedDate;
/** /**
* 编辑书创建时间 * 编辑书创建时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdDate; private Date createdDate;
/** /**
......
...@@ -57,15 +57,13 @@ public class ESBookAndAdviserFacade { ...@@ -57,15 +57,13 @@ public class ESBookAndAdviserFacade {
@ApiOperation("es中删除部分测试图书") @ApiOperation("es中删除部分测试图书")
@GetMapping("deleteAdviserBooks4ES") @GetMapping("deleteAdviserBooks4ES")
public ResponseDto<?> deleteAdviserBooks4ES() throws BizException { public ResponseDto<?> deleteAdviserBooks4ES() throws BizException {
esBookAndAdviserBiz.deleteAdviserBooks4ES(); throw new BizException("接口已下线 - deleteAdviserBooks4ES");
return new ResponseDto<>();
} }
@ApiOperation("es中删除选中图书") @ApiOperation("es中删除选中图书")
@GetMapping("deleteChoosedAdviserBooks4ES") @GetMapping("deleteChoosedAdviserBooks4ES")
public ResponseDto<?> deleteChoosedAdviserBooks4ES(@RequestParam(value = "keyword") String keyword) throws BizException { public ResponseDto<?> deleteChoosedAdviserBooks4ES(@RequestParam(value = "keyword") String keyword) throws BizException {
esBookAndAdviserBiz.deleteChoosedAdviserBooks4ES(keyword); throw new BizException("接口已下线 - deleteChoosedAdviserBooks4ES");
return new ResponseDto<>();
} }
@ApiOperation("查询ES有而BOOK表没有的书") @ApiOperation("查询ES有而BOOK表没有的书")
...@@ -84,10 +82,7 @@ public class ESBookAndAdviserFacade { ...@@ -84,10 +82,7 @@ public class ESBookAndAdviserFacade {
@ApiOperation("ES同步图书分类信息 - 慎点 参数为接口名") @ApiOperation("ES同步图书分类信息 - 慎点 参数为接口名")
@GetMapping("/syncBookAdviserTemplet4ES") @GetMapping("/syncBookAdviserTemplet4ES")
public ResponseDto<Void> syncBookAdviserTemplet4ES(@RequestParam("conten") String content){ public ResponseDto<Void> syncBookAdviserTemplet4ES(@RequestParam("conten") String content){
if (StrUtil.equals(content,"syncBookAdviserTemplet4ES")){ throw new BizException("接口已下线 - syncBookAdviserTemplet4ES");
esBookAndAdviserBiz.updateTempletId();
}
return new ResponseDto<>();
} }
@ApiOperation("更新es书刊") @ApiOperation("更新es书刊")
......
package com.pcloud.book.es.repository;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
public interface BookAndAdviserRepository extends ElasticsearchRepository<ESBookAndAdviser, String> {
}
...@@ -2,10 +2,16 @@ package com.pcloud.book.util.common; ...@@ -2,10 +2,16 @@ package com.pcloud.book.util.common;
import com.pcloud.book.book.dto.BookDto; import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.dto.BookFundDto; import com.pcloud.book.book.dto.BookFundDto;
import com.pcloud.book.elasticsearch7.entity.Es7Book; import com.pcloud.book.elasticsearch7.domain.entity.Es7Book;
import com.pcloud.book.elasticsearch7.entity.Es7BookFund; import com.pcloud.book.elasticsearch7.domain.entity.Es7BookFund;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.universe.commons.paging.Pagination;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.cglib.beans.BeanCopier; import org.springframework.cglib.beans.BeanCopier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
...@@ -38,4 +44,58 @@ public class Converter { ...@@ -38,4 +44,58 @@ public class Converter {
return dto; return dto;
} }
public static Page<ESBookAndAdviser> convert(Pagination<Es7Book> data) {
List<ESBookAndAdviser> list = new ArrayList<>();
data.getList().forEach(b -> {
ESBookAndAdviser ba = new ESBookAndAdviser();
ba.setFundBookValue(b.getFundBookValue());
ba.setIsMainEditor(b.getIsMainEditor());
ba.setCreatedDate(b.getCreatedDate());
ba.setLastModifiedDate(b.getLastModifiedDate());
// ba.setBookUserCount(b.getBookUserCount());
// ba.setHasAnswer(b.getHasAnswer());
ba.setIsApproval(BooleanUtils.toInteger(b.getIsApproval()));
ba.setIsFundSupport(BooleanUtils.toInteger(b.getIsFundSupport()));
ba.setJoinGroupType(b.getJoinGroupType());
ba.setResourceCount(b.getResourceCount());
// ba.setAreaLabelId(b.getAreaLabelId());
ba.setBookGroupId(b.getBookGroupId());
ba.setGraLabelId(int2Long(b.getAdviserGraLabelId()));
// ba.setRightsSettingId(b.getRightsSettingId());
ba.setSubLabelId(int2Long(b.getAdviserSubLabelId()));
ba.setVerLabelId(int2Long(b.getAdviserVerLabelId()));
ba.setVolLabelId(int2Long(b.getAdviserVolLabelId()));
ba.setAdviserId(long2String(b.getAdviserId()));
ba.setBookAdviserId(long2String(b.getBookAdviserId()));
ba.setBookId(long2String(b.getBookId()));
ba.setBookName(b.getBookName());
ba.setChannelId(long2String(b.getAdviserChannelId()));
ba.setIkBookName(b.getIkBookName());
ba.setIsAdviserBook(BooleanUtils.toString(b.getIsAdviserBook(), "1", "0"));
ba.setIsbn(b.getIsbn());
ba.setIsBookAdviserDelete(BooleanUtils.toString(b.getIsBookAdviserDelete(), "1", "0"));
ba.setIsBookDelete(BooleanUtils.toString(b.getIsDelete(), "1", "0"));
ba.setLabel1(b.getLabel1());
ba.setLabel2(b.getLabel2());
ba.setLabel3(b.getLabel3());
ba.setLabel4(b.getLabel4());
ba.setSecondTempletId(long2String(b.getAdviserSecondTempletId()));
ba.setSerialNumber(b.getSerialNumber());
ba.setTempletId(long2String(b.getAdviserTempletId()));
ba.setThirdTempletId(long2String(b.getAdviserThirdTempletId()));
ba.setTypeCode(b.getTypeCode());
list.add(ba);
});
return new PageImpl<>(list, new PageRequest(data.getCurrentPageIndex(), data.getPageSize()), data.getTotalCount());
}
private static String long2String(Long l) {
return l == null ? null : l.toString();
}
private static Long int2Long(Integer l) {
return l == null ? null : l.longValue();
}
} }
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