Commit ac6300a3 by 张富康

省份枚举

1 parent a096a7dd
......@@ -87,10 +87,10 @@ public class UsedCarDataStatsService {
merchantIdList = filterMerchantResponse.stream().map(MerchantProvinceDTO::getMerchantId).collect(Collectors.toList());
}
// 如果角色为销售大区经理和区域运营大区经理需要取交集
if (leaderBoolean) {
if (leaderBoolean && filterBoolean) {
// 商户id交集 merchantIds merchantIdList
merchantIdList = merchantIdList.stream().filter(merchantIds::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIdList)) {
merchantIds = merchantIds.stream().filter(merchantIdList::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIds)) {
return new OperationStatusRes();
}
}
......@@ -101,7 +101,7 @@ public class UsedCarDataStatsService {
queryDataBiz.setBrandIds(null);
queryDataBiz.setDateType(4);
queryDataBiz.setExts(null);
queryDataBiz.setMerchantIds(filterBoolean ? StrUtil.join(",", merchantIdList) : null);
queryDataBiz.setMerchantIds(filterBoolean ? StrUtil.join(",", merchantIds) : null);
queryDataBiz.setStartDate("2000-01-01");
queryDataBiz.setEndDate(DateUtil.format(new Date(), "yyyy-MM-dd"));
// 在库车辆数-A0004 在库成本-A0005 在库超过7天-A0006 在库超过30天-A0007
......@@ -187,16 +187,16 @@ public class UsedCarDataStatsService {
merchantIdList = filterMerchantResponse.stream().map(MerchantProvinceDTO::getMerchantId).collect(Collectors.toList());
}
// 如果角色为销售大区经理和区域运营大区经理需要取交集
if (leaderBoolean) {
if (leaderBoolean && filterBoolean) {
// 商户id交集 merchantIds merchantIdList
merchantIdList = merchantIdList.stream().filter(merchantIds::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIdList)) {
merchantIds = merchantIds.stream().filter(merchantIdList::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIds)) {
return new ReceivingCostDistributionRes();
}
}
// 查询vcp_car_manage_info
List<CarManageInfoDTO> carManageInfoList = carManageInfoMapper.queryPurchasePrice(merchantIdList);
List<CarManageInfoDTO> carManageInfoList = carManageInfoMapper.queryPurchasePrice(merchantIds);
// 如果为空则返回空结果
if (CollUtil.isEmpty(carManageInfoList)) {
return new ReceivingCostDistributionRes();
......@@ -263,10 +263,10 @@ public class UsedCarDataStatsService {
merchantIdList = filterMerchantResponse.stream().map(MerchantProvinceDTO::getMerchantId).collect(Collectors.toList());
}
// 如果角色为销售大区经理和区域运营大区经理需要取交集
if (leaderBoolean) {
if (leaderBoolean && filterBoolean) {
// 商户id交集 merchantIds merchantIdList
merchantIdList = merchantIdList.stream().filter(merchantIds::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIdList)) {
merchantIds = merchantIds.stream().filter(merchantIdList::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIds)) {
return new CycleDataRes();
}
}
......@@ -278,7 +278,7 @@ public class UsedCarDataStatsService {
queryDataBiz.setBrandIds(null);
queryDataBiz.setDateType(4);
queryDataBiz.setExts(null);
queryDataBiz.setMerchantIds(filterBoolean ? StrUtil.join(",", merchantIdList) : null);
queryDataBiz.setMerchantIds(filterBoolean ? StrUtil.join(",", merchantIds) : null);
queryDataBiz.setStartDate(request.getStartTime());
queryDataBiz.setEndDate(request.getEndTime());
// 二手车产值(当期卖车总产值、环比)-A0001 二手车毛利(当期毛利、环比)-A0002
......@@ -434,16 +434,16 @@ public class UsedCarDataStatsService {
merchantIdList = filterMerchantResponse.stream().map(MerchantProvinceDTO::getMerchantId).collect(Collectors.toList());
}
// 如果角色为销售大区经理和区域运营大区经理需要取交集
if (leaderBoolean) {
if (leaderBoolean && filterBoolean) {
// 商户id交集 merchantIds merchantIdList
merchantIdList = merchantIdList.stream().filter(merchantIds::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIdList)) {
merchantIds = merchantIds.stream().filter(merchantIdList::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIds)) {
return new StockStoreAnalysisRes();
}
}
// 查询dj_car_life_service_merchant_bi
List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(5, merchantIdList, request.getStartTime(), request.getEndTime());
List<BiRecord> biRecords = businessIntelligenceMapper.getBiRecords(5, merchantIds, request.getStartTime(), request.getEndTime());
// 如果为空则返回空结果
if (CollUtil.isEmpty(biRecords)) {
return new StockStoreAnalysisRes();
......@@ -452,7 +452,7 @@ public class UsedCarDataStatsService {
// 获取上一个周期的时间返回
Pair<String, String> lastPeriodDates = DateUtils.getLastPeriodDates(request.getStartTime(), request.getEndTime(), request.getCycleType());
// 获取上一个周期的bi数据
List<BiRecord> lastPeriodBiRecords = businessIntelligenceMapper.getBiRecords(5, merchantIdList, lastPeriodDates.getKey(), lastPeriodDates.getValue());
List<BiRecord> lastPeriodBiRecords = businessIntelligenceMapper.getBiRecords(5, merchantIds, lastPeriodDates.getKey(), lastPeriodDates.getValue());
// 总开单门店 计算biRecords不同门店id的数量
Integer totalOpenStoreCount = (int) biRecords.stream().map(BiRecord::getMerchantId).distinct().count();
// 按门店分组
......@@ -480,9 +480,9 @@ public class UsedCarDataStatsService {
// 多品类门店
int multiCategoryStoreCount = countMultiCategoryStores(biRecords);
// 流失门店
int lostStoreCount = businessIntelligenceMapper.countLostMerchant(merchantIdList, request.getStartTime());
int lostStoreCount = businessIntelligenceMapper.countLostMerchant(merchantIds, request.getStartTime());
// 历史门店总数
int totalStoreCount = businessIntelligenceMapper.countHistoryMerchant(merchantIdList, request.getStartTime());
int totalStoreCount = businessIntelligenceMapper.countHistoryMerchant(merchantIds, request.getStartTime());
// 计算环比 ((本周期统计值-上周期统计值)/上周期统计值)*100%,保留百分比两位小数,即xx.xx%
if (CollUtil.isNotEmpty(lastPeriodBiRecords)) {
......@@ -572,7 +572,6 @@ public class UsedCarDataStatsService {
public RegionDistributionRes getRegionDistribution(RegionDistributionReq request) {
Integer brandId = request.getBrandId();
Integer provinceId = null;
// Integer provinceId = request.getProvinceId();
List<Integer> merchantIds = businessAnalysisService.getMerchantIds(request.getRegionId());
boolean leaderBoolean = ObjectUtil.equals(request.getRole(), LoginRoleEnum.AREA_SUPERVISION_LEADER.getValue())
|| ObjectUtil.equals(request.getRole(), LoginRoleEnum.SALE_LEADER.getValue());
......@@ -589,7 +588,6 @@ public class UsedCarDataStatsService {
// 筛选品牌,区域后的商户id
CarBrandProvinceRequestDTO carBrandProvinceRequestDTO = new CarBrandProvinceRequestDTO();
carBrandProvinceRequestDTO.setFirstBrandIdList(ObjectUtil.isNotEmpty(brandId) ? Collections.singletonList(brandId) : null);
carBrandProvinceRequestDTO.setProvinceIds(ObjectUtil.isNotEmpty(provinceId) ? Collections.singletonList(provinceId) : null);
RpcResponse<List<MerchantProvinceDTO>> filterMerchantIdsResponse = merchantRemote.findMerchantListByBrandIdsProvince(carBrandProvinceRequestDTO);
filterMerchantResponse = filterMerchantIdsResponse.getResult();
// 如果为空则返回空结果
......@@ -599,10 +597,10 @@ public class UsedCarDataStatsService {
merchantIdList = filterMerchantResponse.stream().map(MerchantProvinceDTO::getMerchantId).collect(Collectors.toList());
}
// 如果角色为销售大区经理和区域运营大区经理需要取交集
if (leaderBoolean) {
if (leaderBoolean && filterBoolean) {
// 商户id交集 merchantIds merchantIdList
merchantIdList = merchantIdList.stream().filter(merchantIds::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIdList)) {
merchantIds = merchantIds.stream().filter(merchantIdList::contains).collect(Collectors.toList());
if (CollUtil.isEmpty(merchantIds)) {
return new RegionDistributionRes();
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!