Commit 2398c73f by 郑勇

feat: [1005149] 出版端书刊管理新增按时间筛选并导出

parent 84544f04
...@@ -804,4 +804,6 @@ public interface BookBiz { ...@@ -804,4 +804,6 @@ public interface BookBiz {
* * @param null * * @param null
*/ */
PageBean listAdviserBook(AviserBookInfoParam aviserBookInfoParam); PageBean listAdviserBook(AviserBookInfoParam aviserBookInfoParam);
void exportListPage4Agent(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode);
} }
...@@ -1308,6 +1308,49 @@ public class BookBizImpl implements BookBiz { ...@@ -1308,6 +1308,49 @@ public class BookBizImpl implements BookBiz {
return pageBean; return pageBean;
} }
@Override
public void exportListPage4Agent(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode) {
LOGGER.info("书刊列表-出版端,<START>.[paramMap]=" + paramMap + ",agentId" + agentId);
List<Long> adviserIds = adviserConsr.getIdsByNameAndAgentId(agentId, (String) paramMap.get("bookName"));
List<Long> agent4AdviserIds = adviserConsr.getIdsByNameAndAgentId(agentId, null);
paramMap.put("adviserIds", adviserIds);
paramMap.put("agent4AdviserIds", agent4AdviserIds);
if (ListUtils.isEmpty(agent4AdviserIds)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "列表为空!");
}
List<BookDto> list = bookDao.listPage4Agent(paramMap);
if(CollUtil.isEmpty(list)){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "列表为空!");
}
if(list.size()>1500){
throw new ExportException(ExportException.OPERATE_ERROR, "数量超过限制,请添加条件再导出!");
}
ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> {
try{
List<Object[]> dataList = new ArrayList<>();
for (int i = 0, size = list.size(); i < size; i++) {
BookDto bookDto = list.get(i);
Object[] obj = new Object[5];
obj[0] = i + 1;
obj[1] = bookDto.getBookName();
obj[2] = bookDto.getIsbn();
obj[3] = bookDto.getBookId();
obj[4] = null!=bookDto.getCreatedDate() ? DateUtils.getStrFormTime("yyyy-MM-dd HH:mm:ss", bookDto.getCreatedDate()) : null;
dataList.add(obj);
}
Date date = new Date();
String[] rowsName = {"序号", "书刊名称", "书刊号", "书刊ID", "创建时间"};
String fileName = "书刊管理书刊列表--" + DateUtils.getStrFormTime("yyyyMMdd", date);
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
String letterType = "book_download";
String content = String.format("{\"commitTime\":\"%s\",\"type\":\"%s\"}", DateUtils.formatDate(date), fileName);
messageConsr.sendLetter(partyId, partyId, content, systemCode, letterType, fileUrl, fileName);
}catch (Exception e) {
LOGGER.error("exportListPage4Agent+++paramMap=" + paramMap.toString() + "systemCode=" + systemCode + "partyId=" + partyId);
}
});
}
/** /**
* 获取应用关联图书 * 获取应用关联图书
*/ */
......
...@@ -384,4 +384,6 @@ public interface BookDao extends BaseDao<Book> { ...@@ -384,4 +384,6 @@ public interface BookDao extends BaseDao<Book> {
Integer getBookCountByAdviserId(Long adviserId); Integer getBookCountByAdviserId(Long adviserId);
boolean checkIsBookId(Long isbnNumber); boolean checkIsBookId(Long isbnNumber);
List<BookDto> listPage4Agent(Map<String, Object> paramMap);
} }
...@@ -465,4 +465,9 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao { ...@@ -465,4 +465,9 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
public boolean checkIsBookId(Long isbnNumber) { public boolean checkIsBookId(Long isbnNumber) {
return getSessionTemplate().selectOne(getStatement("checkIsBookId"), isbnNumber); return getSessionTemplate().selectOne(getStatement("checkIsBookId"), isbnNumber);
} }
@Override
public List<BookDto> listPage4Agent(Map<String, Object> paramMap) {
return getSessionTemplate().selectList(getStatement("listPage4Agent"), paramMap);
}
} }
...@@ -422,7 +422,9 @@ public interface BookFacade { ...@@ -422,7 +422,9 @@ public interface BookFacade {
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId, @RequestParam(value = "secondTempletId", required = false) Long secondTempletId,
@RequestParam(value = "thirdTempletId", required = false) Long thirdTempletId, @RequestParam(value = "thirdTempletId", required = false) Long thirdTempletId,
@RequestParam(value = "isPrint", required = false) Boolean isPrint, @RequestParam(value = "isPrint", required = false) Boolean isPrint,
@RequestParam(value = "minimumSupport", required = false) Integer minimumSupport) @RequestParam(value = "minimumSupport", required = false) Integer minimumSupport,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime)
throws BizException, PermissionException, JsonParseException; throws BizException, PermissionException, JsonParseException;
/** /**
......
...@@ -561,7 +561,9 @@ public class BookFacadeImpl implements BookFacade { ...@@ -561,7 +561,9 @@ public class BookFacadeImpl implements BookFacade {
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId, @RequestParam(value = "secondTempletId", required = false) Long secondTempletId,
@RequestParam(value = "thirdTempletId", required = false) Long thirdTempletId, @RequestParam(value = "thirdTempletId", required = false) Long thirdTempletId,
@RequestParam(value = "isPrint", required = false) Boolean isPrint, @RequestParam(value = "isPrint", required = false) Boolean isPrint,
@RequestParam(value = "minimumSupport", required = false) Integer minimumSupport) @RequestParam(value = "minimumSupport", required = false) Integer minimumSupport,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime)
throws BizException, PermissionException { throws BizException, PermissionException {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage < 0 || numPerPage < 0) { if (currentPage < 0 || numPerPage < 0) {
...@@ -586,11 +588,66 @@ public class BookFacadeImpl implements BookFacade { ...@@ -586,11 +588,66 @@ public class BookFacadeImpl implements BookFacade {
paramMap.put("thirdTempletIds", Optional.ofNullable(paramMap.get("thirdTempletId")).map(Lists::newArrayList).orElse(Lists.newArrayList())); paramMap.put("thirdTempletIds", Optional.ofNullable(paramMap.get("thirdTempletId")).map(Lists::newArrayList).orElse(Lists.newArrayList()));
paramMap.put("isPrint", isPrint); paramMap.put("isPrint", isPrint);
paramMap.put("minimumSupport", minimumSupport); paramMap.put("minimumSupport", minimumSupport);
paramMap.put("startTime", StringUtil.isBlank(startTime) ? null : startTime);
paramMap.put("endTime", StringUtil.isBlank(endTime) ? null : endTime);
return new ResponseDto<>( return new ResponseDto<>(
bookBiz.listPage4Agent(new PageParam(currentPage, numPerPage), paramMap, agentId)); bookBiz.listPage4Agent(new PageParam(currentPage, numPerPage), paramMap, agentId));
} }
/** /**
* 书刊列表导出-出版端
*/
@RequestMapping(value = "exportListPage4Agent", method = RequestMethod.GET)
public ResponseDto<PageBean> exportListPage4Agent( @RequestHeader("token") String token,
@RequestParam(value = "bookName", required = false) String bookName,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "mainEditorName", required = false) String mainEditorName,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "isbn", required = false) String isbn,
@RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId,
@RequestParam(value = "thirdTempletId", required = false) Long thirdTempletId,
@RequestParam(value = "isPrint", required = false) Boolean isPrint,
@RequestParam(value = "minimumSupport", required = false) Integer minimumSupport,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime)
throws BizException, PermissionException {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
if (IsSystem.NOT_SYSTEM.code.equals(isSystem)) {
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
}
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookName", bookName != null && "".equals(bookName.trim()) ? null : bookName);
if(!StringUtil.isEmpty(bookName)){
String [] nameList = bookName.trim().split("[\u00A0|\u3000|\u0020]");
paramMap.put("nameList", Lists.newArrayList(nameList));
}
paramMap.put("channelId", channelId);
paramMap.put("typeCode", typeCode != null && "".equals(typeCode.trim()) ? null : typeCode);
paramMap.put("mainEditorName",
mainEditorName != null && "".equals(mainEditorName.trim()) ? null : mainEditorName);
paramMap.put("isFundSupport", isFundSupport);
paramMap.put("isbn", isbn);
paramMap.put("templetId", templetId);
paramMap.put("secondTempletId", secondTempletId);
paramMap.put("secondTempletIds", Optional.ofNullable(paramMap.get("secondTempletId")).map(Lists::newArrayList).orElse(Lists.newArrayList()));
paramMap.put("thirdTempletId", thirdTempletId);
paramMap.put("thirdTempletIds", Optional.ofNullable(paramMap.get("thirdTempletId")).map(Lists::newArrayList).orElse(Lists.newArrayList()));
paramMap.put("isPrint", isPrint);
paramMap.put("minimumSupport", minimumSupport);
paramMap.put("startTime", StringUtil.isBlank(startTime) ? null : startTime);
paramMap.put("endTime", StringUtil.isBlank(endTime) ? null : endTime);
bookBiz.exportListPage4Agent(paramMap, agentId,partyId,systemCode);
return new ResponseDto<>();
}
/**
* 获取编辑书刊列表-(APP编辑) * 获取编辑书刊列表-(APP编辑)
*/ */
@Override @Override
......
...@@ -1241,7 +1241,7 @@ ...@@ -1241,7 +1241,7 @@
SELECT SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK, A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER, B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT, A.TEMPLET_ID, A.IS_PRINT isPrint, IF(ISNULL(s.id),0,1) minimumSupport IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT, A.TEMPLET_ID, A.IS_PRINT isPrint, IF(ISNULL(s.id),0,1) minimumSupport,B.CREATED_DATE
FROM FROM
BOOK_ADVISER A BOOK_ADVISER A
INNER JOIN INNER JOIN
...@@ -1325,6 +1325,9 @@ ...@@ -1325,6 +1325,9 @@
<if test="minimumSupport != null"> <if test="minimumSupport != null">
AND s.id is NOT NULL AND s.id is NOT NULL
</if> </if>
<if test="startTime!=null and endTime!=null">
and b.CREATED_DATE between #{startTime} and #{endTime}
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY ORDER BY
A.CREATED_DATE DESC A.CREATED_DATE DESC
......
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