소스 검색

bug修改

wangb 1 주 전
부모
커밋
840b747a2d
1개의 변경된 파일97개의 추가작업 그리고 59개의 파일을 삭제
  1. 97 59
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

+ 97 - 59
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -871,7 +871,7 @@ public class SpecificService {
         });
         resultList.stream().forEach(i -> {
             Optional<ProEconPowerstationInfoDay1> optional = sameperiodList.stream()
-                    .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(j.getRecordDate())).equals(i.getMonth()))
+                    .filter(j -> j.getForeignKeyId().equals(i.getWpid()) && DateUtils.getMonth(j.getRecordDate())==(i.getMonth()))
                     .findFirst();
             if (optional.isPresent()) {
                 ProEconPowerstationInfoDay1 tqinfoday = optional.get();
@@ -960,14 +960,14 @@ public class SpecificService {
         }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
-        currentqw.clear();
-        currentqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl");
-        currentqw.eq("to_char(record_date,'yyyy')", year);
-        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        currentList.addAll(iTurbineInfoDayService.list(currentqw));
+//        currentqw.clear();
+//        currentqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl");
+//        currentqw.eq("to_char(record_date,'yyyy')", year);
+//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        currentList.addAll(iTurbineInfoDayService.list(currentqw));
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
-        sameperiodqw.select("station_id,max(record_date),sum(rfdl) rfdl,sum(llfdl) llfdl");
+        sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl");
         if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
         } else {
@@ -976,12 +976,12 @@ public class SpecificService {
         sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
         sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> sameperiodList = iTurbineInfoDayService.list(sameperiodqw);
-        sameperiodqw.clear();
-        sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl");
-        sameperiodqw.eq("station_id", companys + type);
-        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
-        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
+//        sameperiodqw.clear();
+//        sameperiodqw.select("station_id,max(record_date) record_date,sum(rfdl) rfdl,sum(llfdl) llfdl");
+//        sameperiodqw.eq("station_id", CacheContext.wplsf.get(0).getId());
+//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
+//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
+//        sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -990,25 +990,41 @@ public class SpecificService {
             SpecificTargetVo vo = new SpecificTargetVo();
             String wpid = i.getStationId();
             vo.setWpid(wpid);
-            if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) {
-                vo.setWpname(CacheContext.cpmap.get(companys).getAname());
-            } else if (wpid.contains("_RGN")) {
-                vo.setWpname(CacheContext.rgmap.get(companys).getAname());
-            } else {
+//            if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) {
+//                vo.setWpname(CacheContext.cpmap.get(companys).getAname());
+//            } else if (wpid.contains("_RGN")) {
+//                vo.setWpname(CacheContext.rgmap.get(companys).getAname());
+//            } else {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
+//            }
+            vo.setYear(DateUtils.getYear(i.getRecordDate()));
+            vo.setMonth(DateUtils.getMonth(i.getRecordDate()));
+//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? i.getRfdl().doubleValue() / i.getLlfdl().doubleValue() * 100 : 0, 2));
+            double llfdl = i.getLlfdl() != null ?i.getLlfdl().doubleValue() :0.0;
+            double rfdl = i.getRfdl() != null ?i.getRfdl().doubleValue() :0.0;
+            if (llfdl != 0) {
+                Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                vo.setCurrent(calculatedValue);
+            } else {
+                vo.setCurrent(0.0);
             }
-            vo.setYear(DateUtils.getYear(Date.from(i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())));
-            vo.setMonth(DateUtils.getMonth(Date.from(i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant())));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? i.getRfdl().doubleValue() / i.getLlfdl().doubleValue() * 100 : 0, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
             Optional<TurbineInfoDay> optional = sameperiodList.stream()
-                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
+                    .filter(j -> j.getStationId().equals(i.getWpid()) && DateUtils.getMonth(j.getRecordDate())==(i.getMonth()))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? tqinfoday.getRfdl().doubleValue() / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? tqinfoday.getRfdl().doubleValue() / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+                double llfdl = tqinfoday.getLlfdl() != null ?tqinfoday.getLlfdl().doubleValue() :0.0;
+                double rfdl = tqinfoday.getRfdl() != null ?tqinfoday.getRfdl().doubleValue() :0.0;
+                if (llfdl != 0) {
+                    Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                    i.setSameperiod(calculatedValue);
+                } else {
+                    i.setSameperiod(0.0);
+                }
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -1039,14 +1055,14 @@ public class SpecificService {
                 SpecificTarget vo = new SpecificTarget();
                 vo.setWpid(wpid);
                 int orderNum = 100;
-                if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) {
-                    vo.setWpname(CacheContext.cpmap.get(companys).getAname());
-                } else if (wpid.contains("_RGN")) {
-                    vo.setWpname(CacheContext.rgmap.get(companys).getAname());
-                } else {
+//                if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) {
+//                    vo.setWpname(CacheContext.cpmap.get(companys).getAname());
+//                } else if (wpid.contains("_RGN")) {
+//                    vo.setWpname(CacheContext.rgmap.get(companys).getAname());
+//                } else {
                     vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
                     orderNum = CacheContext.wpmap.get(wpid).getOrderNum();
-                }
+//                }
                 vo.setOrderNum(orderNum);
                 List<SpecificTargetVo> tempList = new ArrayList<>();
 
@@ -1057,13 +1073,13 @@ public class SpecificService {
                     } else {
                         SpecificTargetVo vo1 = new SpecificTargetVo();
                         vo1.setWpid(wpid);
-                        if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) {
-                            vo1.setWpname(CacheContext.cpmap.get(companys).getAname());
-                        } else if (wpid.contains("_RGN")) {
-                            vo1.setWpname(CacheContext.rgmap.get(companys).getAname());
-                        } else {
+//                        if (wpid.contains("_ZGS") || wpid.contains("_FGS" + type)) {
+//                            vo1.setWpname(CacheContext.cpmap.get(companys).getAname());
+//                        } else if (wpid.contains("_RGN")) {
+//                            vo1.setWpname(CacheContext.rgmap.get(companys).getAname());
+//                        } else {
                             vo1.setWpname(CacheContext.wpmap.get(wpid).getAname());
-                        }
+//                        }
                         vo1.setYear(Integer.parseInt(year));
                         vo1.setMonth(x);
                         tempList.add(vo1);
@@ -1072,6 +1088,12 @@ public class SpecificService {
 
                 vo.setTargetList(tempList);
                 resultendList.add(vo);
+                SpecificTarget vo2 = new SpecificTarget();
+                vo2.setWpid(vo.getWpid());
+                vo2.setTargetList(vo.getTargetList());
+                vo2.setOrderNum(vo.getOrderNum()+1);
+                vo2.setWpname(CacheContext.cpmap.get(companys).getAname());
+                resultendList.add(vo2);
 
             });
         }
