Browse Source

首页发电量完成情况模块和基础指标模块数据接入

limiao 4 years atrás
parent
commit
0755e35d45

+ 51 - 0
src/main/java/com/gyee/frame/common/quartz/task/index_electricQuantity.java

@@ -0,0 +1,51 @@
+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 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
+ * @Description 向页面预测今天气象推送数据
+ * @Auther Wang Jiawen
+ * @DATE 2020/1/2 15:33
+ */
+@Component("index_electricQuantity")
+public class index_electricQuantity {
+	@Autowired
+	private TsysUserMapper tsysUserMapper;
+	@Autowired
+    private IndexService indexService;
+    /**
+     * 无参的任务
+     * @throws Exception 
+     */
+    public void index_electricQuantity() throws Exception {
+    	indexService.index_electricQuantity();//调用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());
+    }
+
+}

+ 51 - 0
src/main/java/com/gyee/frame/common/quartz/task/index_target_basic_indicators.java

@@ -0,0 +1,51 @@
+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 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
+ * @Description 向页面预测今天气象推送数据
+ * @Auther Wang Jiawen
+ * @DATE 2020/1/2 15:33
+ */
+@Component("index_target_basic_indicators")
+public class index_target_basic_indicators {
+	@Autowired
+	private TsysUserMapper tsysUserMapper;
+	@Autowired
+    private IndexService indexService;
+    /**
+     * 无参的任务
+     * @throws Exception 
+     */
+    public void index_target_basic_indicators() throws Exception {
+    	indexService.index_target_basic_indicators();//调用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());
+    }
+
+}

+ 2 - 0
src/main/java/com/gyee/frame/netty/websocket/config/ConfigDetail.txt

@@ -20,6 +20,8 @@ sisConfigMap->index_target_windSpeed_power->"pageNumber_6","functionNumber_2"
 sisConfigMap->index_windturbine_status->"pageNumber_6","functionNumber_3"
 10.首页模块推送,第四部分发电量完成情况模块,包括月计划发电量、年计划发电量
 sisConfigMap->index_electricQuantity->"pageNumber_6","functionNumber_4"
+11.首页模块推送,第二部分指标模块的子模块3,基础指标模块,包括月利用小时、年利用小时、综合场用电率、设备可利用率、减排二氧化硫、减排二氧化碳、节约用水、节约标煤、mttr、mtbf
+sisConfigMap->index_target_basic_indicators->"pageNumber_6","functionNumber_5"
 
 19.综合指标模块推送,指标名称comprehensive_target,包括数值,记录综合指标
 sisConfigMap->comprehensive_target->"pageNumber_7","functionNumber_1"

+ 157 - 0
src/main/java/com/gyee/frame/service/app/index/IndexService.java

@@ -11,6 +11,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Resource;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.stereotype.Service;
@@ -21,19 +23,35 @@ import com.gyee.frame.common.spring.InitialRunner;
 import com.gyee.frame.model.auto.Weatherfd;
 import com.gyee.frame.model.auto.WeatherfdExample;
 import com.gyee.frame.model.auto.WindPowerStationTestingPoint2;
+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.DateUtils;
+import com.gyee.frame.util.StringUtils;
 import com.gyee.frame.util.mongodb.IMongodbUtil;
 import com.gyee.frame.util.mongodb.MongodbUtilImpl;
 
+/**
+ * 
+	 *@author:Li Miao
+	 *
+	 *@description: sis手机app首页数据接入
+	 *
+	 *@createTime:2020年5月15日
+	 *
+ */
 @Service
 public class IndexService extends SocketToolService{
 	@Autowired
     private InitialRunner initialRunner;
     private static int decimal_digit = 0;
+    
+    @Resource
+    private WindpowerinfodayService windpowerinfodayService;
 	
 	public void index_target_comprehensive_indicators() throws Exception{
 		 Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
@@ -444,5 +462,144 @@ public class IndexService extends SocketToolService{
 	        }
        this.pushToWeb("pageNumber_6","functionNumber_3",windpowerstationpointDataMap, Messagetype.MESSAGE);
 	}
+	
+	public void index_electricQuantity() throws Exception{
+		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();
+	        IMongodbUtil mongodb = new MongodbUtilImpl();
+
+	        for(Windpowerstation windpowerstation:wpls){
+	            Map<String,Double> pointDataMap = new HashMap();
+	            double yfdl = 0;
+	            double nfdl = 0;
+
+	            try {
+	                //月计划发电量
+	                PointData rfdl_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_YFDL).getCode());
+	                yfdl = new BigDecimal(rfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+	            }catch (Exception e){
+	                System.out.println(e.getMessage());
+	            }
+
+	            try {
+	                //年计划发电量
+	                PointData aqts_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_NFDL).getCode());
+	                nfdl = new BigDecimal(aqts_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
+	            }catch (Exception e){
+	                System.out.println(e.getMessage());
+	            }
+
+	            pointDataMap.put("yfdl",yfdl);
+	            pointDataMap.put("nfdl",nfdl);
+	            windpowerstationpointDataMap.put(windpowerstation.getId(),pointDataMap);
+	        }
+      this.pushToWeb("pageNumber_6","functionNumber_4",windpowerstationpointDataMap, Messagetype.MESSAGE);
+	}
+	
+	public void index_target_basic_indicators() throws Exception{
+		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();
+       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_6","functionNumber_5",windpowerstationpointDataMap, Messagetype.MESSAGE);
+	}
 
 }