瀏覽代碼

bug修复

wangb 2 月之前
父節點
當前提交
6f93d5deab
共有 1 個文件被更改,包括 28 次插入18 次删除
  1. 28 18
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

+ 28 - 18
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -192,7 +192,7 @@ public class SpecificService {
         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) as djss,sum(xdss) as xdss,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,avg(fnlyl) as fnlyl");
         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);
@@ -211,13 +211,13 @@ public class SpecificService {
                 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));
-                    dqvo.setYwhssl(DoubleUtils.getRoundingNum(dqvo.getYwhssdl() / dqvo.getYllfdl() * 100, 2));
-                    dqvo.setYgzssl(DoubleUtils.getRoundingNum(dqvo.getYgzssdl() / dqvo.getYllfdl() * 100, 2));
-                    dqvo.setYxdssl(DoubleUtils.getRoundingNum(dqvo.getYxdssdl() / dqvo.getYllfdl() * 100, 2));
-                    dqvo.setYxnssl(DoubleUtils.getRoundingNum(dqvo.getYxnssdl() / dqvo.getYllfdl() * 100, 2));
-                    dqvo.setYslssl(DoubleUtils.getRoundingNum(dqvo.getYslssdl() / dqvo.getYllfdl() * 100, 2));
+                dqvo.setYfnlyl(NumberUtil.round(monthSpecific.getFnlyl(), 2).doubleValue());
+                if (monthSpecific.getLlfdl() != 0) {
+                    dqvo.setYwhssl(DoubleUtils.getRoundingNum((monthSpecific.getJhjxss() / 1000 + monthSpecific.getFjhjxss() / 1000) / monthSpecific.getLlfdl() * 100, 2));
+                    dqvo.setYgzssl(DoubleUtils.getRoundingNum(monthSpecific.getGzss() / monthSpecific.getLlfdl() * 100, 2));
+                    dqvo.setYxdssl(DoubleUtils.getRoundingNum(monthSpecific.getXdss() / monthSpecific.getLlfdl() * 100, 2));
+                    dqvo.setYxnssl(DoubleUtils.getRoundingNum(monthSpecific.getXnss() / monthSpecific.getLlfdl() * 100, 2));
+                    dqvo.setYslssl(DoubleUtils.getRoundingNum(monthSpecific.getSlss() / monthSpecific.getLlfdl() * 100, 2));
                 } else {
                     dqvo.setYfnlyl(0.0);
                     dqvo.setYwhssl(0.0);
@@ -316,7 +316,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) as 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,avg(fnlyl) as fnlyl");
         qw.eq("to_char(record_date,'yyyy-MM')", yearMonth);
         qw.groupBy("to_char(record_date,'yyyy-MM')");
         List<TurbineInfoDay> monthList = iTurbineInfoDayService.list(qw);
@@ -330,8 +330,8 @@ public class SpecificService {
             dqvo.setYxdssdl(DoubleUtils.getRoundingNum(monthSpecific.getXnss() / 1000, 2));
             dqvo.setYxnssdl(DoubleUtils.getRoundingNum(monthSpecific.getDjss() / 1000, 2));
             dqvo.setYslssdl(DoubleUtils.getRoundingNum(monthSpecific.getSlss() / 1000, 2));
+            dqvo.setYfnlyl(NumberUtil.round(monthSpecific.getFnlyl(), 2).doubleValue());
             if (dqvo.getYllfdl() != 0) {
-                dqvo.setYfnlyl(DoubleUtils.getRoundingNum(dqvo.getYsjfdl() / dqvo.getYllfdl() * 100, 2));
                 dqvo.setYwhssl(DoubleUtils.getRoundingNum(dqvo.getYwhssdl() / dqvo.getYllfdl() * 100, 2));
                 dqvo.setYgzssl(DoubleUtils.getRoundingNum(dqvo.getYgzssdl() / dqvo.getYllfdl() * 100, 2));
                 dqvo.setYxdssl(DoubleUtils.getRoundingNum(dqvo.getYxdssdl() / dqvo.getYllfdl() * 100, 2));
@@ -438,7 +438,7 @@ public class SpecificService {
         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) as djss,sum(xdss) as xdss,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,avg(fnlyl) as fnlyl");
         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);
@@ -456,8 +456,8 @@ public class SpecificService {
                 dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getXdss() / 1000, 2));
                 dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getXnss() / 1000, 2));
                 dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getSlss() / 1000, 2));
+                dqvo.setNfnlyl(NumberUtil.round(yearSpecific.getFnlyl(), 2).doubleValue());
                 if (dqvo.getYllfdl() != 0) {
-                    dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2));
                     dqvo.setNwhssl(DoubleUtils.getRoundingNum(dqvo.getNwhssdl() / dqvo.getNllfdl() * 100, 2));
                     dqvo.setNgzssl(DoubleUtils.getRoundingNum(dqvo.getNgzssdl() / dqvo.getNllfdl() * 100, 2));
                     dqvo.setNxdssl(DoubleUtils.getRoundingNum(dqvo.getNxdssdl() / dqvo.getNllfdl() * 100, 2));
