Browse Source

首页问题修改

wangb 1 month ago
parent
commit
b76336975a

+ 5 - 3
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/homepage/EconomyPointHomePageService.java

@@ -1943,7 +1943,8 @@ public class EconomyPointHomePageService {
         String s = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
         BigDecimal monCache = yfdlCal.get(s);
         yfdl.setValue(monCache.add(BigDecimal.valueOf(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
-        yfdl.setTotal(yllfdlCal.get(s).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue());
+        double yllfdl = yllfdlCal.get(s).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue();
+        yfdl.setTotal(Double.parseDouble(String.format("%.2f", yllfdl)));
         Double ybfb = calDivide(yfdl.getValue(), yfdl.getTotal());
         yfdl.setBfb(new BigDecimal(ybfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
         ls.add(yfdl);
@@ -1951,7 +1952,8 @@ public class EconomyPointHomePageService {
         GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
         nfdl.setName("年发电量");
         nfdl.setValue(nfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
-        nfdl.setTotal(nllfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue());
+        double nllfdl = nllfdlCal.get(LocalDate.now().getYear()).add(BigDecimal.valueOf(rfdl.getTotal())).doubleValue();
+        nfdl.setTotal(Double.parseDouble(String.format("%.2f", nllfdl)));
         Double nbfb = calDivide(nfdl.getValue(), nfdl.getTotal());
         nfdl.setBfb(new BigDecimal(nbfb * 100).setScale(2, RoundingMode.HALF_UP).doubleValue());
         ls.add(nfdl);
@@ -2027,7 +2029,7 @@ public class EconomyPointHomePageService {
      * 缓存月、年发电量
      */
     public void calFdl() {
-        if (null != lastCalDate || LocalDate.now().equals(lastCalDate)) {
+        if (LocalDate.now().equals(lastCalDate)) {
             return;
         }
         LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();