Browse Source

场站月度分析

xushili 1 year ago
parent
commit
b13f9603aa

+ 47 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/controller/bmk/ProEconStationAnalysisController.java

@@ -0,0 +1,47 @@
+package com.gyee.runeconomy.controller.bmk;
+
+import com.gyee.common.model.StringUtils;
+import com.gyee.common.vo.benchmark.WxsslVo;
+import com.gyee.runeconomy.dto.R;
+import com.gyee.runeconomy.dto.ResultMsg;
+import com.gyee.runeconomy.model.fitting.ProEconStationAnalysis;
+import com.gyee.runeconomy.service.fitting.IProEconStationAnalysisService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-07-05
+ */
+@RestController
+@RequestMapping("/stationAnalysis")
+public class ProEconStationAnalysisController {
+
+    @Resource
+    private IProEconStationAnalysisService stationAnalysisService;
+
+    @GetMapping("/month")
+    @ApiOperation(value = "场站月度分析", notes = "场站月度分析")
+    public R gsdb(@RequestParam(value = "companys",required = true) String companys,
+                  @RequestParam(value = "type",required = true) String type,
+                  @RequestParam(value = "beginDate",required = true) String beginDate,
+                  @RequestParam(value = "endDate",required = true) String endDate,
+                  @RequestParam(value = "target",required = false) String target,
+                  @RequestParam(value = "sort",required = false) String sort
+    ){
+        try {
+            List<ProEconStationAnalysis> resultList = stationAnalysisService.month(companys,type,beginDate,endDate,target,sort);
+            if (StringUtils.isNotNull(resultList)) return R.data(ResultMsg.ok(resultList));
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return R.error(ResultMsg.error());
+    }
+}

+ 16 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/mapper/fitting/ProEconStationAnalysisMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.mapper.fitting;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.runeconomy.model.fitting.ProEconStationAnalysis;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-07-05
+ */
+public interface ProEconStationAnalysisMapper extends BaseMapper<ProEconStationAnalysis> {
+
+}

+ 469 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/model/fitting/ProEconStationAnalysis.java

@@ -0,0 +1,469 @@
+package com.gyee.runeconomy.model.fitting;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-07-05
+ */
+@TableName("pro_econ_station_analysis")
+@ApiModel(value = "ProEconStationAnalysis对象", description = "")
+public class ProEconStationAnalysis implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    private String equipmentId;
+
+    private LocalDate recordDate;
+
+    private String nemName;
+
+    private String aname;
+
+    private String windpowerstationId;
+
+    private String windpowerstationAname;
+
+    private String companyId;
+
+    @ApiModelProperty("年平均风速m/s")
+    private BigDecimal yearAverageWindSpeed;
+
+    @ApiModelProperty("平均温度°C")
+    private BigDecimal averageTemperature;
+
+    @ApiModelProperty("相对湿度%")
+    private BigDecimal relativeHumidity;
+
+    @ApiModelProperty("水平面总辐射量kWh/㎡")
+    private BigDecimal horizontalTotalRadiation;
+
+    @ApiModelProperty("倾斜面总辐射量kWh/㎡")
+    private BigDecimal inclinedTotalRadiation;
+
+    @ApiModelProperty("日照时数h")
+    private BigDecimal sunshineDuration;
+
+    @ApiModelProperty("发电量kWh")
+    private BigDecimal powerGeneration;
+
+    @ApiModelProperty("上网电量kWh")
+    private BigDecimal gridPower;
+
+    @ApiModelProperty("购网电量kWh")
+    private BigDecimal purchasePower;
+
+    @ApiModelProperty("逆变器输入电量kWh")
+    private BigDecimal inverterInputPower;
+
+    @ApiModelProperty("逆变器输出电量kWh")
+    private BigDecimal inverterOutputPower;
+
+    @ApiModelProperty("等效利用小时数(年利用小时数)h")
+    private BigDecimal equivalentHours;
+
+    @ApiModelProperty("弃光电量kWh")
+    private BigDecimal abandonedLightPower;
+
+    @ApiModelProperty("弃光率%")
+    private BigDecimal abandonedLightRate;
+
+    @ApiModelProperty("用电量kWh")
+    private BigDecimal plantPowerConsumption;
+
+    @ApiModelProperty("综合厂用电量kWh")
+    private BigDecimal comprehensivePlantPowerConsumption;
+
+    @ApiModelProperty("用电率%")
+    private BigDecimal plantPowerRate;
+
+    @ApiModelProperty("综合厂用电率%")
+    private BigDecimal comprehensivePlantPowerRate;
+
+    @ApiModelProperty("厂损率%")
+    private BigDecimal plantLossRate;
+
+    @ApiModelProperty("逆变器损耗kWh")
+    private BigDecimal inverterLoss;
+
+    @ApiModelProperty("集电线路及箱变损耗kWh")
+    private BigDecimal collectorLineAndBoxTransformerLoss;
+
+    @ApiModelProperty("升压站损耗kWh")
+    private BigDecimal boosterStationLoss;
+
+    @ApiModelProperty("光伏电站整体效率")
+    private BigDecimal solarPowerStationEfficiency;
+
+    @ApiModelProperty("最大出力kW")
+    private BigDecimal maxOutput;
+
+    @ApiModelProperty("逆变器转换效率%")
+    private BigDecimal inverterConversionEfficiency;
+
+    @ApiModelProperty("光伏方阵效率%")
+    private BigDecimal solarArrayEfficiency;
+
+    @ApiModelProperty("发电时长h")
+    private BigDecimal powerGenerationDuration;
+
+    @ApiModelProperty("停机时长h")
+    private BigDecimal downtimeDuration;
+
+    @ApiModelProperty("中断时长h")
+    private BigDecimal interruptionDuration;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getEquipmentId() {
+        return equipmentId;
+    }
+
+    public void setEquipmentId(String equipmentId) {
+        this.equipmentId = equipmentId;
+    }
+
+    public LocalDate getRecordDate() {
+        return recordDate;
+    }
+
+    public void setRecordDate(LocalDate recordDate) {
+        this.recordDate = recordDate;
+    }
+
+    public String getNemName() {
+        return nemName;
+    }
+
+    public void setNemName(String nemName) {
+        this.nemName = nemName;
+    }
+
+    public String getAname() {
+        return aname;
+    }
+
+    public void setAname(String aname) {
+        this.aname = aname;
+    }
+
+    public String getWindpowerstationId() {
+        return windpowerstationId;
+    }
+
+    public void setWindpowerstationId(String windpowerstationId) {
+        this.windpowerstationId = windpowerstationId;
+    }
+
+    public String getWindpowerstationAname() {
+        return windpowerstationAname;
+    }
+
+    public void setWindpowerstationAname(String windpowerstationAname) {
+        this.windpowerstationAname = windpowerstationAname;
+    }
+
+    public String getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(String companyId) {
+        this.companyId = companyId;
+    }
+
+    public BigDecimal getYearAverageWindSpeed() {
+        return yearAverageWindSpeed;
+    }
+
+    public void setYearAverageWindSpeed(BigDecimal yearAverageWindSpeed) {
+        this.yearAverageWindSpeed = yearAverageWindSpeed;
+    }
+
+    public BigDecimal getAverageTemperature() {
+        return averageTemperature;
+    }
+
+    public void setAverageTemperature(BigDecimal averageTemperature) {
+        this.averageTemperature = averageTemperature;
+    }
+
+    public BigDecimal getRelativeHumidity() {
+        return relativeHumidity;
+    }
+
+    public void setRelativeHumidity(BigDecimal relativeHumidity) {
+        this.relativeHumidity = relativeHumidity;
+    }
+
+    public BigDecimal getHorizontalTotalRadiation() {
+        return horizontalTotalRadiation;
+    }
+
+    public void setHorizontalTotalRadiation(BigDecimal horizontalTotalRadiation) {
+        this.horizontalTotalRadiation = horizontalTotalRadiation;
+    }
+
+    public BigDecimal getInclinedTotalRadiation() {
+        return inclinedTotalRadiation;
+    }
+
+    public void setInclinedTotalRadiation(BigDecimal inclinedTotalRadiation) {
+        this.inclinedTotalRadiation = inclinedTotalRadiation;
+    }
+
+    public BigDecimal getSunshineDuration() {
+        return sunshineDuration;
+    }
+
+    public void setSunshineDuration(BigDecimal sunshineDuration) {
+        this.sunshineDuration = sunshineDuration;
+    }
+
+    public BigDecimal getPowerGeneration() {
+        return powerGeneration;
+    }
+
+    public void setPowerGeneration(BigDecimal powerGeneration) {
+        this.powerGeneration = powerGeneration;
+    }
+
+    public BigDecimal getGridPower() {
+        return gridPower;
+    }
+
+    public void setGridPower(BigDecimal gridPower) {
+        this.gridPower = gridPower;
+    }
+
+    public BigDecimal getPurchasePower() {
+        return purchasePower;
+    }
+
+    public void setPurchasePower(BigDecimal purchasePower) {
+        this.purchasePower = purchasePower;
+    }
+
+    public BigDecimal getInverterInputPower() {
+        return inverterInputPower;
+    }
+
+    public void setInverterInputPower(BigDecimal inverterInputPower) {
+        this.inverterInputPower = inverterInputPower;
+    }
+
+    public BigDecimal getInverterOutputPower() {
+        return inverterOutputPower;
+    }
+
+    public void setInverterOutputPower(BigDecimal inverterOutputPower) {
+        this.inverterOutputPower = inverterOutputPower;
+    }
+
+    public BigDecimal getEquivalentHours() {
+        return equivalentHours;
+    }
+
+    public void setEquivalentHours(BigDecimal equivalentHours) {
+        this.equivalentHours = equivalentHours;
+    }
+
+    public BigDecimal getAbandonedLightPower() {
+        return abandonedLightPower;
+    }
+
+    public void setAbandonedLightPower(BigDecimal abandonedLightPower) {
+        this.abandonedLightPower = abandonedLightPower;
+    }
+
+    public BigDecimal getAbandonedLightRate() {
+        return abandonedLightRate;
+    }
+
+    public void setAbandonedLightRate(BigDecimal abandonedLightRate) {
+        this.abandonedLightRate = abandonedLightRate;
+    }
+
+    public BigDecimal getPlantPowerConsumption() {
+        return plantPowerConsumption;
+    }
+
+    public void setPlantPowerConsumption(BigDecimal plantPowerConsumption) {
+        this.plantPowerConsumption = plantPowerConsumption;
+    }
+
+    public BigDecimal getComprehensivePlantPowerConsumption() {
+        return comprehensivePlantPowerConsumption;
+    }
+
+    public void setComprehensivePlantPowerConsumption(BigDecimal comprehensivePlantPowerConsumption) {
+        this.comprehensivePlantPowerConsumption = comprehensivePlantPowerConsumption;
+    }
+
+    public BigDecimal getPlantPowerRate() {
+        return plantPowerRate;
+    }
+
+    public void setPlantPowerRate(BigDecimal plantPowerRate) {
+        this.plantPowerRate = plantPowerRate;
+    }
+
+    public BigDecimal getComprehensivePlantPowerRate() {
+        return comprehensivePlantPowerRate;
+    }
+
+    public void setComprehensivePlantPowerRate(BigDecimal comprehensivePlantPowerRate) {
+        this.comprehensivePlantPowerRate = comprehensivePlantPowerRate;
+    }
+
+    public BigDecimal getPlantLossRate() {
+        return plantLossRate;
+    }
+
+    public void setPlantLossRate(BigDecimal plantLossRate) {
+        this.plantLossRate = plantLossRate;
+    }
+
+    public BigDecimal getInverterLoss() {
+        return inverterLoss;
+    }
+
+    public void setInverterLoss(BigDecimal inverterLoss) {
+        this.inverterLoss = inverterLoss;
+    }
+
+    public BigDecimal getCollectorLineAndBoxTransformerLoss() {
+        return collectorLineAndBoxTransformerLoss;
+    }
+
+    public void setCollectorLineAndBoxTransformerLoss(BigDecimal collectorLineAndBoxTransformerLoss) {
+        this.collectorLineAndBoxTransformerLoss = collectorLineAndBoxTransformerLoss;
+    }
+
+    public BigDecimal getBoosterStationLoss() {
+        return boosterStationLoss;
+    }
+
+    public void setBoosterStationLoss(BigDecimal boosterStationLoss) {
+        this.boosterStationLoss = boosterStationLoss;
+    }
+
+    public BigDecimal getSolarPowerStationEfficiency() {
+        return solarPowerStationEfficiency;
+    }
+
+    public void setSolarPowerStationEfficiency(BigDecimal solarPowerStationEfficiency) {
+        this.solarPowerStationEfficiency = solarPowerStationEfficiency;
+    }
+
+    public BigDecimal getMaxOutput() {
+        return maxOutput;
+    }
+
+    public void setMaxOutput(BigDecimal maxOutput) {
+        this.maxOutput = maxOutput;
+    }
+
+    public BigDecimal getInverterConversionEfficiency() {
+        return inverterConversionEfficiency;
+    }
+
+    public void setInverterConversionEfficiency(BigDecimal inverterConversionEfficiency) {
+        this.inverterConversionEfficiency = inverterConversionEfficiency;
+    }
+
+    public BigDecimal getSolarArrayEfficiency() {
+        return solarArrayEfficiency;
+    }
+
+    public void setSolarArrayEfficiency(BigDecimal solarArrayEfficiency) {
+        this.solarArrayEfficiency = solarArrayEfficiency;
+    }
+
+    public BigDecimal getPowerGenerationDuration() {
+        return powerGenerationDuration;
+    }
+
+    public void setPowerGenerationDuration(BigDecimal powerGenerationDuration) {
+        this.powerGenerationDuration = powerGenerationDuration;
+    }
+
+    public BigDecimal getDowntimeDuration() {
+        return downtimeDuration;
+    }
+
+    public void setDowntimeDuration(BigDecimal downtimeDuration) {
+        this.downtimeDuration = downtimeDuration;
+    }
+
+    public BigDecimal getInterruptionDuration() {
+        return interruptionDuration;
+    }
+
+    public void setInterruptionDuration(BigDecimal interruptionDuration) {
+        this.interruptionDuration = interruptionDuration;
+    }
+
+    @Override
+    public String toString() {
+        return "ProEconStationAnalysis{" +
+            "id = " + id +
+            ", equipmentId = " + equipmentId +
+            ", recordDate = " + recordDate +
+            ", nemName = " + nemName +
+            ", aname = " + aname +
+            ", windpowerstationId = " + windpowerstationId +
+            ", windpowerstationAname = " + windpowerstationAname +
+            ", companyId = " + companyId +
+            ", yearAverageWindSpeed = " + yearAverageWindSpeed +
+            ", averageTemperature = " + averageTemperature +
+            ", relativeHumidity = " + relativeHumidity +
+            ", horizontalTotalRadiation = " + horizontalTotalRadiation +
+            ", inclinedTotalRadiation = " + inclinedTotalRadiation +
+            ", sunshineDuration = " + sunshineDuration +
+            ", powerGeneration = " + powerGeneration +
+            ", gridPower = " + gridPower +
+            ", purchasePower = " + purchasePower +
+            ", inverterInputPower = " + inverterInputPower +
+            ", inverterOutputPower = " + inverterOutputPower +
+            ", equivalentHours = " + equivalentHours +
+            ", abandonedLightPower = " + abandonedLightPower +
+            ", abandonedLightRate = " + abandonedLightRate +
+            ", plantPowerConsumption = " + plantPowerConsumption +
+            ", comprehensivePlantPowerConsumption = " + comprehensivePlantPowerConsumption +
+            ", plantPowerRate = " + plantPowerRate +
+            ", comprehensivePlantPowerRate = " + comprehensivePlantPowerRate +
+            ", plantLossRate = " + plantLossRate +
+            ", inverterLoss = " + inverterLoss +
+            ", collectorLineAndBoxTransformerLoss = " + collectorLineAndBoxTransformerLoss +
+            ", boosterStationLoss = " + boosterStationLoss +
+            ", solarPowerStationEfficiency = " + solarPowerStationEfficiency +
+            ", maxOutput = " + maxOutput +
+            ", inverterConversionEfficiency = " + inverterConversionEfficiency +
+            ", solarArrayEfficiency = " + solarArrayEfficiency +
+            ", powerGenerationDuration = " + powerGenerationDuration +
+            ", downtimeDuration = " + downtimeDuration +
+            ", interruptionDuration = " + interruptionDuration +
+        "}";
+    }
+}

