From c7e75b55da03f6d13a210f40b7d87d25f3240c16 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 17 十一月 2021 23:54:24 +0800
Subject: [PATCH] 优化代码

---
 service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java b/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
index e348283..81654b6 100755
--- a/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java
@@ -33,7 +33,12 @@
 
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service("getReportFeeMonthStatisticsBMOImpl")
 public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthStatisticsBMO {
@@ -93,9 +98,15 @@
                 double receivableAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivableAmount());
                 //鑾峰彇瀹炴敹閲戦
                 double receivedAmount = Double.parseDouble(reportFeeMonthStatistics.getReceivedAmount());
-                double chargeRate = (receivedAmount / receivableAmount) * 100.0;
-                reportFeeMonthStatistics.setChargeRate(String.format("%.2f", chargeRate) + "%");
+                if (receivableAmount != 0) {
+                    double chargeRate = (receivedAmount / receivableAmount) * 100.0;
+                    reportFeeMonthStatistics.setChargeRate(String.format("%.2f", chargeRate) + "%");
+                } else {
+                    reportFeeMonthStatistics.setChargeRate("0%");
+
+                }
                 reportFeeMonthStatisticsDtos.add(reportFeeMonthStatistics);
+
             }
             ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryMajor(reportFeeMonthStatisticsDto);
             if (reportFeeMonthStatisticsList != null && reportFeeMonthStatisticsList.size() > 0) {

--
Gitblit v1.8.0