Jelajahi Sumber

代码优化

wangb 1 bulan lalu
induk
melakukan
08984e25ba

+ 5 - 2
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/Comprehensive/ComprehensiveelectricityService.java

@@ -442,8 +442,8 @@ public class ComprehensiveelectricityService {
 
                     if (!zbls.isEmpty() && zbls != null) {
                         //综合场用电量取值
-                        zhcydl = zbls.get(0).getZhcydl().doubleValue();
-                        zhcydlsum += zhcydl;
+//                        zhcydl = zbls.get(0).getZhcydl().doubleValue();
+//                        zhcydlsum += zhcydl;
                         //发电量取值
                         if (calFirstMonth == currentMonth && currentyear == dqnf) {
                             //                        sjdl = (zbls.get(0).getYfdldb().doubleValue() / 10000) + (rfdlsj / 10000);
@@ -459,6 +459,9 @@ public class ComprehensiveelectricityService {
                         //购网电量取值
                         gwdl = zbls.get(0).getGwdl().doubleValue();
                         gwdlsum += gwdl;
+                        zhcydl = sjdl - swdl + gwdl ;
+                        zhcydlsum += zhcydl;
+
                         //综合场用电率计算 —— 综合场用电率=(发电量-上网电量+购网电量)/发电量
                         if (sjdl != 0) {
                             zhcydll = (sjdl - swdl + gwdl) / sjdl;

+ 25 - 8
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -184,9 +184,17 @@ public class SpecificService {
      * @return
      */
     private void setDySpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) {
+        LocalDate now = LocalDate.now();
+        int day = now.getDayOfMonth();
+        String[] yearMonth = yearmonth.split("-");
+        LocalDate current = LocalDate.of(Integer.parseInt(yearMonth[0]), Integer.parseInt(yearMonth[1]), day);
         QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
-        qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss");
+        qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) as djss,sum(xdss) as xdss,sum(xnss) as xnss,sum(slss) as slss");
         qw.eq("to_char(record_date,'yyyy-MM')", yearmonth);
+        if (Integer.parseInt(yearMonth[0]) == now.getYear() && Integer.parseInt(yearMonth[1]) == now.getMonthValue()) {
+            qw.lt("record_date", current);
+        }
+
         qw.groupBy("to_char(record_date,'yyyy-MM')");
         List<TurbineInfoDay> monthList = iTurbineInfoDayService.list(qw);
         if (StringUtils.isNotEmpty(monthList)) {
@@ -197,8 +205,8 @@ public class SpecificService {
                 dqvo.setYsjfdl(DoubleUtils.getRoundingNum(monthSpecific.getRfdl() / 1000, 2));
                 dqvo.setYwhssdl(DoubleUtils.getRoundingNum(monthSpecific.getJhjxss() / 1000 + monthSpecific.getFjhjxss() / 1000, 2));
                 dqvo.setYgzssdl(DoubleUtils.getRoundingNum(monthSpecific.getGzss() / 1000, 2));
-                dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getXnss() / 1000, 2));
-                dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getDjss() / 1000, 2));
+                dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getXdss() / 1000, 2));
+                dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getXnss() / 1000, 2));
                 dqvo.setYslssdl(DoubleUtils.getRoundingNum(monthSpecific.getSlss() / 1000, 2));
                 if (dqvo.getYllfdl() != 0) {
                     dqvo.setYfnlyl(DoubleUtils.getRoundingNum(dqvo.getYsjfdl() / dqvo.getYllfdl() * 100, 2));
@@ -305,7 +313,7 @@ public class SpecificService {
         String year = String.valueOf(Integer.parseInt(yearString) - 1);
         String yearMonth = year + "-" + yearmonth.split("-")[1];
         QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
-        qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss");
+        qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) as djss,sum(xnss) as xnss,sum(slss) as slss");
         qw.eq("to_char(record_date,'yyyy-MM')", yearMonth);
         qw.groupBy("to_char(record_date,'yyyy-MM')");
         List<TurbineInfoDay> monthList = iTurbineInfoDayService.list(qw);
@@ -422,9 +430,16 @@ public class SpecificService {
      * @param dqvo
      */
     private void setDnSpecificinfodays(String companys, String type, String yearmonth, SpecificTopVo dqvo) {
+        LocalDate now = LocalDate.now();
+        int day = now.getDayOfMonth();
+        String[] yearMonth = yearmonth.split("-");
+        LocalDate current = LocalDate.of(Integer.parseInt(yearMonth[0]), Integer.parseInt(yearMonth[1]), day);
         QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
-        qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) djss,sum(xnss) as xnss,sum(slss) as slss");
+        qw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) as djss,sum(xdss) as xdss,sum(xnss) as xnss,sum(slss) as slss");
         qw.eq("to_char(record_date,'yyyy')", yearmonth.split("-")[0]);
+        if (Integer.parseInt(yearMonth[0]) == now.getYear() && Integer.parseInt(yearMonth[1]) == now.getMonthValue()) {
+            qw.lt("record_date", current);
+        }
         qw.groupBy("to_char(record_date,'yyyy')");
         List<TurbineInfoDay> yearList = iTurbineInfoDayService.list(qw);
         if (StringUtils.isNotEmpty(yearList)) {
@@ -435,8 +450,8 @@ public class SpecificService {
                 dqvo.setNsjfdl(DoubleUtils.getRoundingNum(yearSpecific.getRfdl() / 1000, 2));
                 dqvo.setNwhssdl(DoubleUtils.getRoundingNum(yearSpecific.getJhjxss() / 1000 + yearSpecific.getFjhjxss() / 1000, 2));
                 dqvo.setNgzssdl(DoubleUtils.getRoundingNum(yearSpecific.getGzss() / 1000, 2));
-                dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getXnss() / 1000, 2));
-                dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getDjss() / 1000, 2));
+                dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getXdss() / 1000, 2));
+                dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getXnss() / 1000, 2));
                 dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getSlss() / 1000, 2));
                 if (dqvo.getYllfdl() != 0) {
                     dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2));
@@ -1844,7 +1859,9 @@ public class SpecificService {
         currentqw.select("station_id,max(record_date) as record_date,sum(rfdl_fj) rfdl_fj");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.like("station_id", "_FDC_");
-        currentqw.lt("record_date", of);
+        if (Integer.parseInt(year) == now.getYear()) {
+            currentqw.lt("record_date", of);
+        }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<StationInfoDay> currentList = iStationInfoDayService.list(currentqw);