Commit 9c328f63 by daixing

修改接口,添加分页

parent 1352fdbe
......@@ -265,7 +265,7 @@ public interface BookGroupBiz {
/**
* 社群码分类统计
*/
List<GroupStatisticVO> getClassifyStatistic(Long bookGroupId, Long adviserId);
PageBeanNew<GroupStatisticVO> getClassifyStatistic(Long bookGroupId, Long adviserId, Integer currentPage, Integer numPerPage);
/**
* 社群码分类的微信群统计
......
......@@ -1236,14 +1236,18 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Override
public List<GroupStatisticVO> getClassifyStatistic(Long bookGroupId, Long adviserId) {
List<ListClassifyVO> listClassifyVOS = bookGroupClassifyBiz.listAllClassify(bookGroupId);
if (ListUtils.isEmpty(listClassifyVOS)){
return new ArrayList<>();
public PageBeanNew<GroupStatisticVO> getClassifyStatistic(Long bookGroupId, Long adviserId, Integer currentPage, Integer numPerPage) {
PageParam pageParam = new PageParam(currentPage,numPerPage);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupId",bookGroupId);
PageBeanNew<GroupStatisticVO> pageClassify = bookGroupClassifyDao.listPageNew(pageParam, paramMap, "pageClassify");
List<GroupStatisticVO> recordList = pageClassify.getRecordList();
if (ListUtils.isEmpty(recordList)){
return new PageBeanNew<>();
}
List<Long> classifyIds = listClassifyVOS.stream().map(ListClassifyVO::getId).collect(Collectors.toList());
List<Long> classifyIds = recordList.stream().map(GroupStatisticVO::getClassifyId).collect(Collectors.toList());
if (ListUtils.isEmpty(classifyIds)){
return new ArrayList<>();
return new PageBeanNew<>();
}
Map<Long, ClickClassifyDTO> longClickClassifyDTOMap = bookGroupClassifyDao.mapClickClassify(classifyIds);
GetGroupClassifyIncomeDTO getGroupClassifyIncomeDTO = new GetGroupClassifyIncomeDTO();
......@@ -1251,37 +1255,30 @@ public class BookGroupBizImpl implements BookGroupBiz {
getGroupClassifyIncomeDTO.setPartyId(adviserId);
getGroupClassifyIncomeDTO.setRoleId(5L);
Map<Long, BigDecimal> classifyIncome = bookConsr.getClassifyIncome(getGroupClassifyIncomeDTO);
List<GroupStatisticVO> groupStatisticVOS = new ArrayList<>();
Map<Long, Long> mapMemberCount = wechatGroupConsr.getclassifyMemberCount(classifyIds);
listClassifyVOS.forEach(e ->{
recordList.forEach(e ->{
GroupStatisticVO groupStatisticVO = new GroupStatisticVO();
if (longClickClassifyDTOMap.get(e.getId()) != null){
Long count = longClickClassifyDTOMap.get(e.getId()).getCount()==null?0L:longClickClassifyDTOMap.get(e.getId()).getCount();
groupStatisticVO.setClickCount(count);
}
groupStatisticVO.setClassifyId(e.getId());
groupStatisticVO.setClassifyName(e.getClassify());
groupStatisticVO.setCreatedTime(e.getCreatedTime());
if (longClickClassifyDTOMap.get(e.getClassifyId()) != null){
Long count = longClickClassifyDTOMap.get(e.getClassifyId()).getCount()==null?0L:longClickClassifyDTOMap.get(e.getClassifyId()).getCount();
e.setClickCount(count);
}
if (BigDecimal.ZERO.compareTo(e.getPrice()) ==0){
groupStatisticVO.setIsFree(1);
e.setIsFree(1);
}else {
groupStatisticVO.setIsFree(0);
e.setIsFree(0);
}
groupStatisticVO.setGroupPersonCount(e.getUserNumberTotal().longValue());
if (!MapUtils.isEmpty(classifyIncome)){
groupStatisticVO.setIncome(classifyIncome.get(e.getId()));
e.setIncome(classifyIncome.get(e.getClassifyId()));
}else {
groupStatisticVO.setIncome(BigDecimal.ZERO);
e.setIncome(BigDecimal.ZERO);
}
if (!MapUtils.isEmpty(mapMemberCount)){
groupStatisticVO.setInGroupPersonCount(mapMemberCount.get(e.getId()));
e.setInGroupPersonCount(mapMemberCount.get(e.getClassifyId()));
}else {
groupStatisticVO.setInGroupPersonCount(0L);
e.setInGroupPersonCount(0L);
}
groupStatisticVOS.add(groupStatisticVO);
});
return groupStatisticVOS;
return pageClassify;
}
@Override
......@@ -1356,8 +1353,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
productStaticUnderAppMapDTO.setAppIds(appClickStatistics.stream().map(ResourcesStatisticVO::getRescourceId).collect(Collectors.toList()));
productStaticUnderAppMapDTO.setPartyId(adviserId);
productStaticUnderAppMapDTO.setRoleId(5L);
Map<Long, List<com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO>> productStaticUnderApp = settlementConsr.getProductStaticUnderApp(productStaticUnderAppMapDTO);
Map<Long, List<StatisticsIncomeDto>> productStaticUnderAppMap = copy(productStaticUnderApp,bookGroupId);
// Map<Long, List<com.pcloud.settlementcenter.record.dto.ResourcesStatisticVO>> productStaticUnderApp = settlementConsr.getProductStaticUnderApp(productStaticUnderAppMapDTO);
// Map<Long, List<StatisticsIncomeDto>> productStaticUnderAppMap = copy(productStaticUnderApp,bookGroupId);
appClickStatistics.forEach(e ->{
StatisticsIncomeDto statisticsIncomeDto = new StatisticsIncomeDto();
statisticsIncomeDto.setAppId(e.getRescourceId());
......@@ -1367,7 +1364,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
statisticsIncomeDto.setSaleCounts(e.getSaleCount().intValue());
statisticsIncomeDto.setSaleMoney(e.getTotalSale());
statisticsIncomeDto.setScanCounts(e.getBrowseCount().intValue());
statisticsIncomeDto.setItemList(productStaticUnderAppMap.get(e.getRescourceId()));
// statisticsIncomeDto.setItemList(productStaticUnderAppMap.get(e.getRescourceId()));
appStatisticsIncomeDtos.add(statisticsIncomeDto);
});
......
......@@ -170,7 +170,7 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
@Override
public List<ClassifyQrcodeVO> getQrcodeByClassify(Long bookGroupId, Long classifyId) {
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeDao.getQrcodeByClassify(bookGroupId, classifyId);
List<ClassifyQrcodeVO> qrcodeByClassify = groupQrcodeDao.getQrcodeByClassify(classifyId);
if (ListUtils.isEmpty(qrcodeByClassify)){
return new ArrayList<>();
}
......
......@@ -201,5 +201,5 @@ public interface GroupQrcodeDao extends BaseDao<GroupQrcode> {
/**
* 根据分类id获取分类下的群---不分页
*/
List<ClassifyQrcodeVO> getQrcodeByClassify(Long bookGroupId, Long classifyId);
List<ClassifyQrcodeVO> getQrcodeByClassify(Long classifyId);
}
......@@ -191,11 +191,7 @@ public class GroupQrcodeDaoImpl extends BaseDaoImpl<GroupQrcode> implements Grou
}
@Override
public List<ClassifyQrcodeVO> getQrcodeByClassify(Long bookGroupId, Long classifyId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("classifyId", classifyId);
map.put("changeNumber", 0);
return this.getSqlSession().selectList(this.getStatement("listQrcodeByClassify"), map);
public List<ClassifyQrcodeVO> getQrcodeByClassify(Long classifyId) {
return this.getSqlSession().selectList(this.getStatement("getQrcodeByClassify"), classifyId);
}
}
......@@ -277,11 +277,15 @@ public interface BookGroupFacade {
@ApiOperation(value = "社群码分类统计--pc", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", required = true, dataType = "Long", paramType = "query")
@ApiImplicitParam(name = "bookGroupId", value = "bookGroupId", required = true, dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "currentPage", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "numPerPage", required = true, dataType = "Integer", paramType = "query")
})
@RequestMapping(value ="getClassifyStatistic",method = RequestMethod.GET)
public ResponseDto<List<GroupStatisticVO>> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException;
public ResponseDto<?> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "currentPage",required = true) Integer currentPage,
@RequestParam(value = "numPerPage",required = true) Integer numPerPage) throws BizException, PermissionException;
@ApiOperation(value = "社群码分类下的微信群统计--pc", httpMethod = "GET")
@ApiImplicitParams({
......@@ -289,7 +293,7 @@ public interface BookGroupFacade {
@ApiImplicitParam(name = "classifyId", value = "classifyId", required = true, dataType = "Long", paramType = "query")
})
@RequestMapping(value ="getQrcodeStatistic",method = RequestMethod.GET)
public ResponseDto<List<WxGroupStatisticVO>> getQrcodeStatistic(@RequestHeader("token") String token,
public ResponseDto<?> getQrcodeStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws BizException, PermissionException;
......
......@@ -401,17 +401,19 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@RequestMapping(value ="getClassifyStatistic",method = RequestMethod.GET)
public ResponseDto<List<GroupStatisticVO>> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId) throws BizException, PermissionException {
public ResponseDto<?> getClassifyStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam(value = "currentPage",required = true) Integer currentPage,
@RequestParam(value = "numPerPage",required = true) Integer numPerPage) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long adviserId = (Long) map.get(SessionUtil.PARTY_ID);
List<GroupStatisticVO> groupQrcodeStatistic = bookGroupBiz.getClassifyStatistic(bookGroupId, adviserId);
PageBeanNew<GroupStatisticVO> groupQrcodeStatistic = bookGroupBiz.getClassifyStatistic(bookGroupId, adviserId,currentPage,numPerPage);
return new ResponseDto<>(groupQrcodeStatistic);
}
@Override
@RequestMapping(value ="getQrcodeStatistic",method = RequestMethod.GET)
public ResponseDto<List<WxGroupStatisticVO>> getQrcodeStatistic(@RequestHeader("token") String token,
public ResponseDto<?> getQrcodeStatistic(@RequestHeader("token") String token,
@RequestParam(value = "bookGroupId",required = true) Long bookGroupId,
@RequestParam("classifyId") Long classifyId) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
......
......@@ -24,6 +24,9 @@ public class GroupStatisticVO implements Serializable {
@ApiModelProperty("是否免费,1-免费 0-收费")
private Integer isFree;
@ApiModelProperty("价格")
private BigDecimal price;
@ApiModelProperty("点击人数")
private Long clickCount;
......@@ -111,6 +114,13 @@ public class GroupStatisticVO implements Serializable {
this.createdTime = createdTime;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
@Override
public String toString() {
......
......@@ -849,4 +849,11 @@
group by c.id
order by c.id desc
</select>
<select id="pageClassify" parameterType="map" resultType="com.pcloud.book.group.vo.GroupStatisticVO">
select bgc.id classifyId, bgc.classify classifyName, bgc.price price,sum(user_number) groupPersonCount, bgc.create_time createdTime
from book_group_classify bgc left join book_group_qrcode bgq on bgc.id = bgq.classify_id
group by bgc.id
where book_group_id = #{bookGroupId}
</select>
</mapper>
\ No newline at end of file
......@@ -499,4 +499,9 @@
#{item}
</foreach>
</select>
<select id="getQrcodeByClassify" parameterType="long" resultType="com.pcloud.book.group.vo.ClassifyQrcodeVO">
select id, classify_id classifyId, group_name groupName, user_number userNumber, weixin_group_id weixinGroupId, create_time createdTime
from book_group_qrcode where classify_id = #{classifyId}
</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