Commit 1afa0d1c by 裴大威

Merge branch 'feat-1002624' into 'master'

运营端书刊列表

See merge request rays/pcloud-book!573
parents 52a5514c 87de118e
......@@ -200,6 +200,10 @@ public class BookDto extends BaseDto {
* 资源列表
*/
private List<Object> resourceFiles;
/**
* 资源数量
*/
private Integer resourceCount;
/**
* 第一次扫描时间
......@@ -1671,6 +1675,14 @@ public class BookDto extends BaseDto {
this.hasRobotKeyword = hasRobotKeyword;
}
public Integer getResourceCount() {
return resourceCount;
}
public void setResourceCount(Integer resourceCount) {
this.resourceCount = resourceCount;
}
@Override
public String toString() {
return "BookDto{" +
......@@ -1710,6 +1722,7 @@ public class BookDto extends BaseDto {
", apps=" + apps +
", products=" + products +
", resourceFiles=" + resourceFiles +
", resourceCount=" + resourceCount +
", firstScanDate=" + firstScanDate +
", firstSceneName='" + firstSceneName + '\'' +
", issn='" + issn + '\'' +
......
......@@ -621,4 +621,10 @@ public interface BookBiz {
* 获取编辑书刊H5
*/
PageBeanNew<BookDto> getAdviserBooks4H5(String keyword, Long templetId, Long secondTempletId, Integer currentPage, Integer numPerPage);
/**
*运营端获取书刊及配置资源
*/
PageBeanNew<BookDto> getBookAndServeList4Channel(Integer currentPage, Integer numPerPage, Long channelId,String name,
Integer isFundSupport, String startDate, String endDate);
}
......@@ -45,6 +45,8 @@ import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.mq.producer.BookMQProducer;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.wechat.dto.BookServeParamVO;
import com.pcloud.channelcenter.wechat.vo.BookServeVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.AgentTypeEnum;
import com.pcloud.common.core.constant.SystemCode;
......@@ -1947,6 +1949,39 @@ public class BookBizImpl implements BookBiz {
return page;
}
@Override
public PageBeanNew<BookDto> getBookAndServeList4Channel(Integer currentPage, Integer numPerPage, Long channelId,String name,
Integer isFundSupport, String startDate, String endDate) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
paramMap.put("name", name);
paramMap.put("startDate", startDate);
paramMap.put("endDate", endDate);
paramMap.put("isFundSupport", isFundSupport);
PageBeanNew<BookDto> pageBeanNew = bookDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "getBookAndServeList4Channel");
if (null==pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>());
}
List<BookDto> bookDtos = pageBeanNew.getRecordList();
List<Long> adviserIds = bookDtos.stream().filter(s->s.getAdviserId()!=null).map(BookDto::getAdviserId).distinct().collect(Collectors.toList());
Map<Long, String> nameMap = adviserConsr.getNames(adviserIds);
for (BookDto bookDto : bookDtos){
if (!MapUtils.isEmpty(nameMap) && nameMap.containsKey(bookDto.getAdviserId())){
bookDto.setAdviserName(nameMap.get(bookDto.getAdviserId()));
}
BookServeParamVO bookServeParamVO = new BookServeParamVO();
bookServeParamVO.setChannelId(channelId);
bookServeParamVO.setAdviserId(bookDto.getAdviserId());
bookServeParamVO.setBookId(bookDto.getBookId());
List<BookServeVO> bookServeVOS = qrcodeSceneConsr.listBookServe(bookServeParamVO);
List<Object> objects = new ArrayList<>();
objects.addAll(bookServeVOS);
bookDto.setResourceFiles(objects);
bookDto.setResourceCount(bookServeVOS.size());
}
return pageBeanNew;
}
@ParamLog("填充书刊信息")
private void fillBookInfo(List<BookDto> list) {
if (ListUtils.isEmpty(list)){
......
......@@ -15,6 +15,7 @@ import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.*;
import org.codehaus.jackson.JsonParseException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.CookieValue;
......@@ -29,11 +30,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
* @描述:书籍接口
* @作者:songx
......@@ -704,4 +700,16 @@ public interface BookFacade {
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation(value = "根据渠道ID分页获取图书列表及配置资源列表", httpMethod = "GET")
@GetMapping("getBookAndServeList4Channel")
ResponseDto<?> getBookAndServeList4Channel(
@RequestHeader("token") String token,
@RequestParam(value = "currentPage") @ApiParam("当前页数") Integer currentPage,
@RequestParam(value = "numPerPage") @ApiParam("每页条数") Integer numPerPage,
@RequestParam(value = "name", required = false) @ApiParam("图书名称、isbn") String name,
@RequestParam(value = "isFundSupport", required = false) @ApiParam("只看基金支持") Integer isFundSupport,
@RequestParam(value = "startDate", required = false) @ApiParam("开始日期") String startDate,
@RequestParam(value = "endDate", required = false) @ApiParam("结束日期") String endDate
) throws PermissionException, JsonParseException, BizException;
}
......@@ -29,6 +29,7 @@ import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.enums.IsSystem;
import io.swagger.annotations.ApiOperation;
import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -961,4 +962,19 @@ public class BookFacadeImpl implements BookFacade {
return new ResponseDto<>();
}
@Override
@GetMapping("getBookAndServeList4Channel")
public ResponseDto<?> getBookAndServeList4Channel(
@RequestHeader("token") String token,
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate
) throws PermissionException, JsonParseException, BizException{
Long channelId = (Long) SessionUtil.getVlaue(token,SessionUtil.PARTY_ID);
PageBeanNew<BookDto> pageBean = bookBiz.getBookAndServeList4Channel(currentPage,numPerPage,channelId,name,isFundSupport,startDate,endDate);
return new ResponseDto<>(pageBean);
}
}
\ No newline at end of file
......@@ -12,9 +12,11 @@ import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrAskVO;
import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrVO;
import com.pcloud.channelcenter.qrcode.vo.BookAssocQRcountRequestVO;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.channelcenter.wechat.dto.BookServeParamVO;
import com.pcloud.channelcenter.wechat.dto.ListIsInBookParam;
import com.pcloud.channelcenter.wechat.service.AccountSettingService;
import com.pcloud.channelcenter.wechat.service.MessageService;
import com.pcloud.channelcenter.wechat.vo.BookServeVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
......@@ -339,4 +341,16 @@ public class QrcodeSceneConsr {
LOGGER.error("删除二维码失败" + e.getMessage(), e);
}
}
@ParamLog("获取书刊下所有服务")
public List<BookServeVO> listBookServe(BookServeParamVO bookServeParamVO){
List<BookServeVO> list = new ArrayList<>();
try {
list = ResponseHandleUtil.parseList(messageService.listBookServe(bookServeParamVO),BookServeVO.class);
}catch (Exception e){
LOGGER.error("调用messageService.listBookServe失败" + e.getMessage(), e);
}
return list;
}
}
......@@ -2141,4 +2141,37 @@
AND A.IS_MAIN_EDITOR = 1
limit 1
</select>
<select id="getBookAndServeList4Channel" resultMap="bookMap" parameterType="map">
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,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID,A.SECOND_TEMPLET_ID,A.LAST_MODIFIED_DATE LAST_MODIFIED_DATE,A.BOOK_ADVISER_ID,CONCAT('BK',A.BOOK_ID) uniqueNumber
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN BOOK_FUND BF
ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
WHERE
1=1
AND A.CHANNEL_ID = #{channelId}
AND A.IS_MAIN_EDITOR = 1
<if test="name != null">
AND (B.BOOK_NAME LIKE CONCAT('%',#{name},'%') OR B.ISBN LIKE CONCAT(#{name},'%'))
</if>
<if test="startDate!=null">
AND A.CREATED_DATE <![CDATA[ > ]]> #{startDate}
</if>
<if test="endDate!=null">
AND A.CREATED_DATE <![CDATA[ < ]]> #{endDate}
</if>
<if test="isFundSupport != null">
AND
bf.BOOK_FUND_ID IS NOT NULL
</if>
GROUP BY A.BOOK_ID, A.ADVISER_ID
ORDER BY
A.LAST_MODIFIED_DATE DESC
</select>
</mapper>
\ No newline at end of file
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