|
@@ -1,21 +1,21 @@
|
|
|
package com.gyee.generation.service;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
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.StatusDetailValue;
|
|
|
import com.gyee.generation.service.auto.IProEconInterruptionService;
|
|
|
import com.gyee.generation.service.auto.IProEconShutdownEvent2Service;
|
|
|
import com.gyee.generation.service.auto.IProEconShutdownEventService;
|
|
|
import com.gyee.generation.service.auto.IProEconWindturbineStatusService;
|
|
|
-import com.gyee.generation.task.thread.ShutdownnewThread;
|
|
|
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;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -40,20 +40,10 @@ public class ShutdownnewService {
|
|
|
private IProEconShutdownEvent2Service proEconShutdownEvent2Service;
|
|
|
@Resource
|
|
|
private IProEconInterruptionService proEconInterruptionService;
|
|
|
- @Value("${frequency.shutdown}")
|
|
|
- private Integer frequency;
|
|
|
|
|
|
|
|
|
public static Logger logger = LoggerFactory.getLogger(ShutdownnewService.class);
|
|
|
- /// 风机状态说明,key为状态码,value为状态说明
|
|
|
- public Map<Integer, String> statusDescriptionMap = new HashMap<>();
|
|
|
- /// 风机当前状态,key为风机编号
|
|
|
- public Map<String, List<PointData>> statusMap = new HashMap<>();
|
|
|
|
|
|
- Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<>();
|
|
|
- Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<>();
|
|
|
- Map<String, ProEconInterruption> oldInterrup = new HashMap<>();
|
|
|
- Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<>();
|
|
|
|
|
|
@Resource
|
|
|
private Executor executor;
|
|
@@ -61,313 +51,492 @@ public class ShutdownnewService {
|
|
|
|
|
|
public void execShutdown(Date recordDate) throws Exception {
|
|
|
|
|
|
- Date begin = DateUtils.addMinutes(recordDate, -frequency);
|
|
|
-
|
|
|
-
|
|
|
- Date end = recordDate;
|
|
|
- oldStatusMap.clear();
|
|
|
- oldShutdownEvent.clear();
|
|
|
- oldInterrup.clear();
|
|
|
- oldShutdownEvent2.clear();
|
|
|
-
|
|
|
- statusDescriptionMap.put(0, "待机");
|
|
|
- statusDescriptionMap.put(1, "手动停机");
|
|
|
- statusDescriptionMap.put(2, "正常发电");
|
|
|
- statusDescriptionMap.put(3, "缺陷降出力");
|
|
|
- statusDescriptionMap.put(4, "故障停机");
|
|
|
- statusDescriptionMap.put(5, "故障受累");
|
|
|
- statusDescriptionMap.put(6, "检修停机");
|
|
|
- statusDescriptionMap.put(7, "检修受累");
|
|
|
- statusDescriptionMap.put(8, "限电降出力");
|
|
|
- statusDescriptionMap.put(9, "限电停机");
|
|
|
- statusDescriptionMap.put(10, "电网受累");
|
|
|
- statusDescriptionMap.put(11, "环境受累");
|
|
|
- statusDescriptionMap.put(12, "通讯中断");
|
|
|
- statusDescriptionMap.put(13, "设备离线");
|
|
|
-
|
|
|
- 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);
|
|
|
-// }
|
|
|
- statusMap.put(wt.getId(), null);
|
|
|
+ List<String> wtStatusIdLs = new ArrayList<>();
|
|
|
+
|
|
|
+ Map<String, PointData> wtStatusMap = new HashMap<>();
|
|
|
+
|
|
|
+
|
|
|
+ Map<String, ProEconWindturbineStatus> oldStatusMap = new HashMap<>();
|
|
|
+ Map<String, ProEconShutdownEvent> oldShutdownEvent = new HashMap<>();
|
|
|
+ Map<String, ProEconInterruption> oldInterrup = new HashMap<>();
|
|
|
+ Map<String, ProEconShutdownEvent2> oldShutdownEvent2 = new HashMap<>();
|
|
|
+
|
|
|
+ List<ProBasicEquipment> wtls = new ArrayList<>();
|
|
|
+ for (ProBasicEquipment wt : CacheContext.wtls) {
|
|
|
+
|
|
|
+ if (wt.getWindpowerstationId().contains("GDC")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ wtls.add(wt);
|
|
|
+ }
|
|
|
+ for (ProBasicEquipment wt : wtls) {
|
|
|
+ Map<String, ProBasicEquipmentPoint> windturbinetestingpointnewMap = CacheContext.wtpAimap.get(wt.getId());
|
|
|
+
|
|
|
+ //取实时状态数据 赋值给status
|
|
|
+
|
|
|
+ if (windturbinetestingpointnewMap.containsKey(ContantXk.MXZT)) {
|
|
|
+ ProBasicEquipmentPoint mxztPoint = windturbinetestingpointnewMap.get(ContantXk.MXZT);
|
|
|
+ wtStatusIdLs.add(mxztPoint.getNemCode());
|
|
|
+ }
|
|
|
+
|
|
|
//初始化将所有风机编号作为key,value全部赋值为null
|
|
|
oldStatusMap.put(wt.getId(), null);
|
|
|
oldShutdownEvent.put(wt.getId(), null);
|
|
|
oldInterrup.put(wt.getId(), null);
|
|
|
oldShutdownEvent2.put(wt.getId(), null);
|
|
|
}
|
|
|
+
|
|
|
+ List<PointData> wtStatusLs = edosUtil.getHistMatrix(wtStatusIdLs,recordDate.getTime()/1000);
|
|
|
+
|
|
|
+ if (wtStatusLs.size() == wtls.size()) {
|
|
|
+
|
|
|
+ for (int i = 0; i < wtls.size(); i++) {
|
|
|
+
|
|
|
+ ProBasicEquipment wt = wtls.get(i);
|
|
|
+
|
|
|
+ wtStatusMap.put(wt.getId(), wtStatusLs.get(i));
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
//******************************************************************************************************/
|
|
|
|
|
|
//读取数据库存在的恢复时间为NULL的数据,并通过风机编号把数据遍历到对应的map
|
|
|
QueryWrapper<ProEconWindturbineStatus> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.isNull("start_Time");
|
|
|
- List<ProEconWindturbineStatus> oldStatusQuery=proEconWindturbineStatusService.list(queryWrapper).stream()
|
|
|
-// .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
- .sorted(Comparator.comparing(ProEconWindturbineStatus::getStopTime)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (ProEconWindturbineStatus oldStatus : oldStatusQuery)
|
|
|
- {
|
|
|
- if (oldStatusMap.containsKey(oldStatus.getWindturbineId()))
|
|
|
- {
|
|
|
- oldStatusMap.put(oldStatus.getWindturbineId(),oldStatus);
|
|
|
+ queryWrapper.orderByDesc("stop_Time");
|
|
|
+ List<ProEconWindturbineStatus> oldStatusQuery = proEconWindturbineStatusService.list(queryWrapper).stream().collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (ProEconWindturbineStatus oldStatus : oldStatusQuery) {
|
|
|
+ if (oldStatusMap.containsKey(oldStatus.getWindturbineId())) {
|
|
|
+ oldStatusMap.put(oldStatus.getWindturbineId(), oldStatus);
|
|
|
}
|
|
|
}
|
|
|
QueryWrapper<ProEconShutdownEvent> queryWrapper2 = new QueryWrapper<>();
|
|
|
queryWrapper2.isNull("start_Time");
|
|
|
- List<ProEconShutdownEvent> oldShutdwonQuery=proEconShutdownEventService.list(queryWrapper2).stream()
|
|
|
-// .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
- .sorted(Comparator.comparing(ProEconShutdownEvent::getStopTime)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (ProEconShutdownEvent shutdown : oldShutdwonQuery)
|
|
|
- {
|
|
|
- if (oldShutdownEvent.containsKey(shutdown.getWindturbineId()))
|
|
|
- {
|
|
|
- oldShutdownEvent.put(shutdown.getWindturbineId(),shutdown);
|
|
|
+ queryWrapper2.orderByDesc("stop_Time");
|
|
|
+ List<ProEconShutdownEvent> oldShutdwonQuery = proEconShutdownEventService.list(queryWrapper2).stream().collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (ProEconShutdownEvent shutdown : oldShutdwonQuery) {
|
|
|
+ if (oldShutdownEvent.containsKey(shutdown.getWindturbineId())) {
|
|
|
+ oldShutdownEvent.put(shutdown.getWindturbineId(), shutdown);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
QueryWrapper<ProEconInterruption> queryWrapper3 = new QueryWrapper<>();
|
|
|
queryWrapper3.isNull("start_Time");
|
|
|
- List<ProEconInterruption> oldInterrupQuery=proEconInterruptionService.list(queryWrapper3).stream()
|
|
|
-// .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
- .sorted(Comparator.comparing(ProEconInterruption::getStopTime)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (ProEconInterruption interrup : oldInterrupQuery)
|
|
|
- {
|
|
|
- if (oldInterrup.containsKey(interrup.getWindturbineId()))
|
|
|
- {
|
|
|
- oldInterrup.put(interrup.getWindturbineId(),interrup);
|
|
|
+ queryWrapper3.orderByDesc("stop_Time");
|
|
|
+ List<ProEconInterruption> oldInterrupQuery = proEconInterruptionService.list(queryWrapper3).stream().collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (ProEconInterruption interrup : oldInterrupQuery) {
|
|
|
+ if (oldInterrup.containsKey(interrup.getWindturbineId())) {
|
|
|
+ oldInterrup.put(interrup.getWindturbineId(), interrup);
|
|
|
}
|
|
|
}
|
|
|
QueryWrapper<ProEconShutdownEvent2> queryWrapper4 = new QueryWrapper<>();
|
|
|
queryWrapper4.isNull("start_Time");
|
|
|
- List<ProEconShutdownEvent2> oldShutdwonQuery2=proEconShutdownEvent2Service.list(queryWrapper4).stream()
|
|
|
-// .filter(i->StringUtils.empty(i.getStartTime()))
|
|
|
- .sorted(Comparator.comparing(ProEconShutdownEvent2::getStopTime)).collect(Collectors.toList());
|
|
|
-
|
|
|
- for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2)
|
|
|
- {
|
|
|
- if (oldShutdownEvent2.containsKey(shutdown.getWindturbineId()))
|
|
|
- {
|
|
|
+ queryWrapper4.orderByDesc("stop_Time");
|
|
|
+ List<ProEconShutdownEvent2> oldShutdwonQuery2 = proEconShutdownEvent2Service.list(queryWrapper4).stream().collect(Collectors.toList());
|
|
|
|
|
|
-
|
|
|
- oldShutdownEvent2.put(shutdown.getWindturbineId(),shutdown);
|
|
|
+ for (ProEconShutdownEvent2 shutdown : oldShutdwonQuery2) {
|
|
|
+ if (oldShutdownEvent2.containsKey(shutdown.getWindturbineId())) {
|
|
|
+ oldShutdownEvent2.put(shutdown.getWindturbineId(), shutdown);
|
|
|
}
|
|
|
}
|
|
|
//******************************************************************************************************/
|
|
|
+
|
|
|
+ List<ProEconShutdownEvent> updateProEconShutdownEventls = new ArrayList<>();
|
|
|
+ List<ProEconShutdownEvent2> updateProEconShutdownEvent2ls = new ArrayList<>();
|
|
|
+ List<ProEconInterruption> updateProEconInterruptionls = new ArrayList<>();
|
|
|
+ List<ProEconWindturbineStatus> updateProEconWindturbineStatusls = new ArrayList<>();
|
|
|
+
|
|
|
+ List<ProEconShutdownEvent> insertProEconShutdownEventls = new ArrayList<>();
|
|
|
+ List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls = new ArrayList<>();
|
|
|
+ List<ProEconInterruption> insertProEconInterruptionls = new ArrayList<>();
|
|
|
+ List<ProEconWindturbineStatus> insertProEconWindturbineStatusls = new ArrayList<>();
|
|
|
//遍历PG数据库中存在的记录,恢复时间为空的集合
|
|
|
- for (String windturbineId : oldStatusMap.keySet())
|
|
|
- {
|
|
|
-// try {
|
|
|
-// Thread.sleep(100);
|
|
|
-// } catch (InterruptedException e1) {
|
|
|
-// e1.printStackTrace();
|
|
|
-// }
|
|
|
- new Thread(new ShutdownnewThread(executor, oldStatusMap, statusMap, windturbineId,
|
|
|
- statusDescriptionMap, oldShutdownEvent,
|
|
|
- oldInterrup, oldShutdownEvent2,begin, end,edosUtil,proEconWindturbineStatusService,
|
|
|
- proEconShutdownEventService, proEconShutdownEvent2Service,
|
|
|
- proEconInterruptionService)).start();
|
|
|
+ for (String wtId : oldStatusMap.keySet()) {
|
|
|
+
|
|
|
+ ProEconShutdownEvent shutdwonEvent = null;
|
|
|
+ ProEconInterruption interrup = null;
|
|
|
+ ProEconShutdownEvent2 shutdwonEvent2 = null;
|
|
|
+ ProEconWindturbineStatus item = null;
|
|
|
+
|
|
|
+ if (oldStatusMap.containsKey(wtId)) {
|
|
|
+ item = oldStatusMap.get(wtId);
|
|
|
+ }
|
|
|
+ if (oldShutdownEvent.containsKey(wtId)) {
|
|
|
+ shutdwonEvent = oldShutdownEvent.get(wtId);
|
|
|
+ }
|
|
|
+ if (oldShutdownEvent2.containsKey(wtId)) {
|
|
|
+ shutdwonEvent2 = oldShutdownEvent2.get(wtId);
|
|
|
+ }
|
|
|
+ if (oldInterrup.containsKey(wtId)) {
|
|
|
+ interrup = oldInterrup.get(wtId);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wtStatusMap.containsKey(wtId)) {
|
|
|
+ if(wtId.equals("SXJ_KGDL_PTZ_F_WT_0022_EQ"))
|
|
|
+ {
|
|
|
+ System.out.println("");
|
|
|
+ }
|
|
|
+ PointData wtPoint = wtStatusMap.get(wtId);
|
|
|
+ //获取当前时间
|
|
|
+ Date currentTime = recordDate;
|
|
|
+ if (StringUtils.empty(item)) {
|
|
|
+ item = new ProEconWindturbineStatus();
|
|
|
+ initalWindturbineStatus(insertProEconWindturbineStatusls, wtId, wtStatusMap, currentTime, item);
|
|
|
+ } else if (StringUtils.notEmp(item) && wtPoint.getPointValueInDouble() != item.getSatusCode()) {
|
|
|
+ finishWindturbineStatus(updateProEconWindturbineStatusls, wtId, currentTime, item);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wtPoint.getPointValueInDouble() == StatusDetailValue.TXZD.getCode()) {
|
|
|
+ if (StringUtils.empty(interrup)) {
|
|
|
+ interrup = new ProEconInterruption();
|
|
|
+ initalInterruption(insertProEconInterruptionls, wtId, currentTime, interrup);
|
|
|
+ }
|
|
|
+ } else if (StringUtils.notEmp(interrup)) {
|
|
|
+
|
|
|
+ finishInterruption(updateProEconInterruptionls, wtId, currentTime, interrup);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wtPoint.getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
|
|
|
+ if (StringUtils.empty(shutdwonEvent)) {
|
|
|
+ shutdwonEvent = new ProEconShutdownEvent();
|
|
|
+ initalShutdownEvent(insertProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
|
|
|
+ }
|
|
|
+ if (StringUtils.empty(shutdwonEvent2)) {
|
|
|
+ shutdwonEvent2 = new ProEconShutdownEvent2();
|
|
|
+ initalShutdownEvent2(insertProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
|
|
|
+ {
|
|
|
+ finishShutdownEvent(updateProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
|
|
|
+ }
|
|
|
+ if (StringUtils.notEmp(shutdwonEvent2) && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
|
|
|
+ {
|
|
|
+ finishShutdownEvent2(updateProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if (wtPoint.getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
|
|
|
+ if (StringUtils.empty(shutdwonEvent)) {
|
|
|
+ shutdwonEvent = new ProEconShutdownEvent();
|
|
|
+ initalShutdownEvent(insertProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
|
|
|
+ }
|
|
|
+ if (StringUtils.empty(shutdwonEvent2)) {
|
|
|
+ shutdwonEvent2 = new ProEconShutdownEvent2();
|
|
|
+ initalShutdownEvent2(insertProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StringUtils.notEmp(shutdwonEvent) && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
|
|
|
+ {
|
|
|
+ finishShutdownEvent(updateProEconShutdownEventls, wtId, wtStatusMap, currentTime, shutdwonEvent);
|
|
|
+ }
|
|
|
+ if (StringUtils.notEmp(shutdwonEvent2) && shutdwonEvent.getStatusCode()!=wtPoint.getPointValueInDouble())
|
|
|
+ {
|
|
|
+ finishShutdownEvent2(updateProEconShutdownEvent2ls, wtId, wtStatusMap, currentTime, shutdwonEvent2);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (ProEconShutdownEvent vo : updateProEconShutdownEventls) {
|
|
|
+ UpdateWrapper<ProEconShutdownEvent> updateWrapper = new UpdateWrapper<>();
|
|
|
+// updateWrapper.set("start_time", vo.getStartTime());
|
|
|
+// updateWrapper.set("loss_power", vo.getLossPower());
|
|
|
+// updateWrapper.set("stop_hours", vo.getStopHours());
|
|
|
+ proEconShutdownEventService.update(vo, updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (ProEconShutdownEvent2 vo : updateProEconShutdownEvent2ls) {
|
|
|
+ UpdateWrapper<ProEconShutdownEvent2> updateWrapper = new UpdateWrapper<>();
|
|
|
+// updateWrapper.set("start_time", vo.getStartTime());
|
|
|
+// updateWrapper.set("loss_power", vo.getLossPower());
|
|
|
+// updateWrapper.set("stop_hours", vo.getStopHours());
|
|
|
+ proEconShutdownEvent2Service.update(vo, updateWrapper);
|
|
|
+ }
|
|
|
+ for (ProEconWindturbineStatus vo : updateProEconWindturbineStatusls) {
|
|
|
+ UpdateWrapper<ProEconWindturbineStatus> updateWrapper = new UpdateWrapper<>();
|
|
|
+// updateWrapper.set("start_time", vo.getStartTime());
|
|
|
+// updateWrapper.set("loss_power", vo.getLossPower());
|
|
|
+// updateWrapper.set("stop_hours", vo.getStopHours());
|
|
|
+ proEconWindturbineStatusService.update(vo, updateWrapper);
|
|
|
+ }
|
|
|
|
|
|
+ for (ProEconInterruption vo : updateProEconInterruptionls) {
|
|
|
+ UpdateWrapper<ProEconInterruption> updateWrapper = new UpdateWrapper<>();
|
|
|
+// updateWrapper.set("start_time", vo.getStartTime());
|
|
|
+// updateWrapper.set("stop_hours", vo.getStopHours());
|
|
|
+ proEconInterruptionService.update(vo, updateWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconWindturbineStatus> temp1ls = new ArrayList<>();
|
|
|
+ for (ProEconWindturbineStatus vo : insertProEconWindturbineStatusls) {
|
|
|
+ temp1ls.add(vo);
|
|
|
+ if (temp1ls.size() == 100) {
|
|
|
+ proEconWindturbineStatusService.saveBatch(temp1ls);
|
|
|
+ temp1ls = new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!temp1ls.isEmpty()) {
|
|
|
+ proEconWindturbineStatusService.saveBatch(temp1ls);
|
|
|
+ }
|
|
|
+ List<ProEconInterruption> temp2ls = new ArrayList<>();
|
|
|
+ for (ProEconInterruption vo : insertProEconInterruptionls) {
|
|
|
+ temp2ls.add(vo);
|
|
|
+ if (temp2ls.size() == 100) {
|
|
|
+ proEconInterruptionService.saveBatch(temp2ls);
|
|
|
+ temp2ls = new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!temp2ls.isEmpty()) {
|
|
|
+ proEconInterruptionService.saveBatch(temp2ls);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProEconShutdownEvent> temp3ls = new ArrayList<>();
|
|
|
+ for (ProEconShutdownEvent vo : insertProEconShutdownEventls) {
|
|
|
+ temp3ls.add(vo);
|
|
|
+ if (temp3ls.size() == 100) {
|
|
|
+ proEconShutdownEventService.saveBatch(temp3ls);
|
|
|
+ temp3ls = new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if (!temp3ls.isEmpty()) {
|
|
|
+ proEconShutdownEventService.saveBatch(temp3ls);
|
|
|
+ }
|
|
|
+ List<ProEconShutdownEvent2> temp4ls = new ArrayList<>();
|
|
|
+ for (ProEconShutdownEvent2 vo : insertProEconShutdownEvent2ls) {
|
|
|
+ temp4ls.add(vo);
|
|
|
+ if (temp4ls.size() == 100) {
|
|
|
+ proEconShutdownEvent2Service.saveBatch(temp4ls);
|
|
|
+ temp4ls = new ArrayList<>();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ if (!temp4ls.isEmpty()) {
|
|
|
+ proEconShutdownEvent2Service.saveBatch(temp4ls);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
//******************************************************************************************************/
|
|
|
|
|
|
|
|
|
- }
|
|
|
+}
|
|
|
|
|
|
- private ProEconShutdownEvent finishShutdownEvent(String windturbineId, ProEconShutdownEvent shutdwonEvent, Integer currentStatus, Date currentTime) throws Exception {
|
|
|
-// if(currentStatus != 4 && currentStatus != 6)
|
|
|
-// {
|
|
|
- shutdwonEvent.setStartTime(currentTime);
|
|
|
+ private void finishShutdownEvent(List<ProEconShutdownEvent> updateProEconShutdownEventls,
|
|
|
+ String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent item) throws Exception {
|
|
|
|
|
|
- double timehour=DateUtils.hoursDiff2(shutdwonEvent.getStartTime(), shutdwonEvent.getStopTime());
|
|
|
- shutdwonEvent.setStopHours(timehour);
|
|
|
- double losspower=calLossPower(windturbineId, shutdwonEvent.getStartTime(), shutdwonEvent.getStopTime());
|
|
|
- shutdwonEvent.setLossPower(losspower);
|
|
|
+ if (item.getStatusCode() != wtStatusMap.get(wtId).getPointValueInDouble()) {
|
|
|
+ item.setStartTime(currentTime);
|
|
|
|
|
|
+ double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
+ item.setStopHours(timehour);
|
|
|
+ double losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
|
|
|
+ item.setLossPower(losspower);
|
|
|
+
|
|
|
+
|
|
|
+ updateProEconShutdownEventls.add(item);
|
|
|
+ }
|
|
|
|
|
|
- proEconShutdownEventService.saveOrUpdate(shutdwonEvent);
|
|
|
- oldShutdownEvent.put(windturbineId,null);
|
|
|
- shutdwonEvent =null;
|
|
|
-// }
|
|
|
- return shutdwonEvent;
|
|
|
}
|
|
|
|
|
|
- private ProEconInterruption finishInterruption(String windturbineId, ProEconInterruption interrup, Integer currentStatus, Date currentTime) {
|
|
|
-// if(currentStatus != 12)
|
|
|
-// {
|
|
|
- interrup.setStartTime(currentTime);
|
|
|
- double timehour=DateUtils.hoursDiff2(interrup.getStartTime(), interrup.getStopTime());
|
|
|
- interrup.setStopHours(timehour);
|
|
|
|
|
|
+ private void finishShutdownEvent2(List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls,
|
|
|
+ String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) throws Exception {
|
|
|
|
|
|
- proEconInterruptionService.saveOrUpdate(interrup);
|
|
|
- oldInterrup.put(windturbineId,null);
|
|
|
- interrup =null;
|
|
|
-// }
|
|
|
- return interrup;
|
|
|
- }
|
|
|
+ if (item.getStatusCode() != wtStatusMap.get(wtId).getPointValueInDouble()) {
|
|
|
+ item.setStartTime(currentTime);
|
|
|
|
|
|
- private ProEconShutdownEvent2 finishShutdownEvent2(String windturbineId, ProEconShutdownEvent2 shutdwonEvent2, Integer currentStatus, Date currentTime) throws Exception {
|
|
|
-// if(currentStatus != 4 && currentStatus != 6)
|
|
|
-// {
|
|
|
- shutdwonEvent2.setStartTime(currentTime);
|
|
|
-
|
|
|
- double timehour=DateUtils.hoursDiff2(shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
|
|
|
- shutdwonEvent2.setStopHours(timehour);
|
|
|
- double losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
|
|
|
- shutdwonEvent2.setLossPower(losspower);
|
|
|
-
|
|
|
- if(timehour<=24)
|
|
|
- {
|
|
|
- proEconShutdownEvent2Service.saveOrUpdate(shutdwonEvent2);
|
|
|
- }else
|
|
|
- {
|
|
|
- int days=DateUtils.daysDiff1(shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
|
|
|
- Calendar c=Calendar.getInstance();
|
|
|
- Date startTime=shutdwonEvent2.getStartTime();
|
|
|
- c.setTime(shutdwonEvent2.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)
|
|
|
- {
|
|
|
- shutdwonEvent2.setStartTime(c.getTime());
|
|
|
- losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
|
|
|
+ double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
+ item.setStopHours(timehour);
|
|
|
+ double losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
|
|
|
+ item.setLossPower(losspower);
|
|
|
|
|
|
- }
|
|
|
- else {
|
|
|
- shutdwonEvent2.setStopTime(DateUtils.truncate(c.getTime()));
|
|
|
- if(i==days-1)
|
|
|
- {
|
|
|
- shutdwonEvent2.setStartTime(startTime);
|
|
|
+ if (timehour <= 24) {
|
|
|
+
|
|
|
+ insertProEconShutdownEvent2ls.add(item);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ int days = DateUtils.daysDiff1(item.getStartTime(), item.getStopTime());
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
+ Date startTime = item.getStartTime();
|
|
|
+ c.setTime(item.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) {
|
|
|
+ item.setStartTime(c.getTime());
|
|
|
+ losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
|
|
|
+ item.setLossPower(losspower);
|
|
|
+ insertProEconShutdownEvent2ls.add(item);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ ProEconShutdownEvent2 newto = initalShutdownEventnew2(wtId, wtStatusMap, DateUtils.truncate(c.getTime()));
|
|
|
|
|
|
- }else
|
|
|
- {
|
|
|
- shutdwonEvent2.setStartTime(c.getTime());
|
|
|
+ if (i == days - 1) {
|
|
|
+ newto.setStartTime(startTime);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ newto.setStartTime(c.getTime());
|
|
|
|
|
|
}
|
|
|
- losspower=calLossPower(windturbineId, shutdwonEvent2.getStartTime(), shutdwonEvent2.getStopTime());
|
|
|
+ losspower = calLossPower(wtId, newto.getStartTime(), newto.getStopTime());
|
|
|
+ newto.setLossPower(losspower);
|
|
|
+ insertProEconShutdownEvent2ls.add(newto);
|
|
|
+
|
|
|
}
|
|
|
- shutdwonEvent2.setLossPower(losspower);
|
|
|
- proEconShutdownEvent2Service.saveOrUpdate(shutdwonEvent2);
|
|
|
- c.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+
|
|
|
+ c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- shutdwonEvent2 =null;
|
|
|
- oldShutdownEvent2.put(windturbineId,null);
|
|
|
-// }
|
|
|
- return shutdwonEvent2;
|
|
|
}
|
|
|
|
|
|
- private void finishWindturbineStatus(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date currentTime) throws Exception {
|
|
|
- if(!Objects.equals(item.getSatusCode(), currentStatus))
|
|
|
- {
|
|
|
- item.setStartTime(currentTime);
|
|
|
- double timehour=DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
- item.setStopHours(timehour);
|
|
|
- double losspower=calLossPower(windturbineId, item.getStartTime(), item.getStopTime());
|
|
|
- item.setLossPower(losspower);
|
|
|
|
|
|
- proEconWindturbineStatusService.saveOrUpdate(item);
|
|
|
+
|
|
|
+ private void initalShutdownEvent2(List<ProEconShutdownEvent2> insertProEconShutdownEvent2ls,
|
|
|
+ String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent2 item) {
|
|
|
+ item.setId(StringUtils.getUUID());
|
|
|
+ item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
|
|
|
+ item.setStatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
|
|
|
+ item.setStopTime(currentTime);
|
|
|
+ item.setWinpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
|
|
|
+ item.setWindturbineId(wtId);
|
|
|
+ if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
|
|
|
+
|
|
|
+ item.setStopTypeId("gzbmq");
|
|
|
+
|
|
|
+ //读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
+
|
|
|
+ // String stopTypeId =newMethod( windturbineId, begin, end);
|
|
|
+ String stopTypeId = null;
|
|
|
+ if (StringUtils.notEmp(stopTypeId)) {
|
|
|
+ item.setStopTypeId(stopTypeId);
|
|
|
+
|
|
|
+ }
|
|
|
+ } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
|
|
|
+ item.setStopTypeId("wh");
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- private static void initalInterruption(String windturbineId, ProEconWindturbineStatus item, Date stopTime, ProEconInterruption interrup) {
|
|
|
- interrup.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
|
|
|
- interrup.setStopTime(stopTime);
|
|
|
- interrup.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
|
|
|
- interrup.setWindturbineId(windturbineId);
|
|
|
+ insertProEconShutdownEvent2ls.add(item);
|
|
|
}
|
|
|
|
|
|
- private static void initalShutdownEvent2(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime, ProEconShutdownEvent2 shutdwonEvent2) {
|
|
|
- shutdwonEvent2.setId(StringUtils.getUUID());
|
|
|
- shutdwonEvent2.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
|
|
|
- shutdwonEvent2.setStatusCode(currentStatus);
|
|
|
- shutdwonEvent2.setStopTime(stopTime);
|
|
|
- shutdwonEvent2.setWinpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
|
|
|
- shutdwonEvent2.setWindturbineId(windturbineId);
|
|
|
- if (currentStatus == 4)
|
|
|
- {
|
|
|
-
|
|
|
- shutdwonEvent2.setStopTypeId("gzbmq");
|
|
|
+ private ProEconShutdownEvent2 initalShutdownEventnew2(String wtId, Map<String, PointData> wtStatusMap, Date currentTime) {
|
|
|
+ ProEconShutdownEvent2 item = new ProEconShutdownEvent2();
|
|
|
+ item.setId(StringUtils.getUUID());
|
|
|
+ item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
|
|
|
+ item.setStatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
|
|
|
+ item.setStopTime(currentTime);
|
|
|
+ item.setWinpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
|
|
|
+ item.setWindturbineId(wtId);
|
|
|
+ if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
|
|
|
+
|
|
|
+ item.setStopTypeId("gzbmq");
|
|
|
+
|
|
|
//读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
|
|
|
// String stopTypeId =newMethod( windturbineId, begin, end);
|
|
|
- String stopTypeId=null;
|
|
|
- if (StringUtils.notEmp(stopTypeId))
|
|
|
- {
|
|
|
- shutdwonEvent2.setStopTypeId(stopTypeId);
|
|
|
+ String stopTypeId = null;
|
|
|
+ if (StringUtils.notEmp(stopTypeId)) {
|
|
|
+ item.setStopTypeId(stopTypeId);
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- shutdwonEvent2.setStopTypeId("wh");
|
|
|
+ } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
|
|
|
+ item.setStopTypeId("wh");
|
|
|
|
|
|
}
|
|
|
+ return item;
|
|
|
}
|
|
|
|
|
|
- private static void initalShutdownEvent(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime, ProEconShutdownEvent shutdwonEvent) {
|
|
|
-
|
|
|
- shutdwonEvent.setId(StringUtils.getUUID());
|
|
|
- shutdwonEvent.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
|
|
|
- shutdwonEvent.setStatusCode(currentStatus);
|
|
|
- shutdwonEvent.setStopTime(stopTime);
|
|
|
- shutdwonEvent.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
|
|
|
- shutdwonEvent.setWindturbineId(windturbineId);
|
|
|
- if (currentStatus == 4)
|
|
|
- {
|
|
|
+ private static void initalShutdownEvent(List<ProEconShutdownEvent> insertProEconShutdownEventls,
|
|
|
+ String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconShutdownEvent item) {
|
|
|
+ item.setId(StringUtils.getUUID());
|
|
|
+ item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
|
|
|
+ item.setStatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
|
|
|
+ item.setStopTime(currentTime);
|
|
|
+ item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
|
|
|
+ item.setWindturbineId(wtId);
|
|
|
+ if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.GZ.getCode()) {
|
|
|
|
|
|
- shutdwonEvent.setStoptypeId("gzbmq");
|
|
|
+ item.setStoptypeId("gzbmq");
|
|
|
|
|
|
//读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
|
|
|
// String stopTypeId =newMethod( windturbineId, begin, end);
|
|
|
- String stopTypeId=null;
|
|
|
- if (StringUtils.notEmp(stopTypeId))
|
|
|
- {
|
|
|
- shutdwonEvent.setStoptypeId(stopTypeId);
|
|
|
+ String stopTypeId = null;
|
|
|
+ if (StringUtils.notEmp(stopTypeId)) {
|
|
|
+ item.setStoptypeId(stopTypeId);
|
|
|
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- shutdwonEvent.setStoptypeId("wh");
|
|
|
+ } else if (wtStatusMap.get(wtId).getPointValueInDouble() == StatusDetailValue.JX.getCode()) {
|
|
|
+ item.setStoptypeId("wh");
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ insertProEconShutdownEventls.add(item);
|
|
|
}
|
|
|
|
|
|
- private void initalWindturbineStatus(String windturbineId, ProEconWindturbineStatus item, Integer currentStatus, Date stopTime,PointData stpo) {
|
|
|
- item.setProjectId(CacheContext.wtmap.get(windturbineId).getProjectId());
|
|
|
- item.setSatusCode(currentStatus);
|
|
|
- item.setStatusDesc(statusDescriptionMap.get((int)stpo.getPointValueInDouble()));
|
|
|
- item.setStopTime(stopTime);
|
|
|
- item.setWindpowerstationId(CacheContext.wtmap.get(windturbineId).getWindpowerstationId());
|
|
|
- item.setWindturbineId(windturbineId);
|
|
|
+ private void initalWindturbineStatus(List<ProEconWindturbineStatus> insertProEconWindturbineStatusls,
|
|
|
+ String wtId, Map<String, PointData> wtStatusMap, Date currentTime, ProEconWindturbineStatus item) {
|
|
|
+
|
|
|
+ item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
|
|
|
+ item.setSatusCode((int)wtStatusMap.get(wtId).getPointValueInDouble());
|
|
|
+ item.setStatusDesc(StatusDetailValue.getNmaeByCode(wtStatusMap.get(wtId).getPointValueInDouble()));
|
|
|
+ item.setStopTime(currentTime);
|
|
|
+ item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
|
|
|
+ item.setWindturbineId(wtId);
|
|
|
+ insertProEconWindturbineStatusls.add(item);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void finishWindturbineStatus(List<ProEconWindturbineStatus> updateProEconWindturbineStatusls,
|
|
|
+ String wtId, Date currentTime, ProEconWindturbineStatus item) throws Exception {
|
|
|
+ item.setStartTime(currentTime);
|
|
|
+ double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
+ item.setStopHours(timehour);
|
|
|
+ double losspower = calLossPower(wtId, item.getStartTime(), item.getStopTime());
|
|
|
+ item.setLossPower(losspower);
|
|
|
+ updateProEconWindturbineStatusls.add(item);
|
|
|
}
|
|
|
|
|
|
+ private void initalInterruption(List<ProEconInterruption> insertProEconWindturbineStatusls,
|
|
|
+ String wtId, Date currentTime, ProEconInterruption item) {
|
|
|
+ item.setProjectId(CacheContext.wtmap.get(wtId).getProjectId());
|
|
|
+ item.setStopTime(currentTime);
|
|
|
+ item.setWindpowerstationId(CacheContext.wtmap.get(wtId).getWindpowerstationId());
|
|
|
+ item.setWindturbineId(wtId);
|
|
|
+ insertProEconWindturbineStatusls.add(item);
|
|
|
+ }
|
|
|
|
|
|
- private String newMethod( String windturbineId, Date begin, Date end)
|
|
|
- {
|
|
|
+ private void finishInterruption(List<ProEconInterruption> updateProEconWindturbineStatusls,
|
|
|
+ String wtId, Date currentTime, ProEconInterruption item) {
|
|
|
+
|
|
|
+ item.setStartTime(currentTime);
|
|
|
+ double timehour = DateUtils.hoursDiff2(item.getStartTime(), item.getStopTime());
|
|
|
+ item.setStopHours(timehour);
|
|
|
+
|
|
|
+ updateProEconWindturbineStatusls.add(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String newMethod(String windturbineId, Date begin, Date end) {
|
|
|
String result = "";
|
|
|
|
|
|
return result;
|
|
@@ -378,88 +547,79 @@ public class ShutdownnewService {
|
|
|
double result = 0.0;
|
|
|
|
|
|
Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
|
|
|
- Map<String, ProBasicEquipmentPoint> wtpointmap=wtpAimap.get(windturbineId);
|
|
|
+ Map<String, ProBasicEquipmentPoint> wtpointmap = wtpAimap.get(windturbineId);
|
|
|
|
|
|
- Calendar c1=Calendar.getInstance();
|
|
|
+ Calendar c1 = Calendar.getInstance();
|
|
|
c1.setTime(startDate);
|
|
|
- Calendar c2=Calendar.getInstance();
|
|
|
+ Calendar c2 = Calendar.getInstance();
|
|
|
c2.setTime(endDate);
|
|
|
//判定限电是否跨年
|
|
|
- if(endDate.after(startDate) && c1.get(Calendar.YEAR)==c2.get(Calendar.YEAR))
|
|
|
- {
|
|
|
+ if (endDate.after(startDate) && c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)) {
|
|
|
//年故障损失电量
|
|
|
- if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
|
|
|
- {
|
|
|
+ if (wtpointmap.containsKey(ContantXk.NGZSSDL)) {
|
|
|
double beginvalue;
|
|
|
double endvalue;
|
|
|
|
|
|
- List<String> pointid=new ArrayList<>();
|
|
|
+ List<String> pointid = new ArrayList<>();
|
|
|
pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
|
|
|
- List<PointData> xdend=edosUtil.getHistMatrix(pointid,endDate.getTime()/1000);
|
|
|
+ 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 (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
+ beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
+ endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
|
|
|
if (endvalue > beginvalue) {
|
|
|
- result =result+(endvalue - beginvalue);
|
|
|
+ result = result + (endvalue - beginvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- }else
|
|
|
- {
|
|
|
- Calendar c=Calendar.getInstance();
|
|
|
+ } else {
|
|
|
+ Calendar c = Calendar.getInstance();
|
|
|
c.setTime(DateUtils.truncate(startDate));
|
|
|
- c.add(Calendar.DAY_OF_MONTH,1);
|
|
|
+ c.add(Calendar.DAY_OF_MONTH, 1);
|
|
|
//获得1月1日零点值
|
|
|
- Date endtime=c.getTime();
|
|
|
+ Date endtime = c.getTime();
|
|
|
//年故障损失电量
|
|
|
- if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
|
|
|
- {
|
|
|
+ if (wtpointmap.containsKey(ContantXk.NGZSSDL)) {
|
|
|
double beginvalue;
|
|
|
double endvalue;
|
|
|
|
|
|
|
|
|
-
|
|
|
- List<String> pointid=new ArrayList<>();
|
|
|
+ List<String> pointid = new ArrayList<>();
|
|
|
pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
|
|
|
- List<PointData> xdbegin=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
|
|
|
- List<PointData> xdend=edosUtil.getHistMatrix(pointid,endtime.getTime()/1000);
|
|
|
+ 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 (xdbegin.size() == 1 && xdend.size() == 1) {
|
|
|
+ beginvalue = xdbegin.get(0).getPointValueInDouble();
|
|
|
+ endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
|
|
|
if (endvalue > beginvalue) {
|
|
|
- result =result+(endvalue - beginvalue);
|
|
|
+ result = result + (endvalue - beginvalue);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//日故障损失电量
|
|
|
- if(wtpointmap.containsKey(ContantXk.NGZSSDL) )
|
|
|
- {
|
|
|
+ if (wtpointmap.containsKey(ContantXk.NGZSSDL)) {
|
|
|
|
|
|
double endvalue;
|
|
|
|
|
|
- List<String> pointid=new ArrayList<>();
|
|
|
+ List<String> pointid = new ArrayList<>();
|
|
|
pointid.add(wtpointmap.get(ContantXk.NGZSSDL).getNemCode());
|
|
|
- List<PointData> xdend=edosUtil.getHistMatrix(pointid,startDate.getTime()/1000);
|
|
|
+ List<PointData> xdend = edosUtil.getHistMatrix(pointid, startDate.getTime() / 1000);
|
|
|
|
|
|
- if(xdend.size()==1)
|
|
|
- {
|
|
|
+ if (xdend.size() == 1) {
|
|
|
|
|
|
- endvalue=xdend.get(0).getPointValueInDouble();
|
|
|
+ endvalue = xdend.get(0).getPointValueInDouble();
|
|
|
|
|
|
if (endvalue > 0) {
|
|
|
- result =result+endvalue;
|
|
|
+ result = result + endvalue;
|
|
|
}
|
|
|
}
|
|
|
}
|