wangmiaomiao 10 miesięcy temu
rodzic
commit
7b067d6af5

+ 1 - 1
slibra-system/src/main/java/com/slibra/business/mapper/TXinyiDailyMapper.java

@@ -64,5 +64,5 @@ public interface TXinyiDailyMapper
      */
     public int deleteTXinyiDailyByIDs(Long[] IDs);
 
-    HashMap selectAvgWater(@Param("begin") String begin, @Param("end") String end);
+    HashMap<String, BigDecimal> selectAvgWater(@Param("begin") String begin, @Param("end") String end);
 }

+ 21 - 17
slibra-system/src/main/java/com/slibra/business/service/impl/FrontServiceImpl.java

@@ -80,23 +80,27 @@ public class FrontServiceImpl implements IFrontService {
         String begin = formatterDate.format(nowTime.plusDays(-7));
         String end = formatterDate.format(nowTime.plusDays(-1));
         HashMap<String, BigDecimal> lastWeek = this.xinyiDailyMapper.selectAvgWater(begin, end);
-        BigDecimal lastJSL = lastWeek.get("JSL");
-        BigDecimal lastCSL = lastWeek.get("CSL");
-        //获取上上周的统计进出水品均值
-        begin = formatterDate.format(nowTime.plusDays(-14));
-        end = formatterDate.format(nowTime.plusDays(-8));
-        HashMap<String, BigDecimal> beforeLastWeek = this.xinyiDailyMapper.selectAvgWater(begin, end);
-        BigDecimal beforeLastJSL = beforeLastWeek.get("JSL");
-        BigDecimal beforeLastCSL = beforeLastWeek.get("CSL");
-        if(!Objects.isNull(lastJSL)){
-            xinyiIndustrySimple.setSzZJSAvg(lastJSL);
-            if(!Objects.isNull(beforeLastJSL))
-                xinyiIndustrySimple.setSzZJSHb((lastJSL.subtract(beforeLastJSL)).divide(beforeLastJSL, 4, RoundingMode.HALF_UP));
-        }
-        if(!Objects.isNull(lastCSL)){
-            xinyiIndustrySimple.setSzZCSAvg(lastCSL);
-            if(!Objects.isNull(beforeLastCSL))
-                xinyiIndustrySimple.setSzZCSHb((lastCSL.subtract(beforeLastCSL)).divide(beforeLastCSL, 4, RoundingMode.HALF_UP));
+        if(!Objects.isNull(lastWeek)){
+            BigDecimal lastJSL = lastWeek.get("JSL");
+            BigDecimal lastCSL = lastWeek.get("CSL");
+            //获取上上周的统计进出水品均值
+            begin = formatterDate.format(nowTime.plusDays(-14));
+            end = formatterDate.format(nowTime.plusDays(-8));
+            HashMap<String, BigDecimal> beforeLastWeek = this.xinyiDailyMapper.selectAvgWater(begin, end);
+            if(!Objects.isNull(beforeLastWeek)){
+                BigDecimal beforeLastJSL = beforeLastWeek.get("JSL");
+                BigDecimal beforeLastCSL = beforeLastWeek.get("CSL");
+                if(!Objects.isNull(lastJSL)){
+                    xinyiIndustrySimple.setSzZJSAvg(lastJSL);
+                    if(!Objects.isNull(beforeLastJSL))
+                        xinyiIndustrySimple.setSzZJSHb((lastJSL.subtract(beforeLastJSL)).divide(beforeLastJSL, 4, RoundingMode.HALF_UP));
+                }
+                if(!Objects.isNull(lastCSL)){
+                    xinyiIndustrySimple.setSzZCSAvg(lastCSL);
+                    if(!Objects.isNull(beforeLastCSL))
+                        xinyiIndustrySimple.setSzZCSHb((lastCSL.subtract(beforeLastCSL)).divide(beforeLastCSL, 4, RoundingMode.HALF_UP));
+                }
+            }
         }