|
|
@@ -14,6 +14,7 @@ import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.YearMonth;
|
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
@@ -1582,15 +1583,36 @@ public class SingleAnalysisService {
|
|
|
|
|
|
|
|
|
public SingleAnalysisVo SingleAnalysisTurbineinfoday(String wtId, String year, String month, SingleAnalysisVo byzb) {
|
|
|
- LocalDate now=LocalDate.now();
|
|
|
+ LocalDate now = LocalDate.now();
|
|
|
int yearCurrent = now.getYear();
|
|
|
int monthCurrent = now.getMonthValue();
|
|
|
+ int dayOfMonth = now.getDayOfMonth();
|
|
|
+ if (now.getDayOfMonth() == 1) {
|
|
|
+ if (now.getMonthValue() == 1) {
|
|
|
+ yearCurrent = yearCurrent - 1;
|
|
|
+ monthCurrent = 12;
|
|
|
+ } else {
|
|
|
+ monthCurrent = monthCurrent - 1;
|
|
|
+ }
|
|
|
+ dayOfMonth = YearMonth.of(yearCurrent, monthCurrent).lengthOfMonth();
|
|
|
+ }
|
|
|
+
|
|
|
String date = year + "-" + month;
|
|
|
+ if (Integer.parseInt(year) != yearCurrent || Integer.parseInt(month) != monthCurrent) {
|
|
|
+ String monCurrent;
|
|
|
+ if (monthCurrent < 10) {
|
|
|
+ monCurrent = "0" + monthCurrent;
|
|
|
+ date = yearCurrent + "-" + monCurrent;
|
|
|
+ }else {
|
|
|
+ date = yearCurrent + "-" + monthCurrent;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
|
|
|
qw.lambda().eq(TurbineInfoDay::getTurbineId, wtId)
|
|
|
.apply("to_char(record_date,'YYYY-MM')='" + date + "'");
|
|
|
if (Integer.parseInt(year) == yearCurrent && Integer.parseInt(month) == monthCurrent) {
|
|
|
- qw.lambda().lt(TurbineInfoDay::getRecordDate,now);
|
|
|
+ qw.lambda().lt(TurbineInfoDay::getRecordDate, now);
|
|
|
}
|
|
|
List<TurbineInfoDay> list = turbineInfoDayService.list(qw);
|
|
|
double rfdl = list.stream().mapToDouble(TurbineInfoDay::getRfdl).sum();
|
|
|
@@ -1627,6 +1649,8 @@ public class SingleAnalysisService {
|
|
|
byzb.setYxfss(NumberUtil.round(yxfss, 2).doubleValue());
|
|
|
double glyzxxs = list.stream().mapToDouble(TurbineInfoDay::getGlyzxxs).average().orElse(0.0);
|
|
|
byzb.setGlyzxxs(NumberUtil.round(glyzxxs, 2).doubleValue());
|
|
|
+ double dxkyxs = (1200 * (dayOfMonth - 1) - gzmin / 60 - jxmin / 60) / (12 * (dayOfMonth - 1));
|
|
|
+ byzb.setDxklyxs(NumberUtil.round(dxkyxs, 2).doubleValue());
|
|
|
return byzb;
|
|
|
}
|
|
|
}
|