|
|
@@ -1,5 +1,6 @@
|
|
|
package com.gyee.runeconomy.service.auto.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@@ -20,7 +21,6 @@ import com.gyee.runeconomy.service.auto.ITurbineInfoDayService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.text.ParseException;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.Year;
|
|
|
import java.time.ZoneId;
|
|
|
@@ -287,13 +287,91 @@ public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEq
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+// @Override
|
|
|
+// public Map<String, Object> getEquipmentInfoDayTopCompareList(List<Long> ids, Integer types) {
|
|
|
+//
|
|
|
+// Map<String, Object> resultMap = new HashMap<>();
|
|
|
+// Map<String, Object> chartsMap = new HashMap<>();
|
|
|
+// QueryWrapper<ProEconEquipmentInfoDayTop> qw = new QueryWrapper<>();
|
|
|
+//
|
|
|
+//
|
|
|
+// if (null != ids && ids.size() > 0) {
|
|
|
+// qw.lambda().in(ProEconEquipmentInfoDayTop::getId, ids);
|
|
|
+// }
|
|
|
+// List<ProEconEquipmentInfoDayTop> list = baseMapper.selectList(qw);
|
|
|
+// list.stream().forEach(i -> {
|
|
|
+// i.setNemCode(CacheContext.wtmap.get(i.getWindturbineId()).getAname());
|
|
|
+// });
|
|
|
+// resultMap.put("data", list);
|
|
|
+//
|
|
|
+//
|
|
|
+// list.stream().forEach(wtd -> {
|
|
|
+// List<CompareVo> compareList = new ArrayList<>();
|
|
|
+//
|
|
|
+// for (int i = 0; i < 10; i++) {
|
|
|
+// CompareVo vo = new CompareVo();
|
|
|
+//
|
|
|
+// switch (i) {
|
|
|
+// case 0:
|
|
|
+// vo.setTarget("平均切入风速");
|
|
|
+// vo.setData(wtd.getYearxfqr());
|
|
|
+// break;
|
|
|
+// case 1:
|
|
|
+// vo.setTarget("性能损失电量");
|
|
|
+// vo.setData(wtd.getYearxnssdl());
|
|
|
+// break;
|
|
|
+// case 2:
|
|
|
+// vo.setTarget("拟合优度");
|
|
|
+// vo.setData(wtd.getYearnhyd());
|
|
|
+// break;
|
|
|
+// case 3:
|
|
|
+// vo.setTarget("功率一致性系数");
|
|
|
+// vo.setData(wtd.getYearglyzxxs());
|
|
|
+// break;
|
|
|
+// case 4:
|
|
|
+// vo.setTarget("利用小时");
|
|
|
+// vo.setData(wtd.getYearlyxs());
|
|
|
+// break;
|
|
|
+// case 5:
|
|
|
+// vo.setTarget("设备可利用率");
|
|
|
+// vo.setData(wtd.getYearsbklyl());
|
|
|
+// break;
|
|
|
+// case 6:
|
|
|
+// vo.setTarget("等效可利用系数");
|
|
|
+// vo.setData(wtd.getYeardxkyxs());
|
|
|
+// break;
|
|
|
+// case 7:
|
|
|
+// vo.setTarget("有效风时数");
|
|
|
+// vo.setData(wtd.getYearyxfss());
|
|
|
+// break;
|
|
|
+// case 8:
|
|
|
+// vo.setTarget("平均风速");
|
|
|
+// vo.setData(wtd.getYearfs());
|
|
|
+// break;
|
|
|
+// case 9:
|
|
|
+// vo.setTarget("静风频率");
|
|
|
+// vo.setData(wtd.getYearjfpl());
|
|
|
+// break;
|
|
|
+// default:
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// compareList.add(vo);
|
|
|
+// }
|
|
|
+// chartsMap.put(wtd.getNemCode(), compareList);
|
|
|
+//
|
|
|
+// });
|
|
|
+// resultMap.put("charts", chartsMap);
|
|
|
+// return resultMap;
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> getEquipmentInfoDayTopCompareList(List<Long> ids, Integer types) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
Map<String, Object> chartsMap = new HashMap<>();
|
|
|
+ Date recordDate = new Date();
|
|
|
+ DateTime start = DateUtil.beginOfMonth(recordDate);
|
|
|
QueryWrapper<ProEconEquipmentInfoDayTop> qw = new QueryWrapper<>();
|
|
|
-
|
|
|
-
|
|
|
if (null != ids && ids.size() > 0) {
|
|
|
qw.lambda().in(ProEconEquipmentInfoDayTop::getId, ids);
|
|
|
}
|
|
|
@@ -302,6 +380,47 @@ public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEq
|
|
|
i.setNemCode(CacheContext.wtmap.get(i.getWindturbineId()).getAname());
|
|
|
});
|
|
|
resultMap.put("data", list);
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ recordDate = list.get(0).getRecordDate();
|
|
|
+ }
|
|
|
+ int dayOfMonth = DateUtil.dayOfMonth(recordDate);
|
|
|
+ List<TurbineInfoDay> turls = turbineInfoDayService.getTurbineMonthList("NX_FGS_HA_FDC_STA", start.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), recordDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
|
|
|
+ List<TurbineInfoDay> turSorted = turls.stream().sorted(Comparator.comparing(TurbineInfoDay::getScore).reversed().thenComparing(TurbineInfoDay::getTurbineId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ for (int i = 1; i < turSorted.size(); i++) {
|
|
|
+ turSorted.get(i - 1).setScore((double) i);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, TurbineInfoDay> turMap = turls.stream().collect(Collectors.toMap(TurbineInfoDay::getTurbineId, Function.identity()));
|
|
|
+ list.stream().forEach(i -> {
|
|
|
+ TurbineInfoDay tur = turMap.get(i.getWindturbineId());
|
|
|
+ i.setNemCode(CacheContext.wtmap.get(i.getWindturbineId()).getAname());
|
|
|
+ i.setDayfdl(NumberUtil.round(tur.getRfdl() / 1000, 2).doubleValue());
|
|
|
+ i.setDayllfdl(NumberUtil.round(tur.getLlfdl() / 1000, 2).doubleValue());
|
|
|
+ i.setDayfs(NumberUtil.round(tur.getPjfs(), 2).doubleValue());
|
|
|
+ i.setDaygzssdl(NumberUtil.round(tur.getGzss() / 1000, 2).doubleValue());
|
|
|
+ i.setDayxdssdl(NumberUtil.round(tur.getXdss() / 1000, 2).doubleValue());
|
|
|
+ i.setDaywhssdl(NumberUtil.round(tur.getJhjxss() / 1000, 2).doubleValue());
|
|
|
+ i.setDaygzsj(NumberUtil.round(tur.getGzMin() / 60, 2).doubleValue());
|
|
|
+ i.setDaywhsj(NumberUtil.round(tur.getJxMin() / 60, 2).doubleValue());
|
|
|
+ i.setDayyxsj(NumberUtil.round(tur.getYxMin() / 60, 2).doubleValue());
|
|
|
+ i.setDaytjsj(NumberUtil.round(tur.getTjMin() / 60, 2).doubleValue());
|
|
|
+ i.setDayxnssdl(NumberUtil.round(tur.getXnss() / 1000, 2).doubleValue());
|
|
|
+ i.setDaynhyd(NumberUtil.round(tur.getNhyd(), 2).doubleValue());
|
|
|
+ i.setDayglyzxxs(NumberUtil.round(tur.getGlyzxxs(), 2).doubleValue());
|
|
|
+ i.setDaylyxs(NumberUtil.round(tur.getLyxs(), 2).doubleValue());
|
|
|
+ i.setDaysbklyl(NumberUtil.round(tur.getKlyl(), 2).doubleValue());
|
|
|
+ double dxkyxs = (24 * (dayOfMonth - 1) - tur.getGzMin() / 60 - tur.getJxMin() / 60) / (0.24 * (dayOfMonth - 1));
|
|
|
+ i.setDaydxkyxs(NumberUtil.round(dxkyxs, 2).doubleValue());
|
|
|
+ i.setDayyxfss(NumberUtil.round(tur.getYxfss(), 2).doubleValue());
|
|
|
+ i.setDayxfqr(NumberUtil.round(tur.getXfqrfs(), 2).doubleValue());
|
|
|
+ i.setDayjfpl(NumberUtil.round(tur.getJfpl(), 2).doubleValue());
|
|
|
+ double rank = tur.getScore();
|
|
|
+ i.setDayRank((int) rank);
|
|
|
+ i.setDayLevel(level(tur.getScore(), DateUtil.dayOfMonth(i.getRecordDate()) - 1));
|
|
|
+ i.setDayjfpl(NumberUtil.round(tur.getJfpl() * 100, 2).doubleValue());
|
|
|
+ });
|
|
|
+ resultMap.put("data", list);
|
|
|
|
|
|
|
|
|
list.stream().forEach(wtd -> {
|
|
|
@@ -313,43 +432,43 @@ public class ProEconEquipmentInfoDayTopServiceImpl extends ServiceImpl<ProEconEq
|
|
|
switch (i) {
|
|
|
case 0:
|
|
|
vo.setTarget("平均切入风速");
|
|
|
- vo.setData(wtd.getYearxfqr());
|
|
|
+ vo.setData(wtd.getDayxfqr());
|
|
|
break;
|
|
|
case 1:
|
|
|
vo.setTarget("性能损失电量");
|
|
|
- vo.setData(wtd.getYearxnssdl());
|
|
|
+ vo.setData(wtd.getDayxnssdl());
|
|
|
break;
|
|
|
case 2:
|
|
|
vo.setTarget("拟合优度");
|
|
|
- vo.setData(wtd.getYearnhyd());
|
|
|
+ vo.setData(wtd.getDaynhyd());
|
|
|
break;
|
|
|
case 3:
|
|
|
vo.setTarget("功率一致性系数");
|
|
|
- vo.setData(wtd.getYearglyzxxs());
|
|
|
+ vo.setData(wtd.getDayglyzxxs());
|
|
|
break;
|
|
|
case 4:
|
|
|
vo.setTarget("利用小时");
|
|
|
- vo.setData(wtd.getYearlyxs());
|
|
|
+ vo.setData(wtd.getDaylyxs());
|
|
|
break;
|
|
|
case 5:
|
|
|
vo.setTarget("设备可利用率");
|
|
|
- vo.setData(wtd.getYearsbklyl());
|
|
|
+ vo.setData(wtd.getDaysbklyl());
|
|
|
break;
|
|
|
case 6:
|
|
|
vo.setTarget("等效可利用系数");
|
|
|
- vo.setData(wtd.getYeardxkyxs());
|
|
|
+ vo.setData(wtd.getDaydxkyxs());
|
|
|
break;
|
|
|
case 7:
|
|
|
vo.setTarget("有效风时数");
|
|
|
- vo.setData(wtd.getYearyxfss());
|
|
|
+ vo.setData(wtd.getDayyxfss());
|
|
|
break;
|
|
|
case 8:
|
|
|
vo.setTarget("平均风速");
|
|
|
- vo.setData(wtd.getYearfs());
|
|
|
+ vo.setData(wtd.getDayfs());
|
|
|
break;
|
|
|
case 9:
|
|
|
vo.setTarget("静风频率");
|
|
|
- vo.setData(wtd.getYearjfpl());
|
|
|
+ vo.setData(wtd.getDayjfpl());
|
|
|
break;
|
|
|
default:
|
|
|
break;
|