浏览代码

Merge remote-tracking branch 'origin/master'

shilin 2 年之前
父节点
当前提交
440b43a819
共有 23 个文件被更改,包括 1234 次插入211 次删除
  1. 7 7
      web/gdsx-ghost/src/main/java/com/gyee/ghost/init/CacheContext.java
  2. 160 94
      web/gdsx-ghost/src/main/java/com/gyee/ghost/service/RealtimeService.java
  3. 2 1
      web/gdsx-ghost/src/main/java/com/gyee/ghost/task/SaticScheduleTask.java
  4. 2 2
      web/gdsx-ghost/src/test/java/com/gyee/ghost/GhostTest.java
  5. 76 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/ElePerAnalysis.java
  6. 83 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/PointPerSis.java
  7. 53 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/StationPersis.java
  8. 16 19
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/warn/ShutdowneventController.java
  9. 3 3
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/auto/Windpowerinfoday.java
  10. 39 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/ElePerAnalysisVo.java
  11. 16 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/PointPerSisVo.java
  12. 14 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/StationPersisVo.java
  13. 79 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/ProjectplanPGService.java
  14. 81 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/RegionPGService.java
  15. 35 50
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/ShutdowneventService.java
  16. 14 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerinfodayService.java
  17. 94 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationPGService.java
  18. 47 6
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationService.java
  19. 98 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/ElePerAnalysisService.java
  20. 69 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/FreedomService.java
  21. 73 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/PointPerSisService.java
  22. 36 29
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/GenreSetPushService.java
  23. 137 0
      web/monitor-web-sxjn/src/main/java/com/gyee/frame/util/DoubleUtils.java

+ 7 - 7
web/gdsx-ghost/src/main/java/com/gyee/ghost/init/CacheContext.java

@@ -117,12 +117,12 @@ public class CacheContext implements CommandLineRunner {
 //        });
 
 
-        String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
-        try {
-//            realtimeService.saveWindturbineStatus2();
-            realtimeService.saveWindstationStatus(yesterday,yesterday);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
+//        String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
+//        try {
+////            realtimeService.saveWindturbineStatus2();
+//            realtimeService.saveWindstationStatus(yesterday,yesterday);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
     }
 }

+ 160 - 94
web/gdsx-ghost/src/main/java/com/gyee/ghost/service/RealtimeService.java

@@ -21,10 +21,13 @@ import com.gyee.ghost.service.auto.IProEconStatusmxService;
 import com.gyee.ghost.service.auto.IProEconWindturbineStatus2Service;
 import com.gyee.ghost.util.realtimesource.IEdosUtil;
 import lombok.extern.slf4j.Slf4j;
