ソースを参照

socket改成restful接口

chenminghua 2 年 前
コミット
d53b442bb7
20 ファイル変更1334 行追加1065 行削除
  1. 2 8
      src/main/java/com/gyee/frame/common/quartz/task/Index_target_comprehensive_indicators.java
  2. 3 5
      src/main/java/com/gyee/frame/common/quartz/task/Windpowerstationdetail_sevendaycolumn_target.java
  3. 3 5
      src/main/java/com/gyee/frame/common/quartz/task/Windpowerstationdetail_twentyfourhourlinechart_target.java
  4. 1 1
      src/main/java/com/gyee/frame/common/quartz/task/index_curve_columnar_five_loss.java
  5. 2 4
      src/main/java/com/gyee/frame/common/quartz/task/index_electricQuantity.java
  6. 2 4
      src/main/java/com/gyee/frame/common/quartz/task/index_target_basic_indicators.java
  7. 5 12
      src/main/java/com/gyee/frame/common/quartz/task/index_target_windSpeed_power.java
  8. 2 8
      src/main/java/com/gyee/frame/common/quartz/task/index_windturbine_status.java
  9. 0 2
      src/main/java/com/gyee/frame/common/quartz/task/monitor_target_matrixMonitor.java
  10. 2 2
      src/main/java/com/gyee/frame/controller/app/index/IndexHomeController.java
  11. 108 0
      src/main/java/com/gyee/frame/controller/app/monitor/MonitorController.java
  12. 0 2
      src/main/java/com/gyee/frame/controller/app/predict/PredictController.java
  13. 116 91
      src/main/java/com/gyee/frame/controller/app/report/ReportController.java
  14. 2 4
      src/main/java/com/gyee/frame/service/WindpowerinfodayService.java
  15. 0 194
      src/main/java/com/gyee/frame/service/app/index/IndexDetailService.java
  16. 0 369
      src/main/java/com/gyee/frame/service/app/index/IndexHomeService.java
  17. 325 349
      src/main/java/com/gyee/frame/service/app/index/IndexService.java
  18. 508 0
      src/main/java/com/gyee/frame/service/app/index/MonitorDataService.java
  19. 205 5
      src/main/java/com/gyee/frame/service/app/windpowerstationdetail/Windspeedpowercurvedetail.java
  20. 48 0
      src/main/java/com/gyee/frame/util/DateUtils.java

+ 2 - 8
src/main/java/com/gyee/frame/common/quartz/task/Index_target_comprehensive_indicators.java

@@ -1,16 +1,10 @@
 package com.gyee.frame.common.quartz.task;
 
 import com.gyee.frame.mapper.auto.TsysUserMapper;
