Explorar el Código

新经济运行报告代码提交

王波 hace 6 meses
padre
commit
41340c1158
Se han modificado 34 ficheros con 2880 adiciones y 10 borrados
  1. 292 0
      generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFittwoService.java
  2. 26 3
      runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/EarlyWarning/EarlyWarningController.java
  3. 25 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/LossInfo.java
  4. 54 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/LossRates.java
  5. 18 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/PerformanceEntry.java
  6. 66 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/TurbineStats.java
  7. 18 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/TurbineSums.java
  8. 41 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/benchmark.java
  9. 52 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/comprehensive.java
  10. 22 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/information.java
  11. 31 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/performance.java
  12. 3 3
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/EarlyWarninggetService.java
  13. 649 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/GetWindReportService.java
  14. 792 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/WindReportService.java
  15. 4 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/IStationInfoMonthService.java
  16. 4 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconCurveFittMonthMainService.java
  17. 4 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconEquipmentInfoDay4Service.java
  18. 7 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconEquipmentInfoDay5Service.java
  19. 6 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconFaultLiminatedefectsService.java
  20. 5 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconInOrOutSpeedTotalService.java
  21. 5 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconPowerstationInfoDay4Service.java
  22. 6 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconWindturbineGoodnessService.java
  23. 5 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IStationInfoDayService.java
  24. 24 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ITurbineInfoDayService.java
  25. 16 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconCurveFittMonthMainServiceImpl.java
  26. 11 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconEquipmentInfoDay4ServiceImpl.java
  27. 90 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconEquipmentInfoDay5ServiceImpl.java
  28. 42 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconFaultLiminatedefectsServiceImpl.java
  29. 58 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconInOrOutSpeedTotalServiceImpl.java
  30. 54 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconPowerstationInfoDay4ServiceImpl.java
  31. 66 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconWindturbineGoodnessServiceImpl.java
  32. 37 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/StationInfoDayServiceImpl.java
  33. 305 0
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TurbineInfoDayServiceImpl.java
  34. 42 4
      runeconomy-xk/src/main/java/com/gyee/runeconomy/service/impl/StationInfoMonthServiceImpl.java

+ 292 - 0
generationXK-service/src/main/java/com/gyee/generation/service/GoodnessOfFittwoService.java

@@ -0,0 +1,292 @@
+package com.gyee.generation.service;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.generation.init.CacheContext;
+import com.gyee.generation.model.auto.ProBasicEquipment;
+import com.gyee.generation.model.auto.ProEconWtCurveFittingMonth;
+import com.gyee.generation.model.auto.TurbineInfoMin;
+import com.gyee.generation.model.vo.CurveType;
+import com.gyee.generation.model.vo.FitClassVo;
+import com.gyee.generation.service.auto.IProEconWtCurveFittingMonthService;
+import com.gyee.generation.service.auto.ITurbineInfoMinService;
+import com.gyee.generation.util.DateUtils;
+import com.gyee.generation.util.StringUtils;
+import com.gyee.generation.util.realtimesource.IEdosUtil;
+import com.gyee.generation.util.redis.RedisService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+
+@Service
+public class GoodnessOfFittwoService {
+
+
+    //    private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(GoodnessOfFitService.class);
+    @Resource
+    private IEdosUtil edosUtil;
+    @Resource
+    private IProEconWtCurveFittingMonthService proEconWtCurveFittingMonthService;
+    @Resource
+    private RedisService redisService;
+    @Resource
+    private ITurbineInfoMinService turbineInfoMinService;
+
+    public Map<String, Map<String, Double>> goodnessOfFit(String wtId, Date nowDate) throws Exception {
+        Date endDate = DateUtils.truncate(nowDate);
+        Date startDate = DateUtils.addDays(nowDate, -1);
+
+        Calendar c = Calendar.getInstance();
+        c.setTime(startDate);
+        String year = String.valueOf(c.get(Calendar.YEAR));
+        String month = String.valueOf(c.get(Calendar.MONTH) + 1);
+
+        c.setTime(nowDate);
+        c.set(Calendar.DAY_OF_MONTH, 1);
+        Date startDateM = c.getTime();
+        c.set(Calendar.MONTH, 0);
+        Date startDateY = c.getTime();
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String beginDateString = sdf.format(startDate);
+        String endDateString = sdf.format(endDate);
+        String startDateMString = sdf.format(startDateM);
+        String startDateYString = sdf.format(startDateY);
+
+        Map<String, Map<String, Double>> resultmap = new HashMap<>();
+        Map<String, FitClassVo> theMapY = new HashMap<>();
+        Map<String, FitClassVo> theMapM = new HashMap<>();
+        Map<String, FitClassVo> theMapD = new HashMap<>();
+        List<FitClassVo> theListY = new ArrayList<>();
+        List<FitClassVo> theListM = new ArrayList<>();
+        List<FitClassVo> theListD = new ArrayList<>();
+
+        List<ProEconWtCurveFittingMonth> powerList = new ArrayList<>();
+        if (redisService.hasKey(CurveType.monthCurve.id + "_" + wtId)) {
+            String cp0String = redisService.get(CurveType.monthCurve.id + "_" + wtId);
+            powerList = JSONObject.parseObject(cp0String, new TypeReference<List<ProEconWtCurveFittingMonth>>() {});
+        } else {
+            QueryWrapper<ProEconWtCurveFittingMonth> queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("year", year).eq("month", month).eq("windturbine_id", wtId);
+            powerList = proEconWtCurveFittingMonthService.list(queryWrapper);
+        }
+
+        ProBasicEquipment wt = CacheContext.wtmap.get(wtId);
+
+        List<FitClassVo> fitsD = new ArrayList<>();
+        List<FitClassVo> fitsM = new ArrayList<>();
+        List<FitClassVo> fitsY = new ArrayList<>();
+
+        List<TurbineInfoMin> dayinfoMins = turbineInfoMinService.selectByTurbineId(wt.getId(), beginDateString, endDateString);
+        if (!dayinfoMins.isEmpty()) {
+            for (TurbineInfoMin min : dayinfoMins) {
+                FitClassVo po = new FitClassVo();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+                po.setSpeed(StringUtils.round(min.getPjfs(), 2));
+                po.setPower(StringUtils.round(min.getPjgl(), 2));
+                fitsD.add(po);
+            }
+        }
+
+        List<TurbineInfoMin> monthinfoMins = turbineInfoMinService.selectByTurbineId(wt.getId(), startDateMString, endDateString);
+        if (!monthinfoMins.isEmpty()) {
+            for (TurbineInfoMin min : monthinfoMins) {
+                FitClassVo po = new FitClassVo();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+                po.setSpeed(StringUtils.round(min.getPjfs(), 2));
+                po.setPower(StringUtils.round(min.getPjgl(), 2));
+                fitsM.add(po);
+            }
+        }
+
+        List<TurbineInfoMin> yearMins = turbineInfoMinService.selectByTurbineId(wt.getId(), startDateYString, endDateString);
+        if (!yearMins.isEmpty()) {
+            for (TurbineInfoMin min : yearMins) {
+                FitClassVo po = new FitClassVo();
+                po.setWindturbineId(wt.getId());
+                po.setModelId(wt.getModelId());
+                po.setWindpowerstationId(wt.getWindpowerstationId());
+                po.setSpeed(StringUtils.round(min.getPjfs(), 2));
+                po.setPower(StringUtils.round(min.getPjgl(), 2));
+                fitsY.add(po);
+            }
+        }
+
+
+        buildList(theMapY, theListY, wt.getWindpowerstationId(), fitsY, powerList);
+
+
+        buildList(theMapM, theListM, wt.getWindpowerstationId(), fitsM, powerList);
+
+
+        buildList(theMapD, theListD, wt.getWindpowerstationId(), fitsD, powerList);
+
+
+        normalizeResults(theListY);
+        normalizeResults(theListM);
+        normalizeResults(theListD);
+
+        theMapY.forEach((key, value) -> {
+            if (resultmap.containsKey(key)) {
+                Map<String, Double> tempmap = resultmap.get(key);
+                tempmap.put("year", value.getPower() > 1 ? 1 : StringUtils.round(value.getPower(), 2));
+                resultmap.put(key, tempmap);
+            } else {
+                Map<String, Double> tempmap = new HashMap<>();
+                tempmap.put("year", value.getPower() > 1 ? 1 : StringUtils.round(value.getPower(), 2));
+                resultmap.put(key, tempmap);
+            }
+        });
+
+        theMapM.forEach((key, value) -> {
+            if (resultmap.containsKey(key)) {
+                Map<String, Double> tempmap = resultmap.get(key);
+                tempmap.put("month", value.getPower() > 1 ? 1 : StringUtils.round(value.getPower(), 2));
+                resultmap.put(key, tempmap);
+            } else {
+                Map<String, Double> tempmap = new HashMap<>();
+                tempmap.put("month", value.getPower() > 1 ? 1 : StringUtils.round(value.getPower(), 2));
+                resultmap.put(key, tempmap);
+            }
+        });
+
+        theMapD.forEach((key, value) -> {
+            if (resultmap.containsKey(key)) {
+                Map<String, Double> tempmap = resultmap.get(key);
+                tempmap.put("day", value.getPower() > 1 ? 1 : StringUtils.round(value.getPower(), 2));
+                resultmap.put(key, tempmap);
+            } else {
+                Map<String, Double> tempmap = new HashMap<>();
+                tempmap.put("day", value.getPower() > 1 ? 1 : StringUtils.round(value.getPower(), 2));
+                resultmap.put(key, tempmap);
+            }
+        });
+
+
+
+        return resultmap;
+    }
+
+
+    private void buildList(Map<String, FitClassVo> theMap, List<FitClassVo> theList, String windpowerstationId,
+                           List<FitClassVo> fits, List<ProEconWtCurveFittingMonth> powerList) {
+
+        for (FitClassVo item : fits) {
+            FitClassVo itemCopy = cloneFitClassVo(item);
+            Double speed = StringUtils.round(itemCopy.getSpeed(), 1);
+            String windturbineId = itemCopy.getWindturbineId();
+
+
+            Double epower = null;
+            if (CacheContext.theoreticalPowerMap.containsKey(itemCopy.getModelId())
+                    && !CacheContext.theoreticalPowerMap.get(itemCopy.getModelId()).isEmpty()) {
+                if (CacheContext.theoreticalPowerMap.get(itemCopy.getModelId()).containsKey(speed)) {
+                    epower = CacheContext.theoreticalPowerMap.get(itemCopy.getModelId()).get(speed).getEnsurePower();
+                }
+            }
+
+            if (epower == null && powerList != null && !powerList.isEmpty()) {
+                Double finalSpeed = speed;
+                OptionalDouble tempp = powerList.stream()
+                        .filter(i -> Objects.equals(i.getSpeed(), finalSpeed) && i.getWindturbineId().equals(windturbineId))
+                        .mapToDouble(ProEconWtCurveFittingMonth::getOptimalPower)
+                        .findFirst();
+
+                if (tempp.isPresent()) {
+                    epower = tempp.getAsDouble();
+                } else {
+                    DoubleSummaryStatistics summaryStatistics = powerList.stream()
+                            .filter(i -> i.getWindturbineId().equals(windturbineId))
+                            .mapToDouble(ProEconWtCurveFittingMonth::getSpeed)
+                            .summaryStatistics();
+
+                    double maxSpeed = summaryStatistics.getMax();
+                    if (speed > maxSpeed) {
+                        summaryStatistics = powerList.stream()
+                                .filter(i -> i.getWindturbineId().equals(windturbineId))
+                                .mapToDouble(ProEconWtCurveFittingMonth::getActualPower)
+                                .summaryStatistics();
+                        epower = summaryStatistics.getMax();
+                    }
+                }
+            }
+
+            if (epower != null) {
+                buildtheMap(theMap, theList, windpowerstationId, itemCopy, speed, epower);
+            } else {
+            }
+        }
+    }
+
+    private void buildtheMap(Map<String, FitClassVo> theMap, List<FitClassVo> theList, String windpowerstationId,
+                             FitClassVo item, Double speed, Double epower) {
+        Double value1 = (item.getPower() - epower) * (item.getPower() - epower);
+        Double value2 = item.getPower() * item.getPower();
+
+
+        if (theMap.containsKey(item.getWindturbineId())) {
+            FitClassVo vo = theMap.get(item.getWindturbineId());
+            int number = vo.getNumber();
+            vo.setSpeed(vo.getSpeed() + speed);
+            vo.setPower(vo.getPower() + value1);
+            vo.setEpower(vo.getEpower() + value2);
+            vo.setNumber(number + 1);
+            theMap.put(item.getWindturbineId(), vo);
+        } else {
+            FitClassVo fit = new FitClassVo();
+            fit.setWindturbineId(item.getWindturbineId());
+            fit.setWindpowerstationId(windpowerstationId);
+            fit.setModelId(item.getModelId());
+            fit.setSpeed(speed);
+            fit.setPower(value1);
+            fit.setEpower(value2);
+            fit.setNumber(1);
+            theList.add(fit);
+            theMap.put(item.getWindturbineId(), fit);
+        }
+    }
+
+    private void normalizeResults(List<FitClassVo> theList) {
+        for (FitClassVo item : theList) {
+            double rnew = 0;
+            double speed = 0;
+
+            if (item.getEpower() != 0) {
+                rnew = Math.sqrt(item.getPower() / item.getEpower());
+            }
+            if (item.getNumber() != 0) {
+                speed = item.getSpeed() / item.getNumber();
+            }
+            item.setSpeed(speed);
+            item.setPower(rnew);
+
+
+        }
+    }
+
+
+
+    private FitClassVo cloneFitClassVo(FitClassVo original) {
+        FitClassVo clone = new FitClassVo();
+        clone.setWindturbineId(original.getWindturbineId());
+        clone.setWindpowerstationId(original.getWindpowerstationId());
+        clone.setModelId(original.getModelId());
+        clone.setSpeed(original.getSpeed());
+        clone.setPower(original.getPower());
+        clone.setEpower(original.getEpower());
+        clone.setNumber(original.getNumber());
+        return clone;
+    }
+
+}
+

+ 26 - 3
runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/EarlyWarning/EarlyWarningController.java

@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 
 import com.gyee.runeconomy.dto.result.JsonResult;
 import com.gyee.runeconomy.dto.result.ResultCode;