@@ -561,7 +561,7 @@ public class SpecificService {
         String yearString = yearmonth.split("-")[0];
         LocalDate firstDayOfYear = LocalDate.of(Integer.parseInt(yearString) - 1, 1, 1);
         QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
-        qw.select("COALESCE(sum(llfdl), 0) as llfdl,COALESCE(sum(rfdl), 0) as rfdl,COALESCE(sum(gzss), 0) as gzss,COALESCE(sum(jhjxss), 0) as jhjxss,COALESCE(sum(fjhjxss), 0) as fjhjxss,COALESCE(sum(djss), 0) as djss,COALESCE(sum(xnss), 0) as xnss,COALESCE(sum(slss), 0) as slss");
+        qw.select("COALESCE(sum(llfdl), 0) as llfdl,COALESCE(sum(rfdl), 0) as rfdl,COALESCE(sum(gzss), 0) as gzss,COALESCE(sum(jhjxss), 0) as jhjxss,COALESCE(sum(fjhjxss), 0) as fjhjxss,COALESCE(sum(djss), 0) as djss,COALESCE(sum(xnss), 0) as xnss,COALESCE(sum(slss), 0) as slss,COALESCE(avg(fnlyl), 0) as fnlyl");
         qw.between("record_date", Date.from(firstDayOfYear.atStartOfDay(ZoneId.systemDefault()).toInstant()), Date.from(now.minusYears(1).atStartOfDay(ZoneId.systemDefault()).toInstant()));
         List<TurbineInfoDay> yearList = iTurbineInfoDayService.list(qw);
         Optional<TurbineInfoDay> yearFirsts = yearList.stream().findFirst();
@@ -574,8 +574,8 @@ public class SpecificService {
             dqvo.setNxdssdl(DoubleUtils.getRoundingNum(yearSpecific.getXnss() / 1000, 2));
             dqvo.setNxnssdl(DoubleUtils.getRoundingNum(yearSpecific.getDjss() / 1000, 2));
             dqvo.setNslssdl(DoubleUtils.getRoundingNum(yearSpecific.getSlss() / 1000, 2));
+            dqvo.setNfnlyl(NumberUtil.round(yearSpecific.getFnlyl(), 2).doubleValue());
             if (dqvo.getYllfdl() != 0) {
-                dqvo.setNfnlyl(DoubleUtils.getRoundingNum(dqvo.getNsjfdl() / dqvo.getNllfdl() * 100, 2));
                 dqvo.setNwhssl(DoubleUtils.getRoundingNum(dqvo.getNwhssdl() / dqvo.getNllfdl() * 100, 2));
                 dqvo.setNgzssl(DoubleUtils.getRoundingNum(dqvo.getNgzssdl() / dqvo.getNllfdl() * 100, 2));
                 dqvo.setNxdssl(DoubleUtils.getRoundingNum(dqvo.getNxdssdl() / dqvo.getNllfdl() * 100, 2));
@@ -1119,8 +1119,8 @@ public class SpecificService {
         qw2.eq("to_char(record_date,'yyyy-MM')", yearmonth);
         qw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
         List<ProEconPowerstationInfoDay4> dyList = proEconPowerstationInfoDay4Service.list(qw);
-        String yearmon = "month" ;
-        Map<String, Double> fwXq = proEconBrownoutsEvent2Service.getFwXq(yearmonth,yearmon);
+        String yearmon = "month";
+        Map<String, Double> fwXq = proEconBrownoutsEvent2Service.getFwXq(yearmonth, yearmon);
         List<StationInfoMonth> list = stationInfoMonthService.list(qw2);
         if (StringUtils.isNotEmpty(dyList)) {
             dyList.stream().forEach(i -> {
@@ -1251,8 +1251,8 @@ public class SpecificService {
         qw.groupBy("to_char(record_date,'yyyy'),foreign_key_id");
         qw2.groupBy("to_char(record_date,'yyyy'),station_id");
         List<ProEconPowerstationInfoDay4> dyList = proEconPowerstationInfoDay4Service.list(qw);
-        String yearmon = "year" ;
-        Map<String, Double> fwXq = proEconBrownoutsEvent2Service.getFwXq(yearmonth,yearmon);
+        String yearmon = "year";
+        Map<String, Double> fwXq = proEconBrownoutsEvent2Service.getFwXq(yearmonth, yearmon);
         List<StationInfoMonth> list = stationInfoMonthService.list(qw2);
         if (StringUtils.isNotEmpty(dyList)) {
             dyList.stream().forEach(i -> {
@@ -3285,11 +3285,13 @@ public class SpecificService {
 
 
     public List<SpecificTarget> gzsslList(String companys, String type, String year) {
+        Date now = new Date();
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) as record_date,sum(gzss) as gzss,sum(llfdl) as llfdl");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.like("station_id", "_FDC_");
+        currentqw.lt("record_date", now);
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
         currentqw.clear();
@@ -3547,11 +3549,13 @@ public class SpecificService {
 
 
     public List<SpecificTarget> whsslList(String companys, String type, String year) {
+        Date now = new Date();
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) as record_date,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(llfdl) as llfdl");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.like("station_id", "_FDC_");
+        currentqw.lt("record_date", now);
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
 
@@ -3805,11 +3809,13 @@ public class SpecificService {
 
 
     public List<SpecificTarget> xdsslList(String companys, String type, String year) {
+        Date now = new Date();
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) as record_date,sum(xdss) as xdss,sum(llfdl) as llfdl");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.like("station_id", "_FDC_");
+        currentqw.lt("record_date", now);
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
 
@@ -4062,11 +4068,13 @@ public class SpecificService {
     }
 
     public List<SpecificTarget> xnsslList(String companys, String type, String year) {
+        Date now = new Date();
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) as record_date,sum(xnss) as xnss,sum(llfdl) as llfdl");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.like("station_id", "_FDC_");
+        currentqw.lt("record_date", now);
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
         currentqw.clear();
@@ -4322,11 +4330,13 @@ public class SpecificService {
 
 
     public List<SpecificTarget> slsslList(String companys, String type, String year) {
+        Date now = new Date();
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) as record_date,sum(slss) as slss,sum(llfdl) as llfdl");
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.like("station_id", "_FDC_");
+        currentqw.lt("record_date", now);
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
         currentqw.clear();