+import oracle.sql.Datum;
 import org.apache.ibatis.annotations.Update;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -42,6 +45,7 @@ public class RealtimeService {
     public void saveWindturbineStatus2() {
 
         List<ProEconWindturbineStatus2> resultList = new ArrayList<>();
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
 
         List<Windturbine> wtls = CacheContext.wtls;
         Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
@@ -53,26 +57,32 @@ public class RealtimeService {
 //        Date befroeDate = DateUtils.addSeconds(currentDate, -1);
         Date befroeDate = DateUtils.addMinutes(currentDate,-5);
 
+        Date startOfDay = DateUtils.getStartOfDay(currentDate);
+        Date endOfDay = DateUtils.getEndOfDay(currentDate);
+
         wtls.stream().forEach(wt->{
 
             Map<String, Windturbinetestingpointai> stringWindturbinetestingpointaiMap = wtpAimap.get(wt.getId());
             Windturbinetestingpointai windturbinetestingpointai = stringWindturbinetestingpointaiMap.get(Contant.ZTMX);
             Windturbinetestingpointai windturbinetestingpointaifs = stringWindturbinetestingpointaiMap.get(Contant.AI022);
+
             try {
-                PointData realData = edosUtil.getRealData(windturbinetestingpointai);
+                PointData realData = edosUtil.getSectionData(windturbinetestingpointai,currentDate.getTime());
 
                 double aDouble = realData.getPointValueInDouble();
 
                 PointData sectionData = edosUtil.getSectionData(windturbinetestingpointai, befroeDate.getTime());
                 double tempDouble = sectionData.getPointValueInDouble();
                 double speed = edosUtil.getRealData(windturbinetestingpointaifs).getPointValueInDouble();
-                if (aDouble != tempDouble){
+
+                if (isEq(DateUtils.toDate(currentDate),DateUtils.toDate(startOfDay)) || aDouble != tempDouble){
                     ProEconWindturbineStatus2 proEconWindturbineStatus2 = new ProEconWindturbineStatus2();
                     proEconWindturbineStatus2.setId(CommonUtils.getUUID());
                     proEconWindturbineStatus2.setWindpowerstationId(wt.getWindpowerstationid());
                     proEconWindturbineStatus2.setWindturbineId(wt.getId());
-                    proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
-                    proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+
+                    proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
+                    proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
                     proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
                     proEconWindturbineStatus2.setLossPower(0.0);
                     proEconWindturbineStatus2.setShutdownEventId("");
@@ -82,39 +92,51 @@ public class RealtimeService {
                     proEconWindturbineStatus2.setAvgSpeed(0.0);
                     String statusName = statusmxMap.get(new Double(aDouble).intValue());
                     proEconWindturbineStatus2.setStatusDesc(statusName);
-                    resultList.add(proEconWindturbineStatus2);
+//                    resultList.add(proEconWindturbineStatus2);
+                    proEconWindturbineStatus2Service.save(proEconWindturbineStatus2);
 
                     QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
                     qw.eq("windTurbine_Id",wt.getId());
-                    qw.orderByDesc("start_Time");
-                    ProEconWindturbineStatus2 proEconWindturbineStatus21 = proEconWindturbineStatus2Service.getBaseMapper().selectOne(qw);
-                    if (StringUtils.isNotNull(proEconWindturbineStatus21)){
-                        proEconWindturbineStatus21.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
-                        proEconWindturbineStatus21.setLossPower(0.0);
-                        proEconWindturbineStatus21.setSpeed(speed);
-                        proEconWindturbineStatus21.setAvgSpeed(0.0);
-                        resultList.add(proEconWindturbineStatus21);
+                    Date beforeFive = DateUtils.addMinutes(sdf.parse(DateUtils.toDate1(currentDate)), -5);
+//                    String toDate = DateUtils.toDate(beforeFive);
+//                    Date parse = sdf.parse(toDate);
+                    qw.eq("stop_Time",beforeFive);
+                    Optional<ProEconWindturbineStatus2> first = proEconWindturbineStatus2Service.list(qw).stream().findFirst();
+                    if (first.isPresent()){
+                        ProEconWindturbineStatus2 proEconWindturbineStatus = first.get();
+                        proEconWindturbineStatus.setStopTime(DateUtils.parseLongToDate(currentDate.getTime()));
+                        proEconWindturbineStatus.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus.getStopTime(), proEconWindturbineStatus.getStartTime()));
+                        proEconWindturbineStatus.setLossPower(0.0);
+                        proEconWindturbineStatus.setSpeed(speed);
+                        proEconWindturbineStatus.setAvgSpeed(0.0);
+//                        resultList.add(proEconWindturbineStatus2);
+                        proEconWindturbineStatus2Service.updateById(proEconWindturbineStatus2);
                     }
 
                 }else {
                     QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
                     qw.eq("windTurbine_Id",wt.getId());
-                    qw.orderByDesc("start_Time");
-                    ProEconWindturbineStatus2 proEconWindturbineStatus21 = proEconWindturbineStatus2Service.getBaseMapper().selectOne(qw);
-                    if (StringUtils.isNotNull(proEconWindturbineStatus21)){
-                        proEconWindturbineStatus21.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
-                        proEconWindturbineStatus21.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus21.getStopTime(), proEconWindturbineStatus21.getStartTime()));
-                        proEconWindturbineStatus21.setLossPower(0.0);
-                        proEconWindturbineStatus21.setSpeed(speed);
-                        proEconWindturbineStatus21.setAvgSpeed(0.0);
-                        resultList.add(proEconWindturbineStatus21);
-                    }else{
+                    Date beforeFive = DateUtils.addMinutes(sdf.parse(DateUtils.toDate1(currentDate)), -5);
+//                    String toDate = DateUtils.toDate(beforeFive);
+//                    Date parse = sdf.parse(toDate);
+                    qw.eq("stop_Time",beforeFive);
+                    Optional<ProEconWindturbineStatus2> first = proEconWindturbineStatus2Service.list(qw).stream().findFirst();
+                    if (first.isPresent()){
+                        ProEconWindturbineStatus2 proEconWindturbineStatus2 = first.get();
+                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
+                        proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
+                        proEconWindturbineStatus2.setLossPower(0.0);
+                        proEconWindturbineStatus2.setSpeed(speed);
+                        proEconWindturbineStatus2.setAvgSpeed(0.0);
+                        proEconWindturbineStatus2Service.updateById(proEconWindturbineStatus2);
+//                        resultList.add(proEconWindturbineStatus2);
+                    }else {
                         ProEconWindturbineStatus2 proEconWindturbineStatus2 = new ProEconWindturbineStatus2();
                         proEconWindturbineStatus2.setId(CommonUtils.getUUID());
                         proEconWindturbineStatus2.setWindpowerstationId(wt.getWindpowerstationid());
                         proEconWindturbineStatus2.setWindturbineId(wt.getId());
-                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
-                        proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(realData.getPointTime()*1000));
+                        proEconWindturbineStatus2.setStopTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
+                        proEconWindturbineStatus2.setStartTime(DateUtils.parseLongToDate(sdf.parse(DateUtils.toDate1(currentDate)).getTime()));
                         proEconWindturbineStatus2.setStopHours(DateUtils.hoursDiff2(proEconWindturbineStatus2.getStopTime(), proEconWindturbineStatus2.getStartTime()));
                         proEconWindturbineStatus2.setLossPower(0.0);
                         proEconWindturbineStatus2.setShutdownEventId("");
@@ -124,24 +146,115 @@ public class RealtimeService {
                         proEconWindturbineStatus2.setAvgSpeed(0.0);
                         String statusName = statusmxMap.get(new Double(aDouble).intValue());
                         proEconWindturbineStatus2.setStatusDesc(statusName);
-                        resultList.add(proEconWindturbineStatus2);
+//                        resultList.add(proEconWindturbineStatus2);
+                        proEconWindturbineStatus2Service.save(proEconWindturbineStatus2);
                     }
-
                 }
-
-
-
             } catch (Exception e) {
                 e.printStackTrace();
             }
 
         });
 
-        proEconWindturbineStatus2Service.saveOrUpdateBatch(resultList);
+//        proEconWindturbineStatus2Service.saveOrUpdateBatch(resultList);
 
     }
 
     public void saveWindstationStatus(String beginDate,String endDate) {
+
+        List<ProEconStationStatusmx> resultList = new ArrayList<>();
+        List<String> days = DateUtils.getDays(beginDate, endDate);
+        List<Windturbine> wtls = CacheContext.wtls;
+        Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
+        Set<Integer> status = statusmxMap.keySet();
+
+        days.stream().forEach(day->{
+            Date date = DateUtils.parseDate1(day);
+            Date addDays = DateUtils.addDays(date, 1);
+            Map<String,Object> delMap = new HashMap<>();
+            delMap.put("recorddate",date);
+            proEconStationStatusmxService.removeByMap(delMap);
+
+            wtls.stream().forEach(wt->{
+                QueryWrapper<ProEconWindturbineStatus2> qw =  new QueryWrapper<>();
+                qw.eq("windTurbine_Id",wt.getId());
+                qw.le("stop_Time",addDays).ge("start_Time",date);
+                List<ProEconWindturbineStatus2> windturbineStatus2s = proEconWindturbineStatus2Service.list(qw);
+                status.stream().forEach(sta->{
+                    ProEconStationStatusmx proEconStationStatusmx = new ProEconStationStatusmx();
+                    proEconStationStatusmx.setId(CommonUtils.getUUID());
+                    proEconStationStatusmx.setProjectId(wt.getProjectid());
+                    proEconStationStatusmx.setWindpowerstationId(wt.getWindpowerstationid());
+                    proEconStationStatusmx.setWindturbineId(wt.getId());
+                    proEconStationStatusmx.setRecorddate(date);
+                    proEconStationStatusmx.setStopHours(windturbineStatus2s.stream().filter(i->i.getSatusCode().equals(sta)).mapToDouble(ProEconWindturbineStatus2::getStopHours).sum());
+                    proEconStationStatusmx.setLossPower(0.0);
+                    proEconStationStatusmx.setSatusCode(sta);
+                    proEconStationStatusmx.setStatusDesc(statusmxMap.get(sta));
+                    proEconStationStatusmx.setAvgSpeed(0.0);
+                    resultList.add(proEconStationStatusmx);
+                });
+            });
+            proEconStationStatusmxService.saveBatch(resultList);
+        });
+
+
+
+
+
+
+
+//        List<ProEconStationStatusmx> resultList = new ArrayList<>();
+//        List<String> days = DateUtils.getDays(beginDate, endDate);
+//        List<Windturbine> wtls = CacheContext.wtls;
+//        Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
+//        Set<Integer> status = statusmxMap.keySet();
+//
+//        Map<String, Map<String, Windturbinetestingpointai>> wtpAimap = CacheContext.wtpAimap;
+//
+//        Date samedayZero = DateUtils.getSamedayZero();
+//        Date currentDate = DateUtils.getCurrentDate();
+////        Date befroeDate = DateUtils.addSeconds(currentDate,-1);
+////        Date befroeDate = DateUtils.addMinutes(currentDate,-5);
+//        days.forEach(day->{
+//            Date date = DateUtils.parseDate(day);
+//            Date addday = DateUtils.addDays(date, 1);
+//            wtls.stream().forEach(wt->{
+//                Map<String, Windturbinetestingpointai> stringWindturbinetestingpointaiMap = wtpAimap.get(wt.getId());
+//                Windturbinetestingpointai windturbinetestingpointai = stringWindturbinetestingpointaiMap.get(Contant.ZTMX);
+//                Windturbinetestingpointai windturbinetestingpointaifs = stringWindturbinetestingpointaiMap.get(Contant.AI022);
+//                try {
+//                    List<PointData> historyDatasSnap = edosUtil.getHistoryDatasSnap(windturbinetestingpointai, date.getTime() / 1000, addday.getTime() / 1000, null, 60l);
+//                    status.stream().forEach(sta->{
+//                        int minutes = historyDatasSnap.stream().filter(i -> i.getPointValueInDouble() == sta).collect(Collectors.toList()).size();
+//                        ProEconStationStatusmx proEconStationStatusmx = new ProEconStationStatusmx();
+//                        proEconStationStatusmx.setId(CommonUtils.getUUID());
+//                        proEconStationStatusmx.setProjectId(wt.getProjectid());
+//                        proEconStationStatusmx.setWindpowerstationId(wt.getWindpowerstationid());
+//                        proEconStationStatusmx.setWindturbineId(wt.getId());
+//                        proEconStationStatusmx.setRecorddate(date);
+//                        proEconStationStatusmx.setStopHours(DoubleUtils.keepPrecision(new Double(minutes)/60,2));
+//                        proEconStationStatusmx.setLossPower(0.0);
+//                        proEconStationStatusmx.setSatusCode(sta);
+//                        proEconStationStatusmx.setStatusDesc(statusmxMap.get(sta));
+//                        proEconStationStatusmx.setAvgSpeed(0.0);
+////                        proEconStationStatusmxService.save(proEconStationStatusmx);
+//                        resultList.add(proEconStationStatusmx);
+//                    });
+//                } catch (Exception e) {
+//                    e.printStackTrace();
+//                }
+//
+//            });
+//        });
+//
+//        proEconStationStatusmxService.saveBatch(resultList);
+
+
+    }
+
+    public void saveWindstationStatus1(String beginDate,String endDate) {
+
         List<ProEconStationStatusmx> resultList = new ArrayList<>();
         List<String> days = DateUtils.getDays(beginDate, endDate);
         List<Windturbine> wtls = CacheContext.wtls;
@@ -189,63 +302,9 @@ public class RealtimeService {
         proEconStationStatusmxService.saveBatch(resultList);
 
 
-
-//        List<Windturbine> wtls = CacheContext.wtls;
-//        Map<Integer, String> statusmxMap = CacheContext.statusmxMap;
-//        Set<Integer> status = statusmxMap.keySet();
-//        List<String> days = DateUtils.getDays(beginDate, endDate);
-//        days.forEach(day->{
-//            Date date = DateUtils.parseDate1(day);
-//            Date addDay = DateUtils.addDays(date, 1);
-//
-//            wtls.stream().forEach(wt->{
-//                QueryWrapper<ProEconWindturbineStatus2> qw = new QueryWrapper<>();
-//                qw.eq("windTurbine_Id",wt.getId());
-//                qw.ge("start_Time",date).lt("start_Time",addDay);
-//                List<ProEconWindturbineStatus2> proEconWindturbineStatus2s = proEconWindturbineStatus2Service.list(qw);
-//                if (StringUtils.isNotNull(proEconWindturbineStatus2s)){
-//                    status.stream().forEach(sta->{
-//                        List<ProEconWindturbineStatus2> collect = proEconWindturbineStatus2s.stream().filter(i -> i.getSatusCode() == sta).collect(Collectors.toList());
-//                        if (StringUtils.isNotNull(collect)){
-//                            double sum = collect.stream().mapToDouble(ProEconWindturbineStatus2::getStopHours).sum();
-//                            ProEconStationStatusmx proEconStationStatusmx = new ProEconStationStatusmx();
-//                            proEconStationStatusmx.setId(CommonUtils.getUUID());
-//                            proEconStationStatusmx.setProjectId(wt.getProjectid());
-//                            proEconStationStatusmx.setWindpowerstationId(wt.getWindpowerstationid());
-//                            proEconStationStatusmx.setWindturbineId(wt.getId());
-//                            proEconStationStatusmx.setRecorddate(date);
-//                            proEconStationStatusmx.setStopHours(sum);
-//                            proEconStationStatusmx.setLossPower(0.0);
-//                            proEconStationStatusmx.setSatusCode(sta);
-//                            proEconStationStatusmx.setStatusDesc(statusmxMap.get(sta));
-//                            proEconStationStatusmx.setAvgSpeed(0.0);
-//                        }else{
-//
-//                        }
-//                    });
-//                }else{
-//
-//                }
-//                qw.clear();
-//                qw.eq("windTurbine_Id",wt.getId());
-//                qw.ge("stop_Time",date).lt("start_Time",addDay);
-//
-//                proEconWindturbineStatus2s.stream().forEach(data->{
-//
-//                });
-//
-//
-//            });
-//
-//        });
-
-
-
-
-
-
     }
 
+
     /**
      * 获取两日期间日期list
      *
@@ -253,14 +312,21 @@ public class RealtimeService {
      * @param endDate
      * @return
      */
-    private List<String> getDays(String beginDate, String endDate) {
-        List<String> days = null;
-        if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate)) {
-            days = DateUtils.getDays(beginDate, endDate);
-        } else {
-            days = new ArrayList<>();
-            days.add(DateUtils.getYesterdayStr("yyyy-MM-dd"));
+    private boolean isEq(String beginDate, String endDate) throws ParseException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+
+
+
+        Date date1 = sdf.parse(beginDate);
+
+        Date date2 = sdf.parse(endDate);
+
+        if(date1.equals(date2)) {
+
+            return true;
+
+        }else {
+            return false;
         }
-        return days;
     }
 }

+ 2 - 1
web/gdsx-ghost/src/main/java/com/gyee/ghost/task/SaticScheduleTask.java

@@ -55,6 +55,7 @@ public class SaticScheduleTask {
 
     //或直接指定时间间隔,例如:5秒
 //    @Scheduled(fixedRate=300000)
+    @Scheduled(cron = "0 0/5 * * * ?")
     private void status() {
         try {
             realtimeService.saveWindturbineStatus2();
@@ -69,7 +70,7 @@ public class SaticScheduleTask {
     private void statustj() {
         String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
         try {
-            realtimeService.saveWindstationStatus(yesterday,yesterday);
+            realtimeService.saveWindstationStatus1(yesterday,yesterday);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 2 - 2
web/gdsx-ghost/src/test/java/com/gyee/ghost/GhostTest.java

@@ -28,8 +28,8 @@ public class GhostTest {
     public void test1(){
                 String yesterday = DateUtils.getYesterdayStr("yyyy-MM-dd");
         try {
-//            realtimeService.saveWindturbineStatus2();
-            realtimeService.saveWindstationStatus(yesterday,yesterday);
+            realtimeService.saveWindturbineStatus2();
+//            realtimeService.saveWindstationStatus(yesterday,yesterday);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 76 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/ElePerAnalysis.java

@@ -0,0 +1,76 @@
+package com.gyee.frame.controller.peranalysis;
+
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.custom.ElePerAnalysisVo;
+import com.gyee.frame.service.peranalysis.ElePerAnalysisService;
+import com.gyee.frame.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@RequestMapping("/eleperanalysis")
+@Api(value = "月电量分析", tags = "月电量分析")
+public class ElePerAnalysis {
+
+
+    @Autowired
+    private ElePerAnalysisService elePerAnalysisService;
+
+    /**
+     * 月电量分析
+     *
+     * @param companyid
+     * @param regionid
+     * @param station
+     * @param year
+     * @param month
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/geteleperanalysislist")
+    @ResponseBody
+    @ApiOperation(value = "月电量分析", notes = "月电量分析")
+    public AjaxResult ElePerAnalysisList(
+            @RequestParam(value = "companyid", required = false) String companyid,
+            @RequestParam(value = "regionid", required = false) String regionid,
+            @RequestParam(value = "station", required = false) String station,
+            @RequestParam(value = "year", required = false) String year,
+            @RequestParam(value = "month", required = false) String month
+    ) throws Exception {
+
+        List<ElePerAnalysisVo> vos = new ArrayList<>();
+        if (StringUtils.notEmp(station) && StringUtils.notEmp(year) && StringUtils.notEmp(month)) {
+
+            Calendar cal = Calendar.getInstance();
+            cal.set(Calendar.HOUR_OF_DAY, 0);
+            cal.set(Calendar.MINUTE, 0);
+            cal.set(Calendar.SECOND, 0);
+            cal.set(Calendar.MILLISECOND, 0);
+
+            cal.set(Calendar.YEAR, Integer.valueOf(year));
+            cal.set(Calendar.MONTH, Integer.valueOf(month) - 1);
+            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMinimum(Calendar.DAY_OF_MONTH));
+            Date beginDate = cal.getTime();
+            cal.add(Calendar.MONTH, 1);
+            Date endDate = cal.getTime();
+            vos = elePerAnalysisService.getElePerAnalysisList(companyid, regionid, station, beginDate, endDate);
+        }
+
+        if (null != vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+
+    }
+
+
+}

+ 83 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/PointPerSis.java

@@ -0,0 +1,83 @@
+package com.gyee.frame.controller.peranalysis;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.auto.Freedom;
+import com.gyee.frame.model.custom.PointPerSisVo;
+import com.gyee.frame.service.peranalysis.PointPerSisService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/pointpersis")
+@Api(value = "测点曲线分析", tags = "测点曲线分析")
+public class PointPerSis {
+
+
+    @Autowired
+    private PointPerSisService pointPerSisService;
+
+
+    /**
+     * 测点曲线分析
+     * @param wtid
+     * @param beginDate
+     * @param endDate
+     * @param interval
+     * @param uniformcodes
+     * @return
+     */
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    @GetMapping(value = "/getPointPerSisList")
+    public AjaxResult getPointPerSisList(
+            @RequestParam(value = "wtid",required = true)String wtid,
+            @RequestParam(value = "beginDate",required = true)Long beginDate,
+            @RequestParam(value = "endDate",required = true)Long endDate,
+            @RequestParam(value = "interval",required = true)Integer interval,
+            @RequestParam(value = "uniformcodes",required = true)String uniformcodes
+
+    ){
+        try {
+            List<PointPerSisVo> list =  pointPerSisService.freedomList(wtid,beginDate,endDate,interval,uniformcodes);
+
+            if (null != list){
+                return AjaxResult.successData(AjaxStatus.success.code, list);
+            }else {
+                return AjaxResult.successData(AjaxStatus.error.code, "操作失败");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.successData(AjaxStatus.error.code, "系统异常");
+        }
+    }
+
+
+    /**
+     * 获取测点
+     * @return
+     */
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    @GetMapping(value = "/getpoints")
+    public AjaxResult getpoints(
+
+    ){
+        try {
+            List<Freedom>  list =  pointPerSisService.points();
+
+            if (null != list){
+                return AjaxResult.successData(AjaxStatus.success.code, list);
+            }else {
+                return AjaxResult.successData(AjaxStatus.error.code, "操作失败");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.successData(AjaxStatus.error.code, "系统异常");
+        }
+    }
+
+
+
+}

+ 53 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/peranalysis/StationPersis.java

@@ -0,0 +1,53 @@
+package com.gyee.frame.controller.peranalysis;
+
+import com.gyee.frame.common.conf.AjaxStatus;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.custom.StationPersisVo;
+import com.gyee.frame.service.WindpowerstationService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+@RestController
+@RequestMapping("/stationPersis")
+@Api(value = "场站性能分析", tags = "场站性能分析")
+public class StationPersis {
+
+    @Autowired
+    private WindpowerstationService windpowerstationService;
+
+    /**
+     * 场站性能分析
+     * @param station
+     * @param startdate
+     * @param enddate
+     */
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    @GetMapping(value = "/getStationPersis")
+    public AjaxResult getStationPersis(
+            @RequestParam(value = "station",required = false) String station,
+            @RequestParam(value = "startdate",required = false) String startdate,
+            @RequestParam(value = "enddate",required = false) String enddate){
+        try {
+
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date startdt = simpleDateFormat.parse(startdate);
+            Date enddt = simpleDateFormat.parse(enddate);
+
+            List<StationPersisVo> list =   windpowerstationService.getStationPersis(station,startdt,enddt);
+
+            if (null != list){
+                return AjaxResult.successData(AjaxStatus.success.code, list);
+            }else {
+                return AjaxResult.successData(AjaxStatus.error.code, "操作失败");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.successData(AjaxStatus.error.code, "系统异常");
+        }
+    }
+}

+ 16 - 19
web/monitor-web-sxjn/src/main/java/com/gyee/frame/controller/warn/ShutdowneventController.java

@@ -12,15 +12,11 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 
-@Controller
+@RestController
 @RequestMapping("/event")
 @Api(value = "停机事件", tags = "停机事件")
 public class ShutdowneventController {
@@ -70,7 +66,8 @@ public class ShutdowneventController {
 
     /**
      * 长停分析
-     * @param tablepar
+     * @param pageNum
+     * @param pageSize
      * @param wpId
      * @param wtId
      * @param beginDate
@@ -79,22 +76,22 @@ public class ShutdowneventController {
      * @return
      * @throws Exception
      */
-    @PostMapping("/getLonShutdownevent")
-    @ResponseBody
+    @GetMapping("/getLonShutdownevent")
     @ApiOperation(value = "长停事件查询", notes = "长停事件查询")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "tablepar", value = "分页控件", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query"),
-            @ApiImplicitParam(name = "type", value = "类型", required = false, dataType = "string", paramType = "query")})
-    public AjaxResult getLonShutdownevent(@RequestBody  Tablepar tablepar, String wpId, String wtId, String beginDate, String endDate, String type) throws Exception {
+    public AjaxResult getLonShutdownevent(
+            @RequestParam(value = "pageNum", required = true) Integer pageNum,
+            @RequestParam(value = "pageSize", required = true) Integer pageSize,
+            @RequestParam(value = "wpId", required = false) String wpId,
+            @RequestParam(value = "wtId", required = false) String wtId,
+            @RequestParam(value = "beginDate", required = true) String beginDate,
+            @RequestParam(value = "endDate", required = true) String endDate,
+            @RequestParam(value = "type", required = false) String type
+    ) throws Exception {
 
         PageInfo<ShutdowneventVo> result=new PageInfo<>() ;
-        if (StringUtils.notEmp(tablepar) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
+        if (StringUtils.notEmp(pageNum) && StringUtils.notEmp(pageSize) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
 
-            result=shutdowneventService.getLongShutdownevent(tablepar, wpId, wtId, DateUtils.parseDate(beginDate), DateUtils.parseDate(endDate), type);
+            result=shutdowneventService.getLongShutdownevent(pageNum,pageSize, wpId, wtId, DateUtils.parseDate(beginDate), DateUtils.parseDate(endDate), type);
 
         }
         if (null != result) {

+ 3 - 3
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/auto/Windpowerinfoday.java

@@ -11,7 +11,7 @@ public class Windpowerinfoday implements Serializable {
      *
      * @mbg.generated
      */
-    private Integer id;
+    private long id;
 
     /**
      *
@@ -857,7 +857,7 @@ public class Windpowerinfoday implements Serializable {
      *
      * @mbg.generated
      */
-    public Integer getId() {
+    public long getId() {
         return id;
     }
 
@@ -869,7 +869,7 @@ public class Windpowerinfoday implements Serializable {
      *
      * @mbg.generated
      */
-    public void setId(Integer id) {
+    public void setId(long id) {
         this.id = id;
     }
 

+ 39 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/ElePerAnalysisVo.java

@@ -0,0 +1,39 @@
+package com.gyee.frame.model.custom;
+
+import lombok.Data;
+
+@Data
+public class ElePerAnalysisVo {
+
+    //场站id
+    private String id;
+
+    //场站名称
+    private String name;
+
+    //发电量
+    private double generation;
+
+    //风速
+    private double fs;
+
+    //计划发电量
+    private double generatingcapacity;
+
+    //运行
+    private double runhours;
+
+    //停机
+    private double stophours;
+
+    //故障小时
+    private double faulthours;
+
+    //完成率
+    private double finishrate;
+
+
+    public double getFinishrate() {
+        return generation/generatingcapacity;
+    }
+}

+ 16 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/PointPerSisVo.java

@@ -0,0 +1,16 @@
+package com.gyee.frame.model.custom;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+@Data
+public class PointPerSisVo {
+
+    private String wtid;
+
+    private Map<String, List<PointData>> pointDataMap;
+
+
+}

+ 14 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/model/custom/StationPersisVo.java

@@ -0,0 +1,14 @@
+package com.gyee.frame.model.custom;
+
+import lombok.Data;
+
+@Data
+public class StationPersisVo {
+
+
+    private long datatime;//时间戳
+    private double rpjfs;//风速
+    private double sszgl;//功率
+
+
+}

+ 79 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/ProjectplanPGService.java

@@ -0,0 +1,79 @@
+package com.gyee.frame.service;
+
+import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.common.dataSources.DataSource;
+import com.gyee.frame.common.dataSources.DataSourceType;
+import com.gyee.frame.mapper.auto.ProjectplanPGMapper;
+import com.gyee.frame.model.auto.ProjectplanPG;
+import com.gyee.frame.model.auto.ProjectplanPGExample;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class ProjectplanPGService implements BaseService<ProjectplanPG, ProjectplanPGExample> {
+
+    @Resource
+    private ProjectplanPGMapper projectplanPGMapper;
+    @Override
+    public int deleteByPrimaryKey(String id) {
+        return 0;
+    }
+
+    @Override
+    public int insertSelective(ProjectplanPG record) {
+        return 0;
+    }
+
+    @Override
+    public ProjectplanPG selectByPrimaryKey(String id) {
+        return null;
+    }
+
+    @Override
+    public int updateByPrimaryKeySelective(ProjectplanPG record) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExampleSelective(ProjectplanPG record, ProjectplanPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExample(ProjectplanPG record, ProjectplanPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public List<ProjectplanPG> selectByExample(ProjectplanPGExample example) {
+        return null;
+    }
+
+    @Override
+    public long countByExample(ProjectplanPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public int deleteByExample(ProjectplanPGExample example) {
+        return 0;
+    }
+
+
+    @DataSource(value = DataSourceType.SLAVE)
+    public List<ProjectplanPG> findProjectplanPG(String station,String year,String month) {
+
+        List<ProjectplanPG> list=new ArrayList<>();
+        ProjectplanPGExample example=new ProjectplanPGExample();
+        ProjectplanPGExample.Criteria criteria =example.createCriteria();
+        criteria.andWindpowerEqualTo(station);
+        criteria.andYearEqualTo(year);
+        criteria.andMonthEqualTo(month);
+        list= projectplanPGMapper.selectByExample(example);
+        return list;
+
+    }
+}

+ 81 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/RegionPGService.java

@@ -0,0 +1,81 @@
+package com.gyee.frame.service;
+
+
+import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.common.dataSources.DataSource;
+import com.gyee.frame.common.dataSources.DataSourceType;
+import com.gyee.frame.mapper.auto.RegionPGMapper;
+import com.gyee.frame.model.auto.RegionPG;
+import com.gyee.frame.model.auto.RegionPGExample;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class RegionPGService implements BaseService<RegionPG, RegionPGExample> {
+
+    @Resource
+    private RegionPGMapper regionPGMapper;
+    @Override
+    public int deleteByPrimaryKey(String id) {
+        return 0;
+    }
+
+    @Override
+    public int insertSelective(RegionPG record) {
+        return 0;
+    }
+
+    @Override
+    public RegionPG selectByPrimaryKey(String id) {
+        return null;
+    }
+
+    @Override
+    public int updateByPrimaryKeySelective(RegionPG record) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExampleSelective(RegionPG record, RegionPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExample(RegionPG record, RegionPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public List<RegionPG> selectByExample(RegionPGExample example) {
+        return null;
+    }
+
+    @Override
+    public long countByExample(RegionPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public int deleteByExample(RegionPGExample example) {
+        return 0;
+    }
+
+
+    @DataSource(value = DataSourceType.SLAVE)
+    public List<RegionPG> findRegionPG() {
+
+        List<RegionPG> list=new ArrayList<>();
+
+        RegionPGExample example=new RegionPGExample();
+        example.setOrderByClause(" id asc");
+
+        RegionPGExample.Criteria criteria =example.createCriteria();
+        criteria.andCompanyidEqualTo("QJNY");
+        list= regionPGMapper.selectByExample(example);
+        return list;
+
+    }
+}

+ 35 - 50
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/ShutdowneventService.java

@@ -26,78 +26,78 @@ import java.util.*;
 public class ShutdowneventService implements BaseService<Shutdownevent, ShutdowneventExample> {
 	@Resource
 	private ShutdowneventMapper shutdowneventMapper;
-	
+
 
 	@Override
 	public int deleteByPrimaryKey(String ids) {
-				
-			List<String> lista=Convert.toListStrArray(ids);
-			ShutdowneventExample example=new ShutdowneventExample();
-			example.createCriteria().andIdIn(lista);
-			return shutdowneventMapper.deleteByExample(example);
-			
-				
+
+		List<String> lista=Convert.toListStrArray(ids);
+		ShutdowneventExample example=new ShutdowneventExample();
+		example.createCriteria().andIdIn(lista);
+		return shutdowneventMapper.deleteByExample(example);
+
+
 	}
-	
-	
+
+
 	@Override
 	public Shutdownevent selectByPrimaryKey(String id) {
-				
-			return shutdowneventMapper.selectByPrimaryKey(id);
-				
+
+		return shutdowneventMapper.selectByPrimaryKey(id);
+
 	}
 
-	
+
 	@Override
 	public int updateByPrimaryKeySelective(Shutdownevent record) {
 		return shutdowneventMapper.updateByPrimaryKeySelective(record);
 	}
-	
-	
+
+
 	/**
 	 * 添加
 	 */
 	@Override
 	public int insertSelective(Shutdownevent record) {
-				
+
 		//添加雪花主键id
 		record.setId(SnowflakeIdWorker.getUUID());
-			
-				
+
+
 		return shutdowneventMapper.insertSelective(record);
 	}
-	
-	
+
+
 	@Override
 	public int updateByExampleSelective(Shutdownevent record, ShutdowneventExample example) {
-		
+
 		return shutdowneventMapper.updateByExampleSelective(record, example);
 	}
 
-	
+
 	@Override
 	public int updateByExample(Shutdownevent record, ShutdowneventExample example) {
-		
+
 		return shutdowneventMapper.updateByExample(record, example);
 	}
 
 	@Override
 	public List<Shutdownevent> selectByExample(ShutdowneventExample example) {
-		
+
 		return shutdowneventMapper.selectByExample(example);
 	}
 
-	
+
 	@Override
 	public long countByExample(ShutdowneventExample example) {
-		
+
 		return shutdowneventMapper.countByExample(example);
 	}
 
-	
+
 	@Override
 	public int deleteByExample(ShutdowneventExample example) {
-		
+
 		return shutdowneventMapper.deleteByExample(example);
 	}
 
@@ -328,9 +328,9 @@ public class ShutdowneventService implements BaseService<Shutdownevent, Shutdown
 			String  eString = formatter.format(endDate);
 			criteria.andStoptimeGreaterThanOrEqualTo2(bString).andStoptimeLessThanOrEqualTo2(eString);
 			criteria.andStophoursIsNotNull();
-		//	criteria.andStoptypeidNotEqualTo("wh");
-		//	criteria.andStoptypeidNotEqualTo("other");
-		//	criteria.andStoptypeidNotEqualTo("gzbmq");
+			//	criteria.andStoptypeidNotEqualTo("wh");
+			//	criteria.andStoptypeidNotEqualTo("other");
+			//	criteria.andStoptypeidNotEqualTo("gzbmq");
 			criteria.andStophoursLessThan(Double.valueOf(24*7));
 			list= shutdowneventMapper.selectByExample(example);
 
@@ -546,27 +546,12 @@ public class ShutdowneventService implements BaseService<Shutdownevent, Shutdown
 
 	}
 
-	public PageInfo<ShutdowneventVo> getLongShutdownevent(Tablepar tablepar,String wpId,String wtId, Date beginDate, Date endDate,String type)  {
+	public PageInfo<ShutdowneventVo> getLongShutdownevent(int pageNum,int pageSize,String wpId,String wtId, Date beginDate, Date endDate,String type)  {
 
 		PageInfo<ShutdowneventVo> pageInfo=new PageInfo<>();
 		List<Shutdownevent> list =new ArrayList<>();
 		ShutdowneventExample example=new ShutdowneventExample();
 		String order =null;
-		if(StringUtils.isNotEmpty(tablepar.getOrderByColumn()))
-		{
-			StringBuilder sb=new StringBuilder();
-			sb.append(" ").append(tablepar.getOrderByColumn());
-			if(StringUtils.isNotEmpty(tablepar.getIsAsc()))
-			{
-				sb.append(" ").append(tablepar.getIsAsc());
-			}else
-			{
-				sb.append(" asc ");
-			}
-			order=String.valueOf(sb);
-		}else {
-			order=" stoptime desc";
-		}
 
 		ShutdowneventExample.Criteria criteria =example.createCriteria();
 
@@ -584,12 +569,12 @@ public class ShutdowneventService implements BaseService<Shutdownevent, Shutdown
 			criteria.andStatuscodeEqualTo(Integer.valueOf(type));
 		}
 
-		criteria.andStophoursGreaterThanOrEqualTo(168.00);//长停168小时
+		criteria.andStophoursGreaterThanOrEqualTo(10.00);//长停168小时
 
 		criteria.andStoptimeGreaterThanOrEqualTo(beginDate).andStoptimeLessThanOrEqualTo(endDate);
 
 
-		PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
+		PageHelper.startPage(pageNum, pageSize);
 		list= shutdowneventMapper.selectByExample(example);
 		List<ShutdowneventVo> sdelist=new ArrayList<>();
 

+ 14 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerinfodayService.java

@@ -141,4 +141,18 @@ public class WindpowerinfodayService implements BaseService<Windpowerinfoday, Wi
 		return list;
 
 	}
+
+	public List<Windpowerinfoday> getWindpowerinfodayList2(String station, Date beginDate, Date endDate) {
+
+		List<Windpowerinfoday> list = new ArrayList<>();
+		if (StringUtils.notEmp(station) && StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate)) {
+			WindpowerinfodayExample example = new WindpowerinfodayExample();
+			WindpowerinfodayExample.Criteria criteria = example.createCriteria();
+			criteria.andRecorddateGreaterThanOrEqualTo(beginDate).andRecorddateLessThan(endDate);
+			criteria.andForeignkeyidEqualTo(station);
+			list = windpowerinfodayMapper.selectByExample(example);
+		}
+		return list;
+
+	}
 }

+ 94 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationPGService.java

@@ -0,0 +1,94 @@
+package com.gyee.frame.service;
+
+import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.common.dataSources.DataSource;
+import com.gyee.frame.common.dataSources.DataSourceType;
+import com.gyee.frame.mapper.auto.WindpowerstationPGMapper;
+import com.gyee.frame.model.auto.WindpowerstationPG;
+import com.gyee.frame.model.auto.WindpowerstationPGExample;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class WindpowerstationPGService implements BaseService<WindpowerstationPG, WindpowerstationPGExample> {
+
+    @Resource
+    private WindpowerstationPGMapper windpowerstationPGMapper;
+    @Override
+    public int deleteByPrimaryKey(String id) {
+        return 0;
+    }
+
+    @Override
+    public int insertSelective(WindpowerstationPG record) {
+        return 0;
+    }
+
+    @Override
+    public WindpowerstationPG selectByPrimaryKey(String id) {
+        return null;
+    }
+
+    @Override
+    public int updateByPrimaryKeySelective(WindpowerstationPG record) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExampleSelective(WindpowerstationPG record, WindpowerstationPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExample(WindpowerstationPG record, WindpowerstationPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public List<WindpowerstationPG> selectByExample(WindpowerstationPGExample example) {
+        return null;
+    }
+
+    @Override
+    public long countByExample(WindpowerstationPGExample example) {
+        return 0;
+    }
+
+    @Override
+    public int deleteByExample(WindpowerstationPGExample example) {
+        return 0;
+    }
+
+
+    @DataSource(value = DataSourceType.SLAVE)
+    public List<WindpowerstationPG> findWindpowerstationPG(String companyid,String regionid,String station ) {
+
+        List<WindpowerstationPG> list=new ArrayList<>();
+
+        WindpowerstationPGExample example=new WindpowerstationPGExample();
+        example.setOrderByClause(" id asc");
+        WindpowerstationPGExample.Criteria criteria =example.createCriteria();
+        if(null != companyid){
+            criteria.andCompanyidEqualTo(companyid);
+        }
+        if(null != regionid){
+            criteria.andRegionidEqualTo(regionid);
+        }
+        if(null != regionid){
+            criteria.andRegionidEqualTo(regionid);
+        }
+
+
+
+        list= windpowerstationPGMapper.selectByExample(example);
+        return list;
+
+    }
+
+
+
+
+}

+ 47 - 6
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/WindpowerstationService.java

@@ -1,13 +1,21 @@
 package com.gyee.frame.service;
 
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.common.cache.IGlobalCache;
 import com.gyee.frame.common.support.Convert;
 import com.gyee.frame.mapper.auto.WindpowerstationMapper;
 import com.gyee.frame.model.auto.Windpowerstation;
 import com.gyee.frame.model.auto.WindpowerstationExample;
+import com.gyee.frame.model.auto.Windpowerstationpointnew;
+import com.gyee.frame.model.custom.PointData;
+import com.gyee.frame.model.custom.StationPersisVo;
 import com.gyee.frame.model.custom.Tablepar;
+import com.gyee.frame.util.IRealTimeDataBaseUtil;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
 import com.gyee.frame.util.SnowflakeIdWorker;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.cache.annotation.CacheConfig;
@@ -15,10 +23,7 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 风场 WindpowerstationService
@@ -34,8 +39,11 @@ import java.util.Map;
 public class WindpowerstationService implements BaseService<Windpowerstation, WindpowerstationExample> {
 	@Resource
 	private WindpowerstationMapper windpowerstationMapper;
-	
-      	   	      	      	      	      	      	      	      	      	      	
+
+	@Resource
+	private IGlobalCache globalCache;
+
+	IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
 	/**
 	 * 分页查询
 	 * @param tablepar
@@ -164,4 +172,37 @@ public class WindpowerstationService implements BaseService<Windpowerstation, Wi
 
 		return list;
 	}
+
+
+
+	public List<StationPersisVo> getStationPersis(String station, Date startdate, Date enddate) throws Exception {
+
+		List<StationPersisVo> list = new ArrayList<>();
+		String wpString = JSONObject.toJSONString(globalCache.get(station));
+
+		Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+		});
+		if (null != stringMapMap) {
+			String fs = stringMapMap.get("RPJFS").getCode();//日平局风速
+			List<PointData> fss = realApiUtil.getHistoryDatasSnap(fs, startdate.getTime(), enddate.getTime(), null, 60000L);
+			String gl = stringMapMap.get("SSZGL").getCode();//功率
+			List<PointData> gls = realApiUtil.getHistoryDatasSnap(gl, startdate.getTime(), enddate.getTime(), null, 60000L);
+			if (!fss.isEmpty() && !gls.isEmpty()) {
+
+				for (int i =0; i <= fss.size()-1; i++) {
+					StationPersisVo vo = new StationPersisVo();
+					vo.setDatatime(fss.get(i).getPointTime());
+					vo.setRpjfs(fss.get(i).getPointValueInDouble());
+					vo.setSszgl(gls.get(i).getPointValueInDouble());
+					list.add(vo);
+				}
+			}
+		}
+
+		return list;
+	}
+
+
+
+
 }

+ 98 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/ElePerAnalysisService.java

@@ -0,0 +1,98 @@
+package com.gyee.frame.service.peranalysis;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.gyee.frame.common.cache.IGlobalCache;
+import com.gyee.frame.model.auto.ProjectplanPG;
+import com.gyee.frame.model.auto.Windpowerinfoday;
+import com.gyee.frame.model.auto.WindpowerstationPG;
+import com.gyee.frame.model.auto.Windpowerstationpointnew;
+import com.gyee.frame.model.custom.DNAVal;
+import com.gyee.frame.model.custom.ElePerAnalysisVo;
+import com.gyee.frame.service.*;
+import com.gyee.frame.util.IRealTimeDataBaseUtil;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@Service
+public class ElePerAnalysisService {
+
+
+    @Resource
+    private IGlobalCache globalCache;
+
+    @Autowired
+    private WindpowerinfodayService windpowerinfodayService;
+//
+//    @Autowired
+//    private CompanysPGService companysPGService;
+//
+//    @Autowired
+//    private RegionPGService regionPGService;
+
+    @Autowired
+    private ProjectplanPGService projectplanPGService;
+
+    @Autowired
+    private WindpowerstationPGService windpowerstationPGService;
+
+    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
+
+
+    public List<ElePerAnalysisVo> getElePerAnalysisList(String companyid, String regionid, String station, Date beginDate, Date endDate) throws Exception {
+
+
+        List<ElePerAnalysisVo> vos = new ArrayList<>();
+
+        List<WindpowerstationPG> list = windpowerstationPGService.findWindpowerstationPG(companyid, regionid, station);
+        for (WindpowerstationPG wp : list) {
+            String wpString = JSONObject.toJSONString(globalCache.get(station));
+            Map<String, Windpowerstationpointnew> stringMapMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windpowerstationpointnew>>() {
+            });
+
+
+            Calendar calendar = Calendar.getInstance();
+            calendar.setTime(beginDate);
+
+
+            List<ProjectplanPG> pgList = projectplanPGService.findProjectplanPG(station, String.valueOf(calendar.get(Calendar.YEAR)), String.valueOf(calendar.get(Calendar.MONTH)));
+            //(风场、发电量 YFDL、风速 YPJFS、计划发电量、发电小时、停机小时、故障小时、电量完成率)
+            ElePerAnalysisVo vo = new ElePerAnalysisVo();
+            vo.setId(wp.getId());
+            vo.setName(wp.getName());
+            // 获得测点
+            String[] points = new String[2];
+            if (null != stringMapMap) {
+                points[0]= stringMapMap.get("YPJFS").getCode();//月平局风速
+                calendar.setTime(endDate);
+                calendar.add(Calendar.SECOND, -2);
+                long newend = calendar.getTimeInMillis() / 1000;
+                points[0] = stringMapMap.get("YFDL").getCode();//发电量
+
+                DNAVal[] jkvalues = realApiUtil.getHistMatrix(points, newend);
+                if (null != jkvalues && jkvalues.length>0) {
+                    vo.setFs(jkvalues[0].DValue);
+                    vo.setGeneration(jkvalues[1].DValue);
+                }
+                vo.setGeneratingcapacity(Double.valueOf(pgList.get(0).getGeneratingcapacity()));
+            }
+
+            List<Windpowerinfoday> windpowerinfodayList = windpowerinfodayService.getWindpowerinfodayList2(station, beginDate, endDate);
+            Double runhourssum = windpowerinfodayList.stream().filter(n -> null!=n.getRunhours()).mapToDouble(Windpowerinfoday::getRunhours).sum();
+            Double stophourssum = windpowerinfodayList.stream().filter(n->null!= n.getStophours()).mapToDouble(Windpowerinfoday::getStophours).sum();
+            Double faulthourssum = windpowerinfodayList.stream().filter(n->null!= n.getFaulthours()).mapToDouble(Windpowerinfoday::getFaulthours).sum();
+            vo.setRunhours(runhourssum);
+            vo.setStophours(stophourssum);
+            vo.setFaulthours(faulthourssum);
+            vos.add(vo);
+        }
+
+        return vos;
+
+    }
+}

+ 69 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/FreedomService.java

@@ -0,0 +1,69 @@
+package com.gyee.frame.service.peranalysis;
+
+
+import com.gyee.frame.common.base.BaseService;
+import com.gyee.frame.mapper.auto.FreedomMapper;
+import com.gyee.frame.model.auto.Freedom;
+import com.gyee.frame.model.auto.FreedomExample;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class FreedomService implements BaseService<Freedom, FreedomExample> {
+
+    @Autowired
+    private FreedomMapper freedomMapper;
+
+    @Override
+    public int deleteByPrimaryKey(String id) {
+        return 0;
+    }
+
+    @Override
+    public int insertSelective(Freedom record) {
+        return 0;
+    }
+
+    @Override
+    public Freedom selectByPrimaryKey(String id) {
+        return null;
+    }
+
+    @Override
+    public int updateByPrimaryKeySelective(Freedom record) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExampleSelective(Freedom record, FreedomExample example) {
+        return 0;
+    }
+
+    @Override
+    public int updateByExample(Freedom record, FreedomExample example) {
+        return 0;
+    }
+
+    @Override
+    public List<Freedom> selectByExample(FreedomExample example) {
+        return null;
+    }
+
+    @Override
+    public long countByExample(FreedomExample example) {
+        return 0;
+    }
+
+    @Override
+    public int deleteByExample(FreedomExample example) {
+        return 0;
+    }
+
+    public List<Freedom> selectAll() {
+        FreedomExample example = new FreedomExample();
+        return freedomMapper.selectByExample(example);
+
+    }
+}

+ 73 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/peranalysis/PointPerSisService.java

@@ -0,0 +1,73 @@
+package com.gyee.frame.service.peranalysis;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.gyee.frame.common.cache.IGlobalCache;
+import com.gyee.frame.model.auto.Freedom;
+import com.gyee.frame.model.auto.Windpowerstationpointnew;
+import com.gyee.frame.model.auto.Windturbinetestingpointnew;
+import com.gyee.frame.model.custom.PointData;
+import com.gyee.frame.model.custom.PointPerSisVo;
+import com.gyee.frame.util.*;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+
+@Service
+public class PointPerSisService {
+
+    @Resource
+    private IGlobalCache globalCache;
+
+    @Resource
+    private FreedomService freedomService;
+
+
+    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
+
+    public List<PointPerSisVo> freedomList(String wtid, Long beginDate, Long endDate, Integer interval, String uniformcodes) throws Exception {
+        List<PointPerSisVo> vos = new ArrayList<>();
+
+        {
+
+            String[] wtids = wtid.split(",");
+            for (String w : wtids) {
+                String[] codes = uniformcodes.split(",");
+
+                String wpString = (String) (globalCache.get(w));
+
+                Map<String, Windturbinetestingpointnew> windturbinetestingpointnewMap = JSONObject.parseObject(wpString, new TypeReference<Map<String, Windturbinetestingpointnew>>() {
+                });
+
+
+                PointPerSisVo vo = new PointPerSisVo();
+                vo.setWtid(w);
+
+                Map<String, List<PointData>> pointDataMap = new HashMap<>();
+                for (int i = 0; i < codes.length; i++) {
+                    Windturbinetestingpointnew windturbinetestingpointai = windturbinetestingpointnewMap.get(StringUtils.upperCase(codes[i]));
+                    if (StringUtils.isNotNull(windturbinetestingpointai)) {
+                        try {
+                            List<PointData> historyDatas = realApiUtil.getHistoryDatasSnap(windturbinetestingpointai, beginDate / 1000, endDate / 1000, null, interval * 60l);
+                            pointDataMap.put(codes[i], historyDatas);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                }
+
+                vo.setPointDataMap(pointDataMap);
+                vos.add(vo);
+            }
+
+            return vos;
+
+        }
+    }
+
+
+    public List<Freedom> points() {
+        return freedomService.selectAll();
+    }
+}

+ 36 - 29
web/monitor-web-sxjn/src/main/java/com/gyee/frame/service/websocket/GenreSetPushService.java

@@ -2171,35 +2171,42 @@ public class GenreSetPushService {
                 newpointmap.put("gf_y_jhfdl",StringUtils.round(gf_y_jhfdl,2));
                 //光伏年计划发电量
                 newpointmap.put("gf_n_jhfdl",StringUtils.round(gf_n_jhfdl,2));
-
-                if(jr_gf_zjrl!=0)
-                {
-                    double gffhl= new BigDecimal(jr_gf_sjgl).divide(new BigDecimal(jr_gf_zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
-                    //光伏功率负荷率
-                    newpointmap.put("gf_fhl",StringUtils.round(gffhl*100,2));
-                }else
-                {
-                    newpointmap.put("gf_fhl",0.0);
-                }
-                if(jr_fd_zjrl!=0)
-                {
-                    double fdfhl= new BigDecimal(jr_fd_sjgl).divide(new BigDecimal(jr_fd_zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
-                    //风电功率负荷率
-                    newpointmap.put("fd_fhl",StringUtils.round(fdfhl*100,2));
-                }else
-                {
-                    newpointmap.put("fd_fhl",0.0);
-                }
-
-                if((jr_gf_zjrl+jr_fd_zjrl)!=0)
-                {
-                    double fdfhl= new BigDecimal(jr_gf_sjgl+jr_fd_sjgl).divide(new BigDecimal(jr_gf_zjrl+jr_fd_zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
-                    //清洁能源功率负荷率
-                    newpointmap.put("qjny_fhl",StringUtils.round(fdfhl*100,2));
-                }else
-                {
-                    newpointmap.put("qjny_fhl",0.0);
-                }
+                //光伏负荷率
+                newpointmap.put("gf_fhl",StringUtils.round(jr_gf_sjgl,2));
+
+                newpointmap.put("fd_fhl",StringUtils.round(jr_fd_sjgl,2));
+
+                //清洁能源功率负荷率
+                newpointmap.put("qjny_fhl",StringUtils.round(jr_gf_sjgl+jr_fd_sjgl,2));
+
+//                if(jr_gf_zjrl!=0)
+//                {
+//                    double gffhl= new BigDecimal(jr_gf_sjgl).divide(new BigDecimal(jr_gf_zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
+//                    //光伏功率负荷率
+//                    newpointmap.put("gf_fhl",StringUtils.round(gffhl*100,2));
+//                }else
+//                {
+//                    newpointmap.put("gf_fhl",0.0);
+//                }
+//                if(jr_fd_zjrl!=0)
+//                {
+//                    double fdfhl= new BigDecimal(jr_fd_sjgl).divide(new BigDecimal(jr_fd_zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
+//                    //风电功率负荷率
+//                    newpointmap.put("fd_fhl",StringUtils.round(fdfhl*100,2));
+//                }else
+//                {
+//                    newpointmap.put("fd_fhl",0.0);
+//                }
+//
+//                if((jr_gf_zjrl+jr_fd_zjrl)!=0)
+//                {
+//                    double fdfhl= new BigDecimal(jr_gf_sjgl+jr_fd_sjgl).divide(new BigDecimal(jr_gf_zjrl+jr_fd_zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
+//                    //清洁能源功率负荷率
+//                    newpointmap.put("qjny_fhl",StringUtils.round(fdfhl*100,2));
+//                }else
+//                {
+//                    newpointmap.put("qjny_fhl",0.0);
+//                }
 
                 map.put("newpointmap",newpointmap);
 //                for (Windpowerstation wp : wplist) {

+ 137 - 0
web/monitor-web-sxjn/src/main/java/com/gyee/frame/util/DoubleUtils.java

@@ -0,0 +1,137 @@
+package com.gyee.frame.util;
+
+import java.math.BigDecimal;
+
+/**
+ * @ClassName : DoubleUtils
+ * @Author : xieshengjie
+ * @Date: 2021/11/16 17:00
+ * @Description :
+ */
+public class DoubleUtils {
+
+    /**
+     * 保留两位小数
+     * @param number
+     * @param precision
+     * @return
+     */
+    public static double keepPrecision(double number, int precision) {
+        BigDecimal bg = new BigDecimal(number);
+        return bg.setScale(precision, BigDecimal.ROUND_HALF_UP).doubleValue();
+    }
+
+
+    /**
+     * double保留小数点位数,四舍五入
+     * 比如处理价格等数据
+     * @param d 要处理的double值
+     * @param n 要保留的位数
+     * @return
+     */
+    public static double getRoundingNum(double d , int n) {
+        BigDecimal b = new BigDecimal(String.valueOf(d));
+        b = b.divide(BigDecimal.ONE, n, BigDecimal.ROUND_HALF_UP);
+        return b.doubleValue();
+    }
+    /**
+     *
+     * @param numA 数字A
+     * @param numB 数字B
+     * @param operate 运算符
+     * @return
+     */
+    public static double GetResult(double numA, double numB, String operate){
+        double res = 0;
+        BigDecimal bigA = new BigDecimal(Double.toString(numA));
+        BigDecimal bigB = new BigDecimal(Double.toString(numB));
+        switch (operate) {
+
+            case "+":
+                res = bigA.add(bigB).doubleValue();
+                break;
+            case "-":
+                res = bigA.subtract(bigB).doubleValue();
+                break;
+            case "*":
+                res = bigA.multiply(bigB).doubleValue();
+                break;
+            case "/":
+                res = bigA.divide(bigB,2,BigDecimal.ROUND_HALF_UP).doubleValue();
+                break;
+            default :
+                System.out.println("运算符不合法~");
+                break;
+        }
+        return res;
+    }
+
+
+    public static Double sum(Double ...in){
+        Double result = 0.0;
+        for (int i = 0; i < in.length; i++){
+            result = result+(ifNullSet0(in[i]));
+        }
+        return result;
+    }
+
+    public static String hb(String ...in){
+        String result = "";
+        for (int i = 0; i < in.length; i++){
+            result = result+in[i];
+        }
+        return result;
+    }
+
+    public static Integer sum(Integer ...in) {
+        Integer result = 0;
+        for (int i = 0; i < in.length; i++){
+            result = result+(ifNullSet0(in[i]));
+        }
+        return result;
+    }
+
+    public static Double max(Double ...in){
+        Double result = 0.0;
+        for (int i = 0; i < in.length; i++){
+            if (result<ifNullSet0(in[i])){
+                result=ifNullSet0(in[i]);
+            }
+        }
+        return result;
+    }
+
+    public static Double min(Double ...in){
+        Double result = 0.0;
+        for (int i = 0; i < in.length; i++){
+            if (i==0){
+                result=ifNullSet0(in[0]);
+            }
+            if (result>ifNullSet0(in[i])){
+                result=ifNullSet0(in[i]);
+            }
+        }
+        return result;
+    }
+    public static Double ave(Double ...in){
+        if(in.length==0){
+            return 0.0;
+        }else{
+            return sum(in)/in.length;
+        }
+
+    }
+    public static Double ifNullSet0(Double in) {
+        if (in != null) {
+            return in;
+        }
+        return 0.0;
+    }
+
+    public static Integer ifNullSet0(Integer in) {
+        if (in != null) {
+            return in;
+        }
+        return 0;
+    }
+}