-import com.gyee.runeconomy.service.EarlyWarning.EarlyWarningReliableService;
-import com.gyee.runeconomy.service.EarlyWarning.EarlyWarninggetService;
-import com.gyee.runeconomy.service.EarlyWarning.ReportService;
+import com.gyee.runeconomy.service.EarlyWarning.*;
 import com.gyee.runeconomy.service.Weather.WertherForecast;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -37,6 +35,9 @@ public class EarlyWarningController {
     @Autowired
     private WertherForecast wertherForecast;
 
+    @Autowired
+    private GetWindReportService getWindReportService;
+
     @GetMapping(value = "/reporkkxwt")
     @ApiOperation(value = "预警分析报告-可靠性问题", notes = "预警分析报告—可靠性问题")
     public JSONObject getinformationkkx() throws Exception {
@@ -86,6 +87,28 @@ public class EarlyWarningController {
 
     }
 
+    @GetMapping(value = "/getwindreport")
+    @ApiOperation(value = "经济运行分析报告", notes = "经济运行分析报告")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpid", value = "风机", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "time", value = "时间", required = true, dataType = "string", paramType = "query")
+    })
+    public JSONObject getwindreportone(String wpid,String time) throws Exception {
+
+        Map<String, Object> map = new HashMap<>();
+        if (!wpid.isEmpty()) {
+            map = getWindReportService.Electricity(wpid,time);
+        } else {
+            wpid = "NX_FGS_HA_FDC_STA";
+            map = getWindReportService.Electricity(wpid,time);
+        }
+        if (map.size() > 0) {
+            return JsonResult.successData(ResultCode.SUCCESS, map);
+        } else {
+            return JsonResult.error(500, "该月份没有数据");
+        }
+
+    }
     @GetMapping(value = "/weather")
     @ApiOperation(value = "天气", notes = "天气")
     public JSONObject getweather() throws Exception {

+ 25 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/LossInfo.java

@@ -0,0 +1,25 @@
+package com.gyee.runeconomy.dto.report;
+
+/**
+ * 封装损失电量信息
+ */
+public class LossInfo {
+
+    private final String type;
+    private final double value;
+
+    // 构造函数需要声明为 public,以便其他包(如 service)可以访问
+    public LossInfo(String type, double value) {
+        this.type = type;
+        this.value = value;
+    }
+
+    // Getter 方法同样需要是 public
+    public String getType() {
+        return type;
+    }
+
+    public double getValue() {
+        return value;
+    }
+}

+ 54 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/LossRates.java

@@ -0,0 +1,54 @@
+package com.gyee.runeconomy.dto.report;
+
+public class LossRates {
+
+    private String sslx;
+
+    private double zssdl;
+
+    private double zssl;
+
+    private double dtpjss;
+
+    private double tbbh;
+
+    public String getSslx() {
+        return sslx;
+    }
+
+    public void setSslx(String sslx) {
+        this.sslx = sslx;
+    }
+
+    public double getZssdl() {
+        return zssdl;
+    }
+
+    public void setZssdl(double zssdl) {
+        this.zssdl = zssdl;
+    }
+
+    public double getZssl() {
+        return zssl;
+    }
+
+    public void setZssl(double zssl) {
+        this.zssl = zssl;
+    }
+
+    public double getDtpjss() {
+        return dtpjss;
+    }
+
+    public void setDtpjss(double dtpjss) {
+        this.dtpjss = dtpjss;
+    }
+
+    public double getTbbh() {
+        return tbbh;
+    }
+
+    public void setTbbh(double tbbh) {
+        this.tbbh = tbbh;
+    }
+}

+ 18 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/PerformanceEntry.java

@@ -0,0 +1,18 @@
+package com.gyee.runeconomy.dto.report;
+
+public class PerformanceEntry {
+    private String turbineName;
+    private Double value;
+
+    public PerformanceEntry(String turbineName, Double value) {
+        this.turbineName = turbineName;
+        this.value = value;
+    }
+    // getters and setters ...
+    public String getTurbineName() { return turbineName; }
+    public Double getValue() { return value; }
+
+    public void setTurbineName(String turbineName) {
+        this.turbineName = turbineName;
+    }
+}

+ 66 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/TurbineStats.java

@@ -0,0 +1,66 @@
+package com.gyee.runeconomy.dto.report;
+
+/**
+ * 用于封装单台风机的统计数据
+ */
+public class TurbineStats {
+
+    private String turbineId;
+    private double totalRfdl; // 单位: 万kWh
+    private double totalssdl; // 单位: 万kWh
+    private double avgKlyl;   // 单位: %
+    private double avgfnlyl;   // 单位: %
+
+
+    public TurbineStats(String turbineId,  double totalRfdl,double totalssdl, double avgKlyl, double avgfnlyl) {
+        this.turbineId = turbineId;
+        this.totalRfdl = totalRfdl;
+        this.totalssdl = totalssdl;
+        this.avgKlyl = avgKlyl;
+        this.avgfnlyl = avgfnlyl;
+
+    }
+
+
+    // Getter 方法
+
+    public String getTurbineId() {
+        return turbineId;
+    }
+
+    public void setTurbineId(String turbineId) {
+        this.turbineId = turbineId;
+    }
+
+    public double getTotalRfdl() {
+        return totalRfdl;
+    }
+
+    public void setTotalRfdl(double totalRfdl) {
+        this.totalRfdl = totalRfdl;
+    }
+
+    public double getTotalssdl() {
+        return totalssdl;
+    }
+
+    public void setTotalssdl(double totalssdl) {
+        this.totalssdl = totalssdl;
+    }
+
+    public double getAvgKlyl() {
+        return avgKlyl;
+    }
+
+    public void setAvgKlyl(double avgKlyl) {
+        this.avgKlyl = avgKlyl;
+    }
+
+    public double getAvgfnlyl() {
+        return avgfnlyl;
+    }
+
+    public void setAvgfnlyl(double avgfnlyl) {
+        this.avgfnlyl = avgfnlyl;
+    }
+}

+ 18 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/TurbineSums.java

@@ -0,0 +1,18 @@
+package com.gyee.runeconomy.dto.report;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@Getter
+@AllArgsConstructor
+public class TurbineSums {
+    private final double slssSum;
+    private final double xnssSum;
+    private final double xdssSum;
+    private final double jxssSum;
+    private final double fjhjxssSum;
+    private final double fnlyl;
+    private final double llfdl;
+    private final double fdl;
+}

+ 41 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/benchmark.java

@@ -0,0 +1,41 @@
+package com.gyee.runeconomy.dto.report;
+
+public class benchmark {
+
+    /**
+     * 对标对象
+     */
+    private String targets;
+    /**
+     * 对标内容
+     */
+    private String indicator;
+    /**
+     * 对标结论
+     */
+    private String conclusion;
+
+    public String getTargets() {
+        return targets;
+    }
+
+    public void setTargets(String targets) {
+        this.targets = targets;
+    }
+
+    public String getIndicator() {
+        return indicator;
+    }
+
+    public void setIndicator(String indicator) {
+        this.indicator = indicator;
+    }
+
+    public String getConclusion() {
+        return conclusion;
+    }
+
+    public void setConclusion(String conclusion) {
+        this.conclusion = conclusion;
+    }
+}

+ 52 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/comprehensive.java

@@ -0,0 +1,52 @@
+package com.gyee.runeconomy.dto.report;
+
+public class comprehensive {
+    /**
+     * 分类
+     */
+    private String category;
+    /**
+     * 月增长率
+     */
+    private double month_zzl;
+    /**
+     * 年增长率
+     */
+    private double year_zzl;
+    /**
+     * 趋势
+     */
+    private String trend;
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public double getMonth_zzl() {
+        return month_zzl;
+    }
+
+    public void setMonth_zzl(double month_zzl) {
+        this.month_zzl = month_zzl;
+    }
+
+    public double getYear_zzl() {
+        return year_zzl;
+    }
+
+    public void setYear_zzl(double year_zzl) {
+        this.year_zzl = year_zzl;
+    }
+
+    public String getTrend() {
+        return trend;
+    }
+
+    public void setTrend(String trend) {
+        this.trend = trend;
+    }
+}

+ 22 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/information.java

@@ -0,0 +1,22 @@
+package com.gyee.runeconomy.dto.report;
+
+public class information {
+    private String category;
+    private String content;
+
+    public String getCategory() {
+        return category;
+    }
+
+    public void setCategory(String category) {
+        this.category = category;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+}

+ 31 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/dto/report/performance.java

@@ -0,0 +1,31 @@
+package com.gyee.runeconomy.dto.report;
+
+public class performance {
+    private String dbwd;
+    private  String top;
+    private String bottom;
+
+    public String getDbwd() {
+        return dbwd;
+    }
+
+    public void setDbwd(String dbwd) {
+        this.dbwd = dbwd;
+    }
+
+    public String getTop() {
+        return top;
+    }
+
+    public void setTop(String top) {
+        this.top = top;
+    }
+
+    public String getBottom() {
+        return bottom;
+    }
+
+    public void setBottom(String bottom) {
+        this.bottom = bottom;
+    }
+}

+ 3 - 3
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/EarlyWarninggetService.java

@@ -76,15 +76,15 @@ public class EarlyWarninggetService {
         /*********************** 构造筛选结果 ************************/
         String wdl = iskkx.stream()
                 .filter(i -> "是".equals(i.getReliabilityIssue()) && i.getReliabilityIs() == 1)
-                .map(ReliabilityIssues::getTurbineId).sorted().collect(Collectors.joining(","));
+                .map(ReliabilityIssues::getTurbineId).sorted().collect(Collectors.joining(","));//温度类筛选
 
         String ztl = iskkx.stream()
                 .filter(i -> "是".equals(i.getReliabilityIssue()) && i.getReliabilityIs() == 2)
-                .map(ReliabilityIssues::getTurbineId).sorted().collect(Collectors.joining(","));
+                .map(ReliabilityIssues::getTurbineId).sorted().collect(Collectors.joining(","));//状态类筛选
 
         String ztwdl = iskkx.stream()
                 .filter(i -> "是".equals(i.getReliabilityIssue()) && i.getReliabilityIs() == 3)
-                .map(ReliabilityIssues::getTurbineId).sorted().collect(Collectors.joining(","));
+                .map(ReliabilityIssues::getTurbineId).sorted().collect(Collectors.joining(","));//温度状态类筛选
 
         StringBuilder sxjgBuilder = new StringBuilder();
         if (!wdl.isEmpty()) sxjgBuilder.append("以下风机存在温度类隐患:").append(wdl).append("\n");

+ 649 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/GetWindReportService.java

@@ -0,0 +1,649 @@
+package com.gyee.runeconomy.service.EarlyWarning;
+
+import com.gyee.runeconomy.dto.report.*;
+import com.gyee.runeconomy.entity.StationInfoMonth;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.ProBasicEquipment;
+import com.gyee.runeconomy.model.auto.ProBasicPowerstation;
+import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay4;
+import com.gyee.runeconomy.model.auto.TurbineInfoDay;
+import com.gyee.runeconomy.service.IStationInfoMonthService;
+import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay4Service;
+import com.gyee.runeconomy.service.auto.ITurbineInfoDayService;
+import com.gyee.runeconomy.util.StringUtils;
+import lombok.var;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Stream;
+
+@Service
+public class GetWindReportService {
+
+    @Autowired
+    private ITurbineInfoDayService turbineInfoDayService;
+    @Resource
+    private IProEconPowerstationInfoDay4Service proEconPowerstationInfoDay4Service;
+    @Resource
+    private IStationInfoMonthService stationInfoMonthService;
+    @Autowired
+    private WindReportService windReportService;
+
+    public Map<String, Object> Electricity(String wpid, String time) throws Exception {
+        Map<String, Object> map = new LinkedHashMap<>();
+
+        //获取场站信息
+        ProBasicPowerstation stationInfo = CacheContext.wpls.stream()
+                .filter(wt -> wpid.equals(wt.getId()))
+                .findFirst()
+                .orElse(null); // 使用orElse(null)或适当的异常处理
+
+        List<ProBasicEquipment> wtls = CacheContext.wtls;
+
+        map.put("Station_information", stationInfo);//场站信息
+
+        int bl = 1000;
+        //当月数据
+        List<TurbineInfoDay> monthList = turbineInfoDayService.monthList(time);
+        List<TurbineInfoDay> top3list = turbineInfoDayService.topList(time);
+        List<TurbineInfoDay> fntop3list = turbineInfoDayService.fntopList(time);
+        List<TurbineInfoDay> ssdltop3list = turbineInfoDayService.ssdltopList(time);
+        List<TurbineInfoDay> bottom3list = turbineInfoDayService.bottomList(time);
+        List<TurbineInfoDay> fnbottom3list = turbineInfoDayService.fnbottomList(time);
+        List<TurbineInfoDay> ssdlbottom3list = turbineInfoDayService.ssdlbottomList(time);
+        List<TurbineInfoDay> linedlList = turbineInfoDayService.lineList(time);
+
+        List<ProEconPowerstationInfoDay4> dyList = proEconPowerstationInfoDay4Service.dyList(time);
+        List<StationInfoMonth> monthslist = stationInfoMonthService.monthslist(time);
+        //去年当月数据
+        List<TurbineInfoDay> qnmonthList = turbineInfoDayService.qnmonthList(time);
+        List<ProEconPowerstationInfoDay4> qndymttList = proEconPowerstationInfoDay4Service.qndymttList(time);
+        List<StationInfoMonth> qndylist = stationInfoMonthService.qndylist(time);
+
+        //当年数据
+        List<TurbineInfoDay> yearList = turbineInfoDayService.yearList(time);
+        List<ProEconPowerstationInfoDay4> yearmttrList = proEconPowerstationInfoDay4Service.yearmttrList(time);
+        List<StationInfoMonth> yearlist = stationInfoMonthService.yearlist(time);
+
+        // 查询上一年度相同时间段
+        List<TurbineInfoDay> qyearList = turbineInfoDayService.qyearList(time);
+        List<ProEconPowerstationInfoDay4> qnmttList = proEconPowerstationInfoDay4Service.qnmttList(time);
+        List<StationInfoMonth> qnmttlist = stationInfoMonthService.qnmttlist(time);
+
+        setTurbineIdFromNemCode(wtls, top3list);
+        setTurbineIdFromNemCode(wtls, fntop3list);
+        setTurbineIdFromNemCode(wtls, ssdltop3list);
+        setTurbineIdFromNemCode(wtls, bottom3list);
+        setTurbineIdFromNemCode(wtls, fnbottom3list);
+        setTurbineIdFromNemCode(wtls, ssdlbottom3list);
+
+        //周期数据
+        double zqpjfs = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getPjfs(), 2) : 0.0;
+        double zqklyl = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getKlyl(), 0) : 0.0;
+        double zqfdl = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getRfdl() / bl, 2) : 0.0;
+        double zqxdss = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getXdss() / bl, 2) : 0.0;
+        double zqjxss = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getJhjxss() / bl, 2) : 0.0;
+        double zqfjhjxss = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getFjhjxss() / bl, 2) : 0.0;
+        double zdxnss = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getXnss() / bl, 2) : 0.0;
+        double zqslss = monthList.size() > 0 ? StringUtils.round(monthList.get(0).getSlss() / bl, 2) : 0.0;
+        double zssdl = StringUtils.round(zqxdss + zqjxss + zqfjhjxss + zdxnss + zqslss, 2);
+
+        information mation = new information();
+        mation.setCategory("周期内核心数据");
+        mation.setContent("平均风速:" + zqpjfs + "m/s;场站总发电量:" + zqfdl + "万kWh\n" +
+                "50台风机平均可利用率:" + zqklyl + "%;总损失电量:" + zssdl + "万kWh\n" +
+                "单台平均发电量:" + StringUtils.round(zqfdl / 50, 2) + "万kWh");
+
+        // 平均值变量
+        double fdlavgtop3 = 0.0;
+        double avgklyltop3 = 0.0;
+        double avgknlylbottom3 = 0.0;
+        double fdlavgbottom3 = 0.0;
+
+        // ID数组
+        String[] topIds = {"1101", "1102", "1103"};
+        String[] bottomIds = {"1101", "1102", "1103"};
+
+        // 数据数组 - 对应top1fdl, top2fdl, top3fdl等
+        double[] topFdl = new double[3];
+        double[] topLlfdl = new double[3];
+        double[] topGzssdl = new double[3];
+        double[] topJxssdl = new double[3];
+        double[] topXnssdl = new double[3];
+        double[] topXdssdl = new double[3];
+        double[] topSlssdl = new double[3];
+        double[] topFnlyl = new double[3];
+        double[] bottomFdl = new double[3];
+
+        double[] lnfdl = new double[4];
+        double[] lnllfdl = new double[4];
+        double[] lnxdssdl = new double[4];
+        double[] lnzssdl = new double[4];
+        double[] lnfnlyl = new double[4];
+
+        if (linedlList.size() > 0) {
+
+            for (int i = 0; i < linedlList.size(); i++) {
+                var item = linedlList.get(i);
+                lnfdl[i] = StringUtils.round(item.getRfdl() / bl, 2);
+                lnllfdl[i] = StringUtils.round(item.getLlfdl() / bl, 2);
+                lnzssdl[i] = StringUtils.round(item.getGzss() / bl, 2);
+                lnfnlyl[i] = StringUtils.round(item.getFnlyl(), 2);
+                lnxdssdl[i] = StringUtils.round(item.getXdss() / bl, 2);
+            }
+        }
+        double p1fdl = StringUtils.round(lnfdl[0] + lnfdl[1], 2);
+        double p2fdl = StringUtils.round(lnfdl[2] + lnfdl[3], 2);
+        double p1llfdl = StringUtils.round(lnllfdl[0] + lnllfdl[1], 2);
+        double p2llfdl = StringUtils.round(lnllfdl[2] + lnllfdl[3], 2);
+        double p1ssdl = StringUtils.round(lnzssdl[0] + lnzssdl[1], 2);
+        double p2ssdl = StringUtils.round(lnzssdl[2] + lnzssdl[3], 2);
+        double p1fnlyl = StringUtils.round((lnfnlyl[0] + lnfnlyl[1]) / 2, 2);
+        double p2fnlyl = StringUtils.round((lnfnlyl[2] + lnfnlyl[3]) / 2, 2);
+        double p1qfl = StringUtils.round((lnxdssdl[0] + lnxdssdl[1]) / p1llfdl, 2);
+        double p2qfl = StringUtils.round((lnxdssdl[2] + lnxdssdl[3]) / p2llfdl, 2);
+
+        // 处理top3list数据
+        if (top3list.size() > 0) {
+            // 计算平均值
+            double totalRfdl = 0.0;
+            double totalKlyl = 0.0;
+
+            for (int i = 0; i < top3list.size(); i++) {
+                var item = top3list.get(i);
+                topIds[i] = item.getStationId();
+
+                // 计算各项值并赋值
+                topFdl[i] = StringUtils.round(item.getRfdl() / bl, 2);
+                topLlfdl[i] = StringUtils.round(item.getLlfdl() / bl, 2);
+                topGzssdl[i] = StringUtils.round(item.getFjhjxss() / bl, 2);
+                topJxssdl[i] = StringUtils.round(item.getJhjxss() / bl, 2);
+                topXnssdl[i] = StringUtils.round(item.getXnss() / bl, 2);
+                topXdssdl[i] = StringUtils.round(item.getXdss() / bl, 2);
+                topSlssdl[i] = StringUtils.round(item.getSlss() / bl, 2);
+                topFnlyl[i] = StringUtils.round(item.getFnlyl(), 2);
+
+                // 累加计算平均值
+                totalRfdl += item.getRfdl();
+                totalKlyl += item.getKlyl();
+            }
+
+
+            // 计算最终平均值
+            fdlavgtop3 = StringUtils.round((totalRfdl / bl) / 3, 2);
+            avgklyltop3 = StringUtils.round(totalKlyl / 3, 0);
+        }
+        double top1ssdl = StringUtils.round(topXdssdl[0] + topJxssdl[0] + topGzssdl[0] + topXnssdl[0] + topSlssdl[0], 2);
+        double top3ssdl = StringUtils.round(topXdssdl[2] + topJxssdl[2] + topGzssdl[2] + topXnssdl[2] + topSlssdl[2], 2);
+        // 处理bottom3list数据
+        if (bottom3list.size() > 0) {
+            double totalRfdl = 0.0;
+            double totalKlyl = 0.0;
+
+            for (int i = 0; i < bottom3list.size(); i++) {
+                var item = bottom3list.get(i);
+                bottomIds[i] = item.getStationId();
+                bottomFdl[i] = StringUtils.round(item.getRfdl() / bl, 2);
+
+                totalRfdl += item.getRfdl();
+                totalKlyl += item.getKlyl();
+            }
+
+            fdlavgbottom3 = StringUtils.round((totalRfdl / bl) / 3, 2);
+            avgknlylbottom3 = StringUtils.round(totalKlyl / 3, 0);
+        }
+
+
+        double maxValue = 0.0;
+        String zyss = "";
+        double percentage = 0.0;
+        if (monthList.size() > 0) {
+            // 获取五个值
+            double jhjxss = monthList.get(0).getJhjxss();
+            double fjhjxss = monthList.get(0).getFjhjxss();
+            double xdss = monthList.get(0).getXdss();
+            double slss = monthList.get(0).getSlss();
+            double xnss = monthList.get(0).getXnss();
+
+            // 找出最大值
+            maxValue = Stream.of(jhjxss, fjhjxss, xdss, slss, xnss)
+                    .max(Double::compare)
+                    .orElse(0.0);
+
+            // 计算五个值的总和
+            double total = jhjxss + fjhjxss + xdss + slss + xnss;
+
+            // 计算最大值在总和中的占比(百分比)
+            percentage = total > 0 ? StringUtils.round((maxValue / total) * 100, 2) : 0.0;
+
+            // 确定最大值对应的中文名称
+            zyss =
+                    maxValue == jhjxss ? "检修损失电量" :
+                            maxValue == fjhjxss ? "故障损失电量" :
+                                    maxValue == xdss ? "限电损失电量" :
+                                            maxValue == slss ? "受累损失" : "性能损失电量";
+        }
+
+        information mation1 = new information();
+        mation1.setCategory("核心结论");
+        mation1.setContent("1. 性能Top3风机:" + topIds[0] + "号、" + topIds[1] + "号、" + topIds[2] + "号(单台平均发电量为" + fdlavgtop3 + "万kWh,平均可利用率为" + avgklyltop3 + "%);\n" +
+                "2. 性能待优化风机(末3):" + bottomIds[0] + "号、" + bottomIds[1] + "号、" + bottomIds[2] + "号(单台平均发电量为" + fdlavgbottom3 + "万kWh,平均可利用率为" + avgknlylbottom3 + "%);\n" +
+                "3. 主要损失类型:" + zyss + "占总损失" + percentage + "%;\n" +
+                "4. 优化建议:优先对" + bottomIds[2] + "号风机开展故障消缺,调整" + bottomIds[2] + "号风机切入切出风速");
+
+        List<information> mations = new ArrayList<>();
+        mations.add(mation);
+        mations.add(mation1);
+        map.put("mations", mations);
+
+        List<performance> performancesls = new ArrayList<>();
+        performance performance = new performance();
+        performance.setDbwd("月度发电量");
+        performance.setTop("1." + topIds[0] + "号:" + topFdl[0] + "万KWh;" +
+                "2." + topIds[1] + "号:" + topFdl[1] + "万KWh;" +
+                "3." + topIds[2] + "号:" + topFdl[2] + "万KWh;");
+        performance.setBottom("1." + bottomIds[0] + "号:" + bottomFdl[0] + "万KWh;" +
+                "2." + bottomIds[1] + "号:" + bottomFdl[1] + "万KWh;" +
+                "3." + bottomIds[2] + "号:" + bottomFdl[2] + "万KWh;");
+
+        performancesls.add(performance);
+
+        performance performance2 = new performance();
+        performance2.setDbwd("月度风能利用率");
+        performance2.setTop("1." + fntop3list.get(0).getStationId() + "号:" + StringUtils.round(fntop3list.get(0).getFnlyl(), 0) + "%;" +
+                "2." + fntop3list.get(1).getStationId() + "号:" + StringUtils.round(fntop3list.get(1).getFnlyl(), 0) + "%;" +
+                "3." + fntop3list.get(2).getStationId() + "号:" + StringUtils.round(fntop3list.get(2).getFnlyl(), 0) + "%;");
+
+        performance2.setBottom("1." + fnbottom3list.get(0).getStationId() + "号:" + StringUtils.round(fnbottom3list.get(0).getFnlyl(), 0) + "%;" +
+                "2." + fnbottom3list.get(1).getStationId() + "号:" + StringUtils.round(fnbottom3list.get(1).getFnlyl(), 0) + "%;" +
+                "3." + fnbottom3list.get(2).getStationId() + "号:" + StringUtils.round(fnbottom3list.get(2).getFnlyl(), 0) + "%;");
+
+        performancesls.add(performance2);
+
+        performance performance3 = new performance();
+        performance3.setDbwd("月度损失电量");
+        performance3.setTop("1." + ssdltop3list.get(0).getStationId() + "号:" + StringUtils.round(ssdltop3list.get(0).getGzss() / bl, 2) + "万KWh;" +
+                "2." + ssdltop3list.get(1).getStationId() + "号:" + StringUtils.round(ssdltop3list.get(1).getGzss() / bl, 2) + "万KWh;" +
+                "3." + ssdltop3list.get(2).getStationId() + "号:" + StringUtils.round(ssdltop3list.get(2).getGzss() / bl, 2) + "万KWh;");
+        performance3.setBottom("1." + ssdlbottom3list.get(0).getStationId() + "号:" + StringUtils.round(ssdlbottom3list.get(0).getGzss() / bl, 2) + "万KWh;" +
+                "2." + ssdlbottom3list.get(1).getStationId() + "号:" + StringUtils.round(ssdlbottom3list.get(1).getGzss() / bl, 2) + "万KWh;" +
+                "3." + ssdlbottom3list.get(2).getStationId() + "号:" + StringUtils.round(ssdlbottom3list.get(2).getGzss() / bl, 2) + "万KWh;");
+
+        performancesls.add(performance3);
+        map.put("performances", performancesls);
+
+        benchmark benchmark1 = new benchmark();
+        benchmark1.setTargets("对标对象:选择" + topIds[0] + "号、" + topIds[1] + "号、" + topIds[2] + "号风机");
+        benchmark1.setIndicator("对标指标:\n" +
+                "          单台发电量:" + topIds[0] + "号" + topFdl[0] + "万KWh、" + topIds[1] + "号" + topFdl[1] + "万KWh、" + topIds[2] + "号" + topIds[2] + "万KWh\n" +
+                "          故障损失电量:" + topIds[0] + "号" + topGzssdl[0] + "万KWh、" + topIds[1] + "号" + topGzssdl[1] + "万KWh、" + topIds[2] + "号" + topGzssdl[2] + "万KWh\n" +
+                "          检修损失电量:" + topIds[0] + "号" + topJxssdl[0] + "万KWh、" + topIds[1] + "号" + topJxssdl[1] + "万KWh、" + topIds[2] + "号" + topJxssdl[2] + "万KWh\n" +
+                "          性能未达标损失电量:" + topIds[0] + "号" + topXnssdl[0] + "万KWh、" + topIds[1] + "号" + topXnssdl[1] + "万KWh、" + topIds[2] + "号" + topXnssdl[2] + "万KWh\n" +
+                "          限电损失电量:" + topIds[0] + "号" + topXdssdl[0] + "万KWh、" + topIds[1] + "号" + topXdssdl[1] + "万KWh、" + topIds[2] + "号" + topXdssdl[2] + "万KWh\n" +
+                "          受累损失电量:" + topIds[0] + "号" + topSlssdl[0] + "万KWh、" + topIds[1] + "号" + topSlssdl[1] + "万KWh、" + topIds[2] + "号" + topSlssdl[2] + "万KWh\n" +
+                "          风能利用率:" + topIds[0] + "号" + topFnlyl[0] + "%、" + topIds[1] + "号" + topFnlyl[1] + "%、" + topIds[2] + "号" + topFnlyl[2] + "%\n" +
+                "          故障损失率:" + topIds[0] + "号" + StringUtils.round(topGzssdl[0] / topLlfdl[0] * 100, 0) + "%、" + topIds[1] + "号" + StringUtils.round(topGzssdl[1] / topLlfdl[1] * 100, 0) + "%、" + topIds[2] + "号" + StringUtils.round(topGzssdl[2] / topLlfdl[2] * 100, 0) + "%\n" +
+                "          检修损失率:" + topIds[0] + "号" + StringUtils.round(topJxssdl[0] / topLlfdl[0] * 100, 0) + "%、" + topIds[1] + "号" + StringUtils.round(topJxssdl[1] / topLlfdl[1] * 100, 0) + "%、" + topIds[2] + "号" + StringUtils.round(topJxssdl[2] / topLlfdl[2] * 100, 0) + "%\n" +
+                "          弃风率:" + topIds[0] + "号" + StringUtils.round(topXdssdl[0] / topLlfdl[0] * 100, 0) + "%、" + topIds[1] + "号" + StringUtils.round(topXdssdl[1] / topLlfdl[1] * 100, 0) + "%、" + topIds[2] + "号" + StringUtils.round(topXdssdl[2] / topLlfdl[2] * 100, 0) + "%");
+
+        benchmark1.setConclusion("对标结论:" + topIds[2] + "号与" + topIds[0] + "号风机核心差异,损失电量差" + StringUtils.round(top1ssdl - top3ssdl, 2) + "万kWh");
+        map.put("cndb", benchmark1);
+
+        String pfdlmax = p1fdl > p2fdl ? "惠安一期项目" : "惠安二期项目";
+        String pfdlmin = p1fdl < p2fdl ? "惠安一期项目" : "惠安二期项目";
+
+
+        benchmark benchmark2 = new benchmark();
+        benchmark2.setTargets("对标项目:惠安一期项目、惠安二期项目");
+        benchmark2.setIndicator("对标指标:\n" +
+                "          项目总发电量:惠安一期项目" + p1fdl + "万kWh、惠安二期项目" + p2fdl + "万kWh\n" +
+                "          项目总损失电量:惠安一期项目" + p1ssdl + "万kWh、惠安二期项目" + p2ssdl + "万kWh\n" +
+                "          项目风能利用率:惠安一期项目" + p1fnlyl + "%、惠安二期项目" + p2fnlyl + "%\n" +
+                "          项目弃风率:惠安一期项目" + p1qfl + "%、惠安二期项目" + p2qfl + "%");
+        benchmark2.setConclusion("对标结论:" + pfdlmax + "在发电量指标上优于" + pfdlmin + ",惠安一期项目与惠安二期项目损失电量差距为" + StringUtils.round(p1ssdl - p2ssdl, 2));
+        map.put("xmdb", benchmark2);
+
+
+        // 根据数值找出对应的项目名称
+        String[] lineNames = {"惠安一号集电线路", "惠安二号集电线路", "惠安三号集电线路", "惠安四号集电线路"};
+
+        int maxIndex = 0;
+        int minIndex = 0;
+
+        for (int i = 1; i < lnfdl.length; i++) {
+            if (lnfdl[i] > lnfdl[maxIndex]) maxIndex = i;
+            if (lnfdl[i] < lnfdl[minIndex]) minIndex = i;
+        }
+
+        String lnfdlmax = lineNames[maxIndex];  // 发电量最高的线路名称
+        String lnfdlmin = lineNames[minIndex];  // 发电量最低的线路名称
+
+        double ssdlmaxValue = Math.max(Math.max(lnzssdl[0], lnzssdl[1]), Math.max(lnzssdl[2], lnzssdl[3]));
+        double ssdlminValue = Math.min(Math.min(lnzssdl[0], lnzssdl[1]), Math.min(lnzssdl[2], lnzssdl[3]));
+
+        benchmark benchmark3 = new benchmark();
+        benchmark3.setTargets("对标线路:惠安一号集电线路、惠安二号集电线路、惠安三号集电线路、惠安四号集电线路");
+        benchmark3.setIndicator("对标指标:\n" +
+                "          线路总发电量:惠安一号集电线路" + lnfdl[0] + "万kWh、惠安二号集电线路" + lnfdl[1] + "万kWh、惠安三号集电线路" + lnfdl[2] + "万kWh、惠安四号集电线路" + lnfdl[3] + "万kWh\n" +
+                "          线路总损失电量:惠安一号集电线路" + lnzssdl[0] + "万kWh、惠安二号集电线路" + lnzssdl[1] + "万kWh、惠安三号集电线路" + lnzssdl[2] + "万kWh、惠安四号集电线路" + lnzssdl[3] + "万kWh\n" +
+                "          线路风能利用率:惠安一号集电线路" + lnfnlyl[0] + "%、惠安二号集电线路" + lnfnlyl[1] + "%、惠安三号集电线路" + lnfnlyl[2] + "%、惠安四号集电线路" + lnfnlyl[3] + "%\n" +
+                "          线路弃风率:惠安一号集电线路" + StringUtils.round(lnxdssdl[0] / lnllfdl[0] * 100, 0) + "%、" +
+                "          惠安二号集电线路" + StringUtils.round(lnxdssdl[1] / lnllfdl[1] * 100, 0) + "%、" +
+                "          惠安三号集电线路" + StringUtils.round(lnxdssdl[2] / lnllfdl[2] * 100, 0) + "%、" +
+                "          惠安四号集电线路" + StringUtils.round(lnxdssdl[3] / lnllfdl[3] * 100, 0) + "%");
+        benchmark3.setConclusion("对标结论:" + lnfdlmax + "在发电量指标上优于" + lnfdlmin + ",损失电量差距为" + StringUtils.round(ssdlmaxValue - ssdlminValue, 2));
+
+        map.put("xldb", benchmark3);
+        double monthllfdl = 0.0;
+        double monthfdl = 0.0;
+        double monthfnlyl = 0.0;
+        double monthgzssl = 0.0;
+        double monthxdssl = 0.0;
+        double monthmtbf = 0.0;
+        double monthmttr = 0.0;
+        double monthyfwjsl = 0.0;
+        double monthxqjsl = 0.0;
+        String yllfdltrend = "red";
+        String yfdltrend = "red";
+        String yfnlyltrend = "red";
+        String yxdsssltrend = "red";
+        String ygzsssltrend = "red";
+        String ymtbftrend = "red";
+        String ymttrtrend = "red";
+        String yfwjsltrend = "red";
+        String yxqjsltrend = "red";
+
+
+        if (monthList.size() > 0) {
+            double llfdl = monthList.size() > 0 ? monthList.get(0).getLlfdl() : 1;
+            double qnllfdl = qnmonthList.size() > 0 ? qnmonthList.get(0).getLlfdl() : 1;
+            double fdl = monthList.size() > 0 ? monthList.get(0).getRfdl() : 0;
+            double qnfdl = qnmonthList.size() > 0 ? qnmonthList.get(0).getRfdl() : 1;
+            double gzss = monthList.size() > 0 ? monthList.get(0).getGzss() : 0;
+            double qngzss = qnmonthList.size() > 0 ? qnmonthList.get(0).getGzss() : 1;
+            double xdss = monthList.size() > 0 ? monthList.get(0).getXdss() : 0;
+            double qnxdss = qnmonthList.size() > 0 ? qnmonthList.get(0).getXdss() : 1;
+            double yfnlyl = fdl / llfdl * 100;
+            double qnmonthfnlyl = qnllfdl > 1 ? qnfdl / qnllfdl * 100 : 0.0;
+            double ymtbf = monthslist.size() > 0 ? monthslist.get(0).getMtbf() : 0;
+            double qnmonthmtbf = qndylist.size() > 0 ? qndylist.get(0).getMtbf() : 0;
+            double ymttr = monthslist.size() > 0 ? monthslist.get(0).getMttr() : 0;
+            double qnmonthmttr = qndylist.size() > 0 ? qndylist.get(0).getMttr() : 0;
+            double yfwjsl = dyList.size() > 0 && dyList.get(0).getYfwjsl() != null
+                    ? dyList.get(0).getYfwjsl().doubleValue()
+                    : 0.0;
+            double qnmonthyfwjsl = qndymttList.size() > 0 && qndymttList.get(0).getYfwjsl() != null
+                    ? qndymttList.get(0).getYfwjsl().doubleValue()
+                    : 0.0;
+            double xqjsl = dyList.size() > 0 && dyList.get(0).getYgzxqjsl() != null
+                    ? dyList.get(0).getYgzxqjsl().doubleValue()
+                    : 0.0;
+            double qnxqjsl = qndymttList.size() > 0 && qndymttList.get(0).getYgzxqjsl() != null
+                    ? qndymttList.get(0).getYgzxqjsl().doubleValue()
+                    : 0.0;
+
+            monthllfdl = StringUtils.round(qnllfdl > 1 ? (llfdl - qnllfdl) / qnllfdl * 100 : 0, 0);
+            monthfdl = StringUtils.round(qnfdl > 1 ? (fdl - qnfdl) / qnfdl * 100 : 0, 0);
+            monthfnlyl = StringUtils.round(qnmonthfnlyl > 1 ? (yfnlyl - qnmonthfnlyl) / qnmonthfnlyl * 100 : 0, 0); //当月风能利用率差
+            monthgzssl = StringUtils.round(qngzss > 1 ? (gzss - qngzss) / qngzss * 100 : 0, 0);
+            monthxdssl = StringUtils.round(qnxdss > 1 ? (xdss - qnxdss) / qnxdss * 100 : 0, 0);
+            monthmtbf = StringUtils.round(qnmonthmtbf > 1 ? (ymtbf - qnmonthmtbf) / qnmonthmtbf * 100 : 0, 0);
+            monthmttr = StringUtils.round(qnmonthmttr > 1 ? (ymttr - qnmonthmttr) / qnmonthmttr * 100 : 0, 0);
+            monthyfwjsl = StringUtils.round(qnmonthyfwjsl > 1 ? (yfwjsl - qnmonthyfwjsl) / qnmonthyfwjsl * 100 : 0, 0);
+            monthxqjsl = StringUtils.round(qnxqjsl > 1 ? (xqjsl - qnxqjsl) / qnxqjsl * 100 : 0, 0);
+
+            yfnlyltrend = yfnlyl > qnmonthfnlyl ? "red" : "green";//月度风能利用率趋势
+            yfdltrend = fdl > qnfdl ? "red" : "green";
+            yllfdltrend = llfdl > qnllfdl ? "red" : "green";
+            yxdsssltrend = xdss > qnxdss ? "red" : "green";
+            ygzsssltrend = gzss > qngzss ? "red" : "green";
+            ymtbftrend = ymtbf > qnmonthmtbf ? "red" : "green";
+            ymttrtrend = ymttr > qnmonthmttr ? "red" : "green";
+            yfwjsltrend = yfwjsl > qnmonthyfwjsl ? "red" : "green";
+            yxqjsltrend = xqjsl > qnxqjsl ? "red" : "green";
+
+        }
+
+
+        double yearllfdl = 0.0;
+        double yearfdl = 0.0;
+        double yearfnlyl = 0.0;
+        double yeargzssl = 0.0;
+        double yearxdssl = 0.0;
+        double yearmtbf = 0.0;
+        double yearmttr = 0.0;
+        double yearyfwjsl = 0.0;
+        double yearxqjsl = 0.0;
+
+        if (yearList.size() > 0) {
+            double nllfdl = yearList.size() > 0 ? yearList.get(0).getLlfdl() : 1;
+            double qnllfdl = qyearList.size() > 0 ? qyearList.get(0).getLlfdl() : 1;
+            double nfdl = yearList.size() > 0 ? yearList.get(0).getRfdl() : 0;
+            double qnfdl = qyearList.size() > 0 ? qyearList.get(0).getRfdl() : 1;
+            double nfnlyl = nfdl / nllfdl * 100;
+            double qnfnlyl = qnfdl / qnllfdl * 100;
+            double ngzss = yearList.size() > 0 ? yearList.get(0).getGzss() : 0;
+            double qngzss = qyearList.size() > 0 ? qyearList.get(0).getGzss() : 1;
+            double nxdss = yearList.size() > 0 ? yearList.get(0).getXdss() : 0;
+            double qnxdss = qyearList.size() > 0 ? qyearList.get(0).getXdss() : 1;
+            double nmtbf = yearlist.size() > 0 ? yearlist.get(0).getMtbf() : 0;
+            double qnmtbf = qnmttlist.size() > 0 ? qnmttlist.get(0).getMtbf() : 0;
+            double nmttr = yearlist.size() > 0 ? yearlist.get(0).getMttr() : 0;
+            double qnmttr = qnmttlist.size() > 0 ? qnmttlist.get(0).getMttr() : 0;
+            double nyfwjsl = yearmttrList.size() > 0 && yearmttrList.get(0).getNfwjsl() != null
+                    ? yearmttrList.get(0).getNfwjsl().doubleValue()
+                    : 0.0;
+            double qnyfwjsl = qnmttList.size() > 0 && qnmttList.get(0).getNfwjsl() != null
+                    ? qnmttList.get(0).getNfwjsl().doubleValue()
+                    : 0.0;
+            double nxqjsl = yearmttrList.size() > 0 && yearmttrList.get(0).getNgzxqjsl() != null
+                    ? yearmttrList.get(0).getNgzxqjsl().doubleValue()
+                    : 0.0;
+            double qnxqjsl = qnmttList.size() > 0 && qnmttList.get(0).getNgzxqjsl() != null
+                    ? qnmttList.get(0).getNgzxqjsl().doubleValue()
+                    : 0.0;
+
+
+            if (qnllfdl != 0 && qnllfdl != 1 || qnfdl != 1 || qngzss != 1 || qnxdss != 1) {
+                yearllfdl = StringUtils.round((nllfdl - qnllfdl) / qnllfdl * 100, 0);
+                yearfdl = StringUtils.round((nfdl - qnfdl) / qnfdl * 100, 0);
+                yearfnlyl = StringUtils.round(((nfnlyl - qnfnlyl) / qnfnlyl * 100), 0);
+                yeargzssl = StringUtils.round((ngzss - qngzss) / qngzss * 100, 0);
+                yearxdssl = StringUtils.round((nxdss - qnxdss) / qnxdss * 100, 0);
+                yearmtbf = StringUtils.round((nmtbf - qnmtbf) / qnmtbf * 100, 0);
+                yearmttr = StringUtils.round((nmttr - qnmttr) / qnmttr * 100, 0);
+                yearyfwjsl = StringUtils.round((nyfwjsl - qnyfwjsl) / qnyfwjsl * 100, 0);
+                yearxqjsl = StringUtils.round((nxqjsl - qnxqjsl) / qnxqjsl * 100, 0);
+            }
+        }
+
+        List<comprehensive> comprehensiveList = Arrays.asList(
+                createComprehensive("理论发电量", monthllfdl, yearllfdl, yllfdltrend),
+                createComprehensive("发电量", monthfdl, yearfdl, yfdltrend),
+                createComprehensive("风能利用率", monthfnlyl, yearfnlyl, yfnlyltrend),
+                createComprehensive("故障损失率", monthgzssl, yeargzssl, ygzsssltrend),
+                createComprehensive("限电损失率", monthxdssl, yearxdssl, yxdsssltrend),
+                createComprehensive("MTBF", monthmtbf, yearmtbf, ymtbftrend),
+                createComprehensive("MTTR", monthmttr, yearmttr, ymttrtrend),
+                createComprehensive("复位及时率", monthyfwjsl, yearyfwjsl, yfwjsltrend),
+                createComprehensive("消缺及时率", monthxqjsl, yearxqjsl, yxqjsltrend)
+        );
+        map.put("comprehensiveList", comprehensiveList);
+
+
+        double ydfnlyl = monthList.size() > 0 ? monthList.get(0).getFnlyl() : 0;
+        double ndfnlyl = yearList.size() > 0 ? yearList.get(0).getFnlyl() : 0;
+
+//        map.put("风能利用率","场站整体风能利用率:月度"+StringUtils.round(ydfnlyl, 0)+"%,年度"+StringUtils.round(ndfnlyl, 0)+"%\n" +
+//                "风能利用率Top3风机:"+fntop3list.get(0).getStationId()+"号"+StringUtils.round(fntop3list.get(0).getFnlyl(),0)+"%、"
+//                +fntop3list.get(1).getStationId()+"号"+StringUtils.round(fntop3list.get(1).getFnlyl(),0)+"%、" +
+//                ""+fntop3list.get(1).getStationId()+"号"+StringUtils.round(fntop3list.get(2).getFnlyl(),0)+"%\n" +
+//                "风能利用率末3风机:"+fnbottom3list.get(0).getStationId()+"号"+StringUtils.round(fnbottom3list.get(0).getFnlyl(),0)+"%、" +
+//                ""+fnbottom3list.get(1).getStationId()+"号"+StringUtils.round(fnbottom3list.get(1).getFnlyl(),0)+"%、" +
+//                "" +fnbottom3list.get(2).getStationId()+"号"+StringUtils.round(fnbottom3list.get(2).getFnlyl(),0)+"%");
+
+
+        map.put("风能利用率", "场站整体风能利用率:月度" + StringUtils.round(ydfnlyl, 0) + "%,年度" + StringUtils.round(ndfnlyl, 0) + "%");
+        map.put("风能利用率Top3风机","风能利用率Top3风机:" + fntop3list.get(0).getStationId() + "号" + StringUtils.round(fntop3list.get(0).getFnlyl(), 0) + "%、"
+                + fntop3list.get(1).getStationId() + "号" + StringUtils.round(fntop3list.get(1).getFnlyl(), 0) + "%、" +
+                "" + fntop3list.get(1).getStationId() + "号" + StringUtils.round(fntop3list.get(2).getFnlyl(), 0) + "%");
+
+        map.put("风能利用率末3风机","风能利用率末3风机:" + fnbottom3list.get(0).getStationId() + "号" + StringUtils.round(fnbottom3list.get(0).getFnlyl(), 0) + "%、" +
+                "" + fnbottom3list.get(1).getStationId() + "号" + StringUtils.round(fnbottom3list.get(1).getFnlyl(), 0) + "%、" +
+                "" + fnbottom3list.get(2).getStationId() + "号" + StringUtils.round(fnbottom3list.get(2).getFnlyl(), 0) + "%");
+
+        double byllfdl = StringUtils.round(monthList.size() > 0 ? monthList.get(0).getLlfdl() / bl : 0, 2);
+
+        double bygzss = StringUtils.round(monthList.size() > 0 ? monthList.get(0).getGzss() / bl : 0, 2);
+        double bygzssl = StringUtils.round(bygzss / byllfdl * 100, 0);
+
+        double bywhss = StringUtils.round(monthList.size() > 0 ? (monthList.get(0).getJhjxss() / bl) : 0 + monthList.size() > 0 ? (monthList.get(0).getFjhjxss() / bl) : 0, 2);
+        double bywhssl = StringUtils.round(bywhss / byllfdl * 100, 0);//本月维护损失率
+
+        double byslss = StringUtils.round(monthList.size() > 0 ? monthList.get(0).getSlss() / bl : 0, 2);
+        double byslssl = StringUtils.round(byslss / byllfdl * 100, 0);
+
+        double byxnss = StringUtils.round(monthList.size() > 0 ? monthList.get(0).getXnss() / bl : 0, 2);
+        double byxnssl = StringUtils.round(byxnss / byllfdl * 100, 0);
+
+        double byxdss = StringUtils.round(monthList.size() > 0 ? monthList.get(0).getXdss() / bl : 0, 2);
+        double byxdssl = StringUtils.round(byxdss / byllfdl * 100, 0);
+
+
+        double ytbllfdl = StringUtils.round(qnmonthList.size() > 0 ? qnmonthList.get(0).getLlfdl() / bl : 1, 2);
+
+        double ytbgzss = StringUtils.round(qnmonthList.size() > 0 ? qnmonthList.get(0).getGzss() / bl : 0, 2);
+        double ytbgzssl = StringUtils.round(ytbgzss / ytbllfdl * 100, 0);
+
+        double ytbwhss = StringUtils.round(qnmonthList.size() > 0 ? (qnmonthList.get(0).getJhjxss() / bl) : 0 + qnmonthList.size() > 0 ? (qnmonthList.get(0).getFjhjxss() / bl) : 0, 2);
+        double ytbwhssl = StringUtils.round(ytbwhss / ytbllfdl * 100, 0);
+
+        double ytbslss = StringUtils.round(qnmonthList.size() > 0 ? qnmonthList.get(0).getSlss() / bl : 0, 2);
+        double ytbslssl = StringUtils.round(ytbslss / ytbllfdl * 100, 0);
+
+        double ytbxnss = StringUtils.round(qnmonthList.size() > 0 ? qnmonthList.get(0).getXnss() / bl : 0, 2);
+        double ytbxnssl = StringUtils.round(ytbxnss / ytbllfdl * 100, 0);
+
+        double ytbxdss = StringUtils.round(qnmonthList.size() > 0 ? qnmonthList.get(0).getXdss() / bl : 0, 2);
+        double ytbxdssl = StringUtils.round(ytbxdss / ytbllfdl * 100, 0);
+
+
+        List<LossRates> lossList = Arrays.asList(
+                LossRatessive("维护损失", bywhss, bywhssl, StringUtils.round(bywhss / 50, 2), StringUtils.round(bywhssl - ytbwhssl, 2)),
+                LossRatessive("故障损失", bygzss, bygzssl, StringUtils.round(bygzss / 50, 2), StringUtils.round(bygzssl - ytbgzssl, 2)),
+                LossRatessive("限电损失", byxdss, byxdssl, StringUtils.round(byxdss / 50, 2), StringUtils.round(byxdssl - ytbxdssl, 2)),
+                LossRatessive("性能损失", byxnss, byxnssl, StringUtils.round(byxnss / 50, 2), StringUtils.round(byxnssl - ytbxnssl, 2)),
+                LossRatessive("受累损失", byslss, byslssl, StringUtils.round(byslss / 50, 2), StringUtils.round(byslssl - ytbslssl, 2))
+        );
+        map.put("LossRatesList", lossList);
+
+        Map<String, Object> electricity = windReportService.Electricity(time);
+
+        /**********************可靠性分析**********************************/
+        map.put("MTBF", electricity.get("MTBF"));
+        map.put("MTTR", electricity.get("MTTR"));
+        map.put("风机可利用率", electricity.get("风机可利用率"));
+        map.put("故障统计", electricity.get("故障统计"));
+        /**********************可靠性分析**********************************/
+
+
+        /*********************发电量分析**********************************/
+        map.put("发电量分析-总发电量", electricity.get("发电量分析-总发电量"));
+        map.put("发电量分析-理论发电量", electricity.get("发电量分析-理论发电量"));
+        map.put("发电量分析-单台平均", electricity.get("发电量分析-单台平均"));
+        map.put("发电量分析-Top3风机", electricity.get("发电量分析-Top3风机"));
+        map.put("发电量分析-末3风机", electricity.get("发电量分析-末3风机"));
+        map.put("发电量分析-同比分析", electricity.get("发电量分析-同比分析"));
+        /*********************发电量分析**********************************/
+
+        /*********************综合场用电量分析**********************************/
+        map.put("综合场用电量分析-月度场用电量", electricity.get("综合场用电量分析-月度场用电量"));
+        map.put("综合场用电量分析-年度场用电量", electricity.get("综合场用电量分析-年度场用电量"));
+        map.put("综合场用电量分析-场用电率", electricity.get("综合场用电量分析-场用电率"));
+        map.put("综合场用电量分析-与同期对比", electricity.get("综合场用电量分析-与同期对比"));
+        /*********************综合场用电量分析**********************************/
+
+        /*********************风资源分析**********************************/
+        map.put("风资源分析-风资源数据", electricity.get("风资源分析-风资源数据"));
+        map.put("风资源分析-历史对比", electricity.get("风资源分析-历史对比"));
+        /*********************风资源分析**********************************/
+
+
+        map.put("曲线偏差率分析", electricity.get("曲线偏差率分析"));
+        map.put("各区间偏差率统计", electricity.get("各区间偏差率统计"));
+        map.put("单台风速分析", electricity.get("单台风速分析"));
+        map.put("合格率计算", electricity.get("合格率计算"));
+
+        /*********************风资源分析**********************************/
+        map.put("拟合优度排行", electricity.get("拟合优度排行"));
+        map.put("拟合优度排行—上月", electricity.get("拟合优度排行—上月"));
+        /*********************风资源分析**********************************/
+
+
+        map.put("单机月度分析-分析对象", electricity.get("单机月度分析-分析对象"));
+        map.put("单机月度分析-关键数据", electricity.get("单机月度分析-关键数据"));
+        map.put("单机月度分析-关键数据上月", electricity.get("单机月度分析-关键数据上月"));
+        map.put("性能等级评估", electricity.get("性能等级评估"));
+        map.put("复位及时率", electricity.get("复位及时率"));
+        map.put("消缺及时率", electricity.get("消缺及时率"));
+
+
+        /*********************状态转换率**********************************/
+        map.put("状态转换率-大于3米风速", electricity.get("状态转换率-大于3米风速"));
+        map.put("状态转换率-月度5分钟", electricity.get("状态转换率-大于3米风速"));
+        map.put("状态转换率-与上月对比", electricity.get("状态转换率-大于3米风速"));
+        /*********************状态转换率**********************************/
+
+        return map;
+    }
+
+    // 辅助方法
+    private comprehensive createComprehensive(String category, double monthZzl, double yearZzl, String trend) {
+        comprehensive comp = new comprehensive();
+        comp.setCategory(category);
+        comp.setMonth_zzl(monthZzl);
+        comp.setYear_zzl(yearZzl);
+        comp.setTrend(trend);
+        return comp;
+    }
+
+    private LossRates LossRatessive(String category, double zssdl, double zssl, double djpjss, double tbbh) {
+        LossRates loss = new LossRates();
+        loss.setSslx(category);
+        loss.setZssdl(zssdl);
+        loss.setZssl(zssl);
+        loss.setDtpjss(djpjss);
+        loss.setTbbh(tbbh);
+        return loss;
+    }
+
+    /**
+     * 将wtls集合中与top3list匹配项的nemCode赋值给top3list的id字段
+     * 匹配条件:wtls的id与top3list的turbineId相等
+     *
+     * @param wtls     风机基础信息集合
+     * @param top3list 风机日信息集合
+     */
+    public void setTurbineIdFromNemCode(List<ProBasicEquipment> wtls, List<TurbineInfoDay> top3list) {
+        // 遍历top3list中的每个元素
+        for (TurbineInfoDay turbineInfo : top3list) {
+            // 获取当前元素的turbineId
+            String turbineId = turbineInfo.getTurbineId();
+            if (turbineId == null) {
+                continue; // 如果turbineId为空则跳过
+            }
+
+            // 在wtls集合中查找匹配的元素
+            for (ProBasicEquipment equipment : wtls) {
+                // 比较id是否匹配
+                if (turbineId.equals(equipment.getId())) {
+                    // 匹配成功,将nemCode赋值给id字段
+                    turbineInfo.setStationId(equipment.getNemCode());
+                    break; // 找到匹配项后退出内层循环
+                }
+            }
+        }
+    }
+}

