Browse Source

#水电站优化

zhongwei
yang_shj 2 years ago
parent
commit
806785f8e5
  1. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java
  2. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java
  4. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyGroupGenerationVo.java
  5. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java
  6. 1
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  7. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ActivePowerVo.java
  8. 16
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AreaScaleVo.java
  9. 47
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerScoreVo.java
  10. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java
  11. 24
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java
  12. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitTargetVo.java
  13. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitVo.java
  14. 50
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/OldAreaScaleVo.java
  15. 57
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/OldHydropowerScoreVo.java
  16. 18
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/OldStationCountVo.java
  17. 4
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PowerMonthVo.java
  18. 10
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java
  19. 43
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/TargetVo.java
  20. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java
  21. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/PlanGenerationMapper.java
  22. 4
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/PlanGenerationMapper.xml
  23. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IPlanGenerationService.java
  24. 10
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/PlanGenerationServiceImpl.java
  25. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java
  26. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/LevelAlarmController.java
  27. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java
  28. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java
  29. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  30. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java
  31. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/RainFallServiceImpl.java
  32. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/StorageServiceImpl.java
  33. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/UseServiceImpl.java
  34. 47
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java
  35. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomePageController.java
  36. 28
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java
  37. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java
  38. 31
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  39. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaService.java
  40. 17
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java
  41. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java
  42. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IHomePageService.java
  43. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java
  44. 26
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java
  45. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  46. 43
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaServiceImpl.java
  47. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  48. 516
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  49. 475
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  50. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  51. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java
  52. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/RunMonthReportServiceImpl.java
  53. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  54. 109
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  55. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/ImsDeptController.java
  56. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IImsDeptService.java
  57. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClient.java

