Browse Source

#光伏首页

zhongwei
yang_shj 2 years ago
parent
commit
e8175e2fad
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  2. 17
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicPowerVo.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicRealVo.java
  4. 39
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicTargetVo.java
  5. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/SubordinateVo.java
  6. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  7. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
  8. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  9. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java
  10. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java
  11. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java
  12. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StFocusPropertiesServiceImpl.java
  13. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java
  14. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/PVAppMainController.java
  15. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/PhotovoltaicController.java
  16. 10
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  17. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IHomePageService.java
  18. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/PhotovoltaicService.java
  19. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AppHomeServiceImpl.java
  21. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaMonthReportServiceImpl.java
  22. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaServiceImpl.java
  23. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  24. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java
  25. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PVAppMainServiceImpl.java
  26. 521
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  27. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  28. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WaterServiceImpl.java
  29. 12
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java
  30. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java
  31. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/ImsDeptServiceImpl.java
  32. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java
  33. 3
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/maintenance/constants/HomePageConstant.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java

@ -1,4 +1,4 @@
package com.hnac.hzims.operational.maintenance.constants;
package com.hnac.hzims.operational.main.constant;
import java.util.Arrays;
import java.util.List;
@ -175,6 +175,10 @@ public interface HomePageConstant {
/**遥信1**/
String PV_JOINT_RELAY = "joint_relay";
/*==========================================================================================*/
// 光伏指标属性
String PHOTOVOLTAIC_GENERATE = "generation_capacity"; // 发电量
String PHOTOVOLTAIC_LOAD = "active_power"; // 功率
/*==========================================================================================*/
// 水电集团、区域指标关联
/**功率**/
Integer POWER = 0;

17
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicPowerVo.java

@ -0,0 +1,17 @@
package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "当日机组有功功率")
public class PhotovoltaicPowerVo {
@ApiModelProperty(value = "小时")
private String hour;
@ApiModelProperty(value = "有功功率")
private String activePower;
}

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

@ -56,7 +56,7 @@ public class PhotovoltaicRealVo {
private Double deforest;
@ApiModelProperty(value = "功率: kW")
private Double power;
private Double load;
@ApiModelProperty(value = "收益:1kwh = 0.3 ~ 0.425人名币")
private Double income;

39
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicTargetVo.java

@ -0,0 +1,39 @@
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 PhotovoltaicTargetVo {
@ApiModelProperty(value = "机构Id")
private Long deptId;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "设备Code")
private String deviceCode;
@ApiModelProperty(value = "设备名称")
private String deviceName;
@ApiModelProperty(value = "当年发电量")
private Float powerYear;
@ApiModelProperty(value = "当月发电量")
private Float powerMon;
@ApiModelProperty(value = "当日发电量")
private Float powerDay;
@ApiModelProperty(value = "当日机组有功功率")
private List<PhotovoltaicPowerVo> activePowerVoList;
@ApiModelProperty(value = "近30天用电量")
private List<GenerationPowerVo> generationPowerVoList;
}

31
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/SubordinateVo.java

