Commit 9c4dd0bc by 杨卫

feat(report): 新增延保商品品类配置常量类并重构数据服务

- 新增 ExtendedWarrantyCategoryConstants 常量类,支持整车、电池、安心包、轮胎四类延保商品品类配置
- 重构 DailyReportDataService 中的延保品类ID获取逻辑,统一使用常量类进行配置管理
- 移除 DataResp 模型依赖,优化代码结构
- 添加品类ID数组解析功能,支持多品类ID配置和默认值回退机制
- 优化品类ID解析方法,增加异常处理和日志记录
- 添加 matchesCategory 方法注释说明,明确品类匹配规则
1 parent 3d21e49b
package cn.com.glsx.dj.daily.report.constant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.oreframework.boot.env.OrePropertyConfigurer;
import java.util.ArrayList;
import java.util.List;
/**
* 延保日报商品品类配置常量
*
* @author yangwei_by_claude
* @version 1.0
* @since 2026/09/18 10:00
*/
@Slf4j
public final class ExtendedWarrantyCategoryConstants {
/** 配置项分隔符 */
private static final String CATEGORY_ID_SEPARATOR = ",";
/** 整车延保品类 ID 集合配置 key */
public static final String KEY_CAR_IDS = "smartcarlife.goodsType.extendedInsurance.car.ids";
/** 电池延保品类 ID 集合配置 key */
public static final String KEY_BATTERY_IDS = "smartcarlife.goodsType.extendedInsurance.battery.ids";
/** 安心包品类 ID 集合配置 key */
public static final String KEY_AX_PACKAGE_IDS = "smartcarlife.goodsType.extendedInsurance.ax.package.ids";
/** 轮胎品类 ID 集合配置 key */
public static final String KEY_TIRE_IDS = "smartcarlife.goodsType.extendedInsurance.tire.ids";
/** 整车延保品类 ID 默认值 */
public static final String DEFAULT_CAR_IDS = "178,266,271,323";
/** 电池延保品类 ID 默认值 */
public static final String DEFAULT_BATTERY_IDS = "187,341,344,316";
/** 安心包品类 ID 默认值 */
public static final String DEFAULT_AX_PACKAGE_IDS = "180,287,288,289,290,291,292,293";
/** 轮胎品类 ID 默认值 */
public static final String DEFAULT_TIRE_IDS = "184,294,296,298,300";
private ExtendedWarrantyCategoryConstants() {
}
/**
* 读取并解析延保品类 ID 集合配置。
*
* @param key 配置项 key
* @param defaultIds 默认品类 ID 集合
* @return 延保品类 ID 数组
*/
public static Integer[] getCategoryIds(String key, String defaultIds) {
String configuredIds = OrePropertyConfigurer.getString(key, defaultIds);
Integer[] categoryIds = parseCategoryIds(configuredIds, key);
if (categoryIds.length > 0) {
return categoryIds;
}
log.warn("延保品类配置为空或无有效 ID,使用内置默认值,key:{}, defaultIds:{}", key, defaultIds);
return parseCategoryIds(defaultIds, key + ".default");
}
/**
* 解析逗号分隔的品类 ID 字符串,单个非法 ID 不影响其他有效 ID。
*
* @param categoryIds 品类 ID 字符串
* @param configKey 日志使用的配置项 key
* @return 品类 ID 数组
*/
private static Integer[] parseCategoryIds(String categoryIds, String configKey) {
if (StringUtils.isBlank(categoryIds)) {
return new Integer[0];
}
List<Integer> result = new ArrayList<>();
String[] idArray = categoryIds.split(CATEGORY_ID_SEPARATOR);
for (String id : idArray) {
String trimmedId = StringUtils.trim(id);
if (StringUtils.isBlank(trimmedId)) {
continue;
}
try {
result.add(Integer.valueOf(trimmedId));
} catch (NumberFormatException e) {
log.warn("延保品类配置包含非法 ID,已跳过,key:{}, value:{}", configKey, trimmedId);
}
}
return result.toArray(new Integer[result.size()]);
}
}
package cn.com.glsx.dj.daily.report.service; package cn.com.glsx.dj.daily.report.service;
import cn.com.glsx.dj.daily.report.dto.DataBizQueryParamsDTO; import cn.com.glsx.dj.daily.report.constant.ExtendedWarrantyCategoryConstants;
import cn.com.glsx.dj.daily.report.dto.DataBusinessDTO; import cn.com.glsx.dj.daily.report.dto.*;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyDailyReportData;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyDeliveryStatisticsExportVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyAfterSaleReferralStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyDeliveryStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyLanTuAfterSaleReferralStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyLanTuDeliveryStatisticsExportVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyLanTuDeliveryStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyLanTuNegotiationDetailVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyNegotiationDetailVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyOtherDeliveryStatisticsExportVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyOtherDeliveryStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyOtherNegotiationDetailVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeDailyReportData;
import cn.com.glsx.dj.daily.report.dto.LightChangeAfterSaleStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeDeliveryStatisticsVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeOtherBrandAfterSaleExportVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeOtherBrandAfterSaleRowVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeNegotiationVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeOtherBrandSalesExportVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeOtherBrandSalesRowVO;
import cn.com.glsx.dj.daily.report.dto.LightChangeSalesStatisticsVO;
import cn.com.glsx.dj.daily.report.enums.DailyReportFieldEnum; import cn.com.glsx.dj.daily.report.enums.DailyReportFieldEnum;
import cn.com.glsx.dj.daily.report.enums.DailyReportTemplateTypeEnum; import cn.com.glsx.dj.daily.report.enums.DailyReportTemplateTypeEnum;
import cn.com.glsx.dj.daily.report.mapper.DailyReportFieldDataMapper; import cn.com.glsx.dj.daily.report.mapper.DailyReportFieldDataMapper;
...@@ -31,7 +10,6 @@ import cn.com.glsx.dj.daily.report.mapper.DailyReportSubformDataMapper; ...@@ -31,7 +10,6 @@ import cn.com.glsx.dj.daily.report.mapper.DailyReportSubformDataMapper;
import cn.com.glsx.dj.daily.report.model.DailyReportFieldData; import cn.com.glsx.dj.daily.report.model.DailyReportFieldData;
import cn.com.glsx.dj.daily.report.model.DailyReportRecord; import cn.com.glsx.dj.daily.report.model.DailyReportRecord;
import cn.com.glsx.dj.daily.report.model.DailyReportSubformData; import cn.com.glsx.dj.daily.report.model.DailyReportSubformData;
import cn.com.glsx.dj.daily.report.model.DataResp;
import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO; import cn.com.glsx.dj.smartcarlife.dto.GoodsOrderDTO;
import cn.com.glsx.dj.smartcarlife.dto.GoodsSubOrderDTO; import cn.com.glsx.dj.smartcarlife.dto.GoodsSubOrderDTO;
import cn.com.glsx.dj.smartcarlife.dto.LifeMerchantCouponDTO; import cn.com.glsx.dj.smartcarlife.dto.LifeMerchantCouponDTO;
...@@ -997,13 +975,21 @@ public class DailyReportDataService { ...@@ -997,13 +975,21 @@ public class DailyReportDataService {
//问界 //问界
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
//整车延保 //整车延保
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
//电池延保 //电池延保
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
//延保类-安心包 二级品类 //延保类-安心包 二级品类
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
//轮胎 //轮胎
Integer goodsTypeExtInsuranceTire = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.tire", Integer.class, 184); Integer[] goodsTypeExtInsuranceTire = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_TIRE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_TIRE_IDS);
// 查询今日订单:问界品牌,单问界(hmzxBrandFlag=3) // 查询今日订单:问界品牌,单问界(hmzxBrandFlag=3)
String todayStart = reportDate + " 00:00:00"; String todayStart = reportDate + " 00:00:00";
...@@ -1175,13 +1161,21 @@ public class DailyReportDataService { ...@@ -1175,13 +1161,21 @@ public class DailyReportDataService {
//问界 //问界
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
//整车延保 //整车延保
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
//电池延保 //电池延保
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
//延保类-安心包 二级品类 //延保类-安心包 二级品类
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
//轮胎 //轮胎
Integer goodsTypeExtInsuranceTire = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.tire", Integer.class, 184); Integer[] goodsTypeExtInsuranceTire = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_TIRE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_TIRE_IDS);
// 查询本月订单:问界品牌,单问界(hmzxBrandFlag=3) // 查询本月订单:问界品牌,单问界(hmzxBrandFlag=3)
String monthStart = startDate + " 00:00:00"; String monthStart = startDate + " 00:00:00";
...@@ -1415,10 +1409,18 @@ public class DailyReportDataService { ...@@ -1415,10 +1409,18 @@ public class DailyReportDataService {
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
Integer expectedDeliveryCount = getFieldIntValue(recordId, DailyReportFieldEnum.F2_103.getValue(), fieldDataMap); Integer expectedDeliveryCount = getFieldIntValue(recordId, DailyReportFieldEnum.F2_103.getValue(), fieldDataMap);
// 延保品类 // 延保品类
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
Integer goodsTypeExtInsuranceTire = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.tire", Integer.class, 184); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
Integer[] goodsTypeExtInsuranceTire = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_TIRE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_TIRE_IDS);
// 焕新品类(权益服务-广联权益) // 焕新品类(权益服务-广联权益)
Integer goodsTypeRenewalGl = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.equity.type",Integer.class,126); Integer goodsTypeRenewalGl = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.equity.type",Integer.class,126);
...@@ -1555,10 +1557,18 @@ public class DailyReportDataService { ...@@ -1555,10 +1557,18 @@ public class DailyReportDataService {
//鸿蒙智行 //鸿蒙智行
Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids",Integer.class,2365); Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids",Integer.class,2365);
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
Integer goodsTypeExtInsuranceTire = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.tire", Integer.class, 184); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
Integer[] goodsTypeExtInsuranceTire = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_TIRE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_TIRE_IDS);
// 焕新品类(权益服务-广联权益) // 焕新品类(权益服务-广联权益)
Integer goodsTypeRenewalGl = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.equity.type",Integer.class,126); Integer goodsTypeRenewalGl = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.equity.type",Integer.class,126);
...@@ -1698,9 +1708,15 @@ public class DailyReportDataService { ...@@ -1698,9 +1708,15 @@ public class DailyReportDataService {
//鸿蒙智行 //鸿蒙智行
Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids", Integer.class, 2365); Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids", Integer.class, 2365);
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
String todayStart = endDate + " 00:00:00"; String todayStart = endDate + " 00:00:00";
String todayEnd = endDate + " 23:59:59"; String todayEnd = endDate + " 23:59:59";
...@@ -2193,11 +2209,17 @@ public class DailyReportDataService { ...@@ -2193,11 +2209,17 @@ public class DailyReportDataService {
Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids",Integer.class,2365); Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids",Integer.class,2365);
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
//整车延保 //整车延保
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
//电池延保 //电池延保
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
//安心包 //安心包
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
String todayStart = endDate + " 00:00:00"; String todayStart = endDate + " 00:00:00";
String todayEnd = endDate + " 23:59:59"; String todayEnd = endDate + " 23:59:59";
...@@ -2875,10 +2897,18 @@ public class DailyReportDataService { ...@@ -2875,10 +2897,18 @@ public class DailyReportDataService {
log.info("buildExtendedWarrantyHmNegotiationDetailRows start, merchantId:{}", merchantId); log.info("buildExtendedWarrantyHmNegotiationDetailRows start, merchantId:{}", merchantId);
Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids", Integer.class, 2365); Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids", Integer.class, 2365);
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
Integer goodsTypeExtInsuranceTire = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.tire", Integer.class, 184); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
Integer[] goodsTypeExtInsuranceTire = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_TIRE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_TIRE_IDS);
String todayStart = reportDate + " 00:00:00"; String todayStart = reportDate + " 00:00:00";
String todayEnd = reportDate + " 23:59:59"; String todayEnd = reportDate + " 23:59:59";
...@@ -3149,10 +3179,18 @@ public class DailyReportDataService { ...@@ -3149,10 +3179,18 @@ public class DailyReportDataService {
Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids",Integer.class,2365); Integer hmzxBrandId = OrePropertyConfigurer.getProperty("quotation.merchant.main.brand.ids",Integer.class,2365);
Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695); Integer aitoId = OrePropertyConfigurer.getProperty("huawei.wenjie.brand.id", Integer.class, 2695);
// 商品品类配置 // 商品品类配置
Integer goodsTypeExtInsuranceCar = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.car", Integer.class, 178); Integer[] goodsTypeExtInsuranceCar = ExtendedWarrantyCategoryConstants.getCategoryIds(
Integer goodsTypeExtInsuranceBattery = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.battery", Integer.class, 187); ExtendedWarrantyCategoryConstants.KEY_CAR_IDS,
Integer goodsTypeExtInsuranceAxPackageLv2 = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.ax.package", Integer.class, 180); ExtendedWarrantyCategoryConstants.DEFAULT_CAR_IDS);
Integer goodsTypeExtInsuranceTire = OrePropertyConfigurer.getProperty("smartcarlife.goodsType.extendedInsurance.tire", Integer.class, 184); Integer[] goodsTypeExtInsuranceBattery = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_BATTERY_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_BATTERY_IDS);
Integer[] goodsTypeExtInsuranceAxPackageLv2 = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_AX_PACKAGE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_AX_PACKAGE_IDS);
Integer[] goodsTypeExtInsuranceTire = ExtendedWarrantyCategoryConstants.getCategoryIds(
ExtendedWarrantyCategoryConstants.KEY_TIRE_IDS,
ExtendedWarrantyCategoryConstants.DEFAULT_TIRE_IDS);
// 查询当日订单 // 查询当日订单
String todayStart = reportDate + " 00:00:00"; String todayStart = reportDate + " 00:00:00";
...@@ -7170,6 +7208,7 @@ public class DailyReportDataService { ...@@ -7170,6 +7208,7 @@ public class DailyReportDataService {
return sum; return sum;
} }
private BigDecimal buildRate(BigDecimal numerator, BigDecimal denominator) { private BigDecimal buildRate(BigDecimal numerator, BigDecimal denominator) {
if (numerator == null || denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) { if (numerator == null || denominator == null || denominator.compareTo(BigDecimal.ZERO) <= 0) {
return BigDecimal.ZERO; return BigDecimal.ZERO;
...@@ -7235,9 +7274,7 @@ public class DailyReportDataService { ...@@ -7235,9 +7274,7 @@ public class DailyReportDataService {
return nullToZero(first) + nullToZero(second); return nullToZero(first) + nullToZero(second);
} }
/**
* 判断三级分类ID是否命中目标品类ID(任一匹配即命中)
*/
/** /**
* 计算百分比 = numerator / denominator * 100%,保留两位小数 * 计算百分比 = numerator / denominator * 100%,保留两位小数
*/ */
...@@ -7250,6 +7287,17 @@ public class DailyReportDataService { ...@@ -7250,6 +7287,17 @@ public class DailyReportDataService {
.multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP); .multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP);
} }
/**
* 判断订单子品类是否命中目标品类 ID。
* 一级、二级、三级品类任一层级命中目标数组任一 ID 即算命中;单个 Integer
* 与解析后的 Integer[] 均通过现有可变参数签名使用同一套规则。
*
* @param type1 一级品类 ID
* @param type2 二级品类 ID
* @param type3 三级品类 ID
* @param targetIds 目标品类 ID 数组
* @return 是否命中目标品类
*/
private boolean matchesCategory(Integer type1, Integer type2, Integer type3, Integer... targetIds) { private boolean matchesCategory(Integer type1, Integer type2, Integer type3, Integer... targetIds) {
for (Integer targetId : targetIds) { for (Integer targetId : targetIds) {
if (Objects.equals(type1, targetId) || Objects.equals(type2, targetId) || Objects.equals(type3, targetId)) { if (Objects.equals(type1, targetId) || Objects.equals(type2, targetId) || Objects.equals(type3, targetId)) {
......
package cn.com.glsx.dj.daily.report.service; package cn.com.glsx.dj.daily.report.service;
import cn.com.glsx.dj.daily.report.dto.DailyReportRecordDTO;
import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyDailyReportData; import cn.com.glsx.dj.daily.report.dto.ExtendedWarrantyDailyReportData;
import cn.com.glsx.dj.daily.report.dto.LightChangeDailyReportData; import cn.com.glsx.dj.daily.report.dto.LightChangeDailyReportData;
import cn.com.glsx.dj.daily.report.model.DailyReportRecord; import cn.com.glsx.dj.daily.report.model.DailyReportRecord;
import cn.com.glsx.dj.daily.report.util.EasyExcelUtil; import cn.com.glsx.dj.daily.report.util.EasyExcelUtil;
import cn.com.glsx.dj.daily.report.util.ExcelUtils; import cn.com.glsx.dj.daily.report.util.ExcelUtils;
import cn.com.glsx.dj.smartcarlife.dto.CouponDayReportDTO;
import cn.com.glsx.dj.smartcarlife.dto.MerchantActionReportConfigDTO; import cn.com.glsx.dj.smartcarlife.dto.MerchantActionReportConfigDTO;
import cn.com.glsx.dj.smartcarlife.dto.worktoolpush.RecordGroupRequestDTO; import cn.com.glsx.dj.smartcarlife.dto.worktoolpush.RecordGroupRequestDTO;
import cn.com.glsx.dj.smartcarlife.enums.ActionReportTypeEnum; import cn.com.glsx.dj.smartcarlife.enums.ActionReportTypeEnum;
...@@ -14,14 +12,8 @@ import cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum; ...@@ -14,14 +12,8 @@ import cn.com.glsx.dj.smartcarlife.enums.SceneTypeEnum;
import cn.com.glsx.dj.smartcarlife.model.MerchantActionReportGroupConfig; import cn.com.glsx.dj.smartcarlife.model.MerchantActionReportGroupConfig;
import cn.com.glsx.dj.smartcarlife.remote.MerchantActionReportConfigRemote; import cn.com.glsx.dj.smartcarlife.remote.MerchantActionReportConfigRemote;
import cn.com.glsx.dj.smartcarlife.remote.ReportPushRecordRemote; import cn.com.glsx.dj.smartcarlife.remote.ReportPushRecordRemote;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse; import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.com.glsx.framework.core.enums.DefaultErrorEnum;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.core.util.RpcAssert;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -33,11 +25,7 @@ import java.math.BigDecimal; ...@@ -33,11 +25,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.HashMap; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
......
...@@ -11,4 +11,4 @@ ore.starter.class-name=Main ...@@ -11,4 +11,4 @@ ore.starter.class-name=Main
# diamond config # diamond config
ore.diamond.group=dijia ore.diamond.group=dijia
ore.diamond.dataId=rpc-dj-daily-report ore.diamond.dataId=rpc-dj-daily-report
ore.diamond.env=release ore.diamond.env=yangwei
package cn.com.glsx.dj.daily.report.service;
import cn.com.glsx.dj.daily.report.util.BaseServiceTest;
import org.junit.jupiter.api.Test;
import javax.annotation.Resource;
/**
* @author yangwei
* @version 1.0
* @since 2026/09/20 10:45
*/
public class DailyReportPushServiceTest extends BaseServiceTest {
@Resource
private DailyReportPushService dailyReportPushService;
@Test
public void pushDailyReport() {
dailyReportPushService.pushDailyReport(44211227, (byte) 0);
}
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!