|
@@ -250,24 +250,29 @@ public class MTTRMTBFTaskService {
|
|
|
infodayQw.le("recorddate",monthLast);
|
|
|
List<Windpowerinfoday> indodayList = windpowerinfodayService.list(infodayQw);
|
|
|
|
|
|
- //取出所有故障的snapid
|
|
|
- QueryWrapper<Faultsnap> snapQw = new QueryWrapper<>();
|
|
|
- snapQw.eq("category1","FJ").eq("category2","GZ");
|
|
|
- List<Faultsnap> snapList = faultsnapService.list(snapQw);
|
|
|
- Map<BigDecimal,Faultsnap> snapMap = new HashMap<>();
|
|
|
- snapList.stream().forEach(i->{
|
|
|
- snapMap.put(i.getId(),i);
|
|
|
- });
|
|
|
-
|
|
|
- List<BigDecimal> snapids = faultsnapService.list(snapQw).stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
-
|
|
|
- //取出一月故障流水记录
|
|
|
- QueryWrapper<Faulthistory> historyQw = new QueryWrapper<>();
|
|
|
-// historyQw.like("faulttime",date);
|
|
|
-// Date addDay = DateUtils.addDays(date, 1);
|
|
|
- historyQw.ge("faulttime",monthFirst).le("faulttime",monthLast);
|
|
|
- historyQw.in("snapid",snapids);
|
|
|
- List<Faulthistory> historyList = faulthistoryService.list(historyQw);
|
|
|
+ QueryWrapper<Shutdownevent> shutdowneventQueryWrapper = new QueryWrapper<>();
|
|
|
+ Date addDay = DateUtils.addDays(date, 1);
|
|
|
+ shutdowneventQueryWrapper.ge("stoptime",monthFirst).lt("stoptime",addDay);
|
|
|
+ List<Shutdownevent> historyList = shutdowneventService.list(shutdowneventQueryWrapper);
|
|
|
+
|
|
|
+// //取出所有故障的snapid
|
|
|
+// QueryWrapper<Faultsnap> snapQw = new QueryWrapper<>();
|
|
|
+// snapQw.eq("category1","FJ").eq("category2","GZ");
|
|
|
+// List<Faultsnap> snapList = faultsnapService.list(snapQw);
|
|
|
+// Map<BigDecimal,Faultsnap> snapMap = new HashMap<>();
|
|
|
+// snapList.stream().forEach(i->{
|
|
|
+// snapMap.put(i.getId(),i);
|
|
|
+// });
|
|
|
+//
|
|
|
+// List<BigDecimal> snapids = faultsnapService.list(snapQw).stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //取出一月故障流水记录
|
|
|
+// QueryWrapper<Faulthistory> historyQw = new QueryWrapper<>();
|
|
|
+//// historyQw.like("faulttime",date);
|
|
|
+//// Date addDay = DateUtils.addDays(date, 1);
|
|
|
+// historyQw.ge("faulttime",monthFirst).le("faulttime",monthLast);
|
|
|
+// historyQw.in("snapid",snapids);
|
|
|
+// List<Faulthistory> historyList = faulthistoryService.list(historyQw);
|
|
|
double fdFaulttime = 0;
|
|
|
long fdFaultcount = 0;
|
|
|
double fdWthours = 0;
|
|
@@ -284,7 +289,7 @@ public class MTTRMTBFTaskService {
|
|
|
if (StringUtils.isNotNull(windpowerinfodayList)){
|
|
|
faulttime = windpowerinfodayList.stream().mapToDouble(Windpowerinfoday::getFaulttime).sum();
|
|
|
}
|
|
|
- long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getStationid().equals(windpowerstation.getId())).count();
|
|
|
+ long faultcount = historyList.stream().filter(i -> i.getWindpowerstationid().equals(windpowerstation.getId())).count();
|
|
|
zFaulttime += faulttime;
|
|
|
zFaultcount += faultcount;
|
|
|
zWthours += BigDecimalUtils.multiply(BigDecimalUtils.multiply(windpowerstation.getQuantity(),new BigDecimal(24),2),new BigDecimal(getDays(DateUtils.toDate1(monthFirst),DateUtils.toDate1(monthLast)).size()),2).doubleValue();
|
|
@@ -315,7 +320,7 @@ public class MTTRMTBFTaskService {
|
|
|
if (StringUtils.isNotNull(windpowerinfodayList)){
|
|
|
faulttime = windpowerinfodayList.stream().mapToDouble(Windpowerinfoday::getFaulttime).sum();
|
|
|
}
|
|
|
- long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getProjectid().equals(project.getId())).count();
|
|
|
+ long faultcount = historyList.stream().filter(i -> i.getProjectid().equals(project.getId())).count();
|
|
|
|
|
|
Wpmttrandmtbmonth w = new Wpmttrandmtbmonth();
|
|
|
w.setId(StringUtils.getUUID());
|
|
@@ -336,7 +341,8 @@ public class MTTRMTBFTaskService {
|
|
|
if (StringUtils.isNotNull(windpowerinfodayList)){
|
|
|
faulttime = windpowerinfodayList.stream().mapToDouble(Windpowerinfoday::getFaulttime).sum();
|
|
|
}
|
|
|
- long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getLineid().equals(line.getId())).count();
|
|
|
+// long faultcount = historyList.stream().filter(i -> i.().equals(line.getId())).count();
|
|
|
+ long faultcount = historyList.stream().filter(i -> CacheContext.wmap.get(i.getWindturbineid()).getLineid().equals(line.getId())).count();
|
|
|
|
|
|
|
|
|
Wpmttrandmtbmonth w = new Wpmttrandmtbmonth();
|
|
@@ -367,7 +373,8 @@ public class MTTRMTBFTaskService {
|
|
|
if (first.isPresent()){
|
|
|
faulttime = first.get().getFaulttime();
|
|
|
}
|
|
|
- double faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getWindturbineid().equals(windturbine.getId())).count();
|
|
|
+// double faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getWindturbineid().equals(windturbine.getId())).count();
|
|
|
+ double faultcount = historyList.stream().filter(i -> i.getWindturbineid().equals(windturbine.getId())).count();
|
|
|
Wtmttrandmtbfmonth w = new Wtmttrandmtbfmonth();
|
|
|
w.setId(StringUtils.getUUID());
|
|
|
w.setWtid(windturbine.getId());
|
|
@@ -440,24 +447,30 @@ public class MTTRMTBFTaskService {
|
|
|
infodayQw.le("recorddate",yearLast);
|
|
|
List<Windpowerinfoday> indodayList = windpowerinfodayService.list(infodayQw);
|
|
|
|
|
|
- //取出所有故障的snapid
|
|
|
- QueryWrapper<Faultsnap> snapQw = new QueryWrapper<>();
|
|
|
- snapQw.eq("category1","FJ").eq("category2","GZ");
|
|
|
- List<Faultsnap> snapList = faultsnapService.list(snapQw);
|
|
|
- Map<BigDecimal,Faultsnap> snapMap = new HashMap<>();
|
|
|
- snapList.stream().forEach(i->{
|
|
|
- snapMap.put(i.getId(),i);
|
|
|
- });
|
|
|
|
|
|
- List<BigDecimal> snapids = faultsnapService.list(snapQw).stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+ QueryWrapper<Shutdownevent> shutdowneventQueryWrapper = new QueryWrapper<>();
|
|
|
+ Date addDay = DateUtils.addDays(date, 1);
|
|
|
+ shutdowneventQueryWrapper.ge("stoptime",yearFirst).lt("stoptime",addDay);
|
|
|
+ List<Shutdownevent> historyList = shutdowneventService.list(shutdowneventQueryWrapper);
|
|
|
|
|
|
- //取出一年故障流水记录
|
|
|
- QueryWrapper<Faulthistory> historyQw = new QueryWrapper<>();
|
|
|
-// historyQw.like("faulttime",date);
|
|
|
-// Date addDay = DateUtils.addDays(date, 1);
|
|
|
- historyQw.ge("faulttime",yearFirst).le("faulttime",yearLast);
|
|
|
- historyQw.in("snapid",snapids);
|
|
|
- List<Faulthistory> historyList = faulthistoryService.list(historyQw);
|
|
|
+// //取出所有故障的snapid
|
|
|
+// QueryWrapper<Faultsnap> snapQw = new QueryWrapper<>();
|
|
|
+// snapQw.eq("category1","FJ").eq("category2","GZ");
|
|
|
+// List<Faultsnap> snapList = faultsnapService.list(snapQw);
|
|
|
+// Map<BigDecimal,Faultsnap> snapMap = new HashMap<>();
|
|
|
+// snapList.stream().forEach(i->{
|
|
|
+// snapMap.put(i.getId(),i);
|
|
|
+// });
|
|
|
+//
|
|
|
+// List<BigDecimal> snapids = faultsnapService.list(snapQw).stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+//
|
|
|
+// //取出一年故障流水记录
|
|
|
+// QueryWrapper<Faulthistory> historyQw = new QueryWrapper<>();
|
|
|
+//// historyQw.like("faulttime",date);
|
|
|
+//// Date addDay = DateUtils.addDays(date, 1);
|
|
|
+// historyQw.ge("faulttime",yearFirst).le("faulttime",yearLast);
|
|
|
+// historyQw.in("snapid",snapids);
|
|
|
+// List<Faulthistory> historyList = faulthistoryService.list(historyQw);
|
|
|
double fdFaulttime = 0;
|
|
|
long fdFaultcount = 0;
|
|
|
double fdWthours = 0;
|
|
@@ -476,7 +489,7 @@ public class MTTRMTBFTaskService {
|
|
|
if (StringUtils.isNotNull(windpowerinfodayList)){
|
|
|
faulttime = windpowerinfodayList.stream().mapToDouble(Windpowerinfoday::getFaulttime).sum();
|
|
|
}
|
|
|
- long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getStationid().equals(windpowerstation.getId())).count();
|
|
|
+ long faultcount = historyList.stream().filter(i -> i.getWindpowerstationid().equals(windpowerstation.getId())).count();
|
|
|
zFaulttime += faulttime;
|
|
|
zFaultcount += faultcount;
|
|
|
zWthours += BigDecimalUtils.multiply(BigDecimalUtils.multiply(windpowerstation.getQuantity(),new BigDecimal(24),2),new BigDecimal(size),2).doubleValue();
|
|
@@ -506,7 +519,7 @@ public class MTTRMTBFTaskService {
|
|
|
if (StringUtils.isNotNull(windpowerinfodayList)){
|
|
|
faulttime = windpowerinfodayList.stream().mapToDouble(Windpowerinfoday::getFaulttime).sum();
|
|
|
}
|
|
|
- long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getProjectid().equals(project.getId())).count();
|
|
|
+ long faultcount = historyList.stream().filter(i -> i.getProjectid().equals(project.getId())).count();
|
|
|
|
|
|
Wpmttrandmtbfyear w = new Wpmttrandmtbfyear();
|
|
|
w.setId(StringUtils.getUUID());
|
|
@@ -526,8 +539,8 @@ public class MTTRMTBFTaskService {
|
|
|
if (StringUtils.isNotNull(windpowerinfodayList)){
|
|
|
faulttime = windpowerinfodayList.stream().mapToDouble(Windpowerinfoday::getFaulttime).sum();
|
|
|
}
|
|
|
- long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getLineid().equals(line.getId())).count();
|
|
|
-
|
|
|
+// long faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getLineid().equals(line.getId())).count();
|
|
|
+ long faultcount = historyList.stream().filter(i -> CacheContext.wmap.get(i.getWindturbineid()).getLineid().equals(line.getId())).count();
|
|
|
|
|
|
Wpmttrandmtbfyear w = new Wpmttrandmtbfyear();
|
|
|
w.setId(StringUtils.getUUID());
|
|
@@ -558,7 +571,8 @@ public class MTTRMTBFTaskService {
|
|
|
if (first.isPresent()){
|
|
|
faulttime = first.get().getFaulttime();
|
|
|
}
|
|
|
- double faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getWindturbineid().equals(windturbine.getId())).count();
|
|
|
+// double faultcount = historyList.stream().filter(i -> snapMap.get(i.getSnapid()).getWindturbineid().equals(windturbine.getId())).count();
|
|
|
+ double faultcount = historyList.stream().filter(i -> i.getWindturbineid().equals(windturbine.getId())).count();
|
|
|
Wtmttrandmtbfyear w = new Wtmttrandmtbfyear();
|
|
|
w.setId(StringUtils.getUUID());
|
|
|
w.setWtid(windturbine.getId());
|