فهرست منبع

首页数据展示功能修改

shilin 4 سال پیش
والد
کامیت
d8178c5687

+ 78 - 24
src/main/java/com/gyee/frame/service/app/targetdetail/TargetdetailService.java

@@ -1,7 +1,10 @@
 package com.gyee.frame.service.app.targetdetail;
 
+import com.gyee.frame.common.spring.Constant;
+import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.Weatherfd;
 import com.gyee.frame.model.auto.Weatherfh;
+import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
 import com.gyee.frame.model.auto.Windpowerinfoday;
 import com.gyee.frame.model.custom.PointData;
 import com.gyee.frame.model.enumeration.Messagetype;
@@ -272,19 +275,44 @@ public class TargetdetailService extends SocketToolService {
         }else if(pointid.indexOf("divq")!=-1)
         {
             pointid=pointid.substring(5);
-            Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
-            List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
-                    beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
-                    (long) count+1, 3600L);
-            for (int i = 0; i < ls.size(); i++) {
-                ls.get(i).setPointTime(ls.get(i).getPointTime() - 3600);
-                double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                ls.get(i).setPointValueInDouble(temp);
-            }
-            if(ls.size()>0) {
-                ls.remove(0);
-            }
-            vos=ls;
+
+            if(pointid.equals("JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0193"))
+            {
+                Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
+                List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
+                        beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
+                        (long) count+1, 3600L);
+                WindPowerStationTestingPoint2 gfsjglpoint= InitialRunner.stationPointmap.get("-2").get(Constant.TPOINT_WP_SJGL);
+                List<PointData> gfls = mongodb.getHistoryDatasSnap(gfsjglpoint,
+                        beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
+                        (long) count+1, 3600L);
+                for (int i = 0; i < ls.size(); i++) {
+                    ls.get(i).setPointTime(ls.get(i).getPointTime() - 3600);
+                    double llgl=this.decimal(2,ls.get(i).getPointValueInDouble());
+                    llgl= new BigDecimal(llgl).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    ls.get(i).setPointValueInDouble(StringUtils.round(llgl+gfls.get(i).getPointValueInDouble(),2));
+                }
+                if(ls.size()>0) {
+                    ls.remove(0);
+                }
+                vos=ls;
+            }else
+                {
+                    Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
+                    List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
+                            beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
+                            (long) count+1, 3600L);
+                    for (int i = 0; i < ls.size(); i++) {
+                        ls.get(i).setPointTime(ls.get(i).getPointTime() - 3600);
+                        double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                        ls.get(i).setPointValueInDouble(temp);
+                    }
+                    if(ls.size()>0) {
+                        ls.remove(0);
+                    }
+                    vos=ls;
+                }
+
 
         }else if(pointid.indexOf("divw")!=-1)
         {
@@ -317,6 +345,7 @@ public class TargetdetailService extends SocketToolService {
                 ls.remove(0);
             }
             vos=ls;
+
         }
         return vos;
     }
@@ -345,18 +374,42 @@ public class TargetdetailService extends SocketToolService {
             }else if(pointid.indexOf("divq")!=-1)
             {
                 pointid=pointid.substring(5);
-                List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
-                        beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
-                        8L, 3600 * 24L);
-                for (int i = 0; i < ls.size(); i++) {
-                    ls.get(i).setPointTime(ls.get(i).getPointTime() - 24 * 3600);
-                    double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                    ls.get(i).setPointValueInDouble(temp);
-                }
-                if(ls.size()>0) {
-                    ls.remove(0);
+
+                if(pointid.equals("JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0193"))
+                {
+                    Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
+                    List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
+                            beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
+                            8L, 3600 * 24L);
+                    WindPowerStationTestingPoint2 gfsjglpoint= InitialRunner.stationPointmap.get("-2").get(Constant.TPOINT_WP_SJGL);
+                    List<PointData> gfls = mongodb.getHistoryDatasSnap(gfsjglpoint,
+                            beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
+                            8L, 3600 * 24L);
+                    for (int i = 0; i < ls.size(); i++) {
+                        ls.get(i).setPointTime(ls.get(i).getPointTime() - 24*3600);
+                        double llgl=this.decimal(2,ls.get(i).getPointValueInDouble());
+                        llgl= new BigDecimal(llgl).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                        ls.get(i).setPointValueInDouble(StringUtils.round(llgl+gfls.get(i).getPointValueInDouble(),2));
+                    }
+                    if(ls.size()>0) {
+                        ls.remove(0);
+                    }
+                    vos=ls;
+                }else {
+                    List<PointData> ls = mongodb.getHistoryDatasSnap(pointid,
+                            beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
+                            8L, 3600 * 24L);
+                    for (int i = 0; i < ls.size(); i++) {
+                        ls.get(i).setPointTime(ls.get(i).getPointTime() - 24 * 3600);
+                        double temp= new BigDecimal(ls.get(i).getPointValueInDouble()).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                        ls.get(i).setPointValueInDouble(temp);
+                    }
+                    if(ls.size()>0) {
+                        ls.remove(0);
+                    }
+                    vos=ls;
                 }
