|
@@ -1,13 +1,14 @@
|
|
|
package com.gyee.gradeevaluation.service.auto.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.gyee.gradeevaluation.config.R;
|
|
|
import com.gyee.gradeevaluation.model.auto.Benchmark;
|
|
|
import com.gyee.gradeevaluation.mapper.auto.BenchmarkMapper;
|
|
|
+import com.gyee.gradeevaluation.model.auto.Windpowerstation;
|
|
|
import com.gyee.gradeevaluation.service.auto.IBenchmarkService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.gyee.gradeevaluation.util.BigDecimalUtils;
|
|
|
import com.gyee.gradeevaluation.util.DateUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -24,6 +25,10 @@ import java.util.*;
|
|
|
@Service
|
|
|
public class BenchmarkServiceImpl extends ServiceImpl<BenchmarkMapper, Benchmark> implements IBenchmarkService {
|
|
|
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WindpowerstationServiceImpl windpowerstationService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map> zyzb(String windPowerStation) {
|
|
|
Date monthFirst = DateUtils.getMonthFirst(new Date());
|
|
@@ -35,16 +40,21 @@ public class BenchmarkServiceImpl extends ServiceImpl<BenchmarkMapper, Benchmark
|
|
|
"sum(utilizationhours) utilizationhours," +
|
|
|
"avg(availability) availability," +
|
|
|
" sum(mtbf) mtbf,sum(mttr) mttr");
|
|
|
- if (null != windPowerStation && !"".equals(windPowerStation)) {
|
|
|
+ if (null != windPowerStation && !"".equals(windPowerStation) && !"0".equals(windPowerStation)) {
|
|
|
wrapper.eq("foreignkeyid", windPowerStation);
|
|
|
}
|
|
|
+
|
|
|
wrapper.ge("recorddate", monthFirst).le("recorddate", monthLast);
|
|
|
wrapper.groupBy("foreignkeyid");
|
|
|
List<Benchmark> resultlist = this.list(wrapper);
|
|
|
List<Map> list = new ArrayList<>();
|
|
|
resultlist.stream().forEach(i -> {
|
|
|
Map m = new HashMap();
|
|
|
- m.put("foreignkeyid", i.getForeignkeyid());
|
|
|
+
|
|
|
+ Windpowerstation st = windpowerstationService.getById(i.getForeignkeyid());
|
|
|
+ m.put("foreignkeyid", i.getForeignkeyid());//场站
|
|
|
+ m.put("name", st.getName());//场站name
|
|
|
+ //
|
|
|
if (i.getTheoreticalpower().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
m.put("actualpower", (BigDecimalUtils.divide(i.getActualpower(), i.getTheoreticalpower(), 2).multiply(new BigDecimal(100))));
|
|
|
} else {
|