|
@@ -1,13 +1,15 @@
|
|
|
package com.gyee.generation.service;//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.ProBasicEquipment;
|
|
|
+import com.gyee.generation.model.auto.ProBasicEquipmentPoint;
|
|
|
import com.gyee.generation.model.auto.ProEconEquipmentInfoDay5;
|
|
|
import com.gyee.generation.model.auto.ProEconShutdownEvent2;
|
|
|
import com.gyee.generation.service.auto.IProEconEquipmentInfoDay5Service;
|
|
|
import com.gyee.generation.service.auto.IProEconShutdownEvent2Service;
|
|
|
-import com.gyee.generation.task.thread.EquipmentInfo5Thread;
|
|
|
import com.gyee.generation.util.DateUtils;
|
|
|
import com.gyee.generation.util.realtimesource.IEdosUtil;
|
|
|
import com.gyee.generation.util.statisticcs.Initial;
|
|
@@ -15,8 +17,6 @@ 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
|
|
@@ -33,8 +33,6 @@ public class EquipmentInfo5Service {
|
|
|
private IProEconEquipmentInfoDay5Service proEconEquipmentInfoDay5Service;
|
|
|
|
|
|
|
|
|
- @Resource
|
|
|
- private Executor executor;
|
|
|
public void calEquipmentInfoDay(Date currentDate) throws Exception {
|
|
|
resetRate(DateUtils.truncate(currentDate));
|
|
|
|
|
@@ -58,6 +56,11 @@ public class EquipmentInfo5Service {
|
|
|
Map<String, ProEconEquipmentInfoDay5> rates = new HashMap<>();
|
|
|
|
|
|
for (ProBasicEquipment wt : CacheContext.wtls) {
|
|
|
+
|
|
|
+ if(wt.getWindpowerstationId().contains("GDC"))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
ProEconEquipmentInfoDay5 rate = new ProEconEquipmentInfoDay5();
|
|
|
rate.setRecordDate(currentDate);
|
|
|
rate.setWindpowerstationId(wt.getWindpowerstationId());
|
|
@@ -146,8 +149,9 @@ public class EquipmentInfo5Service {
|
|
|
|
|
|
}
|
|
|
|
|
|
- stateRate(currentDate,rates);
|
|
|
}
|
|
|
+
|
|
|
+ stateRate(currentDate,rates);
|
|
|
List<ProEconEquipmentInfoDay5> dayls=new ArrayList<>();
|
|
|
QueryWrapper<ProEconEquipmentInfoDay5> queryWrapper2 = new QueryWrapper<>();
|
|
|
queryWrapper2.ge("record_date",currentDate);
|
|
@@ -180,14 +184,14 @@ public class EquipmentInfo5Service {
|
|
|
templs.add(vo);
|
|
|
if(templs.size()==100)
|
|
|
{
|
|
|
- proEconEquipmentInfoDay5Service.saveOrUpdateBatch(templs);
|
|
|
+ proEconEquipmentInfoDay5Service.saveBatch(templs);
|
|
|
templs=new ArrayList<>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(!templs.isEmpty())
|
|
|
{
|
|
|
- proEconEquipmentInfoDay5Service.saveOrUpdateBatch(templs);
|
|
|
+ proEconEquipmentInfoDay5Service.saveBatch(templs);
|
|
|
}
|
|
|
|
|
|
// proEconEquipmentInfoDay5Service.saveBatch(dayls);
|
|
@@ -210,6 +214,7 @@ public class EquipmentInfo5Service {
|
|
|
dayInfo.setTimerate6(day.getTimerate6());
|
|
|
dayInfo.setTimerate7(day.getTimerate7());
|
|
|
dayInfo.setTimerate8(day.getTimerate8());
|
|
|
+ dayInfo.setTimerate9(day.getTimerate9());
|
|
|
dayInfo.setTimerate10(day.getTimerate10());
|
|
|
dayInfo.setTimerate11(day.getTimerate11());
|
|
|
dayInfo.setTimerate12(day.getTimerate12());
|
|
@@ -252,16 +257,241 @@ public class EquipmentInfo5Service {
|
|
|
Date beginDate = DateUtils.truncate(currentDate);
|
|
|
Date endDate = DateUtils.addDays(currentDate, 1);
|
|
|
|
|
|
-
|
|
|
- final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
|
|
|
+//
|
|
|
+// final CountDownLatch latch = new CountDownLatch(+CacheContext.wtls.size());
|
|
|
for (ProBasicEquipment wt : CacheContext.wtls) {
|
|
|
|
|
|
- new Thread(new EquipmentInfo5Thread(executor, wt,rates,
|
|
|
- endDate, beginDate,
|
|
|
- edosUtil, stateDescription1,
|
|
|
- stateDescription2,latch)).start();
|
|
|
+ if(wt.getWindpowerstationId().contains("GDC"))
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ProEconEquipmentInfoDay5 rate = rates.get(wt.getId());
|
|
|
+
|
|
|
+ List<PointData> speedDataList = null;
|
|
|
+ List<PointData> statusDataList = null;
|
|
|
+ if (CacheContext.wtpAimap.containsKey(wt.getId())) {
|
|
|
+ Map<String, ProBasicEquipmentPoint> wtpmap = CacheContext.wtpAimap.get(wt.getId());
|
|
|
+ if (wtpmap.containsKey(ContantXk.CJ_SSFS)) {
|
|
|
+ ProBasicEquipmentPoint point = wtpmap.get(ContantXk.CJ_SSFS);
|
|
|
+ speedDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
|
|
|
+ }
|
|
|
+ if (wtpmap.containsKey(ContantXk.MXZT)) {
|
|
|
+ ProBasicEquipmentPoint point = wtpmap.get(ContantXk.MXZT);
|
|
|
+ statusDataList = edosUtil.getHistoryDatasSnap(point.getNemCode(), beginDate.getTime() / 1000, endDate.getTime() / 1000);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (speedDataList != null && statusDataList != null && statusDataList.size() == speedDataList.size() && !speedDataList.isEmpty()) {
|
|
|
+
|
|
|
+ double laststatus = -1;
|
|
|
+ Date begin = new Date();
|
|
|
+ for (int i = 0; i < speedDataList.size(); i++) {
|
|
|
+
|
|
|
+ double status = statusDataList.get(i).getPointValueInDouble();
|
|
|
+ double speed = speedDataList.get(i).getPointValueInDouble();
|
|
|
+ if (i == 0) {
|
|
|
+ begin = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ laststatus = status;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (speed <= 3.0) {
|
|
|
+ if (laststatus != status &&
|
|
|
+ (status == stateDescription1.get(3.0) || status == stateDescription2.get(3.0))) {
|
|
|
+
|
|
|
+ Date end = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ double zhcs = DateUtils.hoursDiff2(begin, end);
|
|
|
+ if (zhcs < 0.25)//5分钟
|
|
|
+ {
|
|
|
+
|
|
|
+ double temp = rate.getTimerate1();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate1(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate2();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate2(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate3();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate3(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate4();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate4(temp);
|
|
|
+
|
|
|
+ } else if (zhcs < 0.33)//10分钟
|
|
|
+ {
|
|
|
+ double temp = rate.getTimerate2();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate2(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate3();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate3(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate4();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate4(temp);
|
|
|
+ } else if (zhcs < 0.42)//15分钟
|
|
|
+ {
|
|
|
+ double temp = rate.getTimerate3();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate3(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate4();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate4(temp);
|
|
|
+ } else if (zhcs < 0.5)//20分钟
|
|
|
+ {
|
|
|
+ double temp = rate.getTimerate4();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate4(temp);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ double temp = rate.getTimerate13();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate13(temp);
|
|
|
+ }
|
|
|
+
|
|
|
+ laststatus = status;
|
|
|
+ begin = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ } else if (speed <= 4.0 && speed > 3.0) {
|
|
|
+ if (laststatus != status &&
|
|
|
+ (status == stateDescription1.get(3.5) || status == stateDescription2.get(3.5))) {
|
|
|
+
|
|
|
+ Date end = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ double zhcs = DateUtils.hoursDiff2(begin, end);
|
|
|
+ if (zhcs < 0.25)//5分钟
|
|
|
+ {
|
|
|
+
|
|
|
+ double temp = rate.getTimerate5();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate5(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate6();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate6(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate7();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate7(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate8();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate8(temp);
|
|
|
+ } else if (zhcs < 0.33)//10分钟
|
|
|
+ {
|
|
|
+
|
|
|
+ double temp = rate.getTimerate6();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate6(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate7();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate7(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate8();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate8(temp);
|
|
|
+ } else if (zhcs < 0.42)//15分钟
|
|
|
+ {
|
|
|
+ double temp = rate.getTimerate7();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate7(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate8();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate8(temp);
|
|
|
+
|
|
|
+ } else if (zhcs < 0.5)//20分钟
|
|
|
+ {
|
|
|
+ double temp = rate.getTimerate8();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate8(temp);
|
|
|
+ }
|
|
|
+
|
|
|
+ //}
|
|
|
+ double temp = rate.getTimerate14();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate14(temp);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ laststatus = status;
|
|
|
+ begin = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ } else {
|
|
|
+ if (laststatus != status &&
|
|
|
+ (status == stateDescription1.get(4.0) || status == stateDescription2.get(4.0))) {
|
|
|
+
|
|
|
+ Date end = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ double zhcs = DateUtils.hoursDiff2(begin, end);
|
|
|
+ if (zhcs < 0.25)//5分钟
|
|
|
+ {
|
|
|
+
|
|
|
+ double temp = rate.getTimerate9();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate9(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate10();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate10(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate11();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate11(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate12();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate12(temp);
|
|
|
+ } else if (zhcs < 0.33)//10分钟
|
|
|
+ {
|
|
|
+
|
|
|
+ double temp = rate.getTimerate10();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate10(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate11();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate11(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate12();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate12(temp);
|
|
|
+ } else if (zhcs < 0.42)//15分钟
|
|
|
+ {
|
|
|
+
|
|
|
+ double temp = rate.getTimerate11();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate11(temp);
|
|
|
+
|
|
|
+ temp = rate.getTimerate12();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate12(temp);
|
|
|
+ } else if (zhcs < 0.5)//20分钟
|
|
|
+ {
|
|
|
+ double temp = rate.getTimerate12();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate12(temp);
|
|
|
+ }
|
|
|
+
|
|
|
+ double temp = rate.getTimerate15();
|
|
|
+ temp = temp + 1;
|
|
|
+ rate.setTimerate15(temp);
|
|
|
+
|
|
|
+
|
|
|
+ laststatus = status;
|
|
|
+ begin = new Date(speedDataList.get(i).getPointTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
- latch.await();
|
|
|
+ // latch.await();
|
|
|
|
|
|
|
|
|
}
|