|
@@ -3,7 +3,10 @@ package com.gyee.gaia.meter.service.meter;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.gyee.gaia.meter.adapter.Adapter;
|
|
|
import com.gyee.gaia.meter.entity.MeterInfoCalculating;
|
|
|
+import com.gyee.gaia.meter.entity.PointData;
|
|
|
+import com.gyee.gaia.meter.entity.PointDatas;
|
|
|
import com.gyee.gaia.meter.entity.PowerStation;
|
|
|
import com.gyee.gaia.meter.entity.vo.MeterVO;
|
|
|
import com.gyee.gaia.meter.service.impl.MeterInfoCalculatingServiceImpl;
|
|
@@ -15,6 +18,7 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Author: malijun
|
|
@@ -24,6 +28,8 @@ import java.util.List;
|
|
|
@Service
|
|
|
public class GetPowerStationInfoById {
|
|
|
@Resource
|
|
|
+ Adapter adapter;
|
|
|
+ @Resource
|
|
|
MeterInfoCalculatingServiceImpl meterInfoCalculatingService;
|
|
|
@Resource
|
|
|
PowerStationServiceImpl powerStationService;
|
|
@@ -47,16 +53,42 @@ public class GetPowerStationInfoById {
|
|
|
for (int i = 1; i <= days; i++) {
|
|
|
//开始时间
|
|
|
DateTime dateTime1 = DateUtil.offsetDay(beginOfMonth, i - 1);
|
|
|
+ DateTime dateTime2 = DateUtil.endOfDay(dateTime1);
|
|
|
|
|
|
//根据时间和code查询风场日发电量,日上网电量,日购网电量
|
|
|
MeterInfoCalculating oneFDL = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().like("code", "%_JDXLFDL_P0").eq("date", dateTime1).eq("windpowerstation_id", nemCode));
|
|
|
MeterInfoCalculating oneSWDL= meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().like("code", "%F_SWDL_P0").eq("date", dateTime1).eq("windpowerstation_id", nemCode));
|
|
|
MeterInfoCalculating oneGWDL= meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>().like("code", "%_GWDL_P0").eq("date", dateTime1).eq("windpowerstation_id", nemCode));
|
|
|
|
|
|
+ BigDecimal speed = BigDecimal.valueOf(0);
|
|
|
+
|
|
|
+ if (nemCode.contains("_MHS_")){
|
|
|
+ Map<String, PointData> speed1 = adapter.getHistorySection("MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0106",dateTime2.getTime());
|
|
|
+ double value = speed1.get("MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0106").getValue();
|
|
|
+ speed= BigDecimal.valueOf(value);
|
|
|
+ } else if (nemCode.contains("_NSS_")) {
|
|
|
+ Map<String, PointData> speed2 = adapter.getHistorySection("NSSFCJSFW.NX_GD_NSSF_XX_XX_XXX_XXX_CI0106",dateTime2.getTime());
|
|
|
+ double value = speed2.get("NSSFCJSFW.NX_GD_NSSF_XX_XX_XXX_XXX_CI0106").getValue();
|
|
|
+ speed= BigDecimal.valueOf(value);
|
|
|
+ } else if (nemCode.contains("_QS_")) {
|
|
|
+ Map<String, PointData> speed3 = adapter.getHistorySection("QSFCJSFW.NX_GD_QSF_XX_XX_XXX_XXX_CI0106",dateTime2.getTime());
|
|
|
+ double value = speed3.get("QSFCJSFW.NX_GD_QSF_XX_XX_XXX_XXX_CI0106").getValue();
|
|
|
+ speed= BigDecimal.valueOf(value);
|
|
|
+ } else if (nemCode.contains("_SBQ_")) {
|
|
|
+ Map<String, PointData> speed4 = adapter.getHistorySection("SBQFCJSFW.NX_GD_SBQF_XX_XX_XXX_XXX_CI0106",dateTime2.getTime());
|
|
|
+ double value = speed4.get("SBQFCJSFW.NX_GD_SBQF_XX_XX_XXX_XXX_CI0106").getValue();
|
|
|
+ speed= BigDecimal.valueOf(value);
|
|
|
+ } else if (nemCode.contains("_XS_")) {
|
|
|
+ Map<String, PointData> speed5 = adapter.getHistorySection("XSFCJSFW.NX_GD_XSF_XX_XX_XXX_XXX_CI0106",dateTime2.getTime());
|
|
|
+ double value = speed5.get("XSFCJSFW.NX_GD_XSF_XX_XX_XXX_XXX_CI0106").getValue();
|
|
|
+ speed= BigDecimal.valueOf(value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
BigDecimal rfdl = BigDecimal.valueOf(0);
|
|
|
BigDecimal rswdl = BigDecimal.valueOf(0);
|
|
|
BigDecimal rgwdl = BigDecimal.valueOf(0);
|
|
|
- BigDecimal speed = BigDecimal.valueOf(0);
|
|
|
+
|
|
|
|
|
|
if (oneFDL != null) {
|
|
|
rfdl = oneFDL.getValue();
|
|
@@ -171,6 +203,7 @@ public class GetPowerStationInfoById {
|
|
|
for (int i = 1; i <= days; i++) {
|
|
|
//开始时间
|
|
|
DateTime dateTime1 = DateUtil.offsetDay(beginOfMonth, i - 1);
|
|
|
+ DateTime dateTime2 = DateUtil.endOfDay(dateTime1);
|
|
|
|
|
|
//根据时间和code查询光场日发电量,日上网电量
|
|
|
MeterInfoCalculating oneFDL = meterInfoCalculatingService.getOne(new QueryWrapper<MeterInfoCalculating>()
|
|
@@ -182,10 +215,37 @@ public class GetPowerStationInfoById {
|
|
|
.eq("date", dateTime1)
|
|
|
.eq("windpowerstation_id", nemCode));
|
|
|
|
|
|
+ BigDecimal speed = BigDecimal.valueOf(0);
|
|
|
+
|
|
|
+ if(nemCode.contains("_DWK_")){
|
|
|
+ List<PointDatas> historyStat1 = adapter.getHistoryStat("DWKDQ.NX_GD_DWKG_DQ_P1_L1_001_AI0082", dateTime1.getTime(), dateTime2.getTime(), 86399);
|
|
|
+ double value = historyStat1.get(0).getAvg().getValue();
|
|
|
+ speed= BigDecimal.valueOf(value).setScale(2,RoundingMode.HALF_EVEN);
|
|
|
+ } else if (nemCode.contains("_PL_")) {
|
|
|
+ double value = 66;
|
|
|
+ speed= BigDecimal.valueOf(value).setScale(2,RoundingMode.HALF_EVEN);
|
|
|
+ }else if (nemCode.contains("_XH_")) {
|
|
|
+ List<PointDatas> historyStat3 = adapter.getHistoryStat("XHDQ.NX_GD_XHG_DQ_P1_L1_001_AI0473", dateTime1.getTime(), dateTime2.getTime(), 86399);
|
|
|
+ double value = historyStat3.get(0).getAvg().getValue();
|
|
|
+ speed= BigDecimal.valueOf(value).setScale(2,RoundingMode.HALF_EVEN);
|
|
|
+ }else if (nemCode.contains("_MCH_")) {
|
|
|
+ List<PointDatas> historyStat4 = adapter.getHistoryStat("XHDQ.NX_GD_XHG_DQ_P1_L1_001_AI0475", dateTime1.getTime(), dateTime2.getTime(), 86399);
|
|
|
+ double value = historyStat4.get(0).getAvg().getValue();
|
|
|
+ speed= BigDecimal.valueOf(value).setScale(2,RoundingMode.HALF_EVEN);
|
|
|
+ }else if (nemCode.contains("_HZJ_")) {
|
|
|
+ List<PointDatas> historyStat5 = adapter.getHistoryStat("HZJFGLZN.NX_GD_HZJG_YC_P1_L1_001_QXZ002", dateTime1.getTime(), dateTime2.getTime(), 86399);
|
|
|
+ double value = historyStat5.get(0).getAvg().getValue();
|
|
|
+ speed= BigDecimal.valueOf(value).setScale(2,RoundingMode.HALF_EVEN);
|
|
|
+ }else if (nemCode.contains("_AK_")) {
|
|
|
+ List<PointDatas> historyStat6 = adapter.getHistoryStat("AKDQ.NX_GD_AKG_DQ_P1_L1_001_AI0157", dateTime1.getTime(), dateTime2.getTime(), 86399);
|
|
|
+ double value = historyStat6.get(0).getAvg().getValue();
|
|
|
+ speed= BigDecimal.valueOf(value).setScale(2,RoundingMode.HALF_EVEN);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
BigDecimal rfdl = BigDecimal.valueOf(0);
|
|
|
BigDecimal rswdl = BigDecimal.valueOf(0);
|
|
|
BigDecimal rgwdl = BigDecimal.valueOf(0);
|
|
|
- BigDecimal speed = BigDecimal.valueOf(0);
|
|
|
|
|
|
if (oneFDL != null) {
|
|
|
rfdl = oneFDL.getValue();
|
|
@@ -195,6 +255,7 @@ public class GetPowerStationInfoById {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
MeterVO meterVO = new MeterVO();
|
|
|
meterVO.setTimestr(String.valueOf(i));
|
|
|
meterVO.setDate(dateTime1);
|