Browse Source

性能损失优化

wangb 3 ngày trước cách đây
mục cha
commit
fcea3eb73c

+ 43 - 410
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/specific/SpecificService.java

@@ -1652,7 +1652,7 @@ public class SpecificService {
             Date date = Date.from(instant);
             vo.setYear(DateUtils.getYear(date));
             vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getRfdlFj().doubleValue()/1000, 2));
+            vo.setCurrent(DoubleUtils.keepPrecision(i.getRfdlFj().doubleValue() / 1000, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -1663,7 +1663,7 @@ public class SpecificService {
 
             if (optional.isPresent()) {
                 StationInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getRfdlFj().doubleValue()/1000, 2));
+                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getRfdlFj().doubleValue() / 1000, 2));
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -1944,7 +1944,7 @@ public class SpecificService {
             Date date = Date.from(instant);
             vo.setYear(DateUtils.getYear(date));
             vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getCydl().doubleValue()/100, 2));
+            vo.setCurrent(DoubleUtils.keepPrecision(i.getCydl().doubleValue() / 100, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -1954,7 +1954,7 @@ public class SpecificService {
                     .findFirst();
             if (optional.isPresent()) {
                 StationInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getCydl().doubleValue()/100, 2));
+                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getCydl().doubleValue() / 100, 2));
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -2250,7 +2250,7 @@ public class SpecificService {
             Date date = Date.from(instant);
             vo.setYear(DateUtils.getYear(date));
             vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getGwdl().doubleValue()/1000, 2));
+            vo.setCurrent(DoubleUtils.keepPrecision(i.getGwdl().doubleValue() / 1000, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -2259,7 +2259,7 @@ public class SpecificService {
                     .findFirst();
             if (optional.isPresent()) {
                 StationInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getGwdl().doubleValue()/1000, 2));
+                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getGwdl().doubleValue() / 1000, 2));
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -2555,7 +2555,7 @@ public class SpecificService {
             Date date = Date.from(instant);
             vo.setYear(DateUtils.getYear(date));
             vo.setMonth(DateUtils.getMonth(date));
-            vo.setCurrent(DoubleUtils.keepPrecision(i.getSwdl().doubleValue()/1000, 2));
+            vo.setCurrent(DoubleUtils.keepPrecision(i.getSwdl().doubleValue() / 1000, 2));
             resultList.add(vo);
         });
         resultList.stream().forEach(i -> {
@@ -2564,7 +2564,7 @@ public class SpecificService {
                     .findFirst();
             if (optional.isPresent()) {
                 StationInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getSwdl().doubleValue()/1000, 2));
+                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getSwdl().doubleValue() / 1000, 2));
                 i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
             } else {
                 i.setSameperiod(0.0);
@@ -3244,50 +3244,20 @@ public class SpecificService {
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
-//        currentqw.eq("location", "wp");
         currentqw.eq("to_char(record_date,'yyyy')", year);
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("station_id", companys);
-//        }
         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(gzss) gzss,sum(llfdl) llfdl");
-//        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));
+        currentqw.clear();
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
         sameperiodqw.select("station_id,max(record_date) record_date,sum(gzss) gzss,sum(llfdl) llfdl");
-//        sameperiodqw.eq("location", "wp");
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS") || companys.endsWith("FGS")) {
-//            currentqw.eq("station_id", companys);
-//        } else {
-//            currentqw.eq("station_id", companys);
-//        }
         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(gzss) gzss,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));
+        sameperiodqw.clear();
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -3296,18 +3266,9 @@ public class SpecificService {
             SpecificTargetVo vo = new SpecificTargetVo();
             String wpid = i.getStationId();
             vo.setWpid(wpid);
-//            if (companys.endsWith("ZGS") || companys.endsWith("FGS")) {
-//                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());
-//            }
-//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-//            Date date2 = Date.from(instant);
             vo.setYear(i.getRecordDate().getYear() + 1900);
             vo.setMonth(i.getRecordDate().getMonth() + 1);
-//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getGzss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
             double llfdl = i.getLlfdl() != null ? i.getLlfdl() : 0.0;
             double rfdl = i.getGzss() != null ? i.getGzss() : 0.0;
             if (llfdl != 0) {
@@ -3320,13 +3281,12 @@ public class SpecificService {
         });
         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->i.getMonth().equals(j.getRecordDate().getMonth()+1))
                     .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));
