Commit 9c328f63 by daixing

修改接口,添加分页

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