统计:处理会员地区统计,存在未知省份的情况

This commit is contained in:
owen 2023-10-16 13:20:11 +08:00
parent bb82c631e9
commit 4f731e9904

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.statistics.service.member;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.NumberUtil;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.ip.core.Area;
import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
import cn.iocoder.yudao.module.statistics.controller.admin.common.vo.DataComparisonRespVO;
@ -60,7 +61,6 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService {
@Override
public List<MemberAreaStatisticsRespVO> getMemberAreaStatisticsList() {
// 统计用户
// TODO @疯狂要处理下未知省份就是没填写省份的情况
// TODO @疯狂可能得把每个省的用户都查询出来然后去 order 那边 in因为要按照这些人为基础来计算用户规模量大可能不太好但是暂时就先这样搞吧 = =
Map<Integer, Integer> userCountMap = convertMap(memberStatisticsMapper.selectSummaryListByAreaId(),
vo -> AreaUtils.getParentIdByType(vo.getAreaId(), AreaTypeEnum.PROVINCE),
@ -74,7 +74,9 @@ public class MemberStatisticsServiceImpl implements MemberStatisticsService {
.setOrderPayUserCount(a.getOrderPayUserCount() + b.getOrderPayUserCount())
.setOrderPayPrice(a.getOrderPayPrice() + b.getOrderPayPrice()));
// 拼接数据
return MemberStatisticsConvert.INSTANCE.convertList(AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area), userCountMap, orderMap);
List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area);
areaList.add(new Area().setId(null).setName("未知"));
return MemberStatisticsConvert.INSTANCE.convertList(areaList, userCountMap, orderMap);
}
// TODO @疯狂这个方法要不拆成1controller 调用 getMemberAnalyseComparisonData2tradeOrderStatisticsService.getPayUserCount3tradeOrderStatisticsService.getOrderPayPrice4