-                vos=ls;
+
 
             }else if(pointid.indexOf("divw")!=-1)
             {
@@ -387,6 +440,7 @@ public class TargetdetailService extends SocketToolService {
                     ls.remove(0);
                 }
                 vos=ls;
+
             }
 
        return vos;

+ 71 - 18
src/main/java/com/gyee/frame/service/app/windpowerstationdetail/Windspeedpowermodule.java

@@ -166,31 +166,84 @@ public class Windspeedpowermodule extends SocketToolService {
 
             //理论功率****************************************************************
 
-            WindPowerStationTestingPoint2 llglpoint=stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_ZLLGL);
+            WindPowerStationTestingPoint2 llglpoint=stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_ZZSGL);
             List<PointData>  llglls = mongodb.getHistoryDatasSnap(llglpoint, beginDate.getTime() / 1000, endDate.getTime() / 1000, 24L, 3600L);
 
+            List<PointData>  gfsjls =null;
+            WindPowerStationTestingPoint2 gfsjglpoint=stationPointmap.get("-2").get(Constant.TPOINT_WP_SJGL);
 
-            if(!llglls.isEmpty())
+            if(windpowerstation.getId().equals("0"))
             {
-                pointDataMap.put("llgl_real",llglls.get(0));
-                // 平均数
+                 gfsjls = mongodb.getHistoryDatasSnap(gfsjglpoint, beginDate.getTime() / 1000, endDate.getTime() / 1000, 24L, 3600L);
+
+                if(!llglls.isEmpty())
+                {
+                    if(null!=gfsjls)
+                    {
+                        for(int i=0;i<llglls.size();i++)
+                        {
+                            llgl= new BigDecimal(llgl).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                            double temp= llgl+gfsjls.get(i).getPointValueInDouble();
+                            llglls.get(i).setPointValueInDouble(StringUtils.round(temp,2));
+                        }
+                    }
+                    pointDataMap.put("llgl_real",llglls.get(0));
+                    // 平均数
 //                llgl = llglls.stream().mapToDouble(PointData::getPointValueInDouble).average().getAsDouble();
-                // 当前值数
-                llgl =  mongodb.getRealData(llglpoint).getPointValueInDouble();;
-                llgl= new BigDecimal(llgl).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                //System.out.println("average:" + llgl);
-
+                    // 当前值数
+                    llgl =  mongodb.getRealData(llglpoint).getPointValueInDouble();
+                    double gfgl=mongodb.getRealData(gfsjglpoint).getPointValueInDouble();
+                    llgl= new BigDecimal(llgl).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    llgl =StringUtils.round(llgl+gfgl,2);
+
+                    //System.out.println("average:" + llgl);
+
+
+                    // 最大值
+                    llglMax = llglls.stream().mapToDouble(PointData::getPointValueInDouble).max().getAsDouble();
+
+                    if(llgl>llglMax)
+                    {
+                        llglMax=llgl;
+                    }
+//                llglMax= new BigDecimal(llglMax).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    //System.out.println("max:" + llglMax);
+
+                    // 最小值
+                    llglMin = llglls.stream().mapToDouble(PointData::getPointValueInDouble).min().getAsDouble();
+//                llglMin= new BigDecimal(llglMin).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    //System.out.println("min:" + llglMin);
+                }
+            }else
+            {
+                if(!llglls.isEmpty())
+                {
+                    pointDataMap.put("llgl_real",llglls.get(0));
+                    // 平均数
+//                llgl = llglls.stream().mapToDouble(PointData::getPointValueInDouble).average().getAsDouble();
+                    // 当前值数
+                    llgl =  mongodb.getRealData(llglpoint).getPointValueInDouble();
+                    llgl= new BigDecimal(llgl).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    //System.out.println("average:" + llgl);
+
+                    // 最大值
+                    llglMax = llglls.stream().mapToDouble(PointData::getPointValueInDouble).max().getAsDouble();
+                    llglMax= new BigDecimal(llglMax).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    if(llgl>llglMax)
+                    {
+                        llglMax=llgl;
+                    }
+
+                    //System.out.println("max:" + llglMax);
+
+                    // 最小值
+                    llglMin = llglls.stream().mapToDouble(PointData::getPointValueInDouble).min().getAsDouble();
+                  llglMin= new BigDecimal(llglMin).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
+                    //System.out.println("min:" + llglMin);
+                }
+            }
 
-                // 最大值
-                llglMax = llglls.stream().mapToDouble(PointData::getPointValueInDouble).max().getAsDouble();
-                llglMax= new BigDecimal(llglMax).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                //System.out.println("max:" + llglMax);
 
-                // 最小值
-                llglMin = llglls.stream().mapToDouble(PointData::getPointValueInDouble).min().getAsDouble();
-                llglMin= new BigDecimal(llglMin).divide(new BigDecimal(1000), 2, RoundingMode.HALF_EVEN).doubleValue();
-                //System.out.println("min:" + llglMin);
-            }