+ 792 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/EarlyWarning/WindReportService.java

@@ -0,0 +1,792 @@
+package com.gyee.runeconomy.service.EarlyWarning;
+
+import com.gyee.runeconomy.entity.StationInfoMonth;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.model.auto.*;
+import com.gyee.runeconomy.service.IStationInfoMonthService;
+import com.gyee.runeconomy.service.auto.*;
+import com.gyee.runeconomy.util.StringUtils;
+import lombok.var;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+@Service
+public class WindReportService {
+
+    @Autowired
+    private ITurbineInfoDayService turbineInfoDayService;
+    @Resource
+    private IStationInfoMonthService stationInfoMonthService;
+    @Resource
+    private IStationInfoDayService stationInfoDayService;
+    @Resource
+    private IProEconCurveFittMonthMainService curveFittMonthMainService;
+    @Resource
+    private IProEconEquipmentInfoDay4Service day4Service;
+    @Resource
+    private IProEconInOrOutSpeedTotalService proEconInOrOutSpeedTotalService;
+    @Resource
+    private IProEconWindturbineGoodnessService goodnessService;
+    @Resource
+    private IProEconEquipmentInfoDay5Service day5Service;
+    @Resource
+    private IProEconFaultLiminatedefectsService proEconFaultLiminatedefectsService;
+
+    // 定义等级常量,便于维护
+    private static final String[] LEVELS = {"A", "B", "C"};
+
+    public Map<String, Object> Electricity(String time) throws Exception {
+
+        String year = time.substring(0, 4);  // 从索引0开始,截取4位
+        String month = time.substring(5, 7);
+        // 去除前导零
+        month = month.replaceFirst("^0", "");
+
+        Map<String, Object> map = new LinkedHashMap<>();
+
+        List<ProBasicEquipment> wtls = CacheContext.wtls;
+        // 1. 数据准备
+        List<StationInfoMonth> monthslist = stationInfoMonthService.monthslist(time);
+        List<StationInfoMonth> qndylist = stationInfoMonthService.qndylist(time);
+
+        List<TurbineInfoDay> monthdllist = turbineInfoDayService.monthList(time);
+        List<TurbineInfoDay> hbmonthList = turbineInfoDayService.hbmonthList(time);
+        List<TurbineInfoDay> qnmonthlist = turbineInfoDayService.qnmonthList(time);
+        List<TurbineInfoDay> dltoplist = turbineInfoDayService.topList(time);
+        List<TurbineInfoDay> dlbottomlist = turbineInfoDayService.bottomList(time);
+        List<TurbineInfoDay> yeardllist = turbineInfoDayService.yearList(time);
+        List<TurbineInfoDay> klyltopList = turbineInfoDayService.klyltopList(time);
+        List<TurbineInfoDay> klylbottomList = turbineInfoDayService.klylbottomList(time);
+        List<TurbineInfoDay> gzcslist = turbineInfoDayService.gzcssumList(time);
+        List<TurbineInfoDay> gzcstop = turbineInfoDayService.gzcstopList(time);
+        List<TurbineInfoDay> glyztopList = turbineInfoDayService.glyztopList(time);
+        List<TurbineInfoDay> glyzbottomList = turbineInfoDayService.glyzbottomList(time);
+        List<TurbineInfoDay> syglyztopList = turbineInfoDayService.syglyztopList(time);
+        List<TurbineInfoDay> syglyzbottomList = turbineInfoDayService.syglyzbottomList(time);
+        List<TurbineInfoDay> xndjList = turbineInfoDayService.xndjList(time);
+
+        List<StationInfoDay> zhcymonthlist = stationInfoDayService.getmonthList(time);
+        List<StationInfoDay> qnzhcymonthlist = stationInfoDayService.getqnmonthList(time);
+        List<StationInfoDay> zhcyyearlist = stationInfoDayService.getyearList(time);
+
+        List<ProEconCurveFittMonthMain> getqxlist = curveFittMonthMainService.getlist(year, month);
+        List<ProEconEquipmentInfoDay4> getpcllist = day4Service.getpcllist(time);
+        List<ProEconInOrOutSpeedTotal> outSpeedtopTotals = proEconInOrOutSpeedTotalService.gettoplist(time);
+        List<ProEconInOrOutSpeedTotal> outSpeedTotals = proEconInOrOutSpeedTotalService.getlist(time);
+        List<ProEconWindturbineGoodness> getnhtop = goodnessService.gettop(time);
+        List<ProEconWindturbineGoodness> getnhbottom = goodnessService.getbottom(time);
+        List<ProEconWindturbineGoodness> getsy_nhtop = goodnessService.getsytop(time);
+        List<ProEconWindturbineGoodness> getsy_nhbottom = goodnessService.getsybottom(time);
+
+        List<ProEconEquipmentInfoDay5> stateRateList = day5Service.getStateRateList(time);
+        List<ProEconEquipmentInfoDay5> systateRateList = day5Service.getsyStateRateList(time);
+        List<ProEconEquipmentInfoDay5> stateRatebotList = day5Service.getStateRatebottomList(time);
+
+        List<ProEconEquipmentInfoDay5> threestateRateList = day5Service.getthreeStateRateList(time);
+        List<ProEconEquipmentInfoDay5> threesystateRateList = day5Service.getsythreeStateRateList(time);
+        List<ProEconEquipmentInfoDay5> threestateRatebotList = day5Service.getthreeStateRatebottomList(time);
+
+        List<ProEconFaultLiminatedefects> liminatedefects = proEconFaultLiminatedefectsService.getlist(time);
+        List<ProEconFaultLiminatedefects> syliminatedefects = proEconFaultLiminatedefectsService.getsylist(time);
+        List<ProEconFaultLiminatedefects> yearliminatedefects = proEconFaultLiminatedefectsService.getyearlist(time);
+
+        // 分组 1: TurbineInfoDay 相关列表
+        applySetIdFromNemCode(wtls, Arrays.asList(
+                        klyltopList, glyztopList, glyzbottomList, syglyztopList,
+                        syglyzbottomList, klylbottomList, gzcstop, dltoplist,
+                        dlbottomlist, xndjList),
+                TurbineInfoDay::getTurbineId,
+                TurbineInfoDay::setStationId);
+
+        // 分组 2: ProEconCurveFittMonthMain 相关列表
+        applySetIdFromNemCode(wtls, Arrays.asList(getqxlist),
+                ProEconCurveFittMonthMain::getWindturbineId,
+                ProEconCurveFittMonthMain::setWindturbineId);
+
+        // 分组 3: ProEconEquipmentInfoDay4 相关列表
+        applySetIdFromNemCode(wtls, Arrays.asList(getpcllist),
+                ProEconEquipmentInfoDay4::getWindturbineId,
+                ProEconEquipmentInfoDay4::setWindturbineId);
+
+        // 分组 4: ProEconEquipmentInfoDay5 相关列表
+        applySetIdFromNemCode(wtls, Arrays.asList(
+                        stateRatebotList, threestateRateList,
+                        threesystateRateList, threestateRatebotList),
+                ProEconEquipmentInfoDay5::getWindturbineId,
+                ProEconEquipmentInfoDay5::setWindturbineId);
+
+        // 分组 5: ProEconInOrOutSpeedTotal 相关列表
+        applySetIdFromNemCode(wtls, Arrays.asList(
+                        outSpeedTotals, outSpeedtopTotals),
+                ProEconInOrOutSpeedTotal::getWindturbineId,
+                ProEconInOrOutSpeedTotal::setWindturbineId);
+
+        // 分组 6: ProEconWindturbineGoodness 相关列表
+        applySetIdFromNemCode(wtls, Arrays.asList(
+                        getnhtop, getnhbottom, getsy_nhtop, getsy_nhbottom),
+                ProEconWindturbineGoodness::getWindturbineId,
+                ProEconWindturbineGoodness::setWindturbineId);
+
+        int bl = 1000;
+
+        double monthdmtbf = monthslist.size() > 0 ? StringUtils.round(monthslist.get(0).getMtbf(), 2) : 0.0;
+        double qnmonthmtbf = qndylist.size() > 0 ? StringUtils.round(qndylist.get(0).getMtbf(), 2) : 1.0;
+
+        double monthdmttr = monthslist.size() > 0 ? StringUtils.round(monthslist.get(0).getMttr(), 2) : 0.0;
+        double qnmonthmttr = qndylist.size() > 0 ? StringUtils.round(qndylist.get(0).getMttr(), 2) : 1.0;
+
+        double monthkyly = monthdllist.size() > 0 ? StringUtils.round(monthdllist.get(0).getKlyl(), 2) : 0.0;
+        double yearklyly = yeardllist.size() > 0 ? StringUtils.round(yeardllist.get(0).getKlyl(), 2) : 0.0;
+
+        String klyltop1id = klyltopList.size() > 0 ? klyltopList.get(0).getStationId() : "";
+        double klyltop1value = klyltopList.size() > 0 ? StringUtils.round(klyltopList.get(0).getKlyl(), 2) : 0.0;
+
+        String klyltop2id = klyltopList.size() > 0 ? klyltopList.get(1).getStationId() : "";
+        double klyltop2value = klyltopList.size() > 0 ? StringUtils.round(klyltopList.get(1).getKlyl(), 2) : 0.0;
+
+        String klyltop3id = klyltopList.size() > 0 ? klyltopList.get(2).getStationId() : "";
+        double klyltop3value = klyltopList.size() > 0 ? StringUtils.round(klyltopList.get(2).getKlyl(), 2) : 0.0;
+
+        String klylbottom1id = klylbottomList.size() > 0 ? klylbottomList.get(0).getStationId() : "";
+        double klylbottom1value = klylbottomList.size() > 0 ? StringUtils.round(klylbottomList.get(0).getKlyl(), 2) : 0.0;
+
+        String klylbottom2id = klylbottomList.size() > 0 ? klylbottomList.get(1).getStationId() : "";
+        double klylbottom2value = klylbottomList.size() > 0 ? StringUtils.round(klylbottomList.get(1).getKlyl(), 2) : 0.0;
+
+        String klylbottom3id = klylbottomList.size() > 0 ? klylbottomList.get(2).getStationId() : "";
+        double klylbottom3value = klylbottomList.size() > 0 ? StringUtils.round(klylbottomList.get(2).getKlyl(), 2) : 0.0;
+
+        double mtbftq = 0.0;
+        double mttrtq = 0.0;
+        if (qnmonthmtbf > 1) {
+            mtbftq = StringUtils.round((monthdmtbf - qnmonthmtbf) / qnmonthmtbf * 100, 2);
+        }
+        if (qnmonthmttr > 1) {
+            mttrtq = StringUtils.round((monthdmttr - qnmonthmttr) / qnmonthmttr * 100, 2);
+        }
+
+        map.put("MTBF", "MTBF(平均无故障时间):月度" + monthdmtbf + "h,与上年同期对比±" + mtbftq + "%");
+        map.put("MTTR", "MTTR(平均修复时间):月度" + monthdmttr + "h,与上年同期对比±" + mttrtq + "%");
+        map.put("风机可利用率", "风机可利用率:\n" +
+                "场站平均可利用率:月度" + monthkyly + "%,年度" + yearklyly + "%\n" +
+                "可利用率Top3风机:" + klyltop1id + "号" + klyltop1value + "%、" + klyltop2id + "号" + klyltop2value + "%、" + klyltop3id + "号" + klyltop3value + "%\n" +
+                "可利用率末3风机:" + klylbottom1id + "号" + klylbottom1value + "%、" + klylbottom2id + "号" + klylbottom2value + "%、" + klylbottom3id + "号" + klylbottom3value + "%");
+
+        int gzcs = gzcslist.size() > 0 ? gzcslist.get(0).getGzcs() : 0;
+        String gzfj = gzcstop.size() > 0 ? gzcstop.get(0).getStationId() : "";
+        int gzfjcs = gzcstop.size() > 0 ? gzcstop.get(0).getGzcs() : 0;
+        map.put("故障统计", "故障统计:\n" +
+                "月度总故障次数:" + gzcs + "次\n" +
+                "故障频发风机:" + gzfj + "号(" + gzfjcs + "次)");
+
+
+        double monthfdl = monthdllist.size() > 0 ? StringUtils.round(monthdllist.get(0).getRfdl() / bl, 2) : 0.0;
+        double monthllfdl = monthdllist.size() > 0 ? StringUtils.round(monthdllist.get(0).getLlfdl() / bl, 2) : 0.0;
+        double qnmonthfdl = qnmonthlist.size() > 0 ? StringUtils.round(qnmonthlist.get(0).getRfdl() / bl, 2) : 1.0;
+        double hbmothfdl = hbmonthList.size() > 0 ? StringUtils.round(hbmonthList.get(0).getRfdl() / bl, 2) : 1.0;
+
+        double yearfdl = yeardllist.size() > 0 ? StringUtils.round(yeardllist.get(0).getRfdl() / bl, 2) : 0.0;
+        double yearllfdl = yeardllist.size() > 0 ? StringUtils.round(yeardllist.get(0).getLlfdl() / bl, 2) : 0.0;
+
+        String[] dltopId = new String[3];
+        double[] dltopFdl = new double[3];
+        double month_dtpjFdl = StringUtils.round(monthfdl / 50, 2);
+        double year_dtpjFdl = StringUtils.round(yearfdl / 50, 2);
+        double monthfdltb = 0;
+        double monthfdlhb = 0;
+        if (qnmonthfdl != 1) {
+            monthfdltb = StringUtils.round((monthfdl - qnmonthfdl) / qnmonthfdl * 100, 2);
+        }
+
+        if (hbmothfdl != 1) {
+            monthfdlhb = StringUtils.round((monthfdl - hbmothfdl) / hbmothfdl * 100, 2);
+        }
+
+
+        for (int i = 0; i < dltoplist.size(); i++) {
+            dltopFdl[i] = StringUtils.round(dltoplist.get(i).getRfdl() / bl, 2);
+            dltopId[i] = dltoplist.get(i).getStationId();
+        }
+
+        String[] bottomId = new String[3];
+        double[] bottomFdl = new double[3];
+        for (int i = 0; i < dlbottomlist.size(); i++) {
+            bottomFdl[i] = StringUtils.round(dlbottomlist.get(i).getRfdl() / bl, 2);
+            bottomId[i] = dlbottomlist.get(i).getStationId();
+        }
+
+//        map.put("发电量分析", "场站总发电量:月度" + monthfdl + "万KWh,年度" + yearfdl + "万KWh\n" +
+//                "理论发电量:月度" + monthllfdl + "万KWh,年度" + yearllfdl + "万KWh\n" +
+//                "单台风机平均发电量:月度" + month_dtpjFdl + "万KWh,年度" + year_dtpjFdl + "万KWh\n" +
+//                "发电量Top3风机:" + dltopId[0] + "号" + dltopFdl[0] + "万KWh、" + dltopId[1] + "号" + dltopFdl[1] + "万KWh、" + dltopId[2] + "号" + dltopFdl[2] + "万KWh\n" +
+//                "发电量末3风机:" + bottomId[0] + "号" + bottomFdl[0] + "万KWh、" + bottomId[1] + "号" + bottomFdl[1] + "万KWh、" + bottomId[2] + "号" + bottomFdl[2] + "万KWh\n" +
+//                "同比/环比分析:月度发电量同比" + monthfdltb + "%(±),环比" + monthfdlhb + "%(±)");
+
+        map.put("发电量分析-总发电量", "场站总发电量:月度" + monthfdl + "万KWh,年度" + yearfdl + "万KWh");
+        map.put("发电量分析-理论发电量","理论发电量:月度" + monthllfdl + "万KWh,年度" + yearllfdl + "万KWh");
+        map.put("发电量分析-单台平均","单台风机平均发电量:月度" + month_dtpjFdl + "万KWh,年度" + year_dtpjFdl + "万KWh");
+        map.put("发电量分析-Top3风机","发电量Top3风机:" + dltopId[0] + "号" + dltopFdl[0] + "万KWh、" + dltopId[1] + "号" + dltopFdl[1] + "万KWh、" + dltopId[2] + "号" + dltopFdl[2] + "万KWh");
+        map.put("发电量分析-末3风机","发电量末3风机:" + bottomId[0] + "号" + bottomFdl[0] + "万KWh、" + bottomId[1] + "号" + bottomFdl[1] + "万KWh、" + bottomId[2] + "号" + bottomFdl[2] + "万KWh");
+        map.put("发电量分析-同比分析","同比/环比分析:月度发电量同比" + monthfdltb + "%(±),环比" + monthfdlhb + "%(±)");
+
+        //月场用电量
+        double monthcydl = zhcymonthlist.size() > 0 ? StringUtils.round((double) zhcymonthlist.get(0).getZhcydl() / bl, 2) : 0.0;
+        //月发电量
+        double monthrfdl = zhcymonthlist.size() > 0 ? StringUtils.round((double) zhcymonthlist.get(0).getRfdl() / bl, 2) : 0.0;
+        //去年月场用电量
+        double qnmonthcydl = qnzhcymonthlist.size() > 0 ? StringUtils.round((double) qnzhcymonthlist.get(0).getZhcydl() / bl, 2) : 1.0;
+        //去年月发电量
+        double qnmonthrfdl = qnzhcymonthlist.size() > 0 ? StringUtils.round((double) qnzhcymonthlist.get(0).getRfdl() / bl, 2) : 1.0;
+        //年场用电量
+        double yearcydl = zhcyyearlist.size() > 0 ? StringUtils.round((double) zhcyyearlist.get(0).getZhcydl() / bl, 2) : 0.0;
+        //年发电量
+        double yearrfdl = zhcyyearlist.size() > 0 ? StringUtils.round((double) zhcyyearlist.get(0).getRfdl() / bl, 2) : 0.0;
+
+        //月场用电率
+        double monthcydll = monthrfdl > 1 ? StringUtils.round(monthcydl / monthrfdl * 100, 2) : 0.0;
+        //年场用电率
+        double yearcydll = yearrfdl > 1 ? StringUtils.round(yearcydl / yearrfdl * 100, 2) : 0.0;
+        //去年场用电率
+        double qnmonthcydll = qnmonthrfdl > 1 ? StringUtils.round(qnmonthcydl / qnmonthrfdl * 100, 2) : 0.0;
+
+        //月场用电量同比
+        double monthcydltb = qnmonthcydl > 1 ? StringUtils.round((monthcydl - qnmonthcydl) / qnmonthcydl * 100, 2) : 0.0;
+
+        //场用电率同比
+        double monthcydlltb = qnmonthcydll > 1 ? StringUtils.round((monthcydll - qnmonthcydll) / qnmonthcydll * 100, 2) : 0.0;
+
+
+//        map.put("综合场用电量分析", "月度场用电量:" + monthcydl + "万KWh\n" +
+//                "年度场用电量:" + yearcydl + "万KWh\n" +
+//                "场用电率:月度" + monthcydll + "%,年度" + yearcydll + "%\n" +
+//                "与同期对比:月度场用电量同比" + monthcydltb + "%(±),场用电率同比" + monthcydlltb + "%(±)");
+
+        map.put("综合场用电量分析-月度场用电量","月度场用电量:" + monthcydl + "万KWh");
+        map.put("综合场用电量分析-年度场用电量","年度场用电量:" + yearcydl + "万KWh");
+        map.put("综合场用电量分析-场用电率","场用电率:月度" + monthcydll + "%,年度" + yearcydll + "%");
+        map.put("综合场用电量分析-与同期对比","与同期对比:月度场用电量同比" + monthcydltb + "%(±),场用电率同比" + monthcydlltb + "%(±)");
+
+        double avgfs = Optional.ofNullable(zhcymonthlist)
+                .filter(list -> !list.isEmpty())
+                .map(list -> list.get(0))
+                .map(StationInfoDay::getCftfs)  // 根据您的实际类名替换
+                .map(BigDecimal::doubleValue)
+                .map(value -> StringUtils.round(value, 2))
+                .orElse(0.0);
+
+        double qnavgfs = Optional.ofNullable(qnzhcymonthlist)
+                .filter(list -> !list.isEmpty())
+                .map(list -> list.get(0))
+                .map(StationInfoDay::getCftfs)  // 根据您的实际类名替换
+                .map(BigDecimal::doubleValue)
+                .map(value -> StringUtils.round(value, 2))
+                .orElse(0.0);
+
+        double tqb_avgfs = qnavgfs > 1 ? StringUtils.round((avgfs - qnavgfs) / qnavgfs * 100, 2) : 0.0;
+        double avgfx = Optional.ofNullable(zhcymonthlist)
+                .filter(list -> !list.isEmpty())
+                .map(list -> list.get(0))
+                .map(StationInfoDay::getCftfx)  // 替换YourObjectClass为实际类名
+                .map(BigDecimal::doubleValue)    // 将BigDecimal转换为double
+                .map(value -> StringUtils.round(value, 2))
+                .orElse(0.0);
+
+        double avgjfpl = Optional.ofNullable(monthdllist)
+                .filter(list -> !list.isEmpty())
+                .map(list -> list.get(0))
+                .map(TurbineInfoDay::getJfpl)
+                .map(value -> StringUtils.round(value, 2))
+                .orElse(0.0);
+        double qnavgjfpl = Optional.ofNullable(qnmonthlist)
+                .filter(list -> !list.isEmpty())
+                .map(list -> list.get(0))
+                .map(TurbineInfoDay::getJfpl)   // 替换YourObjectClass为实际类名
+                .map(value -> StringUtils.round(value, 2))
+                .orElse(0.0);
+        double tqb_jfpl = qnavgjfpl > 1 ? StringUtils.round((avgjfpl - qnavgjfpl) / qnavgjfpl * 100, 2) : 0.0;
+
+//        map.put("风资源分析", "风资源数据:\n" +
+//                "平均风速:" + avgfs + "m/s\n" +
+//                "主导风向:" + avgfx + "\n" +
+//                "静风频率:" + avgjfpl + "%\n" +
+//                "历史对比:与去年同期相比,平均风速" + tqb_avgfs + "m/s(±),静风频率" + tqb_jfpl + "%(±)");
+
+        map.put("风资源分析-风资源数据","风资源数据:\n" +
+                        "平均风速:" + avgfs + "m/s\n" +
+                        "主导风向:" + avgfx + "\n" +
+                        "静风频率:" + avgjfpl + "%");
+        map.put("风资源分析-历史对比","历史对比:与去年同期相比,平均风速" + tqb_avgfs + "m/s(±),静风频率" + tqb_jfpl + "%(±)");
+
+        String[] qxtopid = new String[3];
+        double[] qxpcl = new double[3];
+        for (int i = 0; i < getqxlist.size(); i++) {
+            var item = getqxlist.get(i);
+            qxtopid[i] = item.getWindturbineId();
+            qxpcl[i] = item.getDeviationRate2();
+        }
+
+        map.put("曲线偏差率分析", "偏差率排行(排名前三):\n" +
+                "" + qxtopid[0] + "号风机:偏差率" + qxpcl[0] + "%,排名: 1\n" +
+                "" + qxtopid[1] + "号风机:偏差率" + qxpcl[1] + "%,排名: 2\n" +
+                "" + qxtopid[2] + "号风机:偏差率" + qxpcl[2] + "%,排名: 3");
+
+        double pcl_35 = getpcllist.stream().mapToDouble(ProEconEquipmentInfoDay4::getR35mqxpcl).average().getAsDouble();
+        // 获取最小值对应的数据
+        Optional<ProEconEquipmentInfoDay4> min_35 = getpcllist.stream()
+                .min(Comparator.comparingDouble(ProEconEquipmentInfoDay4::getR35mqxpcl));
+        // 获取最大值对应的数据
+        Optional<ProEconEquipmentInfoDay4> max_35 = getpcllist.stream()
+                .max(Comparator.comparingDouble(ProEconEquipmentInfoDay4::getR35mqxpcl));
+
+        String min_35Id = min_35.map(ProEconEquipmentInfoDay4::getWindturbineId).orElse(null);
+        String max_35Id = max_35.map(ProEconEquipmentInfoDay4::getWindturbineId).orElse(null);
+
+
+        double pcl_511 = getpcllist.stream().mapToDouble(ProEconEquipmentInfoDay4::getR511mqxpcl).average().getAsDouble();
+        Optional<ProEconEquipmentInfoDay4> min_511 = getpcllist.stream()
+                .min(Comparator.comparingDouble(ProEconEquipmentInfoDay4::getR511mqxpcl));
+        // 获取最大值对应的数据
+        Optional<ProEconEquipmentInfoDay4> max_511 = getpcllist.stream()
+                .max(Comparator.comparingDouble(ProEconEquipmentInfoDay4::getR511mqxpcl));
+
+        String min_511Id = min_511.map(ProEconEquipmentInfoDay4::getWindturbineId).orElse(null);
+        String max_511Id = max_511.map(ProEconEquipmentInfoDay4::getWindturbineId).orElse(null);
+
+        double pcl_1125 = getpcllist.stream().mapToDouble(ProEconEquipmentInfoDay4::getR11mycqxpcl).average().getAsDouble();
+        Optional<ProEconEquipmentInfoDay4> min_1125 = getpcllist.stream()
+                .min(Comparator.comparingDouble(ProEconEquipmentInfoDay4::getR511mqxpcl));
+        // 获取最大值对应的数据
+        Optional<ProEconEquipmentInfoDay4> max_1125 = getpcllist.stream()
+                .max(Comparator.comparingDouble(ProEconEquipmentInfoDay4::getR511mqxpcl));
+
+        String min_1125Id = min_1125.map(ProEconEquipmentInfoDay4::getWindturbineId).orElse(null);
+        String max_1125Id = max_1125.map(ProEconEquipmentInfoDay4::getWindturbineId).orElse(null);
+        map.put("各区间偏差率统计", "各区间偏差率统计:\n" +
+                "3-5m/s区间:平均偏差率" + StringUtils.round(pcl_35, 2) + "%,偏差率最大风机:" + max_35Id + "号,偏差率最小风机:" + min_35Id + "号\n" +
+                "5-11m/s区间:平均偏差率" + StringUtils.round(pcl_511, 2) + "%,偏差率最大风机:" + max_511Id + "号,偏差率最小风机:" + min_511Id + "号\n" +
+                "11-25m/s区间:平均偏差率" + StringUtils.round(pcl_1125, 2) + "%,偏差率最大风机:" + max_1125Id + "号,偏差率最小风机:" + min_1125Id + "号");
+
+        String[] yqrtopid = new String[3];
+        double[] yqrfs = new double[3];
+        double[] yqcfs = new double[3];
+
+        for (int i = 0; i < outSpeedtopTotals.size(); i++) {
+            var item = outSpeedtopTotals.get(i);
+            yqrtopid[i] = item.getWindturbineId();
+            yqrfs[i] = StringUtils.round(item.getMonthInputSmall(), 2);
+            yqcfs[i] = StringUtils.round(item.getMonthOutputSmall(), 2);
+        }
+        map.put("单台风速分析", "单台风速分析(排名前三):\n" +
+                "" + yqrtopid[0] + "号风机:月度小风切入风速" + yqrfs[0] + "m/s、小风切出风速" + yqcfs[0] + "m/s\n" +
+                "" + yqrtopid[1] + "号风机:月度小风切入风速" + yqrfs[1] + "m/s、小风切出风速" + yqcfs[1] + "m/s\n" +
+                "" + yqrtopid[2] + "号风机:月度小风切入风速" + yqrfs[2] + "m/s、小风切出风速" + yqcfs[2] + "m/s");
+
+
+        double average = 0.0;
+        if (outSpeedTotals != null && !outSpeedTotals.isEmpty()) {
+            average = outSpeedTotals.stream()
+                    .mapToDouble(ProEconInOrOutSpeedTotal::getMonthInputSmallRatio)
+                    .average()
+                    .orElse(0.0);
+        }
+
+        List<ProEconInOrOutSpeedTotal> out_100 = outSpeedTotals.stream().filter(o -> o.getMonthInputSmallRatio() == 100).collect(Collectors.toList());
+        List<ProEconInOrOutSpeedTotal> out_60 = outSpeedTotals.stream().filter(o -> o.getMonthInputSmallRatio() >= 60).collect(Collectors.toList());
+
+        String out60_id = out_60.stream()
+                .map(ProEconInOrOutSpeedTotal::getWindturbineId)
+                .filter(Objects::nonNull)  // 过滤掉null值
+                .collect(Collectors.joining(","));
+
+        String out100_id = out_100.stream()
+                .map(ProEconInOrOutSpeedTotal::getWindturbineId)
+                .filter(Objects::nonNull)  // 过滤掉null值
+                .collect(Collectors.joining(","));
+
+        map.put("合格率计算", "合格率计算:\n" +
+                "50台风机平均切入切出合格率" + StringUtils.round(average, 2) + "%\n" +
+                "合格率100%的风机:" + out_100.size() + "台,为" + out100_id + "\n" +
+                "合格率低于60%的风机:" + out_60.size() + "台,为" + out60_id + "");
+
+        String[] topnhyd_id = new String[3];
+        double[] top_ynhyd = new double[3];
+
+        String[] bottomnhyd_id = new String[3];
+        double[] bottom_ynhyd = new double[3];
+
+        String[] sytopnhyd_id = new String[3];
+        double[] sytop_ynhyd = new double[3];
+
+        String[] sybottomnhyd_id = new String[3];
+        double[] sybottom_ynhyd = new double[3];
+
+        for (int i = 0; i < getnhtop.size(); i++) {
+            var item = getnhtop.get(i);
+            topnhyd_id[i] = item.getWindturbineId();
+            top_ynhyd[i] = StringUtils.round(item.getMonthGoodness(), 2);
+
+            var item_bot = getnhbottom.get(i);
+            bottomnhyd_id[i] = item_bot.getWindturbineId();
+            bottom_ynhyd[i] = StringUtils.round(item_bot.getMonthGoodness(), 2);
+
+            var qnitem = getsy_nhtop.get(i);
+            sytopnhyd_id[i] = qnitem.getWindturbineId();
+            sytop_ynhyd[i] = StringUtils.round(qnitem.getMonthGoodness(), 2);
+
+            var qnitem_bot = getsy_nhbottom.get(i);
+            sybottomnhyd_id[i] = qnitem_bot.getWindturbineId();
+            sybottom_ynhyd[i] = StringUtils.round(qnitem_bot.getMonthGoodness(), 2);
+        }
+//        map.put("单机性能分析", "拟合优度排行:\n" +
+//                "月拟合优度Top3:" + topnhyd_id[0] + "号" + top_ynhyd[0] + "%、" + topnhyd_id[1] + "号" + top_ynhyd[1] + "%、" + topnhyd_id[2] + "号" + top_ynhyd[2] + "%\n" +
+//                "月拟合优度末3:" + bottomnhyd_id[0] + "号" + bottom_ynhyd[0] + "%、" + bottomnhyd_id[1] + "号" + bottom_ynhyd[2] + "%、" + bottomnhyd_id[2] + "号" + bottom_ynhyd[2] + "%\n" +
+//                "拟合优度排行—上月同期:\n" +
+//                "月拟合优度Top3:" + sytopnhyd_id[0] + "号" + sytop_ynhyd[0] + "%、" + sytopnhyd_id[1] + "号" + sytop_ynhyd[1] + "%、" + sytopnhyd_id[2] + "号" + sytop_ynhyd[2] + "%\n" +
+//                "月拟合优度末3:" + sybottomnhyd_id[0] + "号" + sybottom_ynhyd[0] + "%、" + sybottomnhyd_id[1] + "号" + sybottom_ynhyd[1] + "%、" + sybottomnhyd_id[2] + "号" + sybottom_ynhyd[2] + "%");
+
+        map.put("拟合优度排行","拟合优度排行:\n" +
+                "月拟合优度Top3:" + topnhyd_id[0] + "号" + top_ynhyd[0] + "%、" + topnhyd_id[1] + "号" + top_ynhyd[1] + "%、" + topnhyd_id[2] + "号" + top_ynhyd[2] + "%\n" +
+                "月拟合优度末3:" + bottomnhyd_id[0] + "号" + bottom_ynhyd[0] + "%、" + bottomnhyd_id[1] + "号" + bottom_ynhyd[2] + "%、" + bottomnhyd_id[2] + "号" + bottom_ynhyd[2] + "%");
+
+        map.put("拟合优度排行—上月","拟合优度排行—上月:\n" +
+                "月拟合优度Top3:" + sytopnhyd_id[0] + "号" + sytop_ynhyd[0] + "%、" + sytopnhyd_id[1] + "号" + sytop_ynhyd[1] + "%、" + sytopnhyd_id[2] + "号" + sytop_ynhyd[2] + "%\n" +
+                "月拟合优度末3:" + sybottomnhyd_id[0] + "号" + sybottom_ynhyd[0] + "%、" + sybottomnhyd_id[1] + "号" + sybottom_ynhyd[1] + "%、" + sybottomnhyd_id[2] + "号" + sybottom_ynhyd[2] + "%");
+
+        String[] glyz_topid = new String[3];
+        double[] glyz_top = new double[3];
+        double[] lyxs_top = new double[3];
+
+        String[] syglyz_topid = new String[3];
+        double[] syglyz_top = new double[3];
+        double[] sylyxs_top = new double[3];
+
+
+        String[] glyz_botid = new String[3];
+        double[] glyz_bot = new double[3];
+        double[] lyxs_bot = new double[3];
+
+        String[] syglyz_botid = new String[3];
+        double[] syglyz_bot = new double[3];
+        double[] sylyxs_bot = new double[3];
+        for (int i = 0; i < glyztopList.size(); i++) {
+            var item_top = glyztopList.get(i);
+            glyz_topid[i] = item_top.getStationId();
+            glyz_top[i] = StringUtils.round(item_top.getGlyzxxs(), 2);
+            lyxs_top[i] = StringUtils.round(item_top.getLyxs(), 2);
+
+            var syitem_top = syglyztopList.get(i);
+            syglyz_topid[i] = syitem_top.getStationId();
+            syglyz_top[i] = StringUtils.round(syitem_top.getGlyzxxs(), 2);
+            sylyxs_top[i] = StringUtils.round(syitem_top.getLyxs(), 2);
+
+
+            var item_bot = glyztopList.get(i);
+            glyz_botid[i] = item_bot.getStationId();
+            glyz_bot[i] = StringUtils.round(item_bot.getGlyzxxs(), 2);
+            lyxs_bot[i] = StringUtils.round(item_bot.getLyxs(), 2);
+
+            var syitem_bot = syglyztopList.get(i);
+            syglyz_botid[i] = syitem_bot.getStationId();
+            syglyz_bot[i] = StringUtils.round(syitem_bot.getGlyzxxs(), 2);
+            sylyxs_bot[i] = StringUtils.round(syitem_bot.getLyxs(), 2);
+
+        }
+
+        map.put("单机月度分析-分析对象", "" + glyz_topid[0] + "、" + glyz_topid[1] + "、" + glyz_topid[2] + "、" + glyz_topid[0] + "、" + glyz_topid[1] + "、" + glyz_topid[2] + "、号风机");
+        map.put("单机月度分析-关键数据", "关键数据:\n" +
+                "Top3:" + glyz_topid[0] + "号 机组功率一致性" + glyz_top[0] + "%,设备利用小时:" + lyxs_top[0] + "h\n" +
+                "" + glyz_topid[1] + "号 机组功率一致性" + glyz_top[1] + "%,设备利用小时:" + lyxs_top[1] + "h\n" +
+                "" + glyz_topid[2] + "号 机组功率一致性" + glyz_top[2] + "%,设备利用小时:" + lyxs_top[2] + "h\n" +
+                "末3:" + glyz_botid[0] + "号 机组功率一致性" + glyz_bot[0] + "%,设备利用小时:" + lyxs_bot[0] + "h\n" +
+                "" + glyz_botid[1] + "号 机组功率一致性" + glyz_bot[1] + "%,设备利用小时:" + lyxs_bot[1] + "h\n" +
+                "" + glyz_botid[2] + "号 机组功率一致性" + glyz_bot[2] + "%,设备利用小时:" + lyxs_bot[2]);
+        map.put("单机月度分析-关键数据上月", "关键数据-上月:\n" +
+                "Top3:" + syglyz_topid[0] + "号 机组功率一致性" + syglyz_top[0] + "%,设备利用小时:" + sylyxs_top[0] + "h\n" +
+                "" + syglyz_topid[1] + "号 机组功率一致性" + syglyz_top[1] + "%,设备利用小时:" + sylyxs_top[1] + "h\n" +
+                "" + syglyz_topid[2] + "号 机组功率一致性" + syglyz_top[2] + "%,设备利用小时:" + sylyxs_top[2] + "h\n" +
+                "末3:" + syglyz_botid[0] + "号 机组功率一致性" + syglyz_bot[0] + "%,设备利用小时:" + sylyxs_bot[0] + "h\n" +
+                "" + syglyz_botid[1] + "号 机组功率一致性" + syglyz_bot[1] + "%,设备利用小时:" + sylyxs_bot[1] + "h\n" +
+                "" + syglyz_botid[2] + "号 机组功率一致性" + syglyz_bot[2] + "%,设备利用小时:" + sylyxs_bot[2]);
+
+
+        // 初始化统计Map
+        Map<String, Integer> levelCountMap = new HashMap<>();
+        Map<String, List<String>> levelStationMap = new HashMap<>();
+
+        for (String level : LEVELS) {
+            levelCountMap.put(level, 0);
+            levelStationMap.put(level, new ArrayList<>());
+        }
+
+        // 遍历统计
+        for (TurbineInfoDay item : xndjList) {
+            String level = item.getLevel();
+            String stationId = item.getStationId();
+
+            if (level != null && stationId != null) {
+                for (String targetLevel : LEVELS) {
+                    if (level.contains(targetLevel)) {
+                        levelCountMap.put(targetLevel, levelCountMap.get(targetLevel) + 1);
+                        // 只保留前3个ID
+                        if (levelStationMap.get(targetLevel).size() < 3) {
+                            levelStationMap.get(targetLevel).add(stationId);
+                        }
+                        break; // 找到一个匹配就跳出内层循环
+                    }
+                }
+            }
+        }
+
+        // 生成结果
+        int level_A = levelCountMap.get("A");
+        int level_B = levelCountMap.get("B");
+        int level_C = levelCountMap.get("C");
+
+        String level_Aid = String.join(",", levelStationMap.get("A"));
+        String level_Bid = String.join(",", levelStationMap.get("B"));
+        String level_Cid = String.join(",", levelStationMap.get("C"));
+
+        map.put("性能等级评估", "等级分布:\n" +
+                "A级(优秀):" + level_A + "台(" + level_Aid + "号等)\n" +
+                "B级(良好):" + level_B + "台(" + level_Bid + "号等)\n" +
+                "C级(合格):" + level_C + "台(" + level_Cid + "号等)");
+
+        double wfzfwcs = 0.0;
+        double sfzfwcs = 0.0;
+        double swfzfwcs = 0.0;
+        double esfzfwcs = 0.0;
+
+        double wfzfwl = 0.0;
+        double sfzfwl = 0.0;
+        double swfzfwl = 0.0;
+        double esfzfwl = 0.0;
+        if (stateRateList.size() > 0) {
+
+            wfzfwcs = stateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate16())
+                    .sum();
+
+            sfzfwcs = stateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate17())
+                    .sum();
+
+            swfzfwcs = stateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate18())
+                    .sum();
+
+            esfzfwcs = stateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate19())
+                    .sum();
+
+            wfzfwl = stateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate20() != 0)
+                    .mapToDouble(o -> o.getTimerate16() / o.getTimerate20() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+
+            sfzfwl = stateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate20() != 0)
+                    .mapToDouble(o -> o.getTimerate17() / o.getTimerate20() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+
+            swfzfwl = stateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate20() != 0)
+                    .mapToDouble(o -> o.getTimerate18() / o.getTimerate20() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+
+            esfzfwl = stateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate20() != 0)
+                    .mapToDouble(o -> o.getTimerate19() / o.getTimerate20() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+        }
+
+        double sy_wfzcs = 0.0;
+        double sy_zcs = 0.0;
+        if (systateRateList.size() > 0) {
+            sy_wfzcs = systateRateList.get(0).getTimerate16();
+            sy_zcs = systateRateList.get(0).getTimerate16();
+        }
+
+        double sywfzfwl = StringUtils.round(sy_wfzcs / sy_zcs * 100, 2);
+
+        String[] wfzfwcsbot_id = new String[3];
+        double[] wfzfwcsbot = new double[3];
+        for (int i = 0; i < stateRatebotList.size(); i++) {
+            var item = stateRatebotList.get(i);
+            wfzfwcsbot_id[i] = item.getWindturbineId();
+            wfzfwcsbot[i] = item.getTimerate16();
+        }
+        double fwltb = StringUtils.round((wfzfwl - sywfzfwl) / sywfzfwl * 100,2);
+        map.put("复位及时率", "月度5分钟: 复位次数 "+ wfzfwcs + "次"+",复位及时率:" + wfzfwl + "%\n" +
+                "月度10分钟:复位次数"+ sfzfwcs + "次"+",复位及时率:" + sfzfwl + "%\n" +
+                "月度15分钟:复位次数"+ swfzfwcs +"次"+",复位及时率:" + swfzfwl + "%\n" +
+                "月度20分钟:复位次数"+ esfzfwcs + "次" +"复位及时率:" + esfzfwl + "%\n" +
+                "月度5分钟复位次数排名最低的三台风机:" + wfzfwcsbot_id[0] + "号(" + wfzfwcsbot[0] + "次)、" + wfzfwcsbot_id[1] + "号(" + wfzfwcsbot[1] + "次)、" + wfzfwcsbot_id[2] + "号(" + wfzfwcsbot[2] + "次)\n" +
+                "与上月对比:月度5分钟复位及时率环比" + fwltb + "%(±)");
+
+        double ydgzcs = 0.0;
+        double ydxqcs = 0.0;
+        double ydxqjsl = 0.0;
+        if (liminatedefects.size() > 0) {
+            ydgzcs = liminatedefects.get(0).getFaultCount();
+            ydxqcs = liminatedefects.get(0).getRightCount();
+            ydxqjsl = StringUtils.round(liminatedefects.get(0).getRate(), 2);
+        }
+        double nxqjsl = yearliminatedefects.size() > 0 ? StringUtils.round(yearliminatedefects.get(0).getRate(), 2) : 0.0;
+        double syxqjsl = syliminatedefects.size() > 0 ? StringUtils.round(syliminatedefects.get(0).getRate(), 2) : 0.0;
+
+        double xqjsl_hb = StringUtils.round((ydxqjsl -syxqjsl) /syxqjsl * 100,2);
+        map.put("消缺及时率", "月度故障次数:" + ydgzcs + "次\n" +
+                "月度消缺及时次数:" + ydxqcs + "次\n" +
+                "月度消缺及时率:" + ydxqjsl + "%\n" +
+                "年度消缺及时率:" + nxqjsl + "%\n" +
+                "与上月对比:月度环比" + xqjsl_hb + "%(±)");
+
+
+        double wfzcs = 0.0;
+        double sfzcs = 0.0;
+        double swfzcs = 0.0;
+        double esfzcs = 0.0;
+
+        double wfzzhl = 0.0;
+        double sfzzhl = 0.0;
+        double swfzzhl = 0.0;
+        double esfzzhl = 0.0;
+
+        if (threestateRateList.size() > 0) {
+            // 累加计算,检查列表是否为 null
+            wfzcs = threestateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate5())
+                    .sum();
+
+            sfzcs = threestateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate6())
+                    .sum();
+
+            swfzcs = threestateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate7())
+                    .sum();
+
+            esfzcs = threestateRateList.stream()
+                    .filter(o -> o != null)
+                    .mapToDouble(o -> o.getTimerate8())
+                    .sum();
+
+            wfzzhl = threestateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate14() != 0)
+                    .mapToDouble(o -> o.getTimerate5() / o.getTimerate14() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+
+            sfzzhl = threestateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate14() != 0)
+                    .mapToDouble(o -> o.getTimerate6() / o.getTimerate14() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+
+            swfzzhl = threestateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate14() != 0)
+                    .mapToDouble(o -> o.getTimerate7() / o.getTimerate14() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+
+            esfzzhl = threestateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate14() != 0)
+                    .mapToDouble(o -> o.getTimerate8() / o.getTimerate14() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+        }
+
+        double[] ztzhbot_cs = new double[3];
+        String[] ztzhbot_id = new String[3];
+
+        for (int i = 0; i < threestateRatebotList.size(); i++) {
+            var item = threestateRatebotList.get(i);
+            ztzhbot_id[i] = item.getWindturbineId();
+            ztzhbot_cs[i] = item.getTimerate5();
+        }
+        double sy_ztzhl = 0.0;
+        if (threesystateRateList.size()>0){
+            sy_ztzhl = threesystateRateList.stream()
+                    .filter(o -> o != null && o.getTimerate14() != 0)
+                    .mapToDouble(o -> o.getTimerate5() / o.getTimerate14() * 100)
+                    .map(d -> new BigDecimal(d).setScale(2, RoundingMode.DOWN).doubleValue())
+                    .sum();
+        }
+
+        double ztzhl_hb = StringUtils.round((wfzzhl-sy_ztzhl) / sy_ztzhl * 100,2);
+//        map.put("状态转换率", "大于3米风速转换次数及转换率:\n" +
+//                "5分钟:转换次数为"+wfzcs+"次,转换率为"+wfzzhl+"%\n" +
+//                "10分钟:转换次数为"+sfzcs+"次,转换率为"+sfzzhl+"%\n" +
+//                "15分钟:转换次数为"+swfzcs+"次,转换率为"+swfzzhl+"%\n" +
+//                "20分钟:转换次数为"+esfzcs+"次,转换率为"+esfzzhl+"%\n" +
+//                "月度5分钟转换次数排名最低的三台风机:"+ztzhbot_id[0]+"号("+ztzhbot_cs[0]+"次)、"+ztzhbot_id[1]+"号("+ztzhbot_cs[1]+"次)、"+ztzhbot_id[2]+"号("+ztzhbot_cs[2]+"次)\n" +
+//                "与上月对比:月度5分钟转换率环比"+ztzhl_hb+"%(±)");
+
+        map.put("状态转换率-大于3米风速","大于3米风速转换次数及转换率:\n" +
+                "5分钟:转换次数为"+wfzcs+"次,转换率为"+wfzzhl+"%\n" +
+                "10分钟:转换次数为"+sfzcs+"次,转换率为"+sfzzhl+"%\n" +
+                "15分钟:转换次数为"+swfzcs+"次,转换率为"+swfzzhl+"%\n" +
+                "20分钟:转换次数为"+esfzcs+"次,转换率为"+esfzzhl+"%");
+        map.put("状态转换率-月度5分钟","月度5分钟转换次数排名最低的三台风机:"+ztzhbot_id[0]+"号("+ztzhbot_cs[0]+"次)、"+ztzhbot_id[1]+"号("+ztzhbot_cs[1]+"次)、"+ztzhbot_id[2]+"号("+ztzhbot_cs[2]+"次)");
+        map.put("状态转换率-与上月对比","与上月对比:月度5分钟转换率环比"+ztzhl_hb+"%(±)");
+        return map;
+    }
+
+    /**
+     * 通用的ID匹配和nemCode赋值方法
+     * 将wtls集合中与list匹配项的nemCode赋值给list的指定字段
+     * 匹配条件:wtls的id与list的指定ID字段相等
+     *
+     * @param wtls       风机基础信息集合
+     * @param list       目标信息集合
+     * @param idGetter   获取ID的函数
+     * @param idSetter   设置ID的函数
+     * @param <T>        目标信息类型
+     */
+    public <T> void setIdFromNemCode(List<ProBasicEquipment> wtls, List<T> list,
+                                     Function<T, String> idGetter, BiConsumer<T, String> idSetter) {
+        for (T item : list) {
+            String id = idGetter.apply(item);
+            if (id == null) {
+                continue;
+            }
+            for (ProBasicEquipment equipment : wtls) {
+                if (id.equals(equipment.getId())) {
+                    idSetter.accept(item, equipment.getNemCode());
+                    break;
+                }
+            }
+        }
+    }
+
+    // 通用方法,处理一组集合的 setIdFromNemCode 调用
+    private <T> void applySetIdFromNemCode(
+            List<ProBasicEquipment> wtls,
+            List<List<T>> collections,
+            Function<T, String> idGetter,
+            BiConsumer<T, String> idSetter) {
+        for (List<T> collection : collections) {
+            setIdFromNemCode(wtls, collection, idGetter, idSetter);
+        }
+    }
+
+}

