Commit a27b2db6 by 朱亚洁

出版端社群书统计

parent cacc9d74
package com.pcloud.book.group.dto; package com.pcloud.book.group.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data; import lombok.Data;
/** /**
...@@ -8,10 +10,21 @@ import lombok.Data; ...@@ -8,10 +10,21 @@ import lombok.Data;
* @Date 2019/11/22 14:48 * @Date 2019/11/22 14:48
**/ **/
@Data @Data
public class AltAndCountDTO { public class AltAndCountDTO extends BaseDto{
/**
* 小号id
*/
private String altId; private String altId;
private Integer count; private Integer count;
/**
* 昵称
*/
private String nickName;
/**
* 好友数量
*/
private Integer friendCount;
} }
...@@ -150,4 +150,14 @@ public class BrowseRecordConsr { ...@@ -150,4 +150,14 @@ public class BrowseRecordConsr {
return map; return map;
} }
@ParamLog("根据群分类获取应用/资源浏览量")
public Map<Long, GroupBrowseStatisticVO> mapServeBrowseStatisticByClassify(List<Long> serveIds, String serveType, Long classifyId) {
Map<Long, GroupBrowseStatisticVO> map = null;
try {
map = ResponseHandleUtil.parseMapResponse(browseRecordService.mapServeBrowseStatisticByClassify(serveIds, serveType,classifyId), Long.class, GroupBrowseStatisticVO.class);
} catch (Exception e) {
LOGGER.error("根据群分类获取应用/资源浏览量失败" + e.getMessage(), e);
}
return map;
}
} }
...@@ -6,6 +6,7 @@ import com.pcloud.book.group.dto.AppStatisticsDTO; ...@@ -6,6 +6,7 @@ import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupCountDTO; import com.pcloud.book.group.dto.BookGroupCountDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO; import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.dto.BookGroupStatistic4AgentDTO;
import com.pcloud.book.group.dto.BookGroupStatisticsDTO; import com.pcloud.book.group.dto.BookGroupStatisticsDTO;
import com.pcloud.book.group.dto.ChangeQrCodeTypeDto; import com.pcloud.book.group.dto.ChangeQrCodeTypeDto;
import com.pcloud.book.group.dto.ClassifyKeywordDTO; import com.pcloud.book.group.dto.ClassifyKeywordDTO;
...@@ -42,6 +43,7 @@ import com.pcloud.book.group.vo.StatisticVO; ...@@ -42,6 +43,7 @@ import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.vo.TotalRescourceDataVO; import com.pcloud.book.group.vo.TotalRescourceDataVO;
import com.pcloud.book.group.vo.UserBookInfoVO; import com.pcloud.book.group.vo.UserBookInfoVO;
import com.pcloud.book.group.vo.WxGroupStatisticVO; import com.pcloud.book.group.vo.WxGroupStatisticVO;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.dto.StoreFlowInfoDto; import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
...@@ -705,4 +707,18 @@ public interface BookGroupBiz { ...@@ -705,4 +707,18 @@ public interface BookGroupBiz {
* @return * @return
*/ */
List<BookGroupCountDTO> getAssocBookGroupCount(List<BookGroupCountDTO> dtos); List<BookGroupCountDTO> getAssocBookGroupCount(List<BookGroupCountDTO> dtos);
/**
* 出版社根据bookId获取社群码统计信息
* @param bookId
* @return
*/
BookGroupStatistic4AgentDTO getBookGroupStatisticsByAgent(Long bookId);
/**
* 获取群分类关键词数据
* @param classifyId
* @return
*/
List<ListKeywordVO> getClassifyKeywordStatistic(Long classifyId);
} }
...@@ -55,6 +55,7 @@ import com.pcloud.book.group.dto.BookGroupCountDTO; ...@@ -55,6 +55,7 @@ import com.pcloud.book.group.dto.BookGroupCountDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO; import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO; import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.dto.BookGroupStatistic4AgentDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO; import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.BookGroupStatisticsDTO; import com.pcloud.book.group.dto.BookGroupStatisticsDTO;
import com.pcloud.book.group.dto.ChangeQrCodeTypeDto; import com.pcloud.book.group.dto.ChangeQrCodeTypeDto;
...@@ -1289,83 +1290,25 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -1289,83 +1290,25 @@ public class BookGroupBizImpl implements BookGroupBiz {
@ParamLog("根据bookId获取社群书分类等统计") @ParamLog("根据bookId获取社群书分类等统计")
@Override @Override
public StatisticVO getBookGroupStatistics(Long bookId) { public StatisticVO getBookGroupStatistics(Long bookId) {
return bookGroupClassifyDao.getBookGroupStatistics(bookId); StatisticVO statisticVO = bookGroupClassifyDao.getBookGroupStatistics(bookId);
if (null == statisticVO || null == statisticVO.getBookGroupId()) {
return new StatisticVO();
}
if (JoinGroupTypeEnum.ROBOT.getCode().equals(statisticVO.getJoinGroupType())) {
Long bookGroupId = statisticVO.getBookGroupId();
//个人号数、好友数
Integer robotCount = bookGroupCipherUserDao.getAltCountByBookGroup(bookGroupId);
statisticVO.setRobotCount(robotCount);
Integer friendCount = bookGroupCipherUserDao.getFriendsCountByBookGroup(bookGroupId);
statisticVO.setFriendCount(friendCount);
}
return statisticVO;
} }
@ParamLog("根据bookId获取社群书分类和关键词等统计信息") @ParamLog("根据bookId获取社群书分类和关键词等统计信息")
@Override @Override
public List<ClassifyKeywordDTO> getBookGroupKeywordStatistics(Long bookId) { public List<ClassifyKeywordDTO> getBookGroupKeywordStatistics(Long bookId) {
List<ClassifyKeywordDTO> classifyKeywordDTOS = bookGroupClassifyDao.getClassifyStatistics(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);
List<AppPriceCacheDTO> appPriceCacheDTOS = new ArrayList<>();
for (Long appId : appIds) {
if (appDtoMap.get(appId) != null) {
AppPriceCacheDTO appPriceCacheDTO = new AppPriceCacheDTO();
appPriceCacheDTO.setAppId(appId);
appPriceCacheDTO.setAppTypeEnum(AppTypeEnum.APP_TYPE_MAP.get(appDtoMap.get(appId).getTypeCode()));
appPriceCacheDTOS.add(appPriceCacheDTO);
}
}
Map<Long, BigDecimal> appPriceMap = ResponseHandleUtil.parseMapResponse(appPriceCacheService.getCaches(appPriceCacheDTOS), Long.class, BigDecimal.class);
List<Long> productIds = listKeywordVOS.stream().filter(s -> "PRODUCT".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
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())) {
if ("APP".equalsIgnoreCase(listKeywordVO.getServeType())) {
Long appId = listKeywordVO.getServeId();
AppDto appDto = appDtoMap.get(appId);
if (appDto != null) {
listKeywordVO.setTypeCode(appDto.getTypeCode());
}
if (appPriceMap != null) {
if (appPriceMap.get(appId) != null) {
listKeywordVO.setRetailPrice(appPriceMap.get(appId).doubleValue());
listKeywordVO.setDealPrice(0D);
}
}
listKeywordVO.setApSource("APP");
}
if ("PRODUCT".equalsIgnoreCase(listKeywordVO.getServeType())) {
Long productId = listKeywordVO.getServeId();
ProductDto productDto = productDtoMap.get(productId);
if (productDto != null) {
listKeywordVO.setTypeCode(productDto.getProductTypeCode());
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());
}
}
}
//判断是否为超级作者作品
if (isSuperMap != null && isSuperMap.get(productId) != null && isSuperMap.get(productId)) {
listKeywordVO.setApSource("SUPER_PRODUCT");
} else {
listKeywordVO.setApSource("PRODUCT");
}
}
}
}
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; return classifyKeywordDTOS;
} }
...@@ -4062,4 +4005,85 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -4062,4 +4005,85 @@ public class BookGroupBizImpl implements BookGroupBiz {
public void updateSpecialState(Long id, Boolean belongSpecialAgent) { public void updateSpecialState(Long id, Boolean belongSpecialAgent) {
bookGroupDao.updateSpecialState(id, belongSpecialAgent); bookGroupDao.updateSpecialState(id, belongSpecialAgent);
} }
@Override
public BookGroupStatistic4AgentDTO getBookGroupStatisticsByAgent(Long bookId) {
BookGroupStatistic4AgentDTO groupStatistic4AgentDTO = bookGroupDao.getBaseInfoByBookId(bookId);
if (null == groupStatistic4AgentDTO) {
return new BookGroupStatistic4AgentDTO();
}
Long bookGroupId = groupStatistic4AgentDTO.getBookGroupId();
//资源浏览量
Integer browseCount = 0;
Integer browserCount = 0;
Long browseTimes = 0L;
Map<Long, GroupBrowseStatisticVO> browseMap = browseRecordConsr.mapGroupBrowseStatistic(Arrays.asList(bookGroupId), null);
if (!MapUtils.isEmpty(browseMap) && browseMap.containsKey(bookGroupId)) {
GroupBrowseStatisticVO browseStatisticVO = browseMap.get(bookGroupId);
browseCount = browseStatisticVO.getBrowseCount();
browserCount = browseStatisticVO.getBrowserCount();
browseTimes = browseStatisticVO.getBrowserCount() == 0 ? 0 : browseStatisticVO.getBrowseTimes() / browseStatisticVO.getBrowserCount();
}
groupStatistic4AgentDTO.setBrowseCount(browseCount);
groupStatistic4AgentDTO.setBrowserCount(browserCount);
groupStatistic4AgentDTO.setAvgbrowseTimes(browseTimes);
//购买次数 销售额
Long saleCount = 0L;
Double saleAmount = 0D;
Map<Long, ProductSaleDetailDto> saleMap = tradeConsr.getSaleInfo4Group(Arrays.asList(bookGroupId), null);
if (!MapUtils.isEmpty(saleMap) && saleMap.containsKey(bookGroupId)) {
ProductSaleDetailDto productSaleDetailDto = saleMap.get(bookGroupId);
saleCount = productSaleDetailDto.getSaleCount();
saleAmount = productSaleDetailDto.getSaleMoney();
}
groupStatistic4AgentDTO.setSaleCount(saleCount);
groupStatistic4AgentDTO.setSaleAmount(saleAmount);
if (JoinGroupTypeEnum.ROBOT.getCode().equals(groupStatistic4AgentDTO.getJoinGroupType())) {
//个人号信息
List<AltAndCountDTO> altAndCountDTOS = bookGroupCipherUserDao.getAltFriendList(bookGroupId);
if (!ListUtils.isEmpty(altAndCountDTOS)) {
List<String> altList = altAndCountDTOS.stream().filter(s -> s.getAltId() != null).map(AltAndCountDTO::getAltId).collect(Collectors.toList());
Map<String, RobotBaseInfoDTO> robotBaseInfoDTOMap = wechatGroupConsr.mapRobotInfo(altList);
for (AltAndCountDTO altAndCountDTO : altAndCountDTOS) {
if (!MapUtils.isEmpty(robotBaseInfoDTOMap) && robotBaseInfoDTOMap.containsKey(altAndCountDTO.getAltId())) {
RobotBaseInfoDTO dto = robotBaseInfoDTOMap.get(altAndCountDTO.getAltId());
altAndCountDTO.setNickName(dto == null ? "" : dto.getNickName());
}
}
}
groupStatistic4AgentDTO.setAltAndCountDTOS(altAndCountDTOS);
//个人号配置资源
List<BookGroupServe> list = bookGroupServeDao.getListByBookGroupId(bookGroupId);
groupSet.setBookGroupServeStatistic(list, bookGroupId);
groupStatistic4AgentDTO.setBookGroupServeList(list);
}
return groupStatistic4AgentDTO;
}
@Override
public List<ListKeywordVO> getClassifyKeywordStatistic(Long classifyId) {
ClassifyDTO classifyDTO = bookGroupClassifyDao.getById(classifyId);
if (null == classifyDTO) {
return new ArrayList<>();
}
Long bookGroupId = classifyDTO.getBookGroupId();
//所有的关键词(群分类+书)
List<ListKeywordVO> listKeywordVOS = new ArrayList<>();
//按分类设置的关键词
List<ListKeywordVO> classifyKeywordVOS = bookKeywordDao.getAppKeywordsByClassifyId(classifyId, bookGroupId, null);
List<Long> keywordIdList = new ArrayList<>();
if (!ListUtils.isEmpty(classifyKeywordVOS)) {
keywordIdList = classifyKeywordVOS.stream().filter(s -> s.getKeywordId() != null).map(ListKeywordVO::getKeywordId).distinct().collect(Collectors.toList());
listKeywordVOS.addAll(classifyKeywordVOS);
}
//按书设置的关键词
List<ListKeywordVO> bookKeywordVOS = bookKeywordDao.getAppKeywordsByClassifyId(0L, bookGroupId, keywordIdList);
if (!ListUtils.isEmpty(bookKeywordVOS)) {
listKeywordVOS.addAll(bookKeywordVOS);
}
if (!ListUtils.isEmpty(listKeywordVOS)) {
groupSet.setKeyWordStatistic(classifyId, bookGroupId, listKeywordVOS);
}
return listKeywordVOS;
}
} }
...@@ -140,4 +140,18 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> { ...@@ -140,4 +140,18 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> {
* @return * @return
*/ */
public List<String> getFriendIdListByBookAndRobot(String altId, List<Long> bookIds); public List<String> getFriendIdListByBookAndRobot(String altId, List<Long> bookIds);
/**
* 获取与社群书关联的小号数量
* @param bookGroupId
* @return
*/
Integer getAltCountByBookGroup(Long bookGroupId);
/**
* 社群书关联的小号及好友数量
* @param bookGroupId
* @return
*/
List<AltAndCountDTO> getAltFriendList(Long bookGroupId);
} }
...@@ -2,6 +2,7 @@ package com.pcloud.book.group.dao; ...@@ -2,6 +2,7 @@ package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO; import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatistic4AgentDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO; import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO; import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO; import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
...@@ -290,4 +291,11 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -290,4 +291,11 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* @param belongSpecialAgent * @param belongSpecialAgent
*/ */
public void updateSpecialState(Long id, Boolean belongSpecialAgent); public void updateSpecialState(Long id, Boolean belongSpecialAgent);
/**
* 根据书刊id获取社群书基本信息
* @param bookId
* @return
*/
BookGroupStatistic4AgentDTO getBaseInfoByBookId(Long bookId);
} }
...@@ -158,4 +158,14 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser> ...@@ -158,4 +158,14 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser>
map.put("altId", altId); map.put("altId", altId);
return getSessionTemplate().selectList(getStatement("getFriendIdListByBookAndRobot"), map); return getSessionTemplate().selectList(getStatement("getFriendIdListByBookAndRobot"), map);
} }
@Override
public Integer getAltCountByBookGroup(Long bookGroupId) {
return getSessionTemplate().selectOne(getStatement("getAltCountByBookGroup"), bookGroupId);
}
@Override
public List<AltAndCountDTO> getAltFriendList(Long bookGroupId) {
return getSessionTemplate().selectList(getStatement("getAltFriendList"), bookGroupId);
}
} }
...@@ -3,6 +3,7 @@ package com.pcloud.book.group.dao.impl; ...@@ -3,6 +3,7 @@ package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO; import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatistic4AgentDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO; import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO; import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO; import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
...@@ -330,4 +331,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -330,4 +331,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
paramMap.put("belongSpecialAgent", belongSpecialAgent); paramMap.put("belongSpecialAgent", belongSpecialAgent);
getSessionTemplate().update(getStatement("updateSpecialState"), paramMap); getSessionTemplate().update(getStatement("updateSpecialState"), paramMap);
} }
@Override
public BookGroupStatistic4AgentDTO getBaseInfoByBookId(Long bookId) {
return getSessionTemplate().selectOne(getStatement("getBaseInfoByBookId"), bookId);
}
} }
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.dto.BaseDto;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @描述:出版端书刊社群码数据
* @作者:zhuyajie
* @创建时间:14:40 2020/1/6
* @版本:1.0
*/
@Data
@ApiModel("出版端书刊社群码数据")
public class BookGroupStatistic4AgentDTO extends BaseDto {
@ApiModelProperty("社群书id")
private Long bookGroupId;
@ApiModelProperty("群二维码图片")
private String groupQrcodeUrl;
@ApiModelProperty("群二维码名称")
private String groupQrcodeName;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("进群方式")
private Integer joinGroupType;
@ApiModelProperty("浏览量")
private Integer browseCount;
@ApiModelProperty("浏览人数")
private Integer browserCount;
@ApiModelProperty("平均浏览时长")
private Long avgbrowseTimes;
@ApiModelProperty("购买次数")
private Long saleCount;
@ApiModelProperty("销售额")
private Double saleAmount;
/**
* 个人号列表
*/
private List<AltAndCountDTO> altAndCountDTOS;
/**
* 个人号配置资源数据统计
*/
private List<BookGroupServe> bookGroupServeList;
}
...@@ -27,6 +27,9 @@ public class ClassifyKeywordDTO implements Serializable { ...@@ -27,6 +27,9 @@ public class ClassifyKeywordDTO implements Serializable {
@ApiModelProperty("用户数量") @ApiModelProperty("用户数量")
private Integer userCount; private Integer userCount;
@ApiModelProperty("社群id")
private Long bookGroupId;
private List<ListKeywordVO> listKeywordVOS; private List<ListKeywordVO> listKeywordVOS;
public Long getClassifyId() { public Long getClassifyId() {
...@@ -69,6 +72,14 @@ public class ClassifyKeywordDTO implements Serializable { ...@@ -69,6 +72,14 @@ public class ClassifyKeywordDTO implements Serializable {
this.listKeywordVOS = listKeywordVOS; this.listKeywordVOS = listKeywordVOS;
} }
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
@Override @Override
public String toString() { public String toString() {
return "ClassifyKeywordDTO{" + return "ClassifyKeywordDTO{" +
...@@ -76,6 +87,7 @@ public class ClassifyKeywordDTO implements Serializable { ...@@ -76,6 +87,7 @@ public class ClassifyKeywordDTO implements Serializable {
", classify='" + classify + '\'' + ", classify='" + classify + '\'' +
", groupCount=" + groupCount + ", groupCount=" + groupCount +
", userCount=" + userCount + ", userCount=" + userCount +
", bookGroupId=" + bookGroupId +
", listKeywordVOS=" + listKeywordVOS + ", listKeywordVOS=" + listKeywordVOS +
'}'; '}';
} }
......
...@@ -2,12 +2,14 @@ package com.pcloud.book.group.entity; ...@@ -2,12 +2,14 @@ package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @Description * @Description
* @Author ruansiyuan * @Author ruansiyuan
* @Date 2019/9/23 15:35 * @Date 2019/9/23 15:35
**/ **/
@Data
public class BookGroupServe extends BaseEntity { public class BookGroupServe extends BaseEntity {
private static final long serialVersionUID = 7725930392678110441L; private static final long serialVersionUID = 7725930392678110441L;
...@@ -38,92 +40,28 @@ public class BookGroupServe extends BaseEntity { ...@@ -38,92 +40,28 @@ public class BookGroupServe extends BaseEntity {
@ApiModelProperty("是否超级作者") @ApiModelProperty("是否超级作者")
private Boolean isSuper; private Boolean isSuper;
@ApiModelProperty("销售价")
private Double retailPrice;
@ApiModelProperty("协议价")
private Double dealPrice;
@ApiModelProperty("浏览量")
private Integer browseCount;
@ApiModelProperty("浏览人数")
private Integer browserCount;
@ApiModelProperty("平均浏览时长")
private Long avgbrowseTimes;
@ApiModelProperty("购买次数")
private Integer saleCount;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("描述信息")
private String description;
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getServeType() {
return serveType;
}
public void setServeType(String serveType) {
this.serveType = serveType;
}
public String getServeUrl() {
return serveUrl;
}
public void setServeUrl(String serveUrl) {
this.serveUrl = serveUrl;
}
public String getShortUrl() {
return shortUrl;
}
public void setShortUrl(String shortUrl) {
this.shortUrl = shortUrl;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public String getServeName() {
return serveName;
}
public void setServeName(String serveName) {
this.serveName = serveName;
}
public String getFromType() {
return fromType;
}
public void setFromType(String fromType) {
this.fromType = fromType;
}
public Boolean getIsSuper() {
return isSuper;
}
public void setIsSuper(Boolean isSuper) {
this.isSuper = isSuper;
}
@Override
public String toString() {
return "BookGroupServe{" +
"serveId=" + serveId +
", serveType='" + serveType + '\'' +
", serveUrl='" + serveUrl + '\'' +
", shortUrl='" + shortUrl + '\'' +
", bookGroupId=" + bookGroupId +
", createUser=" + createUser +
", serveName='" + serveName + '\'' +
", fromType='" + fromType + '\'' +
", isSuper=" + isSuper +
"} " + super.toString();
}
} }
...@@ -17,6 +17,7 @@ import com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO; ...@@ -17,6 +17,7 @@ import com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO;
import com.pcloud.book.group.vo.ResourcesStatisticVO; import com.pcloud.book.group.vo.ResourcesStatisticVO;
import com.pcloud.book.group.vo.UpdateRankTypeVO; import com.pcloud.book.group.vo.UpdateRankTypeVO;
import com.pcloud.book.group.vo.UserBookInfoVO; import com.pcloud.book.group.vo.UserBookInfoVO;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean; import com.pcloud.common.page.PageBean;
...@@ -291,7 +292,7 @@ public interface BookGroupFacade { ...@@ -291,7 +292,7 @@ public interface BookGroupFacade {
@RequestParam("bookId") Long bookId @RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException; ) throws BizException, PermissionException, JsonParseException;
@ApiOperation("根据bookId获取社群书分类和关键词等统计信息") @ApiOperation("根据bookId获取社群书群分类资源统计信息")
@GetMapping("getBookGroupKeywordStatistics") @GetMapping("getBookGroupKeywordStatistics")
ResponseDto<?> getBookGroupKeywordStatistics( ResponseDto<?> getBookGroupKeywordStatistics(
@RequestHeader("token") String token, @RequestHeader("token") String token,
...@@ -656,4 +657,16 @@ public interface BookGroupFacade { ...@@ -656,4 +657,16 @@ public interface BookGroupFacade {
}) })
@GetMapping("updateSpecialState") @GetMapping("updateSpecialState")
public ResponseDto<?> updateSpecialState(@RequestParam("id") Long id, @RequestParam("belongSpecialAgent") Boolean belongSpecialAgent); public ResponseDto<?> updateSpecialState(@RequestParam("id") Long id, @RequestParam("belongSpecialAgent") Boolean belongSpecialAgent);
@ApiOperation("出版社根据bookId获取社群码统计信息")
@GetMapping("getBookGroupStatisticsByAgent")
ResponseDto<?> getBookGroupStatisticsByAgent(
@RequestHeader("token") String token,
@RequestParam("bookId") Long bookId
) throws BizException, PermissionException, JsonParseException;
@ApiOperation("获取群分类关键词数据")
@GetMapping("getClassifyKeywordStatistic")
ResponseDto<List<ListKeywordVO>> getClassifyKeywordStatistic(
@RequestHeader("token") String token, @RequestParam("classifyId") Long classifyId) throws PermissionException;
} }
...@@ -26,6 +26,7 @@ import com.pcloud.book.group.vo.TotalRescourceDataVO; ...@@ -26,6 +26,7 @@ import com.pcloud.book.group.vo.TotalRescourceDataVO;
import com.pcloud.book.group.vo.UpdateRankTypeVO; import com.pcloud.book.group.vo.UpdateRankTypeVO;
import com.pcloud.book.group.vo.UserBookInfoVO; import com.pcloud.book.group.vo.UserBookInfoVO;
import com.pcloud.book.group.vo.WxGroupStatisticVO; import com.pcloud.book.group.vo.WxGroupStatisticVO;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.core.constant.SystemCode; import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -405,7 +406,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -405,7 +406,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(bookGroupBiz.getBookGroupStatistics(bookId)); return new ResponseDto<>(bookGroupBiz.getBookGroupStatistics(bookId));
} }
@ApiOperation("根据bookId获取社群书分类和关键词等统计信息") @ApiOperation("根据bookId获取社群书群分类资源统计信息")
@GetMapping("getBookGroupKeywordStatistics") @GetMapping("getBookGroupKeywordStatistics")
@Override @Override
public ResponseDto<?> getBookGroupKeywordStatistics( public ResponseDto<?> getBookGroupKeywordStatistics(
...@@ -1015,4 +1016,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -1015,4 +1016,30 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
bookGroupBiz.updateSpecialState(id, belongSpecialAgent); bookGroupBiz.updateSpecialState(id, belongSpecialAgent);
return new ResponseDto<>(); return new ResponseDto<>();
} }
@ApiOperation("出版社根据bookId获取社群码统计信息")
@GetMapping("getBookGroupStatisticsByAgent")
@Override
public ResponseDto<?> getBookGroupStatisticsByAgent(
@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.getBookGroupStatisticsByAgent(bookId));
}
@Override
@GetMapping("getClassifyKeywordStatistic")
public ResponseDto<List<ListKeywordVO>> getClassifyKeywordStatistic(
@RequestHeader("token") String token, @RequestParam("classifyId") Long classifyId) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (classifyId == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "classifyId不能为空!");
}
List<ListKeywordVO> listKeywordVOS = bookGroupBiz.getClassifyKeywordStatistic(classifyId);
return new ResponseDto<>(listKeywordVOS);
}
} }
package com.pcloud.book.group.set; package com.pcloud.book.group.set;
import com.pcloud.analysisengine.browse.dto.GroupBrowseStatisticVO; import com.pcloud.analysisengine.browse.dto.GroupBrowseStatisticVO;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO; import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.appcenter.base.dto.AppPriceCacheDTO;
import com.pcloud.appcenter.cache.service.AppPriceCacheService;
import com.pcloud.book.consumer.analysisengine.BrowseRecordConsr; import com.pcloud.book.consumer.analysisengine.BrowseRecordConsr;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.app.AssistTempletConsr; import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.common.ExportConsr; import com.pcloud.book.consumer.common.ExportConsr;
import com.pcloud.book.consumer.label.LabelConsr; import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.trade.TradeConsr; import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.user.AdviserConsr; import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.AgentConsr; import com.pcloud.book.consumer.user.AgentConsr;
...@@ -18,17 +23,26 @@ import com.pcloud.book.group.dto.AgentStatisticsInfoDTO; ...@@ -18,17 +23,26 @@ import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO; import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO; import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.GroupTopicDTO; import com.pcloud.book.group.dto.GroupTopicDTO;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.vo.BookGroupAnalysisVO; import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.book.group.vo.UserBookInfoItemVO; import com.pcloud.book.group.vo.UserBookInfoItemVO;
import com.pcloud.book.group.vo.UserBookInfoVO; import com.pcloud.book.group.vo.UserBookInfoVO;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dto.KeywordResourceDTO; import com.pcloud.book.keywords.dto.KeywordResourceDTO;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.ListKeywordVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.MQTopicProducer; import com.pcloud.common.core.constant.MQTopicProducer;
import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.facade.tradecenter.dto.GroupIncomeSearchDto;
import com.pcloud.facade.tradecenter.dto.GroupMoneyDto;
import com.pcloud.facade.tradecenter.dto.ProductSaleDetailDto; import com.pcloud.facade.tradecenter.dto.ProductSaleDetailDto;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.resourcecenter.product.dto.SpecificationDto;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto; import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import com.pcloud.wechatgroup.group.dto.GroupUserCountDTO; import com.pcloud.wechatgroup.group.dto.GroupUserCountDTO;
import com.pcloud.wechatgroup.group.dto.GroupUserDTO; import com.pcloud.wechatgroup.group.dto.GroupUserDTO;
...@@ -90,6 +104,12 @@ public class GroupSet { ...@@ -90,6 +104,12 @@ public class GroupSet {
private BookGroupDao bookGroupDao; private BookGroupDao bookGroupDao;
@Autowired @Autowired
private LabelConsr labelConsr; private LabelConsr labelConsr;
@Autowired
private AppConsr appConsr;
@Autowired
private ProductConsr productConsr;
@Autowired
private AppPriceCacheService appPriceCacheService;
/** /**
* 群分类删除topic * 群分类删除topic
...@@ -451,4 +471,240 @@ public class GroupSet { ...@@ -451,4 +471,240 @@ public class GroupSet {
}); });
} }
} }
/**
* 填充关键词信息
*/
public void setKeyWordStatistic(Long classifyId, Long bookGroupId, List<ListKeywordVO> listKeywordVOS) {
if (ListUtils.isEmpty(listKeywordVOS)) {
return;
}
List<Long> appIds = listKeywordVOS.stream().filter(s -> "APP".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
List<Long> productIds = listKeywordVOS.stream().filter(s -> "PRODUCT".equalsIgnoreCase(s.getServeType())).map(ListKeywordVO::getServeId).collect(Collectors.toList());
//应用商品信息
Map<Long, AppDto> appDtoMap = new HashMap<>();
Map<Long, BigDecimal> appPriceMap = new HashMap<>();
Map<Long, ProductDto> productDtoMap = new HashMap<>();
Map<Long, Boolean> isSuperMap = new HashMap<>();
//浏览量浏览时长
Map<Long, GroupBrowseStatisticVO> appBrowseMap = new HashMap<>();
Map<Long, GroupBrowseStatisticVO> productBrowseMap = new HashMap<>();
//购买次数
Map<Long, GroupMoneyDto> appSaleDetail4Group = new HashMap<>();
Map<Long, GroupMoneyDto> productSaleDetail4Group = new HashMap<>();
if (!ListUtils.isEmpty(appIds)) {
appDtoMap = appConsr.mapByIds(appIds);
List<AppPriceCacheDTO> appPriceCacheDTOS = new ArrayList<>();
for (Long appId : appIds) {
if (appDtoMap.get(appId) != null) {
AppPriceCacheDTO appPriceCacheDTO = new AppPriceCacheDTO();
appPriceCacheDTO.setAppId(appId);
appPriceCacheDTO.setAppTypeEnum(AppTypeEnum.APP_TYPE_MAP.get(appDtoMap.get(appId).getTypeCode()));
appPriceCacheDTOS.add(appPriceCacheDTO);
}
}
appPriceMap = ResponseHandleUtil.parseMapResponse(appPriceCacheService.getCaches(appPriceCacheDTOS), Long.class, BigDecimal.class);
appBrowseMap = browseRecordConsr.mapServeBrowseStatisticByClassify(appIds, "APP", classifyId);
GroupIncomeSearchDto groupIncomeSearchDto = new GroupIncomeSearchDto();
groupIncomeSearchDto.setBookGroupId(bookGroupId);
groupIncomeSearchDto.setClassifyId(classifyId);
groupIncomeSearchDto.setIds(appIds);
groupIncomeSearchDto.setTypeCode("APP");
appSaleDetail4Group = tradeConsr.getSaleDetail4Group(groupIncomeSearchDto);
}
if (!ListUtils.isEmpty(productIds)) {
productDtoMap = productConsr.getProBasesByIds(productIds);
isSuperMap = productConsr.getIsSuperByProductIdList(productIds);
productBrowseMap = browseRecordConsr.mapServeBrowseStatisticByClassify(productIds, "PRODUCT", classifyId);
GroupIncomeSearchDto groupIncomeSearchDto = new GroupIncomeSearchDto();
groupIncomeSearchDto.setBookGroupId(bookGroupId);
groupIncomeSearchDto.setIds(productIds);
groupIncomeSearchDto.setClassifyId(classifyId);
groupIncomeSearchDto.setTypeCode("PRODUCT");
productSaleDetail4Group = tradeConsr.getSaleDetail4Group(groupIncomeSearchDto);
}
//数据填充
for (ListKeywordVO listKeywordVO : listKeywordVOS) {
if (ReplyTypeEnum.APP.value.equals(listKeywordVO.getReplyType())) {
listKeywordVO.setSaleCount(0);
if ("APP".equalsIgnoreCase(listKeywordVO.getServeType())) {
Long appId = listKeywordVO.getServeId();
if (!MapUtils.isEmpty(appDtoMap)) {
AppDto appDto = appDtoMap.get(appId);
if (appDto != null) {
listKeywordVO.setTypeCode(appDto.getTypeCode());
listKeywordVO.setContent(appDto.getTitle());
}
}
if (!MapUtils.isEmpty(appPriceMap)) {
if (appPriceMap.get(appId) != null) {
listKeywordVO.setRetailPrice(appPriceMap.get(appId).doubleValue());
listKeywordVO.setDealPrice(0D);
}
}
listKeywordVO.setApSource("APP");
if (!MapUtils.isEmpty(appBrowseMap) && appBrowseMap.containsKey(appId)) {
GroupBrowseStatisticVO appBrowse = appBrowseMap.get(appId);
listKeywordVO.setBrowseCount(appBrowse.getBrowseCount());
listKeywordVO.setBrowserCount(appBrowse.getBrowserCount());
listKeywordVO.setAvgbrowseTimes(appBrowse.getBrowserCount() == 0 ? 0 : appBrowse.getBrowseTimes() / appBrowse.getBrowserCount());
}
if (!MapUtils.isEmpty(appSaleDetail4Group) && appSaleDetail4Group.containsKey(appId)) {
GroupMoneyDto groupMoneyDto = appSaleDetail4Group.get(appId);
if (null != groupMoneyDto && null != groupMoneyDto.getSaleCount()) {
listKeywordVO.setSaleCount(groupMoneyDto.getSaleCount().intValue());
}
}
} else if ("PRODUCT".equalsIgnoreCase(listKeywordVO.getServeType())) {
Long productId = listKeywordVO.getServeId();
if (!MapUtils.isEmpty(productDtoMap)) {
ProductDto productDto = productDtoMap.get(productId);
if (productDto != null) {
listKeywordVO.setTypeCode(productDto.getProductTypeCode());
listKeywordVO.setContent(productDto.getProductName());
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());
}
}
}
}
//判断是否为超级作者作品
if (!MapUtils.isEmpty(isSuperMap) && isSuperMap.get(productId) != null && isSuperMap.get(productId)) {
listKeywordVO.setApSource("SUPER_PRODUCT");
} else {
listKeywordVO.setApSource("PRODUCT");
}
if (!MapUtils.isEmpty(productBrowseMap) && productBrowseMap.containsKey(productId)) {
GroupBrowseStatisticVO productBrowse = productBrowseMap.get(productId);
listKeywordVO.setBrowseCount(productBrowse.getBrowseCount());
listKeywordVO.setBrowserCount(productBrowse.getBrowserCount());
listKeywordVO.setAvgbrowseTimes(productBrowse.getBrowserCount() == 0 ? 0 : productBrowse.getBrowseTimes() / productBrowse.getBrowserCount());
}
if (!MapUtils.isEmpty(productSaleDetail4Group) && productSaleDetail4Group.containsKey(productId)) {
GroupMoneyDto groupMoneyDto = productSaleDetail4Group.get(productId);
if (null != groupMoneyDto && null != groupMoneyDto.getSaleCount()) {
listKeywordVO.setSaleCount(groupMoneyDto.getSaleCount().intValue());
}
}
}
}
}
}
/**
* 个人号资源配置统计数据
* @param bookGroupServeList
* @param bookGroupId
*/
public void setBookGroupServeStatistic(List<BookGroupServe> bookGroupServeList, Long bookGroupId) {
if (ListUtils.isEmpty(bookGroupServeList)) {
return;
}
List<Long> appIds = bookGroupServeList.stream().filter(s -> "APP".equalsIgnoreCase(s.getServeType())).map(BookGroupServe::getServeId).collect(Collectors.toList());
List<Long> productIds = bookGroupServeList.stream().filter(s -> "PRODUCT".equalsIgnoreCase(s.getServeType())).map(BookGroupServe::getServeId).collect(Collectors.toList());
Map<Long, ProductDto> productDtoMap = new HashMap<>();
Map<Long, AppDto> appDtoMap = new HashMap<>();
//浏览量浏览时长
Map<Long, GroupBrowseStatisticVO> appBrowseStatisticMap = new HashMap<>();
Map<Long, GroupBrowseStatisticVO> productBrowseStatisticMap = new HashMap<>();
//购买次数
Map<Long, GroupMoneyDto> appSaleDetail4Group = new HashMap<>();
Map<Long, GroupMoneyDto> productSaleDetail4Group = new HashMap<>();
//销售价协议价
Map<Long, BigDecimal> appPriceMap = new HashMap<>();
if (!ListUtils.isEmpty(productIds)) {
productDtoMap = productConsr.getProBasesByIds(productIds);
productBrowseStatisticMap = browseRecordConsr.mapServeBrowseStatistic(productIds, "PRODUCT", bookGroupId);
GroupIncomeSearchDto groupIncomeSearchDto = new GroupIncomeSearchDto();
groupIncomeSearchDto.setBookGroupId(bookGroupId);
groupIncomeSearchDto.setIds(productIds);
groupIncomeSearchDto.setTypeCode("PRODUCT");
productSaleDetail4Group = tradeConsr.getSaleDetail4Group(groupIncomeSearchDto);
}
if (!ListUtils.isEmpty(appIds)) {
appDtoMap = appConsr.mapByIds(appIds);
appBrowseStatisticMap = browseRecordConsr.mapServeBrowseStatistic(appIds, "APP", bookGroupId);
List<AppPriceCacheDTO> appPriceCacheDTOS = new ArrayList<>();
for (Long appId : appIds) {
if (null != appDtoMap.get(appId)) {
AppPriceCacheDTO appPriceCacheDTO = new AppPriceCacheDTO();
appPriceCacheDTO.setAppId(appId);
appPriceCacheDTO.setAppTypeEnum(AppTypeEnum.APP_TYPE_MAP.get(appDtoMap.get(appId).getTypeCode()));
appPriceCacheDTOS.add(appPriceCacheDTO);
}
}
appPriceMap = ResponseHandleUtil.parseMapResponse(appPriceCacheService.getCaches(appPriceCacheDTOS), Long.class, BigDecimal.class);
GroupIncomeSearchDto groupIncomeSearchDto = new GroupIncomeSearchDto();
groupIncomeSearchDto.setBookGroupId(bookGroupId);
groupIncomeSearchDto.setIds(appIds);
groupIncomeSearchDto.setTypeCode("APP");
appSaleDetail4Group = tradeConsr.getSaleDetail4Group(groupIncomeSearchDto);
}
for (BookGroupServe bookGroupServe : bookGroupServeList) {
Long serveId = bookGroupServe.getServeId();
GroupBrowseStatisticVO statisticVO = new GroupBrowseStatisticVO();
GroupMoneyDto groupMoneyDto = new GroupMoneyDto();
if ("PRODUCT".equals(bookGroupServe.getServeType())) {
if (!MapUtils.isEmpty(productDtoMap) && productDtoMap.containsKey(serveId)) {
ProductDto productDto = productDtoMap.get(serveId);
if (productDto != null) {
bookGroupServe.setServeName(productDto.getProductName());
if (productDto.getProductTypeDto() != null) {
bookGroupServe.setFromType(productDto.getProductTypeDto().getTypeCode());
bookGroupServe.setDescription(productDto.getProductTypeDto().getTypeName());
bookGroupServe.setPicUrl(productDto.getCoverImg());
}
List<SpecificationDto> specificationDtos = productDto.getSpecification();
if (!ListUtils.isEmpty(specificationDtos)) {
SpecificationDto specificationDto = specificationDtos.get(0);
if (null != specificationDto) {
bookGroupServe.setRetailPrice(specificationDto.getAdvisePrice());
bookGroupServe.setDealPrice(specificationDto.getDealPrice());
}
}
}
}
if (!MapUtils.isEmpty(productBrowseStatisticMap) && productBrowseStatisticMap.containsKey(serveId)) {
statisticVO = productBrowseStatisticMap.get(serveId);
}
if (!MapUtils.isEmpty(productSaleDetail4Group) && productSaleDetail4Group.containsKey(serveId)) {
groupMoneyDto = productSaleDetail4Group.get(serveId);
}
} else if ("APP".equals(bookGroupServe.getServeType())) {
if (!MapUtils.isEmpty(appDtoMap) && appDtoMap.containsKey(serveId)) {
AppDto appDto = appDtoMap.get(serveId);
if (appDto != null) {
bookGroupServe.setServeName(appDto.getTitle());
bookGroupServe.setFromType(appDto.getTypeCode());
bookGroupServe.setDescription(appDto.getTypeName());
bookGroupServe.setPicUrl(appDto.getSquareImg());
}
}
if (!MapUtils.isEmpty(appBrowseStatisticMap) && appBrowseStatisticMap.containsKey(serveId)) {
statisticVO = appBrowseStatisticMap.get(serveId);
}
if (!MapUtils.isEmpty(appPriceMap)) {
if (appPriceMap.get(serveId) != null) {
bookGroupServe.setRetailPrice(appPriceMap.get(serveId).doubleValue());
bookGroupServe.setDealPrice(0D);
}
}
if (!MapUtils.isEmpty(appSaleDetail4Group) && appSaleDetail4Group.containsKey(serveId)) {
groupMoneyDto = appSaleDetail4Group.get(serveId);
}
}
if (null != statisticVO && null != statisticVO.getBrowseCount()) {
bookGroupServe.setBrowseCount(statisticVO.getBrowseCount());
bookGroupServe.setBrowserCount(statisticVO.getBrowserCount());
bookGroupServe.setAvgbrowseTimes(statisticVO.getBrowserCount() == 0 ? 0 : statisticVO.getBrowseTimes() / statisticVO.getBrowserCount());
}
if (null != groupMoneyDto && null != groupMoneyDto.getSaleCount()) {
bookGroupServe.setSaleCount(groupMoneyDto.getSaleCount().intValue());
}
}
}
} }
...@@ -25,6 +25,23 @@ public class StatisticVO implements Serializable { ...@@ -25,6 +25,23 @@ public class StatisticVO implements Serializable {
* 用户数量 * 用户数量
*/ */
private Integer userNumber; private Integer userNumber;
/**
* 进群方式
*/
private Integer joinGroupType;
/**
* 个人号数量
*/
private Integer robotCount;
/**
* 总好友数
*/
private Integer friendCount;
/**
* 社群书id
*/
private Long bookGroupId;
public Integer getClassifyCount() { public Integer getClassifyCount() {
return classifyCount; return classifyCount;
...@@ -50,12 +67,48 @@ public class StatisticVO implements Serializable { ...@@ -50,12 +67,48 @@ public class StatisticVO implements Serializable {
this.userNumber = userNumber; this.userNumber = userNumber;
} }
public Integer getJoinGroupType() {
return joinGroupType;
}
public void setJoinGroupType(Integer joinGroupType) {
this.joinGroupType = joinGroupType;
}
public Integer getRobotCount() {
return robotCount;
}
public void setRobotCount(Integer robotCount) {
this.robotCount = robotCount;
}
public Integer getFriendCount() {
return friendCount;
}
public void setFriendCount(Integer friendCount) {
this.friendCount = friendCount;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroupStatisticDTO{" + return "StatisticVO{" +
", classifyCount=" + classifyCount + "classifyCount=" + classifyCount +
", groupNumber=" + groupNumber + ", groupNumber=" + groupNumber +
", userNumber=" + userNumber + ", userNumber=" + userNumber +
", joinGroupType=" + joinGroupType +
", robotCount=" + robotCount +
", friendCount=" + friendCount +
", bookGroupId=" + bookGroupId +
'}'; '}';
} }
} }
...@@ -93,11 +93,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> { ...@@ -93,11 +93,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
Integer getKeywordCount(Long bookGroupId, Long classifyId); Integer getKeywordCount(Long bookGroupId, Long classifyId);
/** /**
* 根据分类id集合获取 * 根据分类id获取
* @param classifyIds * @param classifyId
* @return * @return
*/ */
List<ListKeywordVO> getKeywordsByClassifyIds(List<Long> classifyIds, Long bookId); List<ListKeywordVO> getKeywordsByClassifyId(Long classifyId, Long bookId);
/** /**
* @description 根据booGroupId获取关键词id * @description 根据booGroupId获取关键词id
...@@ -155,4 +155,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> { ...@@ -155,4 +155,11 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
* 查询所有的作品应用类型的关键词 * 查询所有的作品应用类型的关键词
*/ */
List<BookGroupApp> getAllAppKeyword(); List<BookGroupApp> getAllAppKeyword();
/**
* 根据分类id获取应用关键词回复
* @param classifyId
* @return
*/
List<ListKeywordVO> getAppKeywordsByClassifyId(Long classifyId, Long bookGroupId, List<Long> keywordIdList);
} }
...@@ -120,11 +120,11 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book ...@@ -120,11 +120,11 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
} }
@Override @Override
public List<ListKeywordVO> getKeywordsByClassifyIds(List<Long> classifyIds, Long bookId) { public List<ListKeywordVO> getKeywordsByClassifyId(Long classifyId, Long bookId) {
Map<String, Object> paramMap = new HashMap<>(); Map<String, Object> paramMap = new HashMap<>();
paramMap.put("classifyIds", classifyIds); paramMap.put("classifyId", classifyId);
paramMap.put("bookId", bookId); paramMap.put("bookId", bookId);
return this.getSqlSession().selectList(this.getStatement("getKeywordsByClassifyIds"), paramMap); return this.getSqlSession().selectList(this.getStatement("getKeywordsByClassifyId"), paramMap);
} }
@Override @Override
...@@ -192,4 +192,13 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book ...@@ -192,4 +192,13 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
return getSessionTemplate().selectList(getStatement("getAllAppKeyword")); return getSessionTemplate().selectList(getStatement("getAllAppKeyword"));
} }
@Override
public List<ListKeywordVO> getAppKeywordsByClassifyId(Long classifyId, Long bookGroupId, List<Long> keywordIdList) {
Map<String, Object> paramMap = new HashMap();
paramMap.put("classifyId", classifyId);
paramMap.put("bookGroupId", bookGroupId);
paramMap.put("keywordIdList", keywordIdList);
return getSessionTemplate().selectList(getStatement("getAppKeywordsByClassifyId"), paramMap);
}
} }
...@@ -70,7 +70,7 @@ public class ListKeywordVO implements Serializable { ...@@ -70,7 +70,7 @@ public class ListKeywordVO implements Serializable {
@ApiModelProperty("协议价") @ApiModelProperty("协议价")
private Double dealPrice; private Double dealPrice;
@ApiModelProperty("协议价") @ApiModelProperty("渠道id")
private Long channelId; private Long channelId;
@ApiModelProperty("应用或作品类型") @ApiModelProperty("应用或作品类型")
...@@ -82,4 +82,15 @@ public class ListKeywordVO implements Serializable { ...@@ -82,4 +82,15 @@ public class ListKeywordVO implements Serializable {
@ApiModelProperty("是否可编辑0-否,1-是") @ApiModelProperty("是否可编辑0-否,1-是")
private Integer isEdit; private Integer isEdit;
@ApiModelProperty("浏览量")
private Integer browseCount;
@ApiModelProperty("浏览人数")
private Integer browserCount;
@ApiModelProperty("平均浏览时长")
private Long avgbrowseTimes;
@ApiModelProperty("购买次数")
private Integer saleCount;
} }
...@@ -454,4 +454,25 @@ ...@@ -454,4 +454,25 @@
</if> </if>
</select> </select>
<select id="getAltCountByBookGroup" parameterType="long" resultType="integer">
SELECT
COUNT(DISTINCT alt_id)
FROM
book_group_cipher_user
WHERE
book_group_id = #{bookGroupId}
</select>
<select id="getAltFriendList" parameterType="long" resultType="com.pcloud.book.group.dto.AltAndCountDTO">
SELECT
alt_id altId,
COUNT(DISTINCT wx_user_id) friendCount
FROM
book_group_cipher_user
WHERE
book_group_id = #{bookGroupId}
GROUP BY
alt_id
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -847,13 +847,17 @@ ...@@ -847,13 +847,17 @@
SELECT SELECT
COUNT(DISTINCT t1.id) classifyCount, COUNT(DISTINCT t1.id) classifyCount,
COUNT(DISTINCT t2.id) groupNumber, COUNT(DISTINCT t2.id) groupNumber,
IFNULL(SUM(t2.user_number),0) userNumber IFNULL(SUM(t2.user_number), 0) userNumber,
g.join_group_type joinGroupType,
t1.book_group_id bookGroupId
FROM FROM
book_group_classify t1 book_group_classify t1
left JOIN book_group_qrcode t2 ON t1.id = t2.classify_id LEFT JOIN book_group_qrcode t2 ON t1.id = t2.classify_id
AND t2.is_delete = 0 AND t2.is_delete = 0
LEFT JOIN book_group g ON t1.book_group_id = g.id
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND g.is_delete = 0
AND t1.book_id = #{bookId} AND t1.book_id = #{bookId}
</select> </select>
...@@ -863,13 +867,16 @@ ...@@ -863,13 +867,16 @@
t1.id classifyId, t1.id classifyId,
t1.classify classify, t1.classify classify,
COUNT(DISTINCT t2.id) groupCount, COUNT(DISTINCT t2.id) groupCount,
IFNULL(SUM(t2.user_number),0) userCount IFNULL(SUM(t2.user_number), 0) userCount,
t1.book_group_id bookGroupId
FROM FROM
book_group_classify t1 book_group_classify t1
left JOIN book_group_qrcode t2 ON t1.id = t2.classify_id LEFT JOIN book_group_qrcode t2 ON t1.id = t2.classify_id
AND t2.is_delete = 0 AND t2.is_delete = 0
LEFT JOIN book_group g ON t1.book_group_id = g.id
WHERE WHERE
t1.is_delete = 0 t1.is_delete = 0
AND g.is_delete = 0
AND t1.book_id = #{bookId} AND t1.book_id = #{bookId}
group by t1.id group by t1.id
</select> </select>
......
...@@ -888,4 +888,19 @@ ...@@ -888,4 +888,19 @@
UPDATE book_group SET belong_special_agent = #{belongSpecialAgent} WHERE id = #{id} UPDATE book_group SET belong_special_agent = #{belongSpecialAgent} WHERE id = #{id}
</update> </update>
<select id="getBaseInfoByBookId" parameterType="long" resultType="com.pcloud.book.group.dto.BookGroupStatistic4AgentDTO">
SELECT
id bookGroupId,
group_qrcode_name groupQrcodeName,
group_qrcode_url groupQrcodeUrl,
create_time createTime,
join_group_type joinGroupType
FROM
book_group
WHERE
is_delete = 0
AND book_id = #{bookId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -741,6 +741,8 @@ ...@@ -741,6 +741,8 @@
<select id="getWechatGroupInfoMap" parameterType="list" resultType="com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising"> <select id="getWechatGroupInfoMap" parameterType="list" resultType="com.pcloud.book.group.dto.GroupQrcodeInfo4Advertising">
SELECT SELECT
t.id groupQrcodeId, t.id groupQrcodeId,
t.classify_id classifyId,
t1.book_group_id bookGroupId,
t.group_name groupName, t.group_name groupName,
t.qrcode_url qrcodeUrl, t.qrcode_url qrcodeUrl,
bg.join_group_type joinGroupType bg.join_group_type joinGroupType
......
...@@ -347,8 +347,8 @@ ...@@ -347,8 +347,8 @@
order by t.create_time desc order by t.create_time desc
</select> </select>
<!--根据分类id集合获取--> <!--根据分类id获取-->
<select id="getKeywordsByClassifyIds" parameterType="map" resultType="com.pcloud.book.keywords.vo.ListKeywordVO"> <select id="getKeywordsByClassifyId" parameterType="map" resultType="com.pcloud.book.keywords.vo.ListKeywordVO">
SELECT SELECT
bk.id bookKeywordId, bk.id bookKeywordId,
k.id keywordId, k.id keywordId,
...@@ -370,11 +370,12 @@ ...@@ -370,11 +370,12 @@
WHERE WHERE
bk.is_delete = 0 bk.is_delete = 0
AND k.is_delete = 0 AND k.is_delete = 0
AND (bk.classify_id IN AND (
<foreach collection="classifyIds" item="item" open="(" separator="," close=")"> bk.classify_id = #{classifyId} OR bk.classify_id = 0
#{item} )
</foreach> AND bk.book_id = #{bookId}
or bk.book_id =#{bookId}) GROUP BY
bk.keyword_id
ORDER BY ORDER BY
bk.rank ASC,bk.id DESC bk.rank ASC,bk.id DESC
</select> </select>
...@@ -574,4 +575,44 @@ ...@@ -574,4 +575,44 @@
t1.serve_id, t1.serve_id,
t1.serve_type t1.serve_type
</select> </select>
<select id="getAppKeywordsByClassifyId" 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 = #{classifyId}
AND bk.book_group_id = #{bookGroupId}
AND k.reply_type = 4
<if test="keywordIdList != null and keywordIdList.size>0">
AND k.id NOT IN
<foreach collection = "keywordIdList" index="index" item = "item" open = "(" separator= "," close = ")">
${item}
</foreach>
</if>
GROUP BY
bk.keyword_id
ORDER BY
bk.rank ASC,
bk.update_time DESC,
bk.id DESC
</select>
</mapper> </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