Commit cb6e0f04 by 林永健

refactor(peanalysis): 优化百分比处理及生态系数计算逻辑

- 新增 convertPercentage 方法统一数值转百分比处理
- 调整指标赋值逻辑,统一调用 convertPercentage 函数转换百分比值
- 修正环比计算逻辑,移除无效的空值判断,确保计算准确
- 将部分指标求平均时乘以100,修正统计结果的单位
- 生态系数阈值调整,区间阈值由小数改为整数,提升判断逻辑可读性
- 修正车窗膜、车身膜、精品附件生态系数计算,改为使用产值字段
- 增加车窗膜、车身膜、精品附件生态系数计算调用,保证数据完整性
1 parent 428d8daa
...@@ -192,10 +192,10 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -192,10 +192,10 @@ public class GoodsCategorySummaryResponse implements Serializable {
} }
BigDecimal[] thresholds = { BigDecimal[] thresholds = {
new BigDecimal("0.6"), new BigDecimal("1.2"), // x>=0.6:1.2 new BigDecimal("60"), new BigDecimal("1.2"), // x>=0.6:1.2
new BigDecimal("0.5"), new BigDecimal("1.0"), // 0.5<=x<0.6:1.0 new BigDecimal("50"), new BigDecimal("1.0"), // 0.5<=x<0.6:1.0
new BigDecimal("0.4"), new BigDecimal("0.8"), // 0.4<=x<0.5:0.8 new BigDecimal("40"), new BigDecimal("0.8"), // 0.4<=x<0.5:0.8
new BigDecimal("0.3"), new BigDecimal("0.6") // 0.3<=x<0.4:0.6 new BigDecimal("30"), new BigDecimal("0.6") // 0.3<=x<0.4:0.6
}; };
this.vehicleWarrantyEcoCoefficient = computeEcoCoefficient(this.vehicleWarrantyPenetrationRate, thresholds, BigDecimal.ZERO); this.vehicleWarrantyEcoCoefficient = computeEcoCoefficient(this.vehicleWarrantyPenetrationRate, thresholds, BigDecimal.ZERO);
...@@ -210,10 +210,10 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -210,10 +210,10 @@ public class GoodsCategorySummaryResponse implements Serializable {
} }
BigDecimal[] thresholds = { BigDecimal[] thresholds = {
new BigDecimal("0.2"), new BigDecimal("1.2"), // x>=0.2:1.2 new BigDecimal("20"), new BigDecimal("1.2"), // x>=0.2:1.2
new BigDecimal("0.15"), new BigDecimal("1.0"), // 0.15<=x<0.2:1.0 new BigDecimal("15"), new BigDecimal("1.0"), // 0.15<=x<0.2:1.0
new BigDecimal("0.1"), new BigDecimal("0.8"), // 0.1<=x<0.15:0.8 new BigDecimal("10"), new BigDecimal("0.8"), // 0.1<=x<0.15:0.8
new BigDecimal("0.05"), new BigDecimal("0.6") // 0.05<=x<0.1:0.6 new BigDecimal("5"), new BigDecimal("0.6") // 0.05<=x<0.1:0.6
}; };
this.safetyPackageEcoCoefficient = computeEcoCoefficient(this.safetyPackagePenetrationRate, thresholds, BigDecimal.ZERO); this.safetyPackageEcoCoefficient = computeEcoCoefficient(this.safetyPackagePenetrationRate, thresholds, BigDecimal.ZERO);
...@@ -228,10 +228,10 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -228,10 +228,10 @@ public class GoodsCategorySummaryResponse implements Serializable {
} }
BigDecimal[] thresholds = { BigDecimal[] thresholds = {
new BigDecimal("0.15"), new BigDecimal("1.2"), // x>=0.15:1.2 new BigDecimal("15"), new BigDecimal("1.2"), // x>=0.15:1.2
new BigDecimal("0.11"), new BigDecimal("1.0"), // 0.11<=x<0.15:1.0 new BigDecimal("11"), new BigDecimal("1.0"), // 0.11<=x<0.15:1.0
new BigDecimal("0.08"), new BigDecimal("0.8"), // 0.08<=x<0.11:0.8 new BigDecimal("8"), new BigDecimal("0.8"), // 0.08<=x<0.11:0.8
new BigDecimal("0.05"), new BigDecimal("0.6") // 0.05<=x<0.08:0.6 new BigDecimal("5"), new BigDecimal("0.6") // 0.05<=x<0.08:0.6
}; };
this.batteryWarrantyEcoCoefficient = computeEcoCoefficient(this.batteryWarrantyPenetrationRate, thresholds, BigDecimal.ZERO); this.batteryWarrantyEcoCoefficient = computeEcoCoefficient(this.batteryWarrantyPenetrationRate, thresholds, BigDecimal.ZERO);
...@@ -247,10 +247,10 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -247,10 +247,10 @@ public class GoodsCategorySummaryResponse implements Serializable {
} }
BigDecimal[] thresholds = { BigDecimal[] thresholds = {
new BigDecimal("0.15"), new BigDecimal("1.2"), // x>=0.15:1.2 new BigDecimal("15"), new BigDecimal("1.2"), // x>=0.15:1.2
new BigDecimal("0.11"), new BigDecimal("1.0"), // 0.11<=x<0.15:1.0 new BigDecimal("11"), new BigDecimal("1.0"), // 0.11<=x<0.15:1.0
new BigDecimal("0.08"), new BigDecimal("0.8"), // 0.08<=x<0.11:0.8 new BigDecimal("8"), new BigDecimal("0.8"), // 0.08<=x<0.11:0.8
new BigDecimal("0.05"), new BigDecimal("0.6") // 0.05<=x<0.08:0.6 new BigDecimal("5"), new BigDecimal("0.6") // 0.05<=x<0.08:0.6
}; };
this.tireWarrantyEcoCoefficient = computeEcoCoefficient(this.tireWarrantyPenetrationRate, thresholds, BigDecimal.ZERO); this.tireWarrantyEcoCoefficient = computeEcoCoefficient(this.tireWarrantyPenetrationRate, thresholds, BigDecimal.ZERO);
...@@ -260,7 +260,7 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -260,7 +260,7 @@ public class GoodsCategorySummaryResponse implements Serializable {
* 计算车窗膜-生态系数 * 计算车窗膜-生态系数
*/ */
public void computeWindowFilmEcoCoefficient() { public void computeWindowFilmEcoCoefficient() {
if (this.windowFilmPenetrationRate == null) { if (this.windowFilmPerCarOutput == null) {
return; return;
} }
...@@ -271,14 +271,14 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -271,14 +271,14 @@ public class GoodsCategorySummaryResponse implements Serializable {
new BigDecimal("200"), new BigDecimal("0.6") new BigDecimal("200"), new BigDecimal("0.6")
}; };
this.windowFilmEcoCoefficient = computeEcoCoefficient(this.windowFilmPenetrationRate, thresholds, BigDecimal.ZERO); this.windowFilmEcoCoefficient = computeEcoCoefficient(this.windowFilmPerCarOutput, thresholds, BigDecimal.ZERO);
} }
/** /**
* 计算车身膜-生态系数 * 计算车身膜-生态系数
*/ */
public void computeCarBodyFilmEcoCoefficient() { public void computeCarBodyFilmEcoCoefficient() {
if (this.carBodyFilmPenetrationRate == null) { if (this.carBodyFilmPerCarOutput == null) {
return; return;
} }
...@@ -289,14 +289,14 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -289,14 +289,14 @@ public class GoodsCategorySummaryResponse implements Serializable {
new BigDecimal("400"), new BigDecimal("0.6") new BigDecimal("400"), new BigDecimal("0.6")
}; };
this.carBodyFilmEcoCoefficient = computeEcoCoefficient(this.carBodyFilmPenetrationRate, thresholds, BigDecimal.ZERO); this.carBodyFilmEcoCoefficient = computeEcoCoefficient(this.carBodyFilmPerCarOutput, thresholds, BigDecimal.ZERO);
} }
/** /**
* 计算精品附件-生态系数 * 计算精品附件-生态系数
*/ */
public void computeAccessoriesEcoCoefficient() { public void computeAccessoriesEcoCoefficient() {
if (this.accessoriesPenetrationRate == null) { if (this.accessoriesPerCarOutput == null) {
return; return;
} }
...@@ -307,6 +307,6 @@ public class GoodsCategorySummaryResponse implements Serializable { ...@@ -307,6 +307,6 @@ public class GoodsCategorySummaryResponse implements Serializable {
new BigDecimal("3000"), new BigDecimal("0.6") new BigDecimal("3000"), new BigDecimal("0.6")
}; };
this.accessoriesEcoCoefficient = computeEcoCoefficient(this.accessoriesPenetrationRate, thresholds, BigDecimal.ZERO); this.accessoriesEcoCoefficient = computeEcoCoefficient(this.accessoriesPerCarOutput, thresholds, BigDecimal.ZERO);
} }
} }
\ 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!