Commit 4bf4472e by 田超

Merge branch 'erpIn' into 'master'

feat:[none]ERP优化接口

See merge request rays/pcloud-book!1359
parents 11f24611 3b52b6a1
...@@ -1028,22 +1028,18 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1028,22 +1028,18 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
@ParamLog("获取编辑书刊列表(ERP项目用)") @ParamLog("获取编辑书刊列表(ERP项目用)")
public PageBeanNew<ErpAdviserBookVO> listAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, Long agentId, Integer currentPage, Integer numPerPage) { public PageBeanNew<ErpAdviserBookVO> listAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, Long agentId, Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
List<String> listName=new ArrayList<>();
if(!StringUtil.isEmpty(isbn)){ if(!StringUtil.isEmpty(isbn)){
String [] nameList = isbn.trim().split("[\u00A0|\u3000|\u0020]"); String [] nameList = isbn.trim().split("[\u00A0|\u3000|\u0020]");
listName=Lists.newArrayList(nameList);
paramMap.put("nameList", Lists.newArrayList(nameList)); paramMap.put("nameList", Lists.newArrayList(nameList));
} }
paramMap.put("isbn", isbn); paramMap.put("isbn", isbn);
paramMap.put("uniqueNumber", uniqueNumber); paramMap.put("uniqueNumber", uniqueNumber);
List<Long> adviserIdList=new ArrayList<>();
if(!StringUtil.isEmpty(adviserName)) { if(!StringUtil.isEmpty(adviserName)) {
List<Long> adviserIds = adviserConsr.getAdviserIdsByName(adviserName); List<Long> adviserIds = adviserConsr.getAdviserIdsByName(adviserName);
if(CollectionUtils.isEmpty(adviserIds)) { if(CollectionUtils.isEmpty(adviserIds)) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
} }
paramMap.put("adviserIds", adviserIds); paramMap.put("adviserIds", adviserIds);
adviserIdList=adviserIds;
} }
if(agentId != null && agentId > 0){ if(agentId != null && agentId > 0){
...@@ -1054,22 +1050,12 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1054,22 +1050,12 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
if(paramMap.containsKey("adviserIds")){ if(paramMap.containsKey("adviserIds")){
List<Long> adviserIds = (List<Long>)paramMap.get("adviserIds"); List<Long> adviserIds = (List<Long>)paramMap.get("adviserIds");
adviserIds.retainAll(allAdvisers4Agent); adviserIds.retainAll(allAdvisers4Agent);
adviserIdList=adviserIds;
} else { } else {
paramMap.put("adviserIds", allAdvisers4Agent); paramMap.put("adviserIds", allAdvisers4Agent);
adviserIdList=allAdvisers4Agent;
} }
} }
PageBeanNew<ErpAdviserBookVO> pageBeanNew = bookAdviserDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAdviserBook4Erp"); PageBeanNew<ErpAdviserBookVO> pageBeanNew = bookAdviserDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAdviserBook4Erp");
// Page<ESBookAndAdviser> page= esBookAndAdviserBiz.getESBooks4Erp(isbn,uniqueNumber, listName,adviserIdList,currentPage,numPerPage);
/*if(null==page){
return new PageBeanNew<>(currentPage, numPerPage,0, new ArrayList<>());
}
if(CollUtil.isEmpty(page.getContent())){
return new PageBeanNew<>(currentPage, numPerPage,Long.valueOf(page.getTotalElements()).intValue(), new ArrayList<>());
}
List<ESBookAndAdviser> esBookAndAdvisers = page.getContent();
List<ErpAdviserBookVO> bookVOS = changeToErpBookVO(esBookAndAdvisers);*/
if(null==pageBeanNew || CollUtil.isEmpty(pageBeanNew.getRecordList())){ if(null==pageBeanNew || CollUtil.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage, numPerPage,null==pageBeanNew ? 0 : pageBeanNew.getTotalCount(), new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage,null==pageBeanNew ? 0 : pageBeanNew.getTotalCount(), new ArrayList<>());
} }
...@@ -1090,7 +1076,6 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1090,7 +1076,6 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
Map<Long, UserLogin> userLoginInfoMap= new HashMap<>(); Map<Long, UserLogin> userLoginInfoMap= new HashMap<>();
Map<Long, AdviserBaseInfoDto> adviserAgentMap = new HashMap<>(); Map<Long, AdviserBaseInfoDto> adviserAgentMap = new HashMap<>();
Map<Long, String> channelNameMap = new HashMap<>(); Map<Long, String> channelNameMap = new HashMap<>();
Map<Long, BookDto> bookDtoMapMap = new HashMap<>();
CompletableFuture<Map<Long, UserLogin>> userLoginInfoMapFuture=CompletableFuture.supplyAsync(()->{ CompletableFuture<Map<Long, UserLogin>> userLoginInfoMapFuture=CompletableFuture.supplyAsync(()->{
return adviserConsr.getUserLoginInfoList(adviserIds); return adviserConsr.getUserLoginInfoList(adviserIds);
},ThreadPoolUtils.OTHER_THREAD_POOL); },ThreadPoolUtils.OTHER_THREAD_POOL);
...@@ -1100,15 +1085,11 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1100,15 +1085,11 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
CompletableFuture<Map<Long, String>> channelNameMapFuture=CompletableFuture.supplyAsync(()->{ CompletableFuture<Map<Long, String>> channelNameMapFuture=CompletableFuture.supplyAsync(()->{
return channelConsr.getNamesByIdList(channelIds); return channelConsr.getNamesByIdList(channelIds);
},ThreadPoolUtils.OTHER_THREAD_POOL); },ThreadPoolUtils.OTHER_THREAD_POOL);
CompletableFuture<Map<Long, BookDto>> bookDtoMapFuture=CompletableFuture.supplyAsync(()->{ CompletableFuture.allOf(userLoginInfoMapFuture, adviserAgentMapFuture,channelNameMapFuture);
return bookBiz.listBaseByIds(bookIds);
},ThreadPoolUtils.OTHER_THREAD_POOL);
CompletableFuture.allOf(userLoginInfoMapFuture, adviserAgentMapFuture,channelNameMapFuture,bookDtoMapFuture);
try{ try{
userLoginInfoMap=userLoginInfoMapFuture.get(10,TimeUnit.SECONDS); userLoginInfoMap=userLoginInfoMapFuture.get(10,TimeUnit.SECONDS);
adviserAgentMap=adviserAgentMapFuture.get(10,TimeUnit.SECONDS); adviserAgentMap=adviserAgentMapFuture.get(10,TimeUnit.SECONDS);
channelNameMap=channelNameMapFuture.get(10,TimeUnit.SECONDS); channelNameMap=channelNameMapFuture.get(10,TimeUnit.SECONDS);
bookDtoMapMap=bookDtoMapFuture.get(10,TimeUnit.SECONDS);
} catch (InterruptedException | TimeoutException | ExecutionException e) { } catch (InterruptedException | TimeoutException | ExecutionException e) {
LOGGER.error("[exportMonthReport] 并行导出word失败! err:{}", e.getMessage(), e); LOGGER.error("[exportMonthReport] 并行导出word失败! err:{}", e.getMessage(), e);
} }
...@@ -1129,17 +1110,12 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1129,17 +1110,12 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
if(bookVO.getChannelId() != null && MapUtils.isNotEmpty(channelNameMap) && channelNameMap.containsKey(bookVO.getChannelId())) { if(bookVO.getChannelId() != null && MapUtils.isNotEmpty(channelNameMap) && channelNameMap.containsKey(bookVO.getChannelId())) {
bookVO.setChannelName(channelNameMap.get(bookVO.getChannelId())); bookVO.setChannelName(channelNameMap.get(bookVO.getChannelId()));
} }
if(bookVO.getBookId() != null && MapUtils.isNotEmpty(bookDtoMapMap) && bookDtoMapMap.containsKey(bookVO.getBookId())) {
BookDto bookDto = bookDtoMapMap.get(bookVO.getBookId());
bookVO.setCoverImg(Optional.ofNullable(bookDto).map(a->a.getCoverImg()).orElse(null));
}
bookVO.setIsFundSupport(false); bookVO.setIsFundSupport(false);
if(!ListUtils.isEmpty(list) && list.contains(bookVO.getBookId())) { if(!ListUtils.isEmpty(list) && list.contains(bookVO.getBookId())) {
bookVO.setIsFundSupport(true); bookVO.setIsFundSupport(true);
} }
} }
} }
//return new PageBeanNew<>(currentPage, numPerPage, (int) page.getTotalElements(), bookVOS);
return new PageBeanNew<>(currentPage, numPerPage, pageBeanNew.getTotalCount(), bookVOS); return new PageBeanNew<>(currentPage, numPerPage, pageBeanNew.getTotalCount(), bookVOS);
} }
......
...@@ -632,7 +632,7 @@ ...@@ -632,7 +632,7 @@
) )
</if> </if>
<if test="uniqueNumber != null"> <if test="uniqueNumber != null">
AND CONCAT('BK', ba.BOOK_ID) LIKE CONCAT('%', #{uniqueNumber}, '%') AND ba.BOOK_ID= REPLACE(#{uniqueNumber},"BK","")
</if> </if>
<if test="adviserIds != null and adviserIds.size() > 0"> <if test="adviserIds != null and adviserIds.size() > 0">
AND ba.ADVISER_ID IN AND ba.ADVISER_ID IN
...@@ -640,8 +640,6 @@ ...@@ -640,8 +640,6 @@
${item} ${item}
</foreach> </foreach>
</if> </if>
GROUP BY
ba.BOOK_ADVISER_ID
ORDER BY ORDER BY
ba.CREATED_DATE DESC ba.CREATED_DATE DESC
</select> </select>
......
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