@ -26,7 +26,10 @@ public class SubordinateVo {
private String deptName;
@ApiModelProperty(value = "地市编码")
private String code;
private String areaCode;
@ApiModelProperty(value = "地市名称")
private String areaName;
@ApiModelProperty("经度(东经)")
@JsonSerialize(nullsUsing = NullSerializer.class)
@ -36,22 +39,30 @@ public class SubordinateVo {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Float lttd;
@ApiModelProperty(value = "发电占比")
@ApiModelProperty(value = "容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double areaMakeUp;
private Double capacity;
@ApiModelProperty(value = "功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
@ApiModelProperty(value = "发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generation;
@ApiModelProperty(value = "电站利用率")
@ApiModelProperty(value = "发电占比")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double stationUse;
private Double generationRate;
@ApiModelProperty(value = "容量利用率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double capacityUse;
@ApiModelProperty(value = "电站利用率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double stationUse;
@ApiModelProperty(value = "站点实时温度")
private String temp;
@ -60,4 +71,14 @@ public class SubordinateVo {
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "站点数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long stationCount;
@ApiModelProperty(value = "站点使用数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Long stationUseCount;
}

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

@ -12,7 +12,7 @@ import com.hnac.hzims.equipment.mapper.EmInfoMapper;
import com.hnac.hzims.equipment.mapper.EmInfoNoScopeMapper;
import com.hnac.hzims.equipment.service.*;
import com.hnac.hzims.equipment.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.feign.IStationClient;
import com.hnac.hzims.util.TableJsonUtils;

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java

@ -6,7 +6,7 @@ import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.AbnormalAlarmMapper;
import com.hnac.hzims.operational.alert.service.AbnormalAlarmService;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;

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

@ -14,8 +14,7 @@ import com.hnac.hzims.operational.alert.vo.AlarmDataVo;
import com.hnac.hzims.operational.alert.vo.AlarmParamVo;
import com.hnac.hzims.operational.alert.vo.AlarmReustVo;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.main.vo.WaterMonDataVo;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo;

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -3,16 +3,11 @@ package com.hnac.hzims.operational.census.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.entity.EmInfoEntity;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EmInfoExtendVo;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.service.IOperAccessStatisticsService;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.access.vo.OperAccessStatisticsVO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.constants.CensusConstant;
import com.hnac.hzims.operational.census.service.TargetService;
@ -24,7 +19,7 @@ import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
@ -33,7 +28,6 @@ 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 io.swagger.models.auth.In;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.mp.support.Query;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java

@ -1,8 +1,7 @@
package com.hnac.hzims.operational.config.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.operational.config.service.CentralMonitorService;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.RealStationVo;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java

@ -8,7 +8,6 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.equipment.feign.IEmInfoClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.fdp.feign.IFdpMonitorClient;
@ -23,7 +22,6 @@ import com.hnac.hzims.operational.config.service.StFocusPropertiesService;
import com.hnac.hzims.operational.config.vo.*;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.vo.SoeDataVo;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.util.ExcelUtil;
@ -50,7 +48,6 @@ import org.springblade.system.user.feign.IUserClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StFocusPropertiesServiceImpl.java

@ -1,7 +1,6 @@
package com.hnac.hzims.operational.config.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -14,7 +13,7 @@ import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity;
import com.hnac.hzims.operational.config.mapper.StFocusPropertiesMapper;
import com.hnac.hzims.operational.config.service.StFocusPropertiesService;
import com.hnac.hzims.operational.config.vo.StationRealVo;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationAttributeService;
@ -34,7 +33,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/data/service/impl/HzimsDataServiceImpl.java

@ -6,11 +6,10 @@ import com.hnac.hzims.operational.data.service.HzimsDataService;
import com.hnac.hzims.operational.data.vo.AreaVo;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.vo.HzimsStationCountVo;
import com.hnac.hzims.operational.util.ExcelUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -22,14 +21,12 @@ import org.springblade.system.feign.ISysClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

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

@ -2,12 +2,10 @@ package com.hnac.hzims.operational.main.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.constants.RedisKeyConstants;
import com.hnac.hzims.operational.main.service.IPVAppMainService;
import com.hnac.hzims.operational.main.vo.pv.DeptRealDataVO;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import io.swagger.annotations.Api;
@ -15,8 +13,6 @@ import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springframework.data.redis.core.RedisTemplate;

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

@ -34,15 +34,15 @@ public class PhotovoltaicController extends BladeController {
@ApiOperation("集团/区域发电量")
@GetMapping("/generation")
@ApiOperationSupport(order = 1)
@ApiOperationSupport(order = 2)
public R generation(@ApiParam(value = "集团/区域机构编号") Long deptId,
@ApiParam(value = "查询类型:0-周 1-月 -2年") Long type) {
@ApiParam(value = "查询类型:0-周 1-月 -2年") String type) {
return R.data(service.generation(deptId,type));
}
@ApiOperation("集团/区域下属数据占比")
@GetMapping("/subordinate")
@ApiOperationSupport(order = 1)
@ApiOperationSupport(order = 3)
public R subordinate(@ApiParam(value = "集团/区域机构编号") Long deptId) {
return R.data(service.subordinate(deptId));
}

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

@ -1,6 +1,7 @@
package com.hnac.hzims.operational.main.scheduled;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
@ -168,12 +170,12 @@ public class ScheduledCreateTask {
* @return ReturnT<String>
*/
@XxlJob(ELECTRICITY_GENERATION_RECENT_YEAR)
//@Scheduled(cron = "0/10 * * * * ? ")
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> powerGenerationRecentYear(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
homePageService.loadPowerData(param,SERVE_TYPE,2);
homePageService.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),SERVE_TYPE,2);
return new ReturnT<>("SUCCESS");
}
@ -294,7 +296,7 @@ public class ScheduledCreateTask {
* @return ReturnT<String>
*/
@XxlJob(LOAD_PHOTOVOLTAIC_TARGET)
//@Scheduled(cron = "0/10 * * * * ? ")
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadPhotovoltaicTarget(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
@ -308,7 +310,7 @@ public class ScheduledCreateTask {
* @return ReturnT<String>
*/
@XxlJob(LOAD_PHOTOVOLTAIC_REAL)
//@Scheduled(cron = "0/10 * * * * ? ")
//@Scheduled(cron = "0/50 * * * * ? ")
public ReturnT<String> loadPhotovoltaicReal(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");

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

@ -15,7 +15,7 @@ public interface IHomePageService {
void loadHydropower(String param, Integer serveType);
// 近年发电量数据
void loadPowerData(String param, Integer serveType, int yearCount);
void loadPowerData(String param,List<Integer> types, Integer serveType, int yearCount);
List<String> getMonthList(int year, int endMoth,boolean nextMon);

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

@ -13,17 +13,17 @@ import java.util.List;
*/
public interface PhotovoltaicService {
// 光伏站指标数据加载
void loadPhotovoltaicTarget(String param);
// 光伏站实时数据加载
void loadPhotovoltaicReal(String param);
// 光伏站指标数据加载
void loadPhotovoltaicTarget(String param);
// 集团/区域关键指标
PhotovoltaicKPIsVo KPIs(Long deptId);
// 集团/区域发电量
List<GenerationVo> generation(Long deptId,Long type);
List<GenerationVo> generation(Long deptId,String type);
// 集团/区域下属数据占比
List<SubordinateVo> subordinate(Long deptId);

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

@ -2,12 +2,10 @@ package com.hnac.hzims.operational.main.service.impl;
import com.google.common.collect.Lists;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.AllArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springframework.stereotype.Service;

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

@ -22,7 +22,7 @@ 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.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;

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

@ -10,7 +10,7 @@ import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
import com.hnac.hzims.operational.main.vo.AreaMonthReportVo;
import com.hnac.hzims.operational.main.vo.MaintainVo;
import com.hnac.hzims.operational.main.vo.OverhaulVo;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.report.vo.DutyDefectVO;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;

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

@ -1,7 +1,7 @@
package com.hnac.hzims.operational.main.service.impl;
import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor;

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

@ -15,7 +15,7 @@ import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.ticket.allTicket.fegin.ITicketInfoAllClient;
@ -222,15 +222,16 @@ public class HomePageServiceImpl implements IHomePageService {
* @param yearCount 近几年
*/
@Override
public void loadPowerData(String param, Integer serveType, int yearCount) {
public void loadPowerData(String param,List<Integer> types, Integer serveType, int yearCount) {
// 站点查询
List<StationEntity> stationList = stationService.getStationType(serveType, Collections.singletonList(HomePageConstant.HYDROPOWER), null);
List<StationEntity> stationList = stationService.getStationType(serveType, types, null);
// 设备信息
List<EminfoAndEmParamVo> equipmentInfoList = maintenanceTaskService.getEmInfoList();
// 存储数据map :<站点id,<月份,发电量>>
Map<Long, Map<String, Float>> powerMap = new HashMap<>();
// 获取需要遍历月份
List<String> monList = this.getMonthList(yearCount, 12,true);
Random random = new Random();
stationList.forEach(station -> {
Long departId = station.getRefDept();
// 获取对应站点设备
@ -455,7 +456,10 @@ public class HomePageServiceImpl implements IHomePageService {
*/
@Override
public float getAnalyzeCodeAndSignages(EminfoAndEmParamVo em, String startTime, String endTime, Integer cycleType, String signages) {
// 发电量
// FIXME 光伏测试
Random random = new Random();
return random.nextFloat() * 250000;
/*// 发电量
float aFloat = 0F;
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
@ -497,7 +501,7 @@ public class HomePageServiceImpl implements IHomePageService {
} else {
aFloat = childFloat;
}
return aFloat;
return aFloat;*/
}
/**
@ -1016,7 +1020,7 @@ public class HomePageServiceImpl implements IHomePageService {
chargeVo.setIncome(data.get("income").toString());
chargeVo.setTotalChargeDegrees(data.get("kilowatt").toString());
redisTemplate.opsForValue().set(CHARGE_SUM,data.get("stationNum").toString());
} catch (IOException ignored) {
} catch (Exception ex) {
chargeVo.setOrder("0");
chargeVo.setChargeDegrees("0");
chargeVo.setIncome("0");

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

@ -11,7 +11,7 @@ import com.hnac.hzims.operational.main.vo.MainWorkBenchExtendVo;
import com.hnac.hzims.operational.main.vo.MainWorkBenchVO;
import com.hnac.hzims.operational.main.vo.RoutingParamVo;
import com.hnac.hzims.operational.main.wrapper.MainWorkBenchWrapper;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import org.apache.commons.collections4.MapUtils;

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PVAppMainServiceImpl.java

@ -1,32 +1,25 @@
package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.hnac.hzims.equipment.entity.EmParamEntity;
import com.hnac.hzims.equipment.entity.WorkshopInfoEntity;
import com.hnac.hzims.equipment.feign.IEmParamClient;
import com.hnac.hzims.equipment.feign.IWorkshopInfoClient;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.constants.RedisKeyConstants;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzims.operational.main.service.IAppMainService;
import com.hnac.hzims.operational.main.service.IPVAppMainService;
import com.hnac.hzims.operational.main.service.IWeatherService;
import com.hnac.hzims.operational.main.vo.pv.AreaRealDataVO;
import com.hnac.hzims.operational.main.vo.pv.DeptRealDataVO;
import com.hnac.hzims.operational.main.vo.pv.WsRealDataVO;
import com.hnac.hzims.operational.maintenance.OperationalContants;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
@ -38,10 +31,8 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDate;
import java.time.Period;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;

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

@ -2,25 +2,34 @@ package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.ISideHustleService;
import com.hnac.hzims.operational.main.service.PhotovoltaicService;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.exception.ServiceException;
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.entity.Dept;
import org.springblade.system.entity.Region;
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.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@ -38,19 +47,33 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
private final IMainSystemMonitoringService deviceService;
private final ISideHustleService sideHustleService;
private final IHomePageService homePageService;
private final IWeatherService weatherService;
private final IWaterService waterService;
private final ISysClient sysClient;
private final RedisTemplate redisTemplate;
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 final static String RECENT_YEAR_POWER_DATA = "hzims:operation:key:power:data";
@Value("${hzims.operation.realIdKey}")
public String real_id_key;
/**
* 光伏站-逆变器指标加载
* 光伏站-逆变器实时加载
* @param param
*/
@Override
public void loadPhotovoltaicTarget(String param) {
public void loadPhotovoltaicReal(String param) {
// 查询设备
List<EminfoAndEmParamVo> devices = this.getPhotovoltaicDevice();
if(CollectionUtil.isEmpty(devices)){
@ -65,6 +88,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
real.setDeptId(device.getCreateDept());
real.setDeviceCode(device.getEmCode());
real.setDeviceName(device.getName());
real.setState(random.nextInt(2)-1);
// 容量
real.setCapacity(device.getInstalledCapacity());
// 年发电量
@ -79,20 +103,226 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
real.setVoltage(random.nextDouble() * 300);
// 电流
real.setCurrent(random.nextDouble() * 300);
// 节约标准煤 tec
// 节约标准煤
real.setTec(real.getGenerationMon() * 0.0001229);
// 二氧化碳减排 co2
// 二氧化碳减排
real.setCo2(real.getGenerationMon() * 0.997);
// 减少森林砍伐 deforest
// 减少森林砍伐
real.setDeforest(real.getGenerationMon() * 0.000553);
// 功率 power
real.setPower(random.nextDouble() * 300);
// 收益 income
// 功率
real.setLoad(random.nextDouble() * 300);
// 收益
real.setIncome(random.nextDouble() * 0.34);
list.add(real);
});
redisTemplate.opsForValue().set(load_photovoltaic_real_key,list);
}
/**
* 光伏站-逆变器指标加载
* @param param
*/
@Override
public void loadPhotovoltaicTarget(String param) {
// 有效设备
List<EminfoAndEmParamVo> devices = this.getPhotovoltaicDevice();
if(CollectionUtil.isEmpty(devices)){
return;
}
List<PhotovoltaicTargetVo> list = new ArrayList<>();
devices.forEach(device->{
PhotovoltaicTargetVo target = new PhotovoltaicTargetVo();
target.setDeptId(device.getCreateDept());
target.setDeviceCode(device.getEmCode());
target.setDeviceName(device.getName());
target.setDeptName(device.getName());
// 当年发电量
float powerYear = this.getGenerationPower(device,0);
target.setPowerYear(powerYear);
// 当月发电量
float powerMon = this.getGenerationPower(device,1);
target.setPowerMon(powerMon);
// 当日发电量
float powerDay = this.getGenerationPower(device,2);
// 当天有功功率
// List<ActivePowerVo> activePowerVoList = waterService.getActivePowerVoList(device);
// FIXME 测试模拟数据
List<PhotovoltaicPowerVo> photovoltaicPowers = this.activePowerVoList(device);
target.setActivePowerVoList(photovoltaicPowers);
// 30天发电量
List<GenerationPowerVo> generationPowerVoList = this.getGenerationPowerList(device);
target.setGenerationPowerVoList(generationPowerVoList);
target.setPowerDay(powerDay);
list.add(target);
});
redisTemplate.opsForValue().set(load_photovoltaic_target_key,list);
}
// FIXME 测试模拟
private List<PhotovoltaicPowerVo> activePowerVoList(EminfoAndEmParamVo device) {
List<String> hours = getTestDay();
Random random = new Random();
return hours.stream().map(hour -> {
PhotovoltaicPowerVo power = new PhotovoltaicPowerVo();
power.setHour(hour);
power.setActivePower(String.valueOf(random.nextDouble() * 500));
return power;
}).collect(Collectors.toList());
}
/**
* 获取年日发电量
* @param device
* @param scope
* @return
*/
private float getGenerationPower(EminfoAndEmParamVo device,int scope) {
// 日期格式化yyyy-mm-dd
SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
// 日期格式化yyyy-mm-dd
SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
String startTime,endTime;
int cycle;
switch (scope){
// 年
case 0:
Calendar calendar = Calendar.getInstance();
endTime = sdf.format(calendar.getTime());
calendar.setTime(new Date());
calendar.add(Calendar.MONTH, -calendar.get(Calendar.MONTH));
calendar.add(Calendar.DATE, -calendar.get(Calendar.DATE) + 1);
startTime = df.format(calendar.getTime()) + " 00:00:00";
cycle = EquipmentConstants.CycleTypeEnum.YEAR_CYCLE.getType();
break;
// 月
case 1:
startTime = DateUtil.format(new Date(), "yyyy-MM") + "-01 00:00:00";
endTime = DateUtil.format(new Date(), DateUtil.PATTERN_DATETIME);
cycle = EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType();
break;
// 日
case 2:
Calendar cal = Calendar.getInstance();
String time = df.format(cal.getTime());
startTime = time + " 00:00:00";
endTime = time + " 23:59:59";
cycle = EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType();
break;
default:
throw new IllegalStateException("Unexpected value: " + scope);
}
return homePageService.getAnalyzeCodeAndSignages(device,startTime,endTime,cycle,HomePageConstant.PHOTOVOLTAIC_GENERATE);
}
/**
* 近30天发电量
* @param device
* @return
*/
private List<GenerationPowerVo> getGenerationPowerList(EminfoAndEmParamVo device) {
List<GenerationPowerVo> generationPowerVoList = new ArrayList<>();
// 近30天日期集合
List<String> dayList = this.getRecent30Day();
for (int i = 0; i < dayList.size() - 1; i++) {
GenerationPowerVo generationPowerVo = new GenerationPowerVo();
generationPowerVo.setDate(dayList.get(i));
// 某天发电量
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),HomePageConstant.PHOTOVOLTAIC_GENERATE);
generationPowerVo.setGenerationPower(power);
generationPowerVoList.add(generationPowerVo);
}
return generationPowerVoList;
}
/**
* 近7天发电量
* @param device
* @return
*/
private List<GenerationPowerVo> getGenerationPowerWeek(EminfoAndEmParamVo device) {
List<GenerationPowerVo> generationPowerVoList = new ArrayList<>();
// 近一周日期集合
List<String> dayList = this.getRecentWeek();
SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
for (int i = 0; i < dayList.size() - 1; i++) {
GenerationPowerVo generationPowerVo = new GenerationPowerVo();
generationPowerVo.setDate(sdf.format(DateUtil.parse(dayList.get(i),DateUtil.PATTERN_DATE)));
// 某天发电量
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),HomePageConstant.PHOTOVOLTAIC_GENERATE);
generationPowerVo.setGenerationPower(power);
generationPowerVoList.add(generationPowerVo);
}
return generationPowerVoList;
}
/**
* 当天功率
* @return
*/
private List<String> getTestDay() {
// 日期格式化yyyy-mm-dd
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.HOUR_OF_DAY, - calendar.get(Calendar.HOUR_OF_DAY));
calendar.add(Calendar.HOUR_OF_DAY, + 1);
list.add(df.format(calendar.getTime()));
// 获取时间
while (calendar.getTime().compareTo(new Date()) <= 0) {
calendar.add(Calendar.HOUR_OF_DAY, + 1);
list.add(df.format(calendar.getTime()));
}
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
}
/**
* 获取近30天集合
* @return
*/
private List<String> getRecentWeek() {
// 日期格式化yyyy-mm-dd
SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, + 1);
list.add(df.format(calendar.getTime()));
// 获取日期之间的月
int i = 0;
while (i < 7) {
calendar.add(Calendar.DATE, - 1);
list.add(df.format(calendar.getTime()));
i++;
}
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
}
/**
* 获取近30天集合
* @return
*/
private List<String> getRecent30Day() {
// 日期格式化yyyy-mm-dd
SimpleDateFormat df = new SimpleDateFormat(DateUtil.PATTERN_DATE);
List<String> list = new ArrayList<>();
// 开始日期
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, + 1);
list.add(df.format(calendar.getTime()));
// 获取日期之间的月
int i = 0;
while (i < 30) {
calendar.add(Calendar.DATE, - 1);
list.add(df.format(calendar.getTime()));
i++;
}
return list.stream().sorted(Comparator.comparing(String::valueOf)).collect(Collectors.toList());
}
/**
@ -128,15 +358,6 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
}
/**
* 光伏站-逆变器实时加载
* @param param
*/
@Override
public void loadPhotovoltaicReal(String param) {
}
/**
* 集团/区域关键指标
* @param deptId
* @return
@ -146,7 +367,7 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
// 查询光伏站点
List<StationEntity> stations = stationService.getHomeStationList(deptId,Collections.singletonList(HomePageConstant.PHOTOVOLTAIC),HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stations)){
return null;
return new PhotovoltaicKPIsVo();
}
// redis实时数据
List<PhotovoltaicRealVo> photovoltaics = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key);
@ -163,27 +384,273 @@ public class PhotovoltaicServiceImpl implements PhotovoltaicService {
kpi.setCount(stations.size());
// 容量
kpi.setInstalledCapacity(devices.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
// 负荷
kpi.setLoad(devices.stream().mapToDouble(PhotovoltaicRealVo::getLoad).sum());
// 年发电量
kpi.setPowerYear(devices.stream().mapToDouble(PhotovoltaicRealVo::getGenerationYear).sum());
// 月发电量
kpi.setPowerMon(devices.stream().mapToDouble(PhotovoltaicRealVo::getGenerationMon).sum());
// 日发电量
kpi.setPowerDay(devices.stream().mapToDouble(PhotovoltaicRealVo::getGenerationDay).sum());
// 节约标准煤
kpi.setTec(devices.stream().mapToDouble(PhotovoltaicRealVo::getTec).sum());
// CO2减排
kpi.setCo2(devices.stream().mapToDouble(PhotovoltaicRealVo::getCo2).sum());
// 减少森林砍伐
kpi.setDeforest(devices.stream().mapToDouble(PhotovoltaicRealVo::getDeforest).sum());
// 近3年发电量
kpi.setPowerYearVoList(this.getPowerList(stations.stream().map(StationEntity::getCode).collect(Collectors.toList())));
return kpi;
}
/**
* 获取近3年发电量
* @return
*/
private List<PowerYearVo> getPowerList(List<String> stations) {
// 站点近年发电数据 key - stationCode value - 月份,发电量
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
if(MapUtils.isEmpty(map)){
return new ArrayList<>();
}
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());
}
/**
* 集团/区域发电量
* @param deptId
* @param type
* @return
*/
@Override
public List<GenerationVo> generation(Long deptId, Long type) {
return null;
public List<GenerationVo> generation(Long deptId, String type) {
// 查询光伏站点
List<StationEntity> stations = stationService.getHomeStationList(deptId,Collections.singletonList(HomePageConstant.PHOTOVOLTAIC),HomePageConstant.HYDROPOWER_SERVETYPE);
if(CollectionUtil.isEmpty(stations)){
return new ArrayList<>();
}
switch (type){
// 周
case "0":
return this.getGeneration(stations.stream().map(StationEntity::getRefDept).distinct().collect(Collectors.toList()),true);
// 月
case "1":
return this.getGeneration(stations.stream().map(StationEntity::getRefDept).distinct().collect(Collectors.toList()),false);
// 年
case "2":
return this.getGenerationYear(stations.stream().map(StationEntity::getId).distinct().collect(Collectors.toList()));
default:
throw new ServiceException("无效查询类型!");
}
}
/**
* 获取发电量(/)
* @return
*/
private List<GenerationVo> getGeneration(List<Long> stations,boolean flag) {
// redis实时数据
List<PhotovoltaicTargetVo> photovoltaics = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtil.isEmpty(photovoltaics)){
return new ArrayList();
}
// 过滤有效光伏设备
List<PhotovoltaicTargetVo> filters = photovoltaics.stream().filter(photovoltaic -> stations.contains(photovoltaic.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filters)){
return new ArrayList<>();
}
// 数据集合
List<GenerationPowerVo> generations = new ArrayList<>();
for (PhotovoltaicTargetVo target : filters){
if(CollectionUtil.isEmpty(target.getGenerationPowerVoList())){
continue;
}
generations.addAll(target.getGenerationPowerVoList());
}
if(CollectionUtil.isEmpty(generations)){
return new ArrayList<>();
}
List<String> weeks = this.getRecentWeek();
// 周
if(flag){
// 根据日期分组
return generations.stream().filter(generation -> weeks.contains(generation.getDate())).collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry->{
GenerationVo generation = new GenerationVo();
generation.setPeriod(entry.getKey());
generation.setPower((float)entry.getValue().stream().mapToDouble(GenerationPowerVo::getGenerationPower).sum());
return generation;
}).sorted(Comparator.comparing(GenerationVo::getPeriod)).collect(Collectors.toList());
}
// 月
return generations.stream().collect(Collectors.groupingBy(GenerationPowerVo::getDate)).entrySet().stream().map(entry->{
GenerationVo generation = new GenerationVo();
generation.setPeriod(entry.getKey());
generation.setPower((float)entry.getValue().stream().mapToDouble(GenerationPowerVo::getGenerationPower).sum());
return generation;
}).sorted(Comparator.comparing(GenerationVo::getPeriod)).collect(Collectors.toList());
}
/**
* 获取发电量()
* @return
*/
private List<GenerationVo> getGenerationYear(List<Long> stations) {
// 站点近年发电数据 key - stationCode value - 月份,发电量
Map<Long, Map<String, Float>> map = (Map<Long, Map<String, Float>>) redisTemplate.opsForValue().get(RECENT_YEAR_POWER_DATA);
if(MapUtils.isEmpty(map)){
return new ArrayList<>();
}
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));
// 总和所有相同月份的发电量
String year = String.valueOf(LocalDate.now().getYear());
return months.entrySet().stream().filter(entry -> entry.getKey().contains(year)).map(entry -> {
GenerationVo generation = new GenerationVo();
generation.setPeriod(entry.getKey());
generation.setPower((float) entry.getValue().stream().mapToDouble(PowerMonthVo::getPower).sum());
return generation;
}).sorted(Comparator.comparing(GenerationVo::getPeriod)).collect(Collectors.toList());
}
/**
* 集团/区域下属数据占比
* @param deptId
* @return
*/
@Override
public List<SubordinateVo> subordinate(Long deptId) {
return null;
// 获取区域或者站点map结构
Map<Dept,List<StationEntity>> map = sideHustleService.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.PHOTOVOLTAIC));
if(MapUtils.isEmpty(map)){
return new ArrayList<>();
}
// redis实时数据
List<PhotovoltaicRealVo> photovoltaics = (List<PhotovoltaicRealVo>) redisTemplate.opsForValue().get(load_photovoltaic_real_key);
if(CollectionUtil.isEmpty(photovoltaics)){
return new ArrayList<>();
}
// 遍历数据
List<SubordinateVo> list = new ArrayList<>();
for (Map.Entry<Dept,List<StationEntity>> entry : map.entrySet()) {
SubordinateVo subordinate = new SubordinateVo();
if(ObjectUtil.isEmpty(entry.getValue())){
continue;
}
subordinate.setDeptId(entry.getKey().getId());
subordinate.setDeptName(entry.getKey().getDeptName());
subordinate.setSort(entry.getKey().getSort());
// 获取第一个站点经纬度、行政编码信息
StationEntity station = entry.getValue().get(0);
subordinate.setLttd(station.getLttd());
subordinate.setLgtd(station.getLgtd());
String areaCode = station.getAreaCode();
subordinate.setAreaCode(areaCode);
if(StringUtil.isEmpty(areaCode)){
continue;
}
String[] arrCode = areaCode.split(",");
R<Region> R = sysClient.getRegion(arrCode[1]);
if (R.isSuccess() && ObjectUtil.isNotEmpty(R.getData())) {
subordinate.setAreaName(R.getData().getName());
}
// 获取实时天气
Map<String, HeWeatherWeatherNowResponse> nowWeather = this.weatherService.getNowWeather(Collections.singletonList(station.getCode()));
if(MapUtils.isNotEmpty(nowWeather)){
subordinate.setTemp(nowWeather.get(station.getCode()).getNow().getTemp());
}
// 获取七天天气
Map<String, HeWeatherWeatherDailyResponse> weekWeather = weatherService.getWeekWeather(Collections.singletonList(station.getCode()));
if(MapUtils.isNotEmpty(weekWeather)){
subordinate.setTemp(nowWeather.get(station.getCode()).getNow().getTemp());
}
subordinate.setWeather(weekWeather.get(station.getCode()).getDaily());
// 区域/站点 设备集合
List<PhotovoltaicRealVo> devices = photovoltaics.stream().filter(photovoltaic -> entry.getValue().stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(photovoltaic.getDeptId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(devices)){
subordinate.setGeneration(devices.stream().mapToDouble(PhotovoltaicRealVo::getGenerationYear).sum());
subordinate.setStationCount(Long.valueOf(entry.getValue().size()));
subordinate.setStationUseCount(devices.stream().filter(device -> HomePageConstant.OFF.equals(device.getState())).map(PhotovoltaicRealVo::getDeptId).distinct().count());
subordinate.setCapacity(devices.stream().mapToDouble(PhotovoltaicRealVo::getCapacity).sum());
subordinate.setLoad(devices.stream().mapToDouble(PhotovoltaicRealVo::getLoad).sum());
}
list.add(subordinate);
}
if(CollectionUtil.isEmpty(list)){
return new ArrayList<>();
}
// 总数据 : 发电量 、 容量 、 电站数
Double sumGeneration = list.stream().mapToDouble(SubordinateVo::getGeneration).sum();
Double sumLoad = list.stream().mapToDouble(SubordinateVo::getCapacity).sum();
Double sumStationCount = list.stream().mapToDouble(SubordinateVo::getStationCount).sum();
// 计算 :集团发电占比 电站利用率 容量利用率
return list.stream().map(subordinate ->{
if (Math.abs(sumGeneration) <= 0) {
subordinate.setGenerationRate(0.0);
} else {
subordinate.setGenerationRate(BigDecimal.valueOf(subordinate.getGeneration() / sumGeneration * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
if (Math.abs(sumLoad) <= 0) {
subordinate.setCapacityUse(0.0);
} else {
subordinate.setCapacityUse(BigDecimal.valueOf(subordinate.getLoad() / sumLoad * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
if (Math.abs(sumStationCount) <= 0) {
subordinate.setStationUse(0.0);
} else {
subordinate.setStationUse(BigDecimal.valueOf(subordinate.getStationUseCount() / sumStationCount * 100L).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
}
return subordinate;
}).sorted(Comparator.comparing(SubordinateVo::getCapacity)).collect(Collectors.toList());
}
}

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

@ -16,18 +16,16 @@ import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.operational.access.constants.AccessConstants;
import com.hnac.hzims.operational.access.entity.OperAccessTaskEntity;
import com.hnac.hzims.operational.access.service.IOperAccessTaskService;
import com.hnac.hzims.operational.config.entity.DataSet;
import com.hnac.hzims.operational.defect.constants.DefectConstant;
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.vo.DutyInfoVo;
import com.hnac.hzims.operational.duty.vo.DutyTaskVo;
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo;
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant;
import com.hnac.hzims.operational.maintenance.entity.OperMaintenanceTaskEntity;
import com.hnac.hzims.operational.maintenance.service.IOperMaintenanceTaskService;

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

@ -11,7 +11,7 @@ import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.hzimsweather.vo.RainFallCountByMonthVo;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.HzimsAnalyzeModelStationEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IHzimsAnalyzeModelStationService;

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

@ -9,11 +9,9 @@ import com.hnac.hzims.equipment.vo.PlanPowerYearVo;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse;
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherNowResponse;
import com.hnac.hzims.hzimsweather.response.weather.Now;
import com.hnac.hzims.hzimsweather.vo.DailyHeWeatherVo;
import com.hnac.hzims.operational.main.service.*;
import com.hnac.hzims.operational.main.vo.*;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService;
@ -160,13 +158,13 @@ public class WebHomeServiceImpl implements IWebHomeService {
targetVo.setDeviceCode(device.getEmCode());
targetVo.setDeviceName(device.getName());
targetVo.setDeptName(device.getName());
// 当年电量
// 当年电量
float powerYear = this.getGenerationPower(device,0);
targetVo.setPowerYear(powerYear);
// 当月电量
// 当月电量
float powerMon = this.getGenerationPower(device,1);
targetVo.setPowerMon(powerMon);
// 当日电量
// 当日电量
float powerDay = this.getGenerationPower(device,2);
// 当天有功功率
List<ActivePowerVo> activePowerVoList = waterService.getActivePowerVoList(device);
@ -322,7 +320,7 @@ public class WebHomeServiceImpl implements IWebHomeService {
for (int i = 0; i < dayList.size() - 1; i++) {
GenerationPowerVo generationPowerVo = new GenerationPowerVo();
generationPowerVo.setDate(dayList.get(i));
// 某天电量
// 某天电量
float power = homePageService.getAnalyzeCodeAndSignages(device, dayList.get(i) + " 00:00:00", dayList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.DAY_CYCLE.getType(),HomePageConstant.HYDROPOWER_GENERATE_POWER);
generationPowerVo.setGenerationPower(power);
generationPowerVoList.add(generationPowerVo);

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/DeptServiceImpl.java

@ -1,13 +1,8 @@
package com.hnac.hzims.operational.report.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.report.service.IDeptService;
import com.hnac.hzims.operational.station.service.IStationAttributeService;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzims.operational.station.service.impl.StationAttributeServiceImpl;
import com.hnac.hzims.operational.station.service.impl.StationServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
@ -17,7 +12,6 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.vo.DeptVO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -31,8 +25,6 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import static io.protostuff.MapSchema.MessageFactories.ConcurrentHashMap;
/**
* @author hx
*/

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

@ -3,7 +3,7 @@ package com.hnac.hzims.operational.station.service.impl;
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.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.ImsDeptEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.mapper.ImsDeptMapper;

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

@ -20,8 +20,7 @@ import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.IWeatherService;
import com.hnac.hzims.operational.main.vo.JointRelayVo;
import com.hnac.hzims.operational.main.vo.WaterLevelVo;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IRealMonitorService;
@ -32,8 +31,6 @@ import com.hnac.hzims.operational.station.vo.RealAttributeVo;
import com.hnac.hzims.operational.station.vo.RealDeviceVo;
import com.hnac.hzims.operational.station.vo.RealStationVo;
import com.hnac.hzims.operational.station.vo.WeatherVo;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -56,7 +53,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
import java.util.stream.Stream;

3
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -7,10 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.service.UserAuthDataService;
import com.hnac.hzims.fdp.feign.IQuestionClient;
import com.hnac.hzims.operational.OperationalConstants;
import com.hnac.hzims.operational.data.service.HzimsDataService;
import com.hnac.hzims.operational.main.vo.StationCountVo;
import com.hnac.hzims.operational.station.StationConstants;
import com.hnac.hzims.operational.maintenance.constants.HomePageConstant;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.ControlUsersEntity;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.mapper.ControlUsersMapper;

Loading…
Cancel
Save