Commit 1511139c by 高鹏

Merge branch 'mymaster' into 'master'

C1001010 编辑端关键词回复内容增加预览,出版端书刊管理模块增加社群书管理功能,显示关键词对应

See merge request rays/pcloud-book!38
parents 2ac38974 6d871d8e
......@@ -3,8 +3,10 @@ package com.pcloud.book.group.biz;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
......@@ -216,6 +218,16 @@ public interface BookGroupBiz {
void exportGroupQrcode4Adviser(Map<String, Object> paramMap, Long adviserId);
/**
* 根据bookId获取社群书分类等统计
*/
StatisticVO getBookGroupStatistics(Long bookId);
/**
* 根据bookId获取社群书分类和关键词等统计信息
*/
List<ClassifyKeywordDTO> getBookGroupKeywordStatistics(Long bookId);
/**
* 更新是否显示书名
*/
void updateIsShowBookName(Boolean isShowBookName, Long partyId);
......
......@@ -19,12 +19,18 @@ import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dao.AppClickRecordDao;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.channelcenter.qrcode.dto.GroupQrcodeVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.biz.MessageBiz;
......@@ -134,6 +140,10 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Autowired
private MessageBiz messageBiz;
@Autowired
private BookGroupClassifyDao bookGroupClassifyDao;
@Autowired
private BookKeywordDao bookKeywordDao;
@Autowired
private AudioLessonService audioLessonService;
@Autowired
private ScheduleService scheduleService;
......@@ -885,6 +895,89 @@ public class BookGroupBizImpl implements BookGroupBiz {
});
}
@ParamLog("根据bookId获取社群书分类等统计")
@Override
public StatisticVO getBookGroupStatistics(Long bookId) {
return bookGroupClassifyDao.getBookGroupStatistics(bookId);
}
@ParamLog("根据bookId获取社群书分类和关键词等统计信息")
@Override
public List<ClassifyKeywordDTO> getBookGroupKeywordStatistics(Long bookId) {
List<ClassifyKeywordDTO> classifyKeywordDTOS = bookGroupClassifyDao.getClassifyStatistics(bookId);
if (!ListUtils.isEmpty(classifyKeywordDTOS)) {
List<Long> classifyIds = classifyKeywordDTOS.stream().map(ClassifyKeywordDTO::getClassifyId).collect(Collectors.toList());
List<ListKeywordVO> listKeywordVOS = bookKeywordDao.getKeywordsByClassifyIds(classifyIds,bookId);
List<Long> appIds = listKeywordVOS.stream().filter(s -> "APP".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
Map<Long, AppDto> appDtoMap = appConsr.mapByIds(appIds);
Map<Long, Long> appIdToProductIdMap = new HashMap<>();
List<Long> appProductIds = new ArrayList<>();
for (Long appId : appIds) {
if (appDtoMap.get(appId) != null && appDtoMap.get(appId).getProductId() != null) {
appIdToProductIdMap.put(appId, appDtoMap.get(appId).getProductId());
appProductIds.add(appDtoMap.get(appId).getProductId());
}
}
List<Long> productIds = listKeywordVOS.stream().filter(s -> "PRODUCT".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
productIds.addAll(appProductIds);
Map<Long, ProductDto> productDtoMap = productConsr.getProBasesByIds(productIds);
Map<Long, Boolean> isSuperMap = productConsr.getIsSuperByProductIdList(productIds);
for (ListKeywordVO listKeywordVO : listKeywordVOS) {
if (ReplyTypeEnum.APP.value.equals(listKeywordVO.getReplyType())) {
Long productId = 0L;
if ("APP".equalsIgnoreCase(listKeywordVO.getServeType())) {
Long appId = listKeywordVO.getServeId();
AppDto appDto = appDtoMap.get(appId);
if (appDto != null) {
listKeywordVO.setTypeCode(appDto.getTypeCode());
}
productId = appIdToProductIdMap.get(appId);
listKeywordVO.setApSource("APP");
}
if ("PRODUCT".equalsIgnoreCase(listKeywordVO.getServeType())) {
productId = listKeywordVO.getServeId();
ProductDto productDto = productDtoMap.get(productId);
if (productDto != null) {
listKeywordVO.setTypeCode(productDto.getProductTypeCode());
}
//判断是否为超级作者作品
if (isSuperMap != null && isSuperMap.get(productId) != null && isSuperMap.get(productId)) {
listKeywordVO.setApSource("SUPER_PRODUCT");
}else {
listKeywordVO.setApSource("PRODUCT");
}
}
ProductDto productDto = null;
if (productId != null) {
productDto = productDtoMap.get(productId);
}
if (productDto != null) {
List<SpecificationDto> specificationDtos = productDto.getSpecification();
if (!ListUtils.isEmpty(specificationDtos)) {
SpecificationDto specificationDto = specificationDtos.get(0);
if (specificationDto != null) {
listKeywordVO.setRetailPrice(specificationDto.getAdvisePrice());
listKeywordVO.setDealPrice(specificationDto.getDealPrice());
}
}
}
}
}
Map<Long,List<ListKeywordVO>> listMap=listKeywordVOS.stream().collect(Collectors.groupingBy(ListKeywordVO::getClassifyId));
List<ListKeywordVO> bookKewordList = listKeywordVOS.stream().filter(s -> s.getClassifyId() == 0).collect(Collectors.toList());
for (ClassifyKeywordDTO classifyKeywordDTO : classifyKeywordDTOS) {
List<ListKeywordVO> list = listMap.get(classifyKeywordDTO.getClassifyId());
if (list==null){
list=new ArrayList<>();
}
if (!ListUtils.isEmpty(bookKewordList)){
list.addAll(bookKewordList);
}
classifyKeywordDTO.setListKeywordVOS(list);
}
}
return classifyKeywordDTOS;
}
@Transactional(rollbackFor = Exception.class)
@ParamLog("更新是否显示书名")
......
......@@ -214,5 +214,20 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
* @return
*/
List<ClassifyDTO> getNameWithBookClockInfoIdByIds(Map<String,Object> paramMap);
/**
* 根据bookId获取社群书分类等统计
* @param bookId
* @return
*/
StatisticVO getBookGroupStatistics(Long bookId);
/**
* 根据bookId获取社群书分类集合等统计
* @param bookId
* @return
*/
List<ClassifyKeywordDTO> getClassifyStatistics(Long bookId);
GroupClassifyQrcodeDTO getClassifyQrcodeInfoByName(String weixinGroupName);
}
......@@ -182,6 +182,17 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
public List<ClassifyDTO> getNameWithBookClockInfoIdByIds(Map<String,Object> paramMap) {
return this.getSqlSession().selectList(this.getStatement("getNameWithBookClockInfoIdByIds"), paramMap);
}
@Override
public StatisticVO getBookGroupStatistics(Long bookId) {
return this.getSqlSession().selectOne(this.getStatement("getBookGroupStatistics"), bookId);
}
@Override
public List<ClassifyKeywordDTO> getClassifyStatistics(Long bookId) {
return this.getSqlSession().selectList(this.getStatement("getClassifyStatistics"), bookId);
}
@Override
public GroupClassifyQrcodeDTO getClassifyQrcodeInfoByName(String weixinGroupName) {
return this.getSessionTemplate().selectOne(getStatement("getClassifyQrcodeInfoByName"), weixinGroupName);
......
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/6/26 14:28
**/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ClassifyKeywordDTO implements Serializable {
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("分类名称")
private String classify;
@ApiModelProperty("群数量")
private Integer groupCount;
@ApiModelProperty("用户数量")
private Integer userCount;
private List<ListKeywordVO> listKeywordVOS;
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public Integer getGroupCount() {
return groupCount;
}
public void setGroupCount(Integer groupCount) {
this.groupCount = groupCount;
}
public Integer getUserCount() {
return userCount;
}
public void setUserCount(Integer userCount) {
this.userCount = userCount;
}
public List<ListKeywordVO> getListKeywordVOS() {
return listKeywordVOS;
}
public void setListKeywordVOS(List<ListKeywordVO> listKeywordVOS) {
this.listKeywordVOS = listKeywordVOS;
}
@Override
public String toString() {
return "ClassifyKeywordDTO{" +
"classifyId=" + classifyId +
", classify='" + classify + '\'' +
", groupCount=" + groupCount +
", userCount=" + userCount +
", listKeywordVOS=" + listKeywordVOS +
'}';
}
}
......@@ -224,6 +224,19 @@ public interface BookGroupFacade {
@RequestParam(value = "endDate", required = false) String endDate)
throws BizException, PermissionException;
@ApiOperation("根据bookId获取社群书分类等统计")
@GetMapping("getBookGroupStatistics")
ResponseDto<?> getBookGroupStatistics(
@RequestHeader("token") String token,
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据bookId获取社群书分类和关键词等统计信息")
@GetMapping("getBookGroupKeywordStatistics")
ResponseDto<?> getBookGroupKeywordStatistics(
@RequestHeader("token") String token,
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("更新是否显示书名")
@GetMapping("updateIsShowBookName")
......
......@@ -319,6 +319,34 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>();
}
@ApiOperation("根据bookId获取社群书分类等统计")
@GetMapping("getBookGroupStatistics")
@Override
public ResponseDto<?> getBookGroupStatistics(
@RequestHeader("token") String token,
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(bookId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"bookId不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupStatistics(bookId));
}
@ApiOperation("根据bookId获取社群书分类和关键词等统计信息")
@GetMapping("getBookGroupKeywordStatistics")
@Override
public ResponseDto<?> getBookGroupKeywordStatistics(
@RequestHeader("token") String token,
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if(bookId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"bookId不能为空!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupKeywordStatistics(bookId));
}
@ApiOperation("更新是否显示书名")
@GetMapping("updateIsShowBookName")
@Override
......
......@@ -4,6 +4,7 @@ import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.vo.KeywordVO;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
......@@ -75,4 +76,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
* @Date:2019/5/14 16:46
*/
Integer getKeywordCount(Long bookGroupId, Long classifyId);
/**
* 根据分类id集合获取
* @param classifyIds
* @return
*/
List<ListKeywordVO> getKeywordsByClassifyIds(List<Long> classifyIds, Long bookId);
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.vo.KeywordVO;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
......@@ -89,4 +90,12 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
paramMap.put("classifyId", classifyId);
return this.getSqlSession().selectOne(this.getStatement("getKeywordCount"), paramMap);
}
@Override
public List<ListKeywordVO> getKeywordsByClassifyIds(List<Long> classifyIds, Long bookId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("classifyIds", classifyIds);
paramMap.put("bookId", bookId);
return this.getSqlSession().selectList(this.getStatement("getKeywordsByClassifyIds"), paramMap);
}
}
......@@ -73,7 +73,10 @@ public class ListKeywordVO implements Serializable {
@ApiModelProperty("协议价")
private Long channelId;
@ApiModelProperty("协议价")
@ApiModelProperty("应用或作品类型")
private String typeCode;
@ApiModelProperty("来源APP应用,PRODUCT作品,SUPER_PRODUCT超级作者作品")
private String apSource;
}
......@@ -750,6 +750,38 @@
AND bgc.IS_DELETE = 0
</select>
<!--根据bookId获取社群书分类等统计-->
<select id="getBookGroupStatistics" parameterType="Long" resultType="com.pcloud.book.group.vo.StatisticVO">
SELECT
COUNT(DISTINCT t1.id) classifyCount,
COUNT(DISTINCT t2.id) groupNumber,
IFNULL(SUM(t2.user_number),0) userNumber
FROM
book_group_classify t1
INNER JOIN book_group_qrcode t2 ON t1.id = t2.classify_id
WHERE
t1.is_delete = 0
AND t2.is_delete = 0
AND t1.book_id = #{bookId}
</select>
<!--根据bookId获取社群书分类集合等统计-->
<select id="getClassifyStatistics" parameterType="Long" resultType="com.pcloud.book.group.dto.ClassifyKeywordDTO">
SELECT
t1.id classifyId,
t1.classify classify,
COUNT(DISTINCT t2.id) groupCount,
SUM(t2.user_number) userCount
FROM
book_group_classify t1
INNER JOIN book_group_qrcode t2 ON t1.id = t2.classify_id
WHERE
t1.is_delete = 0
AND t2.is_delete = 0
AND t1.book_id = #{bookId}
group by t1.id
</select>
<select id="getClassifyQrcodeInfoByName" resultType="GroupClassifyQrcodeDTO" parameterType="String">
select
c.id classifyId,
......
......@@ -229,4 +229,36 @@
</if>
order by t.create_time desc
</select>
<!--根据分类id集合获取-->
<select id="getKeywordsByClassifyIds" parameterType="map" resultType="com.pcloud.book.keywords.vo.ListKeywordVO">
SELECT
bk.id bookKeywordId,
k.id keywordId,
k.keywords,
k.matching_rule matchingRule,
k.guide,
bk.rank,
k.content,
k.description,
k.link_url linkUrl,
k.pic_url picUrl,
k.reply_type replyType,
k.serve_id serveId,
k.serve_type serveType,
bk.classify_id classifyId
FROM
book_keyword bk
JOIN keyword k ON bk.keyword_id = k.id
WHERE
bk.is_delete = 0
AND k.is_delete = 0
AND (bk.classify_id IN
<foreach collection="classifyIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
or bk.book_id =#{bookId})
ORDER BY
bk.rank ASC,bk.id 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