+ 4 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/IStationInfoMonthService.java

@@ -20,4 +20,8 @@ public interface IStationInfoMonthService extends IService<StationInfoMonth> {
     List<StationInfoMonth> getInfoByDate(Date date);
     List<StationInfoMonth> getInfoByDate(Date date, List<PointInfo> entity);
     Map<String, StationInfoMonth> getInfoByDateMap(Date date, List<PointInfo> entity);
+    List<StationInfoMonth> monthslist(String  time);
+    List<StationInfoMonth> qndylist(String  time);
+    List<StationInfoMonth> yearlist(String  time);
+    List<StationInfoMonth> qnmttlist(String  time);
 }

+ 4 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconCurveFittMonthMainService.java

@@ -3,6 +3,8 @@ package com.gyee.runeconomy.service.auto;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.runeconomy.model.auto.ProEconCurveFittMonthMain;
 
+import java.util.List;
+
 /**
  * <p>
  * 风电机月拟合曲线主表 服务类
@@ -14,4 +16,6 @@ import com.gyee.runeconomy.model.auto.ProEconCurveFittMonthMain;
 public interface IProEconCurveFittMonthMainService extends IService<ProEconCurveFittMonthMain> {
 
     public int deleteProEconCurveFittMonthMainByMonth(String year, String month);
+
+    List<ProEconCurveFittMonthMain> getlist(String year,String month);
 }

+ 4 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconEquipmentInfoDay4Service.java

@@ -3,6 +3,8 @@ package com.gyee.runeconomy.service.auto;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.runeconomy.model.auto.ProEconEquipmentInfoDay4;
 
+import java.util.List;
+
 /**
  * <p>
  * 五损曲线偏差率切入性能 服务类
@@ -13,4 +15,6 @@ import com.gyee.runeconomy.model.auto.ProEconEquipmentInfoDay4;
  */
 public interface IProEconEquipmentInfoDay4Service extends IService<ProEconEquipmentInfoDay4> {
 
+    List<ProEconEquipmentInfoDay4> getpcllist (String time);
+
 }

