|
@@ -53,7 +53,7 @@ public class EnergyBudgetFactory {
|
|
|
Double currentMonth = energyUsageFactory.getMonthlyUsageValue(energyUsageDefine, reportMonth, projectId);
|
|
|
String currentMonthStr = currentMonth == null ? null : String.valueOf(currentMonth);
|
|
|
return new AttrValueVO(BudgetContentCodes.currentMonth.name(),
|
|
|
- currentMonthStr, AttrValueTypeEnum.number_1);
|
|
|
+ currentMonthStr, AttrValueTypeEnum.number_1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -175,7 +175,7 @@ public class EnergyBudgetFactory {
|
|
|
* @version V1.0 2021/7/27 2:38 下午
|
|
|
*/
|
|
|
private Double getProportion(Double usage, Double budget) {
|
|
|
- if (usage != null && budget != null) {
|
|
|
+ if (usage != null && budget != null && budget != 0d) {
|
|
|
return DataUtils.doubleDivide(usage, budget);
|
|
|
}
|
|
|
return null;
|
|
@@ -192,7 +192,7 @@ public class EnergyBudgetFactory {
|
|
|
*/
|
|
|
public AttrValueVO getMonthlyProportion(Double currentMonth, Double monthlyBudget) {
|
|
|
Double proportion = getProportion(currentMonth, monthlyBudget);
|
|
|
- String proportionStr = proportion == null? null:String.valueOf(proportion);
|
|
|
+ String proportionStr = proportion == null ? null : String.valueOf(proportion);
|
|
|
return new AttrValueVO(BudgetContentCodes.monthlyProportion.name(),
|
|
|
proportionStr, AttrValueTypeEnum.percent_1, DataConstants.PERCENT);
|
|
|
}
|
|
@@ -208,7 +208,7 @@ public class EnergyBudgetFactory {
|
|
|
*/
|
|
|
public AttrValueVO getAnnualProportion(Double aggregate, Double annualBudget) {
|
|
|
Double proportion = getProportion(aggregate, annualBudget);
|
|
|
- String proportionStr = proportion == null? null:String.valueOf(proportion);
|
|
|
+ String proportionStr = proportion == null ? null : String.valueOf(proportion);
|
|
|
return new AttrValueVO(BudgetContentCodes.annualProportion.name(),
|
|
|
proportionStr, AttrValueTypeEnum.percent_1, DataConstants.PERCENT);
|
|
|
}
|