Commit b0c168fc by 田超

Merge branch 'kstore' into 'master'

feat:[none] 新增编辑端知识商城社群书获取接口

See merge request rays/pcloud-book!1539
parents cb24b852 56a6d2ab
......@@ -1093,4 +1093,13 @@ public interface BookGroupBiz {
*获取所有rays码
*/
PageBeanNew<BookGroupDTO> getAllRaysScene(Integer currentPage, Integer numPerPage);
/**
* 编辑端知识商城获取社群书列表
* @param adviserId
* @param param
* @return
*/
PageBeanNew<ListBook4ChannelVO> listBookGroup4AdviserKStore(Long adviserId, ListBookGroup4ChannelParamVO param);
}
......@@ -1410,6 +1410,54 @@ public class BookGroupBizImpl implements BookGroupBiz {
return new PageBeanNew<>(currentPage, numPerPage, totalCount, recordList);
}
@Override
public PageBeanNew<ListBook4ChannelVO> listBookGroup4AdviserKStore(Long adviserId, ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO) {
Integer currentPage = listBookGroup4ChannelParamVO.getCurrentPage();
Integer numPerPage = listBookGroup4ChannelParamVO.getNumPerPage();
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("keywords", listBookGroup4ChannelParamVO.getKeywords());
paramMap.put("isFundBook", listBookGroup4ChannelParamVO.getIsFundBook());
String startTime = listBookGroup4ChannelParamVO.getStartTime();
String endTime = listBookGroup4ChannelParamVO.getEndTime();
if (startTime != null) {
paramMap.put("startTime", startTime + " 00:00:00");
}
if (endTime != null) {
paramMap.put("endTime", endTime + " 23:59:59");
}
paramMap.put("offset", currentPage * numPerPage);
paramMap.put("limit", numPerPage);
Integer totalCount = bookMapper.countBookGroup4AdviserKStore(paramMap);
if (totalCount < 1) {
return new PageBeanNew(currentPage, numPerPage, new ArrayList<>());
}
List<ListBook4ChannelVO> recordList = bookMapper.listBookGroup4AdviserKStore(paramMap);
List<Long> bookGroupIds = recordList.stream().filter(x -> ObjectUtil.isAllNotEmpty(x, x.getBookGroupId())).map(ListBook4ChannelVO::getBookGroupId).distinct().collect(Collectors.toList());
if (ListUtils.isEmpty(bookGroupIds)) {
return new PageBeanNew(currentPage, numPerPage, new ArrayList<>());
}
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyDao.getClassifyCountAbout(bookGroupIds);
recordList.forEach(e -> {
if (!MapUtils.isEmpty(statisMap) && statisMap.containsKey(e.getBookGroupId())) {
BookGroupStatisticDTO dto = statisMap.get(e.getBookGroupId());
e.setClassifyNum(null != dto.getClassifyCount() ? dto.getClassifyCount().longValue() : 0L);
e.setTotalNum(null != dto.getUserNumber() ? dto.getUserNumber().longValue() : 0L);
} else {
e.setClassifyNum(0L);
e.setTotalNum(0L);
}
});
return new PageBeanNew<>(currentPage, numPerPage, totalCount, recordList);
}
/**
* 获取社群书列表(编辑)
*/
......@@ -6911,6 +6959,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
return bookGroupDao.listPageNew(new PageParam(currentPage, numPerPage), new HashMap<>(),"getAllRaysScene");
}
@Override
public List<BookGroupScanStatisticsRespDTO> getBookGroupScanStatistics(BookGroupScanStatisticsRequestDTO reqDTO) {
if (ObjectUtil.hasEmpty(reqDTO, reqDTO.getBookIds(), reqDTO.getAdviserIds(), reqDTO.getChannelIds(), reqDTO.getStart(), reqDTO.getEnd()))
......
......@@ -156,6 +156,15 @@ public interface BookGroupFacade {
ResponseDto<PageBeanNew<ListBook4ChannelVO>> listBookGroup4Channel(@RequestHeader("token") String token,
@RequestBody ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO)
throws BizException, PermissionException;
@ApiOperation(value = "获取社群书列表(编辑端知识商城)", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "listBookGroup4ChannelParamVO", value = "ListBookGroup4ChannelParamVO", dataType = "ListBookGroup4ChannelParamVO", paramType = "body")
})
@RequestMapping(value = "listBookGroup4AdviserKStore", method = RequestMethod.POST)
ResponseDto<PageBeanNew<ListBook4ChannelVO>> listBookGroup4AdviserKStore(@RequestHeader("token") String token,
@RequestBody ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO)
throws BizException, PermissionException;
@ApiOperation(value = "获取用户购买或者参与过的社群书信息", httpMethod = "GET")
@ApiImplicitParams({
......
......@@ -306,6 +306,13 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
@Override
public ResponseDto<PageBeanNew<ListBook4ChannelVO>> listBookGroup4AdviserKStore(String token, ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO) throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<ListBook4ChannelVO> pageBean = bookGroupBiz.listBookGroup4AdviserKStore(adviserId, listBookGroup4ChannelParamVO);
return new ResponseDto<>(pageBean);
}
@Override
@RequestMapping(value = "getUserBrowseGroup4KnowLedgeMall", method = RequestMethod.GET)
public ResponseDto<?> getUserBrowseGroup4KnowLedgeMall( @CookieValue("userInfo") String userInfo,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
......
......@@ -19,4 +19,8 @@ public interface BookMapper {
List<BookScanCountDto>getBookScanCounts(@Param("list") List<Long>bookIds);
Integer countBookGroup4AdviserKStore(Map<String, Object> paramMap);
List<ListBook4ChannelVO> listBookGroup4AdviserKStore(Map<String,Object> params);
}
......@@ -73,5 +73,62 @@
WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
</if>
</select>
<select id="countBookGroup4AdviserKStore" resultType="java.lang.Integer">
SELECT uniqExact(b.BOOK_ID)
FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME
FROM book
WHERE IS_DELETE = 0
AND BOOK_NAME NOT LIKE concat('%', '红榜', '%')
AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1)
AND CHAR_LENGTH(BOOK_NAME) >= 8
) b
JOIN ( SELECT id, book_id, create_time, group_qrcode_name
FROM book_group
WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0)
AND is_delete = 0
<if test="adviserId != null"> AND create_user = ${adviserId} </if>
<if test="startTime != null "> AND create_time &gt;= #{startTime} </if>
<if test="endTime != null "> AND create_time &lt;= #{endTime} </if>
<if test="isFundBook != null and isFundBook == 1">
AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME &lt; now() AND START_TIME > now())
</if>
) bg ON b.BOOK_ID = bg.book_id
<if test="keywords != null">
WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
</if>
</select>
<select id="listBookGroup4AdviserKStore" resultType="com.pcloud.book.group.vo.ListBook4ChannelVO" parameterType="map">
SELECT b.BOOK_ID bookId,
any(b.COVER_IMG) coverImg,
any(bg.id) bookGroupId,
any(b.ISBN) isbn,
any(b.BOOK_NAME) bookName,
any(concat('BK', toString(b.BOOK_ID))) bookNumber
FROM (SELECT BOOK_ID, COVER_IMG, ISBN, BOOK_NAME
FROM book
WHERE IS_DELETE = 0
AND BOOK_NAME NOT LIKE concat('%', '红榜', '%')
AND BOOK_ID IN (SELECT toInt64(BOOK_ID) FROM book_adviser WHERE IS_PRINT = 1)
AND CHAR_LENGTH(BOOK_NAME) >= 8
) b
JOIN ( SELECT id, book_id, create_time, group_qrcode_name
FROM book_group
WHERE id IN (SELECT toInt64(book_group_id) FROM book_group_classify WHERE is_delete = 0)
AND is_delete = 0
<if test="adviserId != null"> AND create_user = ${adviserId} </if>
<if test="startTime != null "> AND create_time &gt;= #{startTime} </if>
<if test="endTime != null "> AND create_time &lt;= #{endTime} </if>
<if test="isFundBook != null and isFundBook == 1">
AND book_id IN (SELECT BOOK_ID FROM book_fund WHERE END_TIME &lt; now() AND START_TIME > now())
</if>
) bg ON b.BOOK_ID = bg.book_id
<if test="keywords != null">
WHERE b.ISBN like concat('%',#{keywords},'%') OR b.BOOK_NAME like concat('%',#{keywords},'%') OR bg.group_qrcode_name like concat('%',#{keywords},'%')
</if>
GROUP BY b.BOOK_ID
ORDER BY b.BOOK_ID DESC
LIMIT ${offset}, ${limit}
</select>
</mapper>
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