|
|
@@ -63,6 +63,8 @@ public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEq
|
|
|
Map<String, TurbineInfoDay> dayMap = tidRecords.stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
|
|
|
peeidtRecords.forEach(peeidt -> {
|
|
|
TurbineInfoDay day = dayMap.get(peeidt.getWindturbineId());
|
|
|
+ Date recordDate = day.getRecordDate();
|
|
|
+ int i = DateUtil.dayOfMonth(recordDate);
|
|
|
peeidt.setDayfdl(NumberUtil.round(day.getRfdl() / 1000, 2).doubleValue());
|
|
|
peeidt.setDayllfdl(NumberUtil.round(day.getLlfdl() / 1000, 2).doubleValue());
|
|
|
peeidt.setDayfs(NumberUtil.round(day.getPjfs(), 2).doubleValue());
|
|
|
@@ -74,18 +76,47 @@ public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEq
|
|
|
peeidt.setDaysbklyl(NumberUtil.round(day.getKlyl(), 2).doubleValue());
|
|
|
peeidt.setDayyxfss(NumberUtil.round(day.getYxfss(), 2).doubleValue());
|
|
|
peeidt.setDayjfpl(NumberUtil.round(day.getJfpl(), 2).doubleValue());
|
|
|
+ peeidt.setDayRank(Integer.valueOf(day.getLevel()));
|
|
|
+ peeidt.setDayLevel(level(day.getScore(), i-1));
|
|
|
});
|
|
|
return peeidtRecords;
|
|
|
}
|
|
|
|
|
|
- public List<TurbineInfoDay> getTopAndList(String windpowerstationId, String date, Integer pageNum, Integer pageSize) {
|
|
|
- LocalDate d = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
- LocalDate firstDayOfMonth = d.withDayOfMonth(1);
|
|
|
- Date startDate = Date.from(firstDayOfMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
|
|
- Date endDate = DateUtil.parse(date);
|
|
|
|
|
|
- List<TurbineInfoDay> turbineMonthList = turbineInfoDayService.getTurbineMonthList(windpowerstationId, startDate, endDate);
|
|
|
|
|
|
+
|
|
|
+ private String level(Double score, int i) {
|
|
|
+ score = 0 != i ? score / i : 0.0;
|
|
|
+ String top;
|
|
|
+ if (score >= 67) {
|
|
|
+ top = "AAA";
|
|
|
+ } else if (score >= 60) {
|
|
|
+ top = "AA";
|
|
|
+ } else if (score >= 56) {
|
|
|
+ top = "A";
|
|
|
+ } else if (score >= 53) {
|
|
|
+ top = "BBB";
|
|
|
+ } else if (score >= 46) {
|
|
|
+ top = "BB";
|
|
|
+ } else if (score >= 42) {
|
|
|
+ top = "B";
|
|
|
+ } else if (score >= 28) {
|
|
|
+ top = "C";
|
|
|
+ } else {
|
|
|
+ top = "C-";
|
|
|
+ }
|
|
|
+ return top;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<TurbineInfoDay> getTopAndList(String windpowerstationId, String date, Integer pageNum, Integer pageSize) {
|
|
|
+ LocalDate endDate = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE);
|
|
|
+ endDate = endDate.minusDays(1);
|
|
|
+ LocalDate startDate = endDate.withDayOfMonth(1);
|
|
|
+ List<TurbineInfoDay> turbineMonthList = turbineInfoDayService.getTurbineMonthList(windpowerstationId, startDate, endDate);
|
|
|
+ List<TurbineInfoDay> collect = turbineMonthList.stream().sorted((t1, t2) -> t2.getScore().compareTo(t1.getScore())).collect(Collectors.toList());
|
|
|
+ for (int i = 1; i <= collect.size(); i++) {
|
|
|
+ collect.get(i-1).setLevel(String.valueOf(i));
|
|
|
+ }
|
|
|
if (pageNum == null || pageSize == null || pageNum < 1 || pageSize < 1) {
|
|
|
return turbineMonthList;
|
|
|
}
|
|
|
@@ -238,7 +269,7 @@ public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEq
|
|
|
|
|
|
if (StringUtils.isNotEmpty(beginDate) && StringUtils.isNotEmpty(endDate))
|
|
|
qw.lambda().ge(ProEconEquipmentInfoDayTop::getRecordDate, DateUtils.parseDate(beginDate)).
|
|
|
- le(ProEconEquipmentInfoDayTop::getRecordDate, DateUtils.parseDate(endDate));
|
|
|
+ lt(ProEconEquipmentInfoDayTop::getRecordDate, DateUtils.parseDate(endDate));
|
|
|
|
|
|
qw.orderByAsc("record_date");
|
|
|
List<ProEconEquipmentInfoDayTop> list = baseMapper.selectList(qw);
|