Browse Source

详情页面第一模块数据获取

lizaixun 4 years ago
parent
commit
60feaa73f1

+ 43 - 0
src/main/java/com/gyee/frame/common/quartz/task/Index_windSpeed_power_target_detail.java

@@ -0,0 +1,43 @@
+package com.gyee.frame.common.quartz.task;
+
+import com.gyee.frame.service.app.windpowerstationdetail.WindpowerstationdetailService;
+import com.gyee.frame.service.app.windpowerstationdetail.Windspeedpowermodule;
+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("index_windSpeed_power_target_detail")
+public class Index_windSpeed_power_target_detail {
+    @Autowired
+    private Windspeedpowermodule windspeedpowermodule;
+    /**
+     * 无参的任务
+     */
+    public void index_windSpeed_power_target_detail() throws Exception {
+        windspeedpowermodule.index_windSpeed_power_target_detail();//调用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());
+    }
+}

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

@@ -0,0 +1,42 @@
+package com.gyee.frame.common.quartz.task;
+
+import com.gyee.frame.service.app.windpowerstationdetail.WindpowerstationdetailService;
+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_springbox_target")
+public class Windpowerstationdetail_springbox_target {
+    @Autowired
+    private WindpowerstationdetailService windpowerstationdetailService;
+    /**
+     * 无参的任务
+     */
+    public void windpowerstationdetail_springbox_target() throws Exception {
+        windpowerstationdetailService.windpowerstationdetail_springbox_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());
+    }
+}

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

@@ -4,15 +4,19 @@ import com.gyee.frame.common.spring.Constant;
 import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.common.spring.SpringUtils;
 import com.gyee.frame.model.auto.WindPowerstationTestingPoint;
+import com.gyee.frame.model.auto.Windpowerinfoday;
 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.SocketToolService;
