Kaynağa Gözat

优化代码

java110 4 yıl önce
ebeveyn
işleme
d576a23f1e

+ 1 - 1
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -2463,7 +2463,7 @@
     </select>
     </select>
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <select id="getReceivedAmountByMonth" parameterType="Map" resultType="Map">
     <select id="getReceivedAmountByMonth" parameterType="Map" resultType="Map">
-        select sum(t.received_amount) total
+        select ifnull(sum(t.received_amount),0) total
         from pay_fee_detail_month t
         from pay_fee_detail_month t
         where
         where
         1=1
         1=1

+ 14 - 2
service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java

@@ -17,7 +17,11 @@ import com.java110.po.reportFeeMonthStatistics.ReportFeeMonthStatisticsPo;
 import com.java110.report.dao.IReportCommunityServiceDao;
 import com.java110.report.dao.IReportCommunityServiceDao;
 import com.java110.report.dao.IReportFeeMonthStatisticsServiceDao;
 import com.java110.report.dao.IReportFeeMonthStatisticsServiceDao;
 import com.java110.report.dao.IReportFeeServiceDao;
 import com.java110.report.dao.IReportFeeServiceDao;
-import com.java110.utils.util.*;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +30,11 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl
  * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl
@@ -778,6 +786,10 @@ public class GeneratorFeeMonthStatisticsInnerServiceSMOImpl implements IGenerato
         double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getDeadlineTime(), tmpReportFeeDto.getEndTime());
         double month = computeFeeSMOImpl.dayCompare(tmpReportFeeDto.getDeadlineTime(), tmpReportFeeDto.getEndTime());
         month = Math.ceil(month);
         month = Math.ceil(month);
 
 
+        if (month == 0) {
+            return tmpReportFeeDto.getFeePrice();
+        }
+
         BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice());
         BigDecimal feePriceDec = new BigDecimal(tmpReportFeeDto.getFeePrice());
         double money = feePriceDec.divide(new BigDecimal(month), 2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
         double money = feePriceDec.divide(new BigDecimal(month), 2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
         return money;
         return money;