Browse Source

#集中监控增加设备装机容量

zhongwei
yang_shj 4 months ago
parent
commit
d214b181d0
  1. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/RealDeviceVo.java
  2. 29
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  3. 44
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

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

@ -18,6 +18,9 @@ public class RealDeviceVo implements Serializable {
@ApiModelProperty("设备名称") @ApiModelProperty("设备名称")
private String deviceName; private String deviceName;
@ApiModelProperty("装机容量")
private Double installedCapacity;
@ApiModelProperty("设备状态") @ApiModelProperty("设备状态")
private Integer state; private Integer state;

29
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java

@ -291,6 +291,8 @@ public class MonitorServiceImpl implements MonitorService {
List<String> aborts = interruptionAlarmService.aborts(operations); List<String> aborts = interruptionAlarmService.aborts(operations);
// 设备状态分类 // 设备状态分类
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final); Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final);
// 设备信息
List<EminfoAndEmParamVo> deviceParms = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
// 按10个站点一组分割属性配置 // 按10个站点一组分割属性配置
List<Map<String, List<StationAttributeEntity>>> limit = this.limitMapChunk(attributes); List<Map<String, List<StationAttributeEntity>>> limit = this.limitMapChunk(attributes);
// 线程执行次数 // 线程执行次数
@ -305,8 +307,8 @@ public class MonitorServiceImpl implements MonitorService {
RealStationVo realStation = new RealStationVo(); RealStationVo realStation = new RealStationVo();
// 设备信息 // 设备信息
List<RealDeviceVo> devices = this.monitorRealDevice(value,realTimeData); List<RealDeviceVo> devices = this.monitorRealDevice(value,realTimeData);
// 设备状态 // 设备状态、装机容量
this.deviceStatus(devices,deviceClassifyMap); this.deviceParam(devices,deviceClassifyMap,deviceParms);
realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList()));
// 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序 // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序
this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation);
@ -330,30 +332,33 @@ public class MonitorServiceImpl implements MonitorService {
} }
/** /**
* 设置设备状态 * 设置设备状态装机容量
* @param devices * @param devices
* @param deviceClassifyMap * @param deviceClassifyMap
*/ */
private void deviceStatus(List<RealDeviceVo> devices, Map<String, List<String>> deviceClassifyMap) { private void deviceParam(List<RealDeviceVo> devices, Map<String, List<String>> deviceClassifyMap,List<EminfoAndEmParamVo> deviceParams) {
if (CollectionUtil.isEmpty(devices) || MapUtils.isEmpty(deviceClassifyMap)) { if (CollectionUtil.isEmpty(devices) || MapUtils.isEmpty(deviceClassifyMap)) {
return; return;
} }
List<String> faults = deviceClassifyMap.get(HomePageConstant.FAULT); List<String> faults = deviceClassifyMap.get(HomePageConstant.FAULT);
List<String> overhaults = deviceClassifyMap.get(HomePageConstant.OVERHAUL); List<String> overhaults = deviceClassifyMap.get(HomePageConstant.OVERHAUL);
devices.forEach(device -> { devices.forEach(device -> {
int state = -1; device.setState(-1);
if(StringUtil.isNotBlank(device.getDeviceCode())){ if(StringUtil.isNotBlank(device.getDeviceCode())){
// 故障 // 设备装机容量
if(CollectionUtil.isNotEmpty(deviceParams)){
Optional<EminfoAndEmParamVo> optional = deviceParams.stream().filter(param->param.getEmCode().equals(device.getDeviceCode())).findFirst();
optional.ifPresent(eminfoAndEmParamVo -> device.setInstalledCapacity(eminfoAndEmParamVo.getInstalledCapacity()));
}
// 设备状态 : 故障、检修
if (CollectionUtil.isNotEmpty(faults) && faults.contains(device.getDeviceCode())) { if (CollectionUtil.isNotEmpty(faults) && faults.contains(device.getDeviceCode())) {
state = 4; device.setState(4);
// 检修
} else if (CollectionUtil.isNotEmpty(overhaults) && overhaults.contains(device.getDeviceCode())) { } else if (CollectionUtil.isNotEmpty(overhaults) && overhaults.contains(device.getDeviceCode())) {
state = 0; device.setState(0);
} }
} }
if(state >= 0){ // 根据有功进行判断设备状态
device.setState(state); if(device.getState() < 0){
}else{
List<RealAttributeVo> attbts = device.getAttbtList(); List<RealAttributeVo> attbts = device.getAttbtList();
// 功率属性记录 // 功率属性记录
List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList());

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

@ -17,6 +17,7 @@ import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity;
import com.hnac.hzims.operational.defect.service.IOperPhenomenonService; import com.hnac.hzims.operational.defect.service.IOperPhenomenonService;
import com.hnac.hzims.operational.duty.service.IImsDutyMainService; import com.hnac.hzims.operational.duty.service.IImsDutyMainService;
import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo;
import com.hnac.hzims.operational.fill.entity.GenerateEntity;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.entity.UserDeptEntity; import com.hnac.hzims.operational.main.entity.UserDeptEntity;
import com.hnac.hzims.operational.main.service.*; import com.hnac.hzims.operational.main.service.*;
@ -800,7 +801,7 @@ public class HydropowerServiceImpl implements HydropowerService {
private List<PowerYearVo> generateThreeYear(List<String> stations,Map<String, Map<String, Float>> map) { private List<PowerYearVo> generateThreeYear(List<String> stations,Map<String, Map<String, Float>> map) {
List<Map<String, Float>> filter = map.entrySet().stream().filter(entry -> stations.contains(entry.getKey())).map(Map.Entry::getValue).collect(Collectors.toList()); List<Map<String, Float>> filter = map.entrySet().stream().filter(entry -> stations.contains(entry.getKey())).map(Map.Entry::getValue).collect(Collectors.toList());
if (CollectionUtil.isEmpty(filter)) { if (CollectionUtil.isEmpty(filter)) {
return new ArrayList<>(); return this.defaultThreeYear();
} }
// 根据月份分组 // 根据月份分组
List<PowerMonthVo> powerMonthVos = new ArrayList<>(); List<PowerMonthVo> powerMonthVos = new ArrayList<>();
@ -837,6 +838,47 @@ public class HydropowerServiceImpl implements HydropowerService {
} }
/**
* 默认结构
* @return
*/
private List<PowerYearVo> defaultThreeYear() {
List<String> mons = this.mons(2,12,false);
// 返回结果
// 根据月份分组
List<PowerMonthVo> powerMonthVos = new ArrayList<>();
mons.forEach(item -> {
PowerMonthVo powerMonthVo = new PowerMonthVo();
powerMonthVo.setStrMonth(item);
powerMonthVo.setPower(0f);
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());
// 根据年份分组
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());
}
/*=====================================================app=====================================================*/ /*=====================================================app=====================================================*/
/** /**

Loading…
Cancel
Save