-import com.gyee.frame.model.auto.Weatherfd;
-import com.gyee.frame.service.app.index.IndexService;
-import com.gyee.frame.service.WeatherfdService;
+import com.gyee.frame.service.app.index.MonitorDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -23,7 +17,7 @@ public class Index_target_comprehensive_indicators {
 	@Autowired
 	private TsysUserMapper tsysUserMapper;
 	@Autowired
-    private IndexService indexService;
+    private MonitorDataService indexService;
     /**
      * 无参的任务
      * @throws Exception 

+ 3 - 5
src/main/java/com/gyee/frame/common/quartz/task/Windpowerstationdetail_sevendaycolumn_target.java

@@ -1,11 +1,9 @@
 package com.gyee.frame.common.quartz.task;
 
-import com.gyee.frame.service.app.windpowerstationdetail.Windspeedpowercurvedetail;
+import com.gyee.frame.service.app.windpowerstationdetail.WindPowerEchartService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -16,12 +14,12 @@ import java.util.Date;
 @Component("windpowerstationdetail_sevendaycolumn_target")
 public class Windpowerstationdetail_sevendaycolumn_target {
     @Autowired
-    private Windspeedpowercurvedetail windspeedpowercurvedetail;
+    private WindPowerEchartService windspeedpowercurvedetail;
     /**
      * 无参的任务
      */
     public void windpowerstationdetail_sevendaycolumn_target() throws Exception {
-        windspeedpowercurvedetail.windpowerstationdetail_sevendaycolumn_target();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
+//        windspeedpowercurvedetail.windpowerstationdetail_sevendaycolumn_target();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
         ////System.out.println("我已执行");
     }
 

+ 3 - 5
src/main/java/com/gyee/frame/common/quartz/task/Windpowerstationdetail_twentyfourhourlinechart_target.java

@@ -1,11 +1,9 @@
 package com.gyee.frame.common.quartz.task;
 
-import com.gyee.frame.service.app.windpowerstationdetail.Windspeedpowercurvedetail;
+import com.gyee.frame.service.app.windpowerstationdetail.WindPowerEchartService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -17,13 +15,13 @@ import java.util.Date;
 @Component("windpowerstationdetail_twentyfourhourlinechart_target")
 public class Windpowerstationdetail_twentyfourhourlinechart_target {
     @Autowired
-    private Windspeedpowercurvedetail windspeedpowercurvedetail;
+    private WindPowerEchartService windspeedpowercurvedetail;
 /**
      * 无参的任务*/
 
 
     public void windpowerstationdetail_twentyfourhourlinechart_target() throws Exception {
-        windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
+//        windspeedpowercurvedetail.windpowerstationdetail_twentyfourhourlinechart_target();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
         ////System.out.println("我已执行");
     }
 

+ 1 - 1
src/main/java/com/gyee/frame/common/quartz/task/index_curve_columnar_five_loss.java

@@ -19,7 +19,7 @@ public class index_curve_columnar_five_loss {
      * @throws Exception 
      */
     public void index_curve_columnar_five_loss() throws Exception {
-    	indexDetailService.index_curve_columnar_five_loss();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送     
+//    	indexDetailService.index_curve_columnar_five_loss();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
         ////System.out.println("我已执行");
     }   
        

+ 2 - 4
src/main/java/com/gyee/frame/common/quartz/task/index_electricQuantity.java

@@ -1,12 +1,10 @@
 package com.gyee.frame.common.quartz.task;
 
 import com.gyee.frame.mapper.auto.TsysUserMapper;
-import com.gyee.frame.service.app.index.IndexService;
+import com.gyee.frame.service.app.index.MonitorDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -19,7 +17,7 @@ public class index_electricQuantity {
 	@Autowired
 	private TsysUserMapper tsysUserMapper;
 	@Autowired
-    private IndexService indexService;
+    private MonitorDataService indexService;
     /**
      * 无参的任务
      * @throws Exception 

+ 2 - 4
src/main/java/com/gyee/frame/common/quartz/task/index_target_basic_indicators.java

@@ -1,12 +1,10 @@
 package com.gyee.frame.common.quartz.task;
 
 import com.gyee.frame.mapper.auto.TsysUserMapper;
-import com.gyee.frame.service.app.index.IndexService;
+import com.gyee.frame.service.app.index.MonitorDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -19,7 +17,7 @@ public class index_target_basic_indicators {
 	@Autowired
 	private TsysUserMapper tsysUserMapper;
 	@Autowired
-    private IndexService indexService;
+    private MonitorDataService indexService;
     /**
      * 无参的任务
      * @throws Exception

+ 5 - 12
src/main/java/com/gyee/frame/common/quartz/task/index_target_windSpeed_power.java

@@ -1,16 +1,9 @@
 package com.gyee.frame.common.quartz.task;
 
-import com.gyee.frame.mapper.auto.TsysUserMapper;
-import com.gyee.frame.model.auto.Weatherfd;
-import com.gyee.frame.service.app.index.IndexService;
-import com.gyee.frame.service.WeatherfdService;
+import com.gyee.frame.service.app.index.MonitorDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -20,16 +13,16 @@ import java.util.List;
  */
 @Component("index_target_windSpeed_power")
 public class index_target_windSpeed_power {
+//	@Autowired
+//	private TsysUserMapper tsysUserMapper;
 	@Autowired
-	private TsysUserMapper tsysUserMapper;
-	@Autowired
-    private IndexService indexService;
+    private MonitorDataService indexService;
     /**
      * 无参的任务
      * @throws Exception 
      */
     public void index_target_windSpeed_power() throws Exception {
-    	indexService.index_target_windSpeed_power();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送     
+//    	indexService.index_target_windSpeed_power();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
         ////System.out.println("我已执行");
     }   
        

+ 2 - 8
src/main/java/com/gyee/frame/common/quartz/task/index_windturbine_status.java

@@ -1,16 +1,10 @@
 package com.gyee.frame.common.quartz.task;
 
 import com.gyee.frame.mapper.auto.TsysUserMapper;
-import com.gyee.frame.model.auto.Weatherfd;
-import com.gyee.frame.service.app.index.IndexService;
-import com.gyee.frame.service.WeatherfdService;
+import com.gyee.frame.service.app.index.MonitorDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.text.ParseException;
-import java.util.Date;
-import java.util.List;
-
 /**
  *测试类
  * @CLASSNAME   WeatherfdPushTask
@@ -23,7 +17,7 @@ public class index_windturbine_status {
 	@Autowired
 	private TsysUserMapper tsysUserMapper;
 	@Autowired
-    private IndexService indexService;
+    private MonitorDataService indexService;
     /**
      * 无参的任务
      * @throws Exception 

+ 0 - 2
src/main/java/com/gyee/frame/common/quartz/task/monitor_target_matrixMonitor.java

@@ -4,8 +4,6 @@ import com.gyee.frame.service.monitor.MonitorService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.Date;
-
 /**
  *
  */

+ 2 - 2
src/main/java/com/gyee/frame/controller/app/index/IndexHomeController.java

@@ -3,7 +3,7 @@ package com.gyee.frame.controller.app.index;
 import com.gyee.frame.common.dataSources.DataSource;
 import com.gyee.frame.common.dataSources.DataSourceType;
 import com.gyee.frame.common.domain.AjaxResult;
-import com.gyee.frame.service.app.index.IndexHomeService;
+import com.gyee.frame.service.app.index.IndexService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -22,7 +22,7 @@ import java.util.Map;
 public class IndexHomeController {
 
     @Resource
-    private IndexHomeService indexHomeService;
+    private IndexService indexHomeService;
 
     /**
      * 首页汇总数据

+ 108 - 0
src/main/java/com/gyee/frame/controller/app/monitor/MonitorController.java

@@ -0,0 +1,108 @@
+package com.gyee.frame.controller.app.monitor;
+
+import com.gyee.frame.common.dataSources.DataSource;
+import com.gyee.frame.common.dataSources.DataSourceType;
+import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.model.custom.DataVo;
+import com.gyee.frame.model.custom.PointData;
+import com.gyee.frame.service.app.index.MonitorDataService;
+import com.gyee.frame.service.app.windpowerstationdetail.WindPowerEchartService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 监视页面数据
+ */
+@Slf4j
+@RestController
+@RequestMapping("/monitor")
+public class MonitorController {
+
+    @Resource
+    private MonitorDataService monitorDataService;
+    @Resource
+    private WindPowerEchartService echartService;
+
+    /**
+     * 安全天数、装机容量、发电量...
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/indicator")
+    public AjaxResult getIndicator(){
+        Map<String, Map<String, Object>> map = monitorDataService.index_target_comprehensive_indicators();
+        return AjaxResult.successData(map);
+    }
+
+    /**
+     * 实时风速、预测风速、功率...
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/windSpeed/power")
+    public AjaxResult getWindSpeedAndPower(){
+        Map<String, Map<String, Object>> map = monitorDataService.index_windSpeed_power();
+        return AjaxResult.successData(map);
+    }
+
+    /**
+     * 风机状态
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/windTurbine/status")
+    public AjaxResult getWindTurbineStatus(){
+        Map<String, Map<String, Double>> map = monitorDataService.index_windturbine_status();
+        return AjaxResult.successData(map);
+    }
+
+    /**
+     * 月发电量、年发电量
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/electric/quantity")
+    public AjaxResult getElectricQuantity(){
+        Map<String, Map<String, Double>> map = monitorDataService.index_electricQuantity();
+        return AjaxResult.successData(map);
+    }
+
+    /**
+     * 月利用小时、年利用小时、综合厂用电、节能减排....
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/analysis/indicator")
+    public AjaxResult getAnalysisIndicator(){
+        Map<String, Map<String, Object>> map = monitorDataService.index_target_basic_indicators();
+        return AjaxResult.successData(map);
+    }
+
+    /**
+     * 风速功率曲线图
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/echart/windSpeed/power")
+    public AjaxResult getEchartWindSpeedPower(){
+        Map<String, Map<String, List<PointData>>> map = echartService.twentyfourhourlinechart_target();
+        return AjaxResult.successData(map);
+    }
+
+    /**
+     * 五损柱状图
+     * @return
+     */
+    @DataSource(DataSourceType.MASTER)
+    @GetMapping("/echart/losses")
+    public AjaxResult getEchartLosses(){
+        Map<String, List<DataVo>> map = echartService.index_curve_columnar_five_loss();
+        return AjaxResult.successData(map);
+    }
+}

+ 0 - 2
src/main/java/com/gyee/frame/controller/app/predict/PredictController.java

@@ -3,9 +3,7 @@ package com.gyee.frame.controller.app.predict;
 import com.gyee.frame.common.dataSources.DataSource;
 import com.gyee.frame.common.dataSources.DataSourceType;
 import com.gyee.frame.common.domain.AjaxResult;
-import com.gyee.frame.model.auto.Wfnwpdata;
 import com.gyee.frame.service.app.predict.PredictService;
-import com.gyee.frame.util.DateUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;

+ 116 - 91
src/main/java/com/gyee/frame/controller/app/report/ReportController.java

@@ -3,6 +3,7 @@ package com.gyee.frame.controller.app.report;
 import com.gyee.frame.common.dataSources.DataSource;
 import com.gyee.frame.common.dataSources.DataSourceType;
 import com.gyee.frame.common.domain.AjaxResult;
+import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.Windpowerinfoday;
 import com.gyee.frame.model.auto.Windpowerinfoday3;
@@ -10,12 +11,17 @@ import com.gyee.frame.model.auto.Windpowerstation;
 import com.gyee.frame.service.Windpowerinfoday3Service;
 import com.gyee.frame.service.WindpowerinfodayService;
 import com.gyee.frame.util.DateUtils;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
+import com.gyee.frame.util.StringUtils;
+import com.gyee.frame.util.golden.StringUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
@@ -32,18 +38,24 @@ public class ReportController {
     private WindpowerinfodayService windpowerinfodayService;
     @Resource
     private Windpowerinfoday3Service windpowerinfoday3Service;
+    @Resource
+    RealTimeDataBaseFactory mongodb;
 
     /**
      * 新能源日报
      */
     @DataSource(value = DataSourceType.MASTER)
     @GetMapping("/xnyrb")
-    public AjaxResult getSafeMeasure(String time) {
+    public AjaxResult getSafeMeasure(String time) throws Exception {
         LinkedHashMap<String, Object> map1 = new LinkedHashMap<>();
         LinkedHashMap<String, Object> map2 = new LinkedHashMap<>();
 
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(DateUtils.parseStrtoDate(time, DateUtils.YYYY_MM_DD));
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(DateUtils.parseStrtoDate(time, DateUtils.YYYY_MM_DD));
+        long times = cal.getTime().getTime();
+        long now = new Date().getTime();
+        if (times >= now)
+            return AjaxResult.successData(null);
 
         //风场合计
         double rpjfshj = 0.0;
@@ -87,60 +99,66 @@ public class ReportController {
 
         for (Windpowerstation wp : InitialRunner.wplsall) {
             try{
+                Calendar calendar = Calendar.getInstance();
+                calendar.setTime(DateUtils.parseStrtoDate(time, DateUtils.YYYY_MM_DD));
+
                 List<Windpowerinfoday> list = windpowerinfodayService.findListByStationAndDate(wp.getId(), calendar.getTime());
                 List<Windpowerinfoday> collect = list.stream().filter(w -> w.getForeignkeyid().equals(wp.getId())).collect(Collectors.toList());
                 Windpowerinfoday wind = collect.size() > 0 ? collect.get(0) : new Windpowerinfoday();
 
-                double rpjfs = wind.getSpeed();
-                double rfdl = wind.getGeneratingcapacity4();
-                double yfdl = wind.getMonthgc2();
-                double nljfdl = wind.getYeargc2();
-                double rswdl = wind.getGridelectricity4();
-                double yljswdl = wind.getMonthge();
-                double nljswdl = wind.getYearge();
-                double zhcydl = wind.getBuyelectricity4() + wind.getBuyagricultureelectricity4() + wind.getGeneratingcapacity4() - wind.getGridelectricity4();
-                double yljzhcydl = wind.getMonthbe() + wind.getMonthae() + wind.getMonthgc2() - wind.getMonthge();
+                double rpjfs = wind.getSpeed();  //日平均风速
+                double rfdl = wind.getGeneratingcapacity4();  //日发电量
+                double yfdl = wind.getMonthgc2();  //月发电量
+                double nljfdl = wind.getYeargc2(); //年发电量
+                double rswdl = wind.getGridelectricity4(); //日上网电量
+                double yljswdl = wind.getMonthge();  //月累计上网电量
+                double nljswdl = wind.getYearge();  //年累计上网电量
+                double zhcydl = wind.getBuyelectricity4() + wind.getBuyagricultureelectricity4() + wind.getGeneratingcapacity4() - wind.getGridelectricity4(); //综合厂用电量
+                double yljzhcydl = wind.getMonthbe() + wind.getMonthae() + wind.getMonthgc2() - wind.getMonthge(); //月累计综合厂用电量
 
                 List<Windpowerinfoday> scada = list.stream().filter(w -> w.getWindpowerstationid().equals(wp.getId()) && w.getForeignkeyid().contains("_GC")).collect(Collectors.toList());
-                double scadarfdl = scada.stream().mapToDouble(Windpowerinfoday::getGeneratingcapacity).sum();
+                double scadarfdl = scada.stream().mapToDouble(Windpowerinfoday::getGeneratingcapacity).sum(); //SCADA日发电量
 
-                double scadayljfdl = wind.getMonthgc();
-                double scadanljfdl = wind.getYeargc();
-                double scadazhcydl = wind.getBuyelectricity4() + wind.getBuyagricultureelectricity4() + wind.getGeneratingcapacity() - wind.getGridelectricity4();
-                double scadayljzhcydl = wind.getMonthbe() + wind.getMonthae() + wind.getMonthgc() - wind.getMonthge();
-                double scadazhcyll = scadarfdl == 0 ? 0.0 : scadazhcydl / scadarfdl * 100;
+                double scadayljfdl = wind.getMonthgc();  // SCADA月发电量
+                double scadanljfdl = wind.getYeargc();  // SCADA年发电量
+                double scadazhcydl = scadarfdl - rswdl; //SCADA综合厂用电量
+                double scadayljzhcydl = scadayljfdl - yljswdl; //SCADA月综合厂用电量
+                double scadazhcyll = scadarfdl == 0 ? 0.0 : scadazhcydl / scadarfdl * 100; //SCADA综合厂用电率
 
                 List<Windpowerinfoday3> info1 = windpowerinfoday3Service.getItemByStationAndDate(wp.getId(), calendar.getTime(), calendar.getTime());
-                Date st = calendar.getTime();
                 calendar.add(Calendar.MONTH, 0);
                 calendar.set(Calendar.DAY_OF_MONTH, 1);
-                List<Windpowerinfoday3> info2 = windpowerinfoday3Service.getItemByStationAndDate(wp.getId(), calendar.getTime(), st);
-                int year = calendar.get(Calendar.YEAR);
-                calendar.setTime(DateUtils.parseStrtoDate(year + "-01-01", DateUtils.YYYY_MM_DD));
-                List<Windpowerinfoday3> info3 = windpowerinfoday3Service.getItemByStationAndDate(wp.getId(), calendar.getTime(), st);
-                double rxdssdl = info1.size() > 0 ? info1.get(0).getDaynhxdssdl() / 10000 : 0.0;
-                double yljxdssdl = info2.stream().mapToDouble(Windpowerinfoday3::getDaynhcfdl).sum() / 10000;
-                double nljxdssdl = info3.stream().mapToDouble(Windpowerinfoday3::getDaynhcfdl).sum() / 10000;
+                Date st = calendar.getTime();
+                calendar.add(Calendar.MONTH, 1);
+                calendar.set(Calendar.DAY_OF_MONTH, 0);
+                Date et = calendar.getTime();
+                List<Windpowerinfoday3> info2 = windpowerinfoday3Service.getItemByStationAndDate(wp.getId(), st, et);
+                st = DateUtils.getYearFirstDay(calendar.getTime());
+                et = DateUtils.getYearEndDay(calendar.getTime());
+                List<Windpowerinfoday3> info3 = windpowerinfoday3Service.getItemByStationAndDate(wp.getId(), st, et);
+                double rxdssdl = info1.size() > 0 ? info1.get(0).getDaynhxdssdl() / 10000 : 0.0;   //日限电损失
+                double yljxdssdl = info2.stream().mapToDouble(Windpowerinfoday3::getDaynhxdssdl).sum() / 10000;  //月限电损失
+                double nljxdssdl = info3.stream().mapToDouble(Windpowerinfoday3::getDaynhxdssdl).sum() / 10000;  //年限电损失
 
                 Map<String, Double> count = new HashMap<>();
-                count.put("rpjfs", rpjfs);
-                count.put("rfdl", rfdl);
-                count.put("yfdl", yfdl);
-                count.put("nljfdl", nljfdl);
-                count.put("rswdl", rswdl);
-                count.put("yljswdl", yljswdl);
-                count.put("nljswdl", nljswdl);
-                count.put("zhcydl", zhcydl);
-                count.put("yljzhcydl", yljzhcydl);
-                count.put("scadarfdl", scadarfdl);
-                count.put("scadayljfdl", scadayljfdl);
-                count.put("scadanljfdl", scadanljfdl);
-                count.put("scadazhcydl", scadazhcydl);
-                count.put("scadayljzhcydl", scadayljzhcydl);
-                count.put("scadazhcyll", scadazhcyll);
-                count.put("rxdssdl", rxdssdl);
-                count.put("yljxdssdl", yljxdssdl);
-                count.put("nljxdssdl", nljxdssdl);
+                count.put("rpjfs", StringUtils.round(rpjfs, 2));
+                count.put("rfdl", StringUtils.round(rfdl, 2));
+                count.put("yfdl", StringUtils.round(yfdl, 2));
+                count.put("nljfdl", StringUtils.round(nljfdl, 2));
+                count.put("rswdl", StringUtils.round(rswdl, 2));
+                count.put("yljswdl", StringUtils.round(yljswdl, 2));
+                count.put("nljswdl", StringUtils.round(nljswdl, 2));
+                count.put("zhcydl", StringUtils.round(zhcydl, 2));
+                count.put("yljzhcydl", StringUtils.round(yljzhcydl, 2));
+                count.put("scadarfdl", StringUtils.round(scadarfdl, 2));
+                count.put("scadayljfdl", StringUtils.round(scadayljfdl, 2));
+                count.put("scadanljfdl", StringUtils.round(scadanljfdl, 2));
+                count.put("scadazhcydl", StringUtils.round(scadazhcydl, 2));
+                count.put("scadayljzhcydl", StringUtils.round(scadayljzhcydl, 2));
+                count.put("scadazhcyll", StringUtils.round(scadazhcyll, 2));
+                count.put("rxdssdl", StringUtils.round(rxdssdl, 2));
+                count.put("yljxdssdl", StringUtils.round(yljxdssdl, 2));
+                count.put("nljxdssdl", StringUtils.round(nljxdssdl, 2));
 
                 if (wp.getId().contains("FDC")){
                     map1.put(wp.getName(), count);
@@ -164,8 +182,14 @@ public class ReportController {
                     nljxdssdlhj += nljxdssdl;
                 }
                 if (wp.getId().contains("GDC")){
+                    // 由于光伏的日照强度没有,直接从golden读取
+                    String point = wp.getId().equals("DWK_GDC") ? Constant.DWKFS : wp.getId().equals("PL_GDC") ? Constant.PLFS : wp.getId().equals("MCH_GDC") ?  Constant.MCHFS : wp.getId().equals("XH_GDC") ? Constant.XHFS : Constant.HZJFS;
+                    String[] str = new String[]{point};
+                    // 光照强度实时值,读取18:00的
+                    double value = mongodb.create().getHistMatrix(str, (int) (DateUtils.getEndOfDay(cal.getTime()).getTime() / 1000) - 21600)[0].DValue;
+                    count.replace("rpjfs", StringUtils.round(value, 2));
                     map2.put(wp.getName(), count);
-                    rpjfshjgc += rpjfs;
+                    rpjfshjgc += value;
                     rfdlhjgc += rfdl;
                     yfdlhjgc += yfdl;
                     nljfdlhjgc += nljfdl;
@@ -184,52 +208,51 @@ public class ReportController {
                     yljxdssdlhjgc += yljxdssdl;
                     nljxdssdlhjgc += nljxdssdl;
                 }
-
             } catch (Exception e){
                 continue;
             }
         }
 
         Map<String, Double> pm1 = new HashMap<>();
-        pm1.put("rpjfs", rpjfshj / 5);
-        pm1.put("rfdl", rfdlhj);
-        pm1.put("yfdl", yfdlhj);
-        pm1.put("nljfdl", nljfdlhj);
-        pm1.put("rswdl", rswdlhj);
-        pm1.put("yljswdl", yljswdlhj);
-        pm1.put("nljswdl", nljswdlhj);
-        pm1.put("zhcydl", zhcydlhj);
-        pm1.put("yljzhcydl", yljzhcydlhj);
-        pm1.put("scadarfdl", scadarfdlhj);
-        pm1.put("scadayljfdl", scadayljfdlhj);
-        pm1.put("scadanljfdl", scadanljfdlhj);
-        pm1.put("scadazhcydl", scadazhcydlhj);
-        pm1.put("scadayljzhcydl", scadayljzhcydlhj);
-        pm1.put("scadazhcyll", scadazhcyllhj);
-        pm1.put("rxdssdl", rxdssdlhj);
-        pm1.put("yljxdssdl", yljxdssdlhj);
-        pm1.put("nljxdssdl", nljxdssdlhj);
+        pm1.put("rpjfs", StringUtils.round(rpjfshj / 5, 2));
+        pm1.put("rfdl", StringUtils.round(rfdlhj, 2));
+        pm1.put("yfdl", StringUtils.round(yfdlhj, 2));
+        pm1.put("nljfdl", StringUtils.round(nljfdlhj, 2));
+        pm1.put("rswdl", StringUtils.round(rswdlhj, 2));
+        pm1.put("yljswdl", StringUtils.round(yljswdlhj, 2));
+        pm1.put("nljswdl", StringUtils.round(nljswdlhj, 2));
+        pm1.put("zhcydl", StringUtils.round(zhcydlhj, 2));
+        pm1.put("yljzhcydl", StringUtils.round(yljzhcydlhj, 2));
+        pm1.put("scadarfdl", StringUtils.round(scadarfdlhj, 2));
+        pm1.put("scadayljfdl", StringUtils.round(scadayljfdlhj, 2));
+        pm1.put("scadanljfdl", StringUtils.round(scadanljfdlhj, 2));
+        pm1.put("scadazhcydl", StringUtils.round(scadazhcydlhj, 2));
+        pm1.put("scadayljzhcydl", StringUtils.round(scadayljzhcydlhj, 2));
+        pm1.put("scadazhcyll", StringUtils.round(scadazhcydlhj / scadarfdlhj * 100, 2));
+        pm1.put("rxdssdl", StringUtils.round(rxdssdlhj, 2));
+        pm1.put("yljxdssdl", StringUtils.round(yljxdssdlhj, 2));
+        pm1.put("nljxdssdl", StringUtils.round(nljxdssdlhj, 2));
         map1.put("合计", pm1);
 
         Map<String, Double> pm2 = new HashMap<>();
-        pm2.put("rpjfs", rpjfshjgc / 5);
-        pm2.put("rfdl", rfdlhjgc);
-        pm2.put("yfdl", yfdlhjgc);
-        pm2.put("nljfdl", nljfdlhjgc);
-        pm2.put("rswdl", rswdlhjgc);
-        pm2.put("yljswdl", yljswdlhjgc);
-        pm2.put("nljswdl", nljswdlhjgc);
-        pm2.put("zhcydl", zhcydlhjgc);
-        pm2.put("yljzhcydl", yljzhcydlhjgc);
-        pm2.put("scadarfdl", scadarfdlhjgc);
-        pm2.put("scadayljfdl", scadayljfdlhjgc);
-        pm2.put("scadanljfdl", scadanljfdlhjgc);
-        pm2.put("scadazhcydl", scadazhcydlhjgc);
-        pm2.put("scadayljzhcydl", scadayljzhcydlhjgc);
-        pm2.put("scadazhcyll", scadazhcyllhjgc);
-        pm2.put("rxdssdl", rxdssdlhjgc);
-        pm2.put("yljxdssdl", yljxdssdlhjgc);
-        pm2.put("nljxdssdl", nljxdssdlhjgc);
+        pm2.put("rpjfs", StringUtils.round(rpjfshjgc, 2));
+        pm2.put("rfdl", StringUtils.round(rfdlhjgc, 2));
+        pm2.put("yfdl", StringUtils.round(yfdlhjgc, 2));
+        pm2.put("nljfdl", StringUtils.round(nljfdlhjgc, 2));
+        pm2.put("rswdl", StringUtils.round(rswdlhjgc, 2));
+        pm2.put("yljswdl", StringUtils.round(yljswdlhjgc, 2));
+        pm2.put("nljswdl", StringUtils.round(nljswdlhjgc, 2));
+        pm2.put("zhcydl", StringUtils.round(zhcydlhjgc, 2));
+        pm2.put("yljzhcydl", StringUtils.round(yljzhcydlhjgc, 2));
+        pm2.put("scadarfdl", StringUtils.round(scadarfdlhjgc, 2));
+        pm2.put("scadayljfdl", StringUtils.round(scadayljfdlhjgc, 2));
+        pm2.put("scadanljfdl", StringUtils.round(scadanljfdlhjgc, 2));
+        pm2.put("scadazhcydl", StringUtils.round(scadazhcydlhjgc, 2));
+        pm2.put("scadayljzhcydl", StringUtils.round(scadayljzhcydlhjgc, 2));
+        pm2.put("scadazhcyll", StringUtils.round(scadazhcyllhjgc, 2));
+        pm2.put("rxdssdl", StringUtils.round(rxdssdlhjgc, 2));
+        pm2.put("yljxdssdl", StringUtils.round(yljxdssdlhjgc, 2));
+        pm2.put("nljxdssdl", StringUtils.round(nljxdssdlhjgc, 2));
         map2.put("合计", pm2);
 
         Map<String, Object> map = new HashMap<>();
@@ -240,13 +263,16 @@ public class ReportController {
     }
 
 
-    public static void main(String[] a) {
+    public static void main(String[] args) throws ParseException {
 
-//        Calendar calendar = Calendar.getInstance();
-//
-//        calendar.setTime(DateUtils.parseStrtoDate("2022-06-08", DateUtils.YYYY_MM_DD));
+        Calendar calendar = Calendar.getInstance();
+
+        calendar.setTime(DateUtils.parseStrtoDate("2022-06-08", DateUtils.YYYY_MM_DD));
 //        System.out.println(DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD));
-//
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+//        Date time =sdf.parse(sdf.format(calendar.getTime()));
+//        System.out.println(time);
+
 //        calendar.add(Calendar.MONTH, 0);
 //        calendar.set(Calendar.DAY_OF_MONTH, 1);
 //        System.out.println(DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
@@ -254,9 +280,8 @@ public class ReportController {
 //        calendar.add(Calendar.MONTH, 1);
 //        calendar.set(Calendar.DAY_OF_MONTH, 0);
 //        System.out.println(DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD_HH_MM_SS));
-//
-//
-//        int i = calendar.get(Calendar.YEAR);
-//        System.out.println(i);
+
+        System.out.println(DateUtils.format(DateUtils.getYearFirstDay(calendar.getTime()), DateUtils.YYYY_MM_DD_HH_MM_SS));
+        System.out.println(DateUtils.format(DateUtils.getYearEndDay(calendar.getTime()), DateUtils.YYYY_MM_DD_HH_MM_SS));
     }
 }

+ 2 - 4
src/main/java/com/gyee/frame/service/WindpowerinfodayService.java

@@ -228,12 +228,10 @@ public class WindpowerinfodayService extends SocketToolService implements BaseSe
 	}
 
 
-	public List<Windpowerinfoday> findListByStationAndDate(String wpId,Date time) throws ParseException {
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-		Date recodedatebegin =sdf.parse(sdf.format(time));
+	public List<Windpowerinfoday> findListByStationAndDate(String wpId,Date time){
 		WindpowerinfodayExample testExample=new WindpowerinfodayExample();
 		testExample.setOrderByClause("id ASC");
-		testExample.createCriteria().andWindpowerstationidEqualTo(wpId).andRecorddateEqualTo(recodedatebegin);
+		testExample.createCriteria().andWindpowerstationidEqualTo(wpId).andRecorddateEqualTo(time);
 
 		List<Windpowerinfoday> list= windpowerinfodayMapper.selectByExample(testExample);
 		return list;

+ 0 - 194
src/main/java/com/gyee/frame/service/app/index/IndexDetailService.java

@@ -383,200 +383,6 @@ public class IndexDetailService extends SocketToolService {
         return vos;
     }
 
-    public void index_curve_columnar_five_loss() throws Exception {
-
-        Map<String, List<DataVo>> pointDataMap = new HashMap();
-
-        List<Windpowerstation> wpls = new ArrayList<>();
-        for (Windpowerstation wp : InitialRunner.wpls) {
-            wpls.add(wp);
-        }
-        Windpowerstation windpowerstationAll = new Windpowerstation();
-        windpowerstationAll.setId("0");
-        wpls.add(windpowerstationAll);
-
-
-        Calendar c = Calendar.getInstance();
-
-        c.set(Calendar.HOUR_OF_DAY, 0);
-        c.set(Calendar.MINUTE, 0);
-        c.set(Calendar.SECOND, 0);
-        c.add(Calendar.DAY_OF_MONTH,2);
-        Date endDate = c.getTime();
-        c.add(Calendar.DAY_OF_MONTH,-7);
-        Date beginDate = c.getTime();
-
-        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
-
-        for (Windpowerstation windpowerstation : wpls) {
-
-            List<DataVo> vos = new ArrayList<DataVo>();
-            long length = 7;
-            for (int i = 0; i < length; i++) {
-                DataVo vo = new DataVo();
-
-                vo.setValue1(0.0);// 发电量
-                vo.setValue2(0.0);// 故障损失
-                vo.setValue3(0.0);// 检修损失
-                vo.setValue4(0.0);// 限电损失
-                vo.setValue5(0.0);// 性能损失
-                vo.setValue6(0.0);// 受累损失
-                vo.setValue7(0.0);// 应发电量
-                vos.add(vo);
-            }
-            Map<String, WindPowerStationTestingPoint2> map = stationPointmap.get(windpowerstation.getId());
-
-//            public static final String RGZZSDL = "RGZZSDL";// 故障
-//            public static final String RSZZSDL = "RSZZSDL";// 故障
-//            public static final String RJXZSDL = "RJXZSDL";// 维护
-//            public static final String RLZZSDL = "RLZZSDL";// 维护
-//            public static final String RQFZSDL = "RQFZSDL";// 性能
-//            public static final String RXDZSDL = "RXDZSDL";// 限电
-//            public static final String RWZZSDL = "RWZZSDL";// 受累
-//            public static final String RTZZSDL = "RTZZSDL";// 受累
-
-            WindPowerStationTestingPoint2 fdl = map.get(Constant.TPOINT_WP_RFDL);
-
-            WindPowerStationTestingPoint2 gzss = map.get(Constant.RGZZSDL);
-            WindPowerStationTestingPoint2 gzsl = map.get(Constant.RSZZSDL);
-
-            WindPowerStationTestingPoint2 jxss = map.get(Constant.RJXZSDL);
-            WindPowerStationTestingPoint2 jxsl = map.get(Constant.RLZZSDL);
-
-            WindPowerStationTestingPoint2 xnss = map.get(Constant.RQFZSDL);
-            WindPowerStationTestingPoint2 xdss = map.get(Constant.RXDZSDL);
-
-            WindPowerStationTestingPoint2 slss = map.get(Constant.RWZZSDL);
-            WindPowerStationTestingPoint2 slsl = map.get(Constant.RTZZSDL);
-
-            Calendar cal = Calendar.getInstance();
-            //发电量
-            List<PointData> fdlls = mongodb.create().getHistoryDatasSnap(fdl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-
-            for (int j = 0; j < fdlls.size(); j++) {
-
-                vos.get(j).setTime((fdlls.get(j).getPointTime()-3600*24) * 1000);
-                vos.get(j).setValue1(StringUtils.round(fdlls.get(j).getPointValueInDouble(),2));
-            }
-
-            try {
-
-                //故障损失
-                List<PointData> gzssls = mongodb.create().getHistoryDatasSnap(gzss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-                //故障受累失
-                List<PointData> gzslls = mongodb.create().getHistoryDatasSnap(gzsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-
-                double temp1 = 0;
-                double temp2 = 0;
-                for (int i = 0; i < vos.size(); i++) {
-
-                   // temp1 =gzssls.get(i).getPointValueInDouble();
-                    temp1 =new BigDecimal(gzssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                    //temp2 =gzslls.get(i).getPointValueInDouble();
-                    temp2 =new BigDecimal(gzslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                    vos.get(i).setValue2(StringUtils.round(temp1+temp2, 2));// 故障损失
-
-                }
-
-            } catch (Exception e) {
-                // TODO: handle exception
-            }
-
-            try {
-                //检修损失
-                List<PointData> jxssls = mongodb.create().getHistoryDatasSnap(jxss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-                //检修受累
-                List<PointData> jxslls = mongodb.create().getHistoryDatasSnap(jxsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-
-                double temp1 = 0;
-                double temp2 = 0;
-                for (int i = 0; i < vos.size(); i++) {
-
-                   // temp1 = jxssls.get(i).getPointValueInDouble();
-                    temp1 =new BigDecimal(jxssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                  //  temp2 = jxslls.get(i).getPointValueInDouble();
-                    temp2 =new BigDecimal(jxslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                    vos.get(i).setValue3(StringUtils.round(temp1+temp2, 2));// 检修损失
-
-                }
-
-            } catch (Exception e) {
-                // TODO: handle exception
-            }
-
-            try {
-                //限电损失
-                List<PointData> xdssls = mongodb.create().getHistoryDatasSnap(xdss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-
-                double temp = 0;
-                for (int i = 0; i < vos.size(); i++) {
-                    //temp = xdssls.get(i).getPointValueInDouble();
-                    temp =new BigDecimal(xdssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                    vos.get(i).setValue4(StringUtils.round(temp, 2));// 限电损失
-
-                }
-
-            } catch (Exception e) {
-                // TODO: handle exception
-            }
-            try {
-                //性能损失
-                List<PointData> xnssls = mongodb.create().getHistoryDatasSnap(xnss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-
-                double temp = 0;
-                for (int i = 0; i < vos.size(); i++) {
-                   // temp = xnssls.get(i).getPointValueInDouble();
-                    temp =new BigDecimal(xnssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                    vos.get(i).setValue5(StringUtils.round(temp, 2));// 性能损失
-
-                }
-
-            } catch (Exception e) {
-                // TODO: handle exception
-            }
-
-            try {
-                //天气受累
-                List<PointData> slssls = mongodb.create().getHistoryDatasSnap(slss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-                //电网受累
-                List<PointData> slslls = mongodb.create().getHistoryDatasSnap(slsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
-
-                double temp1 = 0;
-                double temp2 = 0;
-                for (int i = 0; i < vos.size(); i++) {
-
-                   // temp1 = slssls.get(i).getPointValueInDouble();
-                    temp1 =new BigDecimal(slssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                   // temp2 = slslls.get(i).getPointValueInDouble();
-                    temp2 =new BigDecimal(slslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-                    vos.get(i).setValue6(StringUtils.round(temp1+temp2, 2));// 受累损失
-
-                }
-
-            } catch (Exception e) {
-                // TODO: handle exception
-            }
-
-            for(DataVo vo:vos)
-            {
-                vo.setValue7(StringUtils.round(vo.getValue1()+vo.getValue2()+vo.getValue3()+vo.getValue4()+vo.getValue5()+vo.getValue6(), 2));
-            }
-            pointDataMap.put(windpowerstation.getId(),vos);
-
-        }
-
-        this.pushToWeb("pageNumber_6", "functionNumber_7","all", pointDataMap, Messagetype.MESSAGE);
-
-    }
-
 
     public void index_windStation_card(){
         Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;

+ 0 - 369
src/main/java/com/gyee/frame/service/app/index/IndexHomeService.java

@@ -1,369 +0,0 @@
-package com.gyee.frame.service.app.index;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.gyee.frame.common.Constants;
-import com.gyee.frame.common.conf.redis.CacheContext;
-import com.gyee.frame.common.spring.Constant;
-import com.gyee.frame.common.spring.InitialRunner;
-import com.gyee.frame.model.auto.*;
-import com.gyee.frame.model.custom.DNAVal;
-import com.gyee.frame.model.custom.PointData;
-import com.gyee.frame.service.ProjectplanService;
-import com.gyee.frame.service.WindpowerinfodayService;
-import com.gyee.frame.util.DateUtils;
-import com.gyee.frame.util.RealTimeDataBaseFactory;
-import com.gyee.frame.util.StringUtils;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.NumberFormat;
-import java.util.*;
-
-
-/**
- * app 首页   大屏数据大致相同
- */
-@Service
-public class IndexHomeService {
-
-    @Resource
-    private ProjectplanService projectplanService;
-    @Resource
-    private WindpowerinfodayService windpowerinfodayService;
-    @Resource
-    RealTimeDataBaseFactory mongodb;
-
-    private final long day_time = 24 * 60 * 60 * 1000;
-
-    /**
-     * 获取横屏数据
-     * @return
-     */
-    public Map<String, Object> list() throws Exception {
-        Map<String, Object> map = new HashMap<>();
-        Map<String, Object> mapgs = new HashMap<>();  // 汇总
-        Map<String, Object> mapfd = new HashMap<>();  // 风电
-        Map<String, Object> mapgf = new HashMap<>();  // 光伏
-        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
-
-        Double zjrl = 0.0;
-        Double fdzjrl = 0.0;
-        Double gfzjrl = 0.0;
-
-        List<Windpowerstation> wpList = InitialRunner.wpallls;
-        for (Windpowerstation wp : wpList){
-            zjrl += wp.getCapacity().doubleValue();
-            if (wp.getId().endsWith("FDC"))
-                fdzjrl += wp.getCapacity().doubleValue();
-            else
-                gfzjrl += wp.getCapacity().doubleValue();
-        }
-
-        NumberFormat format = NumberFormat.getNumberInstance();
-        format.setMaximumFractionDigits(0);
-
-        mapgs.put("zjrl", Integer.valueOf(format.format(zjrl)));
-        mapfd.put("fdzjrl",Integer.valueOf(format.format(fdzjrl)));
-        mapgf.put("gfzjrl",Integer.valueOf(format.format(gfzjrl)));
-
-        /*********************************  公司汇总数据 start   **/
-        double zgl = mongodb.create().getRealData(Constant.JSFW_SSSSZGL).getPointValueInDouble();// 总功率
-        int aqts = (int) mongodb.create().getRealData(Constant.CALC_TIANSHU).getPointValueInDouble();// 安全天数
-        double rfdl = mongodb.create().getRealData(Constant.JSFW_SSRFDLB).getPointValueInDouble();// 日累计电量
-        double yfdl = mongodb.create().getRealData(Constant.JSFW_SSYFDLB).getPointValueInDouble();// 月累计电量
-        double nfdl = mongodb.create().getRealData(Constant.JSFW_SSNFDLB).getPointValueInDouble();// 年发电量
-        double swdl = mongodb.create().getRealData(Constant.JSFW_SSSWDLB).getPointValueInDouble();// 上网电量
-        mapgs.put("zgl",zgl);
-        mapgs.put("aqts",aqts);
-        mapgs.put("rfdl",rfdl);
-        mapgs.put("yfdl",yfdl);
-        mapgs.put("nfdl",nfdl);
-        mapgs.put("swdl",swdl);
-
-        /**  计划发电量  **/
-        ProjectplanExample example = new ProjectplanExample();
-        String year = String.valueOf(DateUtils.getYear(new Date()));
-        example.createCriteria().andYearEqualTo(year)
-                .andMonthIsNotNull();
-        List<Projectplan> projectplanList = projectplanService.selectByExample(example);
-        double njhdl = projectplanList.stream().mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
-        double yjhdl = projectplanList.stream().filter(i->Integer.parseInt(i.getMonth()) == DateUtils.getMonth(new Date()))
-                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
-        mapgs.put("njhdl",njhdl);
-        mapgs.put("yjhdl",yjhdl);
-        /**  计划发电量  **/
-
-        //综合场用电率
-        double yzhcydl = 0.14;
-        long st = DateUtils.getThisMonthFirstDay().getTime() / 1000;
-        long et = DateUtils.getThisMonthLastday().getTime() / 1000;
-        long days = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
-        List<PointData> zhgwdlList = mongodb.create().getHistoryDatasSnap(Constant.JSFW_GWWDLB, st, et, days, ((et - st) / day_time));// 月购网电量
-        double yswdl = mongodb.create().getRealData(Constant.JSFW_QSSWDL).getPointValueInDouble(); // 风电月上网电量
-        double zhcyd = zhgwdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum() + (yfdl - yswdl);
-        mapgs.put("yzhcydl", StringUtils.round(zhcyd / yfdl, 2) > 20 ? yzhcydl : StringUtils.round(zhcyd / yfdl, 0));
-
-        // 月利用小时  年利用小时
-        double temp  = new BigDecimal(zjrl).divide(new BigDecimal(10), 2, RoundingMode.HALF_EVEN).doubleValue();
-        double nlyxs = new BigDecimal(nfdl).divide(new BigDecimal(temp), 2, RoundingMode.HALF_EVEN).doubleValue();
-        double ylyxs = new BigDecimal(yfdl).divide(new BigDecimal(temp), 2, RoundingMode.HALF_EVEN).doubleValue();
-        mapgs.put("nlyxs",nlyxs);
-        mapgs.put("ylyxs",ylyxs);
-
-        //7 日发电量
-        LinkedList<Object> ls = new LinkedList<>();
-        for (int i = 6; i >= 0; i--){
-            Calendar calendar = Calendar.getInstance();
-            calendar.add(Calendar.DAY_OF_MONTH, -i);
-            String[] ps = new String[] {Constant.JSFW_SSRFDLB};
-            DNAVal histMatrix = mongodb.create().getHistMatrix(ps, (int) ((DateUtils.getEndOfDay(calendar.getTime()).getTime() + 1) / 1000))[0];
-            Map<String, Object> mp = new LinkedHashMap<>();
-            mp.put("value", histMatrix.DValue);
-            mp.put("time", DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD).substring(8));
-            ls.add(mp);
-        }
-        mapgs.put("7rfdl",ls);
-        /*********************************  公司汇总数据 end   **/
-
-
-        /*********************************  风场数据 start   **/
-        double fdssfs = mongodb.create().getRealData(Constant.JSFW_FJSSFS).getPointValueInDouble();//风场实时风速
-        double fdssgl = mongodb.create().getRealData(Constant.JSFW_FJSSZGL).getPointValueInDouble();//风场实时功率
-        double fdrfdl = mongodb.create().getRealData(Constant.JSFW_FJRFDLB).getPointValueInDouble();// 风场日发电量合计
-        double fdyfdl = mongodb.create().getRealData(Constant.JSFW_FJYFDLB).getPointValueInDouble();// 风场月累计电量
-        double fdnfdl = mongodb.create().getRealData(Constant.JSFW_FJNFDLB).getPointValueInDouble();// 风场年累计电量
-        double fdswdl = mongodb.create().getRealData(Constant.JSFW_FJSWDLB).getPointValueInDouble();// 风场上网电量合计
-        double fdnjhdl = projectplanList.stream()  // 风场年计划发电量
-                .filter(p -> p.getWindpower().endsWith("FDC"))
-                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
-        double fdyjhdl = projectplanList.stream()  // 风场月计划发电量
-                .filter(i->Integer.parseInt(i.getMonth()) == DateUtils.getMonth(new Date()) && i.getWindpower().endsWith("FDC"))
-                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
-        List<PointData> fdzhgwdlList = mongodb.create().getHistoryDatasSnap(Constant.JSFW_FDGWDL, st, et, days, ((et - st) / day_time));// 风场月购网电量
-        double fdyswdl = mongodb.create().getRealData(Constant.JSFW_FJYSWDL).getPointValueInDouble();// 风场上网电量合计
-        double fdzhcyd = Math.abs(fdzhgwdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum() + (fdyfdl - fdyswdl));  // 风场综合厂用电
-        double fdzhcydl = StringUtils.round((fdzhcyd / fdyfdl), 2) > 20 ? 0.16 : StringUtils.round((fdzhcyd / fdyfdl), 2); // 风场综合厂用电率
-        double temp2  = new BigDecimal(fdzjrl).divide(new BigDecimal(10), 2, RoundingMode.HALF_EVEN).doubleValue();
-        double fdylyxs = new BigDecimal(fdyfdl).divide(new BigDecimal(temp2), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电月利用小时
-        double fdnlyxs = new BigDecimal(fdnfdl).divide(new BigDecimal(temp2), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电年利用小时
-        double fdfnlyl = mongodb.create().getRealData(Constant.JSFW_FNLYL).getPointValueInDouble();   // 风电风能利用率
-        double fdsbklyl = new Random().nextDouble() * 2 + 98;  // 风电设备可利用率
-
-        mapfd.put("fdssfs", fdssfs);
-        mapfd.put("fdssgl", fdssgl);
-        mapfd.put("fdrfdl", fdrfdl);
-        mapfd.put("fdyfdl", fdyfdl);
-        mapfd.put("fdnfdl", fdnfdl);
-        mapfd.put("fdswdl", fdswdl);
-        mapfd.put("fdnjhdl", fdnjhdl);
-        mapfd.put("fdyjhdl", fdyjhdl);
-        mapfd.put("fdzhcyd", fdzhcyd);
-        mapfd.put("fdzhcydl", fdzhcydl);
-        mapfd.put("fdylyxs", fdylyxs);
-        mapfd.put("fdnlyxs", fdnlyxs);
-        mapfd.put("fdfnlyl", fdfnlyl > 70 ? fdfnlyl : new Random().nextDouble() * 2+ 82);
-        mapfd.put("fdsbklyl", fdsbklyl);
-        /*********************************  风场数据 end   **/
-
-
-        /*********************************  光伏数据 start   **/
-        double dwkfs = mongodb.create().getRealData(Constant.DWKFS).getPointValueInDouble();// 大武口光照强度
-        double plfs = mongodb.create().getRealData(Constant.PLFS).getPointValueInDouble();// 平罗光照强度
-        double mchfs = mongodb.create().getRealData(Constant.MCHFS).getPointValueInDouble();// 马场胡光照强度
-        double xhfs = mongodb.create().getRealData(Constant.XHFS).getPointValueInDouble();// 宣和光照强度
-        double hzjfs = mongodb.create().getRealData(Constant.HZJFS).getPointValueInDouble();// 海子井光照强度
-        double gfrzqd = dwkfs + plfs + mchfs + xhfs + hzjfs;   // 光照强度总计
-        double gfssgl = mongodb.create().getRealData(Constant.JSFW_GFSSZGL).getPointValueInDouble();// 光伏实时功率
-        double gfrfdl = mongodb.create().getRealData(Constant.JSFW_GFRFDLB).getPointValueInDouble();// 光伏日发电量合计
-        double gfyfdl = mongodb.create().getRealData(Constant.JSFW_GFYFDLB).getPointValueInDouble();// 光伏月累计电量
-        double gfnfdl = mongodb.create().getRealData(Constant.JSFW_GFNFDLB).getPointValueInDouble();// 光伏年累计电量
-        double gfswdl = mongodb.create().getRealData(Constant.JSFW_GFSWDLB).getPointValueInDouble();// 光伏上网电量合计
-        double gfnjhdl = projectplanList.stream()  // 光伏年计划发电量
-                .filter(p -> p.getWindpower().endsWith("GDC"))
-                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
-        double gfyjhdl = projectplanList.stream()  // 光伏月计划发电量
-                .filter(i->Integer.parseInt(i.getMonth()) == DateUtils.getMonth(new Date()) && i.getWindpower().endsWith("GDC"))
-                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
-        List<PointData> gfzhgwdlList = mongodb.create().getHistoryDatasSnap(Constant.JSFW_GFGWDL, st, et, days, ((et - st) / day_time));// 风场月购网电量
-        double gfyswdl = mongodb.create().getRealData(Constant.JSFW_GFYSWDL).getPointValueInDouble();// 风场上网电量合计
-        double gfzhcyd = Math.abs(gfzhgwdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum() + (gfyfdl - gfyswdl));  // 风场综合厂用电
-        double gfzhcydl = StringUtils.round((gfzhcyd / fdyfdl), 2) > 20 ? 0.18 : StringUtils.round((fdzhcyd / fdyfdl), 2); // 风场综合厂用电率
-        double temp3  = new BigDecimal(gfzjrl).divide(new BigDecimal(10), 2, RoundingMode.HALF_EVEN).doubleValue();
-        double gfylyxs = new BigDecimal(gfyfdl).divide(new BigDecimal(temp3), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电月利用小时
-        double gfnlyxs = new BigDecimal(gfnfdl).divide(new BigDecimal(temp3), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电年利用小时
-        double gfgnlyl = new Random().nextDouble() * 10 + 80;  // 光能利用率
-        double gfsbklyl = new Random().nextDouble() * 3 + 95;  // 光伏设备可利用小时
-
-        mapgf.put("gfrzqd", gfrzqd);
-        mapgf.put("gfssgl", gfssgl);
-        mapgf.put("gfrfdl", gfrfdl);
-        mapgf.put("gfyfdl", gfyfdl);
-        mapgf.put("gfnfdl", gfnfdl);
-        mapgf.put("gfswdl", gfswdl);
-        mapgf.put("gfnjhdl", gfnjhdl);
-        mapgf.put("gfyjhdl", gfyjhdl);
-        mapgf.put("gfzhcyd", gfzhcyd);
-        mapgf.put("gfzhcydl", gfzhcydl);
-        mapgf.put("gfylyxs", gfylyxs);
-        mapgf.put("gfnlyxs", gfnlyxs);
-        mapgf.put("gfgnlyl", gfgnlyl);
-        mapgf.put("gfsbklyl", gfsbklyl);
-        /*********************************  光伏数据 end   **/
-
-        mapgs.put("yzhcyd", fdzhcyd + gfzhcyd);  //总的综合厂用电
-
-        map.put("gs", mapgs);
-        map.put("fd", mapfd);
-        map.put("gf", mapgf);
-        return map;
-    }
-
-
-    /**
-     * 首页 各场站图表数据
-     * @return
-     * @throws Exception
-     */
-    public Map<String, Object> refresh() throws Exception {
-        Map<String, Object> map = new HashMap<>();
-
-        double mhsfs = mongodb.create().getRealData(Constant.JSFW_MHSSFS).getPointValueInDouble();// 麻黄山风速
-        double nssfs = mongodb.create().getRealData(Constant.JSFW_NSSSFS).getPointValueInDouble();// 牛首山风速
-        double qsfs = mongodb.create().getRealData(Constant.JSFW_QSSSFS).getPointValueInDouble();// 青山风速
-        double sbqfs = mongodb.create().getRealData(Constant.JSFW_SBSSFS).getPointValueInDouble();// 石板泉风速
-        double xsfs = mongodb.create().getRealData(Constant.JSFW_XSSSFS).getPointValueInDouble();// 香山风速
-
-        double mhsgl = mongodb.create().getRealData(Constant.MHSDQ_POWER).getPointValueInDouble();// 麻黄山总功率
-        double nssgl = mongodb.create().getRealData(Constant.NSSDQ_POWER).getPointValueInDouble();// 牛首山总功率
-        double qsgl= mongodb.create().getRealData(Constant.JSFW_QSSSZGL).getPointValueInDouble();// 青山总功率
-        double sbqgl = mongodb.create().getRealData(Constant.JSFW_SBSSZGL).getPointValueInDouble();// 石板泉总功率
-        double xsgl = mongodb.create().getRealData(Constant.XSDQ_POWER).getPointValueInDouble();// 香山总功率
-
-        double mhsfdl = mongodb.create().getRealData(Constant.JSFW_MHRFDLB).getPointValueInDouble();// 麻黄山日发电量
-        double nssfdl = mongodb.create().getRealData(Constant.JSFW_NSRFDLB).getPointValueInDouble();// 牛首山日发电量
-        double qsfdl = mongodb.create().getRealData(Constant.JSFW_QSRFDLB).getPointValueInDouble();// 青山日发电量
-        double sbqfdl = mongodb.create().getRealData(Constant.JSFW_SBRFDLB).getPointValueInDouble();// 石板泉日发电量
-        double xsfdl = mongodb.create().getRealData(Constant.JSFW_XSRFDLB).getPointValueInDouble();// 香山日发电量
-
-        Map<String, Object> mpfdmhs = new HashMap<>();
-        mpfdmhs.put("station", "麻黄山");
-        mpfdmhs.put("fs",mhsfs);
-        mpfdmhs.put("gl",mhsgl);
-        mpfdmhs.put("fdl",mhsfdl);
-
-        Map<String, Object> mpfdnss = new HashMap<>();
-        mpfdnss.put("station", "牛首山");
-        mpfdnss.put("fs",nssfs);
-        mpfdnss.put("gl",nssgl);
-        mpfdnss.put("fdl",nssfdl);
-
-        Map<String, Object> mpfdqs = new HashMap<>();
-        mpfdqs.put("station", "青山");
-        mpfdqs.put("fs",qsfs);
-        mpfdqs.put("gl",qsgl);
-        mpfdqs.put("fdl",qsfdl);
-
-        Map<String, Object> mpfdsbq = new HashMap<>();
-        mpfdsbq.put("station", "石板泉");
-        mpfdsbq.put("fs",sbqfs);
-        mpfdsbq.put("gl",sbqgl);
-        mpfdsbq.put("fdl",sbqfdl);
-
-        Map<String, Object> mpfdxs = new HashMap<>();
-        mpfdxs.put("station", "香山");
-        mpfdxs.put("fs",xsfs);
-        mpfdxs.put("gl",xsgl);
-        mpfdxs.put("fdl",xsfdl);
-
-        List<Object> lsFDC = new ArrayList<>();
-        lsFDC.add(mpfdmhs);
-        lsFDC.add(mpfdnss);
-        lsFDC.add(mpfdqs);
-        lsFDC.add(mpfdsbq);
-        lsFDC.add(mpfdxs);
-
-
-        double dwkfs = mongodb.create().getRealData(Constant.DWKFS).getPointValueInDouble();// 大武口光照强度
-        double plfs = mongodb.create().getRealData(Constant.PLFS).getPointValueInDouble();// 平罗光照强度
-        double mchfs = mongodb.create().getRealData(Constant.MCHFS).getPointValueInDouble();// 马场胡光照强度
-        double xhfs = mongodb.create().getRealData(Constant.XHFS).getPointValueInDouble();// 宣和光照强度
-        double hzjfs = mongodb.create().getRealData(Constant.HZJFS).getPointValueInDouble();// 海子井光照强度
-
-        double dwkgl = mongodb.create().getRealData(Constant.JSFW_DWSSZGL).getPointValueInDouble();// 大武口总功率
-        double plgl = mongodb.create().getRealData(Constant.JSFW_PLSSZGL).getPointValueInDouble();// 平罗总功率
-        double mchgl = mongodb.create().getRealData(Constant.JSFW_MCSSZGL).getPointValueInDouble();// 马场湖总功率
-        double xhgl = mongodb.create().getRealData(Constant.JSFW_XHSSZGL).getPointValueInDouble(); // 宣和总功率
-        double hzjgl = mongodb.create().getRealData(Constant.JSFW_HZJSSZGL).getPointValueInDouble();// 海子井功率
-
-        double dwkfdl = mongodb.create().getRealData(Constant.JSFW_DWRFDLB).getPointValueInDouble();// 大武口日发电量
-        double plfdl = mongodb.create().getRealData(Constant.JSFW_PLRFDLB).getPointValueInDouble();// 平罗日发电量
-        double xhfdl = mongodb.create().getRealData(Constant.JSFW_XHRFDLB).getPointValueInDouble();// 宣和日发电量
-        double mchfdl = mongodb.create().getRealData(Constant.JSFW_MCRFDLB).getPointValueInDouble();// 马场湖日发电量
-        double hzjfdl = mongodb.create().getRealData(Constant.JSFW_HZJRFDLB).getPointValueInDouble();// 海子井日发电量
-
-        Map<String, Object> mpgfdwk = new HashMap<>();
-        mpgfdwk.put("station", "大武口");
-        mpgfdwk.put("fs",dwkfs);
-        mpgfdwk.put("gl",dwkgl);
-        mpgfdwk.put("fdl",dwkfdl);
-
-        Map<String, Object> mpgfpl = new HashMap<>();
-        mpgfpl.put("station", "平罗");
-        mpgfpl.put("fs",plfs);
-        mpgfpl.put("gl",plgl);
-        mpgfpl.put("fdl",plfdl);
-
-        Map<String, Object> mpgfxh = new HashMap<>();
-        mpgfxh.put("station", "宣和");
-        mpgfxh.put("fs",xhfs);
-        mpgfxh.put("gl",xhgl);
-        mpgfxh.put("fdl",xhfdl);
-
-        Map<String, Object> mpgfmch = new HashMap<>();
-        mpgfmch.put("station", "马场湖");
-        mpgfmch.put("fs",mchfs);
-        mpgfmch.put("gl",mchgl);
-        mpgfmch.put("fdl",mchfdl);
-
-        Map<String, Object> mpgfhzj = new HashMap<>();
-        mpgfhzj.put("station", "海子井");
-        mpgfhzj.put("fs",hzjfs);
-        mpgfhzj.put("gl",hzjgl);
-        mpgfhzj.put("fdl",hzjfdl);
-
-        List<Object> lsGDC = new ArrayList<>();
-        lsGDC.add(mpgfdwk);
-        lsGDC.add(mpgfpl);
-        lsGDC.add(mpgfxh);
-        lsGDC.add(mpgfmch);
-        lsGDC.add(mpgfhzj);
-
-        double zgl = mongodb.create().getRealData(Constant.JSFW_SSSSZGL).getPointValueInDouble();// 总功率
-        double fdssfs = mongodb.create().getRealData(Constant.JSFW_FJSSFS).getPointValueInDouble();//风场实时风速
-        double fdssgl = mongodb.create().getRealData(Constant.JSFW_FJSSZGL).getPointValueInDouble();//风场实时功率
-        double gfrzqd = dwkfs + plfs + mchfs + xhfs + hzjfs;   // 光照强度总计
-        double gfssgl = mongodb.create().getRealData(Constant.JSFW_GFSSZGL).getPointValueInDouble();// 光伏实时功率
-
-        map.put("fd", lsFDC);
-        map.put("gf", lsGDC);
-        map.put("zgl",zgl);
-        map.put("fdssfs", fdssfs);
-        map.put("fdssgl", fdssgl);
-        map.put("gfrzqd", gfrzqd);
-        map.put("gfssgl", gfssgl);
-        return map;
-    }
-
-
-    public static void main(String[] a){
-
-        for (int i = 6; i >= 0; i--){
-            Calendar calendar = Calendar.getInstance();
-            calendar.add(Calendar.DAY_OF_MONTH, -i);
-//            System.out.println(DateUtils.format(DateUtils.getEndOfDay(calendar.getTime()), DateUtils.YYYY_MM_DD_HH_MM_SS));
-            System.out.println(DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD).substring(8));
-        }
-    }
-}

+ 325 - 349
src/main/java/com/gyee/frame/service/app/index/IndexService.java

@@ -1,391 +1,367 @@
 package com.gyee.frame.service.app.index;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.frame.common.Constants;
-import com.gyee.frame.common.feign.RemoteServiceBuilder;
+import com.gyee.frame.common.conf.redis.CacheContext;
 import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
-import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
-import com.gyee.frame.model.auto.Windpowerinfoday;
-import com.gyee.frame.model.auto.Windpowerstation;
-import com.gyee.frame.model.auto.WpMttrAndMtbMonth;
+import com.gyee.frame.model.auto.*;
+import com.gyee.frame.model.custom.DNAVal;
 import com.gyee.frame.model.custom.PointData;
-import com.gyee.frame.model.enumeration.Messagetype;
-import com.gyee.frame.netty.websocket.util.SocketToolService;
-import com.gyee.frame.service.*;
+import com.gyee.frame.service.ProjectplanService;
+import com.gyee.frame.service.WindpowerinfodayService;
+import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.RealTimeDataBaseFactory;
 import com.gyee.frame.util.StringUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.NumberFormat;
 import java.util.*;
 
+
 /**
- * 首页指标数据
+ * app 首页   大屏数据大致相同
  */
-@Slf4j
 @Service
-public class IndexService extends SocketToolService {
+public class IndexService {
 
     @Resource
     private ProjectplanService projectplanService;
     @Resource
-    private WindpowerinfodayService windpowerinfodayService;
-    @Resource
-    private RealTimeDataBaseFactory mongodb;
-    @Resource
-    private MttrAndMtbfService mttrAndMtbfService;
-    @Resource
-    private FocastpowerService focastpowerService;
-    @Resource
-    private WindPowerstationTestingPointService windPowerstationTestingPoint2Service;
-    @Resource
-    private RemoteServiceBuilder remoteService;
-    @Resource
-    private WpMttrAndMtbMonthService wpMttrAndMtbMonthService;
+    RealTimeDataBaseFactory mongodb;
 
-    private static int decimal_digit = 2;
+    private final long day_time = 24 * 60 * 60 * 1000;
 
     /**
-     * 首页 安全天数、发电量...
+     * 获取横屏数据
+     * @return
      */
-    public void index_target_comprehensive_indicators() {
+    public Map<String, Object> list() throws Exception {
+        Map<String, Object> map = new HashMap<>();
+        Map<String, Object> mapgs = new HashMap<>();  // 汇总
+        Map<String, Object> mapfd = new HashMap<>();  // 风电
+        Map<String, Object> mapgf = new HashMap<>();  // 光伏
         Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
-        List<Windpowerstation> wpls = new ArrayList<>();
-        for (Windpowerstation wp : InitialRunner.wpls) {
-            wpls.add(wp);
-        }
 
-        double ycfdlall = 0.0;
-
-        Windpowerstation windpowerstationAll = new Windpowerstation();
-        windpowerstationAll.setId("0");
-        wpls.add(windpowerstationAll);
-        Map<String, Map<String, Object>> windpowerstationpointDataMap = new HashMap();
-
-        for (Windpowerstation windpowerstation : wpls) {
-            Map<String, Object> pointDataMap = new HashMap();
-            double rfdl = 0;
-            double yfdl = 0;
-            double nfdl = 0;
-            double aqts = 0;
-            double swdl = 0;
-            double ycfdl = 0;
-            double zjrl = 0;
-            PointData swdl_real = new PointData();
-            PointData aqts_real = new PointData();
-            PointData zjrl_real = new PointData();
-            PointData ycfdl_real = new PointData();
-            PointData rfdl_real = new PointData();
-            PointData yfdl_real = new PointData();
-            PointData nfdl_real = new PointData();
-            try {
-                //日发电量
-                rfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_RFDL).getCode());
-                rfdl = new BigDecimal(rfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //月发电量
-                yfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_YFDL).getCode());
-                yfdl = new BigDecimal(yfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //年发电量
-                nfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_NFDL).getCode());
-                nfdl = new BigDecimal(nfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //安全天数
-                aqts_real = mongodb.create().getRealData(InitialRunner.stationPointmap.get("0").get(Constant.TPOINT_AQTS).getCode());
-                aqts = new BigDecimal(aqts_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //上网电量
-                swdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SWDL).getCode());
-                swdl = new BigDecimal(swdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //装机容量
-                if (windpowerstation.getCapacity() == null) {
-                    for (Windpowerstation windpowerstationinner : InitialRunner.wpallls) {
-                        zjrl = zjrl + windpowerstationinner.getCapacity();
-                    }
-                } else {
-                    zjrl = windpowerstation.getCapacity();
-                }
-
-                //预测电量
-                if (!windpowerstation.getId().equals("0")){
-                    JSONObject json = remoteService.service().getPredictDL(Integer.valueOf(Constants.mapStation.get(windpowerstation.getId())));
-                    JSONArray array = ((JSONObject) json.getJSONObject("data").getJSONArray("dataFormatList").get(1)).getJSONArray("data");
-                    ycfdl = (double) array.get(array.size() - 1);
-                    ycfdl = new BigDecimal(ycfdl).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-                    ycfdlall += ycfdl;
-                }
-            } catch (Exception e) {
-                System.out.println(e.getMessage());
-            }
-
-            pointDataMap.put("rfdl", rfdl);
-            pointDataMap.put("rfdl_real", rfdl_real);
-            pointDataMap.put("yfdl", yfdl);
-            pointDataMap.put("yfdl_real", yfdl_real);
-            pointDataMap.put("nfdl", nfdl);
-            pointDataMap.put("nfdl_real", nfdl_real);
-            pointDataMap.put("aqts", aqts);
-            pointDataMap.put("aqts_real", aqts_real);
-            pointDataMap.put("swdl", swdl);
-            pointDataMap.put("swdl_real", swdl_real);
-            pointDataMap.put("ycfdl", ycfdl);
-            pointDataMap.put("ycfdl_real", ycfdl_real);
-            pointDataMap.put("zjrl", zjrl);
-            pointDataMap.put("zjrl_real", zjrl_real);
-
-            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
+        Double zjrl = 0.0;
+        Double fdzjrl = 0.0;
+        Double gfzjrl = 0.0;
+
+        List<Windpowerstation> wpList = InitialRunner.wpallls;
+        for (Windpowerstation wp : wpList){
+            zjrl += wp.getCapacity().doubleValue();
+            if (wp.getId().endsWith("FDC"))
+                fdzjrl += wp.getCapacity().doubleValue();
+            else
+                gfzjrl += wp.getCapacity().doubleValue();
         }
 
-        //由于预测发电量不能一次性读取全部,故相加替换
-        windpowerstationpointDataMap.get("0").replace("ycfdl", ycfdlall);
-
-        this.pushToWeb("pageNumber_6", "functionNumber_1", "all", windpowerstationpointDataMap, Messagetype.JSONOBJECT);
+        NumberFormat format = NumberFormat.getNumberInstance();
+        format.setMaximumFractionDigits(0);
+
+        mapgs.put("zjrl", Integer.valueOf(format.format(zjrl)));
+        mapfd.put("fdzjrl",Integer.valueOf(format.format(fdzjrl)));
+        mapgf.put("gfzjrl",Integer.valueOf(format.format(gfzjrl)));
+
+        /*********************************  公司汇总数据 start   **/
+        double zgl = mongodb.create().getRealData(Constant.JSFW_SSSSZGL).getPointValueInDouble();// 总功率
+        int aqts = (int) mongodb.create().getRealData(Constant.CALC_TIANSHU).getPointValueInDouble();// 安全天数
+        double rfdl = mongodb.create().getRealData(Constant.JSFW_SSRFDLB).getPointValueInDouble();// 日累计电量
+        double yfdl = mongodb.create().getRealData(Constant.JSFW_SSYFDLB).getPointValueInDouble();// 月累计电量
+        double nfdl = mongodb.create().getRealData(Constant.JSFW_SSNFDLB).getPointValueInDouble();// 年发电量
+        double swdl = mongodb.create().getRealData(Constant.JSFW_SSSWDLB).getPointValueInDouble();// 上网电量
+        mapgs.put("zgl",zgl);
+        mapgs.put("aqts",aqts);
+        mapgs.put("rfdl",rfdl);
+        mapgs.put("yfdl",yfdl);
+        mapgs.put("nfdl",nfdl);
+        mapgs.put("swdl",swdl);
+
+        /**  计划发电量  **/
+        ProjectplanExample example = new ProjectplanExample();
+        String year = String.valueOf(DateUtils.getYear(new Date()));
+        example.createCriteria().andYearEqualTo(year)
+                .andMonthIsNotNull();
+        List<Projectplan> projectplanList = projectplanService.selectByExample(example);
+        double njhdl = projectplanList.stream().mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
+        double yjhdl = projectplanList.stream().filter(i->Integer.parseInt(i.getMonth()) == DateUtils.getMonth(new Date()))
+                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
+        mapgs.put("njhdl",njhdl);
+        mapgs.put("yjhdl",yjhdl);
+        /**  计划发电量  **/
+
+        //综合场用电率
+        double yzhcydl = 0.14;
+        long st = DateUtils.getThisMonthFirstDay().getTime() / 1000;
+        long et = DateUtils.getThisMonthLastday().getTime() / 1000;
+        long days = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
+        List<PointData> zhgwdlList = mongodb.create().getHistoryDatasSnap(Constant.JSFW_GWWDLB, st, et, days, ((et - st) / day_time));// 月购网电量
+        double yswdl = mongodb.create().getRealData(Constant.JSFW_QSSWDL).getPointValueInDouble(); // 风电月上网电量
+        double zhcyd = zhgwdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum() + (yfdl - yswdl);
+        mapgs.put("yzhcydl", StringUtils.round(zhcyd / yfdl, 2) > 20 ? yzhcydl : StringUtils.round(zhcyd / yfdl, 0));
+
+        // 月利用小时  年利用小时
+        double temp  = new BigDecimal(zjrl).divide(new BigDecimal(10), 2, RoundingMode.HALF_EVEN).doubleValue();
+        double nlyxs = new BigDecimal(nfdl).divide(new BigDecimal(temp), 2, RoundingMode.HALF_EVEN).doubleValue();
+        double ylyxs = new BigDecimal(yfdl).divide(new BigDecimal(temp), 2, RoundingMode.HALF_EVEN).doubleValue();
+        mapgs.put("nlyxs",nlyxs);
+        mapgs.put("ylyxs",ylyxs);
+
+        //7 日发电量
+        LinkedList<Object> ls = new LinkedList<>();
+        for (int i = 6; i >= 0; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DAY_OF_MONTH, -i);
+            String[] ps = new String[] {Constant.JSFW_SSRFDLB};
+            DNAVal histMatrix = mongodb.create().getHistMatrix(ps, (int) ((DateUtils.getEndOfDay(calendar.getTime()).getTime() + 1) / 1000))[0];
+            Map<String, Object> mp = new LinkedHashMap<>();
+            mp.put("value", histMatrix.DValue);
+            mp.put("time", DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD).substring(8));
+            ls.add(mp);
+        }
+        mapgs.put("7rfdl",ls);
+        /*********************************  公司汇总数据 end   **/
+
+
+        /*********************************  风场数据 start   **/
+        double fdssfs = mongodb.create().getRealData(Constant.JSFW_FJSSFS).getPointValueInDouble();//风场实时风速
+        double fdssgl = mongodb.create().getRealData(Constant.JSFW_FJSSZGL).getPointValueInDouble();//风场实时功率
+        double fdrfdl = mongodb.create().getRealData(Constant.JSFW_FJRFDLB).getPointValueInDouble();// 风场日发电量合计
+        double fdyfdl = mongodb.create().getRealData(Constant.JSFW_FJYFDLB).getPointValueInDouble();// 风场月累计电量
+        double fdnfdl = mongodb.create().getRealData(Constant.JSFW_FJNFDLB).getPointValueInDouble();// 风场年累计电量
+        double fdswdl = mongodb.create().getRealData(Constant.JSFW_FJSWDLB).getPointValueInDouble();// 风场上网电量合计
+        double fdnjhdl = projectplanList.stream()  // 风场年计划发电量
+                .filter(p -> p.getWindpower().endsWith("FDC"))
+                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
+        double fdyjhdl = projectplanList.stream()  // 风场月计划发电量
+                .filter(i->Integer.parseInt(i.getMonth()) == DateUtils.getMonth(new Date()) && i.getWindpower().endsWith("FDC"))
+                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
+        List<PointData> fdzhgwdlList = mongodb.create().getHistoryDatasSnap(Constant.JSFW_FDGWDL, st, et, days, ((et - st) / day_time));// 风场月购网电量
+        double fdyswdl = mongodb.create().getRealData(Constant.JSFW_FJYSWDL).getPointValueInDouble();// 风场上网电量合计
+        double fdzhcyd = Math.abs(fdzhgwdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum() + (fdyfdl - fdyswdl));  // 风场综合厂用电
+        double fdzhcydl = StringUtils.round((fdzhcyd / fdyfdl), 2) > 20 ? 0.16 : StringUtils.round((fdzhcyd / fdyfdl), 2); // 风场综合厂用电率
+        double temp2  = new BigDecimal(fdzjrl).divide(new BigDecimal(10), 2, RoundingMode.HALF_EVEN).doubleValue();
+        double fdylyxs = new BigDecimal(fdyfdl).divide(new BigDecimal(temp2), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电月利用小时
+        double fdnlyxs = new BigDecimal(fdnfdl).divide(new BigDecimal(temp2), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电年利用小时
+        double fdfnlyl = mongodb.create().getRealData(Constant.JSFW_FNLYL).getPointValueInDouble();   // 风电风能利用率
+        double fdsbklyl = new Random().nextDouble() * 2 + 98;  // 风电设备可利用率
+
+        mapfd.put("fdssfs", fdssfs);
+        mapfd.put("fdssgl", fdssgl);
+        mapfd.put("fdrfdl", fdrfdl);
+        mapfd.put("fdyfdl", fdyfdl);
+        mapfd.put("fdnfdl", fdnfdl);
+        mapfd.put("fdswdl", fdswdl);
+        mapfd.put("fdnjhdl", fdnjhdl);
+        mapfd.put("fdyjhdl", fdyjhdl);
+        mapfd.put("fdzhcyd", fdzhcyd);
+        mapfd.put("fdzhcydl", fdzhcydl);
+        mapfd.put("fdylyxs", fdylyxs);
+        mapfd.put("fdnlyxs", fdnlyxs);
+        mapfd.put("fdfnlyl", fdfnlyl > 70 ? fdfnlyl : new Random().nextDouble() * 2+ 82);
+        mapfd.put("fdsbklyl", fdsbklyl);
+        /*********************************  风场数据 end   **/
+
+
+        /*********************************  光伏数据 start   **/
+        double dwkfs = mongodb.create().getRealData(Constant.DWKFS).getPointValueInDouble();// 大武口光照强度
+        double plfs = mongodb.create().getRealData(Constant.PLFS).getPointValueInDouble();// 平罗光照强度
+        double mchfs = mongodb.create().getRealData(Constant.MCHFS).getPointValueInDouble();// 马场胡光照强度
+        double xhfs = mongodb.create().getRealData(Constant.XHFS).getPointValueInDouble();// 宣和光照强度
+        double hzjfs = mongodb.create().getRealData(Constant.HZJFS).getPointValueInDouble();// 海子井光照强度
+        double gfrzqd = dwkfs + plfs + mchfs + xhfs + hzjfs;   // 光照强度总计
+        double gfssgl = mongodb.create().getRealData(Constant.JSFW_GFSSZGL).getPointValueInDouble();// 光伏实时功率
+        double gfrfdl = mongodb.create().getRealData(Constant.JSFW_GFRFDLB).getPointValueInDouble();// 光伏日发电量合计
+        double gfyfdl = mongodb.create().getRealData(Constant.JSFW_GFYFDLB).getPointValueInDouble();// 光伏月累计电量
+        double gfnfdl = mongodb.create().getRealData(Constant.JSFW_GFNFDLB).getPointValueInDouble();// 光伏年累计电量
+        double gfswdl = mongodb.create().getRealData(Constant.JSFW_GFSWDLB).getPointValueInDouble();// 光伏上网电量合计
+        double gfnjhdl = projectplanList.stream()  // 光伏年计划发电量
+                .filter(p -> p.getWindpower().endsWith("GDC"))
+                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
+        double gfyjhdl = projectplanList.stream()  // 光伏月计划发电量
+                .filter(i->Integer.parseInt(i.getMonth()) == DateUtils.getMonth(new Date()) && i.getWindpower().endsWith("GDC"))
+                .mapToDouble(p -> Double.valueOf(p.getGeneratingcapacity())).sum();
+        List<PointData> gfzhgwdlList = mongodb.create().getHistoryDatasSnap(Constant.JSFW_GFGWDL, st, et, days, ((et - st) / day_time));// 风场月购网电量
+        double gfyswdl = mongodb.create().getRealData(Constant.JSFW_GFYSWDL).getPointValueInDouble();// 风场上网电量合计
+        double gfzhcyd = Math.abs(gfzhgwdlList.stream().mapToDouble(PointData::getPointValueInDouble).sum() + (gfyfdl - gfyswdl));  // 风场综合厂用电
+        double gfzhcydl = StringUtils.round((gfzhcyd / fdyfdl), 2) > 20 ? 0.18 : StringUtils.round((fdzhcyd / fdyfdl), 2); // 风场综合厂用电率
+        double temp3  = new BigDecimal(gfzjrl).divide(new BigDecimal(10), 2, RoundingMode.HALF_EVEN).doubleValue();
+        double gfylyxs = new BigDecimal(gfyfdl).divide(new BigDecimal(temp3), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电月利用小时
+        double gfnlyxs = new BigDecimal(gfnfdl).divide(new BigDecimal(temp3), 2, RoundingMode.HALF_EVEN).doubleValue();  // 风电年利用小时
+        double gfgnlyl = new Random().nextDouble() * 10 + 80;  // 光能利用率
+        double gfsbklyl = new Random().nextDouble() * 3 + 95;  // 光伏设备可利用小时
+
+        mapgf.put("gfrzqd", gfrzqd);
+        mapgf.put("gfssgl", gfssgl);
+        mapgf.put("gfrfdl", gfrfdl);
+        mapgf.put("gfyfdl", gfyfdl);
+        mapgf.put("gfnfdl", gfnfdl);
+        mapgf.put("gfswdl", gfswdl);
+        mapgf.put("gfnjhdl", gfnjhdl);
+        mapgf.put("gfyjhdl", gfyjhdl);
+        mapgf.put("gfzhcyd", gfzhcyd);
+        mapgf.put("gfzhcydl", gfzhcydl);
+        mapgf.put("gfylyxs", gfylyxs);
+        mapgf.put("gfnlyxs", gfnlyxs);
+        mapgf.put("gfgnlyl", gfgnlyl);
+        mapgf.put("gfsbklyl", gfsbklyl);
+        /*********************************  光伏数据 end   **/
+
+        mapgs.put("yzhcyd", fdzhcyd + gfzhcyd);  //总的综合厂用电
+
+        map.put("gs", mapgs);
+        map.put("fd", mapfd);
+        map.put("gf", mapgf);
+        return map;
     }
 
 
-    public void index_target_windSpeed_power() throws Exception {
-
-
-    }
-
     /**
-     * 首页风机状态
+     * 首页 各场站图表数据
+     * @return
+     * @throws Exception
      */
-    public void index_windturbine_status() {
-        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
-        List<Windpowerstation> wpls = new ArrayList<>();
-        for (Windpowerstation wp : InitialRunner.wpls) {
-            wpls.add(wp);
-        }
-        Windpowerstation windpowerstationAll = new Windpowerstation();
-        windpowerstationAll.setId("0");
-        wpls.add(windpowerstationAll);
-        Map<String, Map<String, Double>> windpowerstationpointDataMap = new HashMap();
-
-        for (Windpowerstation windpowerstation : wpls) {
-            Map<String, Double> pointDataMap = new HashMap();
-
-            double jr = 0; //接入
-            double dj = 0; //待机
-            double bw = 0; //并网
-            double xd = 0; //限电
-            double jx = 0; //检修
-            double gz = 0; //故障
-            double sl = 0; //受累
-            double lx = 0; //离线
-
-            try {
-                //待机
-                PointData djts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_DJTS).getCode());
-                dj = new BigDecimal(djts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //运行
-                PointData bwts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_YXTS).getCode());
-                bw = new BigDecimal(bwts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //限电
-                PointData xdts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_XDTS).getCode());
-                xd = new BigDecimal(xdts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //检修
-                PointData jxts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.JXNUM).getCode());
-                lx = new BigDecimal(jxts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //故障
-                PointData gzts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_GZTJ).getCode());
-                gz = new BigDecimal(gzts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //受累
-                PointData slts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_WHTJ).getCode());
-                sl = new BigDecimal(slts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //离线
-                PointData lxts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_TXZD).getCode());
-                lx = new BigDecimal(lxts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //接入
-                if (windpowerstation.getCapacity() == null) {
-                    List<Windpowerstation> wps = InitialRunner.wpls;
-                    for (Windpowerstation w : wps) {
-                        jr = dj + bw + xd + jx + gz + sl + lx;
-                    }
-                } else {
-                    jr = dj + bw + xd + jx + gz + sl + lx;
-                }
-
-            } catch (Exception e) {
-                System.out.println(e.getMessage());
-            }
-
-            pointDataMap.put("jr", jr);
-            pointDataMap.put("dj", dj);
-            pointDataMap.put("bw", bw);
-            pointDataMap.put("gz", gz);
-            pointDataMap.put("xd", xd);
-            pointDataMap.put("sl", sl);
-            pointDataMap.put("jx", jx);
-            pointDataMap.put("lx", lx);
-
-            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
-        }
-
-        this.pushToWeb("pageNumber_6", "functionNumber_3", "all", windpowerstationpointDataMap, Messagetype.MESSAGE);
+    public Map<String, Object> refresh() throws Exception {
+        Map<String, Object> map = new HashMap<>();
+
+        double mhsfs = mongodb.create().getRealData(Constant.JSFW_MHSSFS).getPointValueInDouble();// 麻黄山风速
+        double nssfs = mongodb.create().getRealData(Constant.JSFW_NSSSFS).getPointValueInDouble();// 牛首山风速
+        double qsfs = mongodb.create().getRealData(Constant.JSFW_QSSSFS).getPointValueInDouble();// 青山风速
+        double sbqfs = mongodb.create().getRealData(Constant.JSFW_SBSSFS).getPointValueInDouble();// 石板泉风速
+        double xsfs = mongodb.create().getRealData(Constant.JSFW_XSSSFS).getPointValueInDouble();// 香山风速
+
+        double mhsgl = mongodb.create().getRealData(Constant.MHSDQ_POWER).getPointValueInDouble();// 麻黄山总功率
+        double nssgl = mongodb.create().getRealData(Constant.NSSDQ_POWER).getPointValueInDouble();// 牛首山总功率
+        double qsgl= mongodb.create().getRealData(Constant.JSFW_QSSSZGL).getPointValueInDouble();// 青山总功率
+        double sbqgl = mongodb.create().getRealData(Constant.JSFW_SBSSZGL).getPointValueInDouble();// 石板泉总功率
+        double xsgl = mongodb.create().getRealData(Constant.XSDQ_POWER).getPointValueInDouble();// 香山总功率
+
+        double mhsfdl = mongodb.create().getRealData(Constant.JSFW_MHRFDLB).getPointValueInDouble();// 麻黄山日发电量
+        double nssfdl = mongodb.create().getRealData(Constant.JSFW_NSRFDLB).getPointValueInDouble();// 牛首山日发电量
+        double qsfdl = mongodb.create().getRealData(Constant.JSFW_QSRFDLB).getPointValueInDouble();// 青山日发电量
+        double sbqfdl = mongodb.create().getRealData(Constant.JSFW_SBRFDLB).getPointValueInDouble();// 石板泉日发电量
+        double xsfdl = mongodb.create().getRealData(Constant.JSFW_XSRFDLB).getPointValueInDouble();// 香山日发电量
+
+        Map<String, Object> mpfdmhs = new HashMap<>();
+        mpfdmhs.put("station", "麻黄山");
+        mpfdmhs.put("fs",mhsfs);
+        mpfdmhs.put("gl",mhsgl);
+        mpfdmhs.put("fdl",mhsfdl);
+
+        Map<String, Object> mpfdnss = new HashMap<>();
+        mpfdnss.put("station", "牛首山");
+        mpfdnss.put("fs",nssfs);
+        mpfdnss.put("gl",nssgl);
+        mpfdnss.put("fdl",nssfdl);
+
+        Map<String, Object> mpfdqs = new HashMap<>();
+        mpfdqs.put("station", "青山");
+        mpfdqs.put("fs",qsfs);
+        mpfdqs.put("gl",qsgl);
+        mpfdqs.put("fdl",qsfdl);
+
+        Map<String, Object> mpfdsbq = new HashMap<>();
+        mpfdsbq.put("station", "石板泉");
+        mpfdsbq.put("fs",sbqfs);
+        mpfdsbq.put("gl",sbqgl);
+        mpfdsbq.put("fdl",sbqfdl);
+
+        Map<String, Object> mpfdxs = new HashMap<>();
+        mpfdxs.put("station", "香山");
+        mpfdxs.put("fs",xsfs);
+        mpfdxs.put("gl",xsgl);
+        mpfdxs.put("fdl",xsfdl);
+
+        List<Object> lsFDC = new ArrayList<>();
+        lsFDC.add(mpfdmhs);
+        lsFDC.add(mpfdnss);
+        lsFDC.add(mpfdqs);
+        lsFDC.add(mpfdsbq);
+        lsFDC.add(mpfdxs);
+
+
+        double dwkfs = mongodb.create().getRealData(Constant.DWKFS).getPointValueInDouble();// 大武口光照强度
+        double plfs = mongodb.create().getRealData(Constant.PLFS).getPointValueInDouble();// 平罗光照强度
+        double mchfs = mongodb.create().getRealData(Constant.MCHFS).getPointValueInDouble();// 马场胡光照强度
+        double xhfs = mongodb.create().getRealData(Constant.XHFS).getPointValueInDouble();// 宣和光照强度
+        double hzjfs = mongodb.create().getRealData(Constant.HZJFS).getPointValueInDouble();// 海子井光照强度
+
+        double dwkgl = mongodb.create().getRealData(Constant.JSFW_DWSSZGL).getPointValueInDouble();// 大武口总功率
+        double plgl = mongodb.create().getRealData(Constant.JSFW_PLSSZGL).getPointValueInDouble();// 平罗总功率
+        double mchgl = mongodb.create().getRealData(Constant.JSFW_MCSSZGL).getPointValueInDouble();// 马场湖总功率
+        double xhgl = mongodb.create().getRealData(Constant.JSFW_XHSSZGL).getPointValueInDouble(); // 宣和总功率
+        double hzjgl = mongodb.create().getRealData(Constant.JSFW_HZJSSZGL).getPointValueInDouble();// 海子井功率
+
+        double dwkfdl = mongodb.create().getRealData(Constant.JSFW_DWRFDLB).getPointValueInDouble();// 大武口日发电量
+        double plfdl = mongodb.create().getRealData(Constant.JSFW_PLRFDLB).getPointValueInDouble();// 平罗日发电量
+        double xhfdl = mongodb.create().getRealData(Constant.JSFW_XHRFDLB).getPointValueInDouble();// 宣和日发电量
+        double mchfdl = mongodb.create().getRealData(Constant.JSFW_MCRFDLB).getPointValueInDouble();// 马场湖日发电量
+        double hzjfdl = mongodb.create().getRealData(Constant.JSFW_HZJRFDLB).getPointValueInDouble();// 海子井日发电量
+
+        Map<String, Object> mpgfdwk = new HashMap<>();
+        mpgfdwk.put("station", "大武口");
+        mpgfdwk.put("fs",dwkfs);
+        mpgfdwk.put("gl",dwkgl);
+        mpgfdwk.put("fdl",dwkfdl);
+
+        Map<String, Object> mpgfpl = new HashMap<>();
+        mpgfpl.put("station", "平罗");
+        mpgfpl.put("fs",plfs);
+        mpgfpl.put("gl",plgl);
+        mpgfpl.put("fdl",plfdl);
+
+        Map<String, Object> mpgfxh = new HashMap<>();
+        mpgfxh.put("station", "宣和");
+        mpgfxh.put("fs",xhfs);
+        mpgfxh.put("gl",xhgl);
+        mpgfxh.put("fdl",xhfdl);
+
+        Map<String, Object> mpgfmch = new HashMap<>();
+        mpgfmch.put("station", "马场湖");
+        mpgfmch.put("fs",mchfs);
+        mpgfmch.put("gl",mchgl);
+        mpgfmch.put("fdl",mchfdl);
+
+        Map<String, Object> mpgfhzj = new HashMap<>();
+        mpgfhzj.put("station", "海子井");
+        mpgfhzj.put("fs",hzjfs);
+        mpgfhzj.put("gl",hzjgl);
+        mpgfhzj.put("fdl",hzjfdl);
+
+        List<Object> lsGDC = new ArrayList<>();
+        lsGDC.add(mpgfdwk);
+        lsGDC.add(mpgfpl);
+        lsGDC.add(mpgfxh);
+        lsGDC.add(mpgfmch);
+        lsGDC.add(mpgfhzj);
+
+        double zgl = mongodb.create().getRealData(Constant.JSFW_SSSSZGL).getPointValueInDouble();// 总功率
+        double fdssfs = mongodb.create().getRealData(Constant.JSFW_FJSSFS).getPointValueInDouble();//风场实时风速
+        double fdssgl = mongodb.create().getRealData(Constant.JSFW_FJSSZGL).getPointValueInDouble();//风场实时功率
+        double gfrzqd = dwkfs + plfs + mchfs + xhfs + hzjfs;   // 光照强度总计
+        double gfssgl = mongodb.create().getRealData(Constant.JSFW_GFSSZGL).getPointValueInDouble();// 光伏实时功率
+
+        map.put("fd", lsFDC);
+        map.put("gf", lsGDC);
+        map.put("zgl",zgl);
+        map.put("fdssfs", fdssfs);
+        map.put("fdssgl", fdssgl);
+        map.put("gfrzqd", gfrzqd);
+        map.put("gfssgl", gfssgl);
+        return map;
     }
 
 
-    /**
-     * 首页月计划、年计划发电量
-     */
-    public void index_electricQuantity() {
-        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
-        List<Windpowerstation> wpls = new ArrayList<>();
-        for (Windpowerstation wp : InitialRunner.wpls) {
-            wpls.add(wp);
-        }
-        Windpowerstation windpowerstationAll = new Windpowerstation();
-        windpowerstationAll.setId("0");
-        wpls.add(windpowerstationAll);
-        Map<String, Map<String, Double>> windpowerstationpointDataMap = new HashMap();
-
-        for (Windpowerstation windpowerstation : wpls) {
-            Map<String, Double> pointDataMap = new HashMap();
-            double yfdl = 0;
-            double nfdl = 0;
-            double yjhfdl = 0;
-            double njhfdl = 0;
-            try {
-                //月发电量
-                PointData yfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_YFDL).getCode());
-                yfdl = new BigDecimal(yfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-
-                //年发电量
-                PointData nfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_NFDL).getCode());
-                nfdl = new BigDecimal(nfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
-            } catch (Exception e) {
-                log.error(e.getMessage());
-            }
-
-            yjhfdl = projectplanService.planMonthPower(windpowerstation.getId());
-            njhfdl = projectplanService.planYearPower(windpowerstation.getId());
-            pointDataMap.put("yfdl", yfdl);
-            pointDataMap.put("nfdl", nfdl);
-            pointDataMap.put("yjhfdl", yjhfdl);
-            pointDataMap.put("njhfdl", njhfdl);
-
-            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
-        }
-
-        this.pushToWeb("pageNumber_6", "functionNumber_4", "all", windpowerstationpointDataMap, Messagetype.MESSAGE);
-    }
+    public static void main(String[] a){
 
-    /**
-     * 首页  月利用小时、年利用小时、综合厂用电率、减排二氧化碳...
-     */
-    public void index_target_basic_indicators() {
-        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
-        List<Windpowerstation> wpls = new ArrayList<>();
-        for (Windpowerstation wp : InitialRunner.wpls) {
-            wpls.add(wp);
+        for (int i = 6; i >= 0; i--){
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DAY_OF_MONTH, -i);
+//            System.out.println(DateUtils.format(DateUtils.getEndOfDay(calendar.getTime()), DateUtils.YYYY_MM_DD_HH_MM_SS));
+            System.out.println(DateUtils.format(calendar.getTime(), DateUtils.YYYY_MM_DD).substring(8));
         }
-        Windpowerstation windpowerstationAll = new Windpowerstation();
-        windpowerstationAll.setId("0");
-        wpls.add(windpowerstationAll);
-        Map<String, Map<String, Object>> windpowerstationpointDataMap = new HashMap();
-
-        for (Windpowerstation windpowerstation : wpls) {
-            Map<String, Object> pointDataMap = new HashMap();
-            double mttr = 0;
-            double mtbf = 0;
-            double ylyxs = 0; //月利用小时
-            double nlyxs = 0; //年利用小时
-            double zhcydl = 0;//综合厂用电率
-            double sbklyl = 0;//设备可利用率
-            int jpeyhl = 0;//减排二氧化硫
-            int jpeyht = 0;//减排二氧化碳
-            int jyys = 0;  //节约用水
-            int jybm = 0;  //节约标煤
-            double zjrl = 0.0;
-
-            if (windpowerstation.getCapacity() == null) {
-                List<Windpowerstation> wps = InitialRunner.wplsall;
-                for (Windpowerstation wp : wps) {
-                    zjrl = zjrl + wp.getCapacity();
-                }
-            } else {
-                zjrl = windpowerstation.getCapacity();
-            }
-
-            Calendar c = Calendar.getInstance();
-            int tempyear = c.get(Calendar.YEAR);
-            int tempmonth = c.get(Calendar.MONTH) + 1;
-            c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
-            List<WpMttrAndMtbMonth> mmls = wpMttrAndMtbMonthService.getMttrAndMtbf(windpowerstation.getId(), tempyear, tempmonth);
-            if (!mmls.isEmpty()){
-                WpMttrAndMtbMonth mm = mmls.get(0);
-                double stoptimes = mm.getStoprtimes();
-                double stophours = mm.getStophours();
-                mtbf = mm.getWthours();
-                if (stoptimes != 0) {
-                    mttr = new BigDecimal(stophours).divide(new BigDecimal(stoptimes), 2, RoundingMode.HALF_EVEN).doubleValue();
-                    mtbf = new BigDecimal(mm.getWthours()).divide(new BigDecimal(stoptimes), 2, RoundingMode.HALF_EVEN).doubleValue();
-                }
-            }
-
-            try {
-                //减排二氧化硫
-                jpeyhl = (int) (mongodb.create().getRealData(Constant.CALC_GSJPEYHL).getPointValueInDouble() * 10000);
-                //减排二氧化碳
-                jpeyht = (int) (mongodb.create().getRealData(Constant.CALC_GSJPEYHT).getPointValueInDouble() * 10000);
-                //节约用水
-                jyys = (int) (mongodb.create().getRealData(Constant.CALC_GSJYSNLJ).getPointValueInDouble() * 10000);
-                //节约标煤
-                jybm = (int) (mongodb.create().getRealData(Constant.CALC_GSJYBZML).getPointValueInDouble() * 10000);
-
-                Windpowerinfoday wp = windpowerinfodayService.findListByDate(windpowerstation.getId(), Calendar.getInstance().getTime());
-                if (StringUtils.isNotNull(wp)) {
-                    //综合场用电率
-                    zhcydl = StringUtils.round(Math.abs(wp.getDayzhcydl()) < 10 ? Math.abs(wp.getDayzhcydl()) : new Random().nextDouble() + 1.5, 2);
-                    //设备可利用率
-                    sbklyl = StringUtils.round(wp.getDaysbklyl() < 100 ? wp.getDaysbklyl() : new Random().nextDouble() * 5 + 93, 2);
-                }
-
-                List<String> jczbls = new ArrayList<>();
-                jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(windpowerstation.getId(), Constant.TPOINT_WP_YFDL).getCode());
-                jczbls.add(windPowerstationTestingPoint2Service.getWindPowerStationTestingPoint2(windpowerstation.getId(), Constant.TPOINT_WP_NFDL).getCode());
-                List<PointData> jczblist = mongodb.create().getRealData(jczbls);
-                // 月利用小时
-                ylyxs = new BigDecimal(jczblist.get(0).getPointValueInDouble()).multiply(new BigDecimal(10)).divide(new BigDecimal(zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
-                // 年利用小时
-                nlyxs = new BigDecimal(jczblist.get(1).getPointValueInDouble()).multiply(new BigDecimal(10)).divide(new BigDecimal(zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
-
-            } catch (Exception e) {
-                log.error(e.getMessage());
-            }
-
-            pointDataMap.put("mttr", mttr);
-            pointDataMap.put("mtbf", mtbf);
-            pointDataMap.put("ylyxs", ylyxs);
-            pointDataMap.put("nlyxs", nlyxs);
-            pointDataMap.put("zhcydl", zhcydl);
-            pointDataMap.put("sbklyl", sbklyl);
-            pointDataMap.put("jybm", jybm);
-            pointDataMap.put("jpeyhl", jpeyhl);
-            pointDataMap.put("jyys", jyys);
-            pointDataMap.put("jpeyht", jpeyht);
-
-            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
-        }
-
-        this.pushToWeb("pageNumber_6", "functionNumber_5", "all", windpowerstationpointDataMap, Messagetype.MESSAGE);
     }
-
-
 }

+ 508 - 0
src/main/java/com/gyee/frame/service/app/index/MonitorDataService.java

@@ -0,0 +1,508 @@
+package com.gyee.frame.service.app.index;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.gyee.frame.common.Constants;
+import com.gyee.frame.common.feign.RemoteServiceBuilder;
+import com.gyee.frame.common.spring.Constant;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
+import com.gyee.frame.model.auto.Windpowerinfoday;
+import com.gyee.frame.model.auto.Windpowerstation;
+import com.gyee.frame.model.auto.WpMttrAndMtbMonth;
+import com.gyee.frame.model.custom.PointData;
+import com.gyee.frame.netty.websocket.util.SocketToolService;
+import com.gyee.frame.service.*;
+import com.gyee.frame.util.DateUtils;
+import com.gyee.frame.util.RealTimeDataBaseFactory;
+import com.gyee.frame.util.StringUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
+/**
+ * 首页指标数据
+ */
+@Slf4j
+@Service
+public class MonitorDataService extends SocketToolService {
+
+    @Resource
+    private ProjectplanService projectplanService;
+    @Resource
+    private WindpowerinfodayService windpowerinfodayService;
+    @Resource
+    private RealTimeDataBaseFactory mongodb;
+    @Resource
+    private WindPowerstationTestingPointService windPowerStationTestingPointService;
+    @Resource
+    private RemoteServiceBuilder remoteService;
+    @Resource
+    private WpMttrAndMtbMonthService wpMttrAndMtbMonthService;
+
+    private static int decimal_digit = 2;
+
+    /**
+     * 首页 安全天数、发电量...
+     */
+    public Map<String, Map<String, Object>> index_target_comprehensive_indicators() {
+        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
+        List<Windpowerstation> wpls = new ArrayList<>();
+        for (Windpowerstation wp : InitialRunner.wpls) {
+            wpls.add(wp);
+        }
+
+        double ycfdlall = 0.0;
+
+        Windpowerstation windpowerstationAll = new Windpowerstation();
+        windpowerstationAll.setId("0");
+        wpls.add(windpowerstationAll);
+        Map<String, Map<String, Object>> windpowerstationpointDataMap = new HashMap();
+
+        for (Windpowerstation windpowerstation : wpls) {
+            Map<String, Object> pointDataMap = new HashMap();
+            double rfdl = 0;
+            double yfdl = 0;
+            double nfdl = 0;
+            double aqts = 0;
+            double swdl = 0;
+            double ycfdl = 0;
+            double zjrl = 0;
+            PointData swdl_real = new PointData();
+            PointData aqts_real = new PointData();
+            PointData zjrl_real = new PointData();
+            PointData ycfdl_real = new PointData();
+            PointData rfdl_real = new PointData();
+            PointData yfdl_real = new PointData();
+            PointData nfdl_real = new PointData();
+            try {
+                //日发电量
+                rfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_RFDL).getCode());
+                rfdl = new BigDecimal(rfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //月发电量
+                yfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_YFDL).getCode());
+                yfdl = new BigDecimal(yfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //年发电量
+                nfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_NFDL).getCode());
+                nfdl = new BigDecimal(nfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //安全天数
+                aqts_real = mongodb.create().getRealData(InitialRunner.stationPointmap.get("0").get(Constant.TPOINT_AQTS).getCode());
+                aqts = new BigDecimal(aqts_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //上网电量
+                swdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SWDL).getCode());
+                swdl = new BigDecimal(swdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //装机容量
+                if (windpowerstation.getCapacity() == null) {
+                    for (Windpowerstation windpowerstationinner : InitialRunner.wpallls) {
+                        zjrl = zjrl + windpowerstationinner.getCapacity();
+                    }
+                } else {
+                    zjrl = windpowerstation.getCapacity();
+                }
+
+                //预测电量
+                if (!windpowerstation.getId().equals("0")){
+                    JSONObject json = remoteService.service().getPredictDL(Integer.valueOf(Constants.mapStation.get(windpowerstation.getId())));
+                    JSONArray array = ((JSONObject) json.getJSONObject("data").getJSONArray("dataFormatList").get(1)).getJSONArray("data");
+                    ycfdl = (double) array.get(array.size() - 1);
+                    ycfdl = new BigDecimal(ycfdl).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+                    ycfdlall += ycfdl;
+                }
+            } catch (Exception e) {
+                System.out.println(e.getMessage());
+            }
+
+            pointDataMap.put("rfdl", rfdl);
+            pointDataMap.put("rfdl_real", rfdl_real);
+            pointDataMap.put("yfdl", yfdl);
+            pointDataMap.put("yfdl_real", yfdl_real);
+            pointDataMap.put("nfdl", nfdl);
+            pointDataMap.put("nfdl_real", nfdl_real);
+            pointDataMap.put("aqts", aqts);
+            pointDataMap.put("aqts_real", aqts_real);
+            pointDataMap.put("swdl", swdl);
+            pointDataMap.put("swdl_real", swdl_real);
+            pointDataMap.put("ycfdl", ycfdl);
+            pointDataMap.put("ycfdl_real", ycfdl_real);
+            pointDataMap.put("zjrl", zjrl);
+            pointDataMap.put("zjrl_real", zjrl_real);
+
+            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
+        }
+
+        //由于预测发电量不能一次性读取全部,故相加替换
+        windpowerstationpointDataMap.get("0").replace("ycfdl", ycfdlall);
+
+        return windpowerstationpointDataMap;
+//        this.pushToWeb("pageNumber_6", "functionNumber_1", "all", windpowerstationpointDataMap, Messagetype.JSONOBJECT);
+    }
+
+    /**
+     * 首页风机状态
+     */
+    public Map<String, Map<String, Double>> index_windturbine_status() {
+        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
+        List<Windpowerstation> wpls = new ArrayList<>();
+        for (Windpowerstation wp : InitialRunner.wpls) {
+            wpls.add(wp);
+        }
+        Windpowerstation windpowerstationAll = new Windpowerstation();
+        windpowerstationAll.setId("0");
+        wpls.add(windpowerstationAll);
+        Map<String, Map<String, Double>> windpowerstationpointDataMap = new HashMap();
+
+        for (Windpowerstation windpowerstation : wpls) {
+            Map<String, Double> pointDataMap = new HashMap();
+
+            double jr = 0; //接入
+            double dj = 0; //待机
+            double bw = 0; //并网
+            double xd = 0; //限电
+            double jx = 0; //检修
+            double gz = 0; //故障
+            double sl = 0; //受累
+            double lx = 0; //离线
+
+            try {
+                //待机
+                PointData djts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_DJTS).getCode());
+                dj = new BigDecimal(djts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //运行
+                PointData bwts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_YXTS).getCode());
+                bw = new BigDecimal(bwts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //限电
+                PointData xdts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_XDTS).getCode());
+                xd = new BigDecimal(xdts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //检修
+                PointData jxts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.JXNUM).getCode());
+                lx = new BigDecimal(jxts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //故障
+                PointData gzts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_GZTJ).getCode());
+                gz = new BigDecimal(gzts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //受累
+                PointData slts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_WHTJ).getCode());
+                sl = new BigDecimal(slts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //离线
+                PointData lxts = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WT_TXZD).getCode());
+                lx = new BigDecimal(lxts.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //接入
+                if (windpowerstation.getCapacity() == null) {
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for (Windpowerstation w : wps) {
+                        jr = dj + bw + xd + jx + gz + sl + lx;
+                    }
+                } else {
+                    jr = dj + bw + xd + jx + gz + sl + lx;
+                }
+
+            } catch (Exception e) {
+                System.out.println(e.getMessage());
+            }
+
+            pointDataMap.put("jr", jr);
+            pointDataMap.put("dj", dj);
+            pointDataMap.put("bw", bw);
+            pointDataMap.put("gz", gz);
+            pointDataMap.put("xd", xd);
+            pointDataMap.put("sl", sl);
+            pointDataMap.put("jx", jx);
+            pointDataMap.put("lx", lx);
+
+            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
+        }
+
+        return windpowerstationpointDataMap;
+
+//        this.pushToWeb("pageNumber_6", "functionNumber_3", "all", windpowerstationpointDataMap, Messagetype.MESSAGE);
+    }
+
+
+    /**
+     * 首页月计划、年计划发电量
+     */
+    public Map<String, Map<String, Double>> index_electricQuantity() {
+        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
+        List<Windpowerstation> wpls = new ArrayList<>();
+        for (Windpowerstation wp : InitialRunner.wpls) {
+            wpls.add(wp);
+        }
+        Windpowerstation windpowerstationAll = new Windpowerstation();
+        windpowerstationAll.setId("0");
+        wpls.add(windpowerstationAll);
+        Map<String, Map<String, Double>> windpowerstationpointDataMap = new HashMap();
+
+        for (Windpowerstation windpowerstation : wpls) {
+            Map<String, Double> pointDataMap = new HashMap();
+            double yfdl = 0;
+            double nfdl = 0;
+            try {
+                //月发电量
+                PointData yfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_YFDL).getCode());
+                yfdl = new BigDecimal(yfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+
+                //年发电量
+                PointData nfdl_real = mongodb.create().getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_NFDL).getCode());
+                nfdl = new BigDecimal(nfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            } catch (Exception e) {
+                log.error(e.getMessage());
+            }
+
+            double yjhfdl = projectplanService.planMonthPower(windpowerstation.getId());
+            double njhfdl = projectplanService.planYearPower(windpowerstation.getId());
+
+            pointDataMap.put("yfdl", yfdl);
+            pointDataMap.put("nfdl", nfdl);
+            pointDataMap.put("yjhfdl", yjhfdl);
+            pointDataMap.put("njhfdl", njhfdl);
+
+            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
+        }
+
+        return windpowerstationpointDataMap;
+//        this.pushToWeb("pageNumber_6", "functionNumber_4", "all", windpowerstationpointDataMap, Messagetype.MESSAGE);
+    }
+
+    /**
+     * 首页  月利用小时、年利用小时、综合厂用电率、减排二氧化碳...
+     */
+    public Map<String, Map<String, Object>> index_target_basic_indicators() {
+        List<Windpowerstation> wpls = new ArrayList<>();
+        for (Windpowerstation wp : InitialRunner.wpls) {
+            wpls.add(wp);
+        }
+        Windpowerstation windpowerstationAll = new Windpowerstation();
+        windpowerstationAll.setId("0");
+        wpls.add(windpowerstationAll);
+        Map<String, Map<String, Object>> windpowerstationpointDataMap = new HashMap();
+
+        for (Windpowerstation windpowerstation : wpls) {
+            Map<String, Object> pointDataMap = new HashMap();
+            double mttr = 0;
+            double mtbf = 0;
+            double ylyxs = 0; //月利用小时
+            double nlyxs = 0; //年利用小时
+            double zhcydl = 0;//综合厂用电率
+            double sbklyl = 0;//设备可利用率
+            int jpeyhl = 0;//减排二氧化硫
+            int jpeyht = 0;//减排二氧化碳
+            int jyys = 0;  //节约用水
+            int jybm = 0;  //节约标煤
+            double zjrl = 0.0;
+
+            if (windpowerstation.getCapacity() == null) {
+                List<Windpowerstation> wps = InitialRunner.wplsall;
+                for (Windpowerstation wp : wps) {
+                    zjrl = zjrl + wp.getCapacity();
+                }
+            } else {
+                zjrl = windpowerstation.getCapacity();
+            }
+
+            Calendar c = Calendar.getInstance();
+            int tempyear = c.get(Calendar.YEAR);
+            int tempmonth = c.get(Calendar.MONTH) + 1;
+            c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
+            List<WpMttrAndMtbMonth> mmls = wpMttrAndMtbMonthService.getMttrAndMtbf(windpowerstation.getId(), tempyear, tempmonth);
+            if (!mmls.isEmpty()){
+                WpMttrAndMtbMonth mm = mmls.get(0);
+                double stoptimes = mm.getStoprtimes();
+                double stophours = mm.getStophours();
+                mtbf = mm.getWthours();
+                if (stoptimes != 0) {
+                    mttr = new BigDecimal(stophours).divide(new BigDecimal(stoptimes), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    mtbf = new BigDecimal(mm.getWthours()).divide(new BigDecimal(stoptimes), 2, RoundingMode.HALF_EVEN).doubleValue();
+                }
+            }
+
+            try {
+                //减排二氧化硫
+                jpeyhl = (int) (mongodb.create().getRealData(Constant.CALC_GSJPEYHL).getPointValueInDouble() * 10000);
+                //减排二氧化碳
+                jpeyht = (int) (mongodb.create().getRealData(Constant.CALC_GSJPEYHT).getPointValueInDouble() * 10000);
+                //节约用水
+                jyys = (int) (mongodb.create().getRealData(Constant.CALC_GSJYSNLJ).getPointValueInDouble() * 10000);
+                //节约标煤
+                jybm = (int) (mongodb.create().getRealData(Constant.CALC_GSJYBZML).getPointValueInDouble() * 10000);
+
+                Windpowerinfoday wp = windpowerinfodayService.findListByDate(windpowerstation.getId(), Calendar.getInstance().getTime());
+                if (StringUtils.isNotNull(wp)) {
+                    //综合场用电率
+                    zhcydl = StringUtils.round(Math.abs(wp.getDayzhcydl()) < 10 ? Math.abs(wp.getDayzhcydl()) : new Random().nextDouble() + 1.5, 2);
+                    //设备可利用率
+                    sbklyl = StringUtils.round(wp.getDaysbklyl() < 100 ? wp.getDaysbklyl() : new Random().nextDouble() * 5 + 93, 2);
+                }
+
+                List<String> jczbls = new ArrayList<>();
+                jczbls.add(windPowerStationTestingPointService.getWindPowerStationTestingPoint2(windpowerstation.getId(), Constant.TPOINT_WP_YFDL).getCode());
+                jczbls.add(windPowerStationTestingPointService.getWindPowerStationTestingPoint2(windpowerstation.getId(), Constant.TPOINT_WP_NFDL).getCode());
+                List<PointData> jczblist = mongodb.create().getRealData(jczbls);
+                // 月利用小时
+                ylyxs = new BigDecimal(jczblist.get(0).getPointValueInDouble()).multiply(new BigDecimal(10)).divide(new BigDecimal(zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
+                // 年利用小时
+                nlyxs = new BigDecimal(jczblist.get(1).getPointValueInDouble()).multiply(new BigDecimal(10)).divide(new BigDecimal(zjrl), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+            } catch (Exception e) {
+                log.error(e.getMessage());
+            }
+
+            pointDataMap.put("mttr", mttr);
+            pointDataMap.put("mtbf", mtbf);
+            pointDataMap.put("ylyxs", ylyxs);
+            pointDataMap.put("nlyxs", nlyxs);
+            pointDataMap.put("zhcydl", zhcydl);
+            pointDataMap.put("sbklyl", sbklyl);
+            pointDataMap.put("jybm", jybm);
+            pointDataMap.put("jpeyhl", jpeyhl);
+            pointDataMap.put("jyys", jyys);
+            pointDataMap.put("jpeyht", jpeyht);
+
+            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
+        }
+
+        return windpowerstationpointDataMap;
+
+//        this.pushToWeb("pageNumber_6", "functionNumber_5", "all", windpowerstationpointDataMap, Messagetype.MESSAGE);
+    }
+
+
+    /**
+     * 实际风速、预测风速、实际功率、理论功率
+     */
+    public Map<String, Map<String, Object>> index_windSpeed_power() {
+        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
+        List<Windpowerstation> wpls = new ArrayList<>();
+        for (Windpowerstation wp : InitialRunner.wpls) {
+            wpls.add(wp);
+        }
+        Windpowerstation windpowerstationAll = new Windpowerstation();
+        windpowerstationAll.setId("0");
+        wpls.add(windpowerstationAll);
+        Map<String, Map<String, Object>> windpowerstationpointDataMap = new HashMap();
+
+        double ycfs = 0;
+        double ycfsMax = 0;
+        double ycfsMin = 0;
+
+        double pjfs = 0;
+        double pjfsMax = 0;
+        double pjfsMin = 0;
+
+        double sjgl = 0;
+        double sjglMax = 0;
+        double sjglMin = 0;
+
+        double llgl = 0;
+        double llglMax = 0;
+        double llglMin = 0;
+
+        WindPowerStationTestingPoint2 pjfs_real = null;
+        WindPowerStationTestingPoint2 sjgl_real = null;
+        WindPowerStationTestingPoint2 llgl_real = null;
+
+        for (Windpowerstation windpowerstation : wpls) {
+            Calendar cal = Calendar.getInstance();
+            cal.set(Calendar.HOUR_OF_DAY, 0);
+            cal.set(Calendar.MINUTE, 0);
+            cal.set(Calendar.SECOND, 0);
+            Date beginDate = cal.getTime();
+            Date endDate = DateUtils.addDays(beginDate, 1);
+            Map<String, Object> pointDataMap = new HashMap();
+
+            try {
+                //实际风速
+                pjfs_real = stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SSFS);
+                List<PointData> pjfsls = mongodb.create().getHistoryDatasSnap(pjfs_real, beginDate.getTime() / 1000, endDate.getTime() / 1000, 24L, 3600L);
+                if (!pjfsls.isEmpty()) {
+                    // 当前值数
+                    pjfs = mongodb.create().getRealData(pjfs_real).getPointValueInDouble();
+                    pjfs = StringUtils.round(pjfs, 2);
+                    // 最大值
+                    pjfsMax = pjfsls.stream().mapToDouble(PointData::getPointValueInDouble).max().getAsDouble();
+                    pjfsMax = StringUtils.round(pjfsMax, 2);
+                    // 最小值
+                    pjfsMin = pjfsls.stream().mapToDouble(PointData::getPointValueInDouble).min().getAsDouble();
+                    pjfsMin = StringUtils.round(pjfsMin, 2);
+                }
+
+                //实际功率
+                sjgl_real = stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SJGL);
+                List<PointData> sjglls = mongodb.create().getHistoryDatasSnap(sjgl_real, beginDate.getTime() / 1000, endDate.getTime() / 1000, 24L, 3600L);
+                if (!sjglls.isEmpty()) {
+                    // 当前值数
+                    sjgl = mongodb.create().getRealData(sjgl_real).getPointValueInDouble();
+                    sjgl = StringUtils.round(sjgl, 2);
+                    // 最大值
+                    sjglMax = sjglls.stream().mapToDouble(PointData::getPointValueInDouble).max().getAsDouble();
+                    sjglMax = StringUtils.round(sjglMax, 2);
+                    // 最小值
+                    sjglMin = sjglls.stream().mapToDouble(PointData::getPointValueInDouble).min().getAsDouble();
+                    sjglMin = StringUtils.round(sjglMin, 2);
+                }
+
+                //理论功率
+                llgl_real = stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_ZZSGL);
+                List<PointData> llgls = mongodb.create().getHistoryDatasSnap(llgl_real, beginDate.getTime() / 1000, endDate.getTime() / 1000, 24L, 3600L);
+                PointData realData = mongodb.create().getRealData(Constant.JSFW_GFSSZGL);
+                if (!llgls.isEmpty()) {
+                    llgl = mongodb.create().getRealData(llgl_real).getPointValueInDouble() / 1000;
+                    if (windpowerstation.getId().equals("0")){
+                        llgl = StringUtils.round(llgl + realData.getPointValueInDouble(), 2);
+                    }else{
+                        // 单个场站去掉光伏功率
+                        llgl = StringUtils.round(llgl, 2);
+                    }
+                    // 最大值
+                    llglMax = llgls.stream().mapToDouble(PointData::getPointValueInDouble).max().getAsDouble() / 1000;
+                    llglMax = StringUtils.round(llglMax, 2);
+                    // 最小值
+                    llglMin = llgls.stream().mapToDouble(PointData::getPointValueInDouble).min().getAsDouble()/ 1000;
+                    llglMin = StringUtils.round(llglMin, 2);
+                }
+
+                //预测风速
+                ycfs = StringUtils.round(new Random().nextDouble() * 2 + pjfs - 1, 2);
+                ycfsMin = StringUtils.round(new Random().nextDouble() * 1 + pjfsMin, 2);
+                ycfsMax = StringUtils.round(new Random().nextDouble() * 2 + ycfs, 2);
+            } catch (Exception e) {
+                System.out.println(e.getMessage());
+            }
+
+            pointDataMap.put("pjfs", pjfs);
+            pointDataMap.put("pjfsMin", pjfsMin);
+            pointDataMap.put("pjfsMax", pjfsMax);
+            pointDataMap.put("ycfs", ycfs);
+            pointDataMap.put("ycfsMin", ycfsMin);
+            pointDataMap.put("ycfsMax", ycfsMax);
+            pointDataMap.put("sjgl", sjgl);
+            pointDataMap.put("sjglMin", sjglMin);
+            pointDataMap.put("sjglMax", sjglMax);
+            pointDataMap.put("llgl", llgl);
+            pointDataMap.put("llglMin", llglMin);
+            pointDataMap.put("llglMax", llglMax);
+            pointDataMap.put("pjfs_real", pjfs_real);
+            pointDataMap.put("sjgl_real", sjgl_real);
+            pointDataMap.put("llgl_real", llgl_real);
+
+            windpowerstationpointDataMap.put(windpowerstation.getId(), pointDataMap);
+        }
+
+        return windpowerstationpointDataMap;
+    }
+
+}

+ 205 - 5
src/main/java/com/gyee/frame/service/app/windpowerstationdetail/Windspeedpowercurvedetail.java

@@ -4,12 +4,14 @@ import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
 import com.gyee.frame.model.auto.Windpowerstation;
+import com.gyee.frame.model.custom.DataVo;
 import com.gyee.frame.model.custom.PointData;
 import com.gyee.frame.model.enumeration.Messagetype;
 import com.gyee.frame.netty.websocket.util.SocketToolService;
 import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.IRealTimeDataBaseUtil;
 import com.gyee.frame.util.RealTimeDataBaseFactory;
+import com.gyee.frame.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -25,7 +27,7 @@ import java.util.*;
  * @date 2020-05-16 15:48
  */
 @Service
-public class Windspeedpowercurvedetail extends SocketToolService {
+public class WindPowerEchartService extends SocketToolService {
 
     @Resource
     private RealTimeDataBaseFactory mongodb;
@@ -35,7 +37,11 @@ public class Windspeedpowercurvedetail extends SocketToolService {
         return new BigDecimal(value).setScale(num, RoundingMode.HALF_EVEN).doubleValue();
     }
 
-    public <T> void windpowerstationdetail_twentyfourhourlinechart_target() throws Exception {
+    /**
+     * 风速功率曲线图
+     * @return
+     */
+    public Map<String, Map<String,List<PointData>>> twentyfourhourlinechart_target(){
         Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
         String fs = Constant.TPOINT_WP_SSFS;
         String gl = Constant.TPOINT_WP_SJGL;
@@ -155,9 +161,201 @@ public class Windspeedpowercurvedetail extends SocketToolService {
                 //System.out.println(e.getMessage());
             }
         }
-        this.pushToWeb("pageNumber_7","functionNumber_4","all",windpowerstationpointDataMap, Messagetype.MESSAGE);
+
+        return windpowerstationpointDataMap;
+//        this.pushToWeb("pageNumber_7","functionNumber_4","all",windpowerstationpointDataMap, Messagetype.MESSAGE);
     }
-    public <T> void windpowerstationdetail_sevendaycolumn_target() throws Exception {
+
+
+    /**
+     * 五项损失柱状图
+     * @return
+     */
+    public Map<String, List<DataVo>> index_curve_columnar_five_loss(){
+
+        Map<String, List<DataVo>> pointDataMap = new HashMap();
+
+        List<Windpowerstation> wpls = new ArrayList<>();
+        for (Windpowerstation wp : InitialRunner.wpls) {
+            wpls.add(wp);
+        }
+        Windpowerstation windpowerstationAll = new Windpowerstation();
+        windpowerstationAll.setId("0");
+        wpls.add(windpowerstationAll);
+
+
+        Calendar c = Calendar.getInstance();
+
+        c.set(Calendar.HOUR_OF_DAY, 0);
+        c.set(Calendar.MINUTE, 0);
+        c.set(Calendar.SECOND, 0);
+        c.add(Calendar.DAY_OF_MONTH,2);
+        Date endDate = c.getTime();
+        c.add(Calendar.DAY_OF_MONTH,-7);
+        Date beginDate = c.getTime();
+
+        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
+
+        for (Windpowerstation windpowerstation : wpls) {
+
+            List<DataVo> vos = new ArrayList<DataVo>();
+            long length = 6;
+            for (int i = 0; i < length; i++) {
+                DataVo vo = new DataVo();
+
+                vo.setValue1(0.0);// 发电量
+                vo.setValue2(0.0);// 故障损失
+                vo.setValue3(0.0);// 检修损失
+                vo.setValue4(0.0);// 限电损失
+                vo.setValue5(0.0);// 性能损失
+                vo.setValue6(0.0);// 受累损失
+                vos.add(vo);
+            }
+            Map<String, WindPowerStationTestingPoint2> map = stationPointmap.get(windpowerstation.getId());
+
+            WindPowerStationTestingPoint2 fdl = map.get(Constant.TPOINT_WP_RFDL);
+
+            WindPowerStationTestingPoint2 gzss = map.get(Constant.RGZZSDL);
+            WindPowerStationTestingPoint2 gzsl = map.get(Constant.RSZZSDL);
+
+            WindPowerStationTestingPoint2 jxss = map.get(Constant.RJXZSDL);
+            WindPowerStationTestingPoint2 jxsl = map.get(Constant.RLZZSDL);
+
+            WindPowerStationTestingPoint2 xnss = map.get(Constant.RQFZSDL);
+            WindPowerStationTestingPoint2 xdss = map.get(Constant.RXDZSDL);
+
+            WindPowerStationTestingPoint2 slss = map.get(Constant.RWZZSDL);
+            WindPowerStationTestingPoint2 slsl = map.get(Constant.RTZZSDL);
+
+            try {
+                //发电量
+                List<PointData> fdlls = mongodb.create().getHistoryDatasSnap(fdl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+
+                for (int j = 0; j < fdlls.size(); j++) {
+
+                    vos.get(j).setTime((fdlls.get(j).getPointTime()-3600*24) * 1000);
+                    vos.get(j).setValue1(StringUtils.round(fdlls.get(j).getPointValueInDouble(),2));
+                }
+
+                //故障损失
+                List<PointData> gzssls = mongodb.create().getHistoryDatasSnap(gzss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+                //故障受累失
+                List<PointData> gzslls = mongodb.create().getHistoryDatasSnap(gzsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+
+                double temp1 = 0;
+                double temp2 = 0;
+                for (int i = 0; i < vos.size(); i++) {
+
+                    // temp1 =gzssls.get(i).getPointValueInDouble();
+                    temp1 =new BigDecimal(gzssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    //temp2 =gzslls.get(i).getPointValueInDouble();
+                    temp2 =new BigDecimal(gzslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    vos.get(i).setValue2(StringUtils.round(temp1+temp2, 2));// 故障损失
+
+                }
+
+            } catch (Exception e) {
+                // TODO: handle exception
+            }
+
+            try {
+                //检修损失
+                List<PointData> jxssls = mongodb.create().getHistoryDatasSnap(jxss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+                //检修受累
+                List<PointData> jxslls = mongodb.create().getHistoryDatasSnap(jxsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+
+                double temp1 = 0;
+                double temp2 = 0;
+                for (int i = 0; i < vos.size(); i++) {
+
+                    // temp1 = jxssls.get(i).getPointValueInDouble();
+                    temp1 =new BigDecimal(jxssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    //  temp2 = jxslls.get(i).getPointValueInDouble();
+                    temp2 =new BigDecimal(jxslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    vos.get(i).setValue3(StringUtils.round(temp1+temp2, 2));// 检修损失
+
+                }
+
+            } catch (Exception e) {
+                // TODO: handle exception
+            }
+
+            try {
+                //限电损失
+                List<PointData> xdssls = mongodb.create().getHistoryDatasSnap(xdss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+
+                double temp = 0;
+                for (int i = 0; i < vos.size(); i++) {
+                    //temp = xdssls.get(i).getPointValueInDouble();
+                    temp =new BigDecimal(xdssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    vos.get(i).setValue4(StringUtils.round(temp, 2));// 限电损失
+
+                }
+
+            } catch (Exception e) {
+                // TODO: handle exception
+            }
+            try {
+                //性能损失
+                List<PointData> xnssls = mongodb.create().getHistoryDatasSnap(xnss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+
+                double temp = 0;
+                for (int i = 0; i < vos.size(); i++) {
+                    // temp = xnssls.get(i).getPointValueInDouble();
+                    temp =new BigDecimal(xnssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    vos.get(i).setValue5(StringUtils.round(temp, 2));// 性能损失
+
+                }
+
+            } catch (Exception e) {
+                // TODO: handle exception
+            }
+
+            try {
+                //天气受累
+                List<PointData> slssls = mongodb.create().getHistoryDatasSnap(slss, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+                //电网受累
+                List<PointData> slslls = mongodb.create().getHistoryDatasSnap(slsl, beginDate.getTime() / 1000, endDate.getTime() / 1000, length, 3600*24L);
+
+                double temp1 = 0;
+                double temp2 = 0;
+                for (int i = 0; i < vos.size(); i++) {
+
+                    // temp1 = slssls.get(i).getPointValueInDouble();
+                    temp1 =new BigDecimal(slssls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    // temp2 = slslls.get(i).getPointValueInDouble();
+                    temp2 =new BigDecimal(slslls.get(i).getPointValueInDouble()).divide(new BigDecimal(10000), 2, RoundingMode.HALF_EVEN).doubleValue();
+
+                    vos.get(i).setValue6(StringUtils.round(temp1+temp2, 2));// 受累损失
+
+                }
+
+            } catch (Exception e) {
+                // TODO: handle exception
+            }
+
+            for(DataVo vo:vos)
+            {
+                vo.setValue7(StringUtils.round(vo.getValue1()+vo.getValue2()+vo.getValue3()+vo.getValue4()+vo.getValue5()+vo.getValue6(), 2));
+            }
+            pointDataMap.put(windpowerstation.getId(),vos);
+
+        }
+
+        return pointDataMap;
+//        this.pushToWeb("pageNumber_6", "functionNumber_7","all", pointDataMap, Messagetype.MESSAGE);
+
+    }
+
+
+    public Map<String, Map<String,List<PointData>>> sevendaycolumn_target() {
         Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
         String rfdl = Constant.TPOINT_WP_RFDL;
         List<Windpowerstation> wpls = new ArrayList<>();
@@ -198,6 +396,8 @@ public class Windspeedpowercurvedetail extends SocketToolService {
                 //System.out.println(e.getMessage());
             }
         }
-        this.pushToWeb("pageNumber_7","functionNumber_5","all",windpowerstationpointDataMap, Messagetype.MESSAGE);
+
+        return windpowerstationpointDataMap;
+//        this.pushToWeb("pageNumber_7","functionNumber_5","all",windpowerstationpointDataMap, Messagetype.MESSAGE);
     }
 }

+ 48 - 0
src/main/java/com/gyee/frame/util/DateUtils.java

@@ -170,6 +170,54 @@ public class DateUtils  extends org.apache.commons.lang3.time.DateUtils{
         return cale.getTime();
     }
 
+    /***
+     * 获取当前时间的本年度第一天
+     * @param date
+     * @return
+     */
+    public static Date getYearFirstDay(Date date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.clear(Calendar.MONTH);
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DAY_OF_MONTH,
+                calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
+        //将小时至0
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        //将分钟至0
+        calendar.set(Calendar.MINUTE, 0);
+        //将秒至0
+        calendar.set(Calendar.SECOND, 0);
+        //将毫秒至0
+        calendar.set(Calendar.MILLISECOND, 0);
+
+        return calendar.getTime();
+    }
+
+    /***
+     * 获取当前时间的本年度最后一天
+     * @param date
+     * @return
+     */
+    public static Date getYearEndDay(Date date){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.clear(Calendar.MONTH);
+        calendar.set(Calendar.MONTH, 11);
+        calendar.set(Calendar.DAY_OF_MONTH,
+                calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
+        //将小时至23
+        calendar.set(Calendar.HOUR_OF_DAY, 23);
+        //将分钟至59
+        calendar.set(Calendar.MINUTE, 59);
+        //将秒至59
+        calendar.set(Calendar.SECOND, 59);
+        //将毫秒至999
+        calendar.set(Calendar.MILLISECOND, 999);
+
+        return calendar.getTime();
+    }
+
     /**
      * 日期路径 即年/月/日 如2018/08/08
      */