Commit d90f97fc by 王璐琦

fix(daily-report): 修正日常报告统计逻辑及导出数据计算错误

- 优化订单中车衣和精品数量统计逻辑,避免重复计数
- 将升级率计算的访问量参数从总访问数改为有效访问数
- 修正售后套餐类目统计,改为直接累加子订单匹配次数
- 修改本月率值计算,使用实际接触客户数替代推荐数
- 调整导出对象中转化率和触达成交率计算,修正参数顺序错误
- 删除多余布尔标志变量,简化代码逻辑和提升统计准确性
1 parent 0ffddba3
...@@ -941,13 +941,17 @@ public class DailyReportDataService { ...@@ -941,13 +941,17 @@ public class DailyReportDataService {
} }
} }
if (orderHasFilm) { monthFilmUpgradeCount++; filmCustomerPhones.add(customerPhone); } if (orderHasFilm) { monthFilmUpgradeCount++; filmCustomerPhones.add(customerPhone); }
boolean orderHasCarCoat = false;
boolean orderHasBoutique = false;
for (GoodsSubOrderDTO subOrder : order.getSubOrderList()) { for (GoodsSubOrderDTO subOrder : order.getSubOrderList()) {
if (subOrder.getStatus() == null if (subOrder.getStatus() == null
|| !Objects.equals(RefundGoodsSubOrderStatusEnum.NOT_REFUNDED.getValue(), subOrder.getStatus())) continue; || !Objects.equals(RefundGoodsSubOrderStatusEnum.NOT_REFUNDED.getValue(), subOrder.getStatus())) continue;
Integer t1 = subOrder.getUpgradeGoodsType(), t2 = subOrder.getUpgradeSecondaryGoodsType(), t3 = subOrder.getUpgradeThirdLevelGoodsType(); Integer t1 = subOrder.getUpgradeGoodsType(), t2 = subOrder.getUpgradeSecondaryGoodsType(), t3 = subOrder.getUpgradeThirdLevelGoodsType();
if (matchesCategory(t1, t2, t3, carCoverId, colorChangeFilmId)) monthCarCoatUpgradeCount++; if (matchesCategory(t1, t2, t3, carCoverId, colorChangeFilmId)) orderHasCarCoat = true;
if (matchesCategory(t1, t2, t3, qualityGoodsId) || qualityGoodsTypeIdSet.contains(t1) || qualityGoodsTypeIdSet.contains(t2) || qualityGoodsTypeIdSet.contains(t3)) monthBoutiqueUpgradeCount++; if (matchesCategory(t1, t2, t3, qualityGoodsId) || qualityGoodsTypeIdSet.contains(t1) || qualityGoodsTypeIdSet.contains(t2) || qualityGoodsTypeIdSet.contains(t3)) orderHasBoutique = true;
} }
if (orderHasCarCoat) monthCarCoatUpgradeCount++;
if (orderHasBoutique) monthBoutiqueUpgradeCount++;
} }
LightChangeDailyReportData.DailyReportSummary summary = new LightChangeDailyReportData.DailyReportSummary(); LightChangeDailyReportData.DailyReportSummary summary = new LightChangeDailyReportData.DailyReportSummary();
...@@ -962,10 +966,10 @@ public class DailyReportDataService { ...@@ -962,10 +966,10 @@ public class DailyReportDataService {
if (monthDelivery > 0 && monthVisit > 0) summary.setMonthDeliveryVisitRate(calcRate(monthVisit, monthDelivery)); if (monthDelivery > 0 && monthVisit > 0) summary.setMonthDeliveryVisitRate(calcRate(monthVisit, monthDelivery));
if (monthVisit > 0 && monthInvalidVisit > 0) summary.setMonthInvalidVisitRate(calcRate(monthInvalidVisit, monthVisit)); if (monthVisit > 0 && monthInvalidVisit > 0) summary.setMonthInvalidVisitRate(calcRate(monthInvalidVisit, monthVisit));
if (monthVisit > 0) { if (monthValidVisit > 0) {
summary.setMonthFilmUpgradeRate(calcRate(monthFilmUpgradeCount, monthVisit)); summary.setMonthFilmUpgradeRate(calcRate(monthFilmUpgradeCount, monthValidVisit));
summary.setMonthCarCoatUpgradeRate(calcRate(monthCarCoatUpgradeCount, monthVisit)); summary.setMonthCarCoatUpgradeRate(calcRate(monthCarCoatUpgradeCount, monthValidVisit));
summary.setMonthBoutiqueUpgradeRate(calcRate(monthBoutiqueUpgradeCount, monthVisit)); summary.setMonthBoutiqueUpgradeRate(calcRate(monthBoutiqueUpgradeCount, monthValidVisit));
} }
if (monthValidVisit > 0 && monthOutput.compareTo(BigDecimal.ZERO) > 0) if (monthValidVisit > 0 && monthOutput.compareTo(BigDecimal.ZERO) > 0)
summary.setMonthAvgOrderPrice(monthOutput.divide(BigDecimal.valueOf(monthValidVisit), 2, RoundingMode.HALF_UP)); summary.setMonthAvgOrderPrice(monthOutput.divide(BigDecimal.valueOf(monthValidVisit), 2, RoundingMode.HALF_UP));
...@@ -2320,15 +2324,11 @@ public class DailyReportDataService { ...@@ -2320,15 +2324,11 @@ public class DailyReportDataService {
} }
} }
if (CollectionUtils.isNotEmpty(o.getSubOrderList())) { if (CollectionUtils.isNotEmpty(o.getSubOrderList())) {
boolean hasCar = false, hasBattery = false, hasAx = false;
for (GoodsSubOrderDTO sub : o.getSubOrderList()) { for (GoodsSubOrderDTO sub : o.getSubOrderList()) {
if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceCar)) hasCar = true; if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceCar)) tWarrantyCar++;
if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceBattery)) hasBattery = true; if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceBattery)) tBattery++;
if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceAxPackageLv2)) hasAx = true; if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceAxPackageLv2)) tAxPackage++;
} }
if (hasCar) tWarrantyCar++;
if (hasBattery) tBattery++;
if (hasAx) tAxPackage++;
} }
} }
...@@ -2349,15 +2349,11 @@ public class DailyReportDataService { ...@@ -2349,15 +2349,11 @@ public class DailyReportDataService {
} }
} }
if (CollectionUtils.isNotEmpty(o.getSubOrderList())) { if (CollectionUtils.isNotEmpty(o.getSubOrderList())) {
boolean hasCar = false, hasBattery = false, hasAx = false;
for (GoodsSubOrderDTO sub : o.getSubOrderList()) { for (GoodsSubOrderDTO sub : o.getSubOrderList()) {
if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceCar)) hasCar = true; if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceCar)) mWarrantyCar++;
if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceBattery)) hasBattery = true; if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceBattery)) mBattery++;
if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceAxPackageLv2)) hasAx = true; if (matchesCategory(sub.getUpgradeGoodsType(), sub.getUpgradeSecondaryGoodsType(), sub.getUpgradeThirdLevelGoodsType(), goodsTypeExtInsuranceAxPackageLv2)) mAxPackage++;
} }
if (hasCar) mWarrantyCar++;
if (hasBattery) mBattery++;
if (hasAx) mAxPackage++;
} }
} }
...@@ -2368,7 +2364,7 @@ public class DailyReportDataService { ...@@ -2368,7 +2364,7 @@ public class DailyReportDataService {
// 本月率值 // 本月率值
String referralRate = formatPercent(buildRate( String referralRate = formatPercent(buildRate(
BigDecimal.valueOf(mDelivery > 0 ? mReferral : 0), BigDecimal.valueOf(mDelivery > 0 ? mTalk : 0),
BigDecimal.valueOf(mDelivery))); BigDecimal.valueOf(mDelivery)));
int totalMonthWarrantyClosed = mWarrantyCar + mBattery + mAxPackage; int totalMonthWarrantyClosed = mWarrantyCar + mBattery + mAxPackage;
String warrantyPenetration = formatPercent(buildRate( String warrantyPenetration = formatPercent(buildRate(
...@@ -2434,16 +2430,12 @@ public class DailyReportDataService { ...@@ -2434,16 +2430,12 @@ public class DailyReportDataService {
// 组装 ExportVO(store-level 跨行合并字段) // 组装 ExportVO(store-level 跨行合并字段)
int totalDelivery = nz(total.getDeliveryCountOfMonth()); int totalDelivery = nz(total.getDeliveryCountOfMonth());
int totalWarrantyClosed = nz(total.getExtendedWarrantyClosedOfMonth()) int totalWarrantyClosed = nz(total.getExtendedWarrantyClosedOfMonth());
+ nz(total.getBatteryWarrantyClosedOfMonth())
+ nz(total.getPeaceOfMindPackageClosedOfMonth());
int totalTalk = nz(total.getPresalesCustomerContactCountOfMonth()); int totalTalk = nz(total.getPresalesCustomerContactCountOfMonth());
ExtendedWarrantyDeliveryStatisticsExportVO export = new ExtendedWarrantyDeliveryStatisticsExportVO(); ExtendedWarrantyDeliveryStatisticsExportVO export = new ExtendedWarrantyDeliveryStatisticsExportVO();
export.setList(result); export.setList(result);
export.setReferralRateTotalOfMonth(formatPercent(buildRate( export.setReferralRateTotalOfMonth(formatPercent(buildRate(BigDecimal.valueOf(totalTalk), BigDecimal.valueOf(totalDelivery))));
BigDecimal.valueOf(nz(total.getValidReferralsOfMonth())), BigDecimal.valueOf(totalDelivery)))); export.setTouchToCloseRateOfMonth(formatPercent(buildRate(BigDecimal.valueOf(totalWarrantyClosed), BigDecimal.valueOf(totalTalk))));
export.setTouchToCloseRateOfMonth(formatPercent(buildRate(
BigDecimal.valueOf(totalWarrantyClosed), BigDecimal.valueOf(totalTalk))));
export.setExtendedWarrantyCountOfMonth(String.valueOf(totalWarrantyClosed)); export.setExtendedWarrantyCountOfMonth(String.valueOf(totalWarrantyClosed));
return Collections.singletonList(export); return Collections.singletonList(export);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!