@ -84,7 +84,7 @@ public interface IPlanGenertionClient {
* @return * @return
*/ */
@GetMapping(GET_POWER_YEAR) @GetMapping(GET_POWER_YEAR)
String getPlanPowerYear(@RequestParam(value = "stationIds", required = false) List<String> stationIds, @RequestParam(value = "date", required = false) String date); Double getPlanPowerYear(@RequestParam(value = "stationIds", required = false) List<String> stationIds, @RequestParam(value = "date", required = false) String date);
/** /**
* 计划发电量查询 * 计划发电量查询

2
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/feign/IPlanGenertionClientBack.java

@ -47,7 +47,7 @@ public class IPlanGenertionClientBack implements IPlanGenertionClient {
} }
@Override @Override
public String getPlanPowerYear(List<String> stationIds, String date) { public Double getPlanPowerYear(List<String> stationIds, String date) {
return null; return null;
} }

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/vo/AlarmMergeVo.java

@ -26,7 +26,7 @@ public class AlarmMergeVo{
private String realId; private String realId;
@ApiModelProperty("告警编号") @ApiModelProperty("告警编号")
private Long alarmCode; private String alarmCode;
@ApiModelProperty("告警类型") @ApiModelProperty("告警类型")
private String type; private String type;

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/duty/vo/ImsDutyGroupGenerationVo.java

@ -10,7 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Time; import java.sql.Time;
@Data @Data
public class ImsDutyGroupGenerationVo extends ImsDutyMainEntity { public class ImsDutyGroupGenerationVo extends ImsDutyMainEntity {
@ApiModelProperty(value = "班组名称") @ApiModelProperty(value = "班组名称")
private String groupName; private String groupName;

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/fill/vo/QueryVo.java

@ -17,10 +17,7 @@ public class QueryVo{
private String stationCode; private String stationCode;
@ApiModelProperty("开始时间") @ApiModelProperty("开始时间")
private Date startTime; private String date;
@ApiModelProperty("结束时间")
private Date endTime;
@ApiModelProperty("设备编号") @ApiModelProperty("设备编号")
private String deviceCode; private String deviceCode;

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

@ -85,6 +85,7 @@ public interface HomePageConstant {
*/ */
Integer HYDROPOWER_SERVETYPE = 2; Integer HYDROPOWER_SERVETYPE = 2;
/** /**
* 站点类型 云服务 * 站点类型 云服务
*/ */

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/ActivePowerVo.java

@ -5,8 +5,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; /**
* @author ysj
*/
@Data @Data
@ApiModel(value = "当日机组有功功率") @ApiModel(value = "当日机组有功功率")
public class ActivePowerVo { public class ActivePowerVo {

16
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AreaScaleVo.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.main.vo; package com.hnac.hzims.operational.main.vo;
import com.hnac.hzims.hzimsweather.entity.DailyHeWeatherEntity;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -9,6 +8,7 @@ import java.util.List;
/** /**
* 集团/区域占比 * 集团/区域占比
* @author ysj
*/ */
@Data @Data
public class AreaScaleVo { public class AreaScaleVo {
@ -25,26 +25,20 @@ public class AreaScaleVo {
@ApiModelProperty(value = "站点实时温度") @ApiModelProperty(value = "站点实时温度")
private String temp; private String temp;
@ApiModelProperty(value = "年计划发电量")
private float planPowerYear;
@ApiModelProperty(value = "年发电量") @ApiModelProperty(value = "年发电量")
private float powerYear; private float powerYear;
@ApiModelProperty(value = "发电完成率") @ApiModelProperty(value = "发电完成率")
private double generationPercentageComplete; private double generationRate;
@ApiModelProperty(value = "区域/集团发电占比")
private double areaMakeUp;
@ApiModelProperty(value = "电站利用率") @ApiModelProperty(value = "电站利用率")
private double stationUse; private double deviceUse;
@ApiModelProperty(value = "容量利用率") @ApiModelProperty(value = "容量利用率")
private double capacityUse; private double capacityUse;
@ApiModelProperty(value = "发电量统计") @ApiModelProperty(value = "区域/集团发电占比")
private double generationCount; private double areaMakeUp;
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer sort; private Integer sort;

47
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerScoreVo.java

@ -1,11 +1,16 @@
package com.hnac.hzims.operational.main.vo; package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
* @author ysj
*/
@Data @Data
@ApiModel(value = "水电站分计对象") @ApiModel(value = "水电站分计对象")
public class HydropowerScoreVo { public class HydropowerScoreVo {
@ -19,39 +24,41 @@ public class HydropowerScoreVo {
@ApiModelProperty(value = "站点数量") @ApiModelProperty(value = "站点数量")
private Integer stationCount; private Integer stationCount;
@ApiModelProperty(value = "月总装机容量") @ApiModelProperty(value = "总装机容量")
private Double installedCapacityMonth; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double installedCapacity;
@ApiModelProperty(value = "容量利用率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double capacityRate;
@ApiModelProperty(value = "总有功功率") @ApiModelProperty(value = "总有功功率")
private Double activePowerMoth; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
@ApiModelProperty(value = "年总发电量") @ApiModelProperty(value = "年总发电量")
private String powerYear; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateYear;
@ApiModelProperty(value = "月总发电量") @ApiModelProperty(value = "月总发电量")
private String powerMonth; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateMon;
@ApiModelProperty(value = "日总发电量") @ApiModelProperty(value = "日总发电量")
private String powerDay; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDay;
@ApiModelProperty(value = "年计划发电量") @ApiModelProperty(value = "年计划发电量")
private String planPowerYear; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double plan;
@ApiModelProperty(value = "年完成发电量")
private String finishPowerYear;
@ApiModelProperty(value = "年计划完成率") @ApiModelProperty(value = "年计划完成率")
private String planCompletionRateYear; @JsonSerialize(nullsUsing = NullSerializer.class)
private Double planRate;
@ApiModelProperty(value = "年总装机容量")
private Double installedCapacityYear;
@ApiModelProperty(value = "年总有功功率")
private Double activePowerYear;
@ApiModelProperty(value = "容量利用率")
private String rateYear;
@ApiModelProperty(value = "近年发电量集合") @ApiModelProperty(value = "近年发电量集合")
private List<PowerYearVo> powerYearVoList; private List<PowerYearVo> powerYearVoList;
@ApiModelProperty(value = "今年计划发电趋势集合")
private List<PowerMonthVo> powerMonthVoList;
} }

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerStationVo.java

@ -1,6 +1,5 @@
package com.hnac.hzims.operational.main.vo; package com.hnac.hzims.operational.main.vo;
import com.hnac.hzims.hzimsweather.entity.DailyHeWeatherEntity;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,6 +8,9 @@ import lombok.Data;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author ysj
*/
@Data @Data
@ApiModel(value = "水利站点首页对象") @ApiModel(value = "水利站点首页对象")
public class HydropowerStationVo { public class HydropowerStationVo {

24
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java

@ -4,8 +4,11 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/**
* @author ysj
*/
@Data @Data
@ApiModel(value = "泵组实时数据对象") @ApiModel(value = "水电站实时数据对象")
public class HydropowerUnitRealVo { public class HydropowerUnitRealVo {
@ApiModelProperty(value = "机构Id") @ApiModelProperty(value = "机构Id")
@ -15,7 +18,7 @@ public class HydropowerUnitRealVo {
private String deptName; private String deptName;
@ApiModelProperty(value = "开关机状态: 0 - 关机 1 - 开机") @ApiModelProperty(value = "开关机状态: 0 - 关机 1 - 开机")
private String state; private Boolean state;
@ApiModelProperty(value = "设备Code") @ApiModelProperty(value = "设备Code")
private String deviceCode; private String deviceCode;
@ -23,26 +26,29 @@ public class HydropowerUnitRealVo {
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String deviceName; private String deviceName;
@ApiModelProperty(value = "总装机容量")
private Double installedCapacity;
@ApiModelProperty(value = "有功功率") @ApiModelProperty(value = "有功功率")
private String activePower; private Double activePower;
@ApiModelProperty(value = "无功功率") @ApiModelProperty(value = "无功功率")
private String reactivePower; private Double reactivePower;
@ApiModelProperty(value = "功率因数") @ApiModelProperty(value = "功率因数")
private String powerFactor; private Double powerFactor;
@ApiModelProperty(value = "机组频率") @ApiModelProperty(value = "机组频率")
private String frequency; private Double frequency;
@ApiModelProperty(value = "导叶开度") @ApiModelProperty(value = "导叶开度")
private String guideOpen; private Double guideOpen;
@ApiModelProperty(value = "定子电压") @ApiModelProperty(value = "定子电压")
private String statorVoltage; private Double statorVoltage;
@ApiModelProperty(value = "定子电流") @ApiModelProperty(value = "定子电流")
private String statorCurrent; private Double statorCurrent;
@ApiModelProperty(value = "有功功率单位") @ApiModelProperty(value = "有功功率单位")
private String powerUnit; private String powerUnit;

5
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitTargetVo.java

@ -7,8 +7,11 @@ import lombok.Data;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author ysj
*/
@Data @Data
@ApiModel(value = "泵组指标数据对象") @ApiModel(value = "水电站指标数据对象")
public class HydropowerUnitTargetVo { public class HydropowerUnitTargetVo {
@ApiModelProperty(value = "机构Id") @ApiModelProperty(value = "机构Id")

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitVo.java

@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/**
* @author ysj
*/
@Data @Data
@ApiModel(value = "水电站数据对象") @ApiModel(value = "水电站数据对象")
public class HydropowerUnitVo { public class HydropowerUnitVo {

50
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/OldAreaScaleVo.java

@ -0,0 +1,50 @@
package com.hnac.hzims.operational.main.vo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 集团/区域占比
*/
@Data
public class OldAreaScaleVo {
@ApiModelProperty(value = "机构ID")
private Long deptId;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "七日内天气")
private List<Daily> weather;
@ApiModelProperty(value = "站点实时温度")
private String temp;
@ApiModelProperty(value = "年计划发电量")
private float planPowerYear;
@ApiModelProperty(value = "年发电量")
private float powerYear;
@ApiModelProperty(value = "发电完成率")
private double generationPercentageComplete;
@ApiModelProperty(value = "区域/集团发电占比")
private double areaMakeUp;
@ApiModelProperty(value = "电站利用率")
private double stationUse;
@ApiModelProperty(value = "容量利用率")
private double capacityUse;
@ApiModelProperty(value = "发电量统计")
private double generationCount;
@ApiModelProperty(value = "排序")
private Integer sort;
}

57
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/OldHydropowerScoreVo.java

@ -0,0 +1,57 @@
package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "水电站分计对象")
public class OldHydropowerScoreVo {
@ApiModelProperty(value = "机构Id")
private Long departId;
@ApiModelProperty(value = "机构名称")
private String departName;
@ApiModelProperty(value = "站点数量")
private Integer stationCount;
@ApiModelProperty(value = "月总装机容量")
private Double installedCapacityMonth;
@ApiModelProperty(value = "总有功功率")
private Double activePowerMoth;
@ApiModelProperty(value = "年总发电量")
private String powerYear;
@ApiModelProperty(value = "月总发电量")
private String powerMonth;
@ApiModelProperty(value = "日总发电量")
private String powerDay;
@ApiModelProperty(value = "年计划发电量")
private String planPowerYear;
@ApiModelProperty(value = "年完成发电量")
private String finishPowerYear;
@ApiModelProperty(value = "年计划完成率")
private String planCompletionRateYear;
@ApiModelProperty(value = "年总装机容量")
private Double installedCapacityYear;
@ApiModelProperty(value = "年总有功功率")
private Double activePowerYear;
@ApiModelProperty(value = "容量利用率")
private String rateYear;
@ApiModelProperty(value = "近年发电量集合")
private List<PowerYearVo> powerYearVoList;
}

18
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/OldStationCountVo.java

@ -0,0 +1,18 @@
package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OldStationCountVo {
@ApiModelProperty(value = "站点类型")
private String stationType;
@ApiModelProperty(value = "站点类型名称")
private String stationTypeName;
@ApiModelProperty(value = "统计")
private int count;
}

4
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PowerMonthVo.java

@ -2,9 +2,11 @@ package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
/**
* @author ysj
*/
@Data @Data
@ApiModel(value = "月发电对象") @ApiModel(value = "月发电对象")
public class PowerMonthVo { public class PowerMonthVo {

10
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/StationCountVo.java

@ -3,14 +3,20 @@ package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/**
* @author ysj
*/
@Data @Data
public class StationCountVo { public class StationCountVo {
@ApiModelProperty(value = "站点类型") @ApiModelProperty(value = "站点类型")
private String stationType; private String type;
@ApiModelProperty(value = "服务类型")
private String serveType;
@ApiModelProperty(value = "站点类型名称") @ApiModelProperty(value = "站点类型名称")
private String stationTypeName; private String typeName;
@ApiModelProperty(value = "统计") @ApiModelProperty(value = "统计")
private int count; private int count;

43
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/TargetVo.java

@ -0,0 +1,43 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
*/
@Data
public class TargetVo {
public TargetVo(){
this.taget_one = 0.0;
this.taget_two = 0.0;
this.taget_three = 0.0;
this.taget_four = 0.0;
}
@ApiModelProperty(value = "指标类型")
private Integer type;
@ApiModelProperty(value = "指标名称")
private String typeName;
@ApiModelProperty(value = "指标1")
private Double taget_one;
@ApiModelProperty(value = "指标2")
private Double taget_two;
@ApiModelProperty(value = "指标3")
private Double taget_three;
@ApiModelProperty(value = "指标4")
private Double taget_four;
@ApiModelProperty(value = "指标5:充电庄数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer charge;
}

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/feign/PlanGenertionClient.java

@ -103,7 +103,7 @@ public class PlanGenertionClient implements IPlanGenertionClient{
*/ */
@GetMapping(GET_POWER_YEAR) @GetMapping(GET_POWER_YEAR)
@Override @Override
public String getPlanPowerYear(List<String> stationIds, String date) { public Double getPlanPowerYear(List<String> stationIds, String date) {
return service.getPlanPowerYear(stationIds,date); return service.getPlanPowerYear(stationIds,date);
} }

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/PlanGenerationMapper.java

@ -34,7 +34,7 @@ public interface PlanGenerationMapper extends UserDataScopeBaseMapper<PlanGenera
* @param date * @param date
* @return * @return
*/ */
String getPlanPowerYear(@Param("stationIdList") List<String> stationIdList,@Param("date") String date); Double getPlanPowerYear(@Param("stationIdList") List<String> stationIdList,@Param("date") String date);
/** /**
* 计划发电量查询 * 计划发电量查询

4
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/mapper/PlanGenerationMapper.xml

@ -75,8 +75,8 @@
</if> </if>
</select> </select>
<select id="getPlanPowerYear" resultType="java.lang.String"> <select id="getPlanPowerYear" resultType="java.lang.Double">
select CONCAT(IFNULL(sum(PLAN_GENERATION),0),'|',IFNULL(sum(PRACTICAL_GENERATION),0)) from hz_ims_plan_generation select IFNULL(sum(PLAN_GENERATION),0) from hz_ims_plan_generation
where IS_DELETED = 0 where IS_DELETED = 0
<if test="stationIdList != null"> <if test="stationIdList != null">
and STATION_ID in and STATION_ID in

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/IPlanGenerationService.java

@ -47,7 +47,7 @@ public interface IPlanGenerationService extends BaseService<PlanGenerationEntity
* @param date * @param date
* @return * @return
*/ */
String getPlanPowerYear(List<String> stationIds, String date); Double getPlanPowerYear(List<String> stationIds, String date);
/** /**
* 计划发电量查询 * 计划发电量查询

10
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/PlanGenerationServiceImpl.java

@ -311,15 +311,11 @@ public class PlanGenerationServiceImpl extends BaseServiceImpl<PlanGenerationMap
* @return * @return
*/ */
@Override @Override
public String getPlanPowerYear(List<String> stationIdList, String date) { public Double getPlanPowerYear(List<String> stationIdList, String date) {
if(CollectionUtil.isEmpty(stationIdList) || StringUtils.isEmpty(date)){ if(CollectionUtil.isEmpty(stationIdList) || StringUtils.isEmpty(date)){
return "0|0"; return 0.0;
} }
String concat = this.baseMapper.getPlanPowerYear(stationIdList,date); return this.baseMapper.getPlanPowerYear(stationIdList,date);
if(StringUtils.isEmpty(concat)){
return "0|0";
}
return concat;
} }
/** /**

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/OperationApplication.java

@ -22,9 +22,7 @@ import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -40,13 +38,6 @@ import javax.annotation.Resource;
@Resource @Resource
public class OperationApplication extends SpringBootServletInitializer { public class OperationApplication extends SpringBootServletInitializer {
static{
System.setProperty("spring.cloud.nacos.discovery.server-addr", "http://175.6.40.67:10042");
System.setProperty("spring.cloud.nacos.config.server-addr", "http://175.6.40.67:10042");
System.setProperty("spring.cloud.nacos.username", "nacos");
System.setProperty("spring.cloud.nacos.password", "nacos");
}
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(OperationalConstants.APP_NAME, OperationApplication.class, args); BladeApplication.run(OperationalConstants.APP_NAME, OperationApplication.class, args);
} }

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/controller/LevelAlarmController.java

@ -3,7 +3,6 @@ package com.hnac.hzims.operational.alert.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity; import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import com.hnac.hzims.operational.alert.service.HistoryLevelAlarmService; import com.hnac.hzims.operational.alert.service.HistoryLevelAlarmService;
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo; import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo;
@ -13,13 +12,11 @@ import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog; import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List; import java.util.List;
/** /**

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/HistoryAbnormalAlarmService.java

@ -15,6 +15,7 @@ import java.util.List;
/** /**
* 告警处理接口 * 告警处理接口
* @author ysj
*/ */
public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormalAlarmEntity> { public interface HistoryAbnormalAlarmService extends BaseService<HistoryAbnormalAlarmEntity> {

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AlertMerageServiceImpl.java

@ -86,7 +86,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService {
List<AlarmMergeVo> alarms = new ArrayList<>(); List<AlarmMergeVo> alarms = new ArrayList<>();
if(CollectionUtil.isNotEmpty(faults)){ if(CollectionUtil.isNotEmpty(faults)){
alarms.addAll(faults.stream().filter(o -> CollectionUtil.isEmpty(handles) alarms.addAll(faults.stream().filter(o -> CollectionUtil.isEmpty(handles)
|| handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(o.getAlarmId())). || !handles.stream().map(AlarmHandleEntity::getAlarmId).collect(Collectors.toList()).contains(o.getAlarmId())).
map(fault->{ map(fault->{
AlarmMergeVo alarm = new AlarmMergeVo(); AlarmMergeVo alarm = new AlarmMergeVo();
alarm.setStationCode(fault.getStationId()); alarm.setStationCode(fault.getStationId());
@ -94,7 +94,7 @@ public class AlertMerageServiceImpl implements AlarmMergeService {
alarm.setContent(fault.getSoeExplain()); alarm.setContent(fault.getSoeExplain());
alarm.setDate(fault.getStartTime()); alarm.setDate(fault.getStartTime());
alarm.setRealId(fault.getRealId()); alarm.setRealId(fault.getRealId());
alarm.setAlarmCode(fault.getAlarmId()); alarm.setAlarmCode(String.valueOf(fault.getAlarmId()));
alarm.setType(AbnormalAlarmConstant.WEBSOCKET_FAULT); alarm.setType(AbnormalAlarmConstant.WEBSOCKET_FAULT);
return alarm; return alarm;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -1110,7 +1110,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
eq(DutyGroupGeneratingCapacityEntity::getEndTime, dutyMainInfoVo.getEndTime()); eq(DutyGroupGeneratingCapacityEntity::getEndTime, dutyMainInfoVo.getEndTime());
eq(DutyGroupGeneratingCapacityEntity::getDutyDept, dutyMainInfoVo.getCreateDept()); eq(DutyGroupGeneratingCapacityEntity::getDutyDept, dutyMainInfoVo.getCreateDept());
eq(DutyGroupGeneratingCapacityEntity::getDateTime, DateUtil.format(dutyMainInfoVo.getDutyDate(), DateUtil.PATTERN_DATE)); eq(DutyGroupGeneratingCapacityEntity::getDateTime, DateUtil.format(dutyMainInfoVo.getDutyDate(), DateUtil.PATTERN_DATE));
eq(DutyGroupGeneratingCapacityEntity::getGroupId, dutyMainInfoVo.getDutyGroupId()); //eq(DutyGroupGeneratingCapacityEntity::getGroupId, dutyMainInfoVo.getDutyGroupId());
}}); }});
if (CollectionUtil.isNotEmpty(generatingCapacityList)) { if (CollectionUtil.isNotEmpty(generatingCapacityList)) {
double generatingCapacity = generatingCapacityList.stream().mapToDouble(DutyGroupGeneratingCapacityEntity::getGeneratingCapacity).sum(); double generatingCapacity = generatingCapacityList.stream().mapToDouble(DutyGroupGeneratingCapacityEntity::getGeneratingCapacity).sum();
@ -1310,7 +1310,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I
List<String> personIdlist = new ArrayList<>(Arrays.asList(dutyMainPersonIds)); List<String> personIdlist = new ArrayList<>(Arrays.asList(dutyMainPersonIds));
if (1 == changeDutyMainVo.getType()) { if (1 == changeDutyMainVo.getType()) {
personIdlist.addAll(personId); personIdlist.addAll(personId);
} else {
personIdlist.removeAll(personId); personIdlist.removeAll(personId);
} }
String resIds = StringUtils.join(personIdlist, "^"); String resIds = StringUtils.join(personIdlist, "^");

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

@ -54,11 +54,8 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
if(!StringUtil.isEmpty(filter.getStationCode())){ if(!StringUtil.isEmpty(filter.getStationCode())){
eq("STATION_CODE",filter.getStationCode()); eq("STATION_CODE",filter.getStationCode());
} }
if(!ObjectUtil.isEmpty(filter.getStartTime())){ if(!ObjectUtil.isEmpty(filter.getDate())){
ge("FILL_DATE",filter.getStartTime()); likeRight("FILL_DATE",filter.getDate());
}
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
} }
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){ if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin()); eq("DATA_ORIGIN",filter.getDataOrigin());

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

@ -48,11 +48,8 @@ public class RainFallServiceImpl extends BaseServiceImpl<RainfallMapper, Rainfal
if(!StringUtil.isEmpty(filter.getStationCode())){ if(!StringUtil.isEmpty(filter.getStationCode())){
eq("STATION_CODE",filter.getStationCode()); eq("STATION_CODE",filter.getStationCode());
} }
if(!ObjectUtil.isEmpty(filter.getStartTime())){ if(!ObjectUtil.isEmpty(filter.getDate())){
ge("FILL_DATE",filter.getStartTime()); likeRight("FILL_DATE",filter.getDate());
}
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
} }
orderByDesc("create_time"); orderByDesc("create_time");
}}; }};

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

@ -48,11 +48,8 @@ public class StorageServiceImpl extends BaseServiceImpl<StorageMapper, StorageEn
if(!StringUtil.isEmpty(filter.getStationCode())){ if(!StringUtil.isEmpty(filter.getStationCode())){
eq("STATION_CODE",filter.getStationCode()); eq("STATION_CODE",filter.getStationCode());
} }
if(!ObjectUtil.isEmpty(filter.getStartTime())){ if(!ObjectUtil.isEmpty(filter.getDate())){
ge("FILL_DATE",filter.getStartTime()); likeRight("FILL_DATE",filter.getDate());
}
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
} }
orderByDesc("create_time"); orderByDesc("create_time");
}}; }};

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

@ -52,11 +52,8 @@ public class UseServiceImpl extends BaseServiceImpl<UseMapper, UseEntity> implem
if(!StringUtil.isEmpty(filter.getStationCode())){ if(!StringUtil.isEmpty(filter.getStationCode())){
eq("STATION_CODE",filter.getStationCode()); eq("STATION_CODE",filter.getStationCode());
} }
if(!ObjectUtil.isEmpty(filter.getStartTime())){ if(!ObjectUtil.isEmpty(filter.getDate())){
ge("FILL_DATE",filter.getStartTime()); likeRight("FILL_DATE",filter.getDate());
}
if(!ObjectUtil.isEmpty(filter.getEndTime())){
le("FILL_DATE",filter.getEndTime());
} }
if(!ObjectUtil.isEmpty(filter.getDataOrigin())){ if(!ObjectUtil.isEmpty(filter.getDataOrigin())){
eq("DATA_ORIGIN",filter.getDataOrigin()); eq("DATA_ORIGIN",filter.getDataOrigin());

47
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomeController.java

@ -0,0 +1,47 @@
package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.HomeService;
import com.hnac.hzims.operational.main.vo.StationCountVo;
import com.hnac.hzims.operational.main.vo.TargetVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.annotation.ApiLog;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author ysj
*/
@RestController
@RequestMapping("/home")
@Api(value = "app首页", tags = "app-首页")
@AllArgsConstructor
public class HomeController extends BladeController {
private final HomeService service;
@ApiLog
@ApiOperation("首页站点数量")
@GetMapping("/count")
@ApiOperationSupport(order = 1)
public R<List<StationCountVo>> count() {
return R.data(service.count());
}
@ApiLog
@ApiOperation("首页关键指标")
@GetMapping("/target")
@ApiOperationSupport(order = 2)
public R<TargetVo> target(@ApiParam(value = "指标类型",required = true) Integer type) {
return R.data(service.target(type));
}
}

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HomePageController.java

@ -37,8 +37,8 @@ public class HomePageController extends BladeController {
@ApiOperation("服务厂站统计") @ApiOperation("服务厂站统计")
@GetMapping("/stationCensus") @GetMapping("/stationCensus")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R<List<StationCountVo>> stationCount(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType, Long deptId) { public R<List<OldStationCountVo>> stationCount(@ApiParam(value = "站点服务类型:1、云服务站点; 2、代运维服务站点", required = true) Integer serveType, Long deptId) {
List<StationCountVo> stationList = homePageService.getStationCount(deptId,serveType); List<OldStationCountVo> stationList = homePageService.getStationCount(deptId,serveType);
return R.data(stationList); return R.data(stationList);
} }
@ -73,8 +73,8 @@ public class HomePageController extends BladeController {
@ApiOperation("水电站数据获取") @ApiOperation("水电站数据获取")
@GetMapping("/getHydropowerData") @GetMapping("/getHydropowerData")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
public R<List<HydropowerScoreVo>> getHydropowerData(@ApiParam(value = "区域id", required = true) Long deptId) { public R<List<OldHydropowerScoreVo>> getHydropowerData(@ApiParam(value = "区域id", required = true) Long deptId) {
List<HydropowerScoreVo> hydropowerScoreVoList = homePageService.getHydropowerData(deptId); List<OldHydropowerScoreVo> hydropowerScoreVoList = homePageService.getHydropowerData(deptId);
return R.data(hydropowerScoreVoList); return R.data(hydropowerScoreVoList);
} }

28
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/HydropowerController.java

@ -2,6 +2,8 @@ package com.hnac.hzims.operational.main.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.main.service.HydropowerService; import com.hnac.hzims.operational.main.service.HydropowerService;
import com.hnac.hzims.operational.main.vo.AreaScaleVo;
import com.hnac.hzims.operational.main.vo.HydropowerScoreVo;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo; import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -21,7 +23,7 @@ import java.util.List;
* @author ysj * @author ysj
*/ */
@RestController @RestController
@RequestMapping("/webHome") @RequestMapping("/hydropower")
@Api(value = "app首页", tags = "app-首页") @Api(value = "app首页", tags = "app-首页")
@AllArgsConstructor @AllArgsConstructor
public class HydropowerController extends BladeController { public class HydropowerController extends BladeController {
@ -30,21 +32,28 @@ public class HydropowerController extends BladeController {
@ApiLog @ApiLog
@ApiOperation("水电站区域指标") @ApiOperation("水电站集团/区域指标")
@GetMapping("/area/target") @GetMapping("/KPIs")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R<HydropowerStationVo> area_target(@ApiParam(value = "站点机构ID") Long deptId) { public R<HydropowerScoreVo> KPIs(@ApiParam(value = "站点机构ID") Long deptId) {
HydropowerStationVo response = service.area_target(deptId); return R.data(service.KPIs(deptId));
return R.data(response);
} }
@ApiLog @ApiLog
@ApiOperation("水电站集团/区域占比")
@GetMapping("/proportion")
@ApiOperationSupport(order = 1)
public R<List<AreaScaleVo>> proportion(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.proportion(deptId));
}
@ApiLog
@ApiOperation("水电站站点指标") @ApiOperation("水电站站点指标")
@GetMapping("/station") @GetMapping("/station")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
public R<HydropowerStationVo> hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) { public R<HydropowerStationVo> hydropowerStation(@ApiParam(value = "站点机构ID") Long deptId) {
HydropowerStationVo response = service.station(deptId); return R.data(service.station(deptId));
return R.data(response);
} }
@ApiLog @ApiLog
@ -52,8 +61,7 @@ public class HydropowerController extends BladeController {
@GetMapping("/getPumpList") @GetMapping("/getPumpList")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
public R<List<HydropowerUnitVo>> hydropowerDevice(@ApiParam(value = "站点机构ID") Long deptId) { public R<List<HydropowerUnitVo>> hydropowerDevice(@ApiParam(value = "站点机构ID") Long deptId) {
List<HydropowerUnitVo> list = service.hydropowerDevice(deptId); return R.data(service.hydropowerDevice(deptId));
return R.data(list);
} }
@ApiLog @ApiLog

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/SideHustleController.java

@ -61,7 +61,7 @@ public class SideHustleController extends BladeController {
@OperationAnnotation(moduleName = "演示大屏",title = "演示大屏", operatorType = OperatorType.MOBILE, @OperationAnnotation(moduleName = "演示大屏",title = "演示大屏", operatorType = OperatorType.MOBILE,
businessType = BusinessType.GENCODE,action = "区域占比") businessType = BusinessType.GENCODE,action = "区域占比")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
public R<List<AreaScaleVo>> areaScale(@ApiParam(value = "区域机构ID") Long deptId) { public R<List<OldAreaScaleVo>> areaScale(@ApiParam(value = "区域机构ID") Long deptId) {
return R.data(regionService.areaScale(deptId)); return R.data(regionService.areaScale(deptId));
} }
@ApiLog @ApiLog

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

@ -36,12 +36,8 @@ public class ScheduledCreateTask {
@Autowired @Autowired
private IUnitRunningTimeService unitRunningTimeService; private IUnitRunningTimeService unitRunningTimeService;
@Autowired @Autowired
private IHomePageService homePageService;
@Autowired
private IWaterService waterService; private IWaterService waterService;
@Autowired @Autowired
private ISideHustleService sideHustleService;
@Autowired
private IAreaMonthReportService reportService; private IAreaMonthReportService reportService;
@Autowired @Autowired
private HydropowerService hydropowerService; private HydropowerService hydropowerService;
@ -151,19 +147,6 @@ public class ScheduledCreateTask {
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
/**
* 首页 - 关键指标数据获取
* @return ReturnT<String>
*/
@XxlJob(CRUCIAL_TARGET_PRELOADING)
public ReturnT<String> loadHydropower(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
homePageService.loadHydropower(param,SERVE_TYPE);
return new ReturnT<>("SUCCESS");
}
/** /**
* 获取站点近3年发电量数据 * 获取站点近3年发电量数据
@ -175,7 +158,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
} }
homePageService.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),SERVE_TYPE,3); hydropowerService.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),SERVE_TYPE,3);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -189,7 +172,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
} }
sideHustleService.loadDutyInfo(param); //sideHustleService.loadDutyInfo(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -203,7 +186,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"); param = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
} }
sideHustleService.deviceClassify(param); //sideHustleService.deviceClassify(param);
return new ReturnT<>("SUCCESS"); return new ReturnT<>("SUCCESS");
} }
@ -254,7 +237,7 @@ public class ScheduledCreateTask {
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(LOAD_WATER_LEVEL) @XxlJob(LOAD_WATER_LEVEL)
//@Scheduled(cron = "0/10 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadWaterLevel(String param) throws Exception { public ReturnT<String> loadWaterLevel(String param) throws Exception {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
@ -268,7 +251,7 @@ public class ScheduledCreateTask {
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(LOAD_HYDROPOWER_UNIT_REAL) @XxlJob(LOAD_HYDROPOWER_UNIT_REAL)
//@Scheduled(cron = "0/10 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerUnitReal(String param) throws Exception { public ReturnT<String> loadHydropowerUnitReal(String param) throws Exception {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
@ -282,7 +265,7 @@ public class ScheduledCreateTask {
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(LOAD_HYDROPOWER_UNIT_TARGET) @XxlJob(LOAD_HYDROPOWER_UNIT_TARGET)
//@Scheduled(cron = "0/10 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadHydropowerUnitTarget(String param) throws Exception { public ReturnT<String> loadHydropowerUnitTarget(String param) throws Exception {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");
@ -296,7 +279,7 @@ public class ScheduledCreateTask {
* @return ReturnT<String> * @return ReturnT<String>
*/ */
@XxlJob(LOAD_PHOTOVOLTAIC_REAL) @XxlJob(LOAD_PHOTOVOLTAIC_REAL)
//@Scheduled(cron = "0/50 * * * * ? ") //@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadPhotovoltaicReal(String param) throws Exception { public ReturnT<String> loadPhotovoltaicReal(String param) throws Exception {
if (Func.isBlank(param)) { if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM"); param = DateUtil.format(new Date(), "yyyy-MM");

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/AreaService.java

@ -13,4 +13,7 @@ public interface AreaService {
// 获取权限区域 // 获取权限区域
Map<Dept, List<StationEntity>> getAuthArea(List<Dept> list,Long deptId,List<Integer> typeList,Integer serveType); Map<Dept, List<StationEntity>> getAuthArea(List<Dept> list,Long deptId,List<Integer> typeList,Integer serveType);
// 获取用户权限区域
Map<Dept, List<StationEntity>> areaOrStaion(Long deptId, List<Integer> types);
} }

17
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HomeService.java

@ -0,0 +1,17 @@
package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.vo.StationCountVo;
import com.hnac.hzims.operational.main.vo.TargetVo;
import java.util.List;
/**
* 首页接口
* @author ysj
*/
public interface HomeService {
List<StationCountVo> count();
TargetVo target(Integer type);
}

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/HydropowerService.java

@ -1,5 +1,7 @@
package com.hnac.hzims.operational.main.service; package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.vo.AreaScaleVo;
import com.hnac.hzims.operational.main.vo.HydropowerScoreVo;
import com.hnac.hzims.operational.main.vo.HydropowerStationVo; import com.hnac.hzims.operational.main.vo.HydropowerStationVo;
import com.hnac.hzims.operational.main.vo.HydropowerUnitVo; import com.hnac.hzims.operational.main.vo.HydropowerUnitVo;
@ -15,11 +17,15 @@ public interface HydropowerService {
void loadHydropowerTarget(String param); void loadHydropowerTarget(String param);
HydropowerStationVo station(Long deptId); void loadPowerData(String param, List<Integer> types, Integer serveType, int year);
HydropowerStationVo station(Long deptId);
List<HydropowerUnitVo> hydropowerDevice(Long deptId); List<HydropowerUnitVo> hydropowerDevice(Long deptId);
List<HydropowerStationVo> webStationList(Long deptId); List<HydropowerStationVo> webStationList(Long deptId);
HydropowerStationVo area_target(Long deptId); HydropowerScoreVo KPIs(Long deptId);
List<AreaScaleVo> proportion(Long deptId);
} }

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

@ -1,8 +1,6 @@
package com.hnac.hzims.operational.main.service; package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.entity.StationEntity;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
@ -19,7 +17,7 @@ public interface IHomePageService {
List<String> getMonthList(int year, int endMoth,boolean nextMon); List<String> getMonthList(int year, int endMoth,boolean nextMon);
List<StationCountVo> getStationCount(Long deptId, Integer serveType); List<OldStationCountVo> getStationCount(Long deptId, Integer serveType);
List<PowerTargetVo> powerTarget(Integer serveType,Long deptId); List<PowerTargetVo> powerTarget(Integer serveType,Long deptId);
@ -32,7 +30,7 @@ public interface IHomePageService {
R<Map<Long,List<AreaGenerationMakeUpVo>>> areaGenerationMakeUp(Long deptId,Integer stationType,Integer serveType); R<Map<Long,List<AreaGenerationMakeUpVo>>> areaGenerationMakeUp(Long deptId,Integer stationType,Integer serveType);
List<HydropowerScoreVo> getHydropowerData(Long deptId); List<OldHydropowerScoreVo> getHydropowerData(Long deptId);
R<Map<Long,List<HomePageCountVo>>> getCount(Long deptId,Integer stationType,Integer serveType); R<Map<Long,List<HomePageCountVo>>> getCount(Long deptId,Integer stationType,Integer serveType);

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java

@ -24,7 +24,7 @@ public interface ISideHustleService {
List<AreaPowerScaleVo> areaPowerScale(Long deptId); List<AreaPowerScaleVo> areaPowerScale(Long deptId);
List<AreaScaleVo> areaScale(Long deptId); List<OldAreaScaleVo> areaScale(Long deptId);
List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types); List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types);

26
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java

@ -17,12 +17,12 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IAppHomeService; import com.hnac.hzims.operational.main.service.IAppHomeService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.ISideHustleService;
import com.hnac.hzims.operational.main.service.IWeatherService; import com.hnac.hzims.operational.main.service.IWeatherService;
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.maintenance.constants.MaintenanceConstant; import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity; import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService; import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
@ -65,20 +65,20 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AppHomeServiceImpl implements IAppHomeService { public class AppHomeServiceImpl implements IAppHomeService {
private final IMainSystemMonitoringService mainService; private final AreaService areaService;
private final IImsDutyMainService dutyMainService;
private final ISideHustleService sideHustleService;
private final IStationService stationService; private final IStationService stationService;
private final IStationAttributeService attributeService; private final IImsDutyMainService dutyMainService;
private final IOperPhenomenonService phenomenonService; private final IOperPhenomenonService phenomenonService;
private final IOperAccessTaskService accessTaskService; private final IOperAccessTaskService accessTaskService;
private final IMainSystemMonitoringService mainService;
private final IStationAttributeService attributeService;
private final IOperMaintenanceTaskService maintenanceTaskService; private final IOperMaintenanceTaskService maintenanceTaskService;
private final IInspectTaskReportClient inspectTaskReportClient; private final IInspectTaskReportClient inspectTaskReportClient;
@ -350,12 +350,12 @@ public class AppHomeServiceImpl implements IAppHomeService {
@Override @Override
public List<AppAreaStationVo> appStationList(Long deptId) { public List<AppAreaStationVo> appStationList(Long deptId) {
// 获取区域或者站点map结构 // 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = sideHustleService.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
if(MapUtils.isEmpty(map)){ if(MapUtils.isEmpty(map)){
return null; return null;
} }
// 获取站点计划发电量集合 // 获取站点计划发电量集合
List<PlanGenerationEntity> planPowerList = sideHustleService.getStaionPlanPower(map); //List<PlanGenerationEntity> planPowerList = sideHustleService.getStaionPlanPower(map);
// 获取设备指标数据列表 // 获取设备指标数据列表
List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_UNIT_TARGET_KEY); List<HydropowerUnitTargetVo> targetList = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(LOAD_HYDROPOWER_UNIT_TARGET_KEY);
// 获取设备实时数据 // 获取设备实时数据
@ -370,10 +370,10 @@ public class AppHomeServiceImpl implements IAppHomeService {
response.setDeptId(item.getRefDept()); response.setDeptId(item.getRefDept());
response.setDeptName(item.getName()); response.setDeptName(item.getName());
// 站点年计划发电量 // 站点年计划发电量
float planPowerYear = this.getPlanPowerYear(planPowerList,item.getCode()); //float planPowerYear = this.getPlanPowerYear(planPowerList,item.getCode());
response.setPlanPowerYear(planPowerYear); response.setPlanPowerYear(0f);
// 站点发电完成率 // 站点发电完成率
double powerRate = this.getPowerRate(targetList,item.getCreateDept(),planPowerYear); double powerRate = this.getPowerRate(targetList,item.getCreateDept(),0f);
response.setPowerRate(powerRate); response.setPowerRate(powerRate);
// 设备总数 // 设备总数
int deviceSum = this.getDeviceSum(realList,item.getCreateDept(),false); int deviceSum = this.getDeviceSum(realList,item.getCreateDept(),false);

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java

@ -5,12 +5,12 @@ import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.message.dto.MailPushDto; import com.hnac.hzims.message.dto.MailPushDto;
import com.hnac.hzims.message.fegin.IPushMsgClient; import com.hnac.hzims.message.fegin.IPushMsgClient;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.IAreaMonthReportService; import com.hnac.hzims.operational.main.service.IAreaMonthReportService;
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService; import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
import com.hnac.hzims.operational.main.vo.AreaMonthReportVo; import com.hnac.hzims.operational.main.vo.AreaMonthReportVo;
import com.hnac.hzims.operational.main.vo.MaintainVo; import com.hnac.hzims.operational.main.vo.MaintainVo;
import com.hnac.hzims.operational.main.vo.OverhaulVo; import com.hnac.hzims.operational.main.vo.OverhaulVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.report.vo.DutyDefectVO; import com.hnac.hzims.operational.report.vo.DutyDefectVO;
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;
@ -51,7 +51,8 @@ import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.*; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
@ -532,7 +533,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 操作票、操作票合格率/ 工作票、工作票合格率 // 操作票、操作票合格率/ 工作票、工作票合格率
this.doubleMonth(area, areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon)); this.doubleMonth(area, areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon));
// 日常维护、巡检任务、缺陷数、消缺率、检修任务 // 日常维护、巡检任务、缺陷数、消缺率、检修任务
this.taskMonth(areaStationList, areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon)); this.taskMonth(Collections.singletonList(area.getId()), areaMonthReport, mon + "-01 00:00:00", getStrEndTime(mon));
// 预测 // 预测
this.getPredictPlanPower(oldActualMap,oldOldActualMap,areaStationList,areaMonthReport); this.getPredictPlanPower(oldActualMap,oldOldActualMap,areaStationList,areaMonthReport);
// 安全生产会议次数、月度检查报告、技能培训、安全大检查 // 安全生产会议次数、月度检查报告、技能培训、安全大检查
@ -785,18 +786,17 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
/** /**
* 任务月报-日常维护巡检任务缺陷数消缺率检修任务 * 任务月报-日常维护巡检任务缺陷数消缺率检修任务
* *
* @param areaStationList * @param areas
* @param areaMonthReport * @param areaMonthReport
*/ */
private void taskMonth(List<StationEntity> areaStationList, AreaMonthReportVo areaMonthReport, String startTime, String endTime) { private void taskMonth(List<Long> areas, AreaMonthReportVo areaMonthReport, String startTime, String endTime) {
List<Long> list = areaStationList.stream().map(StationEntity::getRefDept).collect(Collectors.toList());
//通过线程池异步获取月报各模块内容 主要分为五块内容 //通过线程池异步获取月报各模块内容 主要分为五块内容
ExecutorService exe = Executors.newFixedThreadPool(POOL_QUANTITY); ExecutorService exe = Executors.newFixedThreadPool(POOL_QUANTITY);
//监控线程执行完后返回结果 //监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY); CountDownLatch countDownLatch = new CountDownLatch(POOL_QUANTITY);
// 日常维护 // 日常维护
exe.execute(() -> { exe.execute(() -> {
MaintainVo maintainVo = mainTaskStatisticService.getMaintain(startTime, endTime, list); MaintainVo maintainVo = mainTaskStatisticService.getMaintain(startTime, endTime, areas);
int maintainSum = maintainVo.getMaintain(); int maintainSum = maintainVo.getMaintain();
areaMonthReport.setRoutineMaintenance(maintainSum); areaMonthReport.setRoutineMaintenance(maintainSum);
countDownLatch.countDown(); countDownLatch.countDown();
@ -807,7 +807,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("startDate", startTime); map.put("startDate", startTime);
map.put("endDate", endTime); map.put("endDate", endTime);
map.put("deptList", list); map.put("deptList", areas);
R<DutyInspectTaskVO> R = inspectTaskReportClient.getDutyInspectTask(map); R<DutyInspectTaskVO> R = inspectTaskReportClient.getDutyInspectTask(map);
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
areaMonthReport.setInspect(0); areaMonthReport.setInspect(0);
@ -820,7 +820,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 消缺 // 消缺
exe.execute(() -> { exe.execute(() -> {
DutyDefectVO defectVO = operPhenomenonService.getDutyDefect(startTime, endTime, list); DutyDefectVO defectVO = operPhenomenonService.getDutyDefect(startTime, endTime, areas);
int defectSum = defectVO.getDefectSum(); int defectSum = defectVO.getDefectSum();
int defect = defectVO.getDefect(); int defect = defectVO.getDefect();
areaMonthReport.setDefect(defectSum); areaMonthReport.setDefect(defectSum);
@ -835,7 +835,7 @@ public class AreaMonthReportServiceImpl implements IAreaMonthReportService {
// 检修 // 检修
exe.execute(() -> { exe.execute(() -> {
OverhaulVo overhaulVo = mainTaskStatisticService.getOverhaul(startTime, endTime, list); OverhaulVo overhaulVo = mainTaskStatisticService.getOverhaul(startTime, endTime, areas);
int overhaul = overhaulVo.getOverhaul(); int overhaul = overhaulVo.getOverhaul();
areaMonthReport.setMaintenanceTasks(overhaul); areaMonthReport.setMaintenanceTasks(overhaul);
countDownLatch.countDown(); countDownLatch.countDown();

43
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaServiceImpl.java

@ -7,10 +7,12 @@ import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -81,4 +83,45 @@ public class AreaServiceImpl implements AreaService {
} }
return result; return result;
} }
/**
* 获取区域或者站点map结构
* @param deptId
* @return
*/
@Override
public Map<Dept, List<StationEntity>> areaOrStaion(Long deptId,List<Integer> types) {
//根据用户权限获取机构
R<List<Dept>> R = sysClient.getDeptByCurrentUser();
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) {
return null;
}
if(ObjectUtil.isNotEmpty(deptId)){
List<Dept> list = R.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
return null;
}
Dept dept = list.get(0);
// 机构为站点 key-站点机构 value-站点
if(HomePageConstant.AREA.equals(dept.getDeptCategory())){
List<StationEntity> stationList = stationService.getStationList(R.getData(),dept.getId(),types,HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
Map<Dept, List<StationEntity>> map = new HashMap<>();
stationList.forEach(item->{
List<Dept> stationDeptList = R.getData().stream().filter(o->o.getId().equals(item.getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stationDeptList)){
return;
}
// 站点机构
Dept station = stationDeptList.get(0);
map.put(station, Collections.singletonList(item));
});
return map;
}
}
return this.getAuthArea(R.getData(),deptId,types,HomePageConstant.HYDROPOWER_SERVETYPE);
}
} }

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

@ -341,7 +341,7 @@ public class HomePageServiceImpl implements IHomePageService {
* @return * @return
*/ */
@Override @Override
public List<StationCountVo> getStationCount(Long deptId, Integer serveType) { public List<OldStationCountVo> getStationCount(Long deptId, Integer serveType) {
//根据用户权限获取机构 //根据用户权限获取机构
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); R<List<Dept>> R = sysClient.getDeptByCurrentUser();
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) { if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
@ -352,12 +352,12 @@ public class HomePageServiceImpl implements IHomePageService {
HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE); HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE);
// 查询站点 // 查询站点
List<StationEntity> stationEntityList = stationService.getStationList(R.getData(),deptId,storage,serveType); List<StationEntity> stationEntityList = stationService.getStationList(R.getData(),deptId,storage,serveType);
List<StationCountVo> list = new ArrayList<>(); List<OldStationCountVo> list = new ArrayList<>();
storage.forEach(item->{ storage.forEach(item->{
if(HomePageConstant.PUMPING.equals(item) || HomePageConstant.GATE.equals(item)){ if(HomePageConstant.PUMPING.equals(item) || HomePageConstant.GATE.equals(item)){
return; return;
} }
StationCountVo stationCountVo = new StationCountVo(); OldStationCountVo stationCountVo = new OldStationCountVo();
stationCountVo.setStationType(item.toString()); stationCountVo.setStationType(item.toString());
stationCountVo.setStationTypeName(DictCache.getValue("stationType", item)); stationCountVo.setStationTypeName(DictCache.getValue("stationType", item));
stationCountVo.setCount(0); stationCountVo.setCount(0);
@ -1507,8 +1507,8 @@ public class HomePageServiceImpl implements IHomePageService {
* @return * @return
*/ */
@Override @Override
public List<HydropowerScoreVo> getHydropowerData(Long deptId) { public List<OldHydropowerScoreVo> getHydropowerData(Long deptId) {
List<HydropowerScoreVo> hydropowerScoreVoList = new ArrayList<>(); List<OldHydropowerScoreVo> hydropowerScoreVoList = new ArrayList<>();
// 站点数据(水电站、风电站、光伏站) // 站点数据(水电站、风电站、光伏站)
KeyIndicatorsVo keyIndicatorsVo = (KeyIndicatorsVo) redisTemplate.opsForValue().get(KEY_INDICATORS_INFO); KeyIndicatorsVo keyIndicatorsVo = (KeyIndicatorsVo) redisTemplate.opsForValue().get(KEY_INDICATORS_INFO);
// 水电站 // 水电站
@ -1523,7 +1523,7 @@ public class HomePageServiceImpl implements IHomePageService {
return null; return null;
} }
deptMap.forEach((key, value) -> { deptMap.forEach((key, value) -> {
HydropowerScoreVo hydropowerScoreVo = new HydropowerScoreVo(); OldHydropowerScoreVo hydropowerScoreVo = new OldHydropowerScoreVo();
hydropowerScoreVo.setDepartId(key); hydropowerScoreVo.setDepartId(key);
// 站点查询 // 站点查询
List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), value); List<StationEntity> stationList = stationService.getStationType(HomePageConstant.HYDROPOWER_SERVETYPE, Collections.singletonList(HomePageConstant.HYDROPOWER), value);
@ -1869,7 +1869,7 @@ public class HomePageServiceImpl implements IHomePageService {
* @param powerStationTotalVoList * @param powerStationTotalVoList
* @return * @return
*/ */
private void stationSumData(List<Long> stationIdList, List<PowerStationTotalVo> powerStationTotalVoList, HydropowerScoreVo hydropowerScoreVo) { private void stationSumData(List<Long> stationIdList, List<PowerStationTotalVo> powerStationTotalVoList, OldHydropowerScoreVo hydropowerScoreVo) {
if (CollectionUtil.isEmpty(powerStationTotalVoList)) { if (CollectionUtil.isEmpty(powerStationTotalVoList)) {
hydropowerScoreVo.setInstalledCapacityMonth(0.0); hydropowerScoreVo.setInstalledCapacityMonth(0.0);
return; return;
@ -1899,7 +1899,7 @@ public class HomePageServiceImpl implements IHomePageService {
* @param powerMap * @param powerMap
* @param hydropowerScoreVo * @param hydropowerScoreVo
*/ */
private void recentYearPower(List<Long> stationIdList, Map<Long, Map<String, Float>> powerMap, HydropowerScoreVo hydropowerScoreVo) { private void recentYearPower(List<Long> stationIdList, Map<Long, Map<String, Float>> powerMap, OldHydropowerScoreVo hydropowerScoreVo) {
List<Map<String, Float>> valueList = powerMap.entrySet().stream().filter(e -> stationIdList.contains(e.getKey())).map(Map.Entry::getValue).collect(Collectors.toList()); List<Map<String, Float>> valueList = powerMap.entrySet().stream().filter(e -> stationIdList.contains(e.getKey())).map(Map.Entry::getValue).collect(Collectors.toList());
if (CollectionUtil.isEmpty(valueList) || MapUtils.isEmpty(powerMap)) { if (CollectionUtil.isEmpty(valueList) || MapUtils.isEmpty(powerMap)) {
return; return;
@ -1963,7 +1963,7 @@ public class HomePageServiceImpl implements IHomePageService {
* @param * @param
* @param hydropowerScoreVo * @param hydropowerScoreVo
*/ */
private void planActualPower(List<String> stationCodeList, HydropowerScoreVo hydropowerScoreVo) { private void planActualPower(List<String> stationCodeList, OldHydropowerScoreVo hydropowerScoreVo) {
if (CollectionUtil.isEmpty(stationCodeList)) { if (CollectionUtil.isEmpty(stationCodeList)) {
hydropowerScoreVo.setPlanPowerYear("0"); hydropowerScoreVo.setPlanPowerYear("0");
hydropowerScoreVo.setFinishPowerYear("0"); hydropowerScoreVo.setFinishPowerYear("0");
@ -1973,13 +1973,12 @@ public class HomePageServiceImpl implements IHomePageService {
calendar.setTime(new Date()); calendar.setTime(new Date());
String year = String.valueOf(calendar.get(Calendar.YEAR)); String year = String.valueOf(calendar.get(Calendar.YEAR));
// 查询年计划发电情况 返回格式 : 计划发电量|完成发电量 // 查询年计划发电情况 返回格式 : 计划发电量|完成发电量
String planActualPower = planGenertionClient.getPlanPowerYear(stationCodeList, year); Double planActualPower = planGenertionClient.getPlanPowerYear(stationCodeList, year);
String[] powerArr = planActualPower.split("\\|"); hydropowerScoreVo.setPlanPowerYear(String.valueOf(planActualPower));
hydropowerScoreVo.setPlanPowerYear(powerArr[0]);
// 使用实时统计年发电量计算 // 使用实时统计年发电量计算
float finishPowerYear = Float.parseFloat(hydropowerScoreVo.getPowerYear()); float finishPowerYear = Float.parseFloat(hydropowerScoreVo.getPowerYear());
hydropowerScoreVo.setFinishPowerYear(String.valueOf(finishPowerYear)); hydropowerScoreVo.setFinishPowerYear(String.valueOf(finishPowerYear));
float planPowerYear = Float.parseFloat(powerArr[0]); float planPowerYear = Float.parseFloat(String.valueOf(planActualPower));
if (Math.abs(planPowerYear) <= 0) { if (Math.abs(planPowerYear) <= 0) {
hydropowerScoreVo.setPlanCompletionRateYear("0.0"); hydropowerScoreVo.setPlanCompletionRateYear("0.0");
return; return;
@ -1995,7 +1994,7 @@ public class HomePageServiceImpl implements IHomePageService {
* @param activePowerMap * @param activePowerMap
* @param hydropowerScoreVo * @param hydropowerScoreVo
*/ */
private void activePower(List<StationEntity> stationList, Map<String, Double> activePowerMap, HydropowerScoreVo hydropowerScoreVo) { private void activePower(List<StationEntity> stationList, Map<String, Double> activePowerMap, OldHydropowerScoreVo hydropowerScoreVo) {
if (MapUtils.isEmpty(activePowerMap)) { if (MapUtils.isEmpty(activePowerMap)) {
hydropowerScoreVo.setActivePowerYear(0.0); hydropowerScoreVo.setActivePowerYear(0.0);
hydropowerScoreVo.setActivePowerMoth(0.0); hydropowerScoreVo.setActivePowerMoth(0.0);

516
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -0,0 +1,516 @@
package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.operational.fill.entity.*;
import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.HomeService;
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
import com.hnac.hzims.ticket.allTicket.vo.DoublePassRateVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
/**
* 首页实现类
* @author ysj
*/
@Service
@Slf4j
@RequiredArgsConstructor
public class HomeServiceImpl implements HomeService {
private final OverService overService;
private final OtherService otherService;
private final PowerService powerService;
private final SolveService solveService;
private final IStationService stationService;
private final IPlanGenertionClient planService;
private final OverDetailsService overDetailsService;
private final IMainTaskStatisticService mainTaskStatisticService;
private final ISysClient sysClient;
private final ITicketInfoAllClient ticketClient;
private final RedisTemplate redisTemplate;
private final static String charge = "hzims:operation:key:charge";
@Value("${hzims.operation.homePage.charge.url}")
public String charge_url;
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
private final static String load_photovoltaic_real_key = "hzims:operation:photovoltaic:real:key";
private final static String load_photovoltaic_target_key = "hzims:operation:photovoltaic:target:key";
private static final int STORAGE_POOL_QUANTITY = 4;
private static final int NETWORK_POOL_QUANTITY = 3;
/**
* 首页站点数量
* @return
*/
@Override
public List<StationCountVo> count() {
// 查询全部站点
List<StationEntity> stations = stationService.list();
List<StationCountVo> counts = new ArrayList<>();
stations.stream().collect(Collectors.groupingBy(StationEntity::getServeType))
.forEach((key, value) -> counts.addAll(value.stream().collect(Collectors.groupingBy(StationEntity::getType)).entrySet().stream().
map(station -> {
StationCountVo count = new StationCountVo();
count.setServeType(key);
if(HomePageConstant.CHARGE.equals(station.getKey()) && "2".equals(key)){
TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge);
if(ObjectUtil.isNotEmpty(target)){
count.setCount(Optional.ofNullable(target.getCharge()).orElse(0));
}
}else{
count.setCount(station.getValue().size());
}
count.setType(String.valueOf(station.getKey()));
count.setTypeName(DictCache.getValue("stationType", station.getKey()));
return count;
}).collect(Collectors.toList())));
return counts.stream().sorted(Comparator.comparing(StationCountVo::getServeType)).collect(Collectors.toList());
}
/**
* 首页指标
* @param type
* @return
*/
@Override
public TargetVo target(Integer type) {
switch (type){
// 水电站
case 0:
return this.hydropowerTaget();
// 风电站
case 1:
return this.windTaget();
// 水利
case 2:
return this.waterStorageTaget(false);
// 储能站
case 3:
return this.waterStorageTaget(true);
// 配网
case 4:
return this.networkTaget();
// 光伏站
case 5:
return this.photovoltaicTaget();
// 充电桩
case 7:
return this.chargeTarget();
// 水务
case 6:
default:
return new TargetVo();
}
}
/**
* 水电站指标
* @return
*/
private TargetVo hydropowerTaget() {
TargetVo target = new TargetVo();
target.setType(HomePageConstant.HYDROPOWER);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.HYDROPOWER));
// 实时数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtil.isNotEmpty(reals)){
// 装机容量
target.setTaget_one(reals.stream().mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
}
if(CollectionUtil.isNotEmpty(targets)){
// 发电量
target.setTaget_two(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
}
// 计划发电量
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.HYDROPOWER));
if(CollectionUtil.isNotEmpty(stations)){
List<PlanGenerationEntity> plans = planService.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
if(CollectionUtil.isNotEmpty(plans)){
double plan = plans.stream().mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
if(Math.abs(plan) > 0){
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
}
// 双票合格率
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(areas)){
LocalDateTime firstDateTime = LocalDateTime.of(LocalDate.now().withDayOfYear(1), LocalTime.MIN);
DoublePassRateVO pass = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now());
if(ObjectUtil.isNotEmpty(pass)){
target.setTaget_four(Double.valueOf(pass.getDoublePassRate()));
}
}
}
return target;
}
/**
* 风电指标
* @return
*/
private TargetVo windTaget() {
TargetVo target = new TargetVo();
target.setType(HomePageConstant.WIND_POWER);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WIND_POWER));
// 填报发电量
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.WIND_POWER));
if(CollectionUtil.isEmpty(stations)){
return target;
}
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
eq("type", HomePageConstant.WIND_POWER_TYPE);
likeRight("mon", DateUtil.format(new Date(),"yyyy"));
}};
List<PowerEntity> list = powerService.list(queryWrapper);
if(CollectionUtil.isEmpty(list)){
return target;
}
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum();
// 装机容量
target.setTaget_one(list.get(0).getInstalledCapacity());
// 发电量
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum());
if(Math.abs(plan) > 0){
// 发电完成率
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
// 双票合格率
target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
return target;
}
/**
* 光伏指标
* @return
*/
private TargetVo photovoltaicTaget() {
TargetVo target = new TargetVo();
target.setType(HomePageConstant.PHOTOVOLTAIC);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.PHOTOVOLTAIC));
// 实时数据
List<PhotovoltaicRealVo> reals = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key);
// 指标数据
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtil.isNotEmpty(reals)){
// 装机容量
target.setTaget_one(reals.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
}
if(CollectionUtil.isNotEmpty(targets)){
// 发电量
target.setTaget_two(targets.stream().mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum());
}
// 计划发电量、双票合格率
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.eq(StationEntity::getType,HomePageConstant.PHOTOVOLTAIC));
if(CollectionUtil.isNotEmpty(stations)){
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()));
eq("type", HomePageConstant.PHOTOVOLTAIC_TYPE);
likeRight("mon", DateUtil.format(new Date(),"yyyy"));
}};
List<PowerEntity> list = powerService.list(queryWrapper);
if(CollectionUtil.isEmpty(list)){
return target;
}
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum();
if(Math.abs(plan) > 0){
// 发电完成率
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
// 双票合格率
target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
return target;
}
/**
* 储能指标
* @param flag : false - 水利 true - 储能
* @return
*/
private TargetVo waterStorageTaget(boolean flag) {
TargetVo target = new TargetVo();
if(flag){
target.setType(HomePageConstant.ENERGY_STORAGE);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.ENERGY_STORAGE));
}else{
target.setType(HomePageConstant.WATER_CONSERVANCY);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.WATER_CONSERVANCY));
}
// 查询储能站点
LambdaQueryWrapper<StationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
if(flag){
wrapper.eq(StationEntity::getType,HomePageConstant.ENERGY_STORAGE);
}else{
wrapper.eq(StationEntity::getType,HomePageConstant.WATER_CONSERVANCY);
}
List<StationEntity> stations = stationService.list(wrapper);
if(CollectionUtil.isEmpty(stations)){
return target;
}
// 获取储能区域级别机构
R<List<Dept>> result = sysClient.getDeptByCurrentUser();
if(result.isSuccess() && CollectionUtil.isNotEmpty(result.getData()) && CollectionUtil.isNotEmpty(stations)){
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(areas)){
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("storage-taget-pool-%d").build();
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(4, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
// 监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(STORAGE_POOL_QUANTITY);
// 日常维护
exe.execute(() -> {
target.setTaget_one(Double.valueOf(mainTaskStatisticService.getRoutineMaintenanceCount(areas)));
countDownLatch.countDown();
});
// 检修任务
exe.execute(() -> {
target.setTaget_two(Double.valueOf(mainTaskStatisticService.getMaintenanceTasksCount(areas)));
countDownLatch.countDown();
});
// 消缺率
exe.execute(() -> {
target.setTaget_three(Double.valueOf(mainTaskStatisticService.getDeletionRate(areas)));
countDownLatch.countDown();
});
// 双票合格率
exe.execute(() -> {
LocalDate firstDay = LocalDate.now().withDayOfYear(1);
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN);
DoublePassRateVO pass = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now());
if (ObjectUtil.isNotEmpty(pass)) {
target.setTaget_four(Double.valueOf(pass.getDoublePassRate()));
}
countDownLatch.countDown();
});
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
exe.shutdown();
}
}
return target;
}
/**
* 配网
* @return
*/
private TargetVo networkTaget() {
TargetVo target = new TargetVo();
target.setType(HomePageConstant.DISTRIBUTION_NETWORK);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.DISTRIBUTION_NETWORK));
// 线程池
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("network-taget-pool-%d").build();
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(3, namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
// 监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(NETWORK_POOL_QUANTITY);
// 当月
LocalDate firstDay = LocalDate.now().withDayOfYear(1);
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN);
// 检修卡
exe.execute(()->{
List<OverEntity> overs = overService.list(new QueryWrapper<OverEntity>() {{
ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now());
}});
if(CollectionUtil.isEmpty(overs)){
countDownLatch.countDown();
return;
}
List<OverDetailsEntity> details = overDetailsService.list(new QueryWrapper<OverDetailsEntity>() {{
ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now());
in("over_id",overs.stream().map(OverEntity::getId).collect(Collectors.toList()));
}});
if(CollectionUtil.isEmpty(details)){
countDownLatch.countDown();
return;
}
target.setTaget_one(details.stream().mapToDouble(OverDetailsEntity::getQuantity).sum());
countDownLatch.countDown();
});
// 消缺
exe.execute(()->{
List<SolveEntity> solves = solveService.list(new QueryWrapper<SolveEntity>() {{
ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now());
}});
if(CollectionUtil.isEmpty(solves)){
countDownLatch.countDown();
return;
}
target.setTaget_two(solves.stream().mapToDouble(SolveEntity::getSolveQuantity).sum());
countDownLatch.countDown();
});
// 其他
exe.execute(()->{
List<OtherEntity> others = otherService.list(new QueryWrapper<OtherEntity>() {{
ge("create_time", firstDateTime);
le("create_time", LocalDateTime.now());
}});
if(CollectionUtil.isEmpty(others)){
countDownLatch.countDown();
return;
}
target.setTaget_three(others.stream().mapToDouble(OtherEntity::getFaQuantity).sum());
double online = others.stream().mapToDouble(o-> Double.parseDouble(o.getOnlineRate())).sum();
if(Math.abs(online) > 0){
target.setTaget_three(BigDecimal.valueOf(online / others.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
}
countDownLatch.countDown();
});
// 等待所有线程执行完成
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
return target;
}
/**
* 充电桩
* @return
*/
private TargetVo chargeTarget() {
TargetVo target = (TargetVo) redisTemplate.opsForValue().get(charge);
if(ObjectUtil.isNotEmpty(target)){
return target;
}
target = new TargetVo();
try {
URL serverUrl = new URL(charge_url);
HttpURLConnection conn = (HttpURLConnection) serverUrl.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-type", "application/json");
//必须设置false,否则会自动redirect到重定向后的地址
conn.setInstanceFollowRedirects(false);
conn.connect();
String result = responseFormat(conn);
if (StringUtil.isBlank(result)) {
return new TargetVo();
}
JSONObject jsonObject = JSONObject.parseObject(result);
JSONObject data = JSONObject.parseObject(jsonObject.get("data").toString());
target.setType(HomePageConstant.CHARGE);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.CHARGE));
target.setTaget_one(Double.valueOf(data.get("ordersCount").toString()));
target.setTaget_two(Double.valueOf(data.get("todayDegree").toString()));
target.setTaget_three(Double.valueOf(data.get("income").toString()));
target.setTaget_four(Double.valueOf(data.get("kilowatt").toString()));
target.setCharge(Integer.valueOf(data.get("stationNum").toString()));
redisTemplate.opsForValue().set(charge,target);
redisTemplate.expire(charge,30, TimeUnit.MINUTES);
} catch (Exception e) {
target.setType(HomePageConstant.CHARGE);
target.setTypeName(DictCache.getValue("stationType", HomePageConstant.CHARGE));
target.setTaget_one(0.0);
target.setTaget_two(0.0);
target.setTaget_three(0.0);
target.setTaget_four(0.0);
target.setCharge(0);
log.error("charge_target_exception: {} ", e.getMessage());
}
return target;
}
/***
* 获取返回的内容
* @param connection
* @return
*/
private String responseFormat(HttpURLConnection connection) {
StringBuilder stringBuilder = new StringBuilder();
//将返回的输入流转换成字符串
try (
InputStream inputStream = connection.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader)
) {
String str;
while ((str = bufferedReader.readLine()) != null) {
stringBuilder.append(str);
}
} catch (IOException e) {
return null;
}
return stringBuilder.toString();
}
}

475
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -4,13 +4,14 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.EquipmentConstants; import com.hnac.hzims.EquipmentConstants;
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.EminfoAndEmParamVo; import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily; import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse; import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.fill.service.GenerateService; import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.fill.service.PowerService;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*; import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*; import com.hnac.hzims.operational.main.vo.*;
@ -27,6 +28,7 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -41,20 +43,21 @@ import java.util.stream.Collectors;
/** /**
* APP首页实现类 * APP首页实现类
* @author ysj
*/ */
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class HydropowerServiceImpl implements HydropowerService { public class HydropowerServiceImpl implements HydropowerService {
private final IWaterService waterService;
private final IWeatherService weatherService; private final IWeatherService weatherService;
private final IStationService stationService; private final IStationService stationService;
private final GenerateService generateService; private final GenerateService generateService;
private final IHomePageService homePageService; private final PowerService photovoltaicService;
private final AreaService areaService;
private final IAnalyseDataService analyseDataService; private final IAnalyseDataService analyseDataService;
@ -107,8 +110,10 @@ public class HydropowerServiceImpl implements HydropowerService {
real.setDeviceCode(device.getEmCode()); real.setDeviceCode(device.getEmCode());
real.setDeptName(device.getName()); real.setDeptName(device.getName());
real.setDeviceName(device.getName()); real.setDeviceName(device.getName());
// 装机容量
real.setInstalledCapacity(device.getInstalledCapacity());
// 开关机状态 // 开关机状态
real.setState(this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY)); real.setState(Math.abs(this.getSignageValue(device,map,HomePageConstant.JOINT_RELAY)) > 0);
// 有功功率 // 有功功率
real.setActivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER)); real.setActivePower(this.getSignageValue(device,map,HomePageConstant.HYDROPOWER_ACTIVE_POWER));
// 无功功率 // 无功功率
@ -165,7 +170,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 当日发电量 // 当日发电量
target.setPowerDay(this.getGenerationPower(device,2)); target.setPowerDay(this.getGenerationPower(device,2));
// 当天有功功率 // 当天有功功率
target.setActivePowerVoList(waterService.getActivePowerVoList(device)); target.setActivePowerVoList(this.getLoadsByDay(device));
// 30天发电量 // 30天发电量
target.setGenerationPowerVoList(this.getGenerationPowerList(device)); target.setGenerationPowerVoList(this.getGenerationPowerList(device));
return target; return target;
@ -178,6 +183,112 @@ public class HydropowerServiceImpl implements HydropowerService {
redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets); redisTemplate.opsForValue().set(load_hydropower_unit_target_key,targets);
} }
/**
* 近年发电量数据
*
* @param param 时间
* @param serveType 站点类型
* @param year 近几年
*/
@Override
public void loadPowerData(String param, List<Integer> types, Integer serveType, int year) {
// 站点查询
List<StationEntity> stationList = stationService.getStationType(serveType, types, null);
// 设备信息
List<EminfoAndEmParamVo> devices = maintenanceTaskService.getEmInfoList();
// 开始时间
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH) + 12);
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 结束日期
calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) - year);
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
String start = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE) + " 00:00:00";
// 存储数据map :<站点id,<月份,发电量>>
Map<Long, Map<String, Float>> powerMap = new HashMap<>();
stationList.forEach(station -> {
// 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
Map<String, Float> generateMap = this.getGenerateYear(station,stationDevices,start,end);
if(MapUtils.isEmpty(generateMap)){
return;
}
powerMap.put(station.getId(),generateMap);
});
redisTemplate.opsForValue().set(recent_year_power_data, powerMap);
}
/**
* 当天有功功率
* @param device
* @return
*/
private List<ActivePowerVo> getLoadsByDay(EminfoAndEmParamVo device) {
// FIXME 当天功率测试数据
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
List<ActivePowerVo> list = new ArrayList<>();
Random random = new Random();
while (start.getTime().compareTo(new Date()) <= 0){
ActivePowerVo load = new ActivePowerVo();
load.setHour(start.get(Calendar.HOUR_OF_DAY));
load.setActivePower(String.valueOf(random.nextDouble() * 500));
list.add(load);
start.add(Calendar.HOUR_OF_DAY,1);
}
return list;
/*String start = DateUtil.format(new Date(), DateUtil.PATTERN_DATE) + " 00:00:00";
String end = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start, end, 1, 2, device.getEmCode(), HomePageConstant.PV_LOAD);
if (CollectionUtil.isEmpty(records)) {
return new ArrayList<>();
}
return records.stream().map(record -> {
PhotovoltaicPowerVo load = new PhotovoltaicPowerVo();
Date time = DateUtil.parse(record.getTs(), "yyyy-MM-dd HH:mm:ss.s");
load.setHour(DateUtil.format(time,"yyyy-mm-dd HH"));
load.setActivePower(Optional.ofNullable(record.getVal()).orElse("0"));
return load;
}).sorted(Comparator.comparing(PhotovoltaicPowerVo::getHour)).collect(Collectors.toList());*/
}
/**
* 获取年发电量
* @param devices
* @param start
* @param end
* @return
*/
private Map<String, Float> getGenerateYear(StationEntity station,List<EminfoAndEmParamVo> devices, String start, String end) {
List<PowerMonthVo> datas = new ArrayList<>();
// 设备采集发电量
if(CollectionUtil.isNotEmpty(devices)){
devices.forEach(device->{
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,5,5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){
return;
}
datas.addAll(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.parseFloat(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate;
}).collect(Collectors.toList()));
});
}
// 补充填报数据
datas.addAll(this.generateFill(station,start,end));
if(CollectionUtil.isEmpty(datas)){
return null;
}
return datas.stream().collect(Collectors.toMap(PowerMonthVo::getStrMonth, PowerMonthVo::getPower, Float::sum));
}
/** /**
* 获取填报用电量 * 获取填报用电量
* @param stations * @param stations
@ -206,6 +317,23 @@ public class HydropowerServiceImpl implements HydropowerService {
/** /**
* 补充填报数据
* @param station
* @param start
* @param end
*/
private List<PowerMonthVo> generateFill(StationEntity station, String start, String end) {
start = DateUtil.format(DateUtil.parse(start,DateUtil.PATTERN_DATETIME),"yyyy-MM");
end = DateUtil.format(DateUtil.parse(end,DateUtil.PATTERN_DATETIME),"yyyy-MM");
// 光伏
if(HomePageConstant.PHOTOVOLTAIC.equals(station.getType())){
return photovoltaicService.generateThreeYear(start,end,station.getRefDept());
}
// 水电
return generateService.generateThreeYear(start,end,station.getCode());
}
/**
* 泵站设备 * 泵站设备
* @param stations * @param stations
* @return * @return
@ -236,28 +364,28 @@ public class HydropowerServiceImpl implements HydropowerService {
/** /**
* 获取监测点实时数据 * 获取监测点实时数据
* @param em * @param device
* @param targets * @param targets
* @return * @return
*/ */
private String getSignageValue(EminfoAndEmParamVo em,Map<String, String> map, String targets) { private double getSignageValue(EminfoAndEmParamVo device,Map<String, String> map, String targets) {
if(ObjectUtil.isEmpty(em) || MapUtils.isEmpty(map)){ if(ObjectUtil.isEmpty(device) || MapUtils.isEmpty(map)){
return "0"; return 0.0;
} }
Map<String,String> point = em.getPoint(); Map<String,String> point = device.getPoint();
if(MapUtils.isEmpty(point)){ if(MapUtils.isEmpty(point)){
return "0"; return 0.0;
} }
String realId = point.get(targets); String realId = point.get(targets);
if(StringUtil.isBlank(realId)){ if(StringUtil.isBlank(realId)){
return "0"; return 0.0;
} }
String value = map.get(realId); String value = map.get(realId);
if(StringUtil.isBlank(value)){ if(StringUtil.isBlank(value)){
return "0"; return 0.0;
} }
// 获取value // 获取value
return value; return Double.parseDouble(value);
} }
/** /**
@ -345,11 +473,25 @@ public class HydropowerServiceImpl implements HydropowerService {
* @return * @return
*/ */
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) { private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) {
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATE); // FIXME 测试数据
String start = DateUtil.format(new Date(),DateUtil.PATTERN_DATETIME);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-29); calendar.add(Calendar.DAY_OF_MONTH,-29);
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY));
List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER); calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE));
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND));
String end = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME);
Random random = new Random();
List<GenerationPowerVo> generates = new ArrayList<>();
if(calendar.getTime().compareTo(new Date()) <= 0){
GenerationPowerVo generate = new GenerationPowerVo();
generate.setDate(DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE));
generate.setGenerate(random.nextFloat() * 500000f);
generates.add(generate);
}
return generates;
/*List<AnalyseDataTaosVO> records = analyseDataService.periodTargetData(start,end,EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),5,device.getEmCode(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
if(CollectionUtil.isEmpty(records)){ if(CollectionUtil.isEmpty(records)){
return new ArrayList<>(); return new ArrayList<>();
} }
@ -359,7 +501,7 @@ public class HydropowerServiceImpl implements HydropowerService {
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;
}).collect(Collectors.toList()); }).collect(Collectors.toList());*/
} }
/** /**
@ -388,6 +530,8 @@ public class HydropowerServiceImpl implements HydropowerService {
// 七天天气 // 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode())); Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(Collections.singletonList(station.getCode()));
HydropowerStationVo response = new HydropowerStationVo(); HydropowerStationVo response = new HydropowerStationVo();
// 近年发电量数据
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data);
response.setDeptId(station.getRefDept()); response.setDeptId(station.getRefDept());
response.setDeptName(station.getName()); response.setDeptName(station.getName());
response.setStationCode(station.getCode()); response.setStationCode(station.getCode());
@ -417,7 +561,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 水位、水位曲线 // 水位、水位曲线
this.handleWaterLeve(station.getCode(),response); this.handleWaterLeve(station.getCode(),response);
// 年发电量完成百分比 // 年发电量完成百分比
response.setPowerYearMap(this.handlePowerFinish(station)); response.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map));
// 设备信息 // 设备信息
response.setDeviceList(this.getDevices(station,realList,targetList)); response.setDeviceList(this.getDevices(station,realList,targetList));
return response; return response;
@ -578,7 +722,7 @@ public class HydropowerServiceImpl implements HydropowerService {
if(CollectionUtil.isEmpty(realList)){ if(CollectionUtil.isEmpty(realList)){
return 0.0; return 0.0;
} }
return realList.stream().filter(o->deptId.equals(o.getDeptId())).mapToDouble(o->Double.parseDouble(o.getActivePower())).sum(); return realList.stream().filter(o->deptId.equals(o.getDeptId())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum();
} }
/** /**
@ -681,21 +825,18 @@ public class HydropowerServiceImpl implements HydropowerService {
/** /**
* 年发电量完成百分比 * 年发电量完成百分比
* @param station * @param stations
*/ */
private List<PowerMonthVo> handlePowerFinish(StationEntity station) { private List<PowerMonthVo> handlePowerFinish(List<StationEntity> stations,Map<Long, Map<String, Float>> map) {
String code = station.getCode(); if(CollectionUtil.isEmpty(stations)){
if(StringUtil.isBlank(code)){
return null; return null;
} }
// 实际发电量
Map<Long, Map<String, Float>> powerMap = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data);
// 查询计划发电量 // 查询计划发电量
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date()); calendar.setTime(new Date());
List<PlanPowerYearVo> planPowerList = planGenertionClient.getPlanPowerByYear(code,calendar.get(Calendar.YEAR)); List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()),null,String.valueOf(calendar.get(Calendar.YEAR)));
// 获取月份集合 // 获取月份集合
List<String> monList = homePageService.getMonthList(0,12,false); List<String> monList = this.mons(0,12,false);
return monList.stream().map(o->{ return monList.stream().map(o->{
PowerMonthVo vo = new PowerMonthVo(); PowerMonthVo vo = new PowerMonthVo();
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), o), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE)); LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), o), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
@ -703,32 +844,55 @@ public class HydropowerServiceImpl implements HydropowerService {
vo.setYear(localDate.getYear()); vo.setYear(localDate.getYear());
vo.setMonth(localDate.getMonthValue()); vo.setMonth(localDate.getMonthValue());
// 实际发电量 // 实际发电量
if(CollectionUtil.isEmpty(powerMap)){ if(CollectionUtil.isEmpty(map)){
vo.setPower(0f); vo.setPower(0f);
}else{ }else{
Map<String, Float> map = powerMap.get(station.getId()); float generate = (float) map.entrySet().stream().
if(MapUtils.isEmpty(map)){ filter(entry->stations.stream().map(StationEntity::getId).collect(Collectors.toList()).contains(entry.getKey())).
vo.setPower(0f); mapToDouble(valueMap-> valueMap.getValue().entrySet().stream().filter(entry->entry.getKey().equals(o))
}else{ .mapToDouble(Map.Entry::getValue).sum()).sum();
vo.setPower(map.get(o)); vo.setPower(generate);
}
} }
// 计划发电量 // 计划发电量
if(CollectionUtil.isEmpty(planPowerList)){ if(CollectionUtil.isEmpty(plans)){
vo.setPlanPower(0f); vo.setPlanPower(0f);
}else{ }else{
String mon = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM")); String mon = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM"));
List<PlanPowerYearVo> list = planPowerList.stream().filter(s->mon.equals(s.getMon())).collect(Collectors.toList()); vo.setPlanPower((float)plans.stream().filter(plan->mon.equals(plan.getDateTime())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum());
if(CollectionUtil.isEmpty(list)){
vo.setPlanPower(0f);
}else{
vo.setPlanPower(list.get(0).getPlanPower());
}
} }
return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
/**
* 获取近年月份集合
* @param year
* @return
*/
public List<String> mons(int year, int endMoth, boolean nextMon) {
List<String> list = new ArrayList<>();
// 开始日期
Calendar endCal = Calendar.getInstance();
endCal.setTime(new Date());
endCal.add(Calendar.MONTH, -endCal.get(Calendar.MONTH) + endMoth);
endCal.add(Calendar.DATE, -endCal.get(Calendar.DATE) + 1);
// 结束日期
Calendar startCal = Calendar.getInstance();
startCal.setTime(new Date());
startCal.set(Calendar.YEAR, startCal.get(Calendar.YEAR) - year);
startCal.add(Calendar.MONTH, -startCal.get(Calendar.MONTH));
startCal.add(Calendar.DATE, -startCal.get(Calendar.DATE) + 1);
// 获取日期之间的月份
while (endCal.after(startCal)) {
list.add(DateUtil.format(startCal.getTime(),DateUtil.PATTERN_DATE));
startCal.add(Calendar.MONTH, 1);
}
if(nextMon){
list.add(DateUtil.format(endCal.getTime(),DateUtil.PATTERN_DATE));
}
return list;
}
/** /**
* 水电站站点列表 * 水电站站点列表
@ -751,6 +915,8 @@ public class HydropowerServiceImpl implements HydropowerService {
Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); Map<String, HeWeatherWeatherNowResponse> weather = this.getWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 七天天气 // 七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())); Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.getWeekWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 站点近年发电数据 key - id value - 月份,发电量
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data);
return stations.stream().map(station->{ return stations.stream().map(station->{
HydropowerStationVo hydropower = new HydropowerStationVo(); HydropowerStationVo hydropower = new HydropowerStationVo();
hydropower.setDeptId(station.getRefDept()); hydropower.setDeptId(station.getRefDept());
@ -782,7 +948,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 水位、水位曲线 // 水位、水位曲线
this.handleWaterLeve(station.getCode(),hydropower); this.handleWaterLeve(station.getCode(),hydropower);
// 年发电量完成百分比 // 年发电量完成百分比
hydropower.setPowerYearMap(this.handlePowerFinish(station)); hydropower.setPowerYearMap(this.handlePowerFinish(Collections.singletonList(station),map));
// 设备信息 // 设备信息
hydropower.setDeviceList(this.getDevices(station,realList,targetList)); hydropower.setDeviceList(this.getDevices(station,realList,targetList));
return hydropower; return hydropower;
@ -795,7 +961,224 @@ public class HydropowerServiceImpl implements HydropowerService {
* @return * @return
*/ */
@Override @Override
public HydropowerStationVo area_target(Long deptId) { public HydropowerScoreVo KPIs(Long deptId) {
return null; // 查询水电站站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), HomePageConstant.HYDROPOWER_SERVETYPE);
if (CollectionUtil.isEmpty(stations)) {
return new HydropowerScoreVo();
}
HydropowerScoreVo kpi = new HydropowerScoreVo();
kpi.setDepartId(deptId);
// 站点数量
kpi.setStationCount(stations.size());
// 实时数据
List<HydropowerUnitRealVo> deviceReals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
if (CollectionUtil.isNotEmpty(deviceReals)) {
List<HydropowerUnitRealVo> reals = deviceReals.stream().filter(device -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(device.getDeptId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(reals)) {
// 容量
kpi.setInstalledCapacity(reals.stream().mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum());
// 负荷
kpi.setLoad(reals.stream().mapToDouble(HydropowerUnitRealVo::getActivePower).sum());
// 容量利用率
if (Math.abs(kpi.getInstalledCapacity()) <= 0) {
kpi.setCapacityRate(0.0);
}else{
kpi.setCapacityRate(BigDecimal.valueOf(kpi.getLoad() / kpi.getInstalledCapacity() * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
}
// 指标数据
List<HydropowerUnitTargetVo> deviceTargets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if (CollectionUtil.isNotEmpty(deviceTargets)) {
List<HydropowerUnitTargetVo> targets = deviceTargets.stream().filter(device -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(device.getDeptId())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(targets)) {
// 年发电量
kpi.setGenerateYear(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum());
// 月发电量
kpi.setGenerateMon(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerMon).sum());
// 日发电量
kpi.setGenerateDay(targets.stream().mapToDouble(HydropowerUnitTargetVo::getPowerDay).sum());
// 年计划发电量
Double plan = planGenertionClient.getPlanPowerYear(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), DateUtil.format(new Date(),"yyyy"));
kpi.setPlan(plan);
if(Math.abs(plan) <= 0){
kpi.setPlanRate(0.0);
}else{
kpi.setPlanRate(BigDecimal.valueOf(kpi.getGenerateYear() / plan * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
}
// 站点近年发电数据 key - id value - 月份,发电量
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(recent_year_power_data);
if (MapUtils.isEmpty(map)) {
return kpi;
}
// 今年发电趋势
kpi.setPowerMonthVoList(this.handlePowerFinish(stations,map));
// 近3年发电量
kpi.setPowerYearVoList(this.generateThreeYear(stations.stream().map(StationEntity::getId).collect(Collectors.toList()),map));
return kpi;
}
/**
* 水电站集团/区域指标占比
* @param deptId
* @return
*/
@Override
public List<AreaScaleVo> proportion(Long deptId) {
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> areas = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
if(MapUtils.isEmpty(areas)){
return null;
}
List<String> codes = new ArrayList<>();
areas.forEach((key,value)-> codes.addAll(value.stream().map(StationEntity::getCode).collect(Collectors.toList())));
// 获取站点编码集合
List<String> stations = areas.values().stream().map(values -> values.get(0).getCode()).collect(Collectors.toList());
// 获取站点实时天气
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(stations);
// 获取站点7日天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations);
// 计划发电量
List<PlanGenerationEntity> plans = planGenertionClient.getPlanGenerationByParam(codes, null, DateUtil.format(new Date(), "yyyy"));
// 实时监测点数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
// 获取站点机组指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
// 获取总发电量
List<String> monList = this.mons(0,12,false);
List<AreaScaleVo> scales = areas.entrySet().stream().map(entry->{
AreaScaleVo scale = new AreaScaleVo();
scale.setDeptId(entry.getKey().getId());
scale.setSort(entry.getKey().getSort());
scale.setDeptName(entry.getKey().getDeptName());
// 天气
this.getAreaWearther(scale,nowWeather,weekWeather,entry.getValue().get(0).getCode());
// 指标数据: 发电量完成率
if(CollectionUtil.isNotEmpty(targets)){
// 当年发电量
double generate = targets.stream().filter(target->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(target.getDeptId())).mapToDouble(HydropowerUnitTargetVo::getPowerYear).sum();
scale.setPowerYear((float) generate);
if(CollectionUtil.isNotEmpty(plans)){
// 当年计划发电量
double generatePlan = plans.stream().filter(plan-> entry.getValue().stream().map(StationEntity::getCode).collect(Collectors.toList()).contains(plan.getStationId())).mapToDouble(PlanGenerationEntity::getPlanGeneration).sum();
if(Math.abs(generatePlan) > 0){
scale.setGenerationRate(BigDecimal.valueOf(generate / generatePlan * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}else{
scale.setGenerationRate(0.0);
}
}else{
scale.setGenerationRate(0.0);
}
}
// 实时数据: 容量利用率、电站利用率
if(CollectionUtil.isNotEmpty(reals)){
// 实时功率
double use = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).mapToDouble(HydropowerUnitRealVo::getActivePower).sum();
if(CollectionUtil.isNotEmpty(plans)){
// 装机容量
double capacity = reals.stream().filter(real-> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).mapToDouble(HydropowerUnitRealVo::getInstalledCapacity).sum();
if(Math.abs(capacity) > 0){
scale.setCapacityUse(BigDecimal.valueOf(use / capacity * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}else{
scale.setCapacityUse(0.0);
}
}else{
scale.setCapacityUse(0.0);
}
// 开机数量
long on = reals.stream().filter(real -> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId()) && real.getState()).count();
long sum = reals.stream().filter(real->entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(real.getDeptId())).count();
if(Math.abs(sum) > 0){
scale.setDeviceUse(BigDecimal.valueOf(on / sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
}
return scale;
}).collect(Collectors.toList());
double generate_sum = scales.stream().mapToDouble(AreaScaleVo::getPowerYear).sum();
// 返回结果集
if(Math.abs(generate_sum) > 0){
return scales.stream().peek(scale-> scale.setAreaMakeUp(BigDecimal.valueOf(scale.getPowerYear() / generate_sum * 100).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue())).
/*filter(scale-> Math.abs(scale.getCapacityUse()) > 0 || Math.abs(scale.getAreaMakeUp()) > 0
&& Math.abs(scale.getDeviceUse()) > 0 || Math.abs(scale.getGenerationRate()) > 0)
.*/sorted(Comparator.comparing(AreaScaleVo::getPowerYear).reversed()).collect(Collectors.toList());
}
return scales.stream().peek(scale-> scale.setAreaMakeUp(0.0))./*filter(scale-> Math.abs(scale.getCapacityUse()) > 0 || Math.abs(scale.getAreaMakeUp()) > 0
&& Math.abs(scale.getDeviceUse()) > 0 || Math.abs(scale.getGenerationRate()) > 0)
.*/sorted(Comparator.comparing(AreaScaleVo::getPowerYear).reversed()).collect(Collectors.toList());
}
/**
* 区域天气
* @param scale
* @param nowWeather
* @param weekWeather
* @param code
*/
private void getAreaWearther(AreaScaleVo scale,Map<String, HeWeatherWeatherNowResponse> nowWeather, Map<String, HeWeatherWeatherDailyResponse> weekWeather, String code) {
// 实时天气
if(MapUtils.isNotEmpty(nowWeather) && nowWeather.containsKey(code)){
HeWeatherWeatherNowResponse nowData = nowWeather.get(code);
if(ObjectUtil.isNotEmpty(nowData.getNow())){
scale.setTemp(nowData.getNow().getTemp());
}
}
// 站点七日内天气
if(MapUtils.isNotEmpty(weekWeather) && weekWeather.containsKey(code)){
HeWeatherWeatherDailyResponse weekData = weekWeather.get(code);
List<Daily> dailyList = weekData.getDaily();
if (CollectionUtil.isNotEmpty(dailyList)) {
scale.setWeather(dailyList);
}
}
}
/**
* 近3年发电量
* @param stations
* @return
*/
private List<PowerYearVo> generateThreeYear(List<Long> stations,Map<Long, Map<String, Float>> map) {
List<Map<String, Float>> filter = map.entrySet().stream().filter(e -> stations.contains(e.getKey())).map(Map.Entry::getValue).collect(Collectors.toList());
if (CollectionUtil.isEmpty(filter)) {
return new ArrayList<>();
}
// 根据月份分组
List<PowerMonthVo> powerMonthVos = new ArrayList<>();
filter.forEach(item -> item.forEach((key, value) -> {
PowerMonthVo powerMonthVo = new PowerMonthVo();
powerMonthVo.setStrMonth(key);
powerMonthVo.setPower(value);
powerMonthVos.add(powerMonthVo);
}));
Map<String, List<PowerMonthVo>> months = powerMonthVos.stream().collect(Collectors.groupingBy(PowerMonthVo::getStrMonth));
// 总和所有相同月份的发电量
List<PowerMonthVo> powerMonthVoList = months.entrySet().stream().map(entry -> {
PowerMonthVo powerMonth = new PowerMonthVo();
powerMonth.setStrMonth(entry.getKey());
LocalDate localDate = LocalDate.parse(DateUtil.format(new Date(), entry.getKey()), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATE));
powerMonth.setYear(localDate.getYear());
powerMonth.setMonth(localDate.getMonthValue());
powerMonth.setPower((float) entry.getValue().stream().mapToDouble(PowerMonthVo::getPower).sum());
return powerMonth;
}).collect(Collectors.toList());
if (CollectionUtil.isEmpty(powerMonthVoList)) {
return new ArrayList<>();
}
// 根据年份分组
Map<Integer, List<PowerMonthVo>> year = powerMonthVoList.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());
} }
} }

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

@ -63,7 +63,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
private final IMainSystemMonitoringService deviceService; private final IMainSystemMonitoringService deviceService;
private final ISideHustleService sideHustleService; private final AreaService areaService;
private final IWeatherService weatherService; private final IWeatherService weatherService;
@ -915,7 +915,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override @Override
public List<PhotovoltaicSubordinateVo> subordinate(Long deptId) { public List<PhotovoltaicSubordinateVo> subordinate(Long deptId) {
// 获取区域或者站点map结构 // 获取区域或者站点map结构
Map<Dept, List<StationEntity>> map = sideHustleService.getAreaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC)); Map<Dept, List<StationEntity>> map = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC));
if (MapUtils.isEmpty(map)) { if (MapUtils.isEmpty(map)) {
return new ArrayList<>(); return new ArrayList<>();
} }
@ -1063,7 +1063,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
@Override @Override
public List<PhotovoltaicSubordinateAppVo> app_subordinate(Long deptId) { public List<PhotovoltaicSubordinateAppVo> app_subordinate(Long deptId) {
// 获取区域或者站点map结构 // 获取区域或者站点map结构
Map<Dept, List<StationEntity>> map = sideHustleService.getAreaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC)); Map<Dept, List<StationEntity>> map = areaService.areaOrStaion(deptId, Collections.singletonList(HomePageConstant.PHOTOVOLTAIC));
if (MapUtils.isEmpty(map)) { if (MapUtils.isEmpty(map)) {
return new ArrayList<>(); return new ArrayList<>();
} }

10
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PlatformServiceImpl.java

@ -49,21 +49,17 @@ import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.*; import org.springblade.core.tool.utils.*;
import org.springblade.system.cache.DictCache; import org.springblade.system.cache.DictCache;
import org.springblade.system.entity.Dict; import org.springblade.system.entity.Dict;
import org.springblade.system.user.entity.User; import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient; import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; 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.*; import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -101,7 +97,7 @@ public class PlatformServiceImpl implements IPlatformService {
public List<StationCountVo> doStationCount(Integer serveType) { public List<StationCountVo> doStationCount(Integer serveType) {
List<StationCountVo> list = stationService.getStationTypeGroupCount(serveType); List<StationCountVo> list = stationService.getStationTypeGroupCount(serveType);
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
list.stream().forEach(iter -> iter.setStationTypeName(DictCache.getValue("stationType", iter.getStationType()))); list.stream().forEach(iter -> iter.setTypeName(DictCache.getValue("stationType", iter.getType())));
} }
return list; return list;
} }
@ -124,8 +120,8 @@ public class PlatformServiceImpl implements IPlatformService {
Map<Integer, List<StationEntity>> map = list.stream().filter(o -> null != o.getType()).collect(Collectors.groupingBy(StationEntity::getType)); Map<Integer, List<StationEntity>> map = list.stream().filter(o -> null != o.getType()).collect(Collectors.groupingBy(StationEntity::getType));
dictList.forEach(o->{ dictList.forEach(o->{
StationCountVo stationCountVo = new StationCountVo(); StationCountVo stationCountVo = new StationCountVo();
stationCountVo.setStationType(o.getDictKey()); stationCountVo.setType(o.getDictKey());
stationCountVo.setStationTypeName(o.getDictValue()); stationCountVo.setTypeName(o.getDictValue());
stationCountVo.setCount(0); stationCountVo.setCount(0);
Integer type = Integer.valueOf(o.getDictKey()); Integer type = Integer.valueOf(o.getDictKey());
List<StationEntity> stationEntityList = map.get(type); List<StationEntity> stationEntityList = map.get(type);

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

@ -699,7 +699,8 @@ public class RunMonthReportServiceImpl extends ServiceImpl<RunMonthReportMapper,
List<AnalyseDataTaosVO> listMax = analyzeDataConditionVOMax.getList(); List<AnalyseDataTaosVO> listMax = analyzeDataConditionVOMax.getList();
if (CollectionUtil.isNotEmpty(listAvg) || CollectionUtil.isNotEmpty(listMax)) { if (CollectionUtil.isNotEmpty(listAvg) || CollectionUtil.isNotEmpty(listMax)) {
RunMonthReportUnitVo runMonthReportDataVo = new RunMonthReportUnitVo(); RunMonthReportUnitVo runMonthReportDataVo = new RunMonthReportUnitVo();
String name = signKeyMap.get(analyzeDataConditionVOAvg.getSignage()); String name = "";
//signKeyMap.get(analyzeDataConditionVOAvg.getSignage());
runMonthReportDataVo.setName(namePerfix + name); runMonthReportDataVo.setName(namePerfix + name);
int count = 1; int count = 1;
Map<String, RunMonthReportAvgMaxVo> monthValue = new LinkedHashMap<>(); Map<String, RunMonthReportAvgMaxVo> monthValue = new LinkedHashMap<>();
@ -814,8 +815,8 @@ public class RunMonthReportServiceImpl extends ServiceImpl<RunMonthReportMapper,
if (StringUtil.isNotBlank(analyseDataTaosVO.getVal())) { if (StringUtil.isNotBlank(analyseDataTaosVO.getVal())) {
vo.setValue(Double.valueOf(analyseDataTaosVO.getVal())); vo.setValue(Double.valueOf(analyseDataTaosVO.getVal()));
} }
vo.setName(signKeyMap.get(record.getSignage())); //vo.setName(signKeyMap.get(record.getSignage()));
vo.setSignage(record.getSignage()); //vo.setSignage(record.getSignage());
vo.setTs(analyseDataTaosVO.getTs()); vo.setTs(analyseDataTaosVO.getTs());
runMonthReportDataVoList.add(vo); runMonthReportDataVoList.add(vo);
} }

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

@ -863,7 +863,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
* @return * @return
*/ */
@Override @Override
public List<AreaScaleVo> areaScale(Long deptId) { public List<OldAreaScaleVo> areaScale(Long deptId) {
// 获取区域或者站点map结构 // 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = this.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); Map<Dept,List<StationEntity>> map = this.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER));
if(MapUtils.isEmpty(map)){ if(MapUtils.isEmpty(map)){
@ -888,9 +888,9 @@ public class SideHustleServiceImpl implements ISideHustleService {
// 获取总发电量 // 获取总发电量
List<String> monList = homePageService.getMonthList(0,12,false); List<String> monList = homePageService.getMonthList(0,12,false);
float sumPower = this.getSumPower(map.values(),powerMap,monList); float sumPower = this.getSumPower(map.values(),powerMap,monList);
List<AreaScaleVo> list = new ArrayList<>(); List<OldAreaScaleVo> list = new ArrayList<>();
map.forEach((key,value)->{ map.forEach((key,value)->{
AreaScaleVo areaScaleVo = new AreaScaleVo(); OldAreaScaleVo areaScaleVo = new OldAreaScaleVo();
areaScaleVo.setDeptId(key.getId()); areaScaleVo.setDeptId(key.getId());
areaScaleVo.setSort(key.getSort()); areaScaleVo.setSort(key.getSort());
areaScaleVo.setDeptName(key.getDeptName()); areaScaleVo.setDeptName(key.getDeptName());
@ -919,7 +919,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
this.getAreaWearther(nowWeather,weekWeather,areaScaleVo,value.get(0).getCode()); this.getAreaWearther(nowWeather,weekWeather,areaScaleVo,value.get(0).getCode());
list.add(areaScaleVo); list.add(areaScaleVo);
}); });
return list.stream().sorted(Comparator.comparing(AreaScaleVo::getSort)).collect(Collectors.toList()); return list.stream().sorted(Comparator.comparing(OldAreaScaleVo::getSort)).collect(Collectors.toList());
} }
@ -1132,7 +1132,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
* @param areaScaleVo * @param areaScaleVo
* @param code * @param code
*/ */
private void getAreaWearther(Map<String, HeWeatherWeatherNowResponse> nowWeather, Map<String, HeWeatherWeatherDailyResponse> weekWeather, AreaScaleVo areaScaleVo, String code) { private void getAreaWearther(Map<String, HeWeatherWeatherNowResponse> nowWeather, Map<String, HeWeatherWeatherDailyResponse> weekWeather, OldAreaScaleVo areaScaleVo, String code) {
// 实时天气 // 实时天气
if(MapUtils.isNotEmpty(nowWeather) && nowWeather.containsKey(code)){ if(MapUtils.isNotEmpty(nowWeather) && nowWeather.containsKey(code)){
HeWeatherWeatherNowResponse nowData = nowWeather.get(code); HeWeatherWeatherNowResponse nowData = nowWeather.get(code);

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

@ -63,7 +63,7 @@ public class WaterServiceImpl implements IWaterService {
private final UseService useService; private final UseService useService;
private final IHomePageService homePageService; private final AreaService areaService;
private final IStationService stationService; private final IStationService stationService;
@ -71,8 +71,6 @@ public class WaterServiceImpl implements IWaterService {
private final IAnalyseDataService analyseDataService; private final IAnalyseDataService analyseDataService;
private final ISideHustleService sideHustleService;
private final IMainSystemMonitoringService maintenanceTaskService; private final IMainSystemMonitoringService maintenanceTaskService;
private final IHzimsAnalyzeModelStationService modelStationService; private final IHzimsAnalyzeModelStationService modelStationService;
@ -291,7 +289,19 @@ public class WaterServiceImpl implements IWaterService {
* @return * @return
*/ */
private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) { private Map<Integer, String> getWaterLevelMap(String instanceCode, String signage) {
LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER); /**
* FIXME 水位测试数据
*/
Calendar start = Calendar.getInstance();
start.add(Calendar.HOUR_OF_DAY,-start.get(Calendar.HOUR_OF_DAY));
Map<Integer, String> map = new HashMap<>();
Random random = new Random();
while (start.getTime().compareTo(new Date()) <= 0){
map.put(start.get(Calendar.HOUR_OF_DAY),String.valueOf(random.nextDouble() * 500));
start.add(Calendar.HOUR_OF_DAY,1);
}
return map;
/*LocalDateTime beginTime = LocalDateTime.parse(DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00"), DateUtil.DATETIME_FORMATTER);
LocalDateTime endTime = LocalDateTime.now(); LocalDateTime endTime = LocalDateTime.now();
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO(); AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>(); List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
@ -324,7 +334,7 @@ public class WaterServiceImpl implements IWaterService {
return "0"; return "0";
} }
return value.getVal(); return value.getVal();
})); }));*/
} }
/** /**
@ -894,7 +904,7 @@ public class WaterServiceImpl implements IWaterService {
public List<WaterDetailsVo> waterDetails(Long deptId) { public List<WaterDetailsVo> waterDetails(Long deptId) {
// 获取区域map : key-区域机构 value-水利站点集合 // 获取区域map : key-区域机构 value-水利站点集合
// 获取区域或者站点map结构 // 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = sideHustleService.getAreaOrStaion(deptId,HomePageConstant.waterList); Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,HomePageConstant.waterList);
if(MapUtils.isEmpty(map)){ if(MapUtils.isEmpty(map)){
return null; return null;
} }
@ -939,7 +949,7 @@ public class WaterServiceImpl implements IWaterService {
@Override @Override
public List<WaterRankingVo> waterUseEleRanking(Long deptId) { public List<WaterRankingVo> waterUseEleRanking(Long deptId) {
// 获取区域map : key-区域机构 value-水利站点集合 // 获取区域map : key-区域机构 value-水利站点集合
Map<Dept,List<StationEntity>> map = this.getAreaMap(deptId); Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,HomePageConstant.waterList);
if(MapUtils.isEmpty(map)){ if(MapUtils.isEmpty(map)){
return null; return null;
} }
@ -1310,7 +1320,7 @@ public class WaterServiceImpl implements IWaterService {
//double yearRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)).get().getRunDurationYear(); //double yearRunTime = validTaget.stream().max(Comparator.comparing(WaterPumpTargetVo::getRunDurationYear)).get().getRunDurationYear();
response.setRunDurationYear(yearRunTime); response.setRunDurationYear(yearRunTime);
// 水位曲线/年用电量 // 水位曲线/年用电量
List<String> monList = homePageService.getMonthList(0,12,false); List<String> monList = this.mons(0,12,false);
List<WaterLevelPowerYearVo> waterLevelPowerYearVoList = new ArrayList<>(); List<WaterLevelPowerYearVo> waterLevelPowerYearVoList = new ArrayList<>();
monList.forEach(mon->{ monList.forEach(mon->{
WaterLevelPowerYearVo WPYearVo = new WaterLevelPowerYearVo(); WaterLevelPowerYearVo WPYearVo = new WaterLevelPowerYearVo();
@ -1326,6 +1336,36 @@ public class WaterServiceImpl implements IWaterService {
} }
/** /**
* 获取近年月份集合
* @param year
* @return
*/
public List<String> mons(int year, int endMoth, boolean nextMon) {
List<String> list = new ArrayList<>();
// 开始日期
Calendar endCal = Calendar.getInstance();
endCal.setTime(new Date());
endCal.add(Calendar.MONTH, -endCal.get(Calendar.MONTH) + endMoth);
endCal.add(Calendar.DATE, -endCal.get(Calendar.DATE) + 1);
// 结束日期
Calendar startCal = Calendar.getInstance();
startCal.setTime(new Date());
startCal.set(Calendar.YEAR, startCal.get(Calendar.YEAR) - year);
startCal.add(Calendar.MONTH, -startCal.get(Calendar.MONTH));
startCal.add(Calendar.DATE, -startCal.get(Calendar.DATE) + 1);
// 获取日期之间的月份
while (endCal.after(startCal)) {
list.add(DateUtil.format(startCal.getTime(),DateUtil.PATTERN_DATE));
startCal.add(Calendar.MONTH, 1);
}
if(nextMon){
list.add(DateUtil.format(endCal.getTime(),DateUtil.PATTERN_DATE));
}
return list;
}
/**
* 区域(泵站利用率容量利用率) * 区域(泵站利用率容量利用率)
* @param value * @param value
* @param vo * @param vo
@ -1517,58 +1557,5 @@ public class WaterServiceImpl implements IWaterService {
return null; return null;
} }
/**
* 获取区域节点 key-区域对象 value-站点集合
* @param deptId
* @return
*/
private Map<Dept, List<StationEntity>> getAreaMap(Long deptId) {
//根据用户权限获取机构
R<List<Dept>> R = sysClient.getDeptByCurrentUser();
if (!R.isSuccess() || ObjectUtil.isEmpty(R.getData())) {
return null;
}
Dept title = this.getTitleDetp(deptId);
if(ObjectUtil.isEmpty(title)){
return null;
}
Integer type = title.getDeptCategory();
if(ObjectUtil.isEmpty(type)){
return null;
}
Map<Dept,List<StationEntity>> map = new HashMap<>();
switch (type){
case 1:
case 2:
this.areaMapHandle(R.getData(),title.getId(),map);
break;
case 3:
List<StationEntity> stationList = stationService.getStationList(R.getData(),title.getId(),HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stationList)){
return null;
}
map.put(title,stationList);
break;
default:
return null;
}
return map;
}
/**
* 区域map处理
* @param deptList
* @param deptId
* @param map
*/
private void areaMapHandle(List<Dept> deptList,Long deptId,Map<Dept,List<StationEntity>> map) {
List<Dept> list = homePageService.getChildArea(deptList,deptId,new ArrayList<>());
list.forEach(dept->{
List<StationEntity> stationList = stationService.getStationList(deptList,dept.getId(),HomePageConstant.waterList,HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stationList)){
return;
}
map.put(dept,stationList);
});
}
} }

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/ImsDeptController.java

@ -15,7 +15,6 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IImsDeptService.java

@ -28,5 +28,5 @@ public interface IImsDeptService extends IService<ImsDeptEntity> {
List<DeptTreeVo> getHydropowerTree(Integer stationType,Integer serveType); List<DeptTreeVo> getHydropowerTree(Integer stationType,Integer serveType);
List<AreaTypeVo> getTypeArea(Integer typeArea,Long deptId); List<AreaTypeVo> getTypeArea(Integer typeArea, Long deptId);
} }

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java

@ -1,7 +1,6 @@
package com.hnac.hzims.operational.station.service.impl; package com.hnac.hzims.operational.station.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.service.IWaterService; import com.hnac.hzims.operational.main.service.IWaterService;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.ImsDeptEntity; import com.hnac.hzims.operational.station.entity.ImsDeptEntity;
@ -36,8 +35,9 @@ import java.util.stream.Collectors;
public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity> implements IImsDeptService { public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity> implements IImsDeptService {
private final ISysClient sysClient; private final ISysClient sysClient;
private final IStationService stationService; private final IStationService stationService;
private final IHomePageService homePageService;
private final IWaterService waterService; private final IWaterService waterService;
@ -359,7 +359,34 @@ public class ImsDeptServiceImpl extends ServiceImpl<ImsDeptMapper, ImsDeptEntity
return Collections.singletonList(dept.getId()); return Collections.singletonList(dept.getId());
} }
// 获取传参有效区域 // 获取传参有效区域
List<Dept> paramList = homePageService.getChildArea(list,dept.getId(),new ArrayList<>()); List<Dept> paramList = this.child(list,dept.getId(),new ArrayList<>());
return paramList.stream().map(Dept::getId).collect(Collectors.toList()); return paramList.stream().map(Dept::getId).collect(Collectors.toList());
} }
/**
* 递归取子区域
* @param departList
* @param deptId
* @param list
* @return
*/
private List<Dept> child(List<Dept> departList, Long deptId, List<Dept> list) {
if (ObjectUtil.isEmpty(deptId) || CollectionUtil.isEmpty(departList)) {
return null;
}
departList.forEach(dept -> {
Integer type = dept.getDeptCategory();
if(ObjectUtil.isEmpty(type) || type.equals(HomePageConstant.STATION)){
return;
}
if(dept.getParentId().equals(deptId)){
if (dept.getDeptCategory().equals(HomePageConstant.AREA)) {
list.add(dept);
}
child(departList, dept.getId(), list);
}
});
return list;
}
} }

Loading…
Cancel
Save