|
|
@@ -1,7 +1,6 @@
|
|
|
package com.gyee.runeconomy.service;
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
@@ -17,10 +16,7 @@ import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.ZoneId;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -55,27 +51,22 @@ public class WtAlysisDayService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- //构造条件构造器
|
|
|
- LambdaQueryWrapper<ProEconWtAlysisDay> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- //添加过滤条件
|
|
|
- queryWrapper.eq(ProEconWtAlysisDay::getWindturbineId, wtId).
|
|
|
- ge(ProEconWtAlysisDay::getRecordDate, begin).
|
|
|
- le(ProEconWtAlysisDay::getRecordDate, end);
|
|
|
- queryWrapper.orderByAsc(ProEconWtAlysisDay::getRecordDate);
|
|
|
- //执行查询
|
|
|
- proEconWtAlysisDayService.page(pageInfo, queryWrapper);
|
|
|
-
|
|
|
QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(TurbineInfoDay::getTurbineId, wtId).between(TurbineInfoDay::getRecordDate, begin, end)
|
|
|
+ qw.lambda().eq(TurbineInfoDay::getTurbineId, wtId)
|
|
|
+ .ge(TurbineInfoDay::getRecordDate, begin)
|
|
|
+ .lt(TurbineInfoDay::getRecordDate, end)
|
|
|
.orderByAsc(TurbineInfoDay::getRecordDate);
|
|
|
IPage<TurbineInfoDay> page01 = new Page<>(pageNum, pageSize);
|
|
|
IPage<TurbineInfoDay> page1 = turbineInfoDayService.page(page01, qw);
|
|
|
Map<Date, TurbineInfoDay> dayMap = page1.getRecords().stream().collect(Collectors.toMap(TurbineInfoDay::getRecordDate, Function.identity()));
|
|
|
|
|
|
- pageInfo.getRecords().forEach(rsl -> {
|
|
|
- TurbineInfoDay day = dayMap.get(rsl.getRecordDate());
|
|
|
+ List<ProEconWtAlysisDay> ls = new ArrayList<>();
|
|
|
+ page1.getRecords().forEach(rs -> {
|
|
|
+ TurbineInfoDay day = dayMap.get(rs.getRecordDate());
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
+ ProEconWtAlysisDay rsl = new ProEconWtAlysisDay();
|
|
|
+ rsl.setWindturbineId(rs.getTurbineId());
|
|
|
+ rsl.setRecordDate(rs.getRecordDate());
|
|
|
rsl.setRfdl(NumberUtil.round(day.getRfdl() / 1000, 2).doubleValue());
|
|
|
double yfdl = calFdl(rsl.getWindturbineId(), "month", rsl.getRecordDate(), calendar);
|
|
|
rsl.setYfdl(NumberUtil.round(yfdl / 1000, 2).doubleValue());
|
|
|
@@ -127,8 +118,12 @@ public class WtAlysisDayService {
|
|
|
rsl.setYpjwd(NumberUtil.round(ypjwd, 2).doubleValue());
|
|
|
double npjwd = calPjwd(rsl.getWindturbineId(), "year", rsl.getRecordDate(), calendar);
|
|
|
rsl.setNpjwd(NumberUtil.round(npjwd, 2).doubleValue());
|
|
|
+ ls.add(rsl);
|
|
|
});
|
|
|
-
|
|
|
+ if (!ls.isEmpty()) {
|
|
|
+ pageInfo.setRecords(ls);
|
|
|
+ pageInfo.setTotal(ls.size() == 0 ? 0 : ls.size());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return pageInfo;
|