+ 7 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconEquipmentInfoDay5Service.java

@@ -19,4 +19,11 @@ public interface IProEconEquipmentInfoDay5Service extends IService<ProEconEquipm
 
     List<ProEconEquipmentInfoDay5> getStateConversionRateList(String companyId, String windpowerstationId, String beginDate, String endDate);
 
+    List<ProEconEquipmentInfoDay5> getStateRateList(String time);
+    List<ProEconEquipmentInfoDay5> getthreeStateRateList(String time);
+    List<ProEconEquipmentInfoDay5> getsyStateRateList(String time);
+    List<ProEconEquipmentInfoDay5> getsythreeStateRateList(String time);
+    List<ProEconEquipmentInfoDay5> getStateRatebottomList(String time);
+    List<ProEconEquipmentInfoDay5> getthreeStateRatebottomList(String time);
+
 }

+ 6 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconFaultLiminatedefectsService.java

@@ -3,6 +3,8 @@ package com.gyee.runeconomy.service.auto;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.runeconomy.model.auto.ProEconFaultLiminatedefects;
 
+import java.util.List;
+
 /**
  * <p>
  * 故障消缺及时率 服务类
@@ -13,4 +15,8 @@ import com.gyee.runeconomy.model.auto.ProEconFaultLiminatedefects;
  */
 public interface IProEconFaultLiminatedefectsService extends IService<ProEconFaultLiminatedefects> {
 
+    List<ProEconFaultLiminatedefects> getlist(String time);
+    List<ProEconFaultLiminatedefects> getsylist(String time);
+    List<ProEconFaultLiminatedefects> getyearlist(String time);
+
 }

