Commit d6792782 by 田超

Merge branch 'feature/1004401' into 'master'

feat: [1004401] ERP关联RAYS书刊信息展示、配置资源跳转交互优化

See merge request rays/pcloud-book!1222
parents 4b4fb3f4 5b4a7cb3
...@@ -786,6 +786,19 @@ public class BookDto extends BaseDto { ...@@ -786,6 +786,19 @@ public class BookDto extends BaseDto {
*/ */
private Integer isSendMiniUrl; private Integer isSendMiniUrl;
/**
*是否小睿教育书
*/
private Boolean xiaoRuiEducation;
public Boolean getXiaoRuiEducation() {
return xiaoRuiEducation;
}
public void setXiaoRuiEducation(Boolean xiaoRuiEducation) {
this.xiaoRuiEducation = xiaoRuiEducation;
}
public Integer getIsSendMiniUrl() { public Integer getIsSendMiniUrl() {
return isSendMiniUrl; return isSendMiniUrl;
} }
......
...@@ -15,4 +15,24 @@ public class QrcodeStatisticsDTO { ...@@ -15,4 +15,24 @@ public class QrcodeStatisticsDTO {
private Long browserCounts; private Long browserCounts;
/**
* 二维码类型
*/
private String codeType;
/**
* 二维码下面资源数量
*/
private Integer serveCount;
/**
* 二维码下面企业微信数量和资源数量总和
*/
private Integer totalCount;
/**
* 是否小睿教育书
*/
private Boolean xiaoRuiEducation;
} }
...@@ -245,7 +245,7 @@ public interface BookAdviserBiz { ...@@ -245,7 +245,7 @@ public interface BookAdviserBiz {
*/ */
BookAdviserDto getOneMainBook(Long bookId); BookAdviserDto getOneMainBook(Long bookId);
PageBeanNew<QrCodeVO> getQrList(Long bookId, Long adviserId, Long channelId, Integer currentPage, Integer numPerPage); PageBeanNew<QrCodeVO> getQrList(Long bookId, Long adviserId, Long channelId,Integer type, Integer currentPage, Integer numPerPage);
/** /**
* 获取书下资源总数(包括现代纸书、1V1、小睿、社群码) * 获取书下资源总数(包括现代纸书、1V1、小睿、社群码)
......
...@@ -773,9 +773,14 @@ public class BookBizImpl implements BookBiz { ...@@ -773,9 +773,14 @@ public class BookBizImpl implements BookBiz {
paramMap.put("channelIds", bookDetailDTO.getChannelIds()); paramMap.put("channelIds", bookDetailDTO.getChannelIds());
paramMap.put("adviserIds", bookDetailDTO.getAdviserIds()); paramMap.put("adviserIds", bookDetailDTO.getAdviserIds());
List<BookDto> bookDtos = bookDao.listBookGroupByBookIds(bookDetailDTO.getBookIds(), bookDetailDTO.getChannelIds(),bookDetailDTO.getAdviserIds()); List<BookDto> bookDtos = bookDao.listBookGroupByBookIds(bookDetailDTO.getBookIds(), bookDetailDTO.getChannelIds(),bookDetailDTO.getAdviserIds());
List<Long> xiaoRuiEducation = channelConsr.isXiaoRuiEducation(bookDetailDTO.getBookIds());
if (!ListUtils.isEmpty(bookDtos)) { if (!ListUtils.isEmpty(bookDtos)) {
for (BookDto bookDto : bookDtos) { for (BookDto bookDto : bookDtos) {
bookDto.setXiaoRuiEducation(false);
bookMap.put(bookDto.getBookId() + "_" + bookDto.getChannelId() + "_" + bookDto.getAdviserId(), bookDto); bookMap.put(bookDto.getBookId() + "_" + bookDto.getChannelId() + "_" + bookDto.getAdviserId(), bookDto);
if(CollUtil.isNotEmpty(xiaoRuiEducation) && xiaoRuiEducation.contains(bookDto.getBookId())){
bookDto.setXiaoRuiEducation(true);
}
} }
} }
} }
......
...@@ -249,9 +249,10 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade { ...@@ -249,9 +249,10 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
public ResponseDto<PageBeanNew<QrCodeVO>> getQrList(@RequestParam(value = "bookId") Long bookId, public ResponseDto<PageBeanNew<QrCodeVO>> getQrList(@RequestParam(value = "bookId") Long bookId,
@RequestParam(value = "adviserId") Long adviserId, @RequestParam(value = "adviserId") Long adviserId,
@RequestParam(value = "channelId") Long channelId, @RequestParam(value = "channelId") Long channelId,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "currentPage") Integer currentPage, @RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) throws BizException { @RequestParam(value = "numPerPage") Integer numPerPage) throws BizException {
PageBeanNew<QrCodeVO> qrCodeVOPageBeanNew = bookAdviserBiz.getQrList(bookId, adviserId, channelId, currentPage, numPerPage); PageBeanNew<QrCodeVO> qrCodeVOPageBeanNew = bookAdviserBiz.getQrList(bookId, adviserId, channelId,type, currentPage, numPerPage);
return new ResponseDto<>(qrCodeVOPageBeanNew); return new ResponseDto<>(qrCodeVOPageBeanNew);
} }
......
...@@ -18,4 +18,13 @@ public class QrCodeVO { ...@@ -18,4 +18,13 @@ public class QrCodeVO {
@ApiModelProperty("权益数") @ApiModelProperty("权益数")
private Integer rightsCount; private Integer rightsCount;
@ApiModelProperty("二维码类型")
private String codeType;
@ApiModelProperty("是否小睿教育书")
private Boolean xiaoRuiEducation;
@ApiModelProperty("公众号码id")
private Long sceneId;
} }
...@@ -271,4 +271,19 @@ public class ChannelConsr { ...@@ -271,4 +271,19 @@ public class ChannelConsr {
} }
return new HashMap<>(); return new HashMap<>();
} }
/**
* 是否小睿教育书
*/
public List<Long> isXiaoRuiEducation(List<Long> bookIds) {
if(CollectionUtils.isEmpty(bookIds)){
return new ArrayList<>();
}
try {
return ResponseHandleUtil.parseList(qrcodeSceneService.isXiaoRuiEducation(bookIds), Long.class);
} catch (Exception e) {
LOGGER.error("是否小睿教育书 " + e.getMessage(), e);
throw new ChannelBizException(ChannelBizException.PARAM_IS_NULL, "获取是否小睿教育书失败");
}
}
} }
...@@ -382,4 +382,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -382,4 +382,6 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
List<HotAppDTO> listHotApp(); List<HotAppDTO> listHotApp();
List<HotAppDTO> listHotAppIncrement(); List<HotAppDTO> listHotAppIncrement();
List<BookGroupDTO> getDTOByBookIdList(Long bookId, Long channelId, Long adviserId);
} }
...@@ -82,6 +82,21 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> { ...@@ -82,6 +82,21 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
Map<String, BookGroupServeCountDTO> mapBookGroupQrcodeServeCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds, Integer joinGroupType); Map<String, BookGroupServeCountDTO> mapBookGroupQrcodeServeCount(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds, Integer joinGroupType);
/** /**
* 批量获取群二维码下资源数量
* @param bookGroupIds
* @return
*/
Map<Long, BookGroupServeCountDTO> mapGroupQrcodeServeCount(List<Long> bookGroupIds);
/**
* 批量获取 除了 群二维码下 其它社区码下资源数量
* @param bookGroupIds
* @return
*/
Map<Long, BookGroupServeCountDTO> mapXiaoRuiGroupQrcodeServeCount(List<Long> bookGroupIds);
/**
* 根据书刊查社群书配置资源 * 根据书刊查社群书配置资源
* @author:zhuyajie * @author:zhuyajie
* @date:2020/12/14 16:31 * @date:2020/12/14 16:31
......
...@@ -505,4 +505,13 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -505,4 +505,13 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public List<HotAppDTO> listHotAppIncrement() { public List<HotAppDTO> listHotAppIncrement() {
return getSqlSession().selectList(getStatement("listHotAppIncrement")); return getSqlSession().selectList(getStatement("listHotAppIncrement"));
} }
@Override
public List<BookGroupDTO> getDTOByBookIdList(Long bookId, Long channelId, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
return super.getSqlSession().selectList(getStatement("getDTOByBookIdList"), paramMap);
}
} }
package com.pcloud.book.group.dao.impl; package com.pcloud.book.group.dao.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import com.pcloud.book.book.vo.BookResourceNumDTO; import com.pcloud.book.book.vo.BookResourceNumDTO;
import com.pcloud.book.group.dao.BookGroupServeDao; import com.pcloud.book.group.dao.BookGroupServeDao;
...@@ -155,6 +156,48 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement ...@@ -155,6 +156,48 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
} }
@Override @Override
public Map<Long, BookGroupServeCountDTO> mapGroupQrcodeServeCount(List<Long> bookGroupIds) {
if (CollUtil.isNotEmpty(bookGroupIds) && bookGroupIds.size() > 500) {
Map<Long, BookGroupServeCountDTO>resultMap = new HashMap<>();
List<List<Long>> lists = ListUtils.groupList(bookGroupIds);
for (List<Long> list : lists) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
Map<Long, BookGroupServeCountDTO> objectObjectMap = getSessionTemplate().selectMap(getStatement("mapGroupQrcodeServeCount"), map, "bookQrcodeId");
if(objectObjectMap!=null){
resultMap.putAll(objectObjectMap);
}
}
return resultMap;
} else {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectMap(getStatement("mapGroupQrcodeServeCount"), map, "bookQrcodeId");
}
}
@Override
public Map<Long, BookGroupServeCountDTO> mapXiaoRuiGroupQrcodeServeCount(List<Long> bookGroupIds) {
if (CollUtil.isNotEmpty(bookGroupIds) && bookGroupIds.size() > 500) {
Map<Long, BookGroupServeCountDTO>resultMap = new HashMap<>();
List<List<Long>> lists = ListUtils.groupList(bookGroupIds);
for (List<Long> list : lists) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
Map<Long, BookGroupServeCountDTO> objectObjectMap = getSessionTemplate().selectMap(getStatement("mapXiaoRuiGroupQrcodeServeCount"), map, "bookQrcodeId");
if(objectObjectMap!=null){
resultMap.putAll(objectObjectMap);
}
}
return resultMap;
} else {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectMap(getStatement("mapXiaoRuiGroupQrcodeServeCount"), map, "bookQrcodeId");
}
}
@Override
public List<BookGroupServe> getServeListByBook(Long bookId, Long channelId, Long adviserId) { public List<BookGroupServe> getServeListByBook(Long bookId, Long channelId, Long adviserId) {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("adviserId", adviserId); map.put("adviserId", adviserId);
......
...@@ -358,6 +358,7 @@ ...@@ -358,6 +358,7 @@
<select id="listBookGroupByBookIds" resultMap="bookMap" parameterType="list"> <select id="listBookGroupByBookIds" resultMap="bookMap" parameterType="list">
SELECT SELECT
b.BOOK_ID, b.BOOK_ID,
b.CREATED_DATE,
b.ISBN, b.ISBN,
b.BOOK_NAME, b.BOOK_NAME,
b.COVER_IMG, b.COVER_IMG,
......
...@@ -144,6 +144,16 @@ ...@@ -144,6 +144,16 @@
ORDER BY create_time ASC limit 1 ORDER BY create_time ASC limit 1
</select> </select>
<select id="getDTOByBookIdList" resultMap="BookGroupDTO" parameterType="map">
select
<include refid="Base_Column_List"/>
from book_group
where is_delete = 0
and book_id = #{bookId,jdbcType=BIGINT}
and channel_id = #{channelId,jdbcType=BIGINT}
and create_user = #{adviserId,jdbcType=BIGINT}
</select>
<select id="getDTOByBookIdsAnsAdviserIds" resultMap="BookGroupDTO" parameterType="map"> <select id="getDTOByBookIdsAnsAdviserIds" resultMap="BookGroupDTO" parameterType="map">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
......
...@@ -238,6 +238,26 @@ ...@@ -238,6 +238,26 @@
GROUP BY bg.book_id,bg.create_user,bg.channel_id GROUP BY bg.book_id,bg.create_user,bg.channel_id
</select> </select>
<!--客服机器人、1v1、小睿的资源数-->
<!--2021-02-19 企业微信群也算一个资源数-->
<select id="mapXiaoRuiGroupQrcodeServeCount" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupServeCountDTO">
SELECT
bg.id bookQrcodeId,
ifnull(COUNT(DISTINCT bgs.id),0) + (SELECT ifnull(COUNT(1),0) FROM book_qrcode_wxwork bqw WHERE bqw.book_qrcode_type = 2 AND bqw.book_qrcode_id = bg.id) serveCount,
bg.book_id bookId, bg.create_user adviserId, bg.channel_id channelId,COUNT(DISTINCT bg.group_qrcode_url) qrcodeCount,
bg.join_group_type joinGroupType
FROM `book_group` bg
LEFT JOIN book_group_serve bgs ON bg.id = bgs.book_group_id
WHERE
bg.is_delete=0
AND bg.id IN
<foreach collection="bookGroupIds" item="bookGroupId" separator="," open="(" close=")">
${bookGroupId}
</foreach>
AND bg.join_group_type IN (2,3,4)
GROUP BY bg.id
</select>
<!--社群资源数--> <!--社群资源数-->
<select id="mapBookGroupQrcodeServeCount" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupServeCountDTO"> <select id="mapBookGroupQrcodeServeCount" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupServeCountDTO">
SELECT SELECT
...@@ -265,6 +285,23 @@ ...@@ -265,6 +285,23 @@
GROUP BY bg.book_id,bg.create_user,bg.channel_id GROUP BY bg.book_id,bg.create_user,bg.channel_id
</select> </select>
<!--群二维码资源数-->
<select id="mapGroupQrcodeServeCount" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupServeCountDTO">
SELECT
bg.id bookQrcodeId,ifnull(COUNT(DISTINCT k.id),0) serveCount
FROM
book_group bg
LEFT JOIN book_keyword bk ON bg.id=bk.book_group_id AND bk.is_delete = 0
LEFT JOIN keyword k ON bk.keyword_id = k.id AND k.is_delete = 0
WHERE
bg.is_delete = 0
AND bg.id IN
<foreach collection="bookGroupIds" item="bookGroupId" separator="," open="(" close=")">
${bookGroupId}
</foreach>
GROUP BY bg.id
</select>
<select id="getServeListByBook" parameterType="map" resultMap="BaseResultMap"> <select id="getServeListByBook" parameterType="map" resultMap="BaseResultMap">
SELECT SELECT
s.id, s.id,
......
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