crm:code review 客户画像

This commit is contained in:
YunaiV 2024-04-05 14:44:00 +08:00
parent 9ea43ce55a
commit 05af77b786

View File

@ -40,21 +40,22 @@ public class CrmStatisticsPortraitServiceImpl implements CrmStatisticsPortraitSe
@Override
public List<CrmStatisticCustomerAreaRespVO> getCustomerSummaryByArea(CrmStatisticsPortraitReqVO reqVO) {
// 1.1 获得用户编号数组
// 1. 获得用户编号数组
List<Long> userIds = getUserIds(reqVO);
if (CollUtil.isEmpty(userIds)) {
return Collections.emptyList();
}
reqVO.setUserIds(userIds);
// 1.2 获取客户地区统计数据
// 2. 获取客户地区统计数据
List<CrmStatisticCustomerAreaRespVO> list = portraitMapper.selectSummaryListGroupByAreaId(reqVO);
if (CollUtil.isEmpty(list)) {
return Collections.emptyList();
}
// 2. 拼接数据
// 3. 拼接数据
List<Area> areaList = AreaUtils.getByType(AreaTypeEnum.PROVINCE, area -> area);
areaList.add(new Area().setId(null).setName("未知"));
areaList.add(new Area().setId(null).setName("未知")); // TODO @puhui999是不是 65 find 的逻辑改下不用 findAndThen直接从 areaMap 拿到就设置不拿到就设置 null 未知这样58 本行可以删除掉完事了这样代码更简单和一致
Map<Integer, Area> areaMap = convertMap(areaList, Area::getId);
return convertList(list, item -> {
Integer parentId = AreaUtils.getParentIdByType(item.getAreaId(), AreaTypeEnum.PROVINCE);
@ -76,11 +77,7 @@ public class CrmStatisticsPortraitServiceImpl implements CrmStatisticsPortraitSe
reqVO.setUserIds(userIds);
// 2. 获取客户行业统计数据
List<CrmStatisticCustomerIndustryRespVO> industryRespVOList = portraitMapper.selectCustomerIndustryListGroupByIndustryId(reqVO);
if (CollUtil.isEmpty(industryRespVOList)) {
return Collections.emptyList();
}
return industryRespVOList;
return portraitMapper.selectCustomerIndustryListGroupByIndustryId(reqVO);
}
@Override
@ -93,11 +90,7 @@ public class CrmStatisticsPortraitServiceImpl implements CrmStatisticsPortraitSe
reqVO.setUserIds(userIds);
// 2. 获取客户行业统计数据
List<CrmStatisticCustomerSourceRespVO> sourceRespVOList = portraitMapper.selectCustomerSourceListGroupBySource(reqVO);
if (CollUtil.isEmpty(sourceRespVOList)) {
return Collections.emptyList();
}
return sourceRespVOList;
return portraitMapper.selectCustomerSourceListGroupBySource(reqVO);
}
@Override
@ -110,11 +103,7 @@ public class CrmStatisticsPortraitServiceImpl implements CrmStatisticsPortraitSe
reqVO.setUserIds(userIds);
// 2. 获取客户级别统计数据
List<CrmStatisticCustomerLevelRespVO> levelRespVOList = portraitMapper.selectCustomerLevelListGroupByLevel(reqVO);
if (CollUtil.isEmpty(levelRespVOList)) {
return Collections.emptyList();
}
return levelRespVOList;
return portraitMapper.selectCustomerLevelListGroupByLevel(reqVO);
}
/**