+ 5 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconInOrOutSpeedTotalService.java

@@ -3,6 +3,8 @@ package com.gyee.runeconomy.service.auto;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.runeconomy.model.auto.ProEconInOrOutSpeedTotal;
 
+import java.util.List;
+
 /**
  * <p>
  * 切入切出风速整合 服务类
@@ -13,4 +15,7 @@ import com.gyee.runeconomy.model.auto.ProEconInOrOutSpeedTotal;
  */
 public interface IProEconInOrOutSpeedTotalService extends IService<ProEconInOrOutSpeedTotal> {
 
+    List<ProEconInOrOutSpeedTotal> gettoplist(String time);
+    List<ProEconInOrOutSpeedTotal> getlist(String time);
+
 }

+ 5 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconPowerstationInfoDay4Service.java

@@ -45,4 +45,9 @@ public interface IProEconPowerstationInfoDay4Service extends IService<ProEconPow
 
     List<ProEconPowerstationInfoDay4> getEconThreeRateCurvelist(List<String> foreignKeyIds, Date date);
 
+    List<ProEconPowerstationInfoDay4> dyList(String time);
+    List<ProEconPowerstationInfoDay4> qndymttList(String time);
+    List<ProEconPowerstationInfoDay4> yearmttrList(String time);
+    List<ProEconPowerstationInfoDay4> qnmttList(String time);
+
 }

