Commit fbb45b7c by 郑永强

feat: [1004065] 手动关联RAYS书刊新增出版社筛选

parent 9e186615
...@@ -207,7 +207,7 @@ public interface BookAdviserBiz { ...@@ -207,7 +207,7 @@ public interface BookAdviserBiz {
void refactorData(Long parentId,Long originTempletId, Long secondTempletId); void refactorData(Long parentId,Long originTempletId, Long secondTempletId);
PageBeanNew<ErpAdviserBookVO> listAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, Integer currentPage, Integer numPerPage); PageBeanNew<ErpAdviserBookVO> listAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, Long agentId, Integer currentPage, Integer numPerPage);
/** /**
* 设置书刊是否已下印状态 * 设置书刊是否已下印状态
...@@ -312,5 +312,5 @@ public interface BookAdviserBiz { ...@@ -312,5 +312,5 @@ public interface BookAdviserBiz {
/** /**
* 导出编辑书刊列表(ERP项目用) * 导出编辑书刊列表(ERP项目用)
*/ */
Map<String,Object> exportAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName); Map<String,Object> exportAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, Long agentId);
} }
...@@ -895,7 +895,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -895,7 +895,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
@Override @Override
@ParamLog("获取编辑书刊列表(ERP项目用)") @ParamLog("获取编辑书刊列表(ERP项目用)")
public PageBeanNew<ErpAdviserBookVO> listAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, 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<>();
paramMap.put("isbn", isbn); paramMap.put("isbn", isbn);
paramMap.put("uniqueNumber", uniqueNumber); paramMap.put("uniqueNumber", uniqueNumber);
...@@ -906,6 +906,19 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -906,6 +906,19 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
paramMap.put("adviserIds", adviserIds); paramMap.put("adviserIds", adviserIds);
} }
if(agentId != null && agentId > 0){
List<Long> allAdvisers4Agent = adviserConsr.getByAgentId(agentId);
if(CollectionUtils.isEmpty(allAdvisers4Agent)) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
}
if(paramMap.containsKey("adviserIds")){
List<Long> adviserIds = (List<Long>)paramMap.get("adviserIds");
adviserIds.retainAll(allAdvisers4Agent);
} else {
paramMap.put("adviserIds", allAdvisers4Agent);
}
}
PageBeanNew<ErpAdviserBookVO> pageBeanNew = bookAdviserDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAdviserBook4Erp"); PageBeanNew<ErpAdviserBookVO> pageBeanNew = bookAdviserDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listAdviserBook4Erp");
List<ErpAdviserBookVO> bookVOS = pageBeanNew.getRecordList(); List<ErpAdviserBookVO> bookVOS = pageBeanNew.getRecordList();
if(!CollectionUtils.isEmpty(bookVOS)) { if(!CollectionUtils.isEmpty(bookVOS)) {
...@@ -1985,8 +1998,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1985,8 +1998,8 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
* 导出编辑书刊列表(ERP项目用) * 导出编辑书刊列表(ERP项目用)
*/ */
@Override @Override
public Map<String, Object> exportAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName) { public Map<String, Object> exportAdviserBook4Erp(String isbn, String uniqueNumber, String adviserName, Long agentId) {
if(StringUtils.isBlank(isbn) && StringUtils.isBlank(uniqueNumber) && StringUtils.isBlank(adviserName)){ if(StringUtils.isBlank(isbn) && StringUtils.isBlank(uniqueNumber) && StringUtils.isBlank(adviserName) && !NumberUtil.isNumber(agentId)){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请筛选后再下载!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "请筛选后再下载!");
} }
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
...@@ -1999,18 +2012,27 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -1999,18 +2012,27 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
paramMap.put("adviserIds", adviserIds); paramMap.put("adviserIds", adviserIds);
} }
if(agentId != null && agentId > 0){
List<Long> allAdvisers4Agent = adviserConsr.getByAgentId(agentId);
if(CollectionUtils.isEmpty(allAdvisers4Agent)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前列表为空,请重新筛选再下载!");
}
if(paramMap.containsKey("adviserIds")){
List<Long> adviserIds = (List<Long>)paramMap.get("adviserIds");
adviserIds.retainAll(allAdvisers4Agent);
} else {
paramMap.put("adviserIds", allAdvisers4Agent);
}
}
List<ErpAdviserBookVO> bookVOS = bookAdviserDao.listAdviserBook4Erp(paramMap); List<ErpAdviserBookVO> bookVOS = bookAdviserDao.listAdviserBook4Erp(paramMap);
if(ListUtils.isEmpty(bookVOS)){ if(ListUtils.isEmpty(bookVOS)){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前列表为空,请重新筛选再下载!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前列表为空,请重新筛选再下载!");
} }
List<CompletableFuture<Boolean>> futures = new ArrayList(); List<CompletableFuture<Boolean>> futures = new ArrayList();
for (int i = 0; i <= bookVOS.size() / 100; i++) {
int beginIndex = i * 100; int limitNumber = 100;
int endIndex = beginIndex + 100; for (int i = 0; i < (bookVOS.size() % limitNumber == 0 ? bookVOS.size() / limitNumber : bookVOS.size() / limitNumber + 1); i++) {
if (i == (bookVOS.size() - 1)/100){ List<ErpAdviserBookVO> bookVOList = bookVOS.stream().skip(i * limitNumber).limit(limitNumber).collect(Collectors.toList());
endIndex = bookVOS.size();
}
List<ErpAdviserBookVO> bookVOList = bookVOS.subList(beginIndex, endIndex);
futures.add(CompletableFuture.supplyAsync(() -> { futures.add(CompletableFuture.supplyAsync(() -> {
this.setBookInfo4Erp(bookVOList); this.setBookInfo4Erp(bookVOList);
return true; return true;
......
...@@ -209,12 +209,14 @@ public interface BookAdviserFacade { ...@@ -209,12 +209,14 @@ public interface BookAdviserFacade {
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"), @ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "isbn", value = "isbn", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "isbn", value = "isbn", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "uniqueNumber", value = "uniqueNumber", dataType = "string", paramType = "query"), @ApiImplicitParam(name = "uniqueNumber", value = "uniqueNumber", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "adviserName", value = "adviserName", dataType = "string", paramType = "query")}) @ApiImplicitParam(name = "adviserName", value = "adviserName", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "agentId", value = "agentId", dataType = "long", paramType = "query")})
@RequestMapping(value = "listAdviserBook4Erp", method = RequestMethod.GET) @RequestMapping(value = "listAdviserBook4Erp", method = RequestMethod.GET)
ResponseDto<?> listAdviserBook4Erp(@RequestHeader("token") String token, ResponseDto<?> listAdviserBook4Erp(@RequestHeader("token") String token,
@RequestParam(value = "isbn", required = false) String isbn, @RequestParam(value = "isbn", required = false) String isbn,
@RequestParam(value = "uniqueNumber", required = false) String uniqueNumber, @RequestParam(value = "uniqueNumber", required = false) String uniqueNumber,
@RequestParam(value = "adviserName", required = false) String adviserName, @RequestParam(value = "adviserName", required = false) String adviserName,
@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "currentPage") Integer currentPage, @RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) @RequestParam(value = "numPerPage") Integer numPerPage)
throws PermissionException, JsonParseException, BizException; throws PermissionException, JsonParseException, BizException;
......
...@@ -198,10 +198,11 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade { ...@@ -198,10 +198,11 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
@RequestParam(value = "isbn", required = false) String isbn, @RequestParam(value = "isbn", required = false) String isbn,
@RequestParam(value = "uniqueNumber", required = false) String uniqueNumber, @RequestParam(value = "uniqueNumber", required = false) String uniqueNumber,
@RequestParam(value = "adviserName", required = false) String adviserName, @RequestParam(value = "adviserName", required = false) String adviserName,
@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "currentPage") Integer currentPage, @RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) @RequestParam(value = "numPerPage") Integer numPerPage)
throws PermissionException, JsonParseException, BizException { throws PermissionException, JsonParseException, BizException {
return new ResponseDto<>(bookAdviserBiz.listAdviserBook4Erp(isbn, uniqueNumber, adviserName, currentPage, numPerPage)); return new ResponseDto<>(bookAdviserBiz.listAdviserBook4Erp(isbn, uniqueNumber, adviserName, agentId, currentPage, numPerPage));
} }
/** /**
...@@ -211,9 +212,10 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade { ...@@ -211,9 +212,10 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
public ResponseDto<?> exportAdviserBook4Erp(@RequestHeader("token") String token, public ResponseDto<?> exportAdviserBook4Erp(@RequestHeader("token") String token,
@RequestParam(value = "isbn", required = false) String isbn, @RequestParam(value = "isbn", required = false) String isbn,
@RequestParam(value = "uniqueNumber", required = false) String uniqueNumber, @RequestParam(value = "uniqueNumber", required = false) String uniqueNumber,
@RequestParam(value = "adviserName", required = false) String adviserName) @RequestParam(value = "adviserName", required = false) String adviserName,
@RequestParam(value = "agentId", required = false) Long agentId)
throws PermissionException, JsonParseException, BizException { throws PermissionException, JsonParseException, BizException {
return new ResponseDto<>(bookAdviserBiz.exportAdviserBook4Erp(isbn, uniqueNumber, adviserName)); return new ResponseDto<>(bookAdviserBiz.exportAdviserBook4Erp(isbn, uniqueNumber, adviserName, agentId));
} }
@Override @Override
......
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