Browse Source

#光伏站点指标增加

zhongwei
yang_shj 2 years ago
parent
commit
d55729d474
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/GenerateEntity.java
  2. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/UseEntity.java
  3. 154
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  4. 11
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java
  5. 196
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java
  6. 21
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java
  7. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  8. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/scheduled/StAlamRecordTask.java
  9. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  10. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IHomePageService.java
  11. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java
  12. 158
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  13. 362
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  14. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  15. 82
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  16. 83
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/GenerateEntity.java

@ -22,6 +22,9 @@ public class GenerateEntity extends TenantEntity implements Serializable {
@ApiModelProperty("站点名称") @ApiModelProperty("站点名称")
private String stationName; private String stationName;
@ApiModelProperty("站点来源类型: 0 - 数据采集 1 - 数据填报")
private String dataOrigin;
@ApiModelProperty("发电量") @ApiModelProperty("发电量")
private BigDecimal generate; private BigDecimal generate;

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/entity/UseEntity.java

@ -22,6 +22,9 @@ public class UseEntity extends TenantEntity implements Serializable {
@ApiModelProperty("站点名称") @ApiModelProperty("站点名称")
private String stationName; private String stationName;
@ApiModelProperty("站点数据类型: 0 - 接入站点 1 - 未接入站点")
private String dataOrigin;
@ApiModelProperty("发电量") @ApiModelProperty("发电量")
private BigDecimal use; private BigDecimal use;

154
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java

@ -1,10 +1,15 @@
package com.hnac.hzims.operational.main.constant; package com.hnac.hzims.operational.main.constant;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
* 首页-常量 * 首页-常量
*
* @author 11423 * @author 11423
*/ */
public interface HomePageConstant { public interface HomePageConstant {
@ -52,17 +57,32 @@ public interface HomePageConstant {
/** /**
* 水利集合 * 水利集合
*/ */
List<Integer> waterList = Arrays.asList(HomePageConstant.WATER_CONSERVANCY,HomePageConstant.PUMPING,HomePageConstant.GATE); List<Integer> waterList = Arrays.asList(HomePageConstant.WATER_CONSERVANCY, HomePageConstant.PUMPING, HomePageConstant.GATE);
List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.WIND_POWER,HomePageConstant.WATER_CONSERVANCY,HomePageConstant.ENERGY_STORAGE, List<Integer> types = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY, HomePageConstant.ENERGY_STORAGE,
HomePageConstant.DISTRIBUTION_NETWORK,HomePageConstant.PHOTOVOLTAIC,HomePageConstant.WATER_AFFAIRS,HomePageConstant.CHARGE,HomePageConstant.PUMPING, HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE, HomePageConstant.PUMPING,
HomePageConstant.GATE); HomePageConstant.GATE);
List<String> SIGNAGES = Arrays.asList(HomePageConstant.JOINT_RELAY,HomePageConstant.SWITCH_ON_OFF,HomePageConstant.ELECTRICITY_CONSUMPTION, /**
HomePageConstant.ACTIVE_POWER,HomePageConstant.REACTIVE_POWER,HomePageConstant.POWER_FACTOR,HomePageConstant.VOLTAGE,HomePageConstant.CURRENT, * 实时指标
HomePageConstant.HYDROPOWER_GENERATE_POWER,HomePageConstant.HYDROPOWER_POWERFACTOR,HomePageConstant.HYDROPOWER_FREQUENCY,HomePageConstant.HYDROPOWER_GUIDEOPEN, */
HomePageConstant.HYDROPOWER_VOLTAGE,HomePageConstant.HYDROPOWER_CURRENT,HomePageConstant.UNIT_SPEED,HomePageConstant.ACTIVE_POWER_GIVEN,HomePageConstant.REACTIVE_POWER_GIVEN, List<String> SIGNAGES = Arrays.asList(
HomePageConstant.PV_GENERATION_DAY); // 泵站、水电站
HomePageConstant.JOINT_RELAY, HomePageConstant.SWITCH_ON_OFF, HomePageConstant.ELECTRICITY_CONSUMPTION,
HomePageConstant.ACTIVE_POWER, HomePageConstant.REACTIVE_POWER, HomePageConstant.POWER_FACTOR, HomePageConstant.VOLTAGE, HomePageConstant.CURRENT,
HomePageConstant.HYDROPOWER_GENERATE_POWER, HomePageConstant.HYDROPOWER_POWERFACTOR, HomePageConstant.HYDROPOWER_FREQUENCY, HomePageConstant.HYDROPOWER_GUIDEOPEN,
HomePageConstant.HYDROPOWER_VOLTAGE, HomePageConstant.HYDROPOWER_CURRENT, HomePageConstant.UNIT_SPEED, HomePageConstant.ACTIVE_POWER_GIVEN, HomePageConstant.REACTIVE_POWER_GIVEN,
// 光伏
HomePageConstant.PV_GENERATION_DAY,
HomePageConstant.DIRECT_ONE, HomePageConstant.DIRECT_TWO, HomePageConstant.DIRECT_THREE, HomePageConstant.DIRECT_FOUR, HomePageConstant.DIRECT_FIVE, HomePageConstant.DIRECT_SIX,
HomePageConstant.DIRECT_SEVEN, HomePageConstant.DIRECT_EIGHT, HomePageConstant.DIRECT_NINE, HomePageConstant.DIRECT_TEN, HomePageConstant.DIRECT_ELEVEN, HomePageConstant.DIRECT_TWELVE,
HomePageConstant.DC_VOLTAGE_ONE, HomePageConstant.DC_VOLTAGE_TWO, HomePageConstant.DC_VOLTAGE_THREE, HomePageConstant.DC_VOLTAGE_FOUR, HomePageConstant.DC_VOLTAGE_FIVE, HomePageConstant.DC_VOLTAGE_SIX,
HomePageConstant.DC_VOLTAGE_SEVEN, HomePageConstant.DC_VOLTAGE_EIGHT, HomePageConstant.DC_VOLTAGE_NINE, HomePageConstant.DC_VOLTAGE_TEN, HomePageConstant.DC_VOLTAGE_ELEVEN, HomePageConstant.DC_VOLTAGE_TWELVE,
HomePageConstant.SERIES_ONE, HomePageConstant.SERIES_TWO, HomePageConstant.SERIES_THREE, HomePageConstant.SERIES_FOUR, HomePageConstant.SERIES_FIVE, HomePageConstant.SERIES_SIX,
HomePageConstant.SERIES_SEVEN, HomePageConstant.SERIES_EIGHT, HomePageConstant.SERIES_NINE, HomePageConstant.SERIES_TEN, HomePageConstant.SERIES_ELEVEN, HomePageConstant.SERIES_TWELVE, HomePageConstant.SE_VOLTAGE_ONE,
HomePageConstant.SE_VOLTAGE_TWO, HomePageConstant.SE_VOLTAGE_THREE, HomePageConstant.SE_VOLTAGE_FOUR, HomePageConstant.SE_VOLTAGE_FIVE, HomePageConstant.SE_VOLTAGE_SIX,
HomePageConstant.SE_VOLTAGE_SEVEN, HomePageConstant.SE_VOLTAGE_EIGHT, HomePageConstant.SE_VOLTAGE_NINE, HomePageConstant.SE_VOLTAGE_TEN, HomePageConstant.SE_VOLTAGE_ELEVEN, HomePageConstant.SE_VOLTAGE_TWELVE
);
/** /**
* 站点类型 运维服务 * 站点类型 运维服务
@ -120,12 +140,13 @@ public interface HomePageConstant {
/** /**
* 有功功率 * 有功功率
*/ */
List<String> powerList = Arrays.asList("p","P"); List<String> powerList = Arrays.asList("p", "P");
// 水利-泵组实时属性名称 // 水利-泵组实时属性名称
String JOINT_RELAY = "joint_relay"; // 开机状态 String JOINT_RELAY = "joint_relay"; // 开机状态
String SWITCH_ON_OFF = "switch_on_off"; // 开机状态 String SWITCH_ON_OFF = "switch_on_off"; // 开机状态
String OFF = "1"; // 开机 String OFF = "1"; // 开机
String ON = "0"; // 关机 String ON = "0"; // 关机
String ELECTRICITY_CONSUMPTION = "electricity_consumption"; // 用电量 String ELECTRICITY_CONSUMPTION = "electricity_consumption"; // 用电量
String ACTIVE_POWER = "active_power"; // 有功功率 String ACTIVE_POWER = "active_power"; // 有功功率
@ -156,45 +177,122 @@ public interface HomePageConstant {
String CONCAT_Q = "-Q"; // 有功功率单位拼接值 String CONCAT_Q = "-Q"; // 有功功率单位拼接值
String CONCAT_UAB = "-UAB"; // 有功功率单位拼接值 String CONCAT_UAB = "-UAB"; // 有功功率单位拼接值
String CONCAT_IA = "-IA"; // 有功功率单位拼接值 String CONCAT_IA = "-IA"; // 有功功率单位拼接值
/*==========================================================================================*/
// 光伏
String DIRECT_ONE = "direct_one"; // 直流电流1
String DIRECT_TWO = "direct_two"; // 直流电流2
String DIRECT_THREE = "direct_three"; // 直流电流3
String DIRECT_FOUR = "direct_four"; // 直流电流4
String DIRECT_FIVE = "direct_five"; // 直流电流5
String DIRECT_SIX = "direct_six"; // 直流电流6
String DIRECT_SEVEN = "direct_seven"; // 直流电流7
String DIRECT_EIGHT = "direct_eight"; // 直流电流8
String DIRECT_NINE = "direct_nine"; // 直流电流9
String DIRECT_TEN = "direct_ten"; // 直流电流10
String DIRECT_ELEVEN = "direct_eleven"; // 直流电流11
String DIRECT_TWELVE = "direct_twelve"; // 直流电流12
String DC_VOLTAGE_ONE = "dc_voltage_one"; // 直流电压1
String DC_VOLTAGE_TWO = "dc_voltage_two"; // 直流电压2
String DC_VOLTAGE_THREE = "dc_voltage_three"; // 直流电压3
String DC_VOLTAGE_FOUR = "dc_voltage_four"; // 直流电压4
String DC_VOLTAGE_FIVE = "dc_voltage_five"; // 直流电压5
String DC_VOLTAGE_SIX = "dc_voltage_six"; // 直流电压6
String DC_VOLTAGE_SEVEN = "dc_voltage_seven"; // 直流电压7
String DC_VOLTAGE_EIGHT = "dc_voltage_eight"; // 直流电压8
String DC_VOLTAGE_NINE = "dc_voltage_nine"; // 直流电压9
String DC_VOLTAGE_TEN = "dc_voltage_ten"; // 直流电压10
String DC_VOLTAGE_ELEVEN = "dc_voltage_eleven"; // 直流电压11
String DC_VOLTAGE_TWELVE = "dc_voltage_twelve"; // 直流电压12
String SERIES_ONE = "series_one"; // 串流电流1
String SERIES_TWO = "series_two"; // 串流电流2
String SERIES_THREE = "series_three"; // 串流电流3
String SERIES_FOUR = "series_four"; // 串流电流4
String SERIES_FIVE = "series_five"; // 串流电流5
String SERIES_SIX = "series_six"; // 串流电流6
String SERIES_SEVEN = "series_seven"; // 串流电流7
String SERIES_EIGHT = "series_eight"; // 串流电流8
String SERIES_NINE = "series_nine"; // 串流电流9
String SERIES_TEN = "series_ten"; // 串流电流10
String SERIES_ELEVEN = "series_eleven"; // 串流电流11
String SERIES_TWELVE = "series_twelve"; // 串流电流12
String SE_VOLTAGE_ONE = "se_voltage_one"; // 串流电压1
String SE_VOLTAGE_TWO = "se_voltage_two"; // 串流电压2
String SE_VOLTAGE_THREE = "se_voltage_three"; // 串流电压3
String SE_VOLTAGE_FOUR = "se_voltage_four"; // 串流电压4
String SE_VOLTAGE_FIVE = "se_voltage_five"; // 串流电压5
String SE_VOLTAGE_SIX = "se_voltage_six"; // 串流电压6
String SE_VOLTAGE_SEVEN = "se_voltage_seven"; // 串流电压7
String SE_VOLTAGE_EIGHT = "se_voltage_eight"; // 串流电压8
String SE_VOLTAGE_NINE = "se_voltage_nine"; // 串流电压9
String SE_VOLTAGE_TEN = "se_voltage_ten"; // 串流电压10
String SE_VOLTAGE_ELEVEN = "se_voltage_eleven"; // 串流电压11
String SE_VOLTAGE_TWELVE = "se_voltage_twelve"; // 串流电压12
/*==========================================================================================*/
// 设备/厂房参数 // 设备/厂房参数
/**ct**/ /**
* ct
**/
String CT = "ct"; String CT = "ct";
/**pt**/ /**
* pt
**/
String PT = "pt"; String PT = "pt";
/**装机容量**/ /**
* 装机容量
**/
String INSTALLED_CAPACITY = "installedCapacity"; String INSTALLED_CAPACITY = "installedCapacity";
/*==========================================================================================*/ /*==========================================================================================*/
/**站点数据配置-有功功率**/ /**
* 站点数据配置-有功功率
**/
String P_ATTRIBUTES = "P"; String P_ATTRIBUTES = "P";
/*==========================================================================================*/ /*==========================================================================================*/
// 光伏电站-电表-物模型监测点标识 // 光伏电站-电表-物模型监测点标识
/**开关机状态**/ /**
* 开关机状态
**/
String PV_JOINT_RELAY = "joint_relay"; String PV_JOINT_RELAY = "joint_relay";
/**总有功电度**/ /**
* 总有功电度
**/
String PV_GENERATION_CAPACITY = "generation_capacity"; String PV_GENERATION_CAPACITY = "generation_capacity";
/**日发电量**/ /**
* 日发电量
**/
String PV_GENERATION_DAY = "generate_day"; String PV_GENERATION_DAY = "generate_day";
/**有功功率**/ /**
* 有功功率
**/
String PV_LOAD = "active_power"; String PV_LOAD = "active_power";
/**正向无功**/ /**
* 正向无功
**/
String PV_REACTIVE_POWER = "reactive_power"; String PV_REACTIVE_POWER = "reactive_power";
/**电压**/ /**
* 电压
**/
String PV_VOLTAGE = "voltage"; String PV_VOLTAGE = "voltage";
/**电流**/ /**
* 电流
**/
String PV_CURRENT = "current"; String PV_CURRENT = "current";
/*==========================================================================================*/ /*==========================================================================================*/
// 光伏指标属性 // 光伏指标属性
String PHOTOVOLTAIC_OFF = "1.0"; // 开机 String PHOTOVOLTAIC_OFF = "1.0"; // 开机
String PHOTOVOLTAIC_LOAD_TARGET = "0"; String PHOTOVOLTAIC_LOAD_TARGET = "0";
/*==========================================================================================*/ /*==========================================================================================*/
// 水电集团、区域指标关联 // 水电集团、区域指标关联
/**功率**/ /**
* 功率
**/
Integer POWER = 0; Integer POWER = 0;
/*==========================================================================================*/ /*==========================================================================================*/
// 水利集团、区域指标关联 // 水利集团、区域指标关联
/**功率**/ /**
* 功率
**/
Integer LOADING = 0; Integer LOADING = 0;
} }

11
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java

@ -35,6 +35,10 @@ public class PhotovoltaicDeviceVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double load; private Double load;
@ApiModelProperty(value = "上次功率: kW")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastLoad;
@ApiModelProperty(value = "环比功率") @ApiModelProperty(value = "环比功率")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double loadRatio; private Double loadRatio;
@ -43,11 +47,16 @@ public class PhotovoltaicDeviceVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generate; private Double generate;
@ApiModelProperty(value = "日发电量: kWh") @ApiModelProperty(value = "日发电量: kWh")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDay; private Double generateDay;
@ApiModelProperty(value = "环比功率") @ApiModelProperty(value = "昨日发电量: kWh")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generationYesterday;
@ApiModelProperty(value = "环比发电量")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDayRatio; private Double generateDayRatio;

196
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java

@ -51,4 +51,200 @@ public class PhotovoltaicRealVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double lastLoad; private Double lastLoad;
@ApiModelProperty(value = "直流电流1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_one;
@ApiModelProperty(value = "直流电流2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_two;
@ApiModelProperty(value = "直流电流3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_three;
@ApiModelProperty(value = "直流电流4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_four;
@ApiModelProperty(value = "直流电流5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_five;
@ApiModelProperty(value = "直流电流6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_six;
@ApiModelProperty(value = "直流电流7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_seven;
@ApiModelProperty(value = "直流电流8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_eight;
@ApiModelProperty(value = "直流电流9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_nine;
@ApiModelProperty(value = "直流电流10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_ten;
@ApiModelProperty(value = "直流电流11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_eleven;
@ApiModelProperty(value = "直流电流12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double direct_twelve;
@ApiModelProperty(value = "直流电压1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_one;
@ApiModelProperty(value = "直流电压2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_two;
@ApiModelProperty(value = "直流电压3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_three;
@ApiModelProperty(value = "直流电压4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_four;
@ApiModelProperty(value = "直流电压5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_five;
@ApiModelProperty(value = "直流电压6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_six;
@ApiModelProperty(value = "直流电压7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_seven;
@ApiModelProperty(value = "直流电压8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_eight;
@ApiModelProperty(value = "直流电压9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_nine;
@ApiModelProperty(value = "直流电压10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_ten;
@ApiModelProperty(value = "直流电压11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_eleven;
@ApiModelProperty(value = "直流电压12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double dc_voltage_twelve;
@ApiModelProperty(value = "直流电流1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_one;
@ApiModelProperty(value = "直流电流2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_two;
@ApiModelProperty(value = "直流电流3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_three;
@ApiModelProperty(value = "直流电流4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_four;
@ApiModelProperty(value = "直流电流5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_five;
@ApiModelProperty(value = "直流电流6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_six;
@ApiModelProperty(value = "直流电流7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_seven;
@ApiModelProperty(value = "直流电流8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eight;
@ApiModelProperty(value = "直流电流9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_nine;
@ApiModelProperty(value = "直流电流10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_ten;
@ApiModelProperty(value = "直流电流11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_eleven;
@ApiModelProperty(value = "直流电流12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double series_twelve;
@ApiModelProperty(value = "直流电压1")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_one;
@ApiModelProperty(value = "直流电压2")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_two;
@ApiModelProperty(value = "直流电压3")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_three;
@ApiModelProperty(value = "直流电压4")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_four;
@ApiModelProperty(value = "直流电压5")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_five;
@ApiModelProperty(value = "直流电压6")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_six;
@ApiModelProperty(value = "直流电压7")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_seven;
@ApiModelProperty(value = "直流电压8")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eight;
@ApiModelProperty(value = "直流电压9")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_nine;
@ApiModelProperty(value = "直流电压10")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_ten;
@ApiModelProperty(value = "直流电压11")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_eleven;
@ApiModelProperty(value = "直流电压12")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double se_voltage_twelve;
} }

21
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationVo.java

@ -50,10 +50,22 @@ public class PhotovoltaicStationVo {
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double load; private Double load;
@ApiModelProperty(value = "环比功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double loadRatio;
@ApiModelProperty(value = "日发电量") @ApiModelProperty(value = "日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDay; private Double generateDay;
@ApiModelProperty(value = "昨日发电量: kWh")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generationYesterday;
@ApiModelProperty(value = "环比发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDayRatio;
@ApiModelProperty(value = "月发电量") @ApiModelProperty(value = "月发电量")
@JsonSerialize(nullsUsing = NullSerializer.class) @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateMon; private Double generateMon;
@ -81,9 +93,12 @@ public class PhotovoltaicStationVo {
@ApiModelProperty(value = "发电排行") @ApiModelProperty(value = "发电排行")
private List<PhotovoltaicDeviceVo> devices; private List<PhotovoltaicDeviceVo> devices;
@ApiModelProperty(value = "年发电量完成百分比")
private List<PowerYearVo> generateSurvey;
@ApiModelProperty(value = "设备信息") @ApiModelProperty(value = "设备信息")
private List<PhotovoltaicDeviceChartsVo> charts; private List<PhotovoltaicDeviceChartsVo> charts;
@ApiModelProperty(value = "当日机组有功功率")
private List<PhotovoltaicPowerVo> activePowerVoList;
@ApiModelProperty(value = "近30天用电量")
private List<GenerationPowerVo> generationPowerVoList;
} }

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fasterxml.jackson.core.type.TypeReference;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant; import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
@ -23,6 +24,7 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation; import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage; import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
import com.hnac.hzinfo.sdk.core.utils.JsonUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils; import net.logstash.logback.encoder.org.apache.commons.lang3.ObjectUtils;
@ -231,12 +233,13 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
}*/ }*/
// condition.setEndTime(LocalDateTime.now()); // condition.setEndTime(LocalDateTime.now());
// FIXME 测试使用时间 // FIXME 测试使用时间
condition.setBeginTime(LocalDateTime.parse("2023-02-01 00:00:00", format)); condition.setBeginTime(LocalDateTime.parse("2023-03-22 10:06:38", format));
condition.setEndTime(LocalDateTime.parse("2023-02-27 00:00:00", format)); condition.setEndTime(LocalDateTime.parse("2023-03-24 16:06:38", format));
condition.setNeedPage(true); condition.setNeedPage(true);
condition.setPage(param.getCurrent()); condition.setPage(param.getCurrent());
condition.setLimit(param.getSize()); condition.setLimit(param.getSize());
condition.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); condition.setStationIds(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
//condition.setStationIds(Collections.singletonList("901900000234"));
condition.setTypes(Arrays.asList(param.getType().split(","))); condition.setTypes(Arrays.asList(param.getType().split(",")));
Result<HzPage<SoeData>> result = alarmClient.getByStationsAndTime(condition); Result<HzPage<SoeData>> result = alarmClient.getByStationsAndTime(condition);
if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){ if(!result.isSuccess() || ObjectUtil.isEmpty(result.getData()) || CollectionUtil.isEmpty(result.getData().getRecords())){
@ -277,6 +280,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
return response; return response;
} }
/** /**
* 获取处理数据ID集合 * 获取处理数据ID集合
* @return * @return

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/scheduled/StAlamRecordTask.java

@ -10,9 +10,10 @@ import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import static com.hnac.hzims.operational.main.constant.MainConstants.*; import static com.hnac.hzims.operational.main.constant.MainConstants.*;
/** /**

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java

@ -169,9 +169,10 @@ public class ScheduledCreateTask {
* 获取站点近3年发电量数据 * 获取站点近3年发电量数据
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR) //@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/40 * * * * ? ") @Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear(String param) throws Exception { public ReturnT<String> powerGenerationRecentYear() throws Exception {
String param = "";
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IHomePageService.java

@ -44,12 +44,6 @@ public interface IHomePageService {
List<Dept> getChildArea(List<Dept> departList, Long deptId,List<Dept> list); List<Dept> getChildArea(List<Dept> departList, Long deptId,List<Dept> list);
float getPowerGeneration(List<EminfoAndEmParamVo> list, String startTime, String endTime,Integer cycleType);
float getEmInfoPower(EminfoAndEmParamVo em, String startTime, String endTime,Integer cycleType);
float getAnalyzeCodeAndSignages(EminfoAndEmParamVo em, String startTime, String endTime, Integer cycleType, String signages);
List<PowerMonthVo> planActualTrend(Long deptId); List<PowerMonthVo> planActualTrend(Long deptId);
List<AreaVo> homeStation(Long deptId); List<AreaVo> homeStation(Long deptId);

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java

@ -21,10 +21,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -128,7 +125,7 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) { if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0f; return 0f;
} }
return Float.parseFloat(analyseDataTaosVO.getVal()) * ride; return Float.parseFloat(Optional.ofNullable(analyseDataTaosVO.getVal()).orElse("0")) * ride;
} }

158
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java

@ -3,7 +3,6 @@ package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EmInfoExtendVo; import com.hnac.hzims.equipment.vo.EmInfoExtendVo;
@ -11,23 +10,19 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.monitor.utils.DateUtils; import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.fill.entity.*; import com.hnac.hzims.operational.fill.entity.*;
import com.hnac.hzims.operational.fill.service.*; import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.IAnalyseDataService; import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzims.operational.main.service.IHomePageService; import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService; import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient; import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO; import com.hnac.hzims.ticket.allTicket.vo.DoublePassVO;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient; import com.hnac.hzinfo.datasearch.analyse.IAnalyseInstanceClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO; import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.datasearch.soe.ISoeClient; import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.sdk.core.response.Result; import com.hnac.hzinfo.sdk.core.response.Result;
@ -70,7 +65,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class HomePageServiceImpl implements IHomePageService { public class HomePageServiceImpl implements IHomePageService {
private final IAnalyseDataService analyseDataService; private final IAnalyseDataService analyseDataService;
private final IPlanGenertionClient planGenertionClient; private final IPlanGenertionClient planGenertionClient;
private final IMainSystemMonitoringService maintenanceTaskService; private final IMainSystemMonitoringService maintenanceTaskService;
@ -229,7 +223,7 @@ public class HomePageServiceImpl implements IHomePageService {
List<StationEntity> stationList = stationService.getStationType(serveType, types, null); List<StationEntity> stationList = stationService.getStationType(serveType, types, null);
// 设备信息 // 设备信息
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList(); List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
// 开始事件 // 开始时间
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
@ -390,18 +384,26 @@ public class HomePageServiceImpl implements IHomePageService {
double installedCapacity = getInstalledCapacity(equipmentInfoList, station); double installedCapacity = getInstalledCapacity(equipmentInfoList, station);
powerStationTotalVo.setInstalledCapacity(installedCapacity); powerStationTotalVo.setInstalledCapacity(installedCapacity);
// 当月发电量 // 当月发电量
String startTime = DateUtil.format(new Date(),"yyyy-MM") + "-01 00:00:00"; String start = DateUtil.format(new Date(),"yyyy-MM") + "-01 00:00:00";
String endTime = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
float powerGeneration = this.getPowerGeneration(effEmInfoList, startTime, endTime,EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType()); float powerGeneration = this.generateByDevices(effEmInfoList, start, end,5);
powerStationTotalVo.setPowerGeneration((double)powerGeneration); powerStationTotalVo.setPowerGeneration((double)powerGeneration);
// 计划发电量 // 计划发电量
double plannedPowerGeneration = this.getPlannedPowerGeneration(planGenerationEntityList, station); double plannedPowerGeneration = this.getPlannedPowerGeneration(planGenerationEntityList, station);
powerStationTotalVo.setPlannedPowerGeneration(plannedPowerGeneration); powerStationTotalVo.setPlannedPowerGeneration(plannedPowerGeneration);
// 当年发电量 // 当年发电量
float currentYearPowerGeneration = getPlannedYearGeneration(effEmInfoList); end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.DAY_OF_MONTH,-calendar.get(Calendar.DAY_OF_MONTH));
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
float currentYearPowerGeneration = this.generateByDevices(effEmInfoList, start+ " 00:00:00", end + " 00:00:00",6);;
powerStationTotalVo.setCurrentYearPowerGeneration(currentYearPowerGeneration); powerStationTotalVo.setCurrentYearPowerGeneration(currentYearPowerGeneration);
// 当日发电量 // 当日发电量
float currentDayPowerGeneration = getPowerGeneration(effEmInfoList, getCurrentTime() + " 00:00:00", getAddDayTime(1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType()); float currentDayPowerGeneration = this.generateByDevices(effEmInfoList, getCurrentTime() + " 00:00:00", getAddDayTime(1) + " 00:00:00",3);
powerStationTotalVo.setCurrentDayPowerGeneration(currentDayPowerGeneration); powerStationTotalVo.setCurrentDayPowerGeneration(currentDayPowerGeneration);
// 告警列表 // 告警列表
Result<List<SoeData>> S = soeClient.getByLastLimitTime(null, station.getCode(), 1); Result<List<SoeData>> S = soeClient.getByLastLimitTime(null, station.getCode(), 1);
@ -413,6 +415,24 @@ public class HomePageServiceImpl implements IHomePageService {
} }
/** /**
* 获取设备发电量
* @param devices
* @param start
* @param end
* @return
*/
private float generateByDevices(List<EminfoAndEmParamVo> devices, String start, String end,int accessRules) {
float generate = 0f;
if(CollectionUtil.isEmpty(devices)){
return generate;
}
for(EminfoAndEmParamVo device : devices ){
generate += analyseDataService.periodTargetFloat(start,end,accessRules,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
};
return generate;
}
/**
* 获取站点装机容量 * 获取站点装机容量
* *
* @param equipmentInfoList * @param equipmentInfoList
@ -446,96 +466,6 @@ public class HomePageServiceImpl implements IHomePageService {
/** /**
* 获取发电量
*
* @param list
* @param startTime
* @param endTime
* @return
*/
@Override
public float getPowerGeneration(List<EminfoAndEmParamVo> list, String startTime, String endTime,Integer cycleType) {
float allPower = 0F;
for (EminfoAndEmParamVo em : list) {
float power = this.getEmInfoPower(em, startTime, endTime,cycleType);
allPower += power;
}
return allPower;
}
/**
* 获取发电量
*
* @param em
* @param startTime
* @param endTime
* @return
*/
@Override
public float getEmInfoPower(EminfoAndEmParamVo em, String startTime, String endTime,Integer cycleType) {
return this.getAnalyzeCodeAndSignages(em,startTime,endTime,cycleType,GENERATE_ELECTRICITY);
}
/**
*
* @param em
* @param startTime
* @param endTime
* @param cycleType
* @param signages
* @return
*/
@Override
public float getAnalyzeCodeAndSignages(EminfoAndEmParamVo em, String startTime, String endTime, Integer cycleType, String signages) {
// FIXME 光伏测试
Random random = new Random();
return random.nextFloat() * 250000;
/*// 发电量
float aFloat = 0F;
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
analyzeDataConditionPO.setSignages(signages);
// 取数规则: 0=(整点值/最早值)、1=最大值、2=最小值、3=平均值、4=(累计值/和值)、5=(变化值/差值) 6=最新值
analyzeDataConditionPO.setAccessRules(EquipmentConstants.AccessRulesEnum.DIFF_CYCLE.getType());
// 周期类型: 0-> s(秒) 1->、m(分)、2->h(小时)3->、d(天)4->、w(周)5->、n(自然月)、6->y(自然年)
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
po.setDeviceCode(em.getEmCode());
po.setSignboardConditions(signboardConditions);
R<List<AnalyzeDataConditionVO>> analyzeData = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!analyzeData.isSuccess() || CollectionUtil.isEmpty(analyzeData.getData())) {
return aFloat;
}
List<AnalyzeDataConditionVO> records = analyzeData.getData();
AnalyzeDataConditionVO analyzeDataConditionVO = records.get(0);
if (ObjectUtil.isEmpty(analyzeDataConditionVO)) {
return aFloat;
}
List<AnalyseDataTaosVO> analyseDataTaosVOList = analyzeDataConditionVO.getList();
if (CollectionUtil.isEmpty(analyseDataTaosVOList)) {
return aFloat;
}
AnalyseDataTaosVO analyseDataTaosVO = analyzeDataConditionVO.getList().get(0);
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return aFloat;
}
float childFloat = Float.parseFloat(analyseDataTaosVO.getVal());
if (0 != em.getRideCount()) {
//获取发电量的值 且 * rideCount
aFloat = childFloat * em.getRideCount();
} else {
aFloat = childFloat;
}
return aFloat;*/
}
/**
* 年计划发电完成趋势 * 年计划发电完成趋势
* @param deptId * @param deptId
* @return * @return
@ -641,27 +571,6 @@ public class HomePageServiceImpl implements IHomePageService {
return planFloat; return planFloat;
} }
/**
* 查询站点当年实际发电量
*
* @param effEmInfoList
* @return
*/
private float getPlannedYearGeneration(List<EminfoAndEmParamVo> effEmInfoList) {
Calendar calendar = Calendar.getInstance();
//记得要+1
int month = calendar.get(Calendar.MONTH) + 1;
List<String> monList = this.getMonthList(0, month,true);
float power = 0f;
for (int i = 0; i < monList.size() - 1; i++) {
float monthPower = getPowerGeneration(effEmInfoList, monList.get(i) + " 00:00:00", monList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType());
power = power + monthPower;
}
return power;
}
/** /**
* 关键指标 - 发电站 * 关键指标 - 发电站
* *
@ -1498,7 +1407,6 @@ public class HomePageServiceImpl implements IHomePageService {
} }
/** /**
* 获取近年月份集合 * 获取近年月份集合
* @param year * @param year

362
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java

@ -108,7 +108,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
} }
// 取redis实时数据 // 取redis实时数据
Map<String, String> map = this.getRealData(); Map<String, String> map = this.getRealData();
if(MapUtils.isEmpty(map)){ if (MapUtils.isEmpty(map)) {
return; return;
} }
// redis缓存设备实时数据 // redis缓存设备实时数据
@ -119,19 +119,115 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
real.setDeptId(device.getCreateDept()); real.setDeptId(device.getCreateDept());
real.setDeviceCode(device.getEmCode()); real.setDeviceCode(device.getEmCode());
real.setDeviceName(device.getName()); real.setDeviceName(device.getName());
real.setState(this.getPhotovoltaicState(device,map)); real.setState(this.getPhotovoltaicState(device, map));
// 容量 // 容量
real.setCapacity(device.getInstalledCapacity()); real.setCapacity(device.getInstalledCapacity());
// 发电量 // 发电量
real.setGenerate(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_GENERATION_CAPACITY))); real.setGenerate(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_GENERATION_CAPACITY)));
// 功率 // 功率
real.setLoad(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_LOAD))); real.setLoad(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_LOAD)));
// 电压 // 电压
real.setVoltage(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_VOLTAGE))); real.setVoltage(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_VOLTAGE)));
// 电流 // 电流
real.setCurrent(Double.valueOf(this.getSignageValue(device,map,HomePageConstant.PV_CURRENT))); real.setCurrent(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.PV_CURRENT)));
// 直流电流1
real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE)));
// 直流电流2
real.setDirect_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_TWO)));
// 直流电流3
real.setDirect_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_THREE)));
// 直流电流4
real.setDirect_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_FOUR)));
// 直流电流5
real.setDirect_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_FIVE)));
// 直流电流6
real.setDirect_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_SIX)));
// 直流电流7
real.setDirect_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_SEVEN)));
// 直流电流8
real.setDirect_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_EIGHT)));
// 直流电流9
real.setDirect_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_NINE)));
// 直流电流10
real.setDirect_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_TEN)));
// 直流电流11
real.setDirect_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ELEVEN)));
// 直流电流12
real.setDirect_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_TWELVE)));
// 直流电压1
real.setDc_voltage_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_ONE)));
// 直流电压2
real.setDc_voltage_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TWO)));
// 直流电压3
real.setDc_voltage_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_THREE)));
// 直流电压4
real.setDc_voltage_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_FOUR)));
// 直流电压5
real.setDc_voltage_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_FIVE)));
// 直流电压6
real.setDc_voltage_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_SIX)));
// 直流电压7
real.setDc_voltage_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_SEVEN)));
// 直流电压8
real.setDc_voltage_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_EIGHT)));
// 直流电压9
real.setDc_voltage_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_NINE)));
// 直流电压10
real.setDc_voltage_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TEN)));
// 直流电压11
real.setDc_voltage_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_ELEVEN)));
// 直流电压12
real.setDc_voltage_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DC_VOLTAGE_TWELVE)));
// 串流电流1
real.setDirect_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.DIRECT_ONE)));
// 串流电流2
real.setSeries_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_TWO)));
// 串流电流3
real.setSeries_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_THREE)));
// 串流电流4
real.setSeries_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_FOUR)));
// 串流电流5
real.setSeries_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_FIVE)));
// 串流电流6
real.setSeries_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_SIX)));
// 串流电流7
real.setSeries_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_SEVEN)));
// 串流电流8
real.setSeries_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_EIGHT)));
// 串流电流9
real.setSeries_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_NINE)));
// 串流电流10
real.setSeries_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_TEN)));
// 串流电流11
real.setSeries_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_ELEVEN)));
// 串流电流12
real.setSeries_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SERIES_TWELVE)));
// 串流电压1
real.setSe_voltage_one(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_ONE)));
// 串流电压2
real.setSe_voltage_two(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TWO)));
// 串流电压3
real.setSe_voltage_three(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_THREE)));
// 串流电压4
real.setSe_voltage_four(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_FOUR)));
// 串流电压5
real.setSe_voltage_five(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_FIVE)));
// 串流电压6
real.setSe_voltage_six(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_SIX)));
// 串流电压7
real.setSe_voltage_seven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_SEVEN)));
// 串流电压8
real.setSe_voltage_eight(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_EIGHT)));
// 串流电压9
real.setSe_voltage_nine(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_NINE)));
// 串流电压10
real.setSe_voltage_ten(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TEN)));
// 串流电压11
real.setSe_voltage_eleven(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_ELEVEN)));
// 串流电压12
real.setSe_voltage_twelve(Double.valueOf(this.getSignageValue(device, map, HomePageConstant.SE_VOLTAGE_TWELVE)));
// 上次功率 // 上次功率
real.setLastLoad(this.getLastLoad(device,history)); real.setLastLoad(this.getLastLoad(device, history));
return real; return real;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
// 存储redis // 存储redis
@ -160,13 +256,13 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 当日运行时长 // 当日运行时长
//target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY))); //target.setRunHours(this.runHours(device.getPoint().get(HomePageConstant.PV_JOINT_RELAY)));
// 年发电量 // 年发电量
target.setGenerationYear((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"0")); target.setGenerationYear((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "0"));
// 月发电量 // 月发电量
target.setGenerationMon((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"1")); target.setGenerationMon((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "1"));
// 日发电量 // 日发电量
target.setGenerationDay((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"2")); target.setGenerationDay((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "2"));
// 昨日发电量 // 昨日发电量
target.setGenerationYesterday((double) this.sumValueByTime(device.getEmCode(),device.getRideCount(),"3")); target.setGenerationYesterday((double) this.sumValueByTime(device.getEmCode(), device.getRideCount(), "3"));
// 收益 // 收益
target.setIncome(target.getGenerationDay() * 0.34); target.setIncome(target.getGenerationDay() * 0.34);
// 节约标准煤 // 节约标准煤
@ -186,14 +282,15 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 当天有功功率 * 当天有功功率
*
* @param device * @param device
* @return * @return
*/ */
private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) { private List<PhotovoltaicPowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,1,2,device.getEmCode(),HomePageConstant.PV_LOAD); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if(CollectionUtil.isEmpty(records)){ if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
return records.stream().map(record -> { return records.stream().map(record -> {
@ -207,6 +304,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 近30天发电量 * 近30天发电量
*
* @param device * @param device
* @return * @return
*/ */
@ -218,14 +316,14 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME); String start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,3,device.getEmCode(),HomePageConstant.PV_GENERATION_CAPACITY); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 5, 3, device.getEmCode(), HomePageConstant.PV_GENERATION_CAPACITY);
if(CollectionUtil.isEmpty(records)){ if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>(); return new ArrayList<>();
} }
return records.stream().map(record -> { return records.stream().map(record -> {
GenerationPowerVo generate = new GenerationPowerVo(); GenerationPowerVo generate = new GenerationPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s"); Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE)); generate.setDate(DateUtil.format(time, DateUtil.PATTERN_DATE));
generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0"))); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")));
return generate; return generate;
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList()); }).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList());
@ -234,65 +332,67 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 根据事件查询数据值 * 根据事件查询数据值
*
* @param deviceCode * @param deviceCode
* @param rideCount * @param rideCount
* @param type * @param type
* @return * @return
*/ */
private float sumValueByTime(String deviceCode, int rideCount,String type) { private float sumValueByTime(String deviceCode, int rideCount, String type) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String start = null,end = null; String start = null, end = null;
Integer cycleType = 3; Integer cycleType = 3;
switch (type){ switch (type) {
//年 //年
case "0": case "0":
calendar.add(Calendar.HOUR_OF_DAY, + 1); calendar.add(Calendar.HOUR_OF_DAY, +1);
end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); end = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DATE) + 1); calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DATE) + 1);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
cycleType = 6; cycleType = 6;
break; break;
//月 //月
case "1": case "1":
start = DateUtil.format(new Date(),"yyyy-MM") + "-01 00:00:00"; start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
cycleType = 5; cycleType = 5;
break; break;
//日 //日
case "2": case "2":
start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
break; break;
//昨日 //昨日
case "3": case "3":
calendar.add(Calendar.DAY_OF_MONTH, - 1); calendar.add(Calendar.DAY_OF_MONTH, -1);
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY)); calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE)); calendar.add(Calendar.MINUTE, -calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND)); calendar.add(Calendar.SECOND, -calendar.get(Calendar.SECOND));
start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); start = DateUtil.format(calendar.getTime(), DateUtil.PATTERN_DATETIME);
end = DateUtil.format(new Date(),DateUtil.PATTERN_DATE) + " 00:00:00"; end = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
break; break;
} }
return analyseDataService.periodTargetFloat(start,end,5,cycleType,deviceCode,rideCount,HomePageConstant.PV_GENERATION_CAPACITY); return analyseDataService.periodTargetFloat(start, end, 5, cycleType, deviceCode, rideCount, HomePageConstant.PV_GENERATION_CAPACITY);
} }
/** /**
* 获取上一次功率 * 获取上一次功率
*
* @param device * @param device
* @param history * @param history
* @return * @return
*/ */
private Double getLastLoad(EminfoAndEmParamVo device, List<PhotovoltaicRealVo> history) { private Double getLastLoad(EminfoAndEmParamVo device, List<PhotovoltaicRealVo> history) {
if(CollectionUtil.isEmpty(history)){ if (CollectionUtil.isEmpty(history)) {
return 0.0; return 0.0;
} }
List<PhotovoltaicRealVo> historyDevice = history.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList()); List<PhotovoltaicRealVo> historyDevice = history.stream().filter(o -> o.getDeviceCode().equals(device.getEmCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(historyDevice)){ if (CollectionUtil.isEmpty(historyDevice)) {
return 0.0; return 0.0;
} }
return historyDevice.get(0).getLoad(); return historyDevice.get(0).getLoad();
@ -300,12 +400,13 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 获取开机状态 * 获取开机状态
*
* @param device * @param device
* @return * @return
*/ */
private int getPhotovoltaicState(EminfoAndEmParamVo device,Map<String,String> map) { private int getPhotovoltaicState(EminfoAndEmParamVo device, Map<String, String> map) {
// 获取开关机监测点实时数据 // 获取开关机监测点实时数据
String value = this.getSignageValue(device,map,HomePageConstant.PV_JOINT_RELAY); String value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY);
// 开机状态 // 开机状态
if (HomePageConstant.OFF.equals(value)) { if (HomePageConstant.OFF.equals(value)) {
return 0; return 0;
@ -315,25 +416,26 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 获取监测点实时数据 * 获取监测点实时数据
*
* @param em * @param em
* @param map * @param map
* @param targets * @param targets
* @return * @return
*/ */
private String getSignageValue(EminfoAndEmParamVo em,Map<String,String> map, String targets) { private String getSignageValue(EminfoAndEmParamVo em, Map<String, String> map, String targets) {
if(ObjectUtil.isEmpty(em) || MapUtils.isEmpty(map)){ if (ObjectUtil.isEmpty(em) || MapUtils.isEmpty(map)) {
return "0"; return "0";
} }
Map<String,String> point = em.getPoint(); Map<String, String> point = em.getPoint();
if(MapUtils.isEmpty(point)){ if (MapUtils.isEmpty(point)) {
return "0"; return "0";
} }
String realId = point.get(targets); String realId = point.get(targets);
if(StringUtil.isEmpty(realId)){ if (StringUtil.isEmpty(realId)) {
return "0"; return "0";
} }
String value = map.get(realId); String value = map.get(realId);
if(StringUtil.isEmpty(realId)){ if (StringUtil.isEmpty(realId)) {
return "0"; return "0";
} }
// 获取value // 获取value
@ -463,74 +565,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 获取年日发电量
*
* @param device
* @param scope
* @return
*/
private float getGenerationPower(EminfoAndEmParamVo device, int scope) {
// 日期格式化yyyy-mm-dd
SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
// 日期格式化yyyy-mm-dd
SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
String startTime, endTime;
int cycle;
switch (scope) {
// 年
case 0:
Calendar calendar = Calendar.getInstance();
endTime = sdf.format(calendar.getTime());
calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
startTime = df.format(calendar.getTime()) + " 00:00:00";
cycle = EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType();
break;
// 月
case 1:
startTime = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
cycle = EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType();
break;
// 日
case 2:
Calendar cal = Calendar.getInstance();
String time = df.format(cal.getTime());
startTime = time + " 00:00:00";
endTime = time + " 23:59:59";
cycle = EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType();
break;
default:
throw new IllegalStateException("Unexpected value: " + scope);
}
return homePageService.getAnalyzeCodeAndSignages(device, startTime, endTime, cycle, HomePageConstant.PV_GENERATION_CAPACITY);
}
/**
* 当天功率
*
* @return
*/
private List<String> getTestDay() {
// 日期格式化yyyy-mm-dd
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.HOUR_OF_DAY, -calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.HOUR_OF_DAY, +1);
list.add(df.format(calendar.getTime()));
// 获取时间
while (calendar.getTime().compareTo(new Date()) <= 0) {
calendar.add(Calendar.HOUR_OF_DAY, +1);
list.add(df.format(calendar.getTime()));
}
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
}
/**
* 获取近30天集合 * 获取近30天集合
* *
* @return * @return
@ -950,8 +984,8 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
photovoltaic.setCharts(this.deviceCharts(photovoltaic.getDevices())); photovoltaic.setCharts(this.deviceCharts(photovoltaic.getDevices()));
// 站点实时数据: 装机容量、总发电量、功率、收益 // 站点实时数据: 装机容量、总发电量、功率、收益
this.real_data(photovoltaic); this.real_data(photovoltaic);
// 年发电量比较概括 // 站点今日功率,近年发电量
photovoltaic.setGenerateSurvey(this.generateSurvey(station.getId())); this.target_data(photovoltaic);
return photovoltaic; return photovoltaic;
} }
@ -992,7 +1026,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 容量、实时功率、今日发电量 // 容量、实时功率、今日发电量
this.subordinateTargetData(subordinate, entry.getValue().stream().collect(Collectors.toList()), deviceReals, deviceTargets); this.subordinateTargetData(subordinate, entry.getValue().stream().collect(Collectors.toList()), deviceReals, deviceTargets);
// 当月任务执行情况 // 当月任务执行情况
this.subordinateTaskMon(subordinate,Collections.singletonList(entry.getKey().getId())); this.subordinateTaskMon(subordinate, Collections.singletonList(entry.getKey().getId()));
subordinates.add(subordinate); subordinates.add(subordinate);
} }
return subordinates; return subordinates;
@ -1000,9 +1034,10 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
/** /**
* 当月任务执行情况 * 当月任务执行情况
*
* @param subordinate * @param subordinate
*/ */
private void subordinateTaskMon(PhotovoltaicSubordinateAppVo subordinate,List<Long> depts) { private void subordinateTaskMon(PhotovoltaicSubordinateAppVo subordinate, List<Long> depts) {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME); DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME);
LocalDate firstDay = LocalDate.now().withDayOfMonth(1); LocalDate firstDay = LocalDate.now().withDayOfMonth(1);
LocalDateTime startTime = LocalDateTime.of(firstDay, LocalTime.MIN); LocalDateTime startTime = LocalDateTime.of(firstDay, LocalTime.MIN);
@ -1012,23 +1047,23 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
//监控线程执行完后返回结果 //监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY);
// 日常维护 // 日常维护
exe.execute(()->{ exe.execute(() -> {
MaintainVo maintainVo = taskService.getMaintain(dtf.format(startTime),dtf.format(endTime),depts); MaintainVo maintainVo = taskService.getMaintain(dtf.format(startTime), dtf.format(endTime), depts);
subordinate.setMaintenanceCount(maintainVo.getMaintain()); subordinate.setMaintenanceCount(maintainVo.getMaintain());
subordinate.setMaintenanceFinishCount(maintainVo.getMaintainFinish()); subordinate.setMaintenanceFinishCount(maintainVo.getMaintainFinish());
countDownLatch.countDown(); countDownLatch.countDown();
}); });
// 消缺 // 消缺
exe.execute(()->{ exe.execute(() -> {
ShortagesVo shortages = taskService.getShortages(depts); ShortagesVo shortages = taskService.getShortages(depts);
subordinate.setDefectCount(shortages.getShortagesSum()); subordinate.setDefectCount(shortages.getShortagesSum());
subordinate.setDefectFinishCount(shortages.getShortages()); subordinate.setDefectFinishCount(shortages.getShortages());
countDownLatch.countDown(); countDownLatch.countDown();
}); });
// 检修 // 检修
exe.execute(()->{ exe.execute(() -> {
OverhaulVo overhaulVo = taskService.getOverhaul(dtf.format(startTime),dtf.format(endTime),depts); OverhaulVo overhaulVo = taskService.getOverhaul(dtf.format(startTime), dtf.format(endTime), depts);
int overhaul = overhaulVo.getOverhaul(); int overhaul = overhaulVo.getOverhaul();
int overhaulFinish = overhaulVo.getOverhaulFinish(); int overhaulFinish = overhaulVo.getOverhaulFinish();
subordinate.setOverhaulCount(overhaul); subordinate.setOverhaulCount(overhaul);
@ -1036,11 +1071,11 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
countDownLatch.countDown(); countDownLatch.countDown();
}); });
// 操作票&工作票 // 操作票&工作票
exe.execute(()->{ exe.execute(() -> {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("startDate",dtf.format(startTime)); map.put("startDate", dtf.format(startTime));
map.put("endDate",dtf.format(endTime)); map.put("endDate", dtf.format(endTime));
map.put("deptList",depts); map.put("deptList", depts);
R<TicketMonthVO> R = ticketInfoClient.getOperateWorkStatistic(map); R<TicketMonthVO> R = ticketInfoClient.getOperateWorkStatistic(map);
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return; return;
@ -1419,6 +1454,53 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum()); photovoltaic.setGenerateDay(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum());
// 功率 // 功率
photovoltaic.setLoad(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum()); photovoltaic.setLoad(photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum());
double generationDay = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerateDay).sum();
double generationYesterday = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getGenerationYesterday).sum();
// 环比发电量
if (Math.abs(generationDay) <= 0 || Math.abs(generationYesterday) <= 0) {
photovoltaic.setGenerateDayRatio(0.0);
} else {
photovoltaic.setGenerateDayRatio(BigDecimal.valueOf((generationDay - generationYesterday) / generationYesterday * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
double load = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLoad).sum();
double lastLoad = photovoltaic.getDevices().stream().mapToDouble(PhotovoltaicDeviceVo::getLastLoad).sum();
// 环比功率
if (Math.abs(load) <= 0 || Math.abs(lastLoad) <= 0) {
photovoltaic.setLoadRatio(0.0);
} else {
photovoltaic.setLoadRatio(BigDecimal.valueOf((load - lastLoad) / lastLoad * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
/**
* 站点指标数据统计
*
* @param photovoltaic
*/
private void target_data(PhotovoltaicStationVo photovoltaic) {
List<PhotovoltaicDeviceVo> devices = photovoltaic.getDevices();
if (CollectionUtil.isEmpty(devices)) {
return;
}
// 功率
photovoltaic.setActivePowerVoList(
devices.stream().map(PhotovoltaicDeviceVo::getActivePowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(PhotovoltaicPowerVo::getHour)).entrySet().stream().map(entry -> {
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
load.setHour(entry.getKey());
load.setActivePower(String.valueOf(entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getActivePower())).sum()));
return load;
}).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList())
);
// 发电量
photovoltaic.setGenerationPowerVoList(
devices.stream().map(PhotovoltaicDeviceVo::getGenerationPowerVoList).flatMap(Collection::stream).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry -> {
GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(entry.getKey());
generate.setGenerate((float) entry.getValue().stream().mapToDouble(o -> Double.valueOf(o.getGenerate())).sum());
return generate;
}).sorted(Comparator.comparing(GenerationPowerVo::getDate)).collect(Collectors.toList())
);
} }
/** /**
@ -1446,6 +1528,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 总发电量、实时功率、电压、电流、环比功率 // 总发电量、实时功率、电压、电流、环比功率
item.setGenerate(mateReals.get(0).getGenerate()); item.setGenerate(mateReals.get(0).getGenerate());
item.setLoad(mateReals.get(0).getLoad()); item.setLoad(mateReals.get(0).getLoad());
item.setLastLoad(mateReals.get(0).getLastLoad());
item.setVoltage(mateReals.get(0).getVoltage()); item.setVoltage(mateReals.get(0).getVoltage());
item.setCurrent(mateReals.get(0).getCurrent()); item.setCurrent(mateReals.get(0).getCurrent());
// 环比功率 // 环比功率
@ -1463,6 +1546,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
item.setGenerateYear(mateTargets.get(0).getGenerationYear()); item.setGenerateYear(mateTargets.get(0).getGenerationYear());
item.setGenerateMon(mateTargets.get(0).getGenerationMon()); item.setGenerateMon(mateTargets.get(0).getGenerationMon());
item.setGenerateDay(mateTargets.get(0).getGenerationDay()); item.setGenerateDay(mateTargets.get(0).getGenerationDay());
item.setGenerationYesterday(mateTargets.get(0).getGenerationYesterday());
item.setCo2(mateTargets.get(0).getCo2()); item.setCo2(mateTargets.get(0).getCo2());
item.setTec(mateTargets.get(0).getTec()); item.setTec(mateTargets.get(0).getTec());
item.setDeforest(mateTargets.get(0).getDeforest()); item.setDeforest(mateTargets.get(0).getDeforest());
@ -1501,40 +1585,4 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
}).sorted(Comparator.comparing(PhotovoltaicDeviceChartsVo::getGenerate)).collect(Collectors.toList()); }).sorted(Comparator.comparing(PhotovoltaicDeviceChartsVo::getGenerate)).collect(Collectors.toList());
} }
/**
* 年发电量比较概括
*
* @return
*/
private List<PowerYearVo> generateSurvey(Long station) {
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data);
if (MapUtils.isEmpty(map)) {
return new ArrayList<>();
}
// 站点发电数据
if (!map.containsKey(station)) {
return new ArrayList<>();
}
// 转换成集合
List<PowerMonthVo> generates = new ArrayList<>();
map.get(station).forEach((key, value) -> {
PowerMonthVo generate = new PowerMonthVo();
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), key), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
generate.setYear(localDate.getYear());
generate.setMonth(localDate.getMonthValue());
generate.setStrMonth(key);
generate.setPower(value);
generates.add(generate);
});
// 根据年份分组
Map<Integer, List<PowerMonthVo>> year = generates.stream().collect(Collectors.groupingBy(PowerMonthVo::getYear));
// 返回结果集
return year.entrySet().stream().map(entry -> {
PowerYearVo powerYearVo = new PowerYearVo();
powerYearVo.setYear(entry.getKey());
List<PowerMonthVo> sortValue = entry.getValue().stream().sorted(Comparator.comparing(PowerMonthVo::getMonth)).collect(Collectors.toList());
powerYearVo.setPowerMonthVoList(sortValue);
return powerYearVo;
}).collect(Collectors.toList());
}
} }

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -72,6 +72,8 @@ import java.util.stream.Collectors;
public class SideHustleServiceImpl implements ISideHustleService { public class SideHustleServiceImpl implements ISideHustleService {
@NotNull @NotNull
private final IAnalyseDataService analyseDataService;
@NotNull
private final IHomePageService homePageService; private final IHomePageService homePageService;
@NotNull @NotNull
private final IStationService stationService; private final IStationService stationService;
@ -488,13 +490,12 @@ public class SideHustleServiceImpl implements ISideHustleService {
return; return;
} }
// 区域站点下设备 // 区域站点下设备
List<EminfoAndEmParamVo> valid = deviceList.stream().filter(o->deptList.contains(o.getCreateDept())).collect(Collectors.toList()); List<EminfoAndEmParamVo> devices = deviceList.stream().filter(o->deptList.contains(o.getCreateDept())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(valid)){ if(CollectionUtil.isEmpty(devices)){
return; return;
} }
// 获取当班时间内发电量 // 获取当班时间内发电量
SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME); float generatingCapacity = this.generateByDuty(devices,startDate,endDate);
float generatingCapacity = homePageService.getPowerGeneration(valid,sdf.format(startDate),sdf.format(endDate),EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType());
// 是否为查询上一班组发电量 // 是否为查询上一班组发电量
if(flag){ if(flag){
NextDutyInfoVo upDutyInfoVo = areaDutyVo.getUpDutyInfoVo(); NextDutyInfoVo upDutyInfoVo = areaDutyVo.getUpDutyInfoVo();
@ -505,6 +506,24 @@ public class SideHustleServiceImpl implements ISideHustleService {
areaDutyVo.setGeneratingCapacity(generatingCapacity); areaDutyVo.setGeneratingCapacity(generatingCapacity);
} }
/**
* 根据当班时间查询发电量
* @param devices
* @param startDate
* @param endDate
* @return
*/
private float generateByDuty(List<EminfoAndEmParamVo> devices, Date start, Date end) {
float generate = 0f;
if(CollectionUtil.isEmpty(devices)){
return generate;
}
for(EminfoAndEmParamVo device : devices ){
generate += analyseDataService.periodTargetFloat(DateUtil.format(start,DateUtil.PATTERN_DATETIME),DateUtil.format(end,DateUtil.PATTERN_DATETIME),3,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
};
return generate;
}
/** /**
* 当班双票 * 当班双票

82
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java

@ -60,6 +60,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class WaterServiceImpl implements IWaterService { public class WaterServiceImpl implements IWaterService {
private final IAnalyseDataService analyseDataService;
private final IHomePageService homePageService; private final IHomePageService homePageService;
private final IStationService stationService; private final IStationService stationService;
@ -571,13 +573,13 @@ public class WaterServiceImpl implements IWaterService {
*/ */
private float getUsrPowerYear(EminfoAndEmParamVo device) { private float getUsrPowerYear(EminfoAndEmParamVo device) {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
String endTime = sdf.format(calendar.getTime()); String end = sdf.format(calendar.getTime());
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String startTime = df.format(calendar.getTime()); String start = df.format(calendar.getTime());
// 当年用电量 // 当年用电量
return homePageService.getAnalyzeCodeAndSignages(device,startTime + " 00:00:00",endTime,EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(),HomePageConstant.ELECTRICITY_CONSUMPTION); return analyseDataService.periodTargetFloat(start,end,6,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
} }
/** /**
@ -586,10 +588,10 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
private float getUsrPowerMon(EminfoAndEmParamVo device) { private float getUsrPowerMon(EminfoAndEmParamVo device) {
String startTime = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; String start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
String endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
// 当月用电量 // 当月用电量
return homePageService.getAnalyzeCodeAndSignages(device,startTime,endTime,EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(),HomePageConstant.ELECTRICITY_CONSUMPTION); return analyseDataService.periodTargetFloat(start,end,5,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
} }
/** /**
@ -598,10 +600,9 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
private float getUsrPowerDay(EminfoAndEmParamVo device) { private float getUsrPowerDay(EminfoAndEmParamVo device) {
Calendar cal = Calendar.getInstance(); String time = DateUtil.format(new Date(),DateUtil.PATTERN_DATE);
String time = df.format(cal.getTime());
// 当日用电量 // 当日用电量
return homePageService.getAnalyzeCodeAndSignages(device,time + " 00:00:00",time + " 23:59:59",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),HomePageConstant.ELECTRICITY_CONSUMPTION); return analyseDataService.periodTargetFloat(time + " 00:00:00",time + " 23:59:59",3,5,device.getEmCode(),device.getRideCount(),HomePageConstant.ELECTRICITY_CONSUMPTION);
} }
@ -751,40 +752,51 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
private List<UsrPowerVo> getUsrPowerVoList(EminfoAndEmParamVo device) { private List<UsrPowerVo> getUsrPowerVoList(EminfoAndEmParamVo device) {
List<UsrPowerVo> usrPowerVoList = new ArrayList<>(); String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE);
// 近30天日期集合 Calendar calendar = Calendar.getInstance();
List<String> dayList = this.getRecent30Day(); calendar.add(Calendar.DAY_OF_MONTH,-29);
for (int i = 0; i < dayList.size() - 1; i++) { String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
UsrPowerVo usrPowerVo = new UsrPowerVo(); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.ELECTRICITY_CONSUMPTION);
usrPowerVo.setDate(dayList.get(i)); if(CollectionUtil.isEmpty(records)){
// 某天用电量 return new ArrayList<>();
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),HomePageConstant.ELECTRICITY_CONSUMPTION); }
usrPowerVo.setUsrPower(power); return records.stream().map(record -> {
usrPowerVoList.add(usrPowerVo); UsrPowerVo usr = new UsrPowerVo();
} Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
return usrPowerVoList; usr.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
usr.setUsrPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")));
return usr;
}).collect(Collectors.toList());
} }
/** /**
* 近3年发电量 * 近3年发电量
*
* @param device * @param device
* @return * @return
*/ */
private Map<String, Float> getUsrYearMap(EminfoAndEmParamVo device) { private Map<String, Float> getUsrYearMap(EminfoAndEmParamVo device) {
// 返回map // 开始时间
Map<String, Float> usrYearMap = new HashMap<>(); Calendar calendar = Calendar.getInstance();
// 获取需要遍历月份 calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
List<String> monList = homePageService.getMonthList(2, 12,true); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
for (int i = 0; i < monList.size() - 1; i++) { String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
if (homePageService.compareDate(monList.get(i))) { // 结束日期
usrYearMap.put(monList.get(i), 0f); calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - 3);
continue; calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
} String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 设备某月用电量 // 查询数据
float power = homePageService.getAnalyzeCodeAndSignages(device, monList.get(i) + " 00:00:00", monList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(),HomePageConstant.ELECTRICITY_CONSUMPTION); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
usrYearMap.put(monList.get(i), power); if(CollectionUtil.isEmpty(records)){
} return new HashMap<>();
return usrYearMap; }
return records.stream().map(record -> {
PowerMonthVo generate = new PowerMonthVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
generate.setStrMonth(DateUtil.format(time, DateUtil.PATTERN_DATE));
generate.setPower(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate;
}).collect(Collectors.toMap(PowerMonthVo::getStrMonth,PowerMonthVo::getPower));
} }

83
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java

@ -15,6 +15,7 @@ import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationAttributeService; import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.soe.ISoeClient; import com.hnac.hzinfo.datasearch.soe.ISoeClient;
import com.hnac.hzinfo.datasearch.soe.domian.SoeData; import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -44,6 +45,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class WebHomeServiceImpl implements IWebHomeService { public class WebHomeServiceImpl implements IWebHomeService {
private final IAnalyseDataService analyseDataService;
private final IHomePageService homePageService; private final IHomePageService homePageService;
private final IMainSystemMonitoringService maintenanceTaskService; private final IMainSystemMonitoringService maintenanceTaskService;
@ -70,10 +73,6 @@ public class WebHomeServiceImpl implements IWebHomeService {
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key"; private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
// 日期格式化yyyy-mm-dd
private final SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
// 日期格式化yyyy-mm-dd
private final SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
/** /**
* 加载水电站机组实时数据 * 加载水电站机组实时数据
@ -275,37 +274,36 @@ public class WebHomeServiceImpl implements IWebHomeService {
* @return * @return
*/ */
private float getGenerationPower(EminfoAndEmParamVo device,int scope) { private float getGenerationPower(EminfoAndEmParamVo device,int scope) {
String startTime,endTime; String start,end;
int cycle; int accessRules;
Calendar calendar = Calendar.getInstance();
switch (scope){ switch (scope){
// 年 // 年
case 0: case 0:
Calendar calendar = Calendar.getInstance(); end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
endTime = sdf.format(calendar.getTime());
calendar.setTime(new Date()); calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH)); calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1); calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
startTime = df.format(calendar.getTime()) + " 00:00:00"; start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
cycle = EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType(); accessRules = EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType();
break; break;
// 月 // 月
case 1: case 1:
startTime = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00"; start = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME); end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
cycle = EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType(); accessRules = EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType();
break; break;
// 日 // 日
case 2: case 2:
Calendar cal = Calendar.getInstance(); String time = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
String time = df.format(cal.getTime()); start = time + " 00:00:00";
startTime = time + " 00:00:00"; end = time + " 23:59:59";
endTime = time + " 23:59:59"; accessRules = EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType();
cycle = EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType();
break; break;
default: default:
throw new IllegalStateException("Unexpected value: " + scope); throw new IllegalStateException("Unexpected value: " + scope);
} }
return homePageService.getAnalyzeCodeAndSignages(device,startTime,endTime,cycle,HomePageConstant.HYDROPOWER_GENERATE_POWER); return analyseDataService.periodTargetFloat(start,end,accessRules,5,device.getEmCode(),device.getRideCount(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
} }
/** /**
@ -314,40 +312,21 @@ public class WebHomeServiceImpl implements IWebHomeService {
* @return * @return
*/ */
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) {
List<GenerationPowerVo> generationPowerVoList = new ArrayList<>(); String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE);
// 近30天日期集合
List<String> dayList = this.getRecent30Day();
for (int i = 0; i < dayList.size() - 1; i++) {
GenerationPowerVo generationPowerVo = new GenerationPowerVo();
generationPowerVo.setDate(dayList.get(i));
// 某天发电量
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
generationPowerVo.setGenerate(power);
generationPowerVoList.add(generationPowerVo);
}
return generationPowerVoList;
}
/**
* 获取近30天集合
* @return
*/
private List<String> getRecent30Day() {
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH,-29);
calendar.add(Calendar.DATE, + 1); String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE);
list.add(df.format(calendar.getTime())); List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
// 获取日期之间的月 if(CollectionUtil.isEmpty(records)){
int i = 0; return new ArrayList<>();
while (i < 30) { }
calendar.add(Calendar.DATE, - 1); return records.stream().map(record -> {
list.add(df.format(calendar.getTime())); GenerationPowerVo generate = new GenerationPowerVo();
i++; Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
} generate.setDate(DateUtil.format(time,DateUtil.PATTERN_DATE));
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList()); generate.setGenerate(Float.valueOf(Optional.ofNullable(record.getVal()).orElse("0")));
return generate;
}).collect(Collectors.toList());
} }
/** /**

Loading…
Cancel
Save