+ 6 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IProEconWindturbineGoodnessService.java

@@ -3,6 +3,8 @@ package com.gyee.runeconomy.service.auto;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.gyee.runeconomy.model.auto.ProEconWindturbineGoodness;
 
+import java.util.List;
+
 /**
  * <p>
  * 风电机拟合优度 服务类
@@ -13,4 +15,8 @@ import com.gyee.runeconomy.model.auto.ProEconWindturbineGoodness;
  */
 public interface IProEconWindturbineGoodnessService extends IService<ProEconWindturbineGoodness> {
 
+    List<ProEconWindturbineGoodness> gettop(String time);
+    List<ProEconWindturbineGoodness> getsytop(String time);
+    List<ProEconWindturbineGoodness> getbottom(String time);
+    List<ProEconWindturbineGoodness> getsybottom(String time);
 }

+ 5 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/IStationInfoDayService.java

@@ -21,4 +21,9 @@ public interface IStationInfoDayService extends IService<StationInfoDay> {
     List<StationInfoDay> getTurbineList(String wpid, String kssj, String jssj) throws ParseException;
 
     List<StationInfoDay> getSum(String foreignKeyId, Date date);
+
+    List<StationInfoDay> getmonthList(String time);
+    List<StationInfoDay> getqnmonthList(String time);
+
+    List<StationInfoDay> getyearList(String time);
 }

+ 24 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/ITurbineInfoDayService.java

@@ -35,4 +35,28 @@ public interface ITurbineInfoDayService extends IService<TurbineInfoDay> {
      * 获取单台风机一段时间电量
      */
     List<TurbineInfoDay> getTurbineSingleList(String turbineId, Date startDate, Date endDate);
+    List<TurbineInfoDay> getwpidList(String wpid,String kssj,String jssj) throws ParseException;
+    List<TurbineInfoDay> monthList(String time);
+    List<TurbineInfoDay> hbmonthList(String time);//当前月份减去一个月
+    List<TurbineInfoDay> topList(String time);
+    List<TurbineInfoDay> fntopList(String time);
+    List<TurbineInfoDay> ssdltopList(String time);
+    List<TurbineInfoDay> gzcstopList(String time);
+    List<TurbineInfoDay> gzcssumList(String time);
+    List<TurbineInfoDay> bottomList(String time);
+    List<TurbineInfoDay> fnbottomList(String time);
+    List<TurbineInfoDay> ssdlbottomList(String time);
+    List<TurbineInfoDay> lineList(String time);
+    List<TurbineInfoDay> qnmonthList(String time);
+    List<TurbineInfoDay> yearList(String time);
+    List<TurbineInfoDay> qyearList(String time);
+    List<TurbineInfoDay> klyltopList(String time);
+    List<TurbineInfoDay> klylbottomList(String time);
+    List<TurbineInfoDay> glyztopList(String time);
+    List<TurbineInfoDay> glyzbottomList(String time);
+
+    List<TurbineInfoDay> syglyztopList(String time);
+    List<TurbineInfoDay> syglyzbottomList(String time);
+
+    List<TurbineInfoDay> xndjList(String time);
 }

+ 16 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconCurveFittMonthMainServiceImpl.java

@@ -1,5 +1,6 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.runeconomy.mapper.auto.ProEconCurveFittMonthMainMapper;
 import com.gyee.runeconomy.model.auto.ProEconCurveFittMonthMain;