+ 1 - 3
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/fitting/EconomyAnalysisService.java

@@ -321,8 +321,6 @@ public class EconomyAnalysisService {
         title.add(StrUtil.format(str, CacheContext.wpmap.get(wpid).getAname(),
                 monthMap.get(wpid).get("平均风速"), douStr2Str(monthMap.get(wpid).get("平均风速同比")), douStr2Str(monthMap.get(wpid).get("平均风速环比"))
                 , monthMap.get(wpid).get("理论发电量"), douStr2Str(monthMap.get(wpid).get("理论发电量同比")), douStr2Str(monthMap.get(wpid).get("理论发电量环比"))));
-        str = "{}发生极端天气{}次,持续时长{}小时,受累损失电量{}万千瓦时。主要事件为:{}";
-        title.add(StrUtil.format(str, CacheContext.wpmap.get(wpid).getAname(),"0","0",monthMap.get("0").get("受累损失电量"),""));
         map.put("资源及理论发电量平衡分析", title);
         title = new ArrayList<>();
         str = "本月{}累计发生输变电故障2次,故障消缺时长累计18小时,损失电量9.78万千瓦时。";
@@ -360,7 +358,7 @@ public class EconomyAnalysisService {
         title = new ArrayList<>();
         //风能利用率排序
         List<String> xnssdlpx = getTargetSort("GDC", "性能损失电量");
-        str = "{}:性能损失电量高,存在性能缺陷的风机多,需要整改。";
+        str = "{}:性能损失电量高,需要整改。";
         title.add(StrUtil.format(str,max(xnssdlpx)));
         map.put("场站问题总结和建议", title);
         return map;

+ 19 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/fitting/IProEconStationAnalysisService.java

@@ -0,0 +1,19 @@
+package com.gyee.runeconomy.service.fitting;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.runeconomy.model.fitting.ProEconStationAnalysis;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-07-05
+ */
+public interface IProEconStationAnalysisService extends IService<ProEconStationAnalysis> {
+
+    List<ProEconStationAnalysis> month(String companys, String type, String beginDate, String endDate, String target, String sort);
+}

+ 61 - 0
web/runeconomy-jjyx/src/main/java/com/gyee/runeconomy/service/fitting/ProEconStationAnalysisServiceImpl.java

@@ -0,0 +1,61 @@
+package com.gyee.runeconomy.service.fitting;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.common.util.DateUtils;
+import com.gyee.runeconomy.init.CacheContext;
+import com.gyee.runeconomy.mapper.fitting.ProEconStationAnalysisMapper;
+import com.gyee.runeconomy.model.fitting.ProEconStationAnalysis;
+import org.springframework.stereotype.Service;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2023-07-05
+ */
+@Service
+public class ProEconStationAnalysisServiceImpl extends ServiceImpl<ProEconStationAnalysisMapper, ProEconStationAnalysis> implements IProEconStationAnalysisService {
+
+    @Override
+    public List<ProEconStationAnalysis> month(String companys, String type, String beginDate, String endDate, String target, String sort) {
+
+        QueryWrapper<ProEconStationAnalysis> qw = new QueryWrapper<>();
+        String sql = "windpowerstation_id,windpowerstation_aname,avg(year_average_wind_speed) year_average_wind_speed,avg(average_temperature) average_temperature" +
+                ",avg(relative_humidity) relative_humidity,sum(horizontal_total_radiation) horizontal_total_radiation" +
+                ",sum(inclined_total_radiation) inclined_total_radiation,sum(sunshine_duration) sunshine_duration" +
+                ",sum(power_generation) power_generation,sum(grid_power) grid_power,sum(purchase_power) purchase_power" +
+                ",sum(inverter_input_power) inverter_input_power,sum(inverter_output_power) inverter_output_power,sum(equivalent_hours) equivalent_hours" +
+                ",sum(abandoned_light_power) abandoned_light_power,avg(abandoned_light_rate) abandoned_light_rate,sum(plant_power_consumption) plant_power_consumption" +
+                ",sum(comprehensive_plant_power_consumption) comprehensive_plant_power_consumption,avg(plant_power_rate) plant_power_rate" +
+                ",sum(comprehensive_plant_power_rate) comprehensive_plant_power_rate,avg(plant_loss_rate) plant_loss_rate" +
+                ",sum(inverter_loss) inverter_loss,sum(collector_line_and_box_transformer_loss) collector_line_and_box_transformer_loss" +
+                ",sum(booster_station_loss) booster_station_loss,avg(solar_power_station_efficiency) solar_power_station_efficiency,max(max_output) max_output" +
+                ",avg(inverter_conversion_efficiency) inverter_conversion_efficiency,avg(solar_array_efficiency) solar_array_efficiency" +
+                ",sum(power_generation_duration) power_generation_duration,sum(downtime_duration) downtime_duration,sum(interruption_duration) interruption_duration";
+        qw.select(sql).between("record_date", DateUtils.parseDate(beginDate),DateUtils.parseDate(endDate))
+                .groupBy("windpowerstation_id,windpowerstation_aname");
+
+        if (companys.contains("RGN")) {
+            String finalCompanys = companys;
+            List<String> collect = CacheContext.cpls.stream().filter(cpl -> finalCompanys.contains(cpl.getParentCode())).map(cpl -> cpl.getId()).collect(Collectors.toList());
+            qw.in("company_id", collect);
+        } else {
+            String[] split = companys.split(",");
+            qw.in("company_id", Arrays.asList(split));
+        }
+        if (type.equals("-1")) {
+            qw.like("equipment_id", "_WT_");
+        } else {
+            qw.like("equipment_id", "_IN_");
+        }
+
+        return baseMapper.selectList(qw);
+    }
+}