|
@@ -0,0 +1,163 @@
|
|
|
+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.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;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Li ZaiXun
|
|
|
+ * @purpose
|
|
|
+ * @date 2020-05-16 15:48
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class Windspeedpowercurvedetail extends SocketToolService {
|
|
|
+ @Autowired
|
|
|
+ private InitialRunner initialRunner;
|
|
|
+ private static int decimal_digit = 0;
|
|
|
+ IEdosUtil mongodb = new EdosUtil();
|
|
|
+ public static Map<String,String> windpowerstationdetail_twentyfourhourlinechart_target_pointMap = new HashMap<>();
|
|
|
+ private double decimal(int num,double value){
|
|
|
+ return new BigDecimal(value).setScale(num, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ }
|
|
|
+ public <T> void windpowerstationdetail_twentyfourhourlinechart_target() throws Exception {
|
|
|
+ Map<String, Map<String, WindPowerStationTestingPoint2>> stationPointmap = InitialRunner.stationPointmap;
|
|
|
+ String fs = Constant.TPOINT_WP_SSFS;
|
|
|
+ String gl = Constant.TPOINT_WT_FJGL;
|
|
|
+ String llgl = Constant.TPOINT_WT_LLGL;
|
|
|
+ String ycgl = Constant.TPOINT_WP_YCGL;
|
|
|
+ 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();
|
|
|
+
|
|
|
+
|
|
|
+ for (Windpowerstation windpowerstation : wpls) {
|
|
|
+ Map<String,List<PointData>> map = new HashMap<>();
|
|
|
+ windpowerstationpointDataMap.put(windpowerstation.getId(),map);
|
|
|
+ List<PointData> listPointData = new ArrayList<>();
|
|
|
+ double pjfs = 0;
|
|
|
+
|
|
|
+ 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 = sdf1.parse(sdf1.format(nowTime));
|
|
|
+ Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
|
|
|
+ WindPowerStationTestingPoint2 point = stationPointmap.get(windpowerstation.getId()).get(fs);
|
|
|
+ listPointData = mongodb.getHistoryDatasSnap(point,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
|
|
|
+ (long) count+1, 3600L);
|
|
|
+ for (int i = 0; i < listPointData.size(); i++) {
|
|
|
+ listPointData.get(i).setPointTime(listPointData.get(i).getPointTime() - 3600);
|
|
|
+ listPointData.get(i).setPointValueInDouble(this.decimal(2,listPointData.get(i).getPointValueInDouble()));
|
|
|
+ }
|
|
|
+ if(listPointData.size()>0) {
|
|
|
+ listPointData.remove(0);
|
|
|
+ }
|
|
|
+ map.put("fs",listPointData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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 = sdf1.parse(sdf1.format(nowTime));
|
|
|
+ Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
|
|
|
+ WindPowerStationTestingPoint2 point = stationPointmap.get(windpowerstation.getId()).get(gl);
|
|
|
+ listPointData = mongodb.getHistoryDatasSnap(point,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
|
|
|
+ (long) count+1, 3600L);
|
|
|
+ for (int i = 0; i < listPointData.size(); i++) {
|
|
|
+ listPointData.get(i).setPointTime(listPointData.get(i).getPointTime() - 3600);
|
|
|
+ listPointData.get(i).setPointValueInDouble(this.decimal(2,listPointData.get(i).getPointValueInDouble()));
|
|
|
+ }
|
|
|
+ if(listPointData.size()>0) {
|
|
|
+ listPointData.remove(0);
|
|
|
+ }
|
|
|
+ map.put("gl",listPointData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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 = sdf1.parse(sdf1.format(nowTime));
|
|
|
+ Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
|
|
|
+ WindPowerStationTestingPoint2 point = stationPointmap.get(windpowerstation.getId()).get(llgl);
|
|
|
+ listPointData = mongodb.getHistoryDatasSnap(point,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
|
|
|
+ (long) count+1, 3600L);
|
|
|
+ for (int i = 0; i < listPointData.size(); i++) {
|
|
|
+ listPointData.get(i).setPointTime(listPointData.get(i).getPointTime() - 3600);
|
|
|
+ listPointData.get(i).setPointValueInDouble(this.decimal(2,listPointData.get(i).getPointValueInDouble()));
|
|
|
+ }
|
|
|
+ if(listPointData.size()>0) {
|
|
|
+ listPointData.remove(0);
|
|
|
+ }
|
|
|
+ map.put("llgl",listPointData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ 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 = sdf1.parse(sdf1.format(nowTime));
|
|
|
+ Long count = (endTime.getTime() - beginTime.getTime()) / 1000L / 3600L;
|
|
|
+ WindPowerStationTestingPoint2 point = stationPointmap.get(windpowerstation.getId()).get(ycgl);
|
|
|
+ listPointData = mongodb.getHistoryDatasSnap(point,
|
|
|
+ beginTime.getTime() / 1000, endTime.getTime() / 1000 + 3600L,
|
|
|
+ (long) count+1, 3600L);
|
|
|
+ for (int i = 0; i < listPointData.size(); i++) {
|
|
|
+ listPointData.get(i).setPointTime(listPointData.get(i).getPointTime() - 3600);
|
|
|
+ listPointData.get(i).setPointValueInDouble(this.decimal(2,listPointData.get(i).getPointValueInDouble()));
|
|
|
+ }
|
|
|
+ if(listPointData.size()>0) {
|
|
|
+ listPointData.remove(0);
|
|
|
+ }
|
|
|
+ map.put("ycgl",listPointData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.pushToWeb("pageNumber_7","functionNumber_4",windpowerstationpointDataMap, Messagetype.MESSAGE);
|
|
|
+ }
|
|
|
+}
|