@@ -7,6 +8,8 @@ import com.gyee.runeconomy.service.auto.IProEconCurveFittMonthMainService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Collections;
+import java.util.List;
 
 /**
  * <p>
@@ -27,4 +30,17 @@ public class ProEconCurveFittMonthMainServiceImpl extends ServiceImpl<ProEconCur
 
         return proEconCurveFittMonthMainMapper.deleteProEconCurveFittMonthSubByMonth(year, month);
     }
+
+    @Override
+    public List<ProEconCurveFittMonthMain> getlist(String year,String month) {
+        QueryWrapper<ProEconCurveFittMonthMain> qw = new QueryWrapper<>();
+        qw.lambda()
+                .eq(ProEconCurveFittMonthMain::getYear, year)
+                .like(ProEconCurveFittMonthMain::getMonth, month)
+                .orderByDesc(ProEconCurveFittMonthMain::getDeviationRate2)  // 按DeviationRate2降序排列
+                .last("LIMIT 3");  // 限制返回前3条记录
+
+        List<ProEconCurveFittMonthMain> list = baseMapper.selectList(qw);
+        return list;
+    }
 }

+ 11 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconEquipmentInfoDay4ServiceImpl.java

@@ -1,11 +1,15 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.runeconomy.mapper.auto.ProEconEquipmentInfoDay4Mapper;
 import com.gyee.runeconomy.model.auto.ProEconEquipmentInfoDay4;
 import com.gyee.runeconomy.service.auto.IProEconEquipmentInfoDay4Service;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
+import java.util.List;
+
 /**
  * <p>
  * 五损曲线偏差率切入性能 服务实现类
@@ -17,4 +21,11 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconEquipmentInfoDay4ServiceImpl extends ServiceImpl<ProEconEquipmentInfoDay4Mapper, ProEconEquipmentInfoDay4> implements IProEconEquipmentInfoDay4Service {
 
+    @Override
+    public List<ProEconEquipmentInfoDay4> getpcllist(String time) {
+        QueryWrapper<ProEconEquipmentInfoDay4> qw = new QueryWrapper<>();
+        qw.eq("to_char(record_date,'yyyy-MM')", time);
+        List<ProEconEquipmentInfoDay4> infoDay4s = baseMapper.selectList(qw);
+        return infoDay4s;
+    }
 }

+ 90 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconEquipmentInfoDay5ServiceImpl.java

@@ -10,6 +10,9 @@ import com.gyee.runeconomy.service.auto.IProEconEquipmentInfoDay5Service;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -82,4 +85,91 @@ public class ProEconEquipmentInfoDay5ServiceImpl extends ServiceImpl<ProEconEqui
         List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
         return list;
     }
+
+    @Override
+    public List<ProEconEquipmentInfoDay5> getStateRateList(String time) {
+
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        sb.append("sum(TIMERATE20) TIMERATE20, sum(TIMERATE16) TIMERATE16, sum(TIMERATE17) TIMERATE17,sum(TIMERATE18) TIMERATE18, sum(TIMERATE19) TIMERATE19 ");
+
+        qw.select(sb.toString());
+        qw.eq("to_char(record_date,'yyyy-MM')", time);
+        qw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+    @Override
+    public List<ProEconEquipmentInfoDay5> getthreeStateRateList(String time) {
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        sb.append("sum(TIMERATE5) TIMERATE5, sum(TIMERATE6) TIMERATE6, sum(TIMERATE7) TIMERATE7,sum(TIMERATE8) TIMERATE8, sum(TIMERATE14) TIMERATE14");
+
+        qw.select(sb.toString());
+        qw.eq("to_char(record_date,'yyyy-MM')", time);
+        qw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+    @Override
+    public List<ProEconEquipmentInfoDay5> getsyStateRateList(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        sb.append("sum(TIMERATE20) TIMERATE20, sum(TIMERATE16) TIMERATE16, sum(TIMERATE17) TIMERATE17,sum(TIMERATE18) TIMERATE18, sum(TIMERATE19) TIMERATE19 ");
+
+        qw.select(sb.toString());
+        qw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
+        qw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+    @Override
+    public List<ProEconEquipmentInfoDay5> getsythreeStateRateList(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        StringBuilder sb = new StringBuilder();
+        sb.append("sum(TIMERATE5) TIMERATE5, sum(TIMERATE6) TIMERATE6, sum(TIMERATE7) TIMERATE7,sum(TIMERATE8) TIMERATE8, sum(TIMERATE14) TIMERATE14");
+
+        qw.select(sb.toString());
+        qw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
+        qw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+    @Override
+    public List<ProEconEquipmentInfoDay5> getStateRatebottomList(String time) {
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        qw.select("windturbine_id,sum(TIMERATE16) TIMERATE16 "); // 按风机分组
+        qw.eq("to_char(record_date,'yyyy-MM')", time);
+        qw.groupBy("windturbine_id"); // 按风机ID分组
+        qw.orderByAsc("sum(TIMERATE16)"); // 按总发电量降序排列
+        qw.last("LIMIT 3"); // 限制返回前3条记录
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+    @Override
+    public List<ProEconEquipmentInfoDay5> getthreeStateRatebottomList(String time) {
+        QueryWrapper<ProEconEquipmentInfoDay5> qw = new QueryWrapper<>();
+        qw.select("windturbine_id,sum(TIMERATE5) TIMERATE5 "); // 按风机分组
+        qw.eq("to_char(record_date,'yyyy-MM')", time);
+        qw.groupBy("windturbine_id"); // 按风机ID分组
+        qw.orderByAsc("sum(TIMERATE5)"); // 按总发电量降序排列
+        qw.last("LIMIT 3"); // 限制返回前3条记录
+        List<ProEconEquipmentInfoDay5> list = baseMapper.selectList(qw);
+        return list;
+    }
 }

+ 42 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconFaultLiminatedefectsServiceImpl.java

@@ -1,11 +1,17 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.runeconomy.mapper.auto.ProEconFaultLiminatedefectsMapper;
 import com.gyee.runeconomy.model.auto.ProEconFaultLiminatedefects;
 import com.gyee.runeconomy.service.auto.IProEconFaultLiminatedefectsService;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.List;
+
 /**
  * <p>
  * 故障消缺及时率 服务实现类
@@ -17,4 +23,40 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconFaultLiminatedefectsServiceImpl extends ServiceImpl<ProEconFaultLiminatedefectsMapper, ProEconFaultLiminatedefects> implements IProEconFaultLiminatedefectsService {
 
+    @Override
+    public List<ProEconFaultLiminatedefects> getlist(String time) {
+        QueryWrapper<ProEconFaultLiminatedefects> qw = new QueryWrapper<>();
+        qw.select("sum(fault_count) as fault_count,sum(right_count) as right_count,AVG(rate) as rate");
+        qw.eq("to_char(date_time,'yyyy-MM')", time);
+        qw.groupBy("to_char(date_time,'yyyy-MM')");
+        List<ProEconFaultLiminatedefects> proEconFaultLiminatedefects = baseMapper.selectList(qw);
+        return proEconFaultLiminatedefects;
+    }
+
+    @Override
+    public List<ProEconFaultLiminatedefects> getyearlist(String time) {
+        QueryWrapper<ProEconFaultLiminatedefects> qw = new QueryWrapper<>();
+        qw.select("sum(fault_count) as fault_count,sum(right_count) as right_count,AVG(rate) as rate");
+        LocalDate startDate = LocalDate.of(Integer.parseInt(time.substring(0, 4)), 1, 1);
+        LocalDate endDate = LocalDate.parse(time + "-01").plusMonths(1);
+        qw.ge("date_time", startDate)
+                .lt("date_time", endDate);
+        List<ProEconFaultLiminatedefects> proEconFaultLiminatedefects = baseMapper.selectList(qw);
+        return proEconFaultLiminatedefects;
+    }
+
+    @Override
+    public List<ProEconFaultLiminatedefects> getsylist(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<ProEconFaultLiminatedefects> qw = new QueryWrapper<>();
+        qw.select("sum(fault_count) as fault_count,sum(right_count) as right_count,AVG(rate) as rate");
+        qw.eq("to_char(date_time,'yyyy-MM')", previousMonthStr);
+        qw.groupBy("to_char(date_time,'yyyy-MM')");
+        List<ProEconFaultLiminatedefects> proEconFaultLiminatedefects = baseMapper.selectList(qw);
+        return proEconFaultLiminatedefects;
+    }
 }

+ 58 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconInOrOutSpeedTotalServiceImpl.java

@@ -1,11 +1,18 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.runeconomy.mapper.auto.ProEconInOrOutSpeedTotalMapper;
 import com.gyee.runeconomy.model.auto.ProEconInOrOutSpeedTotal;
 import com.gyee.runeconomy.service.auto.IProEconInOrOutSpeedTotalService;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.List;
+
 /**
  * <p>
  * 切入切出风速整合 服务实现类
@@ -17,4 +24,55 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconInOrOutSpeedTotalServiceImpl extends ServiceImpl<ProEconInOrOutSpeedTotalMapper, ProEconInOrOutSpeedTotal> implements IProEconInOrOutSpeedTotalService {
 
+    @Override
+    public List<ProEconInOrOutSpeedTotal> gettoplist(String time) {
+        // 解析参数时间
+        YearMonth paramYearMonth = YearMonth.parse(time, DateTimeFormatter.ofPattern("yyyy-MM"));
+        LocalDate now = LocalDate.now();
+
+        QueryWrapper<ProEconInOrOutSpeedTotal> qw = new QueryWrapper<>();
+
+        if (paramYearMonth.getYear() == now.getYear() && paramYearMonth.getMonth() == now.getMonth()) {
+            // 当前月份:查询前一天数据
+            LocalDate yesterday = now.minusDays(1);
+            qw.lambda()
+                    .eq(ProEconInOrOutSpeedTotal::getRecordDate, yesterday)  // 直接传入LocalDate
+                    .orderByDesc(ProEconInOrOutSpeedTotal::getMonthInputSmallRatio)
+                    .last("LIMIT 3");
+        } else {
+            // 其他月份:查询该月最后一天的数据
+            LocalDate lastDay = paramYearMonth.atEndOfMonth();
+            qw.lambda()
+                    .eq(ProEconInOrOutSpeedTotal::getRecordDate, lastDay)  // 直接传入LocalDate
+                    .orderByDesc(ProEconInOrOutSpeedTotal::getMonthInputSmallRatio)
+                    .last("LIMIT 3");
+        }
+
+        List<ProEconInOrOutSpeedTotal> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+    @Override
+    public List<ProEconInOrOutSpeedTotal> getlist(String time) {
+        // 解析参数时间
+        YearMonth paramYearMonth = YearMonth.parse(time, DateTimeFormatter.ofPattern("yyyy-MM"));
+        LocalDate now = LocalDate.now();
+
+        QueryWrapper<ProEconInOrOutSpeedTotal> qw = new QueryWrapper<>();
+
+        if (paramYearMonth.getYear() == now.getYear() && paramYearMonth.getMonth() == now.getMonth()) {
+            // 当前月份:查询前一天数据
+            LocalDate yesterday = now.minusDays(1);
+            qw.lambda().eq(ProEconInOrOutSpeedTotal::getRecordDate, yesterday);
+        } else {
+            // 其他月份:查询该月最后一天的数据
+            LocalDate lastDay = paramYearMonth.atEndOfMonth();
+            qw.lambda().eq(ProEconInOrOutSpeedTotal::getRecordDate, lastDay);
+        }
+
+        List<ProEconInOrOutSpeedTotal> list = baseMapper.selectList(qw);
+
+        return list;
+
+    }
 }

+ 54 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconPowerstationInfoDay4ServiceImpl.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.common.model.StringUtils;
 import com.gyee.common.util.DateUtils;
+import com.gyee.runeconomy.entity.StationInfoMonth;
 import com.gyee.runeconomy.mapper.auto.ProEconPowerstationInfoDay4Mapper;
 import com.gyee.runeconomy.model.auto.ProEconPowerstationInfoDay4;
 import com.gyee.runeconomy.service.auto.IProEconPowerstationInfoDay4Service;
@@ -114,4 +115,57 @@ public class ProEconPowerstationInfoDay4ServiceImpl extends ServiceImpl<ProEconP
 
         return list;
     }
+
+    @Override
+    public List<ProEconPowerstationInfoDay4> dyList(String time) {
+        QueryWrapper<ProEconPowerstationInfoDay4> qw = new QueryWrapper<>();
+        qw.select("foreign_key_id,sum(rmtbf) ymtbf,sum(rmttr) ymttr,avg(rfwjsl) yfwjsl,avg(rztzhjsl) yztzhjsl,avg(rgzxqjsl) ygzxqjsl");
+        qw.eq("location", "wp");
+        qw.like("foreign_key_id", "_FDC_");
+        qw.eq("to_char(record_date,'yyyy-MM')", time);
+        qw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
+        List<ProEconPowerstationInfoDay4> dyList = baseMapper.selectList(qw);
+        return dyList;
+    }
+
+    @Override
+    public List<ProEconPowerstationInfoDay4> qndymttList(String time) {
+        String yearString = time.split("-")[0];
+        String year = String.valueOf(Integer.parseInt(yearString) - 1);
+        String yearMonth = year + "-" + time.split("-")[1];
+        QueryWrapper<ProEconPowerstationInfoDay4> qndymttqw = new QueryWrapper<>();
+        qndymttqw.select("foreign_key_id,sum(rmtbf) ymtbf,sum(rmttr) ymttr,avg(rfwjsl) yfwjsl,avg(rztzhjsl) yztzhjsl,avg(rgzxqjsl) ygzxqjsl");
+        qndymttqw.eq("location", "wp");
+        qndymttqw.like("foreign_key_id", "_FDC_");
+        qndymttqw.eq("to_char(record_date,'yyyy-MM')", yearMonth);
+        qndymttqw.groupBy("to_char(record_date,'yyyy-MM'),foreign_key_id");
+        List<ProEconPowerstationInfoDay4> qndymttList = baseMapper.selectList(qndymttqw);
+        return qndymttList;
+    }
+
+    @Override
+    public List<ProEconPowerstationInfoDay4> yearmttrList(String time) {
+        QueryWrapper<ProEconPowerstationInfoDay4> yearmttrqw = new QueryWrapper<>();
+        yearmttrqw.select("foreign_key_id,sum(rmtbf) nmtbf,sum(rmttr) nmttr,avg(rfwjsl) nfwjsl,avg(rztzhjsl) nztzhjsl,avg(rgzxqjsl) ngzxqjsl");
+        yearmttrqw.eq("location", "wp");
+        yearmttrqw.like("foreign_key_id", "_FDC_");
+        yearmttrqw.eq("to_char(record_date,'yyyy')", time.split("-")[0]);
+        yearmttrqw.groupBy("to_char(record_date,'yyyy'),foreign_key_id");
+        List<ProEconPowerstationInfoDay4> yearmttrList = baseMapper.selectList(yearmttrqw);
+        return yearmttrList;
+    }
+
+    @Override
+    public List<ProEconPowerstationInfoDay4> qnmttList(String time) {
+        String yearString = time.split("-")[0];
+        String year = String.valueOf(Integer.parseInt(yearString) - 1);
+        QueryWrapper<ProEconPowerstationInfoDay4> qnmttqw = new QueryWrapper<>();
+        qnmttqw.select("foreign_key_id,sum(rmtbf) nmtbf,sum(rmttr) nmttr,avg(rfwjsl) nfwjsl,avg(rztzhjsl) nztzhjsl,avg(rgzxqjsl) ngzxqjsl");
+        qnmttqw.eq("location", "wp");
+        qnmttqw.like("foreign_key_id", "_FDC_");
+        qnmttqw.eq("to_char(record_date,'yyyy')", year);
+        qnmttqw.groupBy("to_char(record_date,'yyyy'),foreign_key_id");
+        List<ProEconPowerstationInfoDay4> qnmttList = baseMapper.selectList(qnmttqw);
+        return qnmttList;
+    }
 }

+ 66 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProEconWindturbineGoodnessServiceImpl.java

@@ -1,11 +1,17 @@
 package com.gyee.runeconomy.service.auto.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.runeconomy.mapper.auto.ProEconWindturbineGoodnessMapper;
 import com.gyee.runeconomy.model.auto.ProEconWindturbineGoodness;
 import com.gyee.runeconomy.service.auto.IProEconWindturbineGoodnessService;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.Collections;
+import java.util.List;
+
 /**
  * <p>
  * 风电机拟合优度 服务实现类
@@ -17,4 +23,64 @@ import org.springframework.stereotype.Service;
 @Service
 public class ProEconWindturbineGoodnessServiceImpl extends ServiceImpl<ProEconWindturbineGoodnessMapper, ProEconWindturbineGoodness> implements IProEconWindturbineGoodnessService {
 
+    @Override
+    public List<ProEconWindturbineGoodness> gettop(String time) {
+        QueryWrapper<ProEconWindturbineGoodness> monthqw = new QueryWrapper<>();
+        monthqw.select("windturbine_id, AVG(month_goodness) as month_goodness");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("windturbine_id");
+        monthqw.orderByDesc("AVG(month_goodness)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<ProEconWindturbineGoodness> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<ProEconWindturbineGoodness> getsytop(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<ProEconWindturbineGoodness> monthqw = new QueryWrapper<>();
+        monthqw.select("windturbine_id, AVG(month_goodness) as month_goodness");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
+        monthqw.groupBy("windturbine_id");
+        monthqw.orderByDesc("AVG(month_goodness)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<ProEconWindturbineGoodness> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<ProEconWindturbineGoodness> getbottom(String time) {
+        QueryWrapper<ProEconWindturbineGoodness> monthqw = new QueryWrapper<>();
+        monthqw.select("windturbine_id, AVG(month_goodness) as month_goodness");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("windturbine_id");
+        monthqw.orderByAsc("AVG(month_goodness)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<ProEconWindturbineGoodness> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<ProEconWindturbineGoodness> getsybottom(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<ProEconWindturbineGoodness> monthqw = new QueryWrapper<>();
+        monthqw.select("windturbine_id, AVG(month_goodness) as month_goodness");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
+        monthqw.groupBy("windturbine_id");
+        monthqw.orderByAsc("AVG(month_goodness)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+        List<ProEconWindturbineGoodness> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
 }

+ 37 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/StationInfoDayServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
 import java.util.*;
 
 /**
@@ -126,6 +127,42 @@ public class StationInfoDayServiceImpl extends ServiceImpl<StationInfoDayMapper,
     }
 
     @Override
+    public List<StationInfoDay> getmonthList(String time) {
+        QueryWrapper<StationInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("sum(rfdl) as rfdl,AVG(cftfs) as cftfs,AVG(cftfx) as cftfx,sum(zhcydl) as zhcydl");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<StationInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+
+    @Override
+    public List<StationInfoDay> getqnmonthList(String time) {
+        String yearString = time.split("-")[0];
+        String year = String.valueOf(Integer.parseInt(yearString) - 1);
+        String yearMonth = year + "-" + time.split("-")[1];
+        QueryWrapper<StationInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("sum(rfdl) as rfdl, AVG(cftfs) as cftfs,AVG(cftfx) as cftfx,sum(zhcydl) as zhcydl");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", yearMonth);
+        monthqw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<StationInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<StationInfoDay> getyearList(String time) {
+        QueryWrapper<StationInfoDay> yearqw = new QueryWrapper<>();
+        yearqw.select("sum(rfdl) as rfdl, sum(zhcydl) as zhcydl");
+        LocalDate startDate = LocalDate.of(Integer.parseInt(time.substring(0, 4)), 1, 1);
+        LocalDate endDate = LocalDate.parse(time + "-01").plusMonths(1);
+        yearqw.ge("record_date", startDate)
+                .lt("record_date", endDate);
+        List<StationInfoDay> monthList = baseMapper.selectList(yearqw);
+        return monthList;
+    }
+
+    @Override
     public List<StationInfoDay> getTurbineList(String wpid, String kssj, String jssj) throws ParseException {
         QueryWrapper<StationInfoDay> qw = new QueryWrapper<>();
         Date kssjDate = new SimpleDateFormat("yyyy-MM-dd").parse(kssj);

+ 305 - 0
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/TurbineInfoDayServiceImpl.java

@@ -10,6 +10,8 @@ import org.springframework.stereotype.Service;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
 import java.util.Date;
 import java.util.List;
 
@@ -155,4 +157,307 @@ public class TurbineInfoDayServiceImpl extends ServiceImpl<TurbineInfoDayMapper,
         List<TurbineInfoDay> list = baseMapper.selectList(qw);
         return list;
     }
+
+
+    @Override
+    public List<TurbineInfoDay> getwpidList(String wpid, String kssj, String jssj) throws ParseException {
+        QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+        Date kssjDate = new SimpleDateFormat("yyyy-MM-dd").parse(kssj);
+        Date jssjDate = new SimpleDateFormat("yyyy-MM-dd").parse(jssj);
+        qw.lambda().eq(TurbineInfoDay::getStationId,wpid);
+        qw.lambda().between(TurbineInfoDay::getRecordDate,kssjDate,jssjDate);
+        List<TurbineInfoDay> list = baseMapper.selectList(qw);
+        return list;
+    }
+
+
+
+    @Override
+    public List<TurbineInfoDay> monthList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,AVG(pjfs) as pjfs,AVG(klyl) as klyl,sum(gzss) as gzss,sum(xdss) as xdss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(xnss) as xnss,sum(slss) as slss,AVG(fnlyl) as fnlyl,AVG(jfpl) as jfpl");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+
+    @Override
+    public List<TurbineInfoDay> hbmonthList(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,AVG(pjfs) as pjfs");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr); // 使用减去一个月的时间
+        monthqw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> topList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id, sum(rfdl) as rfdl,sum(llfdl) as llfdl, sum(xdss) as xdss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(xnss) as xnss,sum(slss) as slss,avg(klyl) as klyl,AVG(fnlyl) as fnlyl"); // 按风机分组,汇总rfdl,平均klyl
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByDesc("sum(rfdl)"); // 按总发电量降序排列
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> fntopList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(fnlyl) as fnlyl"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByDesc("sum(fnlyl)"); // 按总风能利用率降序排列
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> ssdltopList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id, sum(xdss) + sum(jhjxss) + sum(fjhjxss) + sum(xnss) + sum(slss) as gzss");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id");
+        monthqw.orderByDesc("gzss");
+        monthqw.last("LIMIT 3");
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> gzcstopList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,sum(gzcs) as gzcs");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id");
+        monthqw.orderByDesc("gzcs");
+        monthqw.last("LIMIT 1");
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> gzcssumList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("sum(gzcs) as gzcs");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.orderByDesc("gzcs");
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> bottomList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id, sum(rfdl) as rfdl, sum(xdss) as xdss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(xnss) as xnss,sum(slss) as slss,avg(klyl) as klyl,AVG(fnlyl) as fnlyl"); // 按风机分组,汇总rfdl,平均klyl
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(rfdl)"); // 按总发电量降序排列
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> fnbottomList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(fnlyl) as fnlyl"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(fnlyl)"); // 按总风能利用率降序排列
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> ssdlbottomList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id, sum(xdss) + sum(jhjxss) + sum(fjhjxss) + sum(xnss) + sum(slss) as gzss");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id");
+        monthqw.orderByAsc("gzss");
+        monthqw.last("LIMIT 3");
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> lineList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("line_id, sum(rfdl) as rfdl,sum(llfdl) as llfdl,sum(xdss) as xdss, sum(xdss + jhjxss + fjhjxss + xnss + slss) as gzss, avg(fnlyl) as fnlyl");
+        monthqw.in("line_id", "NX_FGS_HAF01_LN", "NX_FGS_HAF02_LN", "NX_FGS_HAF03_LN", "NX_FGS_HAF04_LN");
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("line_id");
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> qnmonthList(String time) {
+        String yearString = time.split("-")[0];
+        String year = String.valueOf(Integer.parseInt(yearString) - 1);
+        String yearMonth = year + "-" + time.split("-")[1];
+        QueryWrapper<TurbineInfoDay> qnmonthqw = new QueryWrapper<>();
+        qnmonthqw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(xdss) as xdss,sum(jhjxss) as jhjxss,sum(fjhjxss) as fjhjxss,sum(djss) as djss,sum(xnss) as xnss,sum(slss) as slss, AVG(jfpl) as jfpl");
+        qnmonthqw.eq("to_char(record_date,'yyyy-MM')", yearMonth);
+        qnmonthqw.groupBy("to_char(record_date,'yyyy-MM')");
+        List<TurbineInfoDay> qnmonthList = baseMapper.selectList(qnmonthqw);
+        return qnmonthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> yearList(String time) {
+        QueryWrapper<TurbineInfoDay> yearqw = new QueryWrapper<>();
+        yearqw.select("sum(llfdl) as llfdl,sum(rfdl) as rfdl,sum(gzss) as gzss,sum(xdss) as xdss,AVG(klyl) as klyl,AVG(fnlyl) as fnlyl");
+        LocalDate startDate = LocalDate.of(Integer.parseInt(time.substring(0, 4)), 1, 1);
+        LocalDate endDate = LocalDate.parse(time + "-01").plusMonths(1);
+        yearqw.ge("record_date", startDate)
+                .lt("record_date", endDate);
+        List<TurbineInfoDay> yearList = baseMapper.selectList(yearqw);
+        return yearList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> qyearList(String time) {
+        QueryWrapper<TurbineInfoDay> qyearqw = new QueryWrapper<>();
+        qyearqw.select("COALESCE(sum(llfdl), 1) as llfdl, COALESCE(sum(rfdl), 1) as rfdl, COALESCE(sum(gzss), 1) as gzss, COALESCE(sum(xdss), 1) as xdss");
+        int qyear = Integer.parseInt(time.substring(0, 4)) - 1;
+        int mqonth = Integer.parseInt(time.substring(5, 7));
+        LocalDate qnstartDate = LocalDate.of(qyear, 1, 1);
+        LocalDate qnendDate = LocalDate.of(qyear, mqonth, 1).plusMonths(1);
+        qyearqw.ge("record_date", qnstartDate)
+                .lt("record_date", qnendDate);
+        List<TurbineInfoDay> qyearList = baseMapper.selectList(qyearqw);
+        return qyearList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> klyltopList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(klyl) as klyl"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(klyl)"); // 按总风能利用率降序排列
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> klylbottomList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(klyl) as klyl"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(klyl)"); // 按总风能利用率降序排列
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> glyztopList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(glyzxxs) as glyzxxs, sum(lyxs) as lyxs"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(glyzxxs)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> glyzbottomList(String time) {
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(glyzxxs) as glyzxxs, sum(lyxs) as lyxs"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", time);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(glyzxxs)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> syglyztopList(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(glyzxxs) as glyzxxs, sum(lyxs) as lyxs"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(glyzxxs)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> syglyzbottomList(String time) {
+        // 将字符串时间转换为LocalDate,然后减去一个月
+        LocalDate date = LocalDate.parse(time + "-01"); // 假设time格式为"yyyy-MM"
+        LocalDate previousMonth = date.minusMonths(1);
+        String previousMonthStr = previousMonth.format(DateTimeFormatter.ofPattern("yyyy-MM"));
+
+        QueryWrapper<TurbineInfoDay> monthqw = new QueryWrapper<>();
+        monthqw.select("turbine_id,avg(glyzxxs) as glyzxxs, sum(lyxs) as lyxs"); // 按风机分组
+        monthqw.eq("to_char(record_date,'yyyy-MM')", previousMonthStr);
+        monthqw.groupBy("turbine_id"); // 按风机ID分组
+        monthqw.orderByAsc("sum(glyzxxs)");
+        monthqw.last("LIMIT 3"); // 限制返回前3条记录
+
+        List<TurbineInfoDay> monthList = baseMapper.selectList(monthqw);
+        return monthList;
+    }
+
+    @Override
+    public List<TurbineInfoDay> xndjList(String time) {
+        // 解析参数时间
+        YearMonth paramYearMonth = YearMonth.parse(time, DateTimeFormatter.ofPattern("yyyy-MM"));
+        LocalDate now = LocalDate.now();
+
+        QueryWrapper<TurbineInfoDay> qw = new QueryWrapper<>();
+
+        if (paramYearMonth.getYear() == now.getYear() && paramYearMonth.getMonth() == now.getMonth()) {
+            // 当前月份:查询前一天数据
+            LocalDate yesterday = now.minusDays(1);
+            qw.lambda().eq(TurbineInfoDay::getRecordDate, yesterday);
+        } else {
+            // 其他月份:查询该月最后一天的数据
+            LocalDate lastDay = paramYearMonth.atEndOfMonth();
+            qw.lambda().eq(TurbineInfoDay::getRecordDate, lastDay);
+        }
+
+        List<TurbineInfoDay> list = baseMapper.selectList(qw);
+        return list;
+    }
 }

+ 42 - 4
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/impl/StationInfoMonthServiceImpl.java

@@ -10,10 +10,7 @@ import com.gyee.runeconomy.model.auto.PointInfo;
 import com.gyee.runeconomy.service.IStationInfoMonthService;
 import org.springframework.stereotype.Service;
 
-import java.util.Collection;
-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;
 
@@ -61,4 +58,45 @@ public class StationInfoMonthServiceImpl extends ServiceImpl<StationInfoMonthMap
         List<StationInfoMonth> list = getInfoByDate(date, entity);
         return list.stream().collect(Collectors.toMap(StationInfoMonth::getStationId, Function.identity()));
     }
+
+    @Override
+    public List<StationInfoMonth> monthslist(String time) {
+        QueryWrapper<StationInfoMonth> qw2 = new QueryWrapper<>();
+        qw2.eq("to_char(record_date,'yyyy-MM')", time);
+        List<StationInfoMonth> monthslist = baseMapper.selectList(qw2);
+        return monthslist;
+    }
+
+    @Override
+    public List<StationInfoMonth> qndylist(String time) {
+        String yearString = time.split("-")[0];
+        String year = String.valueOf(Integer.parseInt(yearString) - 1);
+        String yearMonth = year + "-" + time.split("-")[1];
+        QueryWrapper<StationInfoMonth> qndymttqw2 = new QueryWrapper<>();
+        qndymttqw2.eq("to_char(record_date,'yyyy-MM')", yearMonth);
+        List<StationInfoMonth> qndylist = baseMapper.selectList(qndymttqw2);
+        return qndylist;
+    }
+
+    @Override
+    public List<StationInfoMonth> yearlist(String time) {
+        QueryWrapper<StationInfoMonth> yearmttrqw2 = new QueryWrapper<>();
+        yearmttrqw2.select("station_id,avg(mtbf) as mtbf,avg(mttr) as mttr");
+        yearmttrqw2.eq("to_char(record_date,'yyyy')", time.split("-")[0]);
+        yearmttrqw2.groupBy("to_char(record_date,'yyyy'),station_id");
+        List<StationInfoMonth> yearlist = baseMapper.selectList(yearmttrqw2);
+        return yearlist;
+    }
+
+    @Override
+    public List<StationInfoMonth> qnmttlist(String time) {
+        String yearString = time.split("-")[0];
+        String year = String.valueOf(Integer.parseInt(yearString) - 1);
+        QueryWrapper<StationInfoMonth> qnmttqw2 = new QueryWrapper<>();
+        qnmttqw2.select("station_id,avg(mtbf) as mtbf,avg(mttr) as mttr");
+        qnmttqw2.eq("to_char(record_date,'yyyy')", year);
+        qnmttqw2.groupBy("to_char(record_date,'yyyy'),station_id");
+        List<StationInfoMonth> qnmttlist = baseMapper.selectList(qnmttqw2);
+        return qnmttlist;
+    }
 }