Commit dba2d884 by 阮思源

c1001923

parent b50c3c60
package com.pcloud.book.group.dto;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/22 14:48
**/
@Data
public class AltAndCountDTO {
private String altId;
private Integer count;
}
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.common.dto.BaseDto;
import java.util.Date;
import java.util.List;
/**
* @描述:个人号读者统计
* @作者:zhuyajie
* @创建时间:10:32 2019/11/11
* @版本:1.0
*/
public class SelfRobotUserDTO extends BaseDto {
/**
* 微信用户ID
*/
private String wxUserId;
/**
* 个人号id
*/
private String robotId;
/**
* 扫码书刊
*/
private List<BookDto> bookList;
/**
* 加好友时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date joinTime;
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getRobotId() {
return robotId;
}
public void setRobotId(String robotId) {
this.robotId = robotId;
}
public List<BookDto> getBookList() {
return bookList;
}
public void setBookList(List<BookDto> bookList) {
this.bookList = bookList;
}
public Date getJoinTime() {
return joinTime;
}
public void setJoinTime(Date joinTime) {
this.joinTime = joinTime;
}
}
package com.pcloud.book.group.dto;
import java.util.List;
import lombok.Data;
/**
* @描述:个人号读者信息查询参数
* @作者:zhuyajie
* @创建时间:11:05 2019/11/11
* @版本:1.0
*/
@Data
public class SelfRobtParamDTO {
/**
* 读者id列表
*/
private List<String> userIds;
/**
* 个人号id列表
*/
private List<String> robotIds;
/**
* 图书id列表
*/
private List<Long> bookIds;
/**
* 当前页
*/
private Integer currentPage;
/**
* 每页数量
*/
private Integer numPerPage;
/**
* 个人号用户筛选,用户筛选好友状态
*/
List<SelfRobotUserDTO> deleteUserDTOS;
/**
* 好友状态 1:已同意 2:已删除
*/
private Integer friendState;
}
package com.pcloud.book.group.enums;
public enum LargTempletEnum {
public enum LargeTempletEnum {
/**
* K12类
*/
......@@ -17,13 +17,18 @@ public enum LargTempletEnum {
/**
* 大众类
*/
GENERAL(4, "大众类");
GENERAL(4, "大众类"),
/**
* 特殊出版社类
*/
SPECIAL_AGENT(5, "特殊出版社");
public final Integer code;
public final String name;
LargTempletEnum(Integer code, String name) {
LargeTempletEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
......
package com.pcloud.book.group.service;
import com.pcloud.book.group.dto.AltAndCountDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.dto.GroupCipherDTO;
......@@ -7,6 +8,8 @@ import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QueryByBookAdviserDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.dto.SelfRobtParamDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.exceptions.BizException;
......@@ -28,6 +31,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* Description 社群书内部接口
......@@ -127,4 +131,39 @@ public interface BookGroupService {
@GetMapping("dealBookGroupServeOldOnShelves")
void dealBookGroupServeOldOnShelves();
@ApiOperation(value = "1v1社群码下用户id", httpMethod = "GET")
@GetMapping("getFriendIdsByBookGroupId")
ResponseEntity<ResponseDto<List<String>>> getFriendIdsByBookGroupId(@RequestParam("bookGroupId") Long bookGroupId);
@ApiOperation(value = "个人号读者统计", httpMethod = "POST")
@PostMapping("listPageFriendInfo")
ResponseEntity<ResponseDto<PageBeanNew<SelfRobotUserDTO>>> listPageFriendInfo(@RequestBody @ApiParam SelfRobtParamDTO selfRobtParamDTO);
@ApiOperation("补充社群书的出版社id")
@GetMapping("fillAgentIdForBookGroup")
void fillAgentIdForBookGroup();
@ApiOperation("获取个人号累计加好友人数")
@GetMapping("getAddFriendCount")
ResponseEntity<ResponseDto<Integer>> getAddFriendCount();
@ApiOperation("获取所有已建分类的1v1的社群码")
@GetMapping("get1v1HasClassifyBookGroupIds")
ResponseEntity<ResponseDto<List<Long>>> get1v1HasClassifyBookGroupIds();
@ApiOperation("根据小号批量获取服务社群书数量")
@PostMapping("getBookGroupCountMapByAltIds")
ResponseEntity<ResponseDto<Map<String,Integer>>> getBookGroupCountMapByAltIds(@RequestBody List<String> altIds);
@ApiOperation("获取小号社群书数量")
@PostMapping("getSerBookGroupCountByAltIds")
ResponseEntity<ResponseDto<Integer>> getSerBookGroupCountByAltIds(@RequestBody List<String> altIds);
@ApiOperation("出版社关联的个人号以及个人号的社群书数量")
@GetMapping("getAltAndCountDTOListByAgentId")
ResponseEntity<ResponseDto<List<AltAndCountDTO>>> getAltAndCountDTOListByAgentId(@RequestParam("agentId") Long agentId);
@ApiOperation("补充社群书旧的作品应用到新的表")
@GetMapping("addOldBookGroupAppToNew")
void addOldBookGroupAppToNew();
}
......@@ -567,4 +567,13 @@ public interface BookBiz {
* 根据书名或ISBN编号获取书id集合
*/
List<Long> getIdsByNameOrISBN(String keyword, Long adviserId);
/**
* 获取1v1社群书书刊列表
* @param currentPage
* @param numPerPage
* @param name
* @return
*/
PageBean getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name);
}
......@@ -53,6 +53,7 @@ import com.pcloud.book.copyright.biz.BookAuthInfoBiz;
import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.group.biz.BookGroupBiz;
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.common.core.aspect.ParamLog;
......@@ -1720,4 +1721,14 @@ public class BookBizImpl implements BookBiz {
}
return bookIds;
}
@Override
public PageBean getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name) {
Map<String, Object> paramMap = new HashMap<>();
if (!StringUtil.isEmpty(name)) {
paramMap.put("name", name);
}
paramMap.put("joinGroupType", JoinGroupTypeEnum.ROBOT.getCode());
return bookDao.listPage(new PageParam(currentPage, numPerPage), paramMap, "getListPage4BookGroup");
}
}
......@@ -26,9 +26,22 @@ import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import io.swagger.annotations.ApiOperation;
/**
* @描述:书籍接口实现类
......@@ -763,4 +776,20 @@ public class BookFacadeImpl implements BookFacade {
PageBeanNew pageBeanNew = bookBiz.listNoAuthGroupBook(listNoAuthGroupBookParam, adviserId);
return new ResponseDto<PageBeanNew>(null == pageBeanNew ? new PageBeanNew():pageBeanNew);
}
}
@ApiOperation("获取1v1社群书书刊列表")
@RequestMapping(value = "getListPage4SelfBookGroup", method = RequestMethod.GET)
public ResponseDto<PageBean> getListPage4SelfBookGroup(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
PageBean pageBean = bookBiz.getListPage4SelfBookGroup(currentPage, numPerPage, name);
return new ResponseDto<PageBean>(null == pageBean ? new PageBean() : pageBean);
}
}
\ No newline at end of file
......@@ -139,4 +139,15 @@ public class BrowseRecordConsr {
return map;
}
@ParamLog("获取应用/资源浏览量")
public Map<Long, GroupBrowseStatisticVO> mapServeBrowseStatistic(List<Long> serveIds, String serveType, Long bookGroupId) {
Map<Long, GroupBrowseStatisticVO> map = null;
try {
map = ResponseHandleUtil.parseMapResponse(browseRecordService.mapServeBrowseStatistic(serveIds, serveType,bookGroupId), Long.class, GroupBrowseStatisticVO.class);
} catch (Exception e) {
LOGGER.error("获取应用/资源浏览量失败" + e.getMessage(), e);
}
return map;
}
}
......@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.pcloud.common.core.aspect.ParamLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -152,4 +153,22 @@ public class AppConsr {
return appDto;
}
@ParamLog("批量获取应用场景值")
public Map<Long, String> listSceneNameByIds(List<Long> appIds) {
Map<Long, String> map = new HashMap<>();
if (ListUtils.isEmpty(appIds)) {
return map;
}
try {
map = ResponseHandleUtil.parseMapResponse(appService.listSceneNameByIds(appIds), Long.class, String.class);
} catch (BizException e) {
LOGGER.warn("批量获取应用场景值[appService.listSceneNameByIds]:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("批量获取应用场景值[appService.listSceneNameByIds]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_USER_ERROR, "批量获取应用场景值失败~!");
}
return map;
}
}
package com.pcloud.book.consumer.user;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.usercenter.party.merchant.service.MerchantService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/14 16:42
**/
@Component("merchantConsr")
public class MerchantConsr {
/**
* logger
*/
private static final Logger LOGGER = LoggerFactory.getLogger(MerchantConsr.class);
@Autowired
private MerchantService merchantService;
/**
* 批量获取作者名称
*/
public Map<Long, String> getNamesByIdList(List<Long> merchantIds) throws BizException {
LOGGER.info("批量获取作者名称,<START>.[merchantIds]=" + merchantIds.toString());
if (ListUtils.isEmpty(merchantIds)) {
return null;
}
Map<Long, String> map = null;
try {
map = ResponseHandleUtil.parseMapResponse(merchantService.getNamesByIdList(merchantIds), Long.class,
String.class);
} catch (Exception e) {
LOGGER.error("批量获取作者名称,<ERROR>.[getNamesByIdList]:" + e.getMessage(), e);
}
return map;
}
/**
* 批量获取作者名称
*/
public Map<Long, Long> getSuperMerchantList() throws BizException {
Map<Long, Long> map = null;
try {
map = ResponseHandleUtil.parseMapResponse(merchantService.getSuperMerchantList(), Long.class, Long.class);
} catch (Exception e) {
LOGGER.error("获取所有超级作者,<ERROR>.[getSuperMerchantList]:" + e.getMessage(), e);
}
return map;
}
}
......@@ -14,20 +14,26 @@ import com.pcloud.wechatgroup.group.dto.RobotReplyDTO;
import com.pcloud.wechatgroup.group.service.GroupMemberService;
import com.pcloud.wechatgroup.message.dto.BrandParamDTO;
import com.pcloud.wechatgroup.message.dto.GroupChatCountDTO;
import com.pcloud.wechatgroup.message.dto.GroupMsgCountDTO;
import com.pcloud.wechatgroup.message.dto.GroupStatistics;
import com.pcloud.wechatgroup.message.dto.LinkGroupParamDTO;
import com.pcloud.wechatgroup.message.dto.UserChatCountDTO;
import com.pcloud.wechatgroup.message.service.MessageService;
import com.pcloud.wechatgroup.monitor.service.MonitorService;
import com.pcloud.wechatgroup.selfrobot.dto.AltAndUserDTO;
import com.pcloud.wechatgroup.selfrobot.dto.AltAndUserResultDTO;
import com.pcloud.wechatgroup.selfrobot.dto.RobotBaseInfoDTO;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotDTO;
import com.pcloud.wechatgroup.selfrobot.dto.UserRobotDTO;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -450,4 +456,106 @@ public class WechatGroupConsr {
}
return map;
}
@ParamLog("获取所有特殊出版社")
public List<Long> getAllAgentId() {
List<Long> agentIds = new ArrayList<>();
try {
agentIds = ResponseHandleUtil.parseList(selfRobotService.getAllAgentId(), Long.class);
} catch (Exception e) {
log.error("查询小号信息.[getGroupRobotByWxId]:" + e.getMessage(), e);
}
return agentIds;
}
@ParamLog("根据大类拿所有小号id集合")
public List<String> getRobotListByLargeTemplet(Integer largeTemplet) {
List<String> altIds = new ArrayList<>();
if (largeTemplet == null) {
return altIds;
}
try {
altIds = ResponseHandleUtil.parseList(selfRobotService.getRobotListByLargeTemplet(largeTemplet), String.class);
} catch (Exception e) {
log.error("根据大类拿所有小号id集合.[getRobotListByLargeTemplet]:" + e.getMessage(), e);
}
return altIds;
}
@ParamLog("批量获取小号名称信息")
public Map<String, RobotBaseInfoDTO> mapRobotInfo(List<String> altIds) {
Map<String, RobotBaseInfoDTO> map = new HashMap<>();
try {
map = ResponseHandleUtil.parseMapResponse(selfRobotService.mapRobotInfo(altIds), String.class, RobotBaseInfoDTO.class);
} catch (Exception e) {
log.error("查询链接发送次数.[getLinkSendCount]:" + e.getMessage(), e);
}
return map;
}
@ParamLog("社群书群消息量")
public Map<Long, GroupMsgCountDTO> mapBookGroupMsgCount(List<Long> bookGroupIds) {
Map<Long, GroupMsgCountDTO> map = new HashMap<>();
try {
map = ResponseHandleUtil.parseMapResponse(messageService.mapBookGroupMsgCount(bookGroupIds), Long.class, GroupMsgCountDTO.class);
} catch (Exception e) {
log.error("社群书群消息量.[mapBookGroupMsgCount]:" + e.getMessage(), e);
}
return map;
}
@ParamLog("每个用户接收消息数量")
public Map<String, Integer> mapReceiveMsgCountByIds(List<String> wxUserIds) {
Map<String, Integer> map = new HashMap<>();
try {
map = ResponseHandleUtil.parseMapResponse(selfRobotService.mapReceiveMsgCountByIds(wxUserIds), String.class, Integer.class);
} catch (Exception e) {
log.error("每个用户接收消息数量.[mapReceiveMsgCountByIds]:" + e.getMessage(), e);
}
return map;
}
@ParamLog("出版社对应的机器人消息量")
public Map<Long, Integer> mapAgentMsgCountByRobotIdList(Map<Long, List<String>> agentRobotsMap) {
Map<Long, Integer> map = new HashMap<>();
if(agentRobotsMap.isEmpty()) {
return map;
}
try {
map = ResponseHandleUtil.parseMapResponse(selfRobotService.mapAgentMsgCountByRobotIdList(agentRobotsMap), Long.class, Integer.class);
} catch (Exception e) {
log.error("出版社对应的机器人消息量.[mapAgentMsgCountByRobotIdList]:" + e.getMessage(), e);
}
return map;
}
@ParamLog("出版社定制小号数")
public Map<Long, Integer> mapSpecialAgentRobotCount(List<Long> agentIds) {
Map<Long, Integer> map = new HashMap<>();
if(CollectionUtils.isEmpty(agentIds)) {
return map;
}
try {
map = ResponseHandleUtil.parseMapResponse(selfRobotService.mapSpecialAgentRobotCount(agentIds), Long.class, Integer.class);
} catch (Exception e) {
log.error("出版社定制小号数.[mapSpecialAgentRobotCount]:" + e.getMessage(), e);
}
return map;
}
@ParamLog("批量获取小号和用户的好友关系")
public List<AltAndUserResultDTO> listAltAndUserRelationship(List<AltAndUserDTO> altAndUserDTOS) {
List<AltAndUserResultDTO> list = new ArrayList<>();
if (CollectionUtils.isEmpty(altAndUserDTOS)) {
return list;
}
try {
list = ResponseHandleUtil.parseListResponse(selfRobotService.listAltAndUserRelationship(altAndUserDTOS), AltAndUserResultDTO.class);
} catch (Exception e) {
log.error("批量获取小号和用户的好友关系.[listAltAndUserRelationship]:" + e.getMessage(), e);
}
return list;
}
}
package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.entity.AppClickRecord;
import java.util.List;
public interface AppClickRecordBiz {
/**
......@@ -10,4 +13,9 @@ public interface AppClickRecordBiz {
* @return
*/
Long createAppClickRecord(AppClickRecord appClickRecord);
/**
* 根据类型按照时间获取资源服务点击人数
*/
List<CountAndTimeDTO> getAppClickByTime(Integer joinGroupType, Integer timeType, String startTime, String endTime);
}
package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.BookGroupAppDTO;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.keywords.entity.BookGuide;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.push.entity.PushItem;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
public interface BookGroupAppBiz {
void addAppKeywordToBookGroupApp(List<BookKeyword> bookKeywords);
void addBookGuideToBookGroupApp(BookGuide bookGuide, List<BookGuideReply> bookGuideReplies);
void addPushToBookGroupApp(List<PushGroup> pushGroups, List<PushItem> pushItems);
void addServeToBookGroupApp(List<BookGroupServe> bookGroupServes);
PageBeanNew<BookGroupAppDTO> getBookGroupAppDTOSByBookGroupId(Long bookGroupId, Integer currentPage, Integer numPerPage);
void exportBookGroupAppDTOSByBookGroupId(Long bookGroupId,String systemCode,Long partyId);
void addOldBookGroupAppToNew();
}
package com.pcloud.book.group.biz;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dto.AltAndCountDTO;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.dto.BookGroupStatisticsDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.GroupCipherDTO;
import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.dto.LabelUserCountDTO;
import com.pcloud.book.group.dto.LargeTempletDTO;
import com.pcloud.book.group.dto.OwnAltQrcodeInfoDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
import com.pcloud.book.group.dto.SelfBookGroupStDTO;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.dto.SelfRobtParamDTO;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.book.group.vo.FriendsVO;
......@@ -518,4 +527,93 @@ public interface BookGroupBiz {
* 上架所有的个人号配置资源
*/
void dealBookGroupServeOldOnShelves();
/**
* 1v1社群码下用户
* @param bookGroupId
* @return
*/
List<String> getFriendIdsByBookGroupId(Long bookGroupId);
/**
* 个人号读者统计
* @param selfRobtParamDTO
* @return
*/
PageBeanNew<SelfRobotUserDTO> listPageFriendInfo(SelfRobtParamDTO selfRobtParamDTO);
/**
* 根据类型获取社群书数量
*/
Integer getBookGroupCountByJoinGroupType(Integer joinGroupType);
/**
* 获取个人号累计加好友人数
*/
Integer getAddFriendCount();
/**
* 根据时间段获取个人号加好友人数
*/
List<CountAndTimeDTO> getAddFriendCountByTime(Integer timeType, String startTime, String endTime);
/**
* 获取出版社创建社群书数量排行
*/
List<TopAgentBookGroupDTO> getTopAgentCreateBookGroup(Integer joinGroupType, Integer top, Boolean isSpecial);
/**
* 补充社群书的出版社id
*/
void fillAgentIdForBookGroup();
/**
* 获取所有已建分类的1v1的社群码
*/
List<Long> get1v1HasClassifyBookGroupIds();
/**
* 获取个人号读者专业或深度分布
*/
List<LabelUserCountDTO> getUserLabelDistribution(Integer largeTemplet, Integer type);
/**
* 获取出版社个人号统计信息
*/
PageBeanNew<AgentStatisticsInfoDTO> getAgentStatisticsInfo(Long agentId, Boolean isSpecial, Integer currentPage, Integer numPerPage);
/**
* 导出出版社个人号统计信息
*/
void exportAgentStatisticsInfo(Long partyId, Long agentId, Boolean isSpecial);
/**
* 按时间获取资源服务点击量趋势
*/
Map<String, List<CountAndTimeDTO>> getServeClickTendencyList(Long bookGroupId, List<String> dateList);
/**
* 个人号社群书统计
*/
PageBeanNew<SelfBookGroupStDTO> getSelfBookGroupStatistics(SelfBookGroupStParamDTO selfBookGroupStParamDTO);
/**
* 导出个人号社群书统计
*/
void exportSelfBookGroupStatistics(SelfBookGroupStParamDTO selfBookGroupStParamDTO,String systemCode,Long partyId);
/**
* 根据小号批量获取服务社群书数量
*/
Map<String,Integer> getBookGroupCountMapByAltIds(List<String> altIds);
/**
* 获取小号社群书数量
*/
Integer getSerBookGroupCountByAltIds(List<String> altIds);
/**
* 出版社关联的个人号以及个人号的社群书数量
*/
List<AltAndCountDTO> getAltAndCountDTOListByAgentId(Long agentId);
}
......@@ -248,4 +248,8 @@ public interface BookGroupClassifyBiz {
* 个人号模式获取一个群
*/
String getSelfGroup(Long classifyId, Integer changeNumber, String wxId);
/**
* 根据类型获取分类数量
*/
Integer getClassifyCountByJoinGroupType(Integer joinGroupType);
}
package com.pcloud.book.group.biz;
import com.pcloud.book.group.entity.CopyCipherRecord;
public interface CopyCipherRecordBiz {
Long createCopyCipherRecord(CopyCipherRecord copyCipherRecord);
}
......@@ -208,4 +208,9 @@ public interface GroupQrcodeBiz {
* 切群之后要做的事
*/
void dealAfterChangeANewGroup(WeixinQrcodeDTO oneQrcode, Long classifyId);
/**
* 根据类型获取当前群总人数
*/
Integer getUserCountByJoinGroupType(Integer joinGroupType);
}
......@@ -4,13 +4,20 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.AppClickRecordBiz;
import com.pcloud.book.group.dao.AppClickRecordDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.set.GroupSet;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description
* @Author ruansiyuan
......@@ -23,16 +30,12 @@ public class AppClickRecordBizImpl implements AppClickRecordBiz {
private AppClickRecordDao appClickRecordDao;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private GroupSet groupSet;
@Override
public Long createAppClickRecord(AppClickRecord appClickRecord) {
if (appClickRecord.getQrcodeId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "群id不能为空");
}
if (appClickRecord.getClassifyId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分类id不能为空!");
}
if (appClickRecord.getBookGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群书id不能为空!");
}
......@@ -42,11 +45,28 @@ public class AppClickRecordBizImpl implements AppClickRecordBiz {
if (StringUtil.isEmpty(appClickRecord.getServeType())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "类型不能为空(APP或PRODUCT)!");
}
GroupQrcode groupQrcode = groupQrcodeDao.getById(appClickRecord.getQrcodeId());
if (groupQrcode != null) {
appClickRecord.setWeixinGroupId(groupQrcode.getWeixinGroupId());
if (appClickRecord.getQrcodeId()!=null){
GroupQrcode groupQrcode = groupQrcodeDao.getById(appClickRecord.getQrcodeId());
if (groupQrcode != null) {
appClickRecord.setWeixinGroupId(groupQrcode.getWeixinGroupId());
}
}
appClickRecordDao.insert(appClickRecord);
return appClickRecord.getId();
}
@ParamLog("根据类型按照时间获取资源服务点击人数")
@Override
public List<CountAndTimeDTO> getAppClickByTime(Integer joinGroupType, Integer timeType, String startTime, String endTime) {
if (timeType == null || (1 != timeType && 2 != timeType)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "时间类型参数错误!");
}
if (StringUtil.isEmpty(startTime) || StringUtil.isEmpty(endTime)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "时间参数错误!");
}
List<CountAndTimeDTO> list = appClickRecordDao.getAppClickByTime(joinGroupType, timeType, startTime, endTime);
groupSet.fillEmptyTime(list, timeType, startTime, endTime);
list = list.stream().sorted(Comparator.comparing(CountAndTimeDTO::getTime)).collect(Collectors.toList());
return list;
}
}
......@@ -11,6 +11,7 @@ import com.pcloud.book.consumer.settlement.SettlementConsr;
import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupAnnouncementBiz;
......@@ -69,7 +70,9 @@ import com.pcloud.book.group.vo.SyncKeyworsVO;
import com.pcloud.book.group.vo.UpdateClassifyVO;
import com.pcloud.book.group.vo.UpdateRankVO;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.common.core.aspect.ParamLog;
......@@ -179,6 +182,10 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
private WeixinQrcodeDao weixinQrcodeDao;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
@Autowired
private KeywordDao keywordDao;
@Override
......@@ -278,6 +285,30 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
bookKeywords.add(bookKeyword);
});
bookKeywordDao.insert(bookKeywords);
fillKeyword(bookKeywords);
bookGroupAppBiz.addAppKeywordToBookGroupApp(bookKeywords);
}
@ParamLog("填充关键词模型")
private void fillKeyword(List<BookKeyword> bookKeywords) {
if (ListUtils.isEmpty(bookKeywords)) {
return;
}
List<Long> keywordIds = bookKeywords.stream().filter(s -> s.getKeywordId() != null).map(BookKeyword::getKeywordId).distinct().collect(Collectors.toList());
if (ListUtils.isEmpty(keywordIds)) {
return;
}
List<Keyword> list = keywordDao.getListByIds(keywordIds);
if (ListUtils.isEmpty(list)) {
return;
}
Map<Long, Keyword> map = new HashMap<>();
for (Keyword keyword : list) {
map.put(keyword.getId(), keyword);
}
for (BookKeyword bookKeyword : bookKeywords) {
bookKeyword.setKeyword(map.get(bookKeyword.getKeywordId()));
}
}
@ParamLog("新增商品对应规格")
......@@ -1175,5 +1206,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return null;
}
@ParamLog("根据类型获取分类数量")
@Override
public Integer getClassifyCountByJoinGroupType(Integer joinGroupType) {
return bookGroupClassifyDao.getClassifyCountByJoinGroupType(joinGroupType);
}
}
package com.pcloud.book.group.biz.impl;
import com.pcloud.book.group.biz.CopyCipherRecordBiz;
import com.pcloud.book.group.dao.CopyCipherRecordDao;
import com.pcloud.book.group.entity.CopyCipherRecord;
import com.pcloud.common.core.aspect.ParamLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:15
**/
@Component("copyCipherRecordBiz")
public class CopyCipherRecordBizImpl implements CopyCipherRecordBiz {
@Autowired
private CopyCipherRecordDao copyCipherRecordDao;
@Transactional(rollbackFor = Exception.class)
@ParamLog("新增复制暗号记录")
@Override
public Long createCopyCipherRecord(CopyCipherRecord copyCipherRecord) {
copyCipherRecordDao.insert(copyCipherRecord);
return copyCipherRecord.getId();
}
}
......@@ -816,4 +816,10 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
}
}
@ParamLog("根据类型获取当前群总人数")
@Override
public Integer getUserCountByJoinGroupType(Integer joinGroupType) {
return groupQrcodeDao.getUserCountByJoinGroupType(joinGroupType);
}
}
package com.pcloud.book.group.constants;
package com.pcloud.book.group.constant;
import com.pcloud.book.group.dto.AutoUpdateGroupNumDTO;
......
......@@ -2,6 +2,9 @@ package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.AppClickDTO;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupAppDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.book.group.vo.GroupScanTrendParamVO;
import com.pcloud.book.group.vo.GroupScanTrendVO;
......@@ -48,4 +51,33 @@ public interface AppClickRecordDao extends BaseDao<AppClickRecord> {
*/
List<ResourcesStatisticVO> getClickStatistics(Long bookGroupId,Long classifyId,Long qrcodeId,String type);
/**
* 根据类型按照时间获取资源服务点击人数
*/
List<CountAndTimeDTO> getAppClickByTime(Integer joinGroupType, Integer timeType, String startTime, String endTime);
/**
* 批量获取点击次数
*/
List<BookGroupAppDTO> getClickCountByServe(Long bookGroupId, String serveType, List<Long> serveIds);
/**
* 批量获取点击人数
*/
List<BookGroupAppDTO> getClickPeopleCountByServe(Long bookGroupId, String serveType, List<Long> serveIds);
/**
* 根据bookGroupId批量获取点击次数
*/
List<CountAndTimeDTO> getAppClickByBookGroupId(Long bookGroupId, List<String> dateList);
/**
* 根据bookGroupIds获取应用点击人数
*/
List<BookGroupIdAndCountDTO> getClPeCoByBookGroupIds(List<Long> bookGroupIds);
/**
* 根据bookGroupIds获取应用点击人数
*/
List<BookGroupIdAndCountDTO> getClCoByBookGroupIds(List<Long> bookGroupIds);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
public interface AppTouchRecordDao extends BaseDao<AppTouchRecord> {
Long getCountByBokkGroupId(Long bookGroupId, String type);
List<AppStatisticsDTO> getAppTouchStatistics(Map<String,Object> map);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.BookGroupAgentRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface BookGroupAgentRecordDao extends BaseDao<BookGroupAgentRecord> {
BookGroupAgentRecord getByAltIdAndBookGroupId(String altId, Long bookGroupId);
List<BookGroupAgentRecord> getAltIdByBookGroupIds(List<Long> bookGroupIds);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.BookGroupAppDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/13 16:49
**/
public interface BookGroupAppDao extends BaseDao<BookGroupApp> {
Integer batchInsert(List<BookGroupApp> bookGroupApps);
BookGroupApp getByCondition(BookGroupApp bookGroupApp);
List<BookGroupAppDTO> getBookGroupAppDTOSByBookGroupId(Long bookGroupId);
List<BookGroupIdAndCountDTO> getServerCountByBookGroupIds(List<Long> bookGroupIds);
List<Long> getAllBookGroupId();
}
package com.pcloud.book.group.dao;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dto.AltAndCountDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.DayCountDTO;
import com.pcloud.book.group.dto.LabelUserCountDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
/**
* @Description
......@@ -41,4 +48,71 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> {
* 查询社群书关联的用户id集合
*/
List<BookGroupCipherUser> getWxUserIdAndAltsByBookGroupId(Long bookGroupId);
/**
* 1v1社群码下用户id
* @param bookGroupId
* @return
*/
List<String> getFriendIdsByBookGroupId(Long bookGroupId);
/**
* 用户扫描的社群书
* @param wxUserId
* @param altId
* @return
*/
public List<BookDto> getBookGroupListByUser(String wxUserId, String altId);
/**
* 获取个人号累计加好友人数
*/
Integer getAddFriendCount();
/**
* 根据时间段获取个人号加好友人数
*/
List<CountAndTimeDTO> getAddFriendCountByTime(Integer timeType, String startTime, String endTime);
/**
* 个人号读者统计
* @param paramMap
* @return
*/
public List<SelfRobotUserDTO> listPageFriendInfo(Map<String, Object> paramMap);
/**
* 获取个人号读者专业或深度分布
*/
List<LabelUserCountDTO> getUserLabelDistribution(Integer type, List<String> altIds);
/**
* 根据社群码获取小号
*/
List<BookGroupCipherUser> getAltIdByBookGroupIds(List<Long> bookGroupIds);
/**
* 根据bookGroupIds获取累计加好友人数
*/
List<BookGroupIdAndCountDTO> getAddFriendByBookGroupIds(List<Long> bookGroupIds);
/**
* 根据社群码id集合获取小号和用户id
*/
List<BookGroupCipherUser> getWxUserIdAndAltsByBookGroupIds(List<Long> bookGroupIds);
/**
* 根据小号获取服务社群书数量
*/
List<AltAndCountDTO> getBookGroupCountListByAltIds(List<String> altIds);
/**
* 获取小号社群书数量
*/
List<Long> getBookGroupIdsByAltIds(List<String> altIds);
/**
* 根据出版社id获取小号id集合
*/
List<String> getAltIdsByAgentId(Long agentId);
}
......@@ -9,6 +9,7 @@ import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.dto.SelfBookGroupStDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
......@@ -273,4 +274,10 @@ public interface BookGroupClassifyDao extends BaseDao<BookGroupClassify> {
public List<BookGroupClassify> getListByBookGroupId(Long bookGroupId);
/**
* 根据类型获取分类数量
*/
Integer getClassifyCountByJoinGroupType(Integer joinGroupType);
List<SelfBookGroupStDTO> listClassifyCountInfo(List<Long> bookGroupIds);
}
......@@ -3,9 +3,12 @@ package com.pcloud.book.group.dao;
import java.util.List;
import java.util.Map;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.SelfBookGroupStDTO;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.common.core.dao.BaseDao;
......@@ -220,4 +223,43 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
*/
void updateLastPushUpdateTime(Long bookGroupId);
/**
* 根据类型获取社群书数量
*/
Integer getBookGroupCountByJoinGroupType(Integer joinGroupType);
/**
* 查询agentId为空的数据
*/
List<Long> getEmptyAgentIdAdviserId();
/**
* 更新出版社id
*/
void updateAgentIdByAdviserId(Long adviserId, Long agentId);
/**
* 获取出版社创建社群书数量排行
*/
List<TopAgentBookGroupDTO> getTopAgentCreateBookGroup(Integer joinGroupType, Integer top, List<Long> agentIds);
/**
* 获取所有已建分类的1v1的社群码
*/
List<Long> get1v1HasClassifyBookGroupIds();
/**
* 获取出版社关联小号
*/
List<String> getRobotWxidsByAgent(Long agentId);
/**
* 获取出版社个人号统计信息
*/
List<AgentStatisticsInfoDTO> getAgentStatisticsInfo(Map<String, Object> paramMap);
/**
* 个人号统计数量
*/
Integer countSelfBookGroupStatistics(Map<String,Object> map);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.common.core.dao.BaseDao;
......@@ -17,4 +18,6 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
void updateShortUrl(Long id, String shortUrl);
List<BookGroupServe> getProductServeList();
List<BookGroupApp> getAllAppServe();
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.entity.CopyCipherRecord;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:13
**/
public interface CopyCipherRecordDao extends BaseDao<CopyCipherRecord> {
List<BookGroupIdAndCountDTO> getCountByBookGroupIds(List<Long> bookGroupIds);
}
......@@ -285,4 +285,9 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
* 查询正在使用的群
*/
List<GroupQrcode> getUsingGroupQrcodeByClassifyId(Long classifyId, Integer changeNumber);
/**
* 根据类型获取当前群总人数
*/
Integer getUserCountByJoinGroupType(Integer joinGroupType);
}
......@@ -3,13 +3,15 @@ package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.AppClickRecordDao;
import com.pcloud.book.group.dto.AppClickDTO;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupAppDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.book.group.vo.GroupScanTrendParamVO;
import com.pcloud.book.group.vo.GroupScanTrendVO;
import com.pcloud.book.group.vo.ResourceClickVO;
import com.pcloud.book.group.vo.ResourcesStatisticVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
......@@ -81,4 +83,54 @@ public class AppClickRecordDaoImpl extends BaseDaoImpl<AppClickRecord> implement
return this.getSqlSession().selectList(this.getStatement("getClickStatistics"), map);
}
@Override
public List<CountAndTimeDTO> getAppClickByTime(Integer joinGroupType, Integer timeType, String startTime, String endTime) {
Map<String, Object> map = new HashMap<>();
map.put("joinGroupType", joinGroupType);
map.put("timeType", timeType);
map.put("startTime", startTime);
map.put("endTime", endTime);
return getSessionTemplate().selectList(getStatement("getAppClickByTime"), map);
}
@Override
public List<BookGroupAppDTO> getClickCountByServe(Long bookGroupId, String serveType, List<Long> serveIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("serveIds", serveIds);
map.put("serveType", serveType);
return getSessionTemplate().selectList(getStatement("getClickCountByServe"), map);
}
@Override
public List<BookGroupAppDTO> getClickPeopleCountByServe(Long bookGroupId, String serveType, List<Long> serveIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("serveIds", serveIds);
map.put("serveType", serveType);
return getSessionTemplate().selectList(getStatement("getClickPeopleCountByServe"), map);
}
@Override
public List<CountAndTimeDTO> getAppClickByBookGroupId(Long bookGroupId, List<String> dateList) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("dateList", dateList);
return getSessionTemplate().selectList(getStatement("getAppClickByBookGroupId"), map);
}
@Override
public List<BookGroupIdAndCountDTO> getClPeCoByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectList(getStatement("getClPeCoByBookGroupIds"), map);
}
@Override
public List<BookGroupIdAndCountDTO> getClCoByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectList(getStatement("getClCoByBookGroupIds"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -24,4 +26,9 @@ public class AppTouchRecordDaoImpl extends BaseDaoImpl<AppTouchRecord> implement
map.put("type",type);
return this.getSqlSession().selectOne(this.getStatement("getCountByBokkGroupId"), map);
}
@Override
public List<AppStatisticsDTO> getAppTouchStatistics(Map<String, Object> map) {
return this.getSqlSession().selectList(this.getStatement("getAppTouchStatistics"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.BookGroupAgentRecordDao;
import com.pcloud.book.group.entity.BookGroupAgentRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/8 11:41
**/
@Component("bookGroupAgentRecordDao")
public class BookGroupAgentRecordDaoImpl extends BaseDaoImpl<BookGroupAgentRecord> implements BookGroupAgentRecordDao {
@Override
public BookGroupAgentRecord getByAltIdAndBookGroupId(String altId, Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("altId", altId);
map.put("bookGroupId",bookGroupId);
return super.getSqlSession().selectOne(getStatement("getByAltIdAndBookGroupId"), map);
}
@Override
public List<BookGroupAgentRecord> getAltIdByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds",bookGroupIds);
return super.getSqlSession().selectList(getStatement("getByAltIdAndBookGroupId"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.BookGroupAppDao;
import com.pcloud.book.group.dto.BookGroupAppDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/13 16:50
**/
@Component("bookGroupAppDao")
public class BookGroupAppDaoImpl extends BaseDaoImpl<BookGroupApp> implements BookGroupAppDao {
@Override
public Integer batchInsert(List<BookGroupApp> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public BookGroupApp getByCondition(BookGroupApp bookGroupApp) {
Map<String, Object> map = new HashMap<>();
map.put("serveId", bookGroupApp.getServeId());
map.put("serveType", bookGroupApp.getServeType());
map.put("bookGroupId", bookGroupApp.getBookGroupId());
map.put("classifyId", bookGroupApp.getClassifyId());
map.put("originType", bookGroupApp.getOriginType());
return super.getSqlSession().selectOne(getStatement("getByCondition"), map);
}
@Override
public List<BookGroupAppDTO> getBookGroupAppDTOSByBookGroupId(Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
return super.getSqlSession().selectList(getStatement("getBookGroupAppDTOSByBookGroupId"), map);
}
@Override
public List<BookGroupIdAndCountDTO> getServerCountByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return super.getSqlSession().selectList(getStatement("getServerCountByBookGroupIds"), map);
}
@Override
public List<Long> getAllBookGroupId() {
return super.getSqlSession().selectList(getStatement("getAllBookGroupId"));
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dto.AltAndCountDTO;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.DayCountDTO;
import com.pcloud.book.group.dto.LabelUserCountDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
......@@ -52,4 +59,80 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser>
map.put("bookGroupId", bookGroupId);
return getSessionTemplate().selectList(getStatement("getWxUserIdAndAltsByBookGroupId"), map);
}
@Override
public List<String> getFriendIdsByBookGroupId(Long bookGroupId) {
return getSessionTemplate().selectList(getStatement("getFriendIdsByBookGroupId"), bookGroupId);
}
@Override
public List<BookDto> getBookGroupListByUser(String wxUserId, String altId) {
Map<String, Object> map = new HashMap<>();
map.put("wxUserId", wxUserId);
map.put("altId", altId);
return getSessionTemplate().selectList(getStatement("getBookGroupListByUser"), map);
}
@Override
public Integer getAddFriendCount() {
return getSessionTemplate().selectOne(getStatement("getAddFriendCount"));
}
@Override
public List<CountAndTimeDTO> getAddFriendCountByTime(Integer timeType, String startTime, String endTime) {
Map<String, Object> map = new HashMap<>();
map.put("timeType", timeType);
map.put("startTime", startTime);
map.put("endTime", endTime);
return getSessionTemplate().selectList(getStatement("getAddFriendCountByTime"), map);
}
@Override
public List<SelfRobotUserDTO> listPageFriendInfo(Map<String, Object> paramMap) {
return getSessionTemplate().selectList(getStatement("listPageFriendInfo"), paramMap);
}
@Override
public List<LabelUserCountDTO> getUserLabelDistribution(Integer type, List<String> altIds) {
Map<String, Object> map = new HashMap<>();
map.put("type", type);
map.put("altIds", altIds);
return getSessionTemplate().selectList(getStatement("getUserLabelDistribution"), map);
}
@Override
public List<BookGroupCipherUser> getAltIdByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectList(getStatement("getAltIdByBookGroupIds"), map);
}
@Override
public List<BookGroupIdAndCountDTO> getAddFriendByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectList(getStatement("getAddFriendByBookGroupIds"), map);
}
@Override
public List<BookGroupCipherUser> getWxUserIdAndAltsByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return getSessionTemplate().selectList(getStatement("getWxUserIdAndAltsByBookGroupIds"), map);
}
@Override
public List<AltAndCountDTO> getBookGroupCountListByAltIds(List<String> altIds) {
return getSessionTemplate().selectList(getStatement("getBookGroupCountListByAltIds"), altIds);
}
@Override
public List<Long> getBookGroupIdsByAltIds(List<String> altIds) {
return getSessionTemplate().selectList(getStatement("getBookGroupIdsByAltIds"), altIds);
}
@Override
public List<String> getAltIdsByAgentId(Long agentId) {
return getSessionTemplate().selectList(getStatement("getAltIdsByAgentId"), agentId);
}
}
......@@ -10,6 +10,7 @@ import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.dto.SelfBookGroupStDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
......@@ -262,4 +263,18 @@ public class BookGroupClassifyDaoImpl extends BaseDaoImpl<BookGroupClassify> imp
return this.getSqlSession().selectList(this.getStatement("getListByBookGroupId"), bookGroupId);
}
@Override
public Integer getClassifyCountByJoinGroupType(Integer joinGroupType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("joinGroupType", joinGroupType);
return this.getSqlSession().selectOne(this.getStatement("getClassifyCountByJoinGroupType"), paramMap);
}
@Override
public List<SelfBookGroupStDTO> listClassifyCountInfo(List<Long> bookGroupIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupIds", bookGroupIds);
return this.getSqlSession().selectList(this.getStatement("listClassifyCountInfo"), paramMap);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.SelfBookGroupStDTO;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
......@@ -236,4 +239,53 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
paramMap.put("bookGroupId", bookGroupId);
super.getSqlSession().update(getStatement("updateLastPushUpdateTime"), paramMap);
}
@Override
public Integer getBookGroupCountByJoinGroupType(Integer joinGroupType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("joinGroupType", joinGroupType);
return this.getSqlSession().selectOne(this.getStatement("getBookGroupCountByJoinGroupType"), paramMap);
}
@Override
public List<Long> getEmptyAgentIdAdviserId() {
return this.getSqlSession().selectList(this.getStatement("getEmptyAgentIdAdviserId"));
}
@Override
public void updateAgentIdByAdviserId(Long adviserId, Long agentId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("agentId", agentId);
super.getSqlSession().update(getStatement("updateAgentIdByAdviserId"), paramMap);
}
@Override
public List<TopAgentBookGroupDTO> getTopAgentCreateBookGroup(Integer joinGroupType, Integer top, List<Long> agentIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("joinGroupType", joinGroupType);
paramMap.put("top", top);
paramMap.put("agentIds", agentIds);
return super.getSqlSession().selectList(getStatement("getTopAgentCreateBookGroup"), paramMap);
}
@Override
public List<Long> get1v1HasClassifyBookGroupIds() {
return super.getSqlSession().selectList(getStatement("get1v1HasClassifyBookGroupIds"));
}
@Override
public List<String> getRobotWxidsByAgent(Long agentId) {
return super.getSqlSession().selectList(getStatement("getRobotWxidsByAgent"), agentId);
}
@Override
public List<AgentStatisticsInfoDTO> getAgentStatisticsInfo(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("getAgentStatisticsInfo"), paramMap);
}
@Override
public Integer countSelfBookGroupStatistics(Map<String, Object> map) {
return super.getSqlSession().selectOne(getStatement("countSelfBookGroupStatistics"),map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.BookGroupServeDao;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
......@@ -48,4 +49,9 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
public List<BookGroupServe> getProductServeList() {
return super.getSqlSession().selectList(getStatement("getProductServeList"));
}
@Override
public List<BookGroupApp> getAllAppServe() {
return super.getSqlSession().selectList(getStatement("getAllAppServe"));
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.CopyCipherRecordDao;
import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.entity.CopyCipherRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:12
**/
@Component("copyCipherRecordDao")
public class CopyCipherRecordDaoImpl extends BaseDaoImpl<CopyCipherRecord> implements CopyCipherRecordDao {
@Override
public List<BookGroupIdAndCountDTO> getCountByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> paramMap = new HashMap();
paramMap.put("bookGroupIds", bookGroupIds);
return this.getSqlSession().selectList(this.getStatement("getCountByBookGroupIds"), paramMap);
}
}
......@@ -290,4 +290,11 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
map.put("changeNumber", changeNumber);
return this.getSessionTemplate().selectList(getStatement("getUsingGroupQrcodeByClassifyId"), map);
}
@Override
public Integer getUserCountByJoinGroupType(Integer joinGroupType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("joinGroupType", joinGroupType);
return this.getSqlSession().selectOne(this.getStatement("getUserCountByJoinGroupType"), paramMap);
}
}
package com.pcloud.book.group.dto;
import com.pcloud.common.vo.BaseVO;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: AgentStatisticsInfoDTO
* @Description: 出版社数据统计DTO
* @Auther: lihao
* @Date: 2019/11/14 16:16
*/
public class AgentStatisticsInfoDTO extends BaseVO {
@ApiModelProperty("出版社ID")
private Long agentId;
@ApiModelProperty("出版社名称")
private String agentName;
@ApiModelProperty("个人号社群书数量")
private Integer groupBookCount;
@ApiModelProperty("定制个人号数量")
private Integer robotCount;
@ApiModelProperty("已发消息数量")
private Integer sendMsgCount;
@ApiModelProperty("是否是定制出版社")
private Boolean isSpecial;
@Override
public String toString() {
return "AgentStatisticsInfoDTO{" +
"agentId=" + agentId +
", agentName='" + agentName + '\'' +
", groupBookCount=" + groupBookCount +
", robotCount=" + robotCount +
", sendMsgCount=" + sendMsgCount +
", isSpecial=" + isSpecial +
'}';
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public Integer getGroupBookCount() {
return groupBookCount;
}
public void setGroupBookCount(Integer groupBookCount) {
this.groupBookCount = groupBookCount;
}
public Integer getRobotCount() {
return robotCount;
}
public void setRobotCount(Integer robotCount) {
this.robotCount = robotCount;
}
public Integer getSendMsgCount() {
return sendMsgCount;
}
public void setSendMsgCount(Integer sendMsgCount) {
this.sendMsgCount = sendMsgCount;
}
public Boolean getSpecial() {
return isSpecial;
}
public void setSpecial(Boolean special) {
isSpecial = special;
}
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:54
**/
@Data
public class AltIdAndNameDTO {
@ApiModelProperty("小号id")
private String altId;
@ApiModelProperty("小号名称")
private String altName;
}
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/14 14:45
**/
public class BookGroupAppDTO implements Serializable {
private static final long serialVersionUID = -4055200132048502158L;
@ApiModelProperty("id主键")
private Long id;
@ApiModelProperty("作品或应用id")
private Long serveId;
@ApiModelProperty("应用或作品")
private String serveType;
@ApiModelProperty("类型来源(1欢迎语,2关键词,3群发,4配置资源)")
private Integer originType;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String typeName;
@ApiModelProperty("应用或作品类型code")
private String typeCode;
@ApiModelProperty("应用或作品创建者id")
private Long serveCreateUserId;
@ApiModelProperty("应用或作品创建者名称")
private String serveCreateUserName;
@ApiModelProperty("协议价")
private Double dealPrice;
@ApiModelProperty("销售价")
private Double retailPrice;
@ApiModelProperty("点击人数")
private Integer clickPeopleCount;
@ApiModelProperty("点击次数")
private Integer clickCount;
@ApiModelProperty("平均浏览时长")
private Integer avgBrowseTime;
@ApiModelProperty("购买人数")
private Integer buyPeopleCount;
@ApiModelProperty("销售额")
private Double saleAmount;
@ApiModelProperty("是否是超级作者")
private Boolean isSuper;
@ApiModelProperty("场景名称")
private String sceneName;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
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 Integer getOriginType() {
return originType;
}
public void setOriginType(Integer originType) {
this.originType = originType;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getServeName() {
return serveName;
}
public void setServeName(String serveName) {
this.serveName = serveName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public Long getServeCreateUserId() {
return serveCreateUserId;
}
public void setServeCreateUserId(Long serveCreateUserId) {
this.serveCreateUserId = serveCreateUserId;
}
public String getServeCreateUserName() {
return serveCreateUserName;
}
public void setServeCreateUserName(String serveCreateUserName) {
this.serveCreateUserName = serveCreateUserName;
}
public Double getDealPrice() {
return dealPrice;
}
public void setDealPrice(Double dealPrice) {
this.dealPrice = dealPrice;
}
public Double getRetailPrice() {
return retailPrice;
}
public void setRetailPrice(Double retailPrice) {
this.retailPrice = retailPrice;
}
public Integer getClickPeopleCount() {
return clickPeopleCount;
}
public void setClickPeopleCount(Integer clickPeopleCount) {
this.clickPeopleCount = clickPeopleCount;
}
public Integer getClickCount() {
return clickCount;
}
public void setClickCount(Integer clickCount) {
this.clickCount = clickCount;
}
public Integer getAvgBrowseTime() {
return avgBrowseTime;
}
public void setAvgBrowseTime(Integer avgBrowseTime) {
this.avgBrowseTime = avgBrowseTime;
}
public Integer getBuyPeopleCount() {
return buyPeopleCount;
}
public void setBuyPeopleCount(Integer buyPeopleCount) {
this.buyPeopleCount = buyPeopleCount;
}
public Double getSaleAmount() {
return saleAmount;
}
public void setSaleAmount(Double saleAmount) {
this.saleAmount = saleAmount;
}
public Boolean getIsSuper() {
return isSuper;
}
public void setIsSuper(Boolean isSuper) {
this.isSuper = isSuper;
}
public String getSceneName() {
return sceneName;
}
public void setSceneName(String sceneName) {
this.sceneName = sceneName;
}
@Override
public String toString() {
return "BookGroupAppDTO{" +
"id=" + id +
", serveId=" + serveId +
", serveType='" + serveType + '\'' +
", originType=" + originType +
", bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", createUser=" + createUser +
", createTime=" + createTime +
", serveName='" + serveName + '\'' +
", typeName='" + typeName + '\'' +
", typeCode='" + typeCode + '\'' +
", serveCreateUserId=" + serveCreateUserId +
", serveCreateUserName='" + serveCreateUserName + '\'' +
", dealPrice=" + dealPrice +
", retailPrice=" + retailPrice +
", clickPeopleCount=" + clickPeopleCount +
", clickCount=" + clickCount +
", avgBrowseTime=" + avgBrowseTime +
", buyPeopleCount=" + buyPeopleCount +
", saleAmount=" + saleAmount +
", isSuper=" + isSuper +
", sceneName='" + sceneName + '\'' +
'}';
}
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/18 10:19
**/
@Data
public class BookGroupIdAndCountDTO {
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("数量")
private Integer count;
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/12 9:37
**/
public class CountAndTimeDTO implements Serializable {
private static final long serialVersionUID = 2807137315474979522L;
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("数量")
private Integer count;
@ApiModelProperty("日期")
private String date;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
@Override
public String toString() {
return "CountAndTimeDTO{" +
"time='" + time + '\'' +
", count=" + count +
", date='" + date + '\'' +
'}';
}
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/13 10:18
**/
@Data
public class LabelUserCountDTO implements Serializable {
@ApiModelProperty("标签id")
private Long labelId;
@ApiModelProperty("标签名称")
private String labelName;
@ApiModelProperty("数量")
private Integer count;
}
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:34
**/
@Data
public class SelfBookGroupStDTO implements Serializable {
private static final long serialVersionUID = -4842978566255913073L;
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("书名")
private String bookName;
@ApiModelProperty("isbn编号")
private String isbn;
@ApiModelProperty("唯一编号")
private String uniqueNumber;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("编辑名称")
private String adviserName;
@ApiModelProperty("出版id")
private Long agentId;
@ApiModelProperty("出版社名称")
private String agentName;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("社群码名称")
private String groupQrcodeName;
@ApiModelProperty("社群码url")
private String groupQrcodeUrl;
@ApiModelProperty("深度标签id")
private Long depLabelId;
@ApiModelProperty("深度标签名称")
private String depLabelName;
@ApiModelProperty("目的标签id")
private Long purLabelId;
@ApiModelProperty("目的标签名称")
private String purLabelName;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("小号信息")
private List<AltIdAndNameDTO> altIdAndNameDTOS;
@ApiModelProperty("扫码人数")
private Integer scanPeopleCount;
@ApiModelProperty("复制暗号人数")
private Integer copyCipherPeopleCount;
@ApiModelProperty("累计加好友人数")
private Integer accAddFriendCount;
@ApiModelProperty("扫码转化率")
private Double scanConversionRate;
@ApiModelProperty("当前好友人数")
private Integer preFriendCount;
@ApiModelProperty("已删好友人数")
private Integer delFriendCount;
@ApiModelProperty("好友留存率")
private Double friendKeepRate;
@ApiModelProperty("已发消息量")
private Integer sendMessageCount;
@ApiModelProperty("群分类数量")
private Integer classifyCount;
@ApiModelProperty("累计进群人数")
private Integer accJoinGroupCount;
@ApiModelProperty("当前群总人数")
private Integer preInGroupPeopleCount;
@ApiModelProperty("群消息数量")
private Integer groupMessageCount;
@ApiModelProperty("资源服务数量")
private Integer serveCount;
@ApiModelProperty("资源点击人数")
private Integer serveClickPeopleCount;
@ApiModelProperty("资源点击次数")
private Integer serveClickCount;
@ApiModelProperty("社群书平均浏览时长")
private Long avgBrowseTime;
@ApiModelProperty("单个服务平均浏览时长")
private Long oneServeBrowseTime;
@ApiModelProperty("购买人数")
private Long buyPeopleCount;
@ApiModelProperty("销售额")
private Double saleAmount;
}
package com.pcloud.book.group.dto;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:27
**/
public class SelfBookGroupStParamDTO {
private String name;
private List<Long> agentIds;
private Boolean isSpecial;
private Long proLabelId;
private Long depLabelId;
private List<Long> bookIds;
private Integer currentPage;
private Integer numPerPage;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Long> getAgentIds() {
return agentIds;
}
public void setAgentIds(List<Long> agentIds) {
this.agentIds = agentIds;
}
public Boolean getIsSpecial() {
return isSpecial;
}
public void setIsSpecial(Boolean isSpecial) {
this.isSpecial = isSpecial;
}
public Long getProLabelId() {
return proLabelId;
}
public void setProLabelId(Long proLabelId) {
this.proLabelId = proLabelId;
}
public Long getDepLabelId() {
return depLabelId;
}
public void setDepLabelId(Long depLabelId) {
this.depLabelId = depLabelId;
}
public List<Long> getBookIds() {
return bookIds;
}
public void setBookIds(List<Long> bookIds) {
this.bookIds = bookIds;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(Integer numPerPage) {
this.numPerPage = numPerPage;
}
@Override
public String toString() {
return "SelfBookGroupStParamDTO{" +
"name='" + name + '\'' +
", agentIds=" + agentIds +
", isSpecial=" + isSpecial +
", proLabelId=" + proLabelId +
", depLabelId=" + depLabelId +
", bookIds=" + bookIds +
", currentPage=" + currentPage +
", numPerPage=" + numPerPage +
'}';
}
}
package com.pcloud.book.group.dto;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/12 15:26
**/
public class TopAgentBookGroupDTO implements Serializable {
private static final long serialVersionUID = -1291031649711381154L;
@ApiModelProperty("出版社id")
private Long agentId;
@ApiModelProperty("出版社名称")
private String agentName;
@ApiModelProperty("创建社群书数量")
private Integer count;
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
@Override
public String toString() {
return "TopAgentBookGroupDTO{" +
"agentId=" + agentId +
", agentName='" + agentName + '\'' +
", count=" + count +
'}';
}
}
......@@ -140,6 +140,11 @@ public class BookGroup extends BaseEntity {
*/
private Boolean isSomeUpdate;
/**
* 出版社id
*/
private Long agentId;
public Long getId() {
return id;
}
......@@ -340,6 +345,14 @@ public class BookGroup extends BaseEntity {
this.isSomeUpdate = isSomeUpdate;
}
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
@Override
public String toString() {
return "BookGroup{" +
......@@ -368,6 +381,7 @@ public class BookGroup extends BaseEntity {
", bookGroupCipher='" + bookGroupCipher + '\'' +
", lastPushUpdateTime=" + lastPushUpdateTime +
", isSomeUpdate=" + isSomeUpdate +
", agentId=" + agentId +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description 特殊出版社对应小号表
* @Author ruansiyuan
* @Date 2019/11/8 11:33
**/
@ApiModel("特殊出版社对应小号")
public class BookGroupAgentRecord extends BaseEntity {
private static final long serialVersionUID = 7490525691947853419L;
@ApiModelProperty("出版社id")
private Long agentId;
@ApiModelProperty("出版社名称")
private String agentName;
@ApiModelProperty("年级")
private String grade;
@ApiModelProperty("科目")
private String subject;
@ApiModelProperty("版本标签(确定小号用的)")
private Integer target;
@ApiModelProperty("小号id")
private String altId;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("编辑id")
private Long adviserId;
public Long getAgentId() {
return agentId;
}
public void setAgentId(Long agentId) {
this.agentId = agentId;
}
public String getAgentName() {
return agentName;
}
public void setAgentName(String agentName) {
this.agentName = agentName;
}
public String getGrade() {
return grade;
}
public void setGrade(String grade) {
this.grade = grade;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public Integer getTarget() {
return target;
}
public void setTarget(Integer target) {
this.target = target;
}
public String getAltId() {
return altId;
}
public void setAltId(String altId) {
this.altId = altId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
@Override
public String toString() {
return "BookGroupAgentRecord{" +
"agentId=" + agentId +
", agentName='" + agentName + '\'' +
", grade='" + grade + '\'' +
", subject='" + subject + '\'' +
", target=" + target +
", altId='" + altId + '\'' +
", bookGroupId=" + bookGroupId +
", adviserId=" + adviserId +
"} " + super.toString();
}
}
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/13 12:01
**/
@ApiModel("社群书应用或作品")
public class BookGroupApp extends BaseEntity {
private static final long serialVersionUID = 8087587834605088625L;
@ApiModelProperty("作品或应用id")
private Long serveId;
@ApiModelProperty("应用或作品")
private String serveType;
@ApiModelProperty("类型来源(1欢迎语,2关键词,3群发,4配置资源)")
private Integer originType;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("分类id")
private Long classifyId;
@ApiModelProperty("创建人")
private Long createUser;
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 Integer getOriginType() {
return originType;
}
public void setOriginType(Integer originType) {
this.originType = originType;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override
public String toString() {
return "BookGroupApp{" +
"serveId=" + serveId +
", serveType='" + serveType + '\'' +
", originType=" + originType +
", bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", createUser=" + createUser +
"} " + super.toString();
}
}
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:09
**/
public class CopyCipherRecord extends BaseEntity {
private static final long serialVersionUID = 64309925992870280L;
@ApiModelProperty("暗号")
private String cipher;
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("微信用户id")
private Long wechatUserId;
public String getCipher() {
return cipher;
}
public void setCipher(String cipher) {
this.cipher = cipher;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getWechatUserId() {
return wechatUserId;
}
public void setWechatUserId(Long wechatUserId) {
this.wechatUserId = wechatUserId;
}
@Override
public String toString() {
return "CopyCipherRecord{" +
"cipher='" + cipher + '\'' +
", bookGroupId=" + bookGroupId +
", wechatUserId=" + wechatUserId +
"} " + super.toString();
}
}
package com.pcloud.book.group.enums;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/14 9:48
**/
public enum AppAndProductTypeEnum {
/**
* APP
*/
APP("APP"),
/**
* PRODUCT
*/
PRODUCT("PRODUCT");
public final String value;
AppAndProductTypeEnum(String value) {
this.value = value;
}
}
package com.pcloud.book.group.enums;
public enum BookGroupAppOriginTypeEnum {
/**
* 欢迎语
*/
GUIDE(1, "欢迎语"),
/**
* 关键词
*/
KEYWORD(2, "关键词"),
/**
* 群发
*/
PUSH(3, "群发"),
/**
* 配置资源
*/
SERVE(4, "配置资源");
public final Integer code;
public final String name;
BookGroupAppOriginTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
}
......@@ -3,12 +3,16 @@ package com.pcloud.book.group.facade;
import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
@Api(description = "应用作品点击记录")
public interface AppClickRecordFacade {
......@@ -20,4 +24,14 @@ public interface AppClickRecordFacade {
@RequestBody @ApiParam("应用点击记录模型") AppClickRecord appClickRecord
) throws BizException;
@ApiOperation("根据类型按照时间获取资源服务点击人数")
@GetMapping("getAppClickByTime")
ResponseDto<?> getAppClickByTime(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType,
@RequestParam("timeType") @ApiParam("时间类型(1按天,2按小时)") Integer timeType,
@RequestParam("startTime") @ApiParam("开始时间") String startTime,
@RequestParam("endTime") @ApiParam("结束时间") String endTime
) throws BizException, PermissionException;
}
package com.pcloud.book.group.facade;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
@Api(description = "社区群应用作品")
public interface BookGroupAppFacade {
@ApiOperation("根据社群码id查询所挂资源统计")
@GetMapping("getBookGroupAppDTOSByBookGroupId")
ResponseDto<?> getBookGroupAppDTOSByBookGroupId(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws PermissionException;
@ApiOperation("根据社群码id导出所挂资源统计")
@GetMapping("exportBookGroupAppDTOSByBookGroupId")
ResponseDto<?> exportBookGroupAppDTOSByBookGroupId(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId
) throws PermissionException;
}
......@@ -215,6 +215,12 @@ public interface BookGroupClassifyFacade {
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId) throws BizException, PermissionException;
@ApiOperation("根据类型获取分类数量")
@GetMapping("getClassifyCountByJoinGroupType")
ResponseDto<?> getClassifyCountByJoinGroupType(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType
) throws PermissionException;
}
package com.pcloud.book.group.facade;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookGroupServe;
......@@ -493,4 +494,81 @@ public interface BookGroupFacade {
@RequestParam("channelId") Long channelId
) throws PermissionException;
@ApiOperation("根据类型获取社群书数量")
@GetMapping("getBookGroupCountByJoinGroupType")
ResponseDto<?> getBookGroupCountByJoinGroupType(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType
) throws PermissionException;
@ApiOperation("获取个人号累计加好友人数")
@GetMapping("getAddFriendCount")
ResponseDto<?> getAddFriendCount(
@RequestHeader("token") String token
) throws PermissionException;
@ApiOperation("根据时间段获取个人号加好友人数")
@GetMapping("getAddFriendCountByTime")
ResponseDto<?> getAddFriendCountByTime(
@RequestHeader("token") String token,
@RequestParam("timeType") @ApiParam("时间类型(1按天,2按小时)") Integer timeType,
@RequestParam("startTime") @ApiParam("开始时间") String startTime,
@RequestParam("endTime") @ApiParam("结束时间") String endTime
) throws PermissionException;
@ApiOperation("获取出版社创建社群书数量排行")
@GetMapping("getTopAgentCreateBookGroup")
ResponseDto<?> getTopAgentCreateBookGroup(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType,
@RequestParam("top") Integer top,
@RequestParam("isSpecial") Boolean isSpecial
) throws PermissionException;
@ApiOperation("获取个人号读者专业或深度分布")
@GetMapping("getUserLabelDistribution")
ResponseDto<?> getUserLabelDistribution(
@RequestHeader("token") String token,
@RequestParam("largeTemplet") @ApiParam("1:K12类,2:少儿类,3:高等/职教,4:大众类,5:特殊出版社") Integer largeTemplet,
@RequestParam("type") @ApiParam("1:专业,2:深度") Integer type
) throws PermissionException;
@ApiOperation("获取出版社个人号统计信息")
@GetMapping("getAgentStatisticsInfo")
ResponseDto<?> getAgentStatisticsInfo(@RequestHeader("token") String token,
@RequestParam(value = "agentId", required = false) @ApiParam("出版社ID") Long agentId,
@RequestParam(value = "isSpecial", required = false) @ApiParam("是否是定制出版社") Boolean isSpecial,
@RequestParam(value = "currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam(value = "numPerPage") @ApiParam("每页条数") Integer numPerPage) throws PermissionException;
@ApiOperation("导出出版社个人号统计信息")
@GetMapping("exportAgentStatisticsInfo")
ResponseDto<?> exportAgentStatisticsInfo(@RequestHeader("token") String token,
@RequestParam(value = "agentId", required = false) @ApiParam("出版社ID") Long agentId,
@RequestParam(value = "isSpecial", required = false) @ApiParam("是否是定制出版社") Boolean isSpecial) throws PermissionException;
@ApiOperation("按时间获取资源服务点击量趋势")
@PostMapping("getServeClickTendencyList")
ResponseDto<?> getServeClickTendencyList(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestBody List<String> dateList
) throws PermissionException;
@ApiOperation("个人号社群书统计")
@PostMapping("getSelfBookGroupStatistics")
ResponseDto<?> getSelfBookGroupStatistics(
@RequestHeader("token") String token,
@RequestBody SelfBookGroupStParamDTO selfBookGroupStParamDTO
) throws PermissionException;
@ApiOperation("导出个人号社群书统计")
@PostMapping("exportSelfBookGroupStatistics")
ResponseDto<?> exportSelfBookGroupStatistics(
@RequestHeader("token") String token,
@RequestBody SelfBookGroupStParamDTO selfBookGroupStParamDTO
) throws PermissionException;
}
package com.pcloud.book.group.facade;
import com.pcloud.book.group.entity.CopyCipherRecord;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Api(description = "点击复制暗号记录接口")
public interface CopyCipherRecordFacade {
@ApiOperation("新增点击复制暗号记录")
@PostMapping("createCopyCipherRecord")
ResponseDto<?> createCopyCipherRecord(
@CookieValue("userInfo") String userInfo,
@RequestBody @ApiParam("点击复制暗号记录模型") CopyCipherRecord copyCipherRecord
) throws BizException;
}
......@@ -84,4 +84,14 @@ public interface GroupQrcodeFacade {
ResponseDto<PageBeanNew> listQrcodeByPcloud(
@RequestHeader("token") String token, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage,@RequestParam(value = "name", required = false) String name) throws PermissionException;
@ApiOperation("根据类型获取当前群总人数")
@GetMapping("getUserCountByJoinGroupType")
ResponseDto<?> getUserCountByJoinGroupType(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType
) throws PermissionException;
}
......@@ -4,8 +4,11 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.AppClickRecordBiz;
import com.pcloud.book.group.entity.AppClickRecord;
import com.pcloud.book.group.facade.AppClickRecordFacade;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -38,4 +41,21 @@ public class AppClickRecordFacadeImpl implements AppClickRecordFacade {
appClickRecord.setWechatUserId(wechatUserId);
return new ResponseDto<>(appClickRecordBiz.createAppClickRecord(appClickRecord));
}
@ApiOperation("根据类型按照时间获取资源服务点击人数")
@GetMapping("getAppClickByTime")
@Override
public ResponseDto<?> getAppClickByTime(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType,
@RequestParam("timeType") @ApiParam("时间类型(1按天,2按小时)") Integer timeType,
@RequestParam("startTime") @ApiParam("开始时间") String startTime,
@RequestParam("endTime") @ApiParam("结束时间") String endTime
) throws BizException, PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(appClickRecordBiz.getAppClickByTime(joinGroupType, timeType, startTime, endTime));
}
}
package com.pcloud.book.group.facade.impl;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.facade.BookGroupAppFacade;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/14 14:35
**/
@RestController("bookGroupAppFacade")
@RequestMapping("bookGroupApp")
public class BookGroupAppFacadeImpl implements BookGroupAppFacade {
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
@ApiOperation("根据社群码id查询所挂资源统计")
@GetMapping("getBookGroupAppDTOSByBookGroupId")
@Override
public ResponseDto<?> getBookGroupAppDTOSByBookGroupId(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupAppBiz.getBookGroupAppDTOSByBookGroupId(bookGroupId,currentPage,numPerPage));
}
@ApiOperation("根据社群码id导出所挂资源统计")
@GetMapping("exportBookGroupAppDTOSByBookGroupId")
@Override
public ResponseDto<?> exportBookGroupAppDTOSByBookGroupId(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookGroupAppBiz.exportBookGroupAppDTOSByBookGroupId(bookGroupId, systemCode, partyId);
return new ResponseDto<>();
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.group.facade.impl;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.facade.BookGroupClassifyFacade;
import com.pcloud.book.group.vo.*;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
......@@ -215,5 +216,19 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
return new ResponseDto<>(classifyVOS);
}
@ApiOperation("根据类型获取分类数量")
@GetMapping("getClassifyCountByJoinGroupType")
@Override
public ResponseDto<?> getClassifyCountByJoinGroupType(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupClassifyBiz.getClassifyCountByJoinGroupType(joinGroupType));
}
}
......@@ -4,6 +4,7 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookGroupServe;
......@@ -20,6 +21,7 @@ import com.pcloud.book.group.vo.ResourcesStatisticVO;
import com.pcloud.book.group.vo.TotalRescourceDataVO;
import com.pcloud.book.group.vo.UpdateRankTypeVO;
import com.pcloud.book.group.vo.WxGroupStatisticVO;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
......@@ -724,4 +726,161 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(bookGroupBiz.getDTOByBookId(bookId,channelId,partyId));
}
@ApiOperation("根据类型获取社群书数量")
@GetMapping("getBookGroupCountByJoinGroupType")
@Override
public ResponseDto<?> getBookGroupCountByJoinGroupType(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new BookBizException(BookBizException.ERROR, "角色错误!");
}
return new ResponseDto<>(bookGroupBiz.getBookGroupCountByJoinGroupType(joinGroupType));
}
@ApiOperation("获取个人号累计加好友人数")
@GetMapping("getAddFriendCount")
@Override
public ResponseDto<?> getAddFriendCount(
@RequestHeader("token") String token
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getAddFriendCount());
}
@ApiOperation("根据时间段获取个人号加好友人数")
@GetMapping("getAddFriendCountByTime")
@Override
public ResponseDto<?> getAddFriendCountByTime(
@RequestHeader("token") String token,
@RequestParam("timeType") @ApiParam("时间类型(1按天,2按小时)") Integer timeType,
@RequestParam("startTime") @ApiParam("开始时间") String startTime,
@RequestParam("endTime") @ApiParam("结束时间") String endTime
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getAddFriendCountByTime(timeType,startTime,endTime));
}
@ApiOperation("获取出版社创建社群书数量排行")
@GetMapping("getTopAgentCreateBookGroup")
@Override
public ResponseDto<?> getTopAgentCreateBookGroup(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType,
@RequestParam("top") Integer top,
@RequestParam("isSpecial") Boolean isSpecial
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getTopAgentCreateBookGroup(joinGroupType, top, isSpecial));
}
@ApiOperation("获取个人号读者专业或深度分布")
@GetMapping("getUserLabelDistribution")
@Override
public ResponseDto<?> getUserLabelDistribution(
@RequestHeader("token") String token,
@RequestParam("largeTemplet") @ApiParam("1:K12类,2:少儿类,3:高等/职教,4:大众类,5:特殊出版社") Integer largeTemplet,
@RequestParam("type") @ApiParam("1:专业,2:深度") Integer type
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getUserLabelDistribution(largeTemplet, type));
}
@ApiOperation("获取出版社个人号统计信息")
@GetMapping("getAgentStatisticsInfo")
@Override
public ResponseDto<?> getAgentStatisticsInfo(
@RequestHeader("token") String token,
@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "isSpecial", required = false) Boolean isSpecial,
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getAgentStatisticsInfo(agentId, isSpecial, currentPage, numPerPage));
}
@ApiOperation("导出出版社个人号统计信息")
@GetMapping("exportAgentStatisticsInfo")
@Override
public ResponseDto<?> exportAgentStatisticsInfo(
@RequestHeader("token") String token,
@RequestParam(value = "agentId", required = false) Long agentId,
@RequestParam(value = "isSpecial", required = false) Boolean isSpecial) throws PermissionException {
Map<String,Object> map = SessionUtil.getToken4Redis(token);
String isSystem = (String)map.get(SessionUtil.IS_SYSTEM);
String systemCode = (String)map.get(SessionUtil.SYSTEM_CODE);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
if (IsSystem.NOT_SYSTEM.code.equals(isSystem)){
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
}
bookGroupBiz.exportAgentStatisticsInfo(partyId, agentId, isSpecial);
return new ResponseDto<>();
}
@ApiOperation("按时间获取资源服务点击量趋势")
@PostMapping("getServeClickTendencyList")
@Override
public ResponseDto<?> getServeClickTendencyList(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") Long bookGroupId,
@RequestBody List<String> dateList
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getServeClickTendencyList(bookGroupId, dateList));
}
@ApiOperation("个人号社群书统计")
@PostMapping("getSelfBookGroupStatistics")
@Override
public ResponseDto<?> getSelfBookGroupStatistics(
@RequestHeader("token") String token,
@RequestBody SelfBookGroupStParamDTO selfBookGroupStParamDTO
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(bookGroupBiz.getSelfBookGroupStatistics(selfBookGroupStParamDTO));
}
@ApiOperation("导出个人号社群书统计")
@PostMapping("exportSelfBookGroupStatistics")
@Override
public ResponseDto<?> exportSelfBookGroupStatistics(
@RequestHeader("token") String token,
@RequestBody SelfBookGroupStParamDTO selfBookGroupStParamDTO
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookGroupBiz.exportSelfBookGroupStatistics(selfBookGroupStParamDTO, systemCode, partyId);
return new ResponseDto<>();
}
}
package com.pcloud.book.group.facade.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.CopyCipherRecordBiz;
import com.pcloud.book.group.entity.CopyCipherRecord;
import com.pcloud.book.group.facade.CopyCipherRecordFacade;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/11/15 14:16
**/
@RestController("copyCipherRecordFacade")
@RequestMapping("copyCipherRecord")
public class CopyCipherRecordFacadeImpl implements CopyCipherRecordFacade {
@Autowired
private CopyCipherRecordBiz copyCipherRecordBiz;
@ApiOperation("新增点击复制暗号记录")
@PostMapping("createCopyCipherRecord")
@Override
public ResponseDto<?> createCopyCipherRecord(
@CookieValue("userInfo") String userInfo,
@RequestBody @ApiParam("点击复制暗号记录模型") CopyCipherRecord copyCipherRecord
) throws BizException {
if (copyCipherRecord==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数为空!");
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
copyCipherRecord.setWechatUserId(wechatUserId);
return new ResponseDto<>(copyCipherRecordBiz.createCopyCipherRecord(copyCipherRecord));
}
}
......@@ -12,6 +12,7 @@ import com.pcloud.book.group.vo.GroupQrcodeBookVO;
import com.pcloud.book.group.vo.ListQrcodeByClassifyParamVO;
import com.pcloud.book.group.vo.UpdateGroupQrcodeRequestVO;
import com.pcloud.book.group.vo.WechatGroupNameVO;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
......@@ -143,4 +144,18 @@ public class GroupQrcodeFacadeImpl implements GroupQrcodeFacade {
PageBeanNew<GroupQrcodeBookVO> pageBeanNew = groupQrcodeBiz.listQrcodeByPcloud(currentPage, numPerPage, name);
return new ResponseDto<>(pageBeanNew);
}
@ApiOperation("根据类型获取当前群总人数")
@GetMapping("getUserCountByJoinGroupType")
@Override
public ResponseDto<?> getUserCountByJoinGroupType(
@RequestHeader("token") String token,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType
) throws PermissionException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
if (!SystemCode.pcloud.code.equalsIgnoreCase(systemCode)) {
throw new PermissionException(PermissionException.PERMISSION_NOT_FOUND);
}
return new ResponseDto<>(groupQrcodeBiz.getUserCountByJoinGroupType(joinGroupType));
}
}
package com.pcloud.book.group.service.impl;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.AltAndCountDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.dto.GroupCipherDTO;
......@@ -8,6 +10,8 @@ import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QueryByBookAdviserDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.dto.SelfRobtParamDTO;
import com.pcloud.book.group.service.BookGroupService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto;
......@@ -40,6 +44,8 @@ public class BookGroupServiceImpl implements BookGroupService {
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
/**
* 获取社群书基本信息
......@@ -211,4 +217,75 @@ public class BookGroupServiceImpl implements BookGroupService {
public void dealBookGroupServeOldOnShelves(){
bookGroupBiz.dealBookGroupServeOldOnShelves();
}
@Override
@GetMapping("getFriendIdsByBookGroupId")
public ResponseEntity<ResponseDto<List<String>>> getFriendIdsByBookGroupId(@RequestParam("bookGroupId") Long bookGroupId) {
List<String> userIds = bookGroupBiz.getFriendIdsByBookGroupId(bookGroupId);
return ResponseHandleUtil.toResponse(userIds);
}
@Override
@PostMapping("listPageFriendInfo")
public ResponseEntity<ResponseDto<PageBeanNew<SelfRobotUserDTO>>> listPageFriendInfo(@RequestBody SelfRobtParamDTO selfRobtParamDTO) {
if (null == selfRobtParamDTO || null == selfRobtParamDTO.getCurrentPage() || null == selfRobtParamDTO.getNumPerPage()) {
return ResponseHandleUtil.toResponse(new PageBeanNew<>());
}
PageBeanNew<SelfRobotUserDTO> pageBeanNew = bookGroupBiz.listPageFriendInfo(selfRobtParamDTO);
return ResponseHandleUtil.toResponse(pageBeanNew);
}
@ApiOperation("补充社群书的出版社id")
@GetMapping("fillAgentIdForBookGroup")
@Override
public void fillAgentIdForBookGroup(){
bookGroupBiz.fillAgentIdForBookGroup();
}
@ApiOperation("获取个人号累计加好友人数")
@GetMapping("getAddFriendCount")
@Override
public ResponseEntity<ResponseDto<Integer>> getAddFriendCount() {
Integer count = bookGroupBiz.getAddFriendCount();
return ResponseHandleUtil.toResponse(count);
}
@ApiOperation("获取所有已建分类的1v1的社群码")
@GetMapping("get1v1HasClassifyBookGroupIds")
@Override
public ResponseEntity<ResponseDto<List<Long>>> get1v1HasClassifyBookGroupIds(){
List<Long> list = bookGroupBiz.get1v1HasClassifyBookGroupIds();
return ResponseHandleUtil.toResponse(list);
}
@ApiOperation("根据小号批量获取服务社群书数量")
@PostMapping("getBookGroupCountMapByAltIds")
@Override
public ResponseEntity<ResponseDto<Map<String,Integer>>> getBookGroupCountMapByAltIds(@RequestBody List<String> altIds){
Map<String,Integer> map = bookGroupBiz.getBookGroupCountMapByAltIds(altIds);
return ResponseHandleUtil.toResponse(map);
}
@ApiOperation("获取小号社群书数量")
@PostMapping("getSerBookGroupCountByAltIds")
@Override
public ResponseEntity<ResponseDto<Integer>> getSerBookGroupCountByAltIds(@RequestBody List<String> altIds) {
Integer count = bookGroupBiz.getSerBookGroupCountByAltIds(altIds);
return ResponseHandleUtil.toResponse(count);
}
@ApiOperation("出版社关联的个人号以及个人号的社群书数量")
@GetMapping("getAltAndCountDTOListByAgentId")
@Override
public ResponseEntity<ResponseDto<List<AltAndCountDTO>>> getAltAndCountDTOListByAgentId(@RequestParam("agentId") Long agentId) {
List<AltAndCountDTO> list=bookGroupBiz.getAltAndCountDTOListByAgentId(agentId);
return ResponseHandleUtil.toResponse(list);
}
@ApiOperation("补充社群书旧的作品应用到新的表")
@GetMapping("addOldBookGroupAppToNew")
@Override
public void addOldBookGroupAppToNew() {
bookGroupAppBiz.addOldBookGroupAppToNew();
}
}
......@@ -7,11 +7,15 @@ import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.common.ExportConsr;
import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.AgentConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.GroupTopicDTO;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.book.keywords.dao.BookKeywordDao;
......@@ -31,9 +35,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
......@@ -73,6 +80,10 @@ public class GroupSet {
private BookGroupCipherUserDao bookGroupCipherUserDao;
@Autowired
private BrowseRecordConsr browseRecordConsr;
@Autowired
private AgentConsr agentConsr;
@Autowired
private BookGroupDao bookGroupDao;
/**
* 群分类删除topic
......@@ -321,4 +332,73 @@ public class GroupSet {
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
return fileUrl;
}
@ParamLog("填充空缺的时间")
public void fillEmptyTime(List<CountAndTimeDTO> list, Integer timeType, String startTime, String endTime) {
Date flag = DateUtils.getDateByStr(startTime);
Date end = DateUtils.getDateByStr(endTime);
List<String> times = list.stream().map(CountAndTimeDTO::getTime).collect(Collectors.toList());
//按天
if (timeType == 1) {
while (flag.before(end)) {
if (!times.contains(DateUtils.getStrFormTime("yyyy-MM-dd", flag))) {
CountAndTimeDTO countAndTimeDTO = new CountAndTimeDTO();
countAndTimeDTO.setTime(DateUtils.getStrFormTime("yyyy-MM-dd", flag));
countAndTimeDTO.setCount(0);
list.add(countAndTimeDTO);
}
flag = DateUtils.addDay(flag, 1);
}
}
//按小时
if (timeType == 2) {
while (flag.before(end)) {
String strForm = DateUtils.getStrFormTime("yyyy-MM-dd HH:mm:ss", flag);
strForm = strForm.substring(0, 13);
if (!times.contains(strForm)) {
CountAndTimeDTO countAndTimeDTO = new CountAndTimeDTO();
countAndTimeDTO.setTime(strForm);
countAndTimeDTO.setCount(0);
list.add(countAndTimeDTO);
}
flag = DateUtils.addHour(flag, 1);
}
}
}
public void setAgentStatisticsDetailInfo(List<AgentStatisticsInfoDTO> agentStatisticsInfoDTOS) {
List<Long> agentIds = agentStatisticsInfoDTOS.stream().filter(s -> s.getAgentId() != null).map(AgentStatisticsInfoDTO::getAgentId).collect(Collectors.toList());
Map<Long, String> agentNameMap = agentConsr.getNames(agentIds);
//出版社定制小号数量
Map<Long, Integer> agentRobotCountMap = wechatGroupConsr.mapSpecialAgentRobotCount(agentIds);
//出版社关联小号发送消息数量
Map<Long, List<String>> agentRobotParamMap = new HashMap<>();
for(Long agId :agentIds) {
List<String> robotWxids = bookGroupDao.getRobotWxidsByAgent(agId);
agentRobotParamMap.put(agId, robotWxids);
}
Map<Long, Integer> agentRobotMsgCountMap = wechatGroupConsr.mapAgentMsgCountByRobotIdList(agentRobotParamMap);
for(AgentStatisticsInfoDTO statisticsInfoDTO : agentStatisticsInfoDTOS) {
Long statisticsAgentId = statisticsInfoDTO.getAgentId();
//出版社名称
if(!CollectionUtils.isEmpty(agentNameMap)) {
statisticsInfoDTO.setAgentName(agentNameMap.get(statisticsAgentId) == null ? "" : agentNameMap.get(statisticsAgentId));
} else {
statisticsInfoDTO.setAgentName("");
}
//定制个人号数量
if(!CollectionUtils.isEmpty(agentRobotCountMap)) {
statisticsInfoDTO.setRobotCount(agentRobotCountMap.get(statisticsAgentId) == null ? 0 : agentRobotCountMap.get(statisticsAgentId));
} else {
statisticsInfoDTO.setRobotCount(0);
}
//出版社个人号已发消息数量
if(!CollectionUtils.isEmpty(agentRobotMsgCountMap)) {
statisticsInfoDTO.setSendMsgCount(agentRobotMsgCountMap.get(statisticsAgentId) == null ? 0 : agentRobotMsgCountMap.get(statisticsAgentId));
} else {
statisticsInfoDTO.setSendMsgCount(0);
}
}
}
}
package com.pcloud.book.group.tools;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.wechatgroup.selfrobot.dto.SelfRobotMsgRecord;
import com.pcloud.wechatgroup.selfrobot.service.SelfRobotService;
import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.SendTextMessageVO;
import com.sdk.wxgroup.WxGroupSDK;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
/**
* @描述:1v1个人号发送消息
* @作者:zhuyajie
* @创建时间:18:02 2019/11/13
* @版本:1.0
*/
@Slf4j
@Component
public class SendSelfMsgTools {
@Autowired
private SelfRobotService selfRobotService;
private static SendSelfMsgTools sendSelfMsgTools;
/**
* 发送文本消息
*/
public static void sendTextMessage(SendTextMessageVO sendTextMessageVO) {
WxGroupSDK.sendTextMessage(sendTextMessageVO);
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
SelfRobotMsgRecord selfRobotMsgRecord = new SelfRobotMsgRecord();
selfRobotMsgRecord.setMessageType(1);//文本
selfRobotMsgRecord.setTextContent(sendTextMessageVO.getContent());
selfRobotMsgRecord.setWxId(sendTextMessageVO.getAltId());
selfRobotMsgRecord.setWxUserId(sendTextMessageVO.getWxGroupId());
insertMsg(selfRobotMsgRecord);
});
}
/**
* 发送入群邀请链接
*/
public static void sendGroupInvite(SendGroupInviteVO sendGroupInviteVO) {
WxGroupSDK.sendGroupInvite(sendGroupInviteVO);
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
SelfRobotMsgRecord selfRobotMsgRecord = new SelfRobotMsgRecord();
selfRobotMsgRecord.setMessageType(11);//链接
selfRobotMsgRecord.setWxId(sendGroupInviteVO.getAltId());
selfRobotMsgRecord.setWxUserId(sendGroupInviteVO.getWxId());
selfRobotMsgRecord.setTitle("邀请你加入群聊");
insertMsg(selfRobotMsgRecord);
});
}
/**
* 保存发送记录
*/
public static void insertMsg(SelfRobotMsgRecord selfRobotMsgRecord) {
try {
sendSelfMsgTools.selfRobotService.addSelfRobotMsg(selfRobotMsgRecord);
} catch (Exception e) {
log.error("添加个人号消息记录失败" + e.getMessage(), e);
}
}
@PostConstruct
public void init() {
sendSelfMsgTools = this;
sendSelfMsgTools.selfRobotService = this.selfRobotService;
}
}
......@@ -4,6 +4,7 @@ import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatisticsDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.dto.ServiceResourceDTO;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.vo.*;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.wechatgroup.message.dto.SendTextDTO;
......
......@@ -5,6 +5,7 @@ import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
......@@ -24,6 +25,7 @@ import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.enums.CipherTypeEnum;
import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendSelfMsgTools;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.keywords.biz.BookGuideBiz;
......@@ -106,6 +108,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
private KeywordDao keywordDao;
@Autowired
private WeixinClockGroupClassifyDao weixinClockGroupClassifyDao;
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
@ParamLog("同意加好友发送欢迎语")
@Override
......@@ -124,7 +128,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo.setAltId(agreeAddUserDTO.getRobotWxId());
vo.setWxGroupId(agreeAddUserDTO.getUserWxId());
vo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(vo);
SendSelfMsgTools.sendTextMessage(vo);
return;
}
if (StringUtil.isBlank(cipher)) {
......@@ -268,6 +272,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
List<BookGuideReply> bookGuideReplies = setToBookGuideReply(setGuideVO.getReplyMessages(), bookGuide.getId(), partyId, bookGroupDTO.getChannelId());
bookGuideReplyDao.insert(bookGuideReplies);
bookGroupAppBiz.addBookGuideToBookGroupApp(bookGuide,bookGuideReplies);
}
@ParamLog("设置回复参数")
......@@ -325,6 +330,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
bookGuideReplyDao.deleteByGuideId(updateGuideVO.getId());
List<BookGuideReply> bookGuideReplies = setToBookGuideReply(updateGuideVO.getReplyMessages(), bookGuide.getId(), partyId, bookGuideOld.getChannelId());
bookGuideReplyDao.insert(bookGuideReplies);
BookGuide bookGuideNew = bookGuideDao.getById(bookGuide.getId());
bookGroupAppBiz.addBookGuideToBookGroupApp(bookGuideNew,bookGuideReplies);
}
}
......
......@@ -11,6 +11,7 @@ import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.live.LiveCons;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
......@@ -32,6 +33,7 @@ import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.QrcodeStatusEnum;
import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendSelfMsgTools;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.group.vo.ClassifyVO;
......@@ -95,6 +97,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
......@@ -156,6 +159,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private BookGroupCipherUserDao bookGroupCipherUserDao;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
/**
* 字符串切割长度
*/
......@@ -222,6 +227,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
}
bookKeyword.setIsEdit(1);
bookKeywordDao.insert(bookKeyword);
bookKeyword.setKeyword(keyword);
bookGroupAppBiz.addAppKeywordToBookGroupApp(Arrays.asList(bookKeyword));
} else {
//按书创建
List<ClassifyNameVO> classifyNameVOS = bookGroupClassifyDao.listClassifyByRank(setKeywordVO.getBookGroupId());
......@@ -273,6 +280,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
} else {
cKeyword.setIsEdit(0);
}
cKeyword.setKeyword(keyword);
bookKeywords.add(cKeyword);
});
}
......@@ -287,8 +295,10 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
} else {
bookKeyword.setIsEdit(0);
}
bookKeyword.setKeyword(keyword);
bookKeywords.add(bookKeyword);
bookKeywordDao.insert(bookKeywords);
bookGroupAppBiz.addAppKeywordToBookGroupApp(bookKeywords);
}
}
......@@ -614,7 +624,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
vo.setAltId(robotId);
vo.setWxGroupId(userWxId);
vo.setIp(ip);
WxGroupSDK.sendTextMessage(vo);
SendSelfMsgTools.sendTextMessage(vo);
log.info("发送收到暗号后的本书介绍 : {}", vo);
}
......@@ -683,8 +693,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
sendGroupInviteVO.setWxId(sendTextDTO.getWechatUserId());
sendGroupInviteVO.setWxGroupId(wxGroupId);
sendGroupInviteVO.setIp(sendTextDTO.getIp());
WxGroupSDK.sendGroupInvite(sendGroupInviteVO);
log.info("发送进群链接 sendGroupInviteVO:{}", sendGroupInviteVO);
SendSelfMsgTools.sendGroupInvite(sendGroupInviteVO);
log.info("[同意加好友发送欢迎语] 发送进群链接 sendGroupInviteVO:{}", sendGroupInviteVO);
}
@ParamLog("根据关键词判断关键词是否为1V1社群群名称")
......
package com.pcloud.book.keywords.dao;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.entity.BookGuide;
import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @author lily
* @date 2019/4/23 15:53
......@@ -31,4 +34,9 @@ public interface BookGuideDao extends BaseDao<BookGuide> {
* @Date:2019/5/5 11:35
*/
GuideDTO getBaseInfo(Long classifyId, Long bookGroupId);
/**
* 查询所有应用作品引导语
*/
List<BookGroupApp> getAllAppGuide();
}
package com.pcloud.book.keywords.dao;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.group.vo.SyncKeyworsVO;
import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordResourceDTO;
......@@ -150,4 +151,8 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
*/
public List<BookGroupKeywordResourceDTO> getBookGroupResourceList(Long bookGroupId);
/**
* 查询所有的作品应用类型的关键词
*/
List<BookGroupApp> getAllAppKeyword();
}
......@@ -4,6 +4,8 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @author lily
* @date 2019/4/25 11:51
......@@ -24,4 +26,9 @@ public interface KeywordDao extends BaseDao<Keyword> {
void updateServeInfo(Long serveId, String serveType, String title, String squareImg);
ReplyKeywordDTO getByKeyword(String keyword);
/**
* 根据id集合批量查询
*/
List<Keyword> getListByIds(List<Long> keywordIds);
}
package com.pcloud.book.keywords.dao.impl;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.keywords.dao.BookGuideDao;
import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.entity.BookGuide;
......@@ -9,6 +10,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -34,4 +36,9 @@ public class BookGuideDaoImpl extends BaseDaoImpl<BookGuide> implements BookGuid
paramMap.put("bookGroupId", bookGroupId);
return this.getSqlSession().selectOne(this.getStatement("getBaseInfo"), paramMap);
}
@Override
public List<BookGroupApp> getAllAppGuide() {
return this.getSqlSession().selectList(this.getStatement("getAllAppGuide"));
}
}
......@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.book.group.dto.BookGroupKeywordResourceDTO;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.group.vo.SyncKeyworsVO;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dto.KeywordDTO;
......@@ -186,4 +187,9 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
return getSessionTemplate().selectList(getStatement("getBookGroupResourceList"), paramMap);
}
@Override
public List<BookGroupApp> getAllAppKeyword() {
return getSessionTemplate().selectList(getStatement("getAllAppKeyword"));
}
}
......@@ -8,6 +8,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
......@@ -38,4 +39,9 @@ public class KeywordDaoImpl extends BaseDaoImpl<Keyword> implements KeywordDao {
public ReplyKeywordDTO getByKeyword(String keyword) {
return this.getSqlSession().selectOne("getByKeyword", keyword);
}
@Override
public List<Keyword> getListByIds(List<Long> keywordIds) {
return this.getSqlSession().selectList("getListByIds", keywordIds);
}
}
......@@ -89,5 +89,7 @@ public class BookKeyword extends BaseEntity {
*/
private Integer isEdit;
private Keyword keyword;
}
......@@ -8,6 +8,7 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.es.biz.ESNewsBiz;
import com.pcloud.book.es.entity.ESNews;
import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.WeixinQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
......@@ -135,6 +136,8 @@ public class PushBizImpl implements PushBiz {
private BookGroupDao bookGroupDao;
@Autowired
private WeixinQrcodeBiz weixinQrcodeBiz;
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
private static final String PUSH_SCHEDULE_PRE="BOOK_GROUP_PUSH_";
......@@ -164,6 +167,7 @@ public class PushBizImpl implements PushBiz {
ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(() -> itemProductAutoOnShelves(push.getPushGroups(), push.getPushItems()));
//设置定时任务
pushQuartz(push);
bookGroupAppBiz.addPushToBookGroupApp(push.getPushGroups(),push.getPushItems());
}
/**
......@@ -484,6 +488,7 @@ public class PushBizImpl implements PushBiz {
pushDao.update(push);
dealUpdatePushGroup(push);
dealUpdatePushItem(push);
bookGroupAppBiz.addPushToBookGroupApp(push.getPushGroups(), push.getPushItems());
//判断是否需要删除群发定时任务
if (isNeedupdatepushSchedule(pushOld, push)) {
//删除之前的群发定时任务,重新设置群发
......@@ -608,6 +613,8 @@ public class PushBizImpl implements PushBiz {
pushGroup.setUpdateUser(partyId);
}
pushGroupDao.batchInsert(pushGroups);
List<PushItem> pushItems = pushItemDao.getListByPushId(pushId);
bookGroupAppBiz.addPushToBookGroupApp(pushGroups, pushItems);
}
@Transactional(rollbackFor = Exception.class)
......
package com.pcloud.book.push.dao;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.push.dto.PlanClassifyDTO;
import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.common.core.dao.BaseDao;
......@@ -63,4 +64,9 @@ public interface PushGroupDao extends BaseDao<PushGroup> {
* @return
*/
List<PlanClassifyDTO> getPlanClassifyListByPlanId(Long pushPlanId);
/**
* 获取所有应用作品类型的群发
*/
List<BookGroupApp> getAllAppPush();
}
package com.pcloud.book.push.dao.impl;
import com.pcloud.book.group.entity.BookGroupApp;
import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.dto.PlanClassifyDTO;
import com.pcloud.book.push.entity.PushGroup;
......@@ -66,4 +67,9 @@ public class PushGroupDaoImpl extends BaseDaoImpl<PushGroup> implements PushGrou
public List<PlanClassifyDTO> getPlanClassifyListByPlanId(Long pushPlanId) {
return super.getSqlSession().selectList(getStatement("getPlanClassifyListByPlanId"), pushPlanId);
}
@Override
public List<BookGroupApp> getAllAppPush() {
return super.getSqlSession().selectList(getStatement("getAllAppPush"));
}
}
......@@ -1803,4 +1803,32 @@
ORDER BY
G.update_time DESC , G.id DESC
</select>
<select id="getListPage4BookGroup" parameterType="map" resultMap="bookMap">
SELECT
b.BOOK_ID,
b.TYPE_CODE,
b.ISBN,
b.BOOK_NAME,
b.AUTHOR,
b.PUBLISH,
b.COVER_IMG,
b.BOOK_PRICE,
b.SERIAL_NUMBER,
b.AD_IMG
FROM
book b
RIGHT JOIN book_group g ON b.BOOK_ID = g.book_id
WHERE
b.IS_DELETE = 0
AND g.is_delete = 0
AND g.join_group_type = #{joinGroupType}
<if test="name!=null">
AND
(b.BOOK_NAME LIKE CONCAT('%', #{name},'%') OR b.ISBN LIKE CONCAT(#{name},'%'))
</if>
ORDER BY
g.create_time DESC
</select>
</mapper>
\ No newline at end of file
......@@ -171,5 +171,167 @@
</if>
</select>
<!--根据类型按照时间获取资源服务点击人数-->
<select id="getAppClickByTime" parameterType="map" resultType="com.pcloud.book.group.dto.CountAndTimeDTO">
SELECT
create_time time,
COUNT(wechat_user_id) count
FROM
(
SELECT
t.wechat_user_id wechat_user_id,
<if test="timeType==1">
DATE_FORMAT(t.create_time, '%Y-%m-%d') create_time
</if>
<if test="timeType==2">
DATE_FORMAT(t.create_time, '%Y-%m-%d %H') create_time
</if>
FROM
app_click_record t
INNER JOIN book_group t1 ON t.book_group_id = t1.id
WHERE
1 = 1
<if test="joinGroupType!=null">
AND t1.join_group_type = #{joinGroupType}
</if>
<if test="startTime!=null">
AND t.create_time >= #{startTime}
</if>
<if test="endTime!=null">
AND t.create_time &lt;= #{endTime}
</if>
GROUP BY
t.wechat_user_id,
<if test="timeType==1">
DATE_FORMAT(t.create_time, '%Y-%m-%d')
</if>
<if test="timeType==2">
DATE_FORMAT(t.create_time, '%Y-%m-%d %H')
</if>
ORDER BY
t.create_time ASC
) tt
<if test="timeType==1">
GROUP BY DATE_FORMAT(tt.create_time,'%Y-%m-%d')
</if>
<if test="timeType==2">
GROUP BY DATE_FORMAT(tt.create_time,'%Y-%m-%d %H')
</if>
</select>
<!--批量获取点击次数-->
<select id="getClickCountByServe" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupAppDTO">
SELECT
COUNT(1) clickCount,
serve_id serveId,
serve_type serveType,
book_group_id bookGroupId
FROM
app_click_record t
WHERE
t.book_group_id = #{bookGroupId}
AND t.serve_id IN
<foreach collection="serveIds" item="item" open="(" close=")" separator="," index="index">
#{item}
</foreach>
AND t.serve_type=#{serveType}
GROUP BY
serve_id,
serve_type,
book_group_id
</select>
<!--批量获取点击人数-->
<select id="getClickPeopleCountByServe" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupAppDTO">
SELECT
COUNT(tt.wechat_user_id) clickPeopleCount,
tt.book_group_id bookGroupId,
tt.serve_id serveId,
tt.serve_type serveType
FROM
(
SELECT
t.wechat_user_id,
t.serve_id,
t.serve_type,
t.book_group_id
FROM
app_click_record t
WHERE
t.book_group_id = #{bookGroupId}
AND t.serve_id IN
<foreach collection="serveIds" item="item" open="(" close=")" separator="," index="index">
#{item}
</foreach>
AND t.serve_type=#{serveType}
GROUP BY
t.wechat_user_id,
t.serve_id,
t.serve_type,
t.book_group_id
) tt
GROUP BY
tt.book_group_id,
tt.serve_id,
tt.serve_type
</select>
<!--根据bookGroupId批量获取点击次数-->
<select id="getAppClickByBookGroupId" parameterType="map" resultType="com.pcloud.book.group.dto.CountAndTimeDTO">
SELECT
DATE_FORMAT(t.create_time, '%Y-%m-%d') date,
DATE_FORMAT(t.create_time,'%Y-%m-%d %H') time,
COUNT(1) count
FROM
app_click_record t
WHERE
t.book_group_id = #{bookGroupId}
AND DATE_FORMAT(t.create_time, '%Y-%m-%d') IN
<foreach collection="dateList" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
GROUP BY
DATE_FORMAT( t.create_time, '%Y-%m-%d %H' )
</select>
<!--根据bookGroupIds获取应用点击人数-->
<select id="getClPeCoByBookGroupIds" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupIdAndCountDTO">
SELECT
tt.book_group_id bookGroupId,
COUNT(tt.wechat_user_id) count
FROM
(
SELECT
t.wechat_user_id,
t.book_group_id
FROM
app_click_record t
WHERE
t.book_group_id IN
<foreach collection="bookGroupIds" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
GROUP BY
t.book_group_id,
t.wechat_user_id
) tt
GROUP BY
tt.book_group_id
</select>
<!--根据bookGroupIds获取应用点击人数-->
<select id="getClCoByBookGroupIds" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupIdAndCountDTO">
SELECT
COUNT(1) count,
t.book_group_id bookGroupId
FROM
app_click_record t
WHERE
t.book_group_id IN
<foreach collection="bookGroupIds" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
GROUP BY
t.book_group_id
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.BookGroupAgentRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.BookGroupAgentRecord">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="agent_name" property="agentName" jdbcType="VARCHAR"/>
<result column="grade" property="grade" jdbcType="VARCHAR"/>
<result column="subject" property="subject" jdbcType="VARCHAR"/>
<result column="target" property="target" jdbcType="VARCHAR"/>
<result column="alt_id" property="altId" jdbcType="VARCHAR"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, agent_id,agent_name,grade,subject,target,alt_id,book_group_id,adviser_id,create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.BookGroupAgentRecord" useGeneratedKeys="true"
keyProperty="id">
insert into book_group_agent_record
<trim prefix="(" suffix=")" suffixOverrides=",">
agent_id,
agent_name,
grade,
subject,
target,
alt_id,
book_group_id,
adviser_id,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{agentId,jdbcType=BIGINT},
#{agentName,jdbcType=VARCHAR},
#{grade,jdbcType=VARCHAR},
#{subject,jdbcType=VARCHAR},
#{target,jdbcType=VARCHAR},
#{altId,jdbcType=VARCHAR},
#{bookGroupId,jdbcType=VARCHAR},
#{adviserId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--根据小号id和社群码id查询-->
<select id="getByAltIdAndBookGroupId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group_agent_record where
alt_id=#{altId}
and book_group_id=#{bookGroupId}
limit 1
</select>
<!--根据社群码id集合查询小号-->
<select id="getAltIdByBookGroupIds" parameterType="map" resultMap="BaseResultMap">
select book_group_id bookGroupId,alt_id altId
from book_group_agent_record
where book_group_id in
<foreach collection="bookGroupIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by book_group_id alt_id
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.BookGroupAppDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.BookGroupApp">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="origin_type" property="originType" jdbcType="INTEGER"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="BaseResultMapDTO" type="com.pcloud.book.group.dto.BookGroupAppDTO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="origin_type" property="originType" jdbcType="INTEGER"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="classify_id" property="classifyId" jdbcType="BIGINT"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, serve_id, serve_type, origin_type, book_group_id, classify_id, create_user, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.BookGroupApp" useGeneratedKeys="true"
keyProperty="id">
insert into book_group_app
<trim prefix="(" suffix=")" suffixOverrides=",">
serve_id,
serve_type,
origin_type,
book_group_id,
classify_id,
create_user,
create_time,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{originType,jdbcType=INTEGER},
#{bookGroupId,jdbcType=BIGINT},
#{classifyId,jdbcType=BIGINT},
#{createUser,jdbcType=BIGINT},
NOW(),
</trim>
</insert>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.group.entity.BookGroupApp" useGeneratedKeys="true" keyProperty="id">
insert into book_group_app (
serve_id,
serve_type,
origin_type,
book_group_id,
classify_id,
create_user,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.originType,jdbcType=INTEGER},
#{item.bookGroupId,jdbcType=BIGINT},
#{item.classifyId,jdbcType=BIGINT},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<!--根据条件查询-->
<select id="getByCondition" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group_app t
where t.serve_type=#{serveType}
and t.serve_id=#{serveId}
and t.book_group_id=#{bookGroupId}
and t.classify_id=#{classifyId}
and t.origin_type=#{originType}
</select>
<!--根据社群码id查询所挂资源统计-->
<select id="getBookGroupAppDTOSByBookGroupId" parameterType="map" resultMap="BaseResultMapDTO">
SELECT
serve_id,
serve_type,
book_group_id,
create_user
FROM
book_group_app t
WHERE
t.book_group_id = #{bookGroupId}
GROUP BY
serve_id,
serve_type,
book_group_id
</select>
<!--根据社群码Id查询资源数量-->
<select id="getServerCountByBookGroupIds" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupIdAndCountDTO">
SELECT
t.book_group_id bookGroupId,
COUNT(1) count
FROM
book_group_app t
WHERE
t.book_group_id IN
<foreach collection="bookGroupIds" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
GROUP BY
t.book_group_id
</select>
<!--查询所有社群书id-->
<select id="getAllBookGroupId" resultType="Long">
SELECT distinct book_group_id from
book_group_app
</select>
<!--获取应用统计数据-->
<select id="getAppServeStatistics" parameterType="map" resultType="com.pcloud.book.group.dto.AppStatisticsDTO">
SELECT
t.serve_id serveId,
t.serve_type serveType
FROM
book_group_app t
left join app_touch_record t1
on t.book_group_id
WHERE 1=1
<if test="bookGroupId!=null">
AND t.book_group_id =#{bookGroupId}
</if>
GROUP BY
t.serve_id,t.serve_type
order by t.create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -105,4 +105,280 @@
where t.book_group_id=#{bookGroupId}
GROUP BY t.wx_user_id
</select>
<select id="getFriendIdsByBookGroupId" resultType="string" parameterType="long">
SELECT DISTINCT
wx_user_id
FROM
book_group_cipher_user
WHERE
book_group_id = #{bookGroupId}
</select>
<select id="listPageFriendInfo" parameterType="map" resultType="com.pcloud.book.group.dto.SelfRobotUserDTO">
SELECT
u.wx_user_id wxUserId,
u.alt_id robotId,
u.create_time joinTime
FROM
book_group_cipher_user u
LEFT JOIN book_group g ON u.book_group_id = g.id
WHERE
1 = 1
<if test="userIds != null and userIds.size>0">
AND u.wx_user_id IN
<foreach collection = "userIds" index="index" item = "userId" open = "(" separator= "," close = ")">
#{userId,jdbcType=VARCHAR}
</foreach>
</if>
<if test="robotIds != null and robotIds.size>0">
AND u.alt_id IN
<foreach collection="robotIds" index="index" item="robotId" open = "(" separator= "," close = ")">
#{robotId, jdbcType=VARCHAR}
</foreach>
</if>
<if test="bookIds != null and bookIds.size>0">
AND g.book_id IN
<foreach collection="bookIds" index="index" item="bookId" open = "(" separator= "," close = ")">
${bookId}
</foreach>
</if>
<if test="null != friendState and (friendState==1 or friendState==2)">
<if test="friendState==2">
AND (
</if>
<if test="friendState==1">
AND !(
</if>
<foreach collection="deleteUserList" index="index" item="item" open="(" separator="or" close=")">
u.wx_user_id = #{item.wxUserId} AND u.alt_id = #{item.robotId}
</foreach>
)
</if>
GROUP BY
u.wx_user_id,
u.alt_id
ORDER BY
u.create_time DESC
<if test="pageNum>=0 and numPerPage>0">
LIMIT #{pageNum}, #{numPerPage}
</if>
</select>
<select id="getBookGroupListByUser" resultType="com.pcloud.book.book.dto.BookDto" parameterType="map">
SELECT
u.book_group_id bookGroupId,
b.BOOK_NAME bookName,
b.ISBN isbn,
b.SERIAL_NUMBER serialNumber
FROM
book_group_cipher_user u
LEFT JOIN book_group g ON u.book_group_id = g.id
LEFT JOIN book b ON g.book_id = b.BOOK_ID
WHERE
u.wx_user_id = #{wxUserId}
AND u.alt_id = #{altId}
GROUP BY
u.book_group_id
</select>
<!--获取个人号累计加好友人数-->
<select id="getAddFriendCount" resultType="Integer">
SELECT
COUNT(1)
FROM
(
SELECT
COUNT(1)
FROM
book_group_cipher_user t
GROUP BY
book_group_id,
wx_user_id
) t
</select>
<!--根据时间段获取个人号加好友人数-->
<select id="getAddFriendCountByTime" parameterType="map" resultType="com.pcloud.book.group.dto.CountAndTimeDTO">
SELECT
COUNT(1) count,
<if test="timeType==1">
DATE_FORMAT(tt.create_time,'%Y-%m-%d') time
</if>
<if test="timeType==2">
DATE_FORMAT(tt.create_time,'%Y-%m-%d %H') time
</if>
FROM
(
SELECT
t.id,t.create_time
FROM
book_group_cipher_user t
WHERE
1=1
<if test="startTime!=null">
and t.create_time >= #{startTime}
</if>
<if test="endTime!=null">
AND t.create_time &lt;= #{endTime}
</if>
GROUP BY
t.book_group_id,
t.wx_user_id
ORDER BY
create_time ASC
) tt
<if test="timeType==1">
GROUP BY DATE_FORMAT(tt.create_time,'%Y-%m-%d')
</if>
<if test="timeType==2">
GROUP BY DATE_FORMAT(tt.create_time,'%Y-%m-%d %H')
</if>
</select>
<!--获取个人号读者专业或深度分布-->
<select id="getUserLabelDistribution" parameterType="map" resultType="com.pcloud.book.group.dto.LabelUserCountDTO">
SELECT
COUNT(tt.wx_user_id) count,
<if test="type==1">
tt.pro_label_id labelId
</if>
<if test="type==2">
tt.dep_label_id labelId
</if>
FROM
(
SELECT
t.book_group_id,
t.wx_user_id,
t1.dep_label_id,
t1.pro_label_id
FROM
book_group_cipher_user t
INNER JOIN book_group t1 ON t.book_group_id = t1.id
WHERE
t1.dep_label_id IS NOT NULL
AND t1.pro_label_id IS NOT NULL
<if test="altIds!=null and altIds.size()>0">
AND alt_id IN
<foreach collection="altIds" item="item" open="(" separator="," close=")" index="index">
#{item}
</foreach>
</if>
GROUP BY
t.book_group_id,
t.wx_user_id
) tt
<if test="type==1">
GROUP BY tt.pro_label_id
</if>
<if test="type==2">
GROUP BY tt.dep_label_id
</if>
ORDER BY
count DESC
</select>
<!--根据社群码获取小号-->
<select id="getAltIdByBookGroupIds" parameterType="map" resultMap="BaseResultMap">
select book_group_id, alt_id
from book_group_cipher_user where
book_group_id in
<foreach collection="bookGroupIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
group by book_group_id,alt_id
</select>
<!--根据bookGroupIds获取累计加好友人数-->
<select id="getAddFriendByBookGroupIds" parameterType="map" resultType="com.pcloud.book.group.dto.BookGroupIdAndCountDTO">
SELECT
tt.book_group_id bookGroupId,
COUNT(wx_user_id) count
FROM
(
SELECT
t.book_group_id,
t.wx_user_id
FROM
book_group_cipher_user t
WHERE
t.book_group_id IN
<foreach collection="bookGroupIds" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
GROUP BY
t.book_group_id,
t.wx_user_id
) tt
GROUP BY
tt.book_group_id
</select>
<!--根据社群码id集合获取小号和用户id-->
<select id="getWxUserIdAndAltsByBookGroupIds" parameterType="map" resultMap="BaseResultMap">
SELECT
t.book_group_id ,
t.alt_id ,
t.wx_user_id
FROM
book_group_cipher_user t
WHERE
t.book_group_id IN
<foreach collection="bookGroupIds" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
GROUP BY
t.book_group_id,
t.alt_id,
t.wx_user_id
</select>
<!--根据小号获取服务社群书数量-->
<select id="getBookGroupCountListByAltIds" parameterType="list" resultType="com.pcloud.book.group.dto.AltAndCountDTO">
SELECT
tt.alt_id altId,
count(1) count
FROM
(
SELECT
t.book_group_id,
t.alt_id
FROM
book_group_cipher_user t
WHERE
alt_id IN
<foreach collection="list" open="(" separator="," close=")" item="item">
#{item}
</foreach>
GROUP BY
t.book_group_id,t.alt_id
) tt
GROUP BY
tt.alt_id
</select>
<!--获取小号社群书数量-->
<select id="getBookGroupIdsByAltIds" parameterType="list" resultType="Long">
SELECT DISTINCT
book_group_id
FROM
book_group_cipher_user t
WHERE
alt_id IN
<foreach collection="list" open="(" separator="," close=")" item="item">
#{item}
</foreach>
</select>
<!--根据出版社id获取小号id集合-->
<select id="getAltIdsByAgentId" parameterType="Long" resultType="String">
SELECT
DISTINCT alt_id
FROM
book_group_cipher_user t
LEFT JOIN book_group t1 ON t.book_group_id = t1.id
WHERE
t1.agent_id = #{agentId}
</select>
</mapper>
\ No newline at end of file
......@@ -988,4 +988,37 @@
order by create_time asc
</select>
<!--根据类型获取分类数量-->
<select id="getClassifyCountByJoinGroupType" parameterType="map" resultType="Integer">
SELECT
COUNT(1)
FROM
book_group_classify t
INNER JOIN book_group t1 ON t.book_group_id = t1.id
WHERE
t.is_delete = 0
AND t1.is_delete = 0
<if test="joinGroupType!=null">
and t1.join_group_type=#{joinGroupType}
</if>
</select>
<select id="listClassifyCountInfo" parameterType="map" resultType="com.pcloud.book.group.dto.SelfBookGroupStDTO">
SELECT
t.book_group_id bookGroupId,
COUNT(t.id) classifyCount,
IFNULL(SUM(t1.user_number),0) preInGroupPeopleCount
FROM
book_group_classify t
LEFT JOIN book_group_qrcode t1 ON t.id = t1.classify_id
AND t1.is_delete = 0
WHERE
t.book_group_id IN
<foreach collection="bookGroupIds" open="(" separator="," close=")" index="index" item="item">
#{item}
</foreach>
AND t.is_delete = 0
GROUP BY
t.book_group_id
</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