瀏覽代碼

Merge remote-tracking branch 'origin/master'

shilin 5 年之前
父節點
當前提交
fc9c970b91

+ 42 - 0
src/main/java/com/gyee/frame/common/quartz/task/Windpowerstationdetail_sevendaycolumn_target.java

@@ -0,0 +1,42 @@
+package com.gyee.frame.common.quartz.task;
+
+import com.gyee.frame.service.app.windpowerstationdetail.Windspeedpowercurvedetail;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+
+/**
+ *测试类
+ * @CLASSNAME   WeatherfdPushTask
+ * @Description 向页面预测今天气象推送数据
+ * @Auther Li ZaiXun
+ *、 @DATE 2020/1/2 15:33
+ */
+@Component("windpowerstationdetail_sevendaycolumn_target")
+public class Windpowerstationdetail_sevendaycolumn_target {
+    @Autowired
+    private Windspeedpowercurvedetail windspeedpowercurvedetail;
+    /**
+     * 无参的任务
+     */
+    public void windpowerstationdetail_sevendaycolumn_target() throws Exception {
+        windspeedpowercurvedetail.windpowerstationdetail_sevendaycolumn_target();//调用list方法完成对 key :"weatherProphet_1" ,路径"weather/weatherProphet_1"的推送
+        //System.out.println("我已执行");
+    }
+
+
+    /**
+     * 有参任务
+     * 目前仅执行常见的数据类型  Integer Long  带L  string  带 ''  bool Double 带 d
+     * @param a
+     * @param b
+     *
+     */
+    public void runTask2(Integer a,Long b,String c,Boolean d,Double e)
+    {
+        //List<TsysUser> list=  tsysUserMapper.selectByExample(new TsysUserExample());
+        //System.err.println("用户查询num:"+list.size());
+        System.out.println("正在执行定时任务,带多个参数的方法"+a+"   "+b+" "+c+"  "+d+" "+e+"执行时间:"+new Date().toLocaleString());
+    }
+}

+ 12 - 18
src/main/java/com/gyee/frame/service/app/index/FocastpowerService.java

@@ -1,28 +1,16 @@
 package com.gyee.frame.service.app.index;
 
-import com.gyee.frame.common.spring.Constant;
-import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.Forecastwindspeedamended;
 import com.gyee.frame.model.auto.ForecastwindspeedamendedExample;
