|
@@ -136,12 +136,10 @@ public class EconomyPointHomePageService {
|
|
* 15分钟发电量
|
|
* 15分钟发电量
|
|
*/
|
|
*/
|
|
private Map<String, GeneratingCapacityVo> generatingCapacity15min = new HashMap<>();
|
|
private Map<String, GeneratingCapacityVo> generatingCapacity15min = new HashMap<>();
|
|
-
|
|
|
|
- private BigDecimal weekFdlCal = null;
|
|
|
|
- private BigDecimal yfdlCal = null;
|
|
|
|
- private BigDecimal yllfdlCal = null;
|
|
|
|
- private BigDecimal nfdlCal = null;
|
|
|
|
- private BigDecimal nllfdlCal = null;
|
|
|
|
|
|
+ private Map<String, BigDecimal> yfdlCal = new HashMap<>();
|
|
|
|
+ private Map<String, BigDecimal> yllfdlCal = new HashMap<>();
|
|
|
|
+ private Map<Integer, BigDecimal> nfdlCal = new HashMap<>();
|
|
|
|
+ private Map<Integer, BigDecimal> nllfdlCal = new HashMap<>();
|
|
private LocalDate lastCalDate;
|
|
private LocalDate lastCalDate;
|
|
|
|
|
|
private Map<LocalDate, BigDecimal> fnlyl = new HashMap<>();
|
|
private Map<LocalDate, BigDecimal> fnlyl = new HashMap<>();
|
|
@@ -1685,13 +1683,18 @@ public class EconomyPointHomePageService {
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> getHomeMiddle(String companyId) throws ParseException {
|
|
public Map<String, Object> getHomeMiddle(String companyId) throws ParseException {
|
|
|
|
+ double rfdl = generatingCapacity15min.get("日发电量").getValue();
|
|
Integer month = LocalDate.now().getMonthValue();
|
|
Integer month = LocalDate.now().getMonthValue();
|
|
int year = LocalDate.now().getYear();
|
|
int year = LocalDate.now().getYear();
|
|
Map<String, Object> allmap = new HashMap<>();
|
|
Map<String, Object> allmap = new HashMap<>();
|
|
PlanDataVo pd = new PlanDataVo();
|
|
PlanDataVo pd = new PlanDataVo();
|
|
- pd.setZfdlsj(weekFdlCal.add(new BigDecimal(generatingCapacity15min.get("日发电量").getValue())).doubleValue());
|
|
|
|
- pd.setYfdlsj(yfdlCal.add(new BigDecimal(generatingCapacity15min.get("月发电量").getValue())).doubleValue());
|
|
|
|
- pd.setNfdlsj(nfdlCal.add(new BigDecimal(generatingCapacity15min.get("年发电量").getValue())).doubleValue());
|
|
|
|
|
|
+ Double week = getWeekFdlCal();
|
|
|
|
+ pd.setZfdlsj(week);
|
|
|
|
+ String s = year + "-" + month;
|
|
|
|
+ BigDecimal monCache = yfdlCal.get(s);
|
|
|
|
+ pd.setYfdlsj(monCache.add(new BigDecimal(rfdl)).doubleValue());
|
|
|
|
+ BigDecimal yearCache = nfdlCal.get(year);
|
|
|
|
+ pd.setNfdlsj(yearCache.add(new BigDecimal(rfdl)).doubleValue());
|
|
//计划发电量
|
|
//计划发电量
|
|
List<ProBasicProjectPlan> list = iProBasicProjectPlanService.list();
|
|
List<ProBasicProjectPlan> list = iProBasicProjectPlanService.list();
|
|
List<ProBasicProjectPlan> pp = list.stream()
|
|
List<ProBasicProjectPlan> pp = list.stream()
|
|
@@ -1803,15 +1806,15 @@ public class EconomyPointHomePageService {
|
|
ptxdl.setYAxisIndex(0);
|
|
ptxdl.setYAxisIndex(0);
|
|
ptssdl.setYAxisIndex(0);
|
|
ptssdl.setYAxisIndex(0);
|
|
ptfdl.setYAxisIndex(0);
|
|
ptfdl.setYAxisIndex(0);
|
|
- if (null == lastYear || lastYear.isEmpty()) {
|
|
|
|
|
|
+ if (lastYear.isEmpty()) {
|
|
List<ValueVo> value = value(year - 1, month);
|
|
List<ValueVo> value = value(year - 1, month);
|
|
ptxdl2.setValue(value);
|
|
ptxdl2.setValue(value);
|
|
ptssdl2.setValue(value);
|
|
ptssdl2.setValue(value);
|
|
ptfdl2.setValue(value);
|
|
ptfdl2.setValue(value);
|
|
} else {
|
|
} else {
|
|
- List<ValueVo> vxdl2 = value(year, 12);
|
|
|
|
- List<ValueVo> vssdl2 = value(year, 12);
|
|
|
|
- List<ValueVo> vfdl2 = value(year, 12);
|
|
|
|
|
|
+ List<ValueVo> vxdl2 = value(year - 1, 12);
|
|
|
|
+ List<ValueVo> vssdl2 = value(year - 1, 12);
|
|
|
|
+ List<ValueVo> vfdl2 = value(year - 1, 12);
|
|
Map<Integer, List<TurbineInfoDay>> day1sMap2 = lastYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
|
|
Map<Integer, List<TurbineInfoDay>> day1sMap2 = lastYear.stream().collect(Collectors.groupingBy(record -> record.getRecordDate().getMonth() + 1));
|
|
for (Integer mon2 : day1sMap2.keySet()) {
|
|
for (Integer mon2 : day1sMap2.keySet()) {
|
|
List<TurbineInfoDay> day1s3 = day1sMap2.get(mon2);
|
|
List<TurbineInfoDay> day1s3 = day1sMap2.get(mon2);
|
|
@@ -1819,24 +1822,27 @@ public class EconomyPointHomePageService {
|
|
LocalDate localDate = day1s3.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
|
|
LocalDate localDate = day1s3.get(0).getRecordDate().toInstant().atZone(ZoneOffset.UTC).toLocalDate();
|
|
int year1 = localDate.getYear();
|
|
int year1 = localDate.getYear();
|
|
String text = year1 + "-" + mon2;
|
|
String text = year1 + "-" + mon2;
|
|
- ValueVo vexdl2 = new ValueVo();
|
|
|
|
- ValueVo vessdl2 = new ValueVo();
|
|
|
|
- ValueVo vefdl2 = new ValueVo();
|
|
|
|
- vexdl2.setText(text);
|
|
|
|
- vessdl2.setText(text);
|
|
|
|
- vefdl2.setText(text);
|
|
|
|
- vexdl2.setValue(day1s4.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
|
- vessdl2.setValue(day1s4.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
- .add(day1s4.stream().map(TurbineInfoDay::getJhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
- .add(day1s4.stream().map(TurbineInfoDay::getFjhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
- .add(day1s4.stream().map(TurbineInfoDay::getSlss).reduce(BigDecimal.ZERO, BigDecimal::add))
|
|
|
|
- .add(day1s4.stream().map(TurbineInfoDay::getXnss).reduce(BigDecimal.ZERO, BigDecimal::add))
|
|
|
|
- .add(day1s4.stream().map(TurbineInfoDay::getDjss).reduce(BigDecimal.ZERO, BigDecimal::add))
|
|
|
|
- .add(day1s4.stream().map(TurbineInfoDay::getGzss).reduce(BigDecimal.ZERO, BigDecimal::add)))));
|
|
|
|
- vefdl2.setValue(day1s4.stream().map(TurbineInfoDay::getRfdl).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
|
- vxdl2.add(vexdl2);
|
|
|
|
- vssdl2.add(vessdl2);
|
|
|
|
- vfdl2.add(vefdl2);
|
|
|
|
|
|
+ for (ValueVo vv : vxdl2) {
|
|
|
|
+ if (vv.getText().equals(text)) {
|
|
|
|
+ vv.setValue(day1s4.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (ValueVo vv : vssdl2) {
|
|
|
|
+ if (vv.getText().equals(text)) {
|
|
|
|
+ vv.setValue(day1s4.stream().map(TurbineInfoDay::getXdss).reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
+ .add(day1s4.stream().map(TurbineInfoDay::getJhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
+ .add(day1s4.stream().map(TurbineInfoDay::getFjhjxss).reduce(BigDecimal.ZERO, BigDecimal::add)
|
|
|
|
+ .add(day1s4.stream().map(TurbineInfoDay::getSlss).reduce(BigDecimal.ZERO, BigDecimal::add))
|
|
|
|
+ .add(day1s4.stream().map(TurbineInfoDay::getXnss).reduce(BigDecimal.ZERO, BigDecimal::add))
|
|
|
|
+ .add(day1s4.stream().map(TurbineInfoDay::getDjss).reduce(BigDecimal.ZERO, BigDecimal::add))
|
|
|
|
+ .add(day1s4.stream().map(TurbineInfoDay::getGzss).reduce(BigDecimal.ZERO, BigDecimal::add)))));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (ValueVo vv : vfdl2) {
|
|
|
|
+ if (vv.getText().equals(text)) {
|
|
|
|
+ vv.setValue(day1s4.stream().map(TurbineInfoDay::getRfdl).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
ptxdl2.setValue(vxdl2);
|
|
ptxdl2.setValue(vxdl2);
|
|
ptssdl2.setValue(vssdl2);
|
|
ptssdl2.setValue(vssdl2);
|
|
@@ -1886,7 +1892,6 @@ public class EconomyPointHomePageService {
|
|
public Map<String, Object> getGeneratingCapacity(String companyId) {
|
|
public Map<String, Object> getGeneratingCapacity(String companyId) {
|
|
Map<String, Object> allmap = new HashMap<>();
|
|
Map<String, Object> allmap = new HashMap<>();
|
|
QueryWrapper<StationInfoMin> qw = new QueryWrapper<>();
|
|
QueryWrapper<StationInfoMin> qw = new QueryWrapper<>();
|
|
- DecimalFormat df = new DecimalFormat("#.##");
|
|
|
|
qw.lambda().ge(StationInfoMin::getRecordDate, LocalDateTime.now().toLocalDate().atStartOfDay())
|
|
qw.lambda().ge(StationInfoMin::getRecordDate, LocalDateTime.now().toLocalDate().atStartOfDay())
|
|
.le(StationInfoMin::getRecordDate, LocalDateTime.now())
|
|
.le(StationInfoMin::getRecordDate, LocalDateTime.now())
|
|
.orderByDesc(StationInfoMin::getRecordDate)
|
|
.orderByDesc(StationInfoMin::getRecordDate)
|
|
@@ -1944,13 +1949,10 @@ public class EconomyPointHomePageService {
|
|
ls.add(nfdl);
|
|
ls.add(nfdl);
|
|
generatingCapacity15min.put(nfdl.getName(), nfdl);
|
|
generatingCapacity15min.put(nfdl.getName(), nfdl);
|
|
} else {
|
|
} else {
|
|
- if (null == lastCalDate || !lastCalDate.equals(LocalDate.now()) || null == yfdlCal) {
|
|
|
|
- calFdl();
|
|
|
|
- }
|
|
|
|
StationInfoMin day1 = day1s.get(0);
|
|
StationInfoMin day1 = day1s.get(0);
|
|
GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
|
|
GeneratingCapacityVo rfdl = new GeneratingCapacityVo();
|
|
rfdl.setName("日发电量");
|
|
rfdl.setName("日发电量");
|
|
- rfdl.setValue(new BigDecimal(day1.getRfdl()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
|
|
+ rfdl.setValue(Double.valueOf(String.format("%.2f", day1.getRfdl())));
|
|
Double llgl = day1.getLlgl();
|
|
Double llgl = day1.getLlgl();
|
|
rfdl.setTotal(calDivide(llgl, 4.0));
|
|
rfdl.setTotal(calDivide(llgl, 4.0));
|
|
Double rbfb = calDivide(rfdl.getValue(), rfdl.getTotal());
|
|
Double rbfb = calDivide(rfdl.getValue(), rfdl.getTotal());
|
|
@@ -1959,17 +1961,19 @@ public class EconomyPointHomePageService {
|
|
generatingCapacity15min.put(rfdl.getName(), rfdl);
|
|
generatingCapacity15min.put(rfdl.getName(), rfdl);
|
|
GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
|
|
GeneratingCapacityVo yfdl = new GeneratingCapacityVo();
|
|
yfdl.setName("月发电量");
|
|
yfdl.setName("月发电量");
|
|
- yfdl.setValue(yfdlCal.add(new BigDecimal(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
- yfdl.setTotal(calDivide(yllfdlCal.add(new BigDecimal(rfdl.getTotal())).doubleValue(), 4.0));
|
|
|
|
|
|
+
|
|
|
|
+ String s = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
|
|
|
|
+ BigDecimal monCache = yfdlCal.get(s);
|
|
|
|
+ yfdl.setValue(monCache.add(new BigDecimal(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
+ yfdl.setTotal(calDivide(yllfdlCal.get(s).add(new BigDecimal(rfdl.getTotal())).doubleValue(), 4.0));
|
|
Double ybfb = calDivide(yfdl.getValue(), yfdl.getTotal());
|
|
Double ybfb = calDivide(yfdl.getValue(), yfdl.getTotal());
|
|
yfdl.setBfb(new BigDecimal(ybfb).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
yfdl.setBfb(new BigDecimal(ybfb).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
ls.add(yfdl);
|
|
ls.add(yfdl);
|
|
generatingCapacity15min.put(yfdl.getName(), yfdl);
|
|
generatingCapacity15min.put(yfdl.getName(), yfdl);
|
|
GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
|
|
GeneratingCapacityVo nfdl = new GeneratingCapacityVo();
|
|
nfdl.setName("年发电量");
|
|
nfdl.setName("年发电量");
|
|
-// nfdl.setValue(nfdlCal.add(new BigDecimal(yfdl.getValue())).doubleValue());
|
|
|
|
- nfdl.setValue(nfdlCal.add(new BigDecimal(yfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
- nfdl.setTotal(calDivide(nllfdlCal.add(new BigDecimal(yfdl.getTotal())).doubleValue(), 4.0));
|
|
|
|
|
|
+ nfdl.setValue(nfdlCal.get(LocalDate.now().getYear()).add(new BigDecimal(rfdl.getValue())).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
|
|
+ nfdl.setTotal(calDivide(nllfdlCal.get(LocalDate.now().getYear()).add(new BigDecimal(rfdl.getTotal())).doubleValue(), 4.0));
|
|
Double nbfb = calDivide(nfdl.getValue(), nfdl.getTotal());
|
|
Double nbfb = calDivide(nfdl.getValue(), nfdl.getTotal());
|
|
nfdl.setBfb(new BigDecimal(nbfb).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
nfdl.setBfb(new BigDecimal(nbfb).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
|
ls.add(nfdl);
|
|
ls.add(nfdl);
|
|
@@ -2054,39 +2058,53 @@ public class EconomyPointHomePageService {
|
|
/**
|
|
/**
|
|
* 缓存月、年发电量
|
|
* 缓存月、年发电量
|
|
*/
|
|
*/
|
|
- private void calFdl() {
|
|
|
|
|
|
+ public void calFdl() {
|
|
|
|
+ if (null != lastCalDate || LocalDate.now().equals(lastCalDate) || !yfdlCal.isEmpty()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
DecimalFormat df = new DecimalFormat("#.##");
|
|
|
|
+ LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
|
|
QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
currentqw.select("station_id,SUM(rfdl) AS rfdl,sum(llfdl) as llfdl")
|
|
currentqw.select("station_id,SUM(rfdl) AS rfdl,sum(llfdl) as llfdl")
|
|
.ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfYear())) // 大于等于今年的第一天
|
|
.ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfYear())) // 大于等于今年的第一天
|
|
- .lt("record_date", LocalDate.now().atStartOfDay().toLocalDate()) // 小于今天0点的日期
|
|
|
|
- .like("station_id", "_FDC_%") // 模糊查询 station_id
|
|
|
|
|
|
+ .lt("record_date", yesterday) // 小于今天0点的日期
|
|
|
|
+ .like("station_id", "_FDC_%")
|
|
.groupBy("station_id");
|
|
.groupBy("station_id");
|
|
- List<TurbineInfoDay> monthData = iTurbineInfoDayService.list(currentqw);
|
|
|
|
- yfdlCal = new BigDecimal(df.format(monthData.get(0).getRfdl()));
|
|
|
|
- yllfdlCal = new BigDecimal(df.format(monthData.get(0).getLlfdl()));
|
|
|
|
|
|
+ List<TurbineInfoDay> yearData = iTurbineInfoDayService.list(currentqw);
|
|
|
|
+ Integer intYear = LocalDate.now().getYear();
|
|
|
|
+ nfdlCal.put(intYear, new BigDecimal(df.format(yearData.get(0).getRfdl())));
|
|
|
|
+ nllfdlCal.put(intYear, new BigDecimal(df.format(yearData.get(0).getLlfdl())));
|
|
currentqw.clear();
|
|
currentqw.clear();
|
|
currentqw.select("station_id,MAX(record_date) AS record_date,SUM(rfdl) AS rfdl,SUM(llfdl) as llfdl")
|
|
currentqw.select("station_id,MAX(record_date) AS record_date,SUM(rfdl) AS rfdl,SUM(llfdl) as llfdl")
|
|
.ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfMonth())) // 大于等于本月的第一天
|
|
.ge("record_date", LocalDate.now().with(TemporalAdjusters.firstDayOfMonth())) // 大于等于本月的第一天
|
|
- .lt("record_date", LocalDate.now().plusDays(1).atStartOfDay().toLocalDate()) // 小于明天0点的日期
|
|
|
|
- .like("station_id", "_FDC_%") // 模糊查询 station_id
|
|
|
|
|
|
+ .lt("record_date", yesterday) // 小于今天0点的日期
|
|
|
|
+ .like("station_id", "_FDC_%")
|
|
.groupBy("station_id");
|
|
.groupBy("station_id");
|
|
- List<TurbineInfoDay> yearData = iTurbineInfoDayService.list(currentqw);
|
|
|
|
- nfdlCal = new BigDecimal(df.format(yearData.get(0).getRfdl()));
|
|
|
|
- nllfdlCal = new BigDecimal(df.format(yearData.get(0).getLlfdl()));
|
|
|
|
|
|
+ List<TurbineInfoDay> monthData = iTurbineInfoDayService.list(currentqw);
|
|
|
|
+ String yearAndMonth = LocalDate.now().getYear() + "-" + LocalDate.now().getMonthValue();
|
|
|
|
+ yfdlCal.put(yearAndMonth, new BigDecimal(df.format(monthData.get(0).getRfdl())));
|
|
|
|
+ yllfdlCal.put(yearAndMonth, new BigDecimal(df.format(monthData.get(0).getLlfdl())));
|
|
currentqw.clear();
|
|
currentqw.clear();
|
|
- currentqw.select("station_id,SUM(rfdl) AS rfdl,sum(llfdl) as llfdl")
|
|
|
|
|
|
+ lastCalDate = LocalDate.now();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ private Double getWeekFdlCal() {
|
|
|
|
+ LocalDate week = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
|
|
|
+ LocalDate yesterday = LocalDate.now().atStartOfDay().toLocalDate();
|
|
|
|
+ if (week.equals(LocalDate.now())) {
|
|
|
|
+ return generatingCapacity15min.get("日发电量").getValue();
|
|
|
|
+ }
|
|
|
|
+ QueryWrapper<TurbineInfoDay> currentqw = new QueryWrapper<>();
|
|
|
|
+ currentqw.select("station_id,SUM(rfdl) AS rfdl")
|
|
.ge("record_date", LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))) // 大于等于本周一的日期
|
|
.ge("record_date", LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY))) // 大于等于本周一的日期
|
|
- .lt("record_date", LocalDate.now().atStartOfDay().toLocalDate()) // 小于今天0点的日期
|
|
|
|
- .like("station_id", "_FDC_") // 模糊查询 station_id
|
|
|
|
|
|
+ .lt("record_date", yesterday)
|
|
.groupBy("station_id");
|
|
.groupBy("station_id");
|
|
List<TurbineInfoDay> weekData = iTurbineInfoDayService.list(currentqw);
|
|
List<TurbineInfoDay> weekData = iTurbineInfoDayService.list(currentqw);
|
|
if (null == weekData || weekData.isEmpty()) {
|
|
if (null == weekData || weekData.isEmpty()) {
|
|
- weekFdlCal = new BigDecimal("0");
|
|
|
|
- } else {
|
|
|
|
- weekFdlCal = new BigDecimal(df.format(weekData.get(0).getRfdl()));
|
|
|
|
|
|
+ return 0.0;
|
|
}
|
|
}
|
|
- lastCalDate = LocalDate.now();
|
|
|
|
|
|
+ return weekData.get(0).getRfdl().add(new BigDecimal(generatingCapacity15min.get("日发电量").getValue())).doubleValue();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|