|
@@ -1,17 +1,16 @@
|
|
|
package com.gyee.generation.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.gyee.common.contant.ContantXk;
|
|
|
import com.gyee.common.model.PointData;
|
|
|
import com.gyee.generation.init.CacheContext;
|
|
|
import com.gyee.generation.model.auto.*;
|
|
|
-import com.gyee.generation.model.vo.StatData;
|
|
|
import com.gyee.generation.service.auto.IProEconBrownoutsEvent2Service;
|
|
|
import com.gyee.generation.service.auto.IProEconBrownoutsEventService;
|
|
|
import com.gyee.generation.service.auto.IProEconMainBrownouts2Service;
|
|
|
import com.gyee.generation.service.auto.IProEconMainBrownoutsService;
|
|
|
+import com.gyee.generation.task.BrownoutsThread;
|
|
|
+import com.gyee.generation.task.MainBrownoutsThread;
|
|
|
import com.gyee.generation.util.DateUtils;
|
|
|
-import com.gyee.generation.util.StringUtils;
|
|
|
import com.gyee.generation.util.realtimesource.IEdosUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -20,6 +19,8 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CountDownLatch;
|
|
|
+import java.util.concurrent.Executor;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@@ -42,6 +43,11 @@ public class LimitEventnewService {
|
|
|
@Resource
|
|
|
private IEdosUtil edosUtil;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private Executor executor;
|
|
|
+ @Resource
|
|
|
+ private Executor mainexecutor;
|
|
|
+
|
|
|
@Value("${frequency.powerrationing}")
|
|
|
private Integer frequency;
|
|
|
public static Logger logger = LoggerFactory.getLogger(ShutdownnewService.class);
|
|
@@ -87,34 +93,34 @@ public class LimitEventnewService {
|
|
|
statusDescriptionMap.put(13, "设备离线");
|
|
|
|
|
|
for (ProBasicPowerstation wp : CacheContext.wpls) {
|
|
|
- Map<String, ProBasicPowerstationPoint> wppointmap = CacheContext.wppointmap.get(wp.getId());
|
|
|
-
|
|
|
- //取实时状态数据 赋值给status
|
|
|
-
|
|
|
- if (wppointmap.containsKey(ContantXk.CZZT)) {
|
|
|
- ProBasicPowerstationPoint mxztPoint = wppointmap.get(ContantXk.CZZT);
|
|
|
- //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
|
|
|
- List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000, null, 1L);
|
|
|
- wpstatusMap.put(wp.getId(), statusls);
|
|
|
- }
|
|
|
-
|
|
|
+// Map<String, ProBasicPowerstationPoint> wppointmap = CacheContext.wppointmap.get(wp.getId());
|
|
|
+//
|
|
|
+// //取实时状态数据 赋值给status
|
|
|
+//
|
|
|
+// if (wppointmap.containsKey(ContantXk.CZZT)) {
|
|
|
+// ProBasicPowerstationPoint mxztPoint = wppointmap.get(ContantXk.CZZT);
|
|
|
+// //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
|
|
|
+// List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000, null, 1L);
|
|
|
+// wpstatusMap.put(wp.getId(), statusls);
|
|
|
+// }
|
|
|
+ wpstatusMap.put(wp.getId(), null);
|
|
|
//初始化将所有风场编号作为key,value全部赋值为null
|
|
|
oldMainBrownoutsMap.put(wp.getId(), null);
|
|
|
oldMainBrownouts2Map.put(wp.getId(), null);
|
|
|
|
|
|
}
|
|
|
for (ProBasicEquipment wt : CacheContext.wtls) {
|
|
|
- Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
|
|
|
-
|
|
|
- //取实时状态数据 赋值给status
|
|
|
-
|
|
|
- if (windturbinetestingpointnewMap.containsKey(ContantXk.MXZT)) {
|
|
|
- ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
|
|
|
- //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
|
|
|
- List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000, null, 1L);
|
|
|
- statusMap.put(wt.getId(), statusls);
|
|
|
- }
|
|
|
-
|
|
|
+// Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
|
|
|
+//
|
|
|
+// //取实时状态数据 赋值给status
|
|
|
+//
|
|
|
+// if (windturbinetestingpointnewMap.containsKey(ContantXk.MXZT)) {
|
|
|
+// ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
|
|
|
+// //获取5分钟没个间隔1秒钟,保证状态与时序库保持一致
|
|
|
+// List<PointData> statusls = edosUtil.getHistoryDatasSnap(mxztPoint.getNemCode(), begin.getTime() / 1000, end.getTime() / 1000, null, 1L);
|
|
|
+// statusMap.put(wt.getId(), statusls);
|
|
|
+// }
|
|
|
+ statusMap.put(wt.getId(), null);
|
|
|
//初始化将所有风机编号作为key,value全部赋值为null
|
|
|
oldBrownoutsStatusMap.put(wt.getId(), null);
|
|
|
oldBrownoutsStatus2Map.put(wt.getId(), null);
|
|
@@ -169,263 +175,35 @@ public class LimitEventnewService {
|
|
|
}
|
|
|
}
|
|
|
//*************************主表数据计算*****************************************************************************/
|
|
|
- //遍历PG数据库中存在的记录,恢复时间为空的集合
|
|
|
- for (String wpId : oldMainBrownoutsMap.keySet()) {
|
|
|
- ProEconMainBrownouts mainBrownouts = null;
|
|
|
- ProEconMainBrownouts2 mainBrownouts2;
|
|
|
- //获取5分钟的状态值
|
|
|
- List<PointData> statusls = wpstatusMap.get(wpId);
|
|
|
-
|
|
|
- Map<String, ProBasicPowerstationPoint> wppointmap = CacheContext.wppointmap.get(wpId);
|
|
|
- //记录上次判定的状态值
|
|
|
- int lastStatus = (int) statusls.get(0).getPointValueInDouble();
|
|
|
- for (PointData stpo : statusls) {
|
|
|
-
|
|
|
- //获取当前状态
|
|
|
- int currentStatus = (int) stpo.getPointValueInDouble();
|
|
|
- //获取当前时间
|
|
|
- Date currentTime = new Date(stpo.getPointTime());
|
|
|
- //如果数据库中不存在该风机未完成的故障记录,进入
|
|
|
- if (mainBrownouts == null) {
|
|
|
- if (currentStatus == 4) {
|
|
|
- mainBrownouts = new ProEconMainBrownouts();
|
|
|
-
|
|
|
- intialainBrownouts(wpId, wppointmap, currentTime, mainBrownouts);
|
|
|
-
|
|
|
- oldMainBrownoutsMap.put(wpId, mainBrownouts);
|
|
|
-
|
|
|
-
|
|
|
- mainBrownouts2 = new ProEconMainBrownouts2();
|
|
|
- intialainBrownouts2(wpId, wppointmap, currentTime, mainBrownouts2);
|
|
|
- oldMainBrownouts2Map.put(wpId, mainBrownouts2);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //将当前状态赋值给过去状态
|
|
|
- lastStatus = currentStatus;
|
|
|
- } else if (lastStatus != currentStatus) {
|
|
|
-
|
|
|
- //如果添加了状态值,状态值变化存储,并清空
|
|
|
- if (oldMainBrownoutsMap.containsKey(wpId)) {
|
|
|
-
|
|
|
- //获取数据库中的状态值,状态值变化存储,并清空
|
|
|
- mainBrownouts = oldMainBrownoutsMap.get(wpId);
|
|
|
- if (mainBrownouts == null) {
|
|
|
- mainBrownouts = new ProEconMainBrownouts();
|
|
|
- intialainBrownouts(wpId, wppointmap, currentTime, mainBrownouts);
|
|
|
- oldMainBrownoutsMap.put(wpId, mainBrownouts);
|
|
|
-
|
|
|
- } else {
|
|
|
- finishMainBrownouts(wpId, mainBrownouts, currentTime);
|
|
|
- oldMainBrownoutsMap.put(wpId, null);
|
|
|
- mainBrownouts = null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (oldMainBrownouts2Map.containsKey(wpId)) {
|
|
|
-
|
|
|
- //获取数据库中的状态值,状态值变化存储,并清空
|
|
|
- mainBrownouts2 = oldMainBrownouts2Map.get(wpId);
|
|
|
- if (mainBrownouts2 == null) {
|
|
|
- mainBrownouts2 = new ProEconMainBrownouts2();
|
|
|
- intialainBrownouts2(wpId, wppointmap, currentTime, mainBrownouts2);
|
|
|
- oldMainBrownouts2Map.put(wpId, mainBrownouts2);
|
|
|
- } else {
|
|
|
- finishMainBrownouts2(wpId, mainBrownouts2, currentTime);
|
|
|
- oldMainBrownouts2Map.put(wpId, null);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ final CountDownLatch latch = new CountDownLatch(oldMainBrownoutsMap.keySet().size());
|
|
|
|
|
|
- lastStatus = currentStatus;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- //循环结束落盘,并清空
|
|
|
- if (oldMainBrownoutsMap.containsKey(wpId)) {
|
|
|
- //获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
|
|
|
- mainBrownouts = oldMainBrownoutsMap.get(wpId);
|
|
|
-
|
|
|
- if (mainBrownouts != null) {
|
|
|
- ProEconMainBrownouts finalItem = mainBrownouts;
|
|
|
- QueryWrapper<ProEconMainBrownouts> queryWrapper5 = new QueryWrapper<>();
|
|
|
- queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
|
|
|
- List<ProEconMainBrownouts> ls = proEconMainBrownoutsService.list(queryWrapper5);
|
|
|
-// .stream()
|
|
|
-// .filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
|
|
|
-// && i.getStopTime().compareTo(finalItem.getStopTime()) == 0)
|
|
|
- //.collect(Collectors.toList());
|
|
|
+ //遍历PG数据库中存在的记录,恢复时间为空的集合
|
|
|
+ for (String wpId : oldMainBrownoutsMap.keySet()) {
|
|
|
//
|
|
|
- if (ls.isEmpty()) {
|
|
|
- proEconMainBrownoutsService.save(finalItem);
|
|
|
- oldMainBrownoutsMap.put(wpId, null);
|
|
|
-
|
|
|
- if (newMainBrownoutsMap.containsKey(wpId)) {
|
|
|
- Map<String, ProEconMainBrownouts> mbmap = newMainBrownoutsMap.get(wpId);
|
|
|
- mbmap.put(String.valueOf(mainBrownouts.getStopTime().getTime()), mainBrownouts);
|
|
|
- } else {
|
|
|
- Map<String, ProEconMainBrownouts> mbmap = new HashMap<>();
|
|
|
- mbmap.put(String.valueOf(mainBrownouts.getStopTime().getTime()), mainBrownouts);
|
|
|
- newMainBrownoutsMap.put(wpId, mbmap);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (oldMainBrownouts2Map.containsKey(wpId)) {
|
|
|
- //获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
|
|
|
- mainBrownouts2 = oldMainBrownouts2Map.get(wpId);
|
|
|
- if (mainBrownouts2 != null) {
|
|
|
- ProEconMainBrownouts2 finalItem = mainBrownouts2;
|
|
|
- QueryWrapper<ProEconMainBrownouts2> queryWrapper5 = new QueryWrapper<>();
|
|
|
- queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
|
|
|
- List<ProEconMainBrownouts2> ls = proEconMainBrownouts2Service.list(queryWrapper5);
|
|
|
-// .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
|
|
|
-// && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (ls.isEmpty()) {
|
|
|
- proEconMainBrownouts2Service.save(finalItem);
|
|
|
- oldMainBrownouts2Map.put(wpId, null);
|
|
|
-
|
|
|
- if (newMainBrownouts2Map.containsKey(wpId)) {
|
|
|
- Map<String, ProEconMainBrownouts2> mbmap = newMainBrownouts2Map.get(wpId);
|
|
|
- mbmap.put(String.valueOf(mainBrownouts2.getStopTime().getTime()), mainBrownouts2);
|
|
|
- } else {
|
|
|
- Map<String, ProEconMainBrownouts2> mbmap = new HashMap<>();
|
|
|
- mbmap.put(String.valueOf(mainBrownouts2.getStopTime().getTime()), mainBrownouts2);
|
|
|
- newMainBrownouts2Map.put(wpId, mbmap);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+// new Thread(new MainBrownoutsThread(mainexecutor
|
|
|
+// , wpstatusMap, wpId, oldMainBrownoutsMap, oldMainBrownouts2Map, proEconMainBrownoutsService, newMainBrownoutsMap, newMainBrownouts2Map, proEconMainBrownouts2Service, edosUtil, begin, end)).start();
|
|
|
+//
|
|
|
+ new Thread(new MainBrownoutsThread(mainexecutor
|
|
|
+ , wpstatusMap, wpId, oldMainBrownoutsMap, oldMainBrownouts2Map, proEconMainBrownoutsService, newMainBrownoutsMap, newMainBrownouts2Map, proEconMainBrownouts2Service, edosUtil, begin, end,latch)).start();
|
|
|
|
|
|
}
|
|
|
+ latch.await();
|
|
|
//*************************主表数据计算*****************************************************************************/
|
|
|
|
|
|
//*************************子表数据计算*****************************************************************************/
|
|
|
//遍历PG数据库中存在的记录,恢复时间为空的集合
|
|
|
for (String wtId : oldBrownoutsStatusMap.keySet()) {
|
|
|
- ProEconBrownoutsEvent brownoutsEvent = null;
|
|
|
- ProEconBrownoutsEvent2 brownoutsEvent2;
|
|
|
- //获取5分钟的状态值
|
|
|
- List<PointData> statusls = statusMap.get(wtId);
|
|
|
-
|
|
|
- Map<String, ProBasicEquipmentPoint> wtpointmap = CacheContext.wtpAimap.get(wtId);
|
|
|
- //记录上次判定的状态值
|
|
|
- int lastStatus = (int) statusls.get(0).getPointValueInDouble();
|
|
|
- for (PointData stpo : statusls) {
|
|
|
- //获取当前状态
|
|
|
- int currentStatus = (int) stpo.getPointValueInDouble();
|
|
|
- //获取当前时间
|
|
|
- Date currentTime = new Date(stpo.getPointTime());
|
|
|
- //如果数据库中不存在该风机未完成的故障记录,进入
|
|
|
- if (brownoutsEvent == null) {
|
|
|
- if (currentStatus == 8 || currentStatus == 9) {
|
|
|
- brownoutsEvent = new ProEconBrownoutsEvent();
|
|
|
- initialBrownoutsEvent(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent);
|
|
|
- oldBrownoutsStatusMap.put(wtId, brownoutsEvent);
|
|
|
-
|
|
|
- brownoutsEvent2 = new ProEconBrownoutsEvent2();
|
|
|
- initialBrownoutsEvent2(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent2);
|
|
|
- oldBrownoutsStatus2Map.put(wtId, brownoutsEvent2);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //将当前状态赋值给过去状态
|
|
|
- lastStatus = currentStatus;
|
|
|
- } else if (lastStatus != currentStatus) {
|
|
|
-
|
|
|
- //如果添加了状态值,状态值变化存储,并清空
|
|
|
- if (oldBrownoutsStatusMap.containsKey(wtId)) {
|
|
|
-
|
|
|
- //获取数据库中的状态值,状态值变化存储,并清空
|
|
|
- brownoutsEvent = oldBrownoutsStatusMap.get(wtId);
|
|
|
- if (brownoutsEvent == null) {
|
|
|
- brownoutsEvent = new ProEconBrownoutsEvent();
|
|
|
- initialBrownoutsEvent(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent);
|
|
|
- oldBrownoutsStatusMap.put(wtId, brownoutsEvent);
|
|
|
- } else {
|
|
|
- finishBrownoutsEvent(wtId, brownoutsEvent, currentTime);
|
|
|
- oldBrownoutsStatusMap.put(wtId, null);
|
|
|
- brownoutsEvent = null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (oldBrownoutsStatus2Map.containsKey(wtId)) {
|
|
|
-
|
|
|
- //获取数据库中的状态值,状态值变化存储,并清空
|
|
|
- brownoutsEvent2 = oldBrownoutsStatus2Map.get(wtId);
|
|
|
- if (brownoutsEvent2 == null) {
|
|
|
- brownoutsEvent2 = new ProEconBrownoutsEvent2();
|
|
|
- initialBrownoutsEvent2(wtId, wtpointmap, currentStatus, currentTime, brownoutsEvent2);
|
|
|
- oldBrownoutsStatus2Map.put(wtId, brownoutsEvent2);
|
|
|
- } else {
|
|
|
- finishBrownoutsEvent2(wtId, brownoutsEvent2, currentTime);
|
|
|
- oldBrownoutsStatus2Map.put(wtId, null);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- lastStatus = currentStatus;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- //循环结束落盘,并清空
|
|
|
- if (oldBrownoutsStatusMap.containsKey(wtId)) {
|
|
|
- //获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
|
|
|
- brownoutsEvent = oldBrownoutsStatusMap.get(wtId);
|
|
|
- if (brownoutsEvent != null) {
|
|
|
- ProEconBrownoutsEvent finalItem = brownoutsEvent;
|
|
|
- QueryWrapper<ProEconBrownoutsEvent> queryWrapper5 = new QueryWrapper<>();
|
|
|
- queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
|
|
|
- List<ProEconBrownoutsEvent> ls = proEconBrownoutsEventService.list(queryWrapper5);
|
|
|
-// .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
|
|
|
-// && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (ls.isEmpty()) {
|
|
|
- proEconBrownoutsEventService.save(finalItem);
|
|
|
- oldBrownoutsStatusMap.put(wtId, null);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (oldBrownoutsStatus2Map.containsKey(wtId)) {
|
|
|
- //获取数据库查询是否有风机对应时间的记录,如果没有写入数据库
|
|
|
- brownoutsEvent2 = oldBrownoutsStatus2Map.get(wtId);
|
|
|
- if (brownoutsEvent2 != null) {
|
|
|
- ProEconBrownoutsEvent2 finalItem = brownoutsEvent2;
|
|
|
- QueryWrapper<ProEconBrownoutsEvent2> queryWrapper5 = new QueryWrapper<>();
|
|
|
- queryWrapper5.eq("windpowerstation_id", finalItem.getWindpowerstationId()).eq("stop_Time",finalItem.getStopTime());
|
|
|
- List<ProEconBrownoutsEvent2> ls = proEconBrownoutsEvent2Service.list(queryWrapper5);
|
|
|
-// .stream().filter(i -> i.getWindpowerstationId().equals(finalItem.getWindpowerstationId())
|
|
|
-// && i.getStopTime().compareTo(finalItem.getStopTime()) == 0).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (ls.isEmpty()) {
|
|
|
- proEconBrownoutsEvent2Service.save(finalItem);
|
|
|
- oldBrownoutsStatus2Map.put(wtId, null);
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ new Thread(new BrownoutsThread(executor,
|
|
|
+ statusMap, wtId, oldBrownoutsStatusMap,oldBrownoutsStatus2Map,
|
|
|
+ proEconBrownoutsEventService,
|
|
|
+ proEconBrownoutsEvent2Service,
|
|
|
+ statusDescriptionMap,
|
|
|
+ newMainBrownouts2Map,
|
|
|
+ newMainBrownoutsMap,
|
|
|
+ edosUtil, begin, end)).start();
|
|
|
|
|
|
}
|
|
|
//*************************子表数据计算*****************************************************************************/
|
|
@@ -435,603 +213,6 @@ public class LimitEventnewService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void initialBrownoutsEvent(String wtId, Map<String, ProBasicEquipmentPoint> wtpointmap, Integer currentStatus, Date currentTime, ProEconBrownoutsEvent sub) throws Exception {
|
|
|
- ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
|
|
|
- Map<String, ProEconMainBrownouts> timemap = null;
|
|
|
- if (newMainBrownoutsMap.containsKey(wt.getWindpowerstationId())) {
|
|
|
- timemap = newMainBrownoutsMap.get(wt.getWindpowerstationId());
|
|
|
- } else {
|
|
|
- timemap = new HashMap<>();
|
|
|
- newMainBrownoutsMap.put(wt.getWindpowerstationId(), timemap);
|
|
|
- }
|
|
|
- if (timemap.containsKey(String.valueOf(currentTime))) {
|
|
|
- ProEconMainBrownouts mainObj = timemap.get(String.valueOf(currentTime));
|
|
|
- sub.setMainId(mainObj.getId());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- sub.setId(StringUtils.getUUID());
|
|
|
- sub.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
- sub.setWindturbineId(wt.getId());
|
|
|
- sub.setProjectId(wt.getProjectId());
|
|
|
- sub.setLineId(wt.getLineId());
|
|
|
- sub.setStopTime(currentTime);
|
|
|
- sub.setStartTime(null);
|
|
|
- sub.setStopHours(0.0);
|
|
|
- sub.setLossPower(0.0);
|
|
|
-
|
|
|
- sub.setStopTypeId(statusDescriptionMap.get(currentStatus));
|
|
|
-
|
|
|
-
|
|
|
- PointData data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSGL));
|
|
|
- sub.setLimitLoad(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
- data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSFS));
|
|
|
- sub.setWindSpeed(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
-
|
|
|
-
|
|
|
- long pried = DateUtils.secondsDiff(DateUtils.addMinutes(currentTime, -5), currentTime);
|
|
|
- List<PointData> hsls = edosUtil.getHistStat(wtpointmap.get(ContantXk.CJ_SSGL), DateUtils.addMinutes(currentTime, -5).getTime() / 1000, currentTime.getTime() / 1000, 1L, pried, StatData.MAX.getValue());
|
|
|
- if (StringUtils.notEmp(hsls) && hsls.size() > 0) {
|
|
|
- sub.setThisLoad(hsls.get(0).getPointValueInDouble());
|
|
|
-
|
|
|
-
|
|
|
- oldBrownoutsStatusMap.put(wtId, sub);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void initialBrownoutsEvent2(String wtId, Map<String, ProBasicEquipmentPoint> wtpointmap, Integer currentStatus, Date currentTime, ProEconBrownoutsEvent2 sub) throws Exception {
|
|
|
- ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
|
|
|
- Map<String, ProEconMainBrownouts2> timemap = null;
|
|
|
- if (newMainBrownouts2Map.containsKey(wt.getWindpowerstationId())) {
|
|
|
- timemap = newMainBrownouts2Map.get(wt.getWindpowerstationId());
|
|
|
-
|
|
|
- }else
|
|
|
- {
|
|
|
- timemap=new HashMap<>();
|
|
|
- newMainBrownouts2Map.put(wt.getWindpowerstationId(),timemap);
|
|
|
- }
|
|
|
- if (timemap.containsKey(String.valueOf(currentTime))) {
|
|
|
- ProEconMainBrownouts2 mainObj = timemap.get(String.valueOf(currentTime));
|
|
|
- sub.setMainId(mainObj.getId());
|
|
|
- }
|
|
|
-
|
|
|
- sub.setId(StringUtils.getUUID());
|
|
|
- sub.setWindpowerstationId(wt.getWindpowerstationId());
|
|
|
- sub.setWindturbineId(wt.getId());
|
|
|
- sub.setProjectId(wt.getProjectId());
|
|
|
- sub.setLineId(wt.getLineId());
|
|
|
- sub.setStopTime(currentTime);
|
|
|
- sub.setStartTime(null);
|
|
|
- sub.setStopHours(0.0);
|
|
|
- sub.setLossPower(0.0);
|
|
|
- sub.setStopTypeId(statusDescriptionMap.get(currentStatus));
|
|
|
-
|
|
|
-
|
|
|
- PointData data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSGL));
|
|
|
- sub.setLimitLoad(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
- data = edosUtil.getRealData(wtpointmap.get(ContantXk.CJ_SSFS));
|
|
|
- sub.setWindSpeed(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
-
|
|
|
-
|
|
|
- long pried = DateUtils.secondsDiff(DateUtils.addMinutes(currentTime, -5), currentTime);
|
|
|
- List<PointData> hsls = edosUtil.getHistStat(wtpointmap.get(ContantXk.CJ_SSGL), DateUtils.addMinutes(currentTime, -5).getTime() / 1000, currentTime.getTime() / 1000, 1L, pried, StatData.MAX.getValue());
|
|
|
- if (StringUtils.notEmp(hsls) && hsls.size() > 0) {
|
|
|
- sub.setThisLoad(hsls.get(0).getPointValueInDouble());
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- oldBrownoutsStatus2Map.put(wtId, sub);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void intialainBrownouts2(String wpId, Map<String, ProBasicPowerstationPoint> wppointmap, Date currentTime, ProEconMainBrownouts2 mainBrownouts2) throws Exception {
|
|
|
- PointData data;
|
|
|
- long pried;
|
|
|
- List<PointData> hsls;
|
|
|
- mainBrownouts2.setId(StringUtils.getUUID());
|
|
|
- mainBrownouts2.setStopTime(currentTime);
|
|
|
- mainBrownouts2.setStartTime(null);
|
|
|
- mainBrownouts2.setStopTypeId("限电");
|
|
|
- data = edosUtil.getRealData(wppointmap.get(ContantXk.SSZGL));
|
|
|
- mainBrownouts2.setLimitLoad(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
- data = edosUtil.getRealData(wppointmap.get(ContantXk.SSPJFS));
|
|
|
- mainBrownouts2.setWindSpeed(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
-
|
|
|
-
|
|
|
- pried = DateUtils.secondsDiff(DateUtils.addMinutes(currentTime, -5), currentTime);
|
|
|
- hsls = edosUtil.getHistStat(wppointmap.get(ContantXk.SSZGL), DateUtils.addMinutes(currentTime, -5).getTime() / 1000, currentTime.getTime() / 1000, 1L, pried, StatData.MAX.getValue());
|
|
|
- if (StringUtils.notEmp(hsls) && hsls.size() > 0) {
|
|
|
- mainBrownouts2.setThisLoad(hsls.get(0).getPointValueInDouble());
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- mainBrownouts2.setWindpowerstationId(wpId);
|
|
|
- mainBrownouts2.setLossPower(0.0);
|
|
|
- }
|
|
|
-
|
|
|
- private void intialainBrownouts(String wpId, Map<String, ProBasicPowerstationPoint> wppointmap, Date currentTime, ProEconMainBrownouts mainBrownouts) throws Exception {
|
|
|
-
|
|
|
-
|
|
|
- mainBrownouts.setId(StringUtils.getUUID());
|
|
|
- mainBrownouts.setStopTime(currentTime);
|
|
|
- mainBrownouts.setStartTime(null);
|
|
|
- mainBrownouts.setStopTypeId("限电");
|
|
|
- PointData data = edosUtil.getRealData(wppointmap.get(ContantXk.SSZGL));
|
|
|
- mainBrownouts.setLimitLoad(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
- data = edosUtil.getRealData(wppointmap.get(ContantXk.SSPJFS));
|
|
|
- mainBrownouts.setWindSpeed(StringUtils.round(data.getPointValueInDouble(), 2));
|
|
|
-
|
|
|
-
|
|
|
- long pried = DateUtils.secondsDiff(DateUtils.addMinutes(currentTime, -5), currentTime);
|
|
|
- List<PointData> hsls = edosUtil.getHistStat(wppointmap.get(ContantXk.SSZGL), DateUtils.addMinutes(currentTime, -5).getTime() / 1000, currentTime.getTime() / 1000, 1L, pried, StatData.MAX.getValue());
|
|
|
- if (StringUtils.notEmp(hsls) && hsls.size() > 0) {
|
|
|
- mainBrownouts.setThisLoad(hsls.get(0).getPointValueInDouble());
|
|
|
-
|
|
|
- }
|
|
|
- mainBrownouts.setWindpowerstationId(wpId);
|
|
|
- mainBrownouts.setLossPower(0.0);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void finishMainBrownouts2(String wpId, ProEconMainBrownouts2 mainBrownouts2, Date currentTime) throws Exception {
|
|
|
-// if(currentStatus != 4 )
|
|
|
-// {
|
|
|
- mainBrownouts2.setStartTime(currentTime);
|
|
|
-
|
|
|
- double timehour = DateUtils.hoursDiff2(mainBrownouts2.getStartTime(), mainBrownouts2.getStopTime());
|
|
|
- mainBrownouts2.setStopHours(timehour);
|
|
|
- double losspower = calWpLossPower(wpId, mainBrownouts2.getStartTime(), mainBrownouts2.getStopTime());
|
|
|
- mainBrownouts2.setLossPower(losspower);
|
|
|
-
|
|
|
- if (timehour <= 24) {
|
|
|
- proEconMainBrownouts2Service.saveOrUpdate(mainBrownouts2);
|
|
|
-
|
|
|
- if (newMainBrownouts2Map.containsKey(wpId)) {
|
|
|
- Map<String, ProEconMainBrownouts2> mbmap = newMainBrownouts2Map.get(wpId);
|
|
|
- mbmap.put(String.valueOf(mainBrownouts2.getStopTime().getTime()), mainBrownouts2);
|
|
|
- } else {
|
|
|
- Map<String, ProEconMainBrownouts2> mbmap = new HashMap<>();
|
|
|
- mbmap.put(String.valueOf(mainBrownouts2.getStopTime().getTime()), mainBrownouts2);
|
|
|
- newMainBrownouts2Map.put(wpId, mbmap);
|
|
|
- }
|
|
|
- } else {
|
|
|
- int days = DateUtils.daysDiff1(mainBrownouts2.getStartTime(), mainBrownouts2.getStopTime());
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- Date startTime = mainBrownouts2.getStartTime();
|
|
|
- c.setTime(mainBrownouts2.getStopTime());
|
|
|
- c.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
- c.set(Calendar.MINUTE, 59);
|
|
|
- c.set(Calendar.SECOND, 59);
|
|
|
- for (int i = 0; i < days; i++) {
|
|
|
- if (i == 0) {
|
|
|
- mainBrownouts2.setStartTime(c.getTime());
|
|
|
- losspower = calWpLossPower(wpId, mainBrownouts2.getStartTime(), mainBrownouts2.getStopTime());
|
|
|
-
|
|
|
- } else {
|
|
|
- mainBrownouts2.setStopTime(DateUtils.truncate(c.getTime()));
|
|
|
- if (i == days - 1) {
|
|
|
- mainBrownouts2.setStartTime(startTime);
|
|
|
-
|
|
|
- } else {
|
|
|
- mainBrownouts2.setStartTime(c.getTime());
|
|
|
-
|
|
|
- }
|
|
|
- losspower = calWpLossPower(wpId, mainBrownouts2.getStartTime(), mainBrownouts2.getStopTime());
|
|
|
- }
|
|
|
- mainBrownouts2.setLossPower(losspower);
|
|
|
- proEconMainBrownouts2Service.saveOrUpdate(mainBrownouts2);
|
|
|
-
|
|
|
- if (newMainBrownouts2Map.containsKey(wpId)) {
|
|
|
- Map<String, ProEconMainBrownouts2> mbmap = newMainBrownouts2Map.get(wpId);
|
|
|
- mbmap.put(String.valueOf(mainBrownouts2.getStopTime().getTime()), mainBrownouts2);
|
|
|
- } else {
|
|
|
- Map<String, ProEconMainBrownouts2> mbmap = new HashMap<>();
|
|
|
- mbmap.put(String.valueOf(mainBrownouts2.getStopTime().getTime()), mainBrownouts2);
|
|
|
- newMainBrownouts2Map.put(wpId, mbmap);
|
|
|
- }
|
|
|
-
|
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- private void finishMainBrownouts(String wpId, ProEconMainBrownouts item, Date currentTime) throws Exception {
|
|
|
-// if(currentStatus != 4 )
|
|
|
-// {
|
|
|
- item.setStartTime(currentTime);
|
|
|
- double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
- item.setStopHours(timehour);
|
|
|
- double losspower = calWpLossPower(wpId, item.getStartTime(), item.getStopTime());
|
|
|
- item.setLossPower(losspower);
|
|
|
- proEconMainBrownoutsService.saveOrUpdate(item);
|
|
|
-
|
|
|
- if (newMainBrownoutsMap.containsKey(wpId)) {
|
|
|
- Map<String, ProEconMainBrownouts> mbmap = newMainBrownoutsMap.get(wpId);
|
|
|
- mbmap.put(String.valueOf(item.getStopTime().getTime()), item);
|
|
|
- } else {
|
|
|
- Map<String, ProEconMainBrownouts> mbmap = new HashMap<>();
|
|
|
- mbmap.put(String.valueOf(item.getStopTime().getTime()), item);
|
|
|
- newMainBrownoutsMap.put(wpId, mbmap);
|
|
|
- }
|
|
|
-// }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private void finishBrownoutsEvent(String wpId, ProEconBrownoutsEvent item, Date currentTime) throws Exception {
|
|
|
-// if (currentStatus != 8 && currentStatus != 9)
|
|
|
-// {
|
|
|
- item.setStartTime(currentTime);
|
|
|
- double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
- item.setStopHours(timehour);
|
|
|
- double losspower = calLossPower(wpId, item.getStartTime(), item.getStopTime());
|
|
|
- item.setLossPower(losspower);
|
|
|
- proEconBrownoutsEventService.saveOrUpdate(item);
|
|
|
-
|
|
|
-
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
- private void finishBrownoutsEvent2(String wpId, ProEconBrownoutsEvent2 brownoutsEvent2, Date currentTime) throws Exception {
|
|
|
-// if (currentStatus != 8 && currentStatus != 9)
|
|
|
-// {
|
|
|
- brownoutsEvent2.setStartTime(currentTime);
|
|
|
-
|
|
|
- double timehour = DateUtils.hoursDiff2(brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
|
|
|
- brownoutsEvent2.setStopHours(timehour);
|
|
|
- double losspower = calLossPower(wpId, brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
|
|
|
- brownoutsEvent2.setLossPower(losspower);
|
|
|
-
|
|
|
- if (timehour <= 24) {
|
|
|
- proEconBrownoutsEvent2Service.saveOrUpdate(brownoutsEvent2);
|
|
|
- } else {
|
|
|
- int days = DateUtils.daysDiff1(brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- Date startTime = brownoutsEvent2.getStartTime();
|
|
|
- c.setTime(brownoutsEvent2.getStopTime());
|
|
|
- c.set(Calendar.HOUR_OF_DAY, 23);
|
|
|
- c.set(Calendar.MINUTE, 59);
|
|
|
- c.set(Calendar.SECOND, 59);
|
|
|
- for (int i = 0; i < days; i++) {
|
|
|
- if (i == 0) {
|
|
|
- brownoutsEvent2.setStartTime(c.getTime());
|
|
|
- losspower = calLossPower(wpId, brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
|
|
|
-
|
|
|
- } else {
|
|
|
- brownoutsEvent2.setStopTime(DateUtils.truncate(c.getTime()));
|
|
|
- if (i == days - 1) {
|
|
|
- brownoutsEvent2.setStartTime(startTime);
|
|
|
-
|
|
|
- } else {
|
|
|
- brownoutsEvent2.setStartTime(c.getTime());
|
|
|
-
|
|
|
- }
|
|
|
- losspower = calLossPower(wpId, brownoutsEvent2.getStartTime(), brownoutsEvent2.getStopTime());
|
|
|
- }
|
|
|
- brownoutsEvent2.setLossPower(losspower);
|
|
|
- proEconBrownoutsEvent2Service.saveOrUpdate(brownoutsEvent2);
|
|
|
-
|
|
|
-
|
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //修改后的限电损失统计,通过时序数据库历史切面计算
|
|
|
- private Double calWpLossPower(String wpId, Date startDate, Date endDate) throws Exception {
|
|
|
- double result = 0.0;
|
|
|
-
|
|
|
- Map<String, Map<String, ProBasicPowerstationPoint>> wppointmap = CacheContext.wppointmap;
|
|
|
- Map<String, ProBasicPowerstationPoint> wtpointmap = wppointmap.get(wpId);
|
|
|
-
|
|
|
- Calendar c1 = Calendar.getInstance();
|
|
|
- c1.setTime(startDate);
|
|
|
- Calendar c2 = Calendar.getInstance();
|
|
|
- c2.setTime(endDate);
|
|
|
- //判定限电是否跨年
|
|
|
- if (endDate.after(startDate) && c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
|
|
|
- //年限电欠发损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //年限电损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- c.setTime(DateUtils.truncate(startDate));
|
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
- //获得1月1日零点值
|
|
|
- Date endtime = c.getTime();
|
|
|
- //年限电欠发损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //年限电损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //日限电欠发损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
|
|
|
-
|
|
|
- double endvalue;
|
|
|
-
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
|
|
|
-
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdend.size() == 1) {
|
|
|
-
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > 0) {
|
|
|
- result = result + endvalue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //日限电损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
|
|
|
-
|
|
|
- double endvalue;
|
|
|
-
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
|
|
|
-
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdend.size() == 1) {
|
|
|
-
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > 0) {
|
|
|
- result = result + endvalue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return result;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //修改后的限电损失统计,通过时序数据库历史切面计算
|
|
|
- private Double calLossPower(String windturbineId, Date startDate, Date endDate) throws Exception {
|
|
|
- double result = 0.0;
|
|
|
-
|
|
|
- Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
|
|
|
- Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
|
|
|
-
|
|
|
- Calendar c1 = Calendar.getInstance();
|
|
|
- c1.setTime(startDate);
|
|
|
- Calendar c2 = Calendar.getInstance();
|
|
|
- c2.setTime(endDate);
|
|
|
- //判定限电是否跨年
|
|
|
- if (endDate.after(startDate) && c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
|
|
|
- //年限电欠发损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //年限电损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- Calendar c = Calendar.getInstance();
|
|
|
- c.setTime(DateUtils.truncate(startDate));
|
|
|
- c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
- //获得1月1日零点值
|
|
|
- Date endtime = c.getTime();
|
|
|
- //年限电欠发损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //年限电损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
|
|
|
- double beginvalue;
|
|
|
- double endvalue;
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endtime.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
- beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > beginvalue) {
|
|
|
- result = result + (endvalue - beginvalue);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //日限电欠发损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDTJSSDL)) {
|
|
|
-
|
|
|
- double endvalue;
|
|
|
-
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDTJSSDL).getNemCode());
|
|
|
-
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdend.size() == 1) {
|
|
|
-
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > 0) {
|
|
|
- result = result + endvalue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //日限电损失电量
|
|
|
- if (wtpointmap.containsKey(ContantXk.NXDJCLSSDL)) {
|
|
|
-
|
|
|
- double endvalue;
|
|
|
-
|
|
|
-
|
|
|
- List<String> pointid = new ArrayList<>();
|
|
|
- pointid.add(wtpointmap.get(ContantXk.NXDJCLSSDL).getNemCode());
|
|
|
-
|
|
|
- List<PointData> xdend = edosUtil.getHistMatrix(pointid, endDate.getTime() / 1000);
|
|
|
-
|
|
|
-
|
|
|
- if (xdend.size() == 1) {
|
|
|
-
|
|
|
- endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
-
|
|
|
- if (endvalue > 0) {
|
|
|
- result = result + endvalue;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return result;
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
}
|