@@ -2776,7 +2798,7 @@ public class SpecificService {
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
         currentqw.clear();
         currentqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
-        currentqw.eq("station_id", companys + type);
+        currentqw.eq("station_id", CacheContext.wplsf.get(0).getId());
         currentqw.eq("to_char(record_date,'yyyy')", year);
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         currentList.addAll(iTurbineInfoDayService.list(currentqw));
@@ -2800,7 +2822,7 @@ public class SpecificService {
         List<TurbineInfoDay> sameperiodList = iTurbineInfoDayService.list(sameperiodqw);
         sameperiodqw.clear();
         sameperiodqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
-        sameperiodqw.eq("station_id", companys + type);
+        sameperiodqw.eq("station_id", CacheContext.wplsf.get(0).getId());
         sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
         sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         sameperiodList.addAll(iTurbineInfoDayService.list(sameperiodqw));
@@ -2819,20 +2841,36 @@ public class SpecificService {
 //            } else {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
 //            }
-            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-            Date date2 = Date.from(instant);
-            vo.setYear(DateUtils.getYear(date2));
-            vo.setMonth(DateUtils.getMonth(date2));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getGzss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
+//            Date date2 = Date.from(instant);
+//            vo.setYear(DateUtils.getYear(date2));
+//            vo.setMonth(DateUtils.getMonth(date2));
+//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getGzss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
+            double llfdl = i.getLlfdl() != null ?i.getLlfdl().doubleValue() :0.0;
+            double rfdl = i.getGzss() != null ?i.getGzss().doubleValue() :0.0;
+            if (llfdl != 0) {
+                Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                vo.setCurrent(calculatedValue);
+            } else {
+                vo.setCurrent(0.0);
+            }
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
             Optional<TurbineInfoDay> optional = sameperiodList.stream()
-                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
+//                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getGzss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getGzss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
+                double llfdl = tqinfoday.getLlfdl() != null ?tqinfoday.getLlfdl().doubleValue() :0.0;
+                double rfdl = tqinfoday.getGzss() != null ?tqinfoday.getGzss().doubleValue() :0.0;
+                if (llfdl != 0) {
+                    Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100,2);
+                    i.setCurrent(calculatedValue);
+                } else {
+                    i.setCurrent(0.0);
+                }
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -3407,16 +3445,16 @@ public class SpecificService {
 //            } else {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
 //            }
-            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-            Date date = Date.from(instant);
-            vo.setYear(DateUtils.getYear(date));
-            vo.setMonth(DateUtils.getMonth(date));
+//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
+//            Date date = Date.from(instant);
+//            vo.setYear(DateUtils.getYear(date));
+//            vo.setMonth(DateUtils.getMonth(date));
             vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXdss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
             Optional<TurbineInfoDay> optional = sameperiodList.stream()
-                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
+//                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
@@ -3701,16 +3739,16 @@ public class SpecificService {
             } else {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
             }
-            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-            Date date = Date.from(instant);
-            vo.setYear(DateUtils.getYear(date));
-            vo.setMonth(DateUtils.getMonth(date));
+//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
+//            Date date = Date.from(instant);
+//            vo.setYear(DateUtils.getYear(date));
+//            vo.setMonth(DateUtils.getMonth(date));
             vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXnss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
             Optional<TurbineInfoDay> optional = sameperiodList.stream()
-                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
+//                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
@@ -3996,16 +4034,16 @@ public class SpecificService {
 //            } else {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
 //            }
-            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-            Date date = Date.from(instant);
-            vo.setYear(DateUtils.getYear(date));
-            vo.setMonth(DateUtils.getMonth(date));
+//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
+//            Date date = Date.from(instant);
+//            vo.setYear(DateUtils.getYear(date));
+//            vo.setMonth(DateUtils.getMonth(date));
             vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getSlss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
             Optional<TurbineInfoDay> optional = sameperiodList.stream()
-                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
+//                    .filter(j -> j.getStationId().equals(i.getWpid()) && String.valueOf(DateUtils.getMonth(Date.from(j.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant()))).equals(i.getMonth()))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();