Browse Source

feature 解决上次读数是空的问题

xiahan 4 months ago
parent
commit
f2c8755945

+ 1 - 2
zhsw-common/src/main/java/com/rongwei/zhsw/system/service/impl/BillGenerationServiceImpl.java

@@ -255,7 +255,7 @@ public class BillGenerationServiceImpl {
      */
     public SwBillManagementUnpaidDo produceBill(SwUserManagementDo swUserManagementDo, SwWaterUsageEntryDo swWaterUsageEntryDo) {
         // 上次抄表数
-        BigDecimal lastreading = swWaterUsageEntryDo.getLastreading();
+        BigDecimal lastreading = swWaterUsageEntryDo.getLastreading()==null?BigDecimal.ZERO:swWaterUsageEntryDo.getLastreading();
         // 本次抄表数
         BigDecimal thisreading = swWaterUsageEntryDo.getThisreading();
 
@@ -297,7 +297,6 @@ public class BillGenerationServiceImpl {
         if (swBillManagementUnpaidDo.getLastmeterreadingdate() == null) {
             monthDiff = 1L;
         } else {
-
             YearMonth localDate1 = YearMonth.from(swBillManagementUnpaidDo.getLastmeterreadingdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
             YearMonth localDate2 = YearMonth.from(swBillManagementUnpaidDo.getThismeterreadingdate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
             // 计算月份差(不考虑天数)