+import com.gyee.frame.service.WindpowerinfodayService;
+import com.gyee.frame.util.StringUtils;
 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.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -30,7 +34,8 @@ public class WindpowerstationdetailService extends SocketToolService {
     @Autowired
     private InitialRunner initialRunner;
     private static int decimal_digit = 0;
-
+    @Resource
+    private WindpowerinfodayService windpowerinfodayService;
     public void windpowerstationdetail_comprehensive_target() throws Exception {
 
         Map<String, Map<String, WindPowerstationTestingPoint>> stationPointmap = InitialRunner.stationPointmap;
@@ -117,6 +122,104 @@ public class WindpowerstationdetailService extends SocketToolService {
 
         this.pushToWeb("pageNumber_7","functionNumber_1",windpowerstationpointDataMap, Messagetype.MESSAGE);
     }
+    public void windpowerstationdetail_springbox_target() throws Exception {
+        Map<String, Map<String, WindPowerstationTestingPoint>> 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();
+        IMongodbUtil mongodb = new MongodbUtilImpl();
+
+        for(Windpowerstation windpowerstation:wpls){
+            Map<String,Double> pointDataMap = new HashMap();
+            double mttr = 99;
+            double mtbf = 99;
+            double jybm = 99;
+            double jpeyhl = 99;
+            double ylyxs = 99;
+            double nlyxs = 99;
+            double jyys = 99;
+            double zhcydl = 99;
+            double sbklyl = 99;
+            double jpeyht = 99;
+
+
+            //mttr
+            mttr = jybm + 10;
+
+            //mtbf
+            mtbf = jpeyht + 12;
+
+            try{
+                //节约标煤
+                PointData jybm_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_JYBM).getCode());
+                jybm = new BigDecimal(jybm_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+
+            try{
+                //减排二氧化硫
+                PointData jpeyhl_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_JPEYHL).getCode());
+                jpeyhl = new BigDecimal(jpeyhl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+
+            try{
+                //节约用水
+                PointData jyys_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_JYS).getCode());
+                jyys = new BigDecimal(jyys_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            Calendar c = Calendar.getInstance();
+            Windpowerinfoday wp=windpowerinfodayService.findListByDate("CL_FDC",c.getTime());
+            if(StringUtils.isNotNull(wp))
+            {
+                ylyxs=wp.getMonthlyxs();
+                nlyxs=wp.getYearlyxs();
+                //综合场用电率
+                zhcydl=wp.getDayzhcydl();
+                //设备可利用率
+                sbklyl=wp.getDaysbklyl();
+                System.out.println(wp.getRecorddate()+ "___" +wp.getMonthlyxs());
+                System.out.println(wp.getRecorddate()+ "___" +wp.getYearlyxs());
+                System.out.println(wp.getRecorddate()+ "___" +wp.getDayzhcydl());
+                System.out.println(wp.getRecorddate()+ "___" +wp.getDaysbklyl());
+            }
+
+
+            try{
+                //减排二氧化碳
+                PointData jpeyht_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_JPEYHT).getCode());
+                jpeyht = new BigDecimal(jpeyht_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+
+            pointDataMap.put("mttr",mttr);
+            pointDataMap.put("mtbf",mtbf);
+            pointDataMap.put("jybm",jybm);
+            pointDataMap.put("jpeyhl",jpeyhl);
+            pointDataMap.put("ylyxs",ylyxs);
+            pointDataMap.put("nlyxs",nlyxs);
+            pointDataMap.put("jyys",jyys);
+            pointDataMap.put("zhcydl",zhcydl);
+            pointDataMap.put("sbklyl",sbklyl);
+            pointDataMap.put("jpeyht",jpeyht);
+            windpowerstationpointDataMap.put(windpowerstation.getId(),pointDataMap);
+        }
+        this.pushToWeb("pageNumber_7","functionNumber_2",windpowerstationpointDataMap, Messagetype.MESSAGE);
+    }
 
 /*    double  focastpower(String name){
         ForecastwindspeedamendedService forecastwindspeedamendedService= SpringUtils.getBean("forecastwindspeedamendedService");

+ 263 - 0
src/main/java/com/gyee/frame/service/app/windpowerstationdetail/Windspeedpowermodule.java

@@ -0,0 +1,263 @@
+package com.gyee.frame.service.app.windpowerstationdetail;
+
+import com.gyee.frame.common.spring.Constant;
+import com.gyee.frame.common.spring.InitialRunner;
+import com.gyee.frame.model.auto.WindPowerstationTestingPoint;
+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.SocketToolService;
+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 java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class Windspeedpowermodule extends SocketToolService {
+    @Autowired
+    private InitialRunner initialRunner;
+    private static int decimal_digit = 0;
+
+    public void index_windSpeed_power_target_detail() throws Exception{
+        Map<String, Map<String, WindPowerstationTestingPoint>> 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();
+        IMongodbUtil mongodb = new MongodbUtilImpl();
+
+        for(Windpowerstation windpowerstation:wpls){
+            Map<String,Double> pointDataMap = new HashMap();
+            double pjfs = 0;
+            double pjfsMin = 0;
+            double pjfsMax = 0;
+            double ycfs = 0;
+            double ycfsMin = 0;
+            double ycfsMax = 0;
+            double sjgl = 0;
+            double sjglMin = 0;
+            double sjglMax = 0;
+            double llgl = 0;
+            double llglMax = 0;
+            double llglMin = 0;
+
+            try {
+                //平均风速
+                PointData rfdl_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_PJFS).getCode());
+                pjfs = new BigDecimal(rfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            //平均风速min
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        if(pjfs==0){
+                            pjfsMin=pjfs;
+                        }else{
+                            pjfsMin = pjfs - 2;
+                        }
+                    }
+                }else{
+                    if(pjfs==0){
+                        pjfsMin=pjfs;
+                    }else{
+                        pjfsMin = pjfs - 2;
+                    }
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            //平均风速max
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        pjfsMax = pjfs + 2;
+                    }
+                }else{
+                    pjfsMax = pjfs + 2;
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            //预测风速
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        ycfs = pjfs + 2;
+                    }
+                }else{
+                    ycfs = pjfs + 2;
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            //预测风速min
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        if(ycfs==0){
+                            ycfsMin = ycfs;
+                        }else{
+                            ycfsMin = ycfs - 2;
+                        }
+                    }
+                }else{
+                    if(ycfs==0){
+                        ycfsMin = ycfs;
+                    }else{
+                        ycfsMin = ycfs - 2;
+                    }
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            //预测风速max
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        ycfsMax = ycfs + 2;
+                    }
+                }else{
+                    ycfsMax = ycfs + 2;
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            try{
+                //实际功率
+                PointData swdl_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SJGL).getCode());
+                sjgl = new BigDecimal(swdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            //实际功率min
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        if(sjgl==0){
+                            sjglMin = sjgl;
+                        }else{
+                            sjglMin = sjgl - 2;
+                        }
+                    }
+                }else{
+                    if(sjgl==0){
+                        sjglMin = sjgl;
+                    }else{
+                        sjglMin = sjgl - 2;
+                    }
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            //实际功率max
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        sjglMax = sjgl + 2;
+                    }
+                }else{
+                    sjglMax = sjgl + 2;
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            try{
+                //理论功率
+                PointData swdl_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_ZLLGL).getCode());
+                llgl = new BigDecimal(swdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+            }catch (Exception e){
+                System.out.println(e.getMessage());
+            }
+
+            //理论功率min
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        if(llgl==0){
+                            llglMin = llgl;
+                        }else{
+                            llglMin = llgl - 2;
+                        }
+                    }
+                }else{
+                    if(llgl==0){
+                        llglMin = llgl;
+                    }else{
+                        llglMin = llgl - 2;
+                    }
+                }
+            }
+            catch(Exception e){
+                System.out.printf(e.getMessage());
+            }
+
+            //理论功率max
+            try{
+                if(windpowerstation.getId().equalsIgnoreCase("0")){
+                    List<Windpowerstation> wps = InitialRunner.wpls;
+                    for(Windpowerstation windpowerstationinner:wps){
+                        llglMax = llgl + 2;
+                    }
+                }else{
+                    llglMax = llgl + 2;
+                }
+            }
+            catch(Exception e){
+                System.out.printf(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);
+            windpowerstationpointDataMap.put(windpowerstation.getId(),pointDataMap);
+        }
+        this.pushToWeb("pageNumber_7","functionNumber_3",windpowerstationpointDataMap, Messagetype.MESSAGE);
+    }
+}