-                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0;
-                double rfdl = tqinfoday.getGzss() != null ? tqinfoday.getGzss().doubleValue() : 0.0;
+                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl() : 0.0;
+                double rfdl = tqinfoday.getGzss() != null ? tqinfoday.getGzss() : 0.0;
                 if (llfdl != 0) {
                     Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                     i.setSameperiod(calculatedValue);
@@ -3363,14 +3323,8 @@ 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 {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
                 orderNum = CacheContext.wpmap.get(wpid).getOrderNum();
-//                }
                 vo.setOrderNum(orderNum);
                 List<SpecificTargetVo> tempList = new ArrayList<>();
 
@@ -3381,13 +3335,7 @@ 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 {
                         vo1.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//                        }
                         vo1.setYear(Integer.parseInt(year));
                         vo1.setMonth(x);
                         tempList.add(vo1);
@@ -3558,173 +3506,19 @@ public class SpecificService {
     }
 
 
-//    public List<SpecificTarget> whsslList(String companys, String type, String year) {
-//        //获取年份所有当月的数据
-//        QueryWrapper<ProEconPowerstationInfoDay1> currentqw = new QueryWrapper<>();
-//        currentqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl");
-//        currentqw.eq("location", "wp");
-//        currentqw.eq("to_char(record_date,'yyyy')", year);
-//        if (type.equals("-1")) {
-//            currentqw.like("foreign_key_id", "_FDC_");
-//        } else {
-//            currentqw.like("foreign_key_id", "_GDC_");
-//        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
-//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
-//        List<ProEconPowerstationInfoDay1> currentList = proEconPowerstationInfoDay1Service.list(currentqw);
-//        currentqw.clear();
-//        currentqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl");
-//        currentqw.eq("foreign_key_id", companys + type);
-//        currentqw.eq("to_char(record_date,'yyyy')", year);
-//        currentqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
-//        currentList.addAll(proEconPowerstationInfoDay1Service.list(currentqw));
-//
-//        int subYear = Integer.parseInt(year) - 1;
-//        QueryWrapper<ProEconPowerstationInfoDay1> sameperiodqw = new QueryWrapper<>();
-//        sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl");
-//        sameperiodqw.eq("location", "wp");
-//        if (type.equals("-1")) {
-//            currentqw.like("foreign_key_id", "_FDC_");
-//        } else {
-//            currentqw.like("foreign_key_id", "_GDC_");
-//        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
-//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
-//        List<ProEconPowerstationInfoDay1> sameperiodList = proEconPowerstationInfoDay1Service.list(sameperiodqw);
-//        sameperiodqw.clear();
-//        sameperiodqw.select("foreign_key_id,max(record_date) record_date,sum(rjxssdl) yjxssdl,sum(rcnsljxssdl) ycnsljxssdl,sum(rllfdl) yllfdl");
-//        sameperiodqw.eq("foreign_key_id", companys + type);
-//        sameperiodqw.eq("to_char(record_date,'yyyy')", String.valueOf(subYear));
-//        sameperiodqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
-//        sameperiodList.addAll(proEconPowerstationInfoDay1Service.list(sameperiodqw));
-//
-//        //合并当月与同期数据为返回结果
-//        List<SpecificTargetVo> resultList = new ArrayList<>();
-//
-//        currentList.stream().forEach(i -> {
-//            SpecificTargetVo vo = new SpecificTargetVo();
-//            String wpid = i.getForeignKeyId();
-//            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 {
-//                vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//            }
-//            vo.setYear(DateUtils.getYear(i.getRecordDate()));
-//            vo.setMonth(DateUtils.getMonth(i.getRecordDate()));
-//            vo.setCurrent(DoubleUtils.keepPrecision(i.getYllfdl().doubleValue() != 0 ? (i.getYjxssdl().doubleValue() + i.getYcnsljxssdl().doubleValue()) / i.getYllfdl().doubleValue() * 100 : 0, 2));
-//            resultList.add(vo);
-//        });
-//        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()))
-//                    .findFirst();
-//            if (optional.isPresent()) {
-//                ProEconPowerstationInfoDay1 tqinfoday = optional.get();
-//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getYllfdl().doubleValue() != 0 ? (tqinfoday.getYjxssdl().doubleValue() + tqinfoday.getYcnsljxssdl().doubleValue()) / tqinfoday.getYllfdl().doubleValue() * 100 : 0, 2));
-//                i.setCompare(i.getCurrent().compareTo(i.getSameperiod()));
-//            } else {
-//                i.setSameperiod(0.0);
-//                i.setCompare(0);
-//            }
-//        });
-//        List<SpecificTarget> resultendList = new ArrayList<>();
-//
-//        Map<String, Map<Integer, SpecificTargetVo>> map = new HashMap<>();
-//
-//        resultList.stream().forEach(i -> {
-//            if (map.containsKey(i.getWpid())) {
-//                Map<Integer, SpecificTargetVo> integerListMap = map.get(i.getWpid());
-//                if (!integerListMap.containsKey(i.getMonth())) {
-//                    map.get(i.getWpid()).put(i.getMonth(), i);
-//                } else {
-//
-//                }
-//            } else {
-//                Map<Integer, SpecificTargetVo> tempMap = new HashMap<>();
-//                tempMap.put(i.getMonth(), i);
-//                map.put(i.getWpid(), tempMap);
-//            }
-//        });
-//        Set<String> wpids = map.keySet();
-//        if (StringUtils.isNotNull(wpids)) {
-//            wpids.stream().forEach(wpid -> {
-//                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 {
-//                    vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//                    orderNum = CacheContext.wpmap.get(wpid).getOrderNum();
-//                }
-//                vo.setOrderNum(orderNum);
-//                List<SpecificTargetVo> tempList = new ArrayList<>();
-//
-//                Map<Integer, SpecificTargetVo> listMap = map.get(wpid);
-//                for (int x = 1; x <= 12; x++) {
-//                    if (listMap.containsKey(x)) {
-//                        tempList.add(listMap.get(x));
-//                    } 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 {
-//                            vo1.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//                        }
-//                        vo1.setYear(Integer.parseInt(year));
-//                        vo1.setMonth(x);
-//                        tempList.add(vo1);
-//                    }
-//                }
-//
-//                vo.setTargetList(tempList);
-//                resultendList.add(vo);
-//            });
-//        }
-//        SortUtils.sort(resultendList, "orderNum", SortUtils.ASC);
-//
-//        return resultendList;
-//    }
-
-
     public List<SpecificTarget> whsslList(String companys, String type, String year) {
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) record_date,sum(jhjxss) jhjxss,sum(fjhjxss) fjhjxss,sum(llfdl) llfdl");
         currentqw.eq("to_char(record_date,'yyyy')", year);
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
         currentqw.groupBy("to_char(record_date,'yyyy-MM'),station_id");
         List<TurbineInfoDay> currentList = iTurbineInfoDayService.list(currentqw);
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
         sameperiodqw.select("station_id,max(record_date) record_date,sum(jhjxss) jhjxss,sum(fjhjxss) fjhjxss,sum(llfdl) llfdl");
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
         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);
@@ -3738,7 +3532,7 @@ public class SpecificService {
             vo.setWpid(wpid);
             vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
             double llfdl = i.getLlfdl() != null ? i.getLlfdl() : 0.0;
-            double rfdl = i.getJhjxss().doubleValue() + i.getFjhjxss().doubleValue() != 0 ? i.getJhjxss().doubleValue() + i.getFjhjxss().doubleValue() : 0.0;
+            double rfdl = i.getJhjxss() + i.getFjhjxss() != 0 ? i.getJhjxss() + i.getFjhjxss() : 0.0;
             if (llfdl != 0) {
                 Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                 vo.setCurrent(calculatedValue);
@@ -3751,12 +3545,13 @@ public class SpecificService {
         });
         resultList.stream().forEach(i -> {
             Optional<TurbineInfoDay> optional = sameperiodList.stream()
+                    .filter(j->i.getMonth().equals(j.getRecordDate().getMonth()+1))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
 
                 double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl() : 0.0;
-                double rfdl = tqinfoday.getJhjxss() != null ? tqinfoday.getJhjxss().doubleValue() + tqinfoday.getFjhjxss().doubleValue() : 0.0;
+                double rfdl = tqinfoday.getJhjxss() != null ? tqinfoday.getJhjxss() + tqinfoday.getFjhjxss().doubleValue() : 0.0;
                 if (llfdl != 0) {
                     Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                     i.setSameperiod(calculatedValue);
@@ -3979,50 +3774,19 @@ public class SpecificService {
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
-//        currentqw.eq("location", "wp");
         currentqw.eq("to_char(record_date,'yyyy')", year);
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
         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(xdss) xdss,sum(llfdl) llfdl");
-////        currentqw.eq("foreign_key_id", companys + type);
-//        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) record_date,sum(xdss) xdss,sum(llfdl) llfdl");
-//        sameperiodqw.eq("location", "wp");
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
         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(xdss) xdss,sum(llfdl) llfdl");
-////        sameperiodqw.eq("foreign_key_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();
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -4031,20 +3795,11 @@ 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 {
             vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//            }
-//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-//            Date date = Date.from(instant);
             vo.setYear(i.getRecordDate().getYear() + 1900);
             vo.setMonth(i.getRecordDate().getMonth() + 1);
-//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXdss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
-            double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0;
-            double rfdl = i.getXdss() != null ? i.getXdss().doubleValue() : 0.0;
+            double llfdl = i.getLlfdl() != null ? i.getLlfdl() : 0.0;
+            double rfdl = i.getXdss() != null ? i.getXdss() : 0.0;
             if (llfdl != 0) {
                 Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                 vo.setCurrent(calculatedValue);
@@ -4055,14 +3810,12 @@ public class SpecificService {
         });
         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->i.getMonth().equals(j.getRecordDate().getMonth()+1))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXdss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
-
-                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0;
-                double rfdl = tqinfoday.getXdss() != null ? tqinfoday.getXdss().doubleValue() : 0.0;
+                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl() : 0.0;
+                double rfdl = tqinfoday.getXdss() != null ? tqinfoday.getXdss() : 0.0;
                 if (llfdl != 0) {
                     Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                     i.setSameperiod(calculatedValue);
@@ -4099,14 +3852,8 @@ 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 {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
                 orderNum = CacheContext.wpmap.get(wpid).getOrderNum();
-//                }
                 vo.setOrderNum(orderNum);
                 List<SpecificTargetVo> tempList = new ArrayList<>();
 
@@ -4117,13 +3864,7 @@ 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 {
                         vo1.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//                        }
                         vo1.setYear(Integer.parseInt(year));
                         vo1.setMonth(x);
                         tempList.add(vo1);
@@ -4298,105 +4039,62 @@ public class SpecificService {
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl");
-//        currentqw.eq("location", "wp");
         currentqw.eq("to_char(record_date,'yyyy')", year);
-        if (type.equals("-1")) {
-            currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
+        currentqw.like("station_id", "_FDC_");
         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(xnss) xnss,sum(llfdl) llfdl");
-////        currentqw.eq("foreign_key_id", companys + type);
-//        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();
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
         sameperiodqw.select("station_id,max(record_date) record_date,sum(xnss) xnss,sum(llfdl) llfdl");
-//        sameperiodqw.eq("location", "wp");
-        if (type.equals("-1")) {
-            currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
+        currentqw.like("station_id", "_FDC_");
         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(xnss) xnss,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));
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
-
+        //添加本月数据
         currentList.stream().forEach(i -> {
             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 {
-                vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
-            }
-//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-//            Date date = Date.from(instant);
+            vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
             vo.setYear(i.getRecordDate().getYear() + 1900);
             vo.setMonth(i.getRecordDate().getMonth() + 1);
-//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getXnss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
-            double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0;
-            double rfdl = i.getXnss() != null ? i.getXnss().doubleValue() : 0.0;
+            double llfdl = i.getLlfdl() != null ? i.getLlfdl() : 0.0;
+            double rfdl = i.getXnss() != null ? i.getXnss() : 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()))
-                    .findFirst();
+            Optional<TurbineInfoDay> optional = sameperiodList.stream().filter(j->i.getMonth().equals(j.getRecordDate().getMonth()+1)).findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getXnss().doubleValue()) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
-
-                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0;
-                double rfdl = tqinfoday.getXnss() != null ? tqinfoday.getXnss().doubleValue() : 0.0;
+                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl() != 0 ? (tqinfoday.getXnss()) / tqinfoday.getLlfdl() * 100 : 0, 2));
+                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl() : 0.0;
+                double rfdl = tqinfoday.getXnss() != null ? tqinfoday.getXnss() : 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);
                 i.setCompare(0);
             }
         });
+
         List<SpecificTarget> resultendList = new ArrayList<>();
 
         Map<String, Map<Integer, SpecificTargetVo>> map = new HashMap<>();
@@ -4421,14 +4119,8 @@ 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 {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
                 orderNum = CacheContext.wpmap.get(wpid).getOrderNum();
-//                }
                 vo.setOrderNum(orderNum);
                 List<SpecificTargetVo> tempList = new ArrayList<>();
 
@@ -4439,13 +4131,7 @@ 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 {
                         vo1.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//                        }
                         vo1.setYear(Integer.parseInt(year));
                         vo1.setMonth(x);
                         tempList.add(vo1);
@@ -4620,50 +4306,20 @@ public class SpecificService {
         //获取年份所有当月的数据
         QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
         currentqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl");
-//        currentqw.eq("location", "wp");
         currentqw.eq("to_char(record_date,'yyyy')", year);
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
         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(slss) slss,sum(llfdl) llfdl");
-////        currentqw.eq("foreign_key_id", companys + type);
-//        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();
 
         int subYear = Integer.parseInt(year) - 1;
         QueryWrapper<TurbineInfoDay> sameperiodqw = new QueryWrapper<>();
         sameperiodqw.select("station_id,max(record_date) record_date,sum(slss) slss,sum(llfdl) llfdl");
-//        sameperiodqw.eq("location", "wp");
-        if (type.equals("-1")) {
             currentqw.like("station_id", "_FDC_");
-        } else {
-            currentqw.like("station_id", "_GDC_");
-        }
-//        if (companys.endsWith("ZGS")) {
-//            currentqw.eq("company_id", companys);
-//        } else {
-//            currentqw.eq("region_id", companys);
-//        }
         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(slss) slss,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();
 
         //合并当月与同期数据为返回结果
         List<SpecificTargetVo> resultList = new ArrayList<>();
@@ -4672,20 +4328,11 @@ 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 {
             vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//            }
-//            Instant instant = i.getRecordDate().atStartOfDay(ZoneId.systemDefault()).toInstant();
-//            Date date = Date.from(instant);
             vo.setYear(i.getRecordDate().getYear() + 1900);
             vo.setMonth(i.getRecordDate().getMonth() + 1);
-//            vo.setCurrent(DoubleUtils.keepPrecision(i.getLlfdl().doubleValue() != 0 ? (i.getSlss().doubleValue()) / i.getLlfdl().doubleValue() * 100 : 0, 2));
-            double llfdl = i.getLlfdl() != null ? i.getLlfdl().doubleValue() : 0.0;
-            double rfdl = i.getSlss() != null ? i.getSlss().doubleValue() : 0.0;
+            double llfdl = i.getLlfdl() != null ? i.getLlfdl() : 0.0;
+            double rfdl = i.getSlss() != null ? i.getSlss() : 0.0;
             if (llfdl != 0) {
                 Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                 vo.setCurrent(calculatedValue);
@@ -4697,14 +4344,12 @@ public class SpecificService {
         });
         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->i.getMonth().equals(j.getRecordDate().getMonth()+1))
                     .findFirst();
             if (optional.isPresent()) {
                 TurbineInfoDay tqinfoday = optional.get();
-//                i.setSameperiod(DoubleUtils.keepPrecision(tqinfoday.getLlfdl().doubleValue() != 0 ? (tqinfoday.getSlss().doubleValue() ) / tqinfoday.getLlfdl().doubleValue() * 100 : 0, 2));
-
-                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl().doubleValue() : 0.0;
-                double rfdl = tqinfoday.getSlss() != null ? tqinfoday.getSlss().doubleValue() : 0.0;
+                double llfdl = tqinfoday.getLlfdl() != null ? tqinfoday.getLlfdl() : 0.0;
+                double rfdl = tqinfoday.getSlss() != null ? tqinfoday.getSlss() : 0.0;
                 if (llfdl != 0) {
                     Double calculatedValue = DoubleUtils.keepPrecision(rfdl / llfdl * 100, 2);
                     i.setSameperiod(calculatedValue);
@@ -4742,14 +4387,8 @@ 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 {
                 vo.setWpname(CacheContext.wpmap.get(wpid).getAname());
                 orderNum = CacheContext.wpmap.get(wpid).getOrderNum();
-//                }
                 vo.setOrderNum(orderNum);
                 List<SpecificTargetVo> tempList = new ArrayList<>();
 
@@ -4760,13 +4399,7 @@ 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 {
                         vo1.setWpname(CacheContext.wpmap.get(wpid).getAname());
-//                        }
                         vo1.setYear(Integer.parseInt(year));
                         vo1.setMonth(x);
                         tempList.add(vo1);