-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.service.ForecastwindspeedamendedService;
-import com.gyee.frame.service.WindpowerinfodayService;
-import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.StringUtils;
-import com.gyee.frame.util.golden.EdosUtil;
-import com.gyee.frame.util.golden.IEdosUtil;
-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.util.*;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
 
 /**
  *
@@ -87,11 +75,17 @@ public class FocastpowerService extends SocketToolService{
         }
         List<Forecastwindspeedamended> wtls = forecastwindspeedamendedService.selectByExample(forecastwindspeedamendedExample);
         double tmp = 0;
-        for(Forecastwindspeedamended wt:wtls)
+
+        if(!wtls.isEmpty())
         {
-            tmp = tmp + wt.getDayspeed().doubleValue()+wt.getNightspeed().doubleValue();
-            tmp=StringUtils.round(tmp/2,2);
+            for(Forecastwindspeedamended wt:wtls)
+            {
+                tmp = tmp + wt.getDayspeed().doubleValue()+wt.getNightspeed().doubleValue();
+
+            }
+            tmp=StringUtils.round(tmp/(wtls.size()*2),2);
         }
+
         return tmp;
     }
 

+ 1 - 5
src/main/java/com/gyee/frame/service/app/windpowerstationdetail/WindpowerstationdetailService.java

@@ -12,8 +12,6 @@ import com.gyee.frame.service.WindpowerinfodayService;
 import com.gyee.frame.util.StringUtils;
 import com.gyee.frame.util.golden.EdosUtil;
 import com.gyee.frame.util.golden.IEdosUtil;
-import com.gyee.frame.util.mongodb.IMongodbUtil;
-import com.gyee.frame.util.mongodb.MongodbUtilImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -49,7 +47,6 @@ public class WindpowerstationdetailService extends SocketToolService {
         windpowerstationAll.setId("0");
         wpls.add(windpowerstationAll);
         Map<String,Map<String,Double>> windpowerstationpointDataMap = new HashMap();
-        IMongodbUtil mongodb = new MongodbUtilImpl();
 
         for(Windpowerstation windpowerstation:wpls){
             Map<String,Double> pointDataMap = new HashMap();
@@ -134,7 +131,6 @@ public class WindpowerstationdetailService extends SocketToolService {
         windpowerstationAll.setId("0");
         wpls.add(windpowerstationAll);
         Map<String,Map<String,Double>> windpowerstationpointDataMap = new HashMap();
-        IMongodbUtil mongodb = new MongodbUtilImpl();
 
         for(Windpowerstation windpowerstation:wpls){
             Map<String,Double> pointDataMap = new HashMap();
@@ -183,7 +179,7 @@ public class WindpowerstationdetailService extends SocketToolService {
             }
 
             Calendar c = Calendar.getInstance();
-            Windpowerinfoday wp=windpowerinfodayService.findListByDate("CL_FDC",c.getTime());
+            Windpowerinfoday wp=windpowerinfodayService.findListByDate(windpowerstation.getId(),c.getTime());
             if(StringUtils.isNotNull(wp))
             {
                 ylyxs=wp.getMonthlyxs();

+ 44 - 4
src/main/java/com/gyee/frame/service/app/windpowerstationdetail/Windspeedpowercurvedetail.java

@@ -6,17 +6,13 @@ import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
 import com.gyee.frame.model.auto.Windpowerstation;
 import com.gyee.frame.model.custom.PointData;
 import com.gyee.frame.model.enumeration.Messagetype;
-import com.gyee.frame.netty.websocket.util.SocketToolController;
 import com.gyee.frame.netty.websocket.util.SocketToolService;
 import com.gyee.frame.util.DateUtils;
 import com.gyee.frame.util.golden.EdosUtil;
 import com.gyee.frame.util.golden.IEdosUtil;
-import com.gyee.frame.util.mongodb.IMongodbUtil;
-import com.gyee.frame.util.mongodb.MongodbUtilImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.swing.text.html.parser.Entity;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
@@ -159,4 +155,48 @@ public class Windspeedpowercurvedetail extends SocketToolService {
         }
         this.pushToWeb("pageNumber_7","functionNumber_4",windpowerstationpointDataMap, Messagetype.MESSAGE);
     }
+    public <T> void windpowerstationdetail_sevendaycolumn_target() throws Exception {
+        Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
+        String rfdl = Constant.TPOINT_WP_RFDL;
+        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,List<PointData>>> windpowerstationpointDataMap = new HashMap();
+
+        IEdosUtil mongodb = new EdosUtil();
+        for (Windpowerstation windpowerstation : wpls) {
+            Map<String,List<PointData>> map = new HashMap<>();
+            windpowerstationpointDataMap.put(windpowerstation.getId(),map);
+            List<PointData> listPointData = new ArrayList<>();
+
+            try {
+                //发电量柱状图,发电量
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH");
+                Date nowTime = DateUtils.getNowDate();
+                Date endTime = sdf.parse(sdf.format(nowTime));
+                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
+                Date beginTime = DateUtils.addDays(endTime, -7);
+                WindPowerStationTestingPoint2 point = stationPointmap.get(windpowerstation.getId()).get(rfdl);
+                listPointData = mongodb.getHistoryDatasSnap(point,
+                        beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L*24,
+                        8L, 3600 * 24L);
+                for (int i = 0; i < listPointData.size(); i++) {
+                    listPointData.get(i).setPointTime(listPointData.get(i).getPointTime() - 24 * 3600);
+                    listPointData.get(i).setPointValueInDouble(this.decimal(2,listPointData.get(i).getPointValueInDouble()));
+                }
+
+                if(listPointData.size()>0) {
+                    listPointData.remove(0);
+                }
+                map.put("rfdl",listPointData);
+            } catch (Exception e) {
+                System.out.println(e.getMessage());
+            }
+        }
+        this.pushToWeb("pageNumber_7","functionNumber_5",windpowerstationpointDataMap, Messagetype.MESSAGE);
+    }
 }