|
@@ -1,16 +1,13 @@
|
|
|
package com.gyee.frame.service.app.windpowerstationdetail;
|
|
|
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
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.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.BeanUtils;
|
|
|
-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;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -18,8 +15,6 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.text.DecimalFormat;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
@@ -49,67 +44,99 @@ public class WindpowerstationdetailService extends SocketToolService {
|
|
|
Map<String,Map<String,Double>> windpowerstationpointDataMap = new HashMap();
|
|
|
IMongodbUtil mongodb = new MongodbUtilImpl();
|
|
|
|
|
|
- for(Windpowerstation windpowerstation:wpls){
|
|
|
- Map<String,Double> pointDataMap = new HashMap();
|
|
|
- double rfdl = 99;
|
|
|
- double aqts = 99;
|
|
|
- double swdl = 99;
|
|
|
- double ycfdl = 99;
|
|
|
- double zjrl = 99;
|
|
|
-
|
|
|
- try {
|
|
|
- //日发电量
|
|
|
- PointData rfdl_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_ALL_RFDL).getCode());
|
|
|
- rfdl = new BigDecimal(rfdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
- }catch (Exception e){
|
|
|
- System.out.println(e.getMessage());
|
|
|
- }
|
|
|
+ for(Windpowerstation windpowerstation:wpls){
|
|
|
+ Map<String,Double> pointDataMap = new HashMap();
|
|
|
+ double rfdl = 0;
|
|
|
+ double aqts = 0;
|
|
|
+ double swdl = 0;
|
|
|
+ double ycfdl = 0;
|
|
|
+ double zjrl = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ //日发电量
|
|
|
+ PointData rfdl_real = mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_ALL_RFDL).getCode());
|
|
|
+ rfdl = 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_AQTS).getCode());
|
|
|
- aqts = new BigDecimal(aqts_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_AQTS).getCode());
|
|
|
+ aqts = new BigDecimal(aqts_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- try{
|
|
|
- //上网电量
|
|
|
- PointData swdl_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SWDL).getCode());
|
|
|
- swdl = new BigDecimal(swdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
- }catch (Exception e){
|
|
|
- System.out.println(e.getMessage());
|
|
|
- }
|
|
|
+ try{
|
|
|
+ //上网电量
|
|
|
+ PointData swdl_real=mongodb.getRealData(stationPointmap.get(windpowerstation.getId()).get(Constant.TPOINT_WP_SWDL).getCode());
|
|
|
+ swdl = new BigDecimal(swdl_real.getPointValueInDouble()).setScale(decimal_digit, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
|
|
|
- //预测发电量
|
|
|
- ycfdl = swdl+12;
|
|
|
- //装机容量
|
|
|
- try{
|
|
|
- //上网电量
|
|
|
- if(windpowerstation.getCapacity()==null){
|
|
|
- List<Windpowerstation> wps = InitialRunner.wpls;
|
|
|
- for(Windpowerstation windpowerstationinner:wps){
|
|
|
- zjrl = zjrl + windpowerstationinner.getCapacity();
|
|
|
- }
|
|
|
- }else{
|
|
|
- zjrl = windpowerstation.getCapacity();
|
|
|
+ //预测发电量
|
|
|
+ try{
|
|
|
+ if(windpowerstation.getId().equalsIgnoreCase("0")){
|
|
|
+ List<Windpowerstation> wps = InitialRunner.wpls;
|
|
|
+ for(Windpowerstation windpowerstationinner:wps){
|
|
|
+ ycfdl = ycfdl + 12;
|
|
|
}
|
|
|
+ }else{
|
|
|
+ ycfdl = 6;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch(Exception e){
|
|
|
+ System.out.printf(e.getMessage());
|
|
|
+ }
|
|
|
|
|
|
- }catch (Exception e){
|
|
|
- System.out.println(e.getMessage());
|
|
|
+ //装机容量
|
|
|
+ try{
|
|
|
+ if(windpowerstation.getCapacity()==null){
|
|
|
+ List<Windpowerstation> wps = InitialRunner.wpls;
|
|
|
+ for(Windpowerstation windpowerstationinner:wps){
|
|
|
+ zjrl = zjrl + windpowerstationinner.getCapacity();
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ zjrl = windpowerstation.getCapacity();
|
|
|
}
|
|
|
- pointDataMap.put("rfdl",rfdl);
|
|
|
- pointDataMap.put("aqts",aqts);
|
|
|
- pointDataMap.put("swdl",swdl);
|
|
|
- pointDataMap.put("ycfdl",ycfdl);
|
|
|
- pointDataMap.put("zjrl",zjrl);
|
|
|
- windpowerstationpointDataMap.put(windpowerstation.getId(),pointDataMap);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
}
|
|
|
+ pointDataMap.put("rfdl",rfdl);
|
|
|
+ pointDataMap.put("aqts",aqts);
|
|
|
+ pointDataMap.put("swdl",swdl);
|
|
|
+ pointDataMap.put("ycfdl",ycfdl);
|
|
|
+ pointDataMap.put("zjrl",zjrl);
|
|
|
+ windpowerstationpointDataMap.put(windpowerstation.getId(),pointDataMap);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
this.pushToWeb("pageNumber_7","functionNumber_1",windpowerstationpointDataMap, Messagetype.MESSAGE);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+/* double focastpower(String name){
|
|
|
+ ForecastwindspeedamendedService forecastwindspeedamendedService= SpringUtils.getBean("forecastwindspeedamendedService");
|
|
|
+
|
|
|
+ ForecastwindspeedamendedExample forecastwindspeedamendedExample=new ForecastwindspeedamendedExample();
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+
|
|
|
+ c.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
+ c.set(Calendar.MINUTE, 0);
|
|
|
+ c.set(Calendar.SECOND, 0);
|
|
|
+ Date begin=c.getTime();
|
|
|
+ c.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ Date end=c.getTime();
|
|
|
+ forecastwindspeedamendedExample.createCriteria().andWpidEqualTo(name).andRecodedateBetween(begin,end);
|
|
|
+ List<Forecastwindspeedamended> wtls = forecastwindspeedamendedService.selectByExample(forecastwindspeedamendedExample);
|
|
|
+ double tmp = 0;
|
|
|
+ for(Forecastwindspeedamended wt:wtls)
|
|
|
+ {
|
|
|
+ tmp = tmp + wt.getDaypower().doubleValue()+wt.getNightpower().doubleValue();
|
|
|
+ }
|
|
|
+ return tmp;
|
|
|
+ }*/
|
|
|
}
|