|
@@ -94,12 +94,6 @@ public class ShutdownService {
|
|
|
|
|
|
public void init()
|
|
|
{
|
|
|
-// statusDescription.put(0, "待机");
|
|
|
-// statusDescription.put(1, "并网");
|
|
|
-// statusDescription.put(2, "停机");
|
|
|
-// statusDescription.put(3, "通讯中断");
|
|
|
-// statusDescription.put(4, "维护");
|
|
|
-// statusDescription.put(5, "限电");
|
|
|
|
|
|
statusDescription.put(0, "待机");
|
|
|
statusDescription.put(1, "手动停机");
|
|
@@ -196,30 +190,6 @@ public class ShutdownService {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// List<ProBasicModelPowerRd> pbmprls=proBasicModelPowerRdService.list().stream()
|
|
|
-//
|
|
|
-// .sorted(Comparator.comparing(ProBasicModelPowerRd::getSpeed)).collect(Collectors.toList());
|
|
|
-//
|
|
|
-//
|
|
|
-// if(!pbmprls.isEmpty())
|
|
|
-// {
|
|
|
-// for(ProBasicModelPowerRd pwpcf:pbmprls)
|
|
|
-// {
|
|
|
-//
|
|
|
-// if(modelPowerMap.containsKey(pwpcf.getId()))
|
|
|
-// {
|
|
|
-// Map<Double, ProBasicModelPowerRd> map =modelPowerMap.get(pwpcf.getId());
|
|
|
-// map.put(pwpcf.getSpeed(),pwpcf);
|
|
|
-// modelPowerMap.put(pwpcf.getId(),map);
|
|
|
-// }else
|
|
|
-// {
|
|
|
-// Map<Double, ProBasicModelPowerRd> map = new HashMap<Double, ProBasicModelPowerRd>();
|
|
|
-// map.put(pwpcf.getSpeed(),pwpcf);
|
|
|
-// modelPowerMap.put(pwpcf.getId(),map);
|
|
|
-// }
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -251,7 +221,7 @@ public class ShutdownService {
|
|
|
|
|
|
if (power > 1)
|
|
|
{
|
|
|
- status.put(key,value == 9 ? 1 : (int) value);
|
|
|
+ status.put(key,value == 9 ? 2 : (int) value);
|
|
|
|
|
|
}
|
|
|
else
|
|
@@ -263,8 +233,6 @@ public class ShutdownService {
|
|
|
oldStatusMap.put(key, null);
|
|
|
oldShutdownEvent.put(key, null);
|
|
|
oldInterrup.put(key, null);
|
|
|
-
|
|
|
- // 新增 shutdownevent2 实时
|
|
|
oldShutdownEvent2.put(key, null);
|
|
|
|
|
|
}
|
|
@@ -330,59 +298,131 @@ public class ShutdownService {
|
|
|
|
|
|
|
|
|
|
|
|
- for (String s : oldStatusMap.keySet())
|
|
|
+ for (String windturbineId : oldStatusMap.keySet())
|
|
|
{
|
|
|
- ProEconWindturbineStatus item = oldStatusMap.get(s);
|
|
|
+ ProEconWindturbineStatus item = oldStatusMap.get(windturbineId);
|
|
|
|
|
|
if (item == null)
|
|
|
{
|
|
|
|
|
|
- //logger.debug("{0}重复加入 风机编号{1}", date,s);
|
|
|
+ //logger.debug("{0}重复加入 风机编号{1}", date,windturbineId);
|
|
|
|
|
|
- ProEconShutdownEvent shutdwonEvent=new ProEconShutdownEvent();
|
|
|
- ProEconInterruption interrup=new ProEconInterruption();
|
|
|
+ ProEconShutdownEvent shutdwonEvent=null;
|
|
|
+ ProEconInterruption interrup=null;
|
|
|
|
|
|
//新增 shutdownevent2 实时
|
|
|
- ProEconShutdownEvent2 shutdwonEvent2=new ProEconShutdownEvent2();
|
|
|
+ ProEconShutdownEvent2 shutdwonEvent2=null;
|
|
|
|
|
|
|
|
|
- item = buildWindturbineStatus(s, date, shutdwonEvent, interrup, shutdwonEvent2);
|
|
|
|
|
|
+ ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
|
|
|
|
|
|
+ retValue.setProjectId(windTurbines.get(windturbineId).getProjectId());
|
|
|
+ retValue.setSatusCode(status.get(windturbineId));
|
|
|
+ retValue.setStatusDesc(statusDescription.get(status.get(windturbineId)));
|
|
|
+ retValue.setStopTime(date);
|
|
|
+ retValue.setWindpowerstationId(windTurbines.get(windturbineId).getWindpowerstationId());
|
|
|
+ retValue.setWindturbineId(windturbineId);
|
|
|
|
|
|
- proEconWindturbineStatusService.save(item);
|
|
|
+ Integer currentStatus = status.get(windturbineId);
|
|
|
+ if (currentStatus == 4 || currentStatus == 6)
|
|
|
+ {
|
|
|
+ shutdwonEvent=new ProEconShutdownEvent();
|
|
|
+ shutdwonEvent.setId(StringUtils.getUUID());
|
|
|
+ shutdwonEvent.setProjectId(retValue.getProjectId());
|
|
|
+ shutdwonEvent.setStatusCode(currentStatus);
|
|
|
+ shutdwonEvent.setStopTime(date);
|
|
|
+ shutdwonEvent.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
+ shutdwonEvent.setWindturbineId(windturbineId);
|
|
|
+
|
|
|
+
|
|
|
+ shutdwonEvent2=new ProEconShutdownEvent2();
|
|
|
+ shutdwonEvent2.setId(StringUtils.getUUID());
|
|
|
+ shutdwonEvent2.setProjectId(retValue.getProjectId());
|
|
|
+ shutdwonEvent2.setStatusCode(currentStatus);
|
|
|
+ shutdwonEvent2.setStopTime(date);
|
|
|
+ shutdwonEvent2.setWinpowerstationId(retValue.getWindpowerstationId());
|
|
|
+ shutdwonEvent2.setWindturbineId(windturbineId);
|
|
|
+
|
|
|
+ if (currentStatus == 4)
|
|
|
+ {
|
|
|
|
|
|
- proEconShutdownEventService.save(shutdwonEvent);
|
|
|
+ Date begin =DateUtils.addMinutes(date,-5);
|
|
|
+ Date end = DateUtils.addMinutes(date,5);
|
|
|
+ shutdwonEvent.setStoptypeId("gzbmq");
|
|
|
+ shutdwonEvent2.setStopTypeId("gzbmq");
|
|
|
+ //读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
+ String str =newMethod( windturbineId, begin, end);
|
|
|
+ if (StringUtils.notEmp(windturbineId))
|
|
|
+ {
|
|
|
|
|
|
- proEconInterruptionService.save(interrup);
|
|
|
+ shutdwonEvent.setStoptypeId(windturbineId);
|
|
|
+ shutdwonEvent2.setStopTypeId(windturbineId);
|
|
|
|
|
|
- // 新增 shutdownevent2 实时
|
|
|
- //20分钟以内的报警数据
|
|
|
- Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-15);
|
|
|
- Date dtend = shutdwonEvent2.getStopTime();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ shutdwonEvent.setStoptypeId("wh");
|
|
|
+ shutdwonEvent2.setStopTypeId("wh");
|
|
|
|
|
|
- Optional<ProEconShutdownEvent2> olditemo= proEconShutdownEvent2Service.list().stream()
|
|
|
- .filter(i -> i.getWindturbineId().equals(s)
|
|
|
- && (i.getStartTime().compareTo(dtbegin) == 0 || i.getStartTime().after(dtbegin))
|
|
|
- && (i.getStartTime().compareTo(dtend) == 0 || i.getStartTime().before(dtend))
|
|
|
+ }
|
|
|
+ retValue.setShutdownEventId(shutdwonEvent.getId());
|
|
|
+ }
|
|
|
+ if (currentStatus == 12)
|
|
|
+ {
|
|
|
+ interrup=new ProEconInterruption();
|
|
|
+ interrup.setProjectId(retValue.getProjectId());
|
|
|
+ interrup.setStopTime(date);
|
|
|
+ interrup.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
+ interrup.setWindturbineId(windturbineId);
|
|
|
+ }
|
|
|
|
|
|
- ).min(Comparator.comparing(ProEconShutdownEvent2::getStartTime));
|
|
|
+ proEconWindturbineStatusService.save(item);
|
|
|
|
|
|
- ProEconShutdownEvent2 lditem;
|
|
|
- if (!olditemo.isPresent())
|
|
|
+ if (shutdwonEvent != null)
|
|
|
{
|
|
|
- proEconShutdownEvent2Service.save(shutdwonEvent2);
|
|
|
-
|
|
|
+ proEconShutdownEventService.save(shutdwonEvent);
|
|
|
}
|
|
|
- else
|
|
|
+ if (shutdwonEvent != null)
|
|
|
{
|
|
|
- lditem=olditemo.get();
|
|
|
- lditem.setStartTime(null);
|
|
|
- if (!oldShutdownEvent2.containsKey(lditem.getWindturbineId()))
|
|
|
- oldShutdownEvent2.put(lditem.getWindturbineId(), lditem);
|
|
|
+ proEconInterruptionService.save(interrup);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (shutdwonEvent2 != null)
|
|
|
+ {
|
|
|
+// 新增 shutdownevent2 实时
|
|
|
+ //20分钟以内的报警数据
|
|
|
+ Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-15);
|
|
|
+ Date dtend = shutdwonEvent2.getStopTime();
|
|
|
+
|
|
|
+ Optional<ProEconShutdownEvent2> olditemo= proEconShutdownEvent2Service.list().stream()
|
|
|
+ .filter(i -> i.getWindturbineId().equals(windturbineId)
|
|
|
+ && (i.getStartTime().compareTo(dtbegin) == 0 || i.getStartTime().after(dtbegin))
|
|
|
+ && (i.getStartTime().compareTo(dtend) == 0 || i.getStartTime().before(dtend))
|
|
|
+
|
|
|
+ ).min(Comparator.comparing(ProEconShutdownEvent2::getStartTime));
|
|
|
+
|
|
|
+ ProEconShutdownEvent2 lditem;
|
|
|
+ if (!olditemo.isPresent())
|
|
|
+ {
|
|
|
+ proEconShutdownEvent2Service.save(shutdwonEvent2);
|
|
|
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ lditem=olditemo.get();
|
|
|
+ lditem.setStartTime(null);
|
|
|
+ if (!oldShutdownEvent2.containsKey(lditem.getWindturbineId()))
|
|
|
+ oldShutdownEvent2.put(lditem.getWindturbineId(), lditem);
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -391,47 +431,47 @@ public class ShutdownService {
|
|
|
c.setTime(date);
|
|
|
if (c.get(Calendar.HOUR_OF_DAY) == 0 &&c.get(Calendar.MINUTE) == 0)
|
|
|
{
|
|
|
- logger.debug("{0}--整点操作--{1}", s, date);
|
|
|
+ logger.debug("{0}--整点操作--{1}", windturbineId, date);
|
|
|
|
|
|
updateAndAddStatus( item);
|
|
|
}
|
|
|
- else if (!Objects.equals(item.getSatusCode(), status.get(s)))
|
|
|
+ else if (!Objects.equals(item.getSatusCode(), status.get(windturbineId)))
|
|
|
{
|
|
|
updateAndAddStatus(item);
|
|
|
|
|
|
// #region 切入切出风速
|
|
|
- if (item.getSatusCode() == 0 && status.get(s) == 2)
|
|
|
+ if (item.getSatusCode() == 0 && status.get(windturbineId) == 2)
|
|
|
{
|
|
|
ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
- input.setWindturbineId(s);
|
|
|
- input.setWindpowerstationId(windTurbines.get(s).getWindpowerstationId());
|
|
|
- input.setProjectId(windTurbines.get(s).getProjectId());
|
|
|
- input.setLineId(windTurbines.get(s).getLineId());
|
|
|
+ input.setWindturbineId(windturbineId);
|
|
|
+ input.setWindpowerstationId(windTurbines.get(windturbineId).getWindpowerstationId());
|
|
|
+ input.setProjectId(windTurbines.get(windturbineId).getProjectId());
|
|
|
+ input.setLineId(windTurbines.get(windturbineId).getLineId());
|
|
|
input.setRecordDate(date);
|
|
|
input.setInputOrOutput(1);
|
|
|
|
|
|
|
|
|
- if (speedpointMap.containsKey(s))
|
|
|
+ if (speedpointMap.containsKey(windturbineId))
|
|
|
{
|
|
|
- double value =edosUtil.getRealData(speedpointMap.get(s).getNemCode()).getPointValueInDouble();
|
|
|
+ double value =edosUtil.getRealData(speedpointMap.get(windturbineId).getNemCode()).getPointValueInDouble();
|
|
|
input.setSpeed(value);
|
|
|
}
|
|
|
|
|
|
proEconInputOrOutputSpeedService.save(input);
|
|
|
|
|
|
}
|
|
|
- else if (item.getSatusCode() == 1 && status.get(s)== 0)
|
|
|
+ else if (item.getSatusCode() == 2 && status.get(windturbineId)== 0)
|
|
|
{
|
|
|
ProEconInputOrOutputSpeed input = new ProEconInputOrOutputSpeed();
|
|
|
- input.setWindturbineId(s);
|
|
|
- input.setWindpowerstationId(windTurbines.get(s).getWindpowerstationId());
|
|
|
- input.setProjectId(windTurbines.get(s).getProjectId());
|
|
|
- input.setLineId(windTurbines.get(s).getLineId());
|
|
|
+ input.setWindturbineId(windturbineId);
|
|
|
+ input.setWindpowerstationId(windTurbines.get(windturbineId).getWindpowerstationId());
|
|
|
+ input.setProjectId(windTurbines.get(windturbineId).getProjectId());
|
|
|
+ input.setLineId(windTurbines.get(windturbineId).getLineId());
|
|
|
input.setRecordDate(date);
|
|
|
input.setInputOrOutput(0);
|
|
|
- if (speedpointMap.containsKey(s))
|
|
|
+ if (speedpointMap.containsKey(windturbineId))
|
|
|
{
|
|
|
- double value =edosUtil.getRealData(speedpointMap.get(s).getNemCode()).getPointValueInDouble();
|
|
|
+ double value =edosUtil.getRealData(speedpointMap.get(windturbineId).getNemCode()).getPointValueInDouble();
|
|
|
input.setSpeed(value);
|
|
|
}
|
|
|
|
|
@@ -481,22 +521,22 @@ public class ShutdownService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void updateAndAddStatus( ProEconWindturbineStatus status) throws Exception {
|
|
|
- status.setStartTime(date);
|
|
|
+ private void updateAndAddStatus( ProEconWindturbineStatus pewstatus) throws Exception {
|
|
|
+ pewstatus.setStartTime(date);
|
|
|
|
|
|
List<PointData> speedDataList1;
|
|
|
|
|
|
|
|
|
- if (windTurbines.get(status.getWindturbineId()).getWindpowerstationId().contains("GDC"))
|
|
|
+ if (windTurbines.get(pewstatus.getWindturbineId()).getWindpowerstationId().contains("GDC"))
|
|
|
{
|
|
|
- String point=gzdpointMap.get(windTurbines.get(status.getWindturbineId()).getWindpowerstationId()).getNemCode();
|
|
|
- speedDataList1 =edosUtil.getHistoryDatasSnap(point,status.getStopTime().getTime()/1000,status.getStartTime().getTime()/1000);
|
|
|
+ String point=gzdpointMap.get(windTurbines.get(pewstatus.getWindturbineId()).getWindpowerstationId()).getNemCode();
|
|
|
+ speedDataList1 =edosUtil.getHistoryDatasSnap(point,pewstatus.getStopTime().getTime()/1000,pewstatus.getStartTime().getTime()/1000);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- String point=speedpointMap.get(status.getWindturbineId()).getNemCode();
|
|
|
- speedDataList1 =edosUtil.getHistoryDatasSnap(point,status.getStopTime().getTime()/1000,status.getStartTime().getTime()/1000);
|
|
|
+ String point=speedpointMap.get(pewstatus.getWindturbineId()).getNemCode();
|
|
|
+ speedDataList1 =edosUtil.getHistoryDatasSnap(point,pewstatus.getStopTime().getTime()/1000,pewstatus.getStartTime().getTime()/1000);
|
|
|
|
|
|
|
|
|
}
|
|
@@ -504,84 +544,159 @@ public class ShutdownService {
|
|
|
|
|
|
if (speedDataList1 != null && speedDataList1.size() > 0)
|
|
|
{
|
|
|
- status.setSpeed(speedDataList1.get(0).getPointValueInDouble());
|
|
|
+ pewstatus.setSpeed(speedDataList1.get(0).getPointValueInDouble());
|
|
|
DoubleSummaryStatistics summaryStatistics=speedDataList1.stream().mapToDouble(PointData::getPointValueInDouble).summaryStatistics();
|
|
|
- status.setAvgSpeed(summaryStatistics.getAverage());
|
|
|
+ pewstatus.setAvgSpeed(summaryStatistics.getAverage());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- status.setSpeed(0.0);
|
|
|
- status.setAvgSpeed(0.0);
|
|
|
+ pewstatus.setSpeed(0.0);
|
|
|
+ pewstatus.setAvgSpeed(0.0);
|
|
|
}
|
|
|
|
|
|
- double timehour=DateUtils.hoursDiff2(date,status.getStopTime());
|
|
|
- status.setStopHours(timehour);
|
|
|
+ double timehour=DateUtils.hoursDiff2(date,pewstatus.getStopTime());
|
|
|
+ pewstatus.setStopHours(timehour);
|
|
|
|
|
|
- ProEconShutdownEvent shutdwonEvent = new ProEconShutdownEvent();
|
|
|
- ProEconInterruption interrup = new ProEconInterruption();
|
|
|
- // #region 新增 shutdownevent2 实时
|
|
|
- ProEconShutdownEvent2 shutdwonEvent2 = new ProEconShutdownEvent2();
|
|
|
+ ProEconShutdownEvent shutdwonEvent = null;
|
|
|
+ ProEconInterruption interrup = null;
|
|
|
+ // #region 新增 shutdownevent2 实时
|
|
|
+ ProEconShutdownEvent2 shutdwonEvent2 = null;
|
|
|
|
|
|
|
|
|
- ProEconWindturbineStatus newStatusItem = buildWindturbineStatus(status.getWindturbineId(), date, shutdwonEvent, interrup, shutdwonEvent2);
|
|
|
-
|
|
|
- proEconWindturbineStatusService.save(newStatusItem);
|
|
|
|
|
|
+ ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
|
|
|
|
|
|
- Integer oldStatus = status.getSatusCode();
|
|
|
- Integer currentStatus = this.status.get(status.getWindturbineId());
|
|
|
+ retValue.setProjectId(windTurbines.get(pewstatus.getWindturbineId()).getProjectId());
|
|
|
+ retValue.setSatusCode(status.get(pewstatus.getWindturbineId()));
|
|
|
+ retValue.setStatusDesc(statusDescription.get(status.get(pewstatus.getWindturbineId())));
|
|
|
+ retValue.setStopTime(date);
|
|
|
+ retValue.setWindpowerstationId(windTurbines.get(pewstatus.getWindturbineId()).getWindpowerstationId());
|
|
|
+ retValue.setWindturbineId(pewstatus.getWindturbineId());
|
|
|
|
|
|
+ Integer currentStatus = status.get(pewstatus.getWindturbineId());
|
|
|
if (currentStatus == 4 || currentStatus == 6)
|
|
|
{
|
|
|
- if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
|
|
|
+ shutdwonEvent=new ProEconShutdownEvent();
|
|
|
+ shutdwonEvent.setId(StringUtils.getUUID());
|
|
|
+ shutdwonEvent.setProjectId(retValue.getProjectId());
|
|
|
+ shutdwonEvent.setStatusCode(currentStatus);
|
|
|
+ shutdwonEvent.setStopTime(date);
|
|
|
+ shutdwonEvent.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
+ shutdwonEvent.setWindturbineId(pewstatus.getWindturbineId());
|
|
|
+
|
|
|
+
|
|
|
+ shutdwonEvent2=new ProEconShutdownEvent2();
|
|
|
+ shutdwonEvent2.setId(StringUtils.getUUID());
|
|
|
+ shutdwonEvent2.setProjectId(retValue.getProjectId());
|
|
|
+ shutdwonEvent2.setStatusCode(currentStatus);
|
|
|
+ shutdwonEvent2.setStopTime(date);
|
|
|
+ shutdwonEvent2.setWinpowerstationId(retValue.getWindpowerstationId());
|
|
|
+ shutdwonEvent2.setWindturbineId(pewstatus.getWindturbineId());
|
|
|
+
|
|
|
+ if (currentStatus == 4)
|
|
|
+ {
|
|
|
+
|
|
|
+ Date begin =DateUtils.addMinutes(date,-5);
|
|
|
+ Date end = DateUtils.addMinutes(date,5);
|
|
|
+ shutdwonEvent.setStoptypeId("gzbmq");
|
|
|
+ shutdwonEvent2.setStopTypeId("gzbmq");
|
|
|
+ //读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
+ String str =newMethod( pewstatus.getWindturbineId(), begin, end);
|
|
|
+ if (StringUtils.notEmp(pewstatus.getWindturbineId()))
|
|
|
+ {
|
|
|
+
|
|
|
+ shutdwonEvent.setStoptypeId(pewstatus.getWindturbineId());
|
|
|
+ shutdwonEvent2.setStopTypeId(pewstatus.getWindturbineId());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- proEconShutdownEventService.save(shutdwonEvent);
|
|
|
+ shutdwonEvent.setStoptypeId("wh");
|
|
|
+ shutdwonEvent2.setStopTypeId("wh");
|
|
|
|
|
|
}
|
|
|
+ retValue.setShutdownEventId(shutdwonEvent.getId());
|
|
|
}
|
|
|
- if (currentStatus == 12 && oldStatus != 12)
|
|
|
+ if (currentStatus == 12)
|
|
|
{
|
|
|
- proEconInterruptionService.save(interrup);
|
|
|
-
|
|
|
+ interrup=new ProEconInterruption();
|
|
|
+ interrup.setProjectId(retValue.getProjectId());
|
|
|
+ interrup.setStopTime(date);
|
|
|
+ interrup.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
+ interrup.setWindturbineId(pewstatus.getWindturbineId());
|
|
|
}
|
|
|
- // 新增 shutdownevent2 实时
|
|
|
- if (currentStatus == 4 || currentStatus == 6)
|
|
|
- {
|
|
|
- if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
|
|
|
- {
|
|
|
- Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-30);
|
|
|
- Date dtend = shutdwonEvent2.getStopTime();
|
|
|
- String windTurbineId = shutdwonEvent2.getWindturbineId();
|
|
|
|
|
|
- Optional<ProEconShutdownEvent2> olditem= proEconShutdownEvent2Service.list().stream()
|
|
|
- .filter(i -> i.getWindturbineId().equals(windTurbineId)
|
|
|
- && (i.getStartTime().compareTo(dtbegin) == 0 || i.getStartTime().after(dtbegin))
|
|
|
- && (i.getStartTime().compareTo(dtend) == 0 || i.getStartTime().before(dtend))
|
|
|
+
|
|
|
+ proEconWindturbineStatusService.save(retValue);
|
|
|
|
|
|
|
|
|
- ).min(Comparator.comparing(ProEconShutdownEvent2::getStartTime));
|
|
|
+ Integer oldStatus = pewstatus.getSatusCode();
|
|
|
+ Integer newStatus = status.get(pewstatus.getWindturbineId());
|
|
|
|
|
|
- ProEconShutdownEvent2 temp;
|
|
|
- if (!olditem.isPresent())
|
|
|
+ if (shutdwonEvent != null)
|
|
|
+ {
|
|
|
+ if (newStatus == 4 || newStatus == 6)
|
|
|
+ {
|
|
|
+ if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
|
|
|
{
|
|
|
- proEconShutdownEvent2Service.save(shutdwonEvent2);
|
|
|
+ proEconShutdownEventService.save(shutdwonEvent);
|
|
|
|
|
|
}
|
|
|
- else
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (interrup != null)
|
|
|
+ {
|
|
|
+ if (newStatus == 12 && oldStatus != 12)
|
|
|
+ {
|
|
|
+ proEconInterruptionService.save(interrup);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (shutdwonEvent2 != null)
|
|
|
+ {
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
+ if (newStatus == 4 || newStatus == 6)
|
|
|
+ {
|
|
|
+ if (oldStatus == 0 || oldStatus == 1 || oldStatus == 12)
|
|
|
{
|
|
|
- temp=olditem.get();
|
|
|
- temp.setStartTime(null);
|
|
|
- if (!oldShutdownEvent2.containsKey(temp.getWindturbineId()))
|
|
|
- oldShutdownEvent2.put(temp.getWindturbineId(), temp);
|
|
|
+ Date dtbegin = DateUtils.addMinutes(shutdwonEvent2.getStopTime(),-30);
|
|
|
+ Date dtend = shutdwonEvent2.getStopTime();
|
|
|
+ String windTurbineId = shutdwonEvent2.getWindturbineId();
|
|
|
+
|
|
|
+ Optional<ProEconShutdownEvent2> olditem= proEconShutdownEvent2Service.list().stream()
|
|
|
+ .filter(i -> i.getWindturbineId().equals(windTurbineId)
|
|
|
+ && (i.getStartTime().compareTo(dtbegin) == 0 || i.getStartTime().after(dtbegin))
|
|
|
+ && (i.getStartTime().compareTo(dtend) == 0 || i.getStartTime().before(dtend))
|
|
|
+
|
|
|
+
|
|
|
+ ).min(Comparator.comparing(ProEconShutdownEvent2::getStartTime));
|
|
|
+
|
|
|
+ ProEconShutdownEvent2 temp;
|
|
|
+ if (!olditem.isPresent())
|
|
|
+ {
|
|
|
+ proEconShutdownEvent2Service.save(shutdwonEvent2);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ temp=olditem.get();
|
|
|
+ temp.setStartTime(null);
|
|
|
+ if (!oldShutdownEvent2.containsKey(temp.getWindturbineId()))
|
|
|
+ oldShutdownEvent2.put(temp.getWindturbineId(), temp);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if (oldStatus == 4 || oldStatus == 6)
|
|
|
{
|
|
|
- if (currentStatus == 0 || currentStatus == 1 || currentStatus == 12)
|
|
|
+ if (newStatus == 0 || newStatus == 1 || newStatus == 12)
|
|
|
{
|
|
|
- ProEconShutdownEvent ose = oldShutdownEvent.get(status.getWindturbineId());
|
|
|
+ ProEconShutdownEvent ose = oldShutdownEvent.get(pewstatus.getWindturbineId());
|
|
|
if (ose != null)
|
|
|
{
|
|
|
ose.setStartTime(date);
|
|
@@ -591,10 +706,10 @@ public class ShutdownService {
|
|
|
|
|
|
if (!ose.getStoptypeId().equals("wh"))
|
|
|
{
|
|
|
- String s =newMethod( status.getWindturbineId(), DateUtils.addMinutes(ose.getStopTime(),-5), date);
|
|
|
- if (StringUtils.notEmp(s))
|
|
|
+ String windturbineId =newMethod( pewstatus.getWindturbineId(), DateUtils.addMinutes(ose.getStopTime(),-5), date);
|
|
|
+ if (StringUtils.notEmp(windturbineId))
|
|
|
{
|
|
|
- ose.setStoptypeId(s);
|
|
|
+ ose.setStoptypeId(windturbineId);
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -602,8 +717,8 @@ public class ShutdownService {
|
|
|
//Double gc = calcLossPower(ose.WINDTURBINEID, ose.STOPTIME.Value, ose.STARTTIME.Value, ose.STOPHOURS.Value, entities);
|
|
|
//ose.LOSSPOWER = gc;
|
|
|
}
|
|
|
- // 新增 shutdownevent2 实时
|
|
|
- ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(status.getWindturbineId());
|
|
|
+ // 新增 shutdownevent2 实时
|
|
|
+ ProEconShutdownEvent2 ose2 = oldShutdownEvent2.get(pewstatus.getWindturbineId());
|
|
|
if (ose2 != null )
|
|
|
{
|
|
|
|
|
@@ -621,9 +736,9 @@ public class ShutdownService {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if (oldStatus == 12 && currentStatus != 12)
|
|
|
+ if (oldStatus == 12 && newStatus != 12)
|
|
|
{
|
|
|
- ProEconInterruption item = oldInterrup.get(status.getWindturbineId());
|
|
|
+ ProEconInterruption item = oldInterrup.get(pewstatus.getWindturbineId());
|
|
|
if (item != null)
|
|
|
{
|
|
|
item.setStartTime(date);
|
|
@@ -744,74 +859,7 @@ public class ShutdownService {
|
|
|
|
|
|
|
|
|
|
|
|
- // 新增 shutdownevent2 实时
|
|
|
- private ProEconWindturbineStatus buildWindturbineStatus(String windturbineId, Date date, ProEconShutdownEvent shutdwonEvent,
|
|
|
- ProEconInterruption interrup, ProEconShutdownEvent2 shutdwonEvent2)
|
|
|
- {
|
|
|
-
|
|
|
- ProEconWindturbineStatus retValue = new ProEconWindturbineStatus();
|
|
|
-
|
|
|
- retValue.setProjectId(windTurbines.get(windturbineId).getProjectId());
|
|
|
- retValue.setSatusCode(status.get(windturbineId));
|
|
|
- retValue.setStatusDesc(statusDescription.get(status.get(windturbineId)));
|
|
|
- retValue.setStopTime(date);
|
|
|
- retValue.setWindpowerstationId(windTurbines.get(windturbineId).getWindpowerstationId());
|
|
|
- retValue.setWindturbineId(windturbineId);
|
|
|
-
|
|
|
- Integer currentStatus = status.get(windturbineId);
|
|
|
- if (currentStatus == 4 || currentStatus == 6)
|
|
|
- {
|
|
|
|
|
|
- shutdwonEvent.setId(StringUtils.getUUID());
|
|
|
- shutdwonEvent.setProjectId(retValue.getProjectId());
|
|
|
- shutdwonEvent.setStatusCode(currentStatus);
|
|
|
- shutdwonEvent.setStopTime(date);
|
|
|
- shutdwonEvent.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
- shutdwonEvent.setWindturbineId(windturbineId);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- shutdwonEvent2.setId(StringUtils.getUUID());
|
|
|
- shutdwonEvent2.setProjectId(retValue.getProjectId());
|
|
|
- shutdwonEvent2.setStatusCode(currentStatus);
|
|
|
- shutdwonEvent2.setStopTime(date);
|
|
|
- shutdwonEvent2.setWinpowerstationId(retValue.getWindpowerstationId());
|
|
|
- shutdwonEvent2.setWindturbineId(windturbineId);
|
|
|
-
|
|
|
- if (currentStatus == 4)
|
|
|
- {
|
|
|
- Date begin =DateUtils.addMinutes(date,-5);
|
|
|
- Date end = DateUtils.addMinutes(date,5);
|
|
|
- shutdwonEvent.setStoptypeId("gzbmq");
|
|
|
- shutdwonEvent2.setStopTypeId("gzbmq");
|
|
|
- //读取报警记录表前后五分钟数据,选取第一个报警报警类型
|
|
|
- String s =newMethod( windturbineId, begin, end);
|
|
|
- if (StringUtils.notEmp(s))
|
|
|
- {
|
|
|
-
|
|
|
- shutdwonEvent.setStoptypeId(s);
|
|
|
- shutdwonEvent2.setStopTypeId(s);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- shutdwonEvent.setStoptypeId("wh");
|
|
|
- shutdwonEvent2.setStopTypeId("wh");
|
|
|
-
|
|
|
- }
|
|
|
- retValue.setShutdownEventId(shutdwonEvent.getId());
|
|
|
- }
|
|
|
- if (currentStatus == 12)
|
|
|
- {
|
|
|
-
|
|
|
- interrup.setProjectId(retValue.getProjectId());
|
|
|
- interrup.setStopTime(date);
|
|
|
- interrup.setWindpowerstationId(retValue.getWindpowerstationId());
|
|
|
- interrup.setWindturbineId(windturbineId);
|
|
|
- }
|
|
|
- return retValue;
|
|
|
- }
|
|
|
|
|
|
//TODO-SL 需要添加报警记录关联停机事件方法
|
|
|
|