Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
tyty 2 years ago
parent
commit
b099a055cf
  1. 21
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/constant/HomePageConstant.java
  2. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/GenerationPowerVo.java
  3. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/GenerationVo.java
  4. 21
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceStateVo.java
  5. 5
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicDeviceVo.java
  6. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicLoadGenerateVo.java
  7. 31
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicLoadVo.java
  8. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicPowerVo.java
  9. 75
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationAppVo.java
  10. 91
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicSubordinateAppVo.java
  11. 2
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicSubordinateVo.java
  12. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/HistoryAbnormalAlarmServiceImpl.java
  13. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/PhotovoltaicController.java
  14. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java
  15. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/IAnalyseDataService.java
  16. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/PhotovoltaicService.java
  17. 99
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AnalyseDataServiceImpl.java
  18. 71
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomePageServiceImpl.java
  19. 772
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/PhotovoltaicServiceImpl.java
  20. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  21. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WebHomeServiceImpl.java
  22. 41
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

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

@ -61,7 +61,8 @@ public interface HomePageConstant {
List<String> SIGNAGES = Arrays.asList(HomePageConstant.JOINT_RELAY,HomePageConstant.SWITCH_ON_OFF,HomePageConstant.ELECTRICITY_CONSUMPTION,
HomePageConstant.ACTIVE_POWER,HomePageConstant.REACTIVE_POWER,HomePageConstant.POWER_FACTOR,HomePageConstant.VOLTAGE,HomePageConstant.CURRENT,
HomePageConstant.HYDROPOWER_GENERATE_POWER,HomePageConstant.HYDROPOWER_POWERFACTOR,HomePageConstant.HYDROPOWER_FREQUENCY,HomePageConstant.HYDROPOWER_GUIDEOPEN,
HomePageConstant.HYDROPOWER_VOLTAGE,HomePageConstant.HYDROPOWER_CURRENT,HomePageConstant.UNIT_SPEED,HomePageConstant.ACTIVE_POWER_GIVEN,HomePageConstant.REACTIVE_POWER_GIVEN);
HomePageConstant.HYDROPOWER_VOLTAGE,HomePageConstant.HYDROPOWER_CURRENT,HomePageConstant.UNIT_SPEED,HomePageConstant.ACTIVE_POWER_GIVEN,HomePageConstant.REACTIVE_POWER_GIVEN,
HomePageConstant.PV_GENERATION_DAY);
/**
* 站点类型 运维服务
@ -168,16 +169,26 @@ public interface HomePageConstant {
String P_ATTRIBUTES = "P";
/*==========================================================================================*/
// 光伏电站-电表-物模型监测点标识
/**开关机状态**/
String PV_JOINT_RELAY = "joint_relay";
/**总有功电度**/
String PV_GENERATION_CAPACITY = "generation_capacity";
/**日发电量**/
String PV_GENERATION_DAY = "generate_day";
/**有功功率**/
String PV_LOAD = "active_power";
/**正向无功**/
String PV_REACTIVE_POWER = "reactive_power";
/**遥信1**/
String PV_JOINT_RELAY = "joint_relay";
/**电压**/
String PV_VOLTAGE = "voltage";
/**电流**/
String PV_CURRENT = "current";
/*==========================================================================================*/
// 光伏指标属性
String PHOTOVOLTAIC_GENERATE = "generation_capacity"; // 发电量
String PHOTOVOLTAIC_LOAD = "active_power"; // 功率
String PHOTOVOLTAIC_OFF = "1.0"; // 开机
String PHOTOVOLTAIC_LOAD_TARGET = "0";
/*==========================================================================================*/
// 水电集团、区域指标关联
/**功率**/

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

@ -12,5 +12,8 @@ public class GenerationPowerVo {
private String date;
@ApiModelProperty(value = "发电量")
private Float generationPower;
private Float generate;
@ApiModelProperty(value = "功率·")
private Float load;
}

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

@ -17,6 +17,6 @@ public class GenerationVo {
@ApiModelProperty(value = "周期")
private String period;
@ApiModelProperty(value = "发电量")
@ApiModelProperty(value = "发电量")
private Float power;
}

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

@ -0,0 +1,21 @@
package com.hnac.hzims.operational.main.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/04/03 16:57:22
* @version 4.0.0
*/
@Data
@ApiModel(value = "光伏站点设备状态对象")
public class PhotovoltaicDeviceStateVo {
@ApiModelProperty(value = "设备装态 : 0 - 离线 1 - 在线 2 - 故障")
private Integer state;
@ApiModelProperty(value = "数量")
private Integer count;
}

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

@ -75,6 +75,11 @@ public class PhotovoltaicDeviceVo {
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double tec;
@ApiModelProperty(value = "减少森林砍伐:1kwh = 0.000553")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double deforest;
@ApiModelProperty(value = "收益: 元")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double income;

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

@ -0,0 +1,31 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author ysj
* @date 2023/03/29 15:14:34
* @version 4.0.0
*/
@Data
@ApiModel(value = "水利站点首页对象")
public class PhotovoltaicLoadGenerateVo {
@ApiModelProperty(value = "周期")
private String period;
@ApiModelProperty(value = "数据值")
private Float value;
}

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

@ -0,0 +1,31 @@
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.ApiModelProperty;
import lombok.Data;
/**
* @author ysj
* @date 2023/04/04 09:28:34
* @version 4.0.0
*/
@Data
@ApiModel(value = "发电量数据")
public class PhotovoltaicLoadVo {
@ApiModelProperty(value = "机构ID")
private Long deptId;
@ApiModelProperty(value = "站点编码")
private String code;
@ApiModelProperty(value = "站点名称")
private String name;
@ApiModelProperty(value = "实时功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
}

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

@ -10,7 +10,7 @@ import lombok.Data;
public class PhotovoltaicPowerVo {
@ApiModelProperty(value = "小时")
private String hour;
private Integer hour;
@ApiModelProperty(value = "有功功率")
private String activePower;

75
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicStationAppVo.java

@ -0,0 +1,75 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.hzimsweather.response.weather.Daily;
import com.hnac.hzims.hzimsweather.response.weather.Now;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.DateUtil;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
/**
* @author ysj
* @date 2023/03/29 15:14:34
* @version 4.0.0
*/
@Data
@ApiModel(value = "光伏站点首页对象")
public class PhotovoltaicStationAppVo {
@ApiModelProperty(value = "机构Id")
private Long deptId;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "站点编码")
private String stationCode;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "总发电负荷")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
@ApiModelProperty(value = "日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDay;
@ApiModelProperty(value = "月发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateMon;
@ApiModelProperty(value = "总发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generate;
@ApiModelProperty(value = "天气")
private Now now;
@ApiModelProperty(value = "站点收益")
private Double income;
@ApiModelProperty(value = "co2减排: kg")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double co2;
@ApiModelProperty(value = "节约标准煤减排: kt")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double tec;
@ApiModelProperty(value = "减少森林砍伐:1kwh = 0.000553")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double deforest;
@ApiModelProperty(value = "减少森林砍伐:1kwh = 0.000553")
@JsonSerialize(nullsUsing = NullSerializer.class)
private List<PhotovoltaicDeviceStateVo> deviceState;
}

91
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicSubordinateAppVo.java

@ -0,0 +1,91 @@
package com.hnac.hzims.operational.main.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.hnac.hzims.hzimsweather.response.weather.Now;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @author ysj
* @date 2023/03/24 09:58:57
* @version 4.0.0
*/
@Data
@ApiModel(value = "发电量数据")
public class PhotovoltaicSubordinateAppVo {
@ApiModelProperty(value = "机构ID")
private Long deptId;
@ApiModelProperty(value = "机构名称")
private String deptName;
@ApiModelProperty(value = "天气")
private Now now;
@ApiModelProperty(value = "地址")
private String address;
@ApiModelProperty(value = "容量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double capacity;
@ApiModelProperty(value = "今日发电量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double generateDay;
@ApiModelProperty(value = "实时功率")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Double load;
@ApiModelProperty(value = "站点实时功率列表")
private List<PhotovoltaicLoadVo> stationLoads;
@ApiModelProperty(value = "日常任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer maintenanceCount;
@ApiModelProperty(value = "日常任务完成数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer maintenanceFinishCount;
@ApiModelProperty(value = "缺陷任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer defectCount;
@ApiModelProperty(value = "缺陷任务完成数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer defectFinishCount;
@ApiModelProperty(value = "检修任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer overhaulCount;
@ApiModelProperty(value = "检修任务完成数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer overhaulFinishCount;
@ApiModelProperty(value = "操作票任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer operateCount;
@ApiModelProperty(value = "操作票任务完成数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer operateFinishCount;
@ApiModelProperty(value = "操作票任务数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer workCount;
@ApiModelProperty(value = "操作票任务完成数量")
@JsonSerialize(nullsUsing = NullSerializer.class)
private Integer workFinishCount;
@ApiModelProperty(value = "排序")
private Integer sort;
}

2
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/SubordinateVo.java → hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/PhotovoltaicSubordinateVo.java

@ -17,7 +17,7 @@ import java.util.List;
*/
@Data
@ApiModel(value = "发电量数据")
public class SubordinateVo {
public class PhotovoltaicSubordinateVo {
@ApiModelProperty(value = "机构ID")
private Long deptId;

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

@ -270,6 +270,7 @@ public class HistoryAbnormalAlarmServiceImpl extends BaseServiceImpl<HistoryAbno
return record;
}).sorted(Comparator.comparing(AlarmDataVo::getIsHandle)
.thenComparing(AlarmDataVo::getTs, Comparator.reverseOrder())).collect(Collectors.toList());
response.setCount(datas.size());
response.setSoeList(datas);
response.setTotal(result.getData().getTotal());

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

@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
public class PhotovoltaicController extends BladeController {
private final PhotovoltaicService service;
@ApiLog
@ApiOperation("集团/区域关键指标")
@GetMapping("/KPIs")
@ -32,6 +33,7 @@ public class PhotovoltaicController extends BladeController {
public R KPIs(@ApiParam(value = "集团/区域机构编号") Long deptId) {
return R.data(service.KPIs(deptId));
}
@ApiLog
@ApiOperation("集团/区域发电量")
@GetMapping("/generation")
@ -40,6 +42,7 @@ public class PhotovoltaicController extends BladeController {
@ApiParam(value = "查询类型:0-周 1-月 -2年") String type) {
return R.data(service.generation(deptId, type));
}
@ApiLog
@ApiOperation("集团/区域下属数据占比")
@GetMapping("/subordinate")
@ -54,4 +57,31 @@ public class PhotovoltaicController extends BladeController {
public R station(@ApiParam(value = "站点机构ID") Long deptId) {
return R.data(service.station(deptId));
}
@ApiLog
@ApiOperation("App区域下属数据")
@GetMapping("/app_subordinate")
@ApiOperationSupport(order = 3)
public R app_subordinate(@ApiParam(value = "区域/站点机构编号") Long deptId) {
return R.data(service.app_subordinate(deptId));
}
@ApiLog
@ApiOperation("App光伏站点数据")
@GetMapping("/app_station")
@ApiOperationSupport(order = 3)
public R app_station(@ApiParam(value = "区域/站点机构编号") Long deptId) {
return R.data(service.app_station(deptId));
}
@ApiLog
@ApiOperation("App功率/发电量查询")
@GetMapping("/app_load_generate")
@ApiOperationSupport(order = 3)
public R app_load_generate(@ApiParam(value = "区域/站点机构编号") Long deptId,
@ApiParam(value = "数据类型: 0 - 功率 1 - 发电量") String type,
@ApiParam(value = "查询类型: 0 - 日 1 - 周 2 - 月 3 - 年") String queryType) {
return R.data(service.app_load_generate(deptId,type,queryType));
}
}

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

@ -175,7 +175,7 @@ public class ScheduledCreateTask {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
homePageService.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),SERVE_TYPE,2);
homePageService.loadPowerData(param, Arrays.asList(HomePageConstant.HYDROPOWER,HomePageConstant.PHOTOVOLTAIC),SERVE_TYPE,3);
return new ReturnT<>("SUCCESS");
}
@ -292,30 +292,30 @@ public class ScheduledCreateTask {
}
/**
* 光伏站-逆变器指标加载
* 光伏站-逆变器实时加载
* @return ReturnT<String>
*/
@XxlJob(LOAD_PHOTOVOLTAIC_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadPhotovoltaicTarget(String param) throws Exception {
@XxlJob(LOAD_PHOTOVOLTAIC_REAL)
//@Scheduled(cron = "0/50 * * * * ? ")
public ReturnT<String> loadPhotovoltaicReal(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
photovoltaicService.loadPhotovoltaicTarget(param);
photovoltaicService.loadPhotovoltaicReal(param);
return new ReturnT<>("SUCCESS");
}
/**
* 光伏站-逆变器实时加载
* 光伏站-逆变器指标加载
* @return ReturnT<String>
*/
@XxlJob(LOAD_PHOTOVOLTAIC_REAL)
//@Scheduled(cron = "0/50 * * * * ? ")
public ReturnT<String> loadPhotovoltaicReal(String param) throws Exception {
@XxlJob(LOAD_PHOTOVOLTAIC_TARGET)
//@Scheduled(cron = "0/40 * * * * ? ")
public ReturnT<String> loadPhotovoltaicTarget(String param) throws Exception {
if (Func.isBlank(param)) {
param = DateUtil.format(new Date(), "yyyy-MM");
}
photovoltaicService.loadPhotovoltaicReal(param);
photovoltaicService.loadPhotovoltaicTarget(param);
return new ReturnT<>("SUCCESS");
}
}

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

@ -1,8 +1,9 @@
package com.hnac.hzims.operational.main.service;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import org.apache.poi.ss.formula.functions.T;
import java.util.List;
import java.util.function.Function;
@ -11,6 +12,11 @@ import java.util.function.Function;
* @author hx
*/
public interface IAnalyseDataService {
<T> List<AnalyzeCodeBySignagesVO> getAnalyzeCodeBySignages(Function<T, MultiAnalyzeCodePO> convert, T resource);
List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages);
Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, Integer ride ,String signages);
}

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

@ -1,9 +1,6 @@
package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.vo.GenerationVo;
import com.hnac.hzims.operational.main.vo.PhotovoltaicKPIsVo;
import com.hnac.hzims.operational.main.vo.PhotovoltaicStationVo;
import com.hnac.hzims.operational.main.vo.SubordinateVo;
import com.hnac.hzims.operational.main.vo.*;
import java.util.List;
@ -27,8 +24,17 @@ public interface PhotovoltaicService {
List<GenerationVo> generation(Long deptId,String type);
// 集团/区域下属数据占比
List<SubordinateVo> subordinate(Long deptId);
List<PhotovoltaicSubordinateVo> subordinate(Long deptId);
// 站点数据
PhotovoltaicStationVo station(Long deptId);
// app区域数据
List<PhotovoltaicSubordinateAppVo> app_subordinate(Long deptId);
// app站点数据
PhotovoltaicStationAppVo app_station(Long deptId);
// App功率/发电量查询
List<PhotovoltaicLoadGenerateVo> app_load_generate(Long deptId, String type,String queryType);
}

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

@ -1,16 +1,30 @@
package com.hnac.hzims.operational.main.service.impl;
import com.google.common.collect.Lists;
import com.hnac.hzims.EquipmentConstants;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyseCodeByAnalyseDataPO;
import com.hnac.hzinfo.datasearch.analyse.po.AnalyzeDataConditionPO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyseDataTaosVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeDataConditionVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.AllArgsConstructor;
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.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -33,4 +47,89 @@ public class AnalyseDataServiceImpl implements IAnalyseDataService {
}
return result;
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param cycleType 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param deviceCode 设备编号
* @param signages 指标
* @return
*/
@Override
public List<AnalyseDataTaosVO> periodTargetData(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode, String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
po.setDeviceCode(deviceCode);
analyzeDataConditionPO.setSignages(signages);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
po.setSignboardConditions(signboardConditions);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return new ArrayList<>();
}
return result.getData().get(0).getList();
}
/***
* 指标数据列表查询
* @param startTime 开始时间
* @param endTime 结束时间
* @param accessRules 间隔周期 : 0-> 1-> 2-> 小时 3-> 4-> 5-> 6->
* @param cycleType 取数规则 : 0=最早值 1=最大值 2=最小值 3=平均值 4=和值 5=差值 6=最新值
* @param deviceCode 设备编号
* @param ride 配电比
* @param signages 指标
* @return
*/
@Override
public Float periodTargetFloat(String startTime, String endTime, Integer accessRules, Integer cycleType, String deviceCode,Integer ride,String signages) {
AnalyseCodeByAnalyseDataPO po = new AnalyseCodeByAnalyseDataPO();
List<AnalyzeDataConditionPO> signboardConditions = new ArrayList<>();
AnalyzeDataConditionPO analyzeDataConditionPO = new AnalyzeDataConditionPO();
analyzeDataConditionPO.setFull(1);
po.setDeviceCode(deviceCode);
analyzeDataConditionPO.setSignages(signages);
analyzeDataConditionPO.setAccessRules(accessRules);
analyzeDataConditionPO.setSaveTimeType(cycleType);
// 间隔
analyzeDataConditionPO.setTimeInterval(1);
analyzeDataConditionPO.setBeginTime(LocalDateTime.parse(DateUtil.format(new Date(), startTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
analyzeDataConditionPO.setEndTime(LocalDateTime.parse(DateUtil.format(new Date(), endTime), DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME)));
signboardConditions.add(analyzeDataConditionPO);
po.setSignboardConditions(signboardConditions);
R<List<AnalyzeDataConditionVO>> result = analyseDataSearchClient.getAnalyzeDataByAnalyzeCodeAndSignages(po);
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) {
return 0f;
}
List<AnalyzeDataConditionVO> records = result.getData();
if(CollectionUtil.isEmpty(records)){
return 0f;
}
AnalyzeDataConditionVO analyzeDataConditionVO = records.get(0);
if (ObjectUtil.isEmpty(analyzeDataConditionVO)) {
return 0f;
}
List<AnalyseDataTaosVO> analyseDataTaosVOList = analyzeDataConditionVO.getList();
if (CollectionUtil.isEmpty(analyseDataTaosVOList)) {
return 0f;
}
AnalyseDataTaosVO analyseDataTaosVO = analyzeDataConditionVO.getList().get(0);
if (ObjectUtil.isEmpty(analyseDataTaosVO) || StringUtil.isBlank(analyseDataTaosVO.getVal())) {
return 0f;
}
return Float.parseFloat(analyseDataTaosVO.getVal()) * ride;
}
}

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

@ -11,6 +11,7 @@ import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.monitor.utils.DateUtils;
import com.hnac.hzims.operational.fill.entity.*;
import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.service.IAnalyseDataService;
import com.hnac.hzims.operational.main.service.IHomePageService;
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService;
import com.hnac.hzims.operational.main.service.IMainTaskStatisticService;
@ -69,7 +70,8 @@ import java.util.stream.Collectors;
@Slf4j
public class HomePageServiceImpl implements IHomePageService {
private final IAnalyseDataSearchClient analyseDataSearchClient;
private final IAnalyseDataService analyseDataService;
private final IPlanGenertionClient planGenertionClient;
private final IMainSystemMonitoringService maintenanceTaskService;
private final IMainTaskStatisticService mainTaskStatisticService;
@ -219,41 +221,70 @@ public class HomePageServiceImpl implements IHomePageService {
*
* @param param 时间
* @param serveType 站点类型
* @param yearCount 近几年
* @param year 近几年
*/
@Override
public void loadPowerData(String param,List<Integer> types, Integer serveType, int yearCount) {
public void loadPowerData(String param,List<Integer> types, Integer serveType, int year) {
// 站点查询
List<StationEntity> stationList = stationService.getStationType(serveType, types, null);
// 设备信息
List<EminfoAndEmParamVo> equipmentInfoList = maintenanceTaskService.getEmInfoList();
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<>();
// 获取需要遍历月份
List<String> monList = this.getMonthList(yearCount, 12,true);
Random random = new Random();
stationList.forEach(station -> {
Long departId = station.getRefDept();
// 获取对应站点设备
List<EminfoAndEmParamVo> effEmInfoList = equipmentInfoList.stream().filter(o -> departId.equals(o.getCreateDept())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(effEmInfoList)) {
// 站点设备集合
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device -> device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(stationDevices)){
return;
}
Map<String, Float> floatMap = new HashMap<>();
for (int i = 0; i < monList.size() - 1; i++) {
if (this.compareDate(monList.get(i))) {
floatMap.put(monList.get(i), 0f);
continue;
}
float power = getPowerGeneration(effEmInfoList, monList.get(i) + " 00:00:00", monList.get(i + 1) + " 00:00:00",EquipmentConstants.CycleTypeEnum.MONTH_CYCLE.getType());
floatMap.put(monList.get(i), power);
Map<String, Float> generateMap = this.getGenerateYear(stationDevices,start,end);
if(MapUtils.isEmpty(generateMap)){
return;
}
powerMap.put(station.getId(), floatMap);
powerMap.put(station.getId(),generateMap);
});
redisTemplate.opsForValue().set(RECENT_YEAR_POWER_DATA, powerMap);
}
/**
* 获取年发电量
* @param devices
* @param start
* @param end
* @return
*/
private Map<String, Float> getGenerateYear(List<EminfoAndEmParamVo> devices, String start, String end) {
List<PowerMonthVo> datas = new ArrayList<>();
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.valueOf(Optional.ofNullable(record.getVal()).orElse("0")) * device.getRideCount());
return generate;
}).collect(Collectors.toList()));
});
if(CollectionUtil.isEmpty(datas)){
return null;
}
return datas.stream().collect(Collectors.groupingBy(PowerMonthVo::getStrMonth, Collectors.collectingAndThen(
Collectors.mapping(PowerMonthVo::getPower, Collectors.reducing(Float::sum)),Optional::get)));
}
/**
* @param stationList
* @return
*/

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

File diff suppressed because it is too large Load Diff

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

@ -1634,7 +1634,7 @@ public class SideHustleServiceImpl implements ISideHustleService {
if(CollectionUtil.isEmpty(list)){
return 0;
}
return (float) list.stream().filter(v->o.equals(v.getDate())).mapToDouble(GenerationPowerVo::getGenerationPower).sum();
return (float) list.stream().filter(v->o.equals(v.getDate())).mapToDouble(GenerationPowerVo::getGenerate).sum();
}
/**

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

@ -322,7 +322,7 @@ public class WebHomeServiceImpl implements IWebHomeService {
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);
generationPowerVo.setGenerate(power);
generationPowerVoList.add(generationPowerVo);
}
return generationPowerVoList;

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

@ -16,11 +16,11 @@ import com.hnac.hzims.operational.config.service.StAlamRecordService;
import com.hnac.hzims.operational.config.service.StFocusPropertiesService;
import com.hnac.hzims.operational.config.vo.MessageParamVo;
import com.hnac.hzims.operational.config.vo.StationRealVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant;
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.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;
@ -31,6 +31,7 @@ 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.sdk.v5.redis.RedisClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
@ -88,6 +89,8 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
@NotNull
private final AbnormalAlarmService abnormalAlarmService;
private final RedisClient redisClient;
@NotNull
private final ISysClient sysClient;
@ -131,8 +134,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
private final static String loadwater_level_key = "hzims:operation:loadwater:level:key";
private final static String redis_real_prefix_key = "iot:real:data:";
@Override
public void realTimeData(String param) {
@ -146,10 +147,14 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
return "";
}
String jointRelay = points.get(HomePageConstant.JOINT_RELAY);
if(StringUtil.isBlank(jointRelay)){
return "";
}
if(!StringUtil.isEmpty(jointRelay)){
return jointRelay;
}
String onOff = points.get(HomePageConstant.SWITCH_ON_OFF);
if(!StringUtil.isEmpty(onOff)){
return onOff;
}
return "";
}).collect(Collectors.toList());
// 获取站点缓存数据
List<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_key);
@ -169,11 +174,11 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
list.forEach(stations -> {
stations.forEach(stationReal -> {
String[] realIdArr = stationReal.getRealId();
List<String> realIds = Stream.of(realIdArr).map(o-> redis_real_prefix_key + stationReal.getStation() + ":" + o).collect(Collectors.toList());
List<String> realIds = Stream.of(realIdArr).collect(Collectors.toList());
if(CollectionUtil.isEmpty(realIds)){
return;
}
List<Object> objects = redisTemplate.opsForValue().multiGet(realIds);
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds);
if(CollectionUtil.isEmpty(objects)){
return;
}
@ -182,11 +187,12 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
log.error(realIds.get(i) + "is null");
continue;
}
Map<String,String> attribute = (Map<String, String>) objects.get(i);
attribute.put("realId",realIdArr[i]);
Map<String,String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i));
attribute.put("realId",attribute.get("k"));
attribute.put("value",attribute.get("v"));
attribute.put("time",attribute.get("t"));
attribute.remove("v");
attribute.remove("k");
attribute.remove("t");
this.getCheckMap(attribute,switchOnOff);
valueMap.put(realIdArr[i],attribute.get("value"));
@ -217,15 +223,15 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
* @param value
* @return
*/
private Map<String, String> getCheckMap(Map<String, String> value,List<String> switchOnOff){
private void getCheckMap(Map<String, String> value,List<String> switchOnOff){
try{
String time = value.get("time");
if(StringUtil.isEmpty(time)){
return value;
}
// 不处理开机状态监测点
if(switchOnOff.contains(value.get("realId"))){
return value;
return;
}
String time = value.get("time");
if(StringUtil.isEmpty(time)){
return;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DateUtil.PATTERN_DATETIME);
Date date = simpleDateFormat.parse(time);
@ -234,9 +240,8 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
value.put("value","0");
}
}catch (ParseException e){
return value;
return;
}
return value;
}
/**

Loading…
Cancel
Save