|
@@ -1,17 +1,21 @@
|
|
|
package com.gyee.runeconomy.service.Economic;
|
|
|
|
|
|
+import com.gyee.common.contant.ContantXk;
|
|
|
+import com.gyee.common.model.PointData;
|
|
|
+import com.gyee.common.vo.curve.CurveVo;
|
|
|
import com.gyee.runeconomy.dto.EconomicVo;
|
|
|
+import com.gyee.runeconomy.dto.PowercurveVo;
|
|
|
import com.gyee.runeconomy.dto.WxssVo;
|
|
|
import com.gyee.runeconomy.init.CacheContext;
|
|
|
-import com.gyee.runeconomy.model.auto.ProBasicOrganizeTree;
|
|
|
-import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay1;
|
|
|
-import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay1Service;
|
|
|
-import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay4Service;
|
|
|
-import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay7Service;
|
|
|
+import com.gyee.runeconomy.model.auto.*;
|
|
|
+import com.gyee.runeconomy.service.auto.*;
|
|
|
import com.gyee.runeconomy.util.DateUtils;
|
|
|
+import com.gyee.runeconomy.util.StringUtils;
|
|
|
+import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.*;
|
|
@@ -32,6 +36,14 @@ public class EconomicService {
|
|
|
@Autowired
|
|
|
private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;//场站三率mtbf
|
|
|
|
|
|
+ @Resource
|
|
|
+ private IProBasicPowerstationPointService proBasicPowerstationPointService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IProBasicEquipmentPointService proBasicEquipmentPointService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IEdosUtil edosUtil;
|
|
|
|
|
|
/**
|
|
|
* @param companyId
|
|
@@ -290,4 +302,85 @@ public class EconomicService {
|
|
|
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+ public List<PowercurveVo> powercurve(String wpid, String type, Date starttime,Date endtime) throws Exception {
|
|
|
+
|
|
|
+ Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero(); //当日零点
|
|
|
+ Date endDate = com.gyee.common.util.DateUtils.getCurrentDate(); //当前时间
|
|
|
+
|
|
|
+ int day = com.gyee.common.util.DateUtils.getCurrentHour();//4
|
|
|
+
|
|
|
+ List<PowercurveVo> vos = new ArrayList<PowercurveVo>();
|
|
|
+
|
|
|
+ for (int i = 0; i < 24; i++) {
|
|
|
+ PowercurveVo vo = new PowercurveVo();
|
|
|
+ vo.setLlgl(0.0); //理论功率
|
|
|
+ vo.setSjgl(0.0); //实际功率
|
|
|
+ vo.setHours(i); //时间戳
|
|
|
+ vo.setName(wpid);
|
|
|
+ vos.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ ProBasicPowerstationPoint sjgl = proBasicPowerstationPointService.getPowerstationPoint(wpid, ContantXk.SSZGL);
|
|
|
+ ProBasicPowerstationPoint ycgl = proBasicPowerstationPointService.getPowerstationPoint(wpid, ContantXk.ZYCGL);
|
|
|
+
|
|
|
+ List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
|
|
|
+ double temp1 = 0;
|
|
|
+ for (int i = 0; i < sjglls.size(); i++) {
|
|
|
+ temp1 = sjglls.get(i).getPointValueInDouble();
|
|
|
+ vos.get(i).setSjgl(StringUtils.round(temp1, 2));
|
|
|
+ }
|
|
|
+
|
|
|
+ List<PointData> llglls = edosUtil.getHistoryDatasSnap(ycgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
|
|
|
+ double temp2 = 0;
|
|
|
+ for (int i = 0; i < llglls.size(); i++) {
|
|
|
+ temp2 = llglls.get(i).getPointValueInDouble();
|
|
|
+ vos.get(i).setLlgl(StringUtils.round(temp2, 2));
|
|
|
+ }
|
|
|
+
|
|
|
+ return vos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public Map<String, List<List<CurveVo>>> curveFittingList(String windturbineIds, String type, String starttime, String endtime, String dateType) throws Exception {
|
|
|
+ Map<String, List<List<CurveVo>>> resultMap = new HashMap<>();
|
|
|
+ Map<String, ProBasicOrganizeTree> wtmap = CacheContext.wtmap;
|
|
|
+
|
|
|
+ Date beginDate = com.gyee.common.util.DateUtils.getSamedayZero(); //当日零点
|
|
|
+ Date endDate = com.gyee.common.util.DateUtils.getCurrentDate(); //当前时间
|
|
|
+
|
|
|
+ if (type.equals("-2")) {
|
|
|
+
|
|
|
+ ProBasicEquipmentPoint sjgl = proBasicEquipmentPointService.getEquipmentPoint(windturbineIds, ContantXk.SSZGL);
|
|
|
+ ProBasicEquipmentPoint ycgl = proBasicEquipmentPointService.getEquipmentPoint(windturbineIds, ContantXk.ZYCGL);
|
|
|
+ List<CurveVo> vo = new ArrayList<CurveVo>();
|
|
|
+ List< List<CurveVo> > tempList = new ArrayList<>();
|
|
|
+ List<PointData> sjglls = edosUtil.getHistoryDatasSnap(sjgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
|
|
|
+ double temp1 = 0;
|
|
|
+ for (int i = 0; i < sjglls.size(); i++) {
|
|
|
+ temp1 = sjglls.get(i).getPointValueInDouble();
|
|
|
+ vo.get(i).setWtid(sjgl.getId());
|
|
|
+ vo.get(i).setNemCode(wtmap.get(sjgl.getNemCode()).getAname());
|
|
|
+ vo.get(i).setTheorypower(StringUtils.round(temp1, 2));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<PointData> llglls = edosUtil.getHistoryDatasSnap(ycgl, beginDate.getTime() / 1000, endDate.getTime() / 1000, null, 900L);
|
|
|
+ double temp2 = 0;
|
|
|
+ for (int i = 0; i < llglls.size(); i++) {
|
|
|
+ temp2 = llglls.get(i).getPointValueInDouble();
|
|
|
+ vo.get(i).setWtid(sjgl.getId());
|
|
|
+ vo.get(i).setNemCode(wtmap.get(sjgl.getNemCode()).getAname());
|
|
|
+ vo.get(i).setEnsurepower(StringUtils.round(temp2, 2));
|
|
|
+ tempList.add(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconWtPowerCurveFitting> collect = CacheContext.wtPowerCurveFittingList.stream().filter(wpcf -> windturbineIds.contains(wpcf.getWindturbineId())).collect(Collectors.toList());
|
|
|
+
|
|
|
+ resultMap.put("list", tempList);
|
|
|
+ }
|
|
|
+
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
}
|