Commit 4f731e99044f9c6f55b78316f263d35d7ac2deb7
1 parent
bb82c631
统计:处理会员地区统计,存在未知省份的情况
Showing
1 changed file
with
4 additions
and
2 deletions
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/service/member/MemberStatisticsServiceImpl.java
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.member; | @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.member; | ||
| 3 | import cn.hutool.core.date.LocalDateTimeUtil; | 3 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 4 | import cn.hutool.core.util.NumberUtil; | 4 | import cn.hutool.core.util.NumberUtil; |
| 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 5 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 6 | +import cn.iocoder.yudao.framework.ip.core.Area; | ||
| 6 | import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum; | 7 | import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum; |
| 7 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 8 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 8 | import cn.iocoder.yudao.module.statistics.controller.admin.common.vo.DataComparisonRespVO; | 9 | import cn.iocoder.yudao.module.statistics.controller.admin.common.vo.DataComparisonRespVO; |
| @@ -60,7 +61,6 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | @@ -60,7 +61,6 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | ||
| 60 | @Override | 61 | @Override |
| 61 | public List<MemberAreaStatisticsRespVO> getMemberAreaStatisticsList() { | 62 | public List<MemberAreaStatisticsRespVO> getMemberAreaStatisticsList() { |
| 62 | // 统计用户 | 63 | // 统计用户 |
| 63 | - // TODO @疯狂:要处理下,未知省份;就是没填写省份的情况; | ||
| 64 | // TODO @疯狂:可能得把每个省的用户,都查询出来,然后去 order 那边 in;因为要按照这些人为基础来计算;;用户规模量大可能不太好,但是暂时就先这样搞吧 = = | 64 | // TODO @疯狂:可能得把每个省的用户,都查询出来,然后去 order 那边 in;因为要按照这些人为基础来计算;;用户规模量大可能不太好,但是暂时就先这样搞吧 = = |
| 65 | Map<Integer, Integer> userCountMap = convertMap(memberStatisticsMapper.selectSummaryListByAreaId(), | 65 | Map<Integer, Integer> userCountMap = convertMap(memberStatisticsMapper.selectSummaryListByAreaId(), |
| 66 | vo -> AreaUtils.getParentIdByType(vo.getAreaId(), AreaTypeEnum.PROVINCE), | 66 | vo -> AreaUtils.getParentIdByType(vo.getAreaId(), AreaTypeEnum.PROVINCE), |
| @@ -74,7 +74,9 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | @@ -74,7 +74,9 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService { | ||
| 74 | .setOrderPayUserCount(a.getOrderPayUserCount() + b.getOrderPayUserCount()) | 74 | .setOrderPayUserCount(a.getOrderPayUserCount() + b.getOrderPayUserCount()) |
| 75 | .setOrderPayPrice(a.getOrderPayPrice() + b.getOrderPayPrice())); | 75 | .setOrderPayPrice(a.getOrderPayPrice() + b.getOrderPayPrice())); |
| 76 | // 拼接数据 | 76 | // 拼接数据 |
| 77 | - return MemberStatisticsConvert.INSTANCE.convertList(AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area), userCountMap, orderMap); | 77 | + List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area); |
| 78 | + areaList.add(new Area().setId(null).setName("未知")); | ||
| 79 | + return MemberStatisticsConvert.INSTANCE.convertList(areaList, userCountMap, orderMap); | ||
| 78 | } | 80 | } |
| 79 | 81 | ||
| 80 | // TODO @疯狂:这个方法,要不拆成:1)controller 调用 getMemberAnalyseComparisonData;2)tradeOrderStatisticsService.getPayUserCount;3)tradeOrderStatisticsService.getOrderPayPrice;4)。。。 | 82 | // TODO @疯狂:这个方法,要不拆成:1)controller 调用 getMemberAnalyseComparisonData;2)tradeOrderStatisticsService.getPayUserCount;3)tradeOrderStatisticsService.getOrderPayPrice;4)。。。 |