Commit f16b1ef5 by 田超

Merge branch 'feature/1003376' into 'master'

feat: [1003376] 时代大屏

See merge request rays/pcloud-book!1125
parents fe8a49bc 2a73d4ce
package com.pcloud.book.timesscreen.service;
import com.pcloud.book.book.dto.BookCountDto;
import com.pcloud.book.book.dto.BookTypeDto;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
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.RequestParam;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@FeignClient(value = "pcloud-service-book", qualifier = "timesBookServiceCloud", path = "book/v1.0/timesBookService")
@Api(description = "时代大屏内部服务")
public interface TimesBookService {
@PostMapping("getBookCount")
@ApiOperation(value = "出版社下编辑的所有书刊的数目", httpMethod = "POST")
ResponseEntity<ResponseDto<Integer>> getBookCount(@RequestBody List<Long> agentIds);
@PostMapping("listBookCountByDate4Agent")
@ApiOperation(value = "出版每日新增书刊数(2周)", httpMethod = "POST")
ResponseEntity<ResponseDto<List<BookCountDto>>> listBookCountByDate4Agent(@RequestBody List<Long> agentIds);
@GetMapping("listPageIncomeDetail")
@ApiOperation(value = "数据分析 书刊分析列表", httpMethod = "GET")
ResponseEntity<ResponseDto<PageBeanNew>> listPageIncomeDetail(@RequestParam(value = "agentId") Long agentId,
@RequestParam(value = "keyWord", required = false) String keyWord,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId);
@GetMapping("exportBookIncomeDetail")
@ApiOperation(value = "书刊分析 导出书刊收益列表", httpMethod = "GET")
ResponseEntity<ResponseDto<Map<String,Object>>> exportBookIncomeDetail(@RequestParam(value = "agentId") Long agentId,
@RequestParam(value = "keyWord", required = false) String keyWord,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId);
@ApiOperation("获取个人号累计加好友人数")
@PostMapping("getAddFriendCount4Times")
ResponseEntity<ResponseDto<Integer>> getAddFriendCount4Times(@RequestBody List<Long> agentIds);
@ApiOperation("获取出版社下个人号累计加好友")
@PostMapping("getWxUserInAgents")
ResponseEntity<ResponseDto<List<String>>> getWxUserInAgents(@RequestBody List<Long> agentIds);
@ApiOperation("获取出版社下社群")
@PostMapping("getBookGroupIdInAgents")
ResponseEntity<ResponseDto<List<Long>>> getBookGroupIdInAgents(@RequestBody List<Long> agentIds);
@ApiOperation("获取书籍类型列表")
@GetMapping("list")
ResponseEntity<ResponseDto<List<BookTypeDto>>> list();
}
...@@ -159,6 +159,11 @@ public interface BookAdviserBiz { ...@@ -159,6 +159,11 @@ public interface BookAdviserBiz {
public Integer getBookCount(Long agentId); public Integer getBookCount(Long agentId);
/** /**
* 时代大屏用
*/
public Integer getBookCounts(List<Long> agentIds);
/**
* 更新模板 * 更新模板
*/ */
public void updateBookTemplet(Book book); public void updateBookTemplet(Book book);
...@@ -170,6 +175,11 @@ public interface BookAdviserBiz { ...@@ -170,6 +175,11 @@ public interface BookAdviserBiz {
public List<BookCountDto> listBookCountByDate4Agent(Long agentId); public List<BookCountDto> listBookCountByDate4Agent(Long agentId);
/** /**
*时代大屏用
*/
public List<BookCountDto> listBookCountByDate4Agents(List<Long> agentIds);
/**
* 删除书籍(编辑端) * 删除书籍(编辑端)
* @param bookId 图书标识 * @param bookId 图书标识
* @param adviserId 编辑标识 * @param adviserId 编辑标识
......
...@@ -624,6 +624,17 @@ public interface BookBiz { ...@@ -624,6 +624,17 @@ public interface BookBiz {
PageBeanNew<BookSaleVO> listPageIncomeDetail(PageParam pageParam, Map<String, Object> paramMap, Long agentId); PageBeanNew<BookSaleVO> listPageIncomeDetail(PageParam pageParam, Map<String, Object> paramMap, Long agentId);
/** /**
* 时代大屏用
*/
PageBeanNew<BookSaleVO> listPageIncomeDetail4Times(PageParam pageParam, Map<String, Object> paramMap, Long agentId);
/**
* 导出书刊收益--时代大屏用
*/
Map<String,Object> exportBookIncomeDetail4Times(Map<String, Object> paramMap, Long agentId);
/**
* 导出书刊收益--出版端 * 导出书刊收益--出版端
*/ */
void exportBookIncomeDetail(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode); void exportBookIncomeDetail(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode);
......
...@@ -9,6 +9,7 @@ import com.google.common.collect.Lists; ...@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.pcloud.analysisengine.browse.dto.BookBrowseAndScanStatsDTO; import com.pcloud.analysisengine.browse.dto.BookBrowseAndScanStatsDTO;
import com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto; import com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto;
import com.pcloud.appcenter.app.dto.AppCountDto;
import com.pcloud.book.base.dto.CountDto; import com.pcloud.book.base.dto.CountDto;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz; import com.pcloud.book.book.biz.BookAdviserBiz;
...@@ -640,6 +641,32 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -640,6 +641,32 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
/** /**
* 时代大屏用
*/
@Override
public Integer getBookCounts(List<Long> agentIds) {
if(ListUtils.isEmpty(agentIds)){
return 0;
}
Long agentId=agentIds.get(0);
if(agentIds.size()>1){
//如果查所有的出版社下的编辑。就传-1
agentId=-1L;
}
List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
Integer bookCount = null;
try {
if (!ListUtils.isEmpty(adviserIds)) {
bookCount = bookAdviserDao.getBookCount(adviserIds);
}
} catch (Exception e) {
LOGGER.error("出版社下编辑的所有书刊的数目,<ERROR>.[getBookCount]:" + e.getMessage(), e);
throw BizException.DB_SELECT_IS_FAIL;
}
return bookCount;
}
/**
* 更新图书模板 * 更新图书模板
*/ */
@ParamLog("更新图书模板") @ParamLog("更新图书模板")
...@@ -686,6 +713,32 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -686,6 +713,32 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
return bookCounts; return bookCounts;
} }
@Override
public List<BookCountDto> listBookCountByDate4Agents(List<Long> agentIds) {
if(ListUtils.isEmpty(agentIds)){
return new ArrayList<>();
}
Long agentId=agentIds.get(0);
if(agentIds.size()>1){
//如果查所有的出版社下的编辑。就传-1
agentId=-1L;
}
// 获取所有编辑
List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
List<BookCountDto> bookCounts = null;
String startDate = DateUtils.getShortDateStr(DateUtils.addDay(new Date(), -14));
String endDate = DateUtils.getShortDateStr(DateUtils.addDay(new Date(), -1));
if (!ListUtils.isEmpty(adviserIds)) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserIds", adviserIds);
paramMap.put("startDate", startDate);
paramMap.put("endDate", endDate);
bookCounts = bookAdviserDao.listBookCountByDate4Agent(paramMap);
}
this.setZoreRecord(bookCounts, startDate, endDate);
return bookCounts;
}
/** /**
* 填充不存在的日期中的值为0 * 填充不存在的日期中的值为0
* *
......
...@@ -2091,6 +2091,84 @@ public class BookBizImpl implements BookBiz { ...@@ -2091,6 +2091,84 @@ public class BookBizImpl implements BookBiz {
return pageNew; return pageNew;
} }
/**
* 时代大屏用
*/
@Override
public PageBeanNew<BookSaleVO> listPageIncomeDetail4Times(PageParam pageParam, Map<String, Object> paramMap, Long agentId) {
List<Long> adviserIds = adviserConsr.getIdsByNameAndAgentId(agentId, (String) paramMap.get("keyWord"));
List<Long> agent4AdviserIds = adviserConsr.getIdsByNameAndAgentId(agentId, null);
paramMap.put("adviserIds", adviserIds);
paramMap.put("agent4AdviserIds", agent4AdviserIds);
if (ListUtils.isEmpty(agent4AdviserIds)) {
return new PageBeanNew<>(0, 0, new ArrayList<>());
}
PageBeanNew<BookSaleVO> pageNew = bookDao.listPageNew(pageParam, paramMap, "listIncomePage4Agent");
//填充收益
bookSet.setAgentSalesInfo4Times(pageNew.getRecordList(),agentId);
return pageNew;
}
/**
* 导出书刊收益--时代大屏用
*/
@Override
public Map<String,Object> exportBookIncomeDetail4Times(Map<String, Object> paramMap, Long agentId) {
//导出数据
if (paramMap == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误!");
}
List<Long> adviserIds = adviserConsr.getIdsByNameAndAgentId(agentId, (String) paramMap.get("keyWord"));
List<Long> agent4AdviserIds = adviserConsr.getIdsByNameAndAgentId(agentId, null);
paramMap.put("adviserIds", adviserIds);
paramMap.put("agent4AdviserIds", agent4AdviserIds);
Long count = bookDao.countIncomePage4Agent(paramMap);
if(count>1500){
throw new ExportException(ExportException.OPERATE_ERROR, "数量超过限制,请添加条件再导出!");
}
Map<String,Object> map=new HashMap<>();
try{
List<BookSaleVO> list = new ArrayList<>();
Integer cu = 100;
Integer p = (count.intValue() / cu) + 1;
for (int i = 0; i < p; i++) {
PageBeanNew<BookSaleVO> pageBeanNew=listPageIncomeDetail(new PageParam(i,cu), paramMap, agentId);
List<BookSaleVO> bookSaleVOS=pageBeanNew.getRecordList();
list.addAll(bookSaleVOS);
}
List<Object[]> dataList = new ArrayList<>();
for (int i = 0, size = list.size(); i < size; i++) {
BookSaleVO bookSaleVO = list.get(i);
Object[] obj = new Object[9];
obj[0] = i + 1;
obj[1] = bookSaleVO.getBookName();
obj[2] = bookSaleVO.getIsbn();
if (bookSaleVO.getIsFundSupport()==true){
obj[3] = "是";
}else{
obj[3] = "否";
}
obj[4] = bookSaleVO.getAdviserName();
obj[5] = bookSaleVO.getChannelName();
if (bookSaleVO.getAgentBookIncomeDTO()!=null){
obj[6] = bookSaleVO.getAgentBookIncomeDTO().getBookIncome();
obj[7] = bookSaleVO.getAgentBookIncomeDTO().getAdviserIncome();
obj[8] = bookSaleVO.getAgentBookIncomeDTO().getAgentIncome();
}
dataList.add(obj);
}
Date date = new Date();
String[] rowsName = {"序号", "书刊名称", "书刊号", "是否基金书", "主编辑", "运营平台", "销售总额", "编辑收益", "出版社收益"};
String fileName = "书刊收益统计--" + DateUtils.getStrFormTime("yyyyMMdd", date);
String fileUrl = exportConsr.exportExcel(fileName, rowsName, dataList);
map.put("fileName",fileName);
map.put("fileUrl",fileUrl);
}catch (Exception e) {
LOGGER.error("exportBookIncomeDetail+++paramMap=" + paramMap.toString());
}
return map;
}
@ParamLog("导出书刊收益导出--出版端") @ParamLog("导出书刊收益导出--出版端")
@Override @Override
public void exportBookIncomeDetail(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode) { public void exportBookIncomeDetail(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode) {
......
...@@ -7,6 +7,7 @@ import cn.hutool.core.collection.CollUtil; ...@@ -7,6 +7,7 @@ import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mchange.v2.lang.ThreadUtils;
import com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto; import com.pcloud.analysisengine.browse.dto.BrowseCacheRecordDto;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO; import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
...@@ -57,8 +58,10 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao; ...@@ -57,8 +58,10 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao; import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dto.BookGroupDTO; import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO; import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.base.constants.MessageFromTypeEnum; import com.pcloud.channelcenter.base.constants.MessageFromTypeEnum;
import com.pcloud.channelcenter.qrcode.dto.QrcodeLocationDto; import com.pcloud.channelcenter.qrcode.dto.QrcodeLocationDto;
import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto;
import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrAskVO; import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrAskVO;
import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrVO; import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrVO;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
...@@ -82,6 +85,7 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto; ...@@ -82,6 +85,7 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto;
import com.pcloud.settlementcenter.pay.constants.PayConstant; import com.pcloud.settlementcenter.pay.constants.PayConstant;
import com.pcloud.settlementcenter.record.dto.AgentBookIncomeDTO; import com.pcloud.settlementcenter.record.dto.AgentBookIncomeDTO;
import com.pcloud.settlementcenter.record.dto.AgentBookIncomeParamDTO; import com.pcloud.settlementcenter.record.dto.AgentBookIncomeParamDTO;
import com.pcloud.settlementcenter.record.dto.AgentBookIncomeParamListDTO;
import com.pcloud.settlementcenter.record.dto.AllBookIncomeParamDTO; import com.pcloud.settlementcenter.record.dto.AllBookIncomeParamDTO;
import com.pcloud.settlementcenter.record.dto.BookIncomeDto; import com.pcloud.settlementcenter.record.dto.BookIncomeDto;
import com.pcloud.usercenter.common.dto.BookCaseParamDto; import com.pcloud.usercenter.common.dto.BookCaseParamDto;
...@@ -110,6 +114,10 @@ import java.util.List; ...@@ -110,6 +114,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -1706,6 +1714,60 @@ public class BookSet { ...@@ -1706,6 +1714,60 @@ public class BookSet {
} }
} }
/**
*时代大屏用
*/
public void setAgentSalesInfo4Times(List<BookSaleVO> bookSaleVOS, Long agentId) {
if (ListUtils.isEmpty(bookSaleVOS)) {
return;
}
List<Long> adviserIdList = bookSaleVOS.stream().filter(a->null!=a.getAdviserId()).map(a->a.getAdviserId()).distinct().collect(Collectors.toList());
List<Long> channelIdList = bookSaleVOS.stream().filter(a->null!=a.getChannelId()).map(a->a.getChannelId()).distinct().collect(Collectors.toList());
List<Long> bookIdList = bookSaleVOS.stream().filter(a->null!=a.getBookId()).map(a->a.getBookId()).distinct().collect(Collectors.toList());
AgentBookIncomeParamListDTO agentBookIncomeParamListDTO=new AgentBookIncomeParamListDTO();
agentBookIncomeParamListDTO.setAgentId(agentId);
agentBookIncomeParamListDTO.setAdviserIds(adviserIdList);
agentBookIncomeParamListDTO.setBookIds(bookIdList);
agentBookIncomeParamListDTO.setChannelIds(channelIdList);
Map<Long, String> adviserNameMap = new HashMap<>();
Map<Long, String> channelNameMap = new HashMap<>();
Map<String, AgentBookIncomeDTO> agentsIncome = new HashMap<>();
CompletableFuture<Map<String, AgentBookIncomeDTO>> agentsIncomeFuture = CompletableFuture.supplyAsync(() -> {
return settlementConsr.getAgentsIncome(agentBookIncomeParamListDTO);
}, ThreadPoolUtils.OTHER_POOL);
CompletableFuture<Map<Long,String> > adviserNameFuture = CompletableFuture.supplyAsync(() -> {
return adviserConsr.getNames(adviserIdList);
},ThreadPoolUtils.OTHER_POOL);
CompletableFuture<Map<Long,String>> channelNameFuture = CompletableFuture.supplyAsync(() -> {
return channelConsr.getNamesByIdList(channelIdList);
},ThreadPoolUtils.OTHER_POOL);
CompletableFuture.allOf(agentsIncomeFuture, adviserNameFuture, channelNameFuture);
try{
agentsIncome = agentsIncomeFuture.get(2, TimeUnit.SECONDS);
adviserNameMap = adviserNameFuture.get(2, TimeUnit.SECONDS);
channelNameMap = channelNameFuture.get(2, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
LOGGER.error("[getAgentsIncome] 并行查询收益任务失败! err:{}", e.getMessage(), e);
}
for (BookSaleVO bookSaleVO : bookSaleVOS) {
String key=bookSaleVO.getAdviserId()+"_"+bookSaleVO.getBookId()+"_"+bookSaleVO.getChannelId();
if(MapUtils.isNotEmpty(agentsIncome) && agentsIncome.containsKey(key)){
AgentBookIncomeDTO agentBookIncomeDTO = agentsIncome.get(key);
agentBookIncomeDTO.setBookId(bookSaleVO.getBookId());
bookSaleVO.setAgentBookIncomeDTO(agentBookIncomeDTO);
}else{
AgentBookIncomeDTO agentBookIncomeDTO=new AgentBookIncomeDTO();
agentBookIncomeDTO.setBookId(bookSaleVO.getBookId());
agentBookIncomeDTO.setAgentIncome(new BigDecimal(0));
agentBookIncomeDTO.setAdviserIncome(new BigDecimal(0));
agentBookIncomeDTO.setBookIncome(new BigDecimal(0));
bookSaleVO.setAgentBookIncomeDTO(agentBookIncomeDTO);
}
bookSaleVO.setChannelName(channelNameMap.get(bookSaleVO.getChannelId()));
bookSaleVO.setAdviserName(adviserNameMap.get(bookSaleVO.getAdviserId()));
}
}
public void setBookGroupInfo(List<Object> recordList) { public void setBookGroupInfo(List<Object> recordList) {
if (ListUtils.isEmpty(recordList)){ if (ListUtils.isEmpty(recordList)){
return; return;
......
...@@ -8,6 +8,7 @@ import com.pcloud.common.utils.ListUtils; ...@@ -8,6 +8,7 @@ import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.settlementcenter.record.dto.AgentBookIncomeDTO; import com.pcloud.settlementcenter.record.dto.AgentBookIncomeDTO;
import com.pcloud.settlementcenter.record.dto.AgentBookIncomeParamDTO; import com.pcloud.settlementcenter.record.dto.AgentBookIncomeParamDTO;
import com.pcloud.settlementcenter.record.dto.AgentBookIncomeParamListDTO;
import com.pcloud.settlementcenter.record.dto.AllBookIncomeParamDTO; import com.pcloud.settlementcenter.record.dto.AllBookIncomeParamDTO;
import com.pcloud.settlementcenter.record.dto.ProductStaticUnderAppMapDTO; import com.pcloud.settlementcenter.record.dto.ProductStaticUnderAppMapDTO;
import com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO; import com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO;
...@@ -112,6 +113,20 @@ public class SettlementConsr { ...@@ -112,6 +113,20 @@ public class SettlementConsr {
return agentBookIncomeDTO; return agentBookIncomeDTO;
} }
@ParamLog(value = "批量获取书刊编辑收益和出版收益", isBefore = false, isAfterReturn = false)
public Map<String, AgentBookIncomeDTO> getAgentsIncome(AgentBookIncomeParamListDTO agentBookIncomeParamListDTO) throws BizException {
Map<String, AgentBookIncomeDTO> result=new HashMap<>();
if (agentBookIncomeParamListDTO==null) {
return result;
}
try {
result= ResponseHandleUtil.parseMap(settlementService.getAgentsIncome(agentBookIncomeParamListDTO), String.class,AgentBookIncomeDTO.class);
} catch (Exception e) {
LOGGER.error("批量获取书刊编辑收益和出版收益.[getAgentsIncome]:" + e.getMessage(), e);
}
return result;
}
@ParamLog("获取书刊收益") @ParamLog("获取书刊收益")
public Map<String, BigDecimal> getAllBookIncome(AllBookIncomeParamDTO paramDTO) throws BizException { public Map<String, BigDecimal> getAllBookIncome(AllBookIncomeParamDTO paramDTO) throws BizException {
Map<String, BigDecimal> map = new HashMap<>(); Map<String, BigDecimal> map = new HashMap<>();
......
...@@ -604,6 +604,11 @@ public interface BookGroupBiz { ...@@ -604,6 +604,11 @@ public interface BookGroupBiz {
Integer getAddFriendCount(); Integer getAddFriendCount();
/** /**
*时代大屏用
*/
Integer getAddFriendCount4Times(List<Long> agentIds);
/**
* 根据时间段获取个人号加好友人数 * 根据时间段获取个人号加好友人数
*/ */
List<CountAndTimeDTO> getAddFriendCountByTime(Integer timeType, String startTime, String endTime); List<CountAndTimeDTO> getAddFriendCountByTime(Integer timeType, String startTime, String endTime);
...@@ -1025,4 +1030,8 @@ public interface BookGroupBiz { ...@@ -1025,4 +1030,8 @@ public interface BookGroupBiz {
* * @param null * * @param null
*/ */
List<BookServeDTO> getServeListByBookGroupId(Long bookGroupId, Long channelId); List<BookServeDTO> getServeListByBookGroupId(Long bookGroupId, Long channelId);
List<String> getWxUserInAgents(List<Long> agentIds);
List<Long> getBookGroupIdInAgents(List<Long> agentIds);
} }
...@@ -3587,6 +3587,11 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3587,6 +3587,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
return bookGroupCipherUserDao.getAddFriendCount(); return bookGroupCipherUserDao.getAddFriendCount();
} }
@Override
public Integer getAddFriendCount4Times(List<Long> agentIds) {
return bookGroupCipherUserDao.getAddFriendCount4Times(agentIds);
}
@ParamLog("根据时间段获取个人号加好友人数") @ParamLog("根据时间段获取个人号加好友人数")
@Override @Override
public List<CountAndTimeDTO> getAddFriendCountByTime( Integer timeType, String startTime, String endTime ) { public List<CountAndTimeDTO> getAddFriendCountByTime( Integer timeType, String startTime, String endTime ) {
...@@ -6218,7 +6223,7 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -6218,7 +6223,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
public List<BookServeDTO> getServeListByBookGroupId(Long bookGroupId, Long channelId) { public List<BookServeDTO> getServeListByBookGroupId(Long bookGroupId, Long channelId) {
List<BookServeDTO> serveDTOList = new ArrayList<>(); List<BookServeDTO> serveDTOList = new ArrayList<>();
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId); AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId);
if (null == accountSettingDto){ if (null == accountSettingDto) {
return new ArrayList<>(); return new ArrayList<>();
} }
List<BookGroupServe> bookGroupServes = bookGroupServeDao.getListByBookGroupId(bookGroupId); List<BookGroupServe> bookGroupServes = bookGroupServeDao.getListByBookGroupId(bookGroupId);
...@@ -6236,4 +6241,22 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -6236,4 +6241,22 @@ public class BookGroupBizImpl implements BookGroupBiz {
} }
return serveDTOList; return serveDTOList;
} }
@Override
public List<String> getWxUserInAgents(List<Long> agentIds) {
if(CollectionUtils.isEmpty(agentIds)){
return new ArrayList<>();
}
List<String> list= bookGroupDao.getWxUserInAgents(agentIds);
return list;
}
@Override
public List<Long> getBookGroupIdInAgents(List<Long> agentIds) {
if(CollectionUtils.isEmpty(agentIds)){
return new ArrayList<>();
}
List<Long> list= bookGroupDao.getBookGroupIdInAgents(agentIds);
return list;
}
} }
...@@ -210,4 +210,9 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> { ...@@ -210,4 +210,9 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> {
* @return * @return
*/ */
public List<String> getAltIdListByUserId(String wxUserId); public List<String> getAltIdListByUserId(String wxUserId);
/**
*时代大屏用
*/
Integer getAddFriendCount4Times(List<Long> agentIds);
} }
...@@ -373,4 +373,8 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -373,4 +373,8 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* @return * @return
*/ */
BookGroupDTO getDTOByBookId4Price(Long bookId, Long channelId, Long adviserId); BookGroupDTO getDTOByBookId4Price(Long bookId, Long channelId, Long adviserId);
List<String> getWxUserInAgents(List<Long> agentIds);
List<Long> getBookGroupIdInAgents(List<Long> agentIds);
} }
...@@ -225,4 +225,11 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser> ...@@ -225,4 +225,11 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser>
public List<String> getAltIdListByUserId(String wxUserId) { public List<String> getAltIdListByUserId(String wxUserId) {
return getSessionTemplate().selectList(getStatement("getAltIdListByUserId"), wxUserId); return getSessionTemplate().selectList(getStatement("getAltIdListByUserId"), wxUserId);
} }
@Override
public Integer getAddFriendCount4Times(List<Long> agentIds) {
Map<String, Object> map = new HashMap<>();
map.put("agentIds", agentIds);
return getSessionTemplate().selectOne(getStatement("getAddFriendCount4Times"), map);
}
} }
...@@ -480,4 +480,18 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -480,4 +480,18 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
paramMap.put("adviserId", adviserId); paramMap.put("adviserId", adviserId);
return super.getSqlSession().selectOne(getStatement("getDTOByBookId4Price"), paramMap); return super.getSqlSession().selectOne(getStatement("getDTOByBookId4Price"), paramMap);
} }
@Override
public List<String> getWxUserInAgents(List<Long> agentIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("agentIds", agentIds);
return super.getSqlSession().selectList(getStatement("getWxUserInAgents"), paramMap);
}
@Override
public List<Long> getBookGroupIdInAgents(List<Long> agentIds) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("agentIds", agentIds);
return super.getSqlSession().selectList(getStatement("getBookGroupIdInAgents"), paramMap);
}
} }
package com.pcloud.book.timesscreen.service.impl;
import com.google.common.collect.Lists;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.biz.BookTypeBiz;
import com.pcloud.book.book.dto.BookCountDto;
import com.pcloud.book.book.dto.BookTypeDto;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.timesscreen.service.TimesBookService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
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.RequestMapping;
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 javax.annotation.Resource;
@RestController
@RequestMapping("timesBookService")
public class TimesBookServiceImpl implements TimesBookService {
@Resource
private BookAdviserBiz bookAdviserBiz;
@Autowired
private BookBiz bookBiz;
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private BookTypeBiz bookTypeBiz;
@Override
@PostMapping("getBookCount")
public ResponseEntity<ResponseDto<Integer>> getBookCount(@RequestBody List<Long> agentIds) {
return ResponseHandleUtil.toResponse(bookAdviserBiz.getBookCounts(agentIds));
}
@Override
@PostMapping("listBookCountByDate4Agent")
public ResponseEntity<ResponseDto<List<BookCountDto>>> listBookCountByDate4Agent(@RequestBody List<Long> agentIds) {
return ResponseHandleUtil.toResponse(bookAdviserBiz.listBookCountByDate4Agents(agentIds));
}
@GetMapping("listPageIncomeDetail")
@Override
public ResponseEntity<ResponseDto<PageBeanNew>> listPageIncomeDetail(@RequestParam(value = "agentId") Long agentId,
@RequestParam(value = "keyWord", required = false) String keyWord,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId) {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("keyWord", keyWord != null && "".equals(keyWord.trim()) ? null : keyWord);
paramMap.put("channelId", channelId);
paramMap.put("typeCode", typeCode != null && "".equals(typeCode.trim()) ? null : typeCode);
paramMap.put("isFundSupport", isFundSupport);
paramMap.put("templetId", templetId);
paramMap.put("secondTempletId", secondTempletId);
paramMap.put("secondTempletIds", Optional.ofNullable(paramMap.get("secondTempletId")).map(Lists::newArrayList).orElse(Lists.newArrayList()));
return ResponseHandleUtil.toResponse(bookBiz.listPageIncomeDetail4Times(new PageParam(currentPage, numPerPage), paramMap, agentId));
}
@Override
@GetMapping("exportBookIncomeDetail")
public ResponseEntity<ResponseDto<Map<String,Object>>> exportBookIncomeDetail(@RequestParam(value = "agentId") Long agentId,
@RequestParam(value = "keyWord", required = false) String keyWord,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("keyWord", keyWord != null && "".equals(keyWord.trim()) ? null : keyWord);
paramMap.put("channelId", channelId);
paramMap.put("typeCode", typeCode != null && "".equals(typeCode.trim()) ? null : typeCode);
paramMap.put("isFundSupport", isFundSupport);
paramMap.put("templetId", templetId);
paramMap.put("secondTempletId", secondTempletId);
paramMap.put("secondTempletIds", Optional.ofNullable(paramMap.get("secondTempletId")).map(Lists::newArrayList).orElse(Lists.newArrayList()));
return ResponseHandleUtil.toResponse(bookBiz.exportBookIncomeDetail4Times(paramMap, agentId));
}
@Override
@PostMapping("getAddFriendCount4Times")
public ResponseEntity<ResponseDto<Integer>> getAddFriendCount4Times(@RequestBody List<Long> agentIds) {
return ResponseHandleUtil.toResponse(bookGroupBiz.getAddFriendCount4Times(agentIds));
}
@Override
@PostMapping("getWxUserInAgents")
public ResponseEntity<ResponseDto<List<String>>> getWxUserInAgents(@RequestBody List<Long> agentIds) {
return ResponseHandleUtil.toResponse(bookGroupBiz.getWxUserInAgents(agentIds));
}
@Override
@PostMapping("getBookGroupIdInAgents")
public ResponseEntity<ResponseDto<List<Long>>> getBookGroupIdInAgents(@RequestBody List<Long> agentIds) {
return ResponseHandleUtil.toResponse(bookGroupBiz.getBookGroupIdInAgents(agentIds));
}
@Override
@GetMapping("list")
public ResponseEntity<ResponseDto<List<BookTypeDto>>> list() {
List<BookTypeDto> bookTypeDtos = bookTypeBiz.getList();
List<BookTypeDto> result = bookTypeDtos == null ? new ArrayList<>() : bookTypeDtos;
return ResponseHandleUtil.toResponse(result);
}
}
...@@ -679,4 +679,24 @@ ...@@ -679,4 +679,24 @@
wx_user_id = #{wxUserId} wx_user_id = #{wxUserId}
</select> </select>
<!--获取个人号累计加好友人数 时代大屏用-->
<select id="getAddFriendCount4Times" parameterType="map" resultType="Integer">
SELECT
COUNT(1)
FROM
(
SELECT
COUNT(1)
FROM
book_group_cipher_user t left JOIN book_group bg on t.book_group_id=t.id
where bg.agent_id in
<foreach collection="agentIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
GROUP BY
t.book_group_id,
t.wx_user_id
) t
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -1187,4 +1187,25 @@ ...@@ -1187,4 +1187,25 @@
ORDER BY create_time ASC limit 1 ORDER BY create_time ASC limit 1
</select> </select>
<select id="getWxUserInAgents" parameterType="map" resultType="String">
SELECT
DISTINCT t.wx_user_id
FROM
book_group_cipher_user t t left JOIN book_group bg on t.book_group_id=t.id
where bg.agent_id in
<foreach collection="agentIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</select>
<select id="getBookGroupIdInAgents" parameterType="map" resultType="Long">
SELECT
DISTINCT t.book_group_id
FROM
book_group_cipher_user t t left JOIN book_group bg on t.book_group_id=t.id
where bg.agent_id in
<foreach collection="agentIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</select>
</mapper> </mapper>
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