Browse Source

#设备参数支持double

zhongwei
yang_shj 7 months ago
parent
commit
faf83717a7
  1. 6
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/RideDeviceVo.java
  2. 43
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java
  3. 10
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/equipment/impl/DeviceServiceImpl.java
  4. 16
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

6
hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/equipment/vo/RideDeviceVo.java

@ -13,11 +13,11 @@ import lombok.EqualsAndHashCode;
public class RideDeviceVo extends EmInfoEntity { public class RideDeviceVo extends EmInfoEntity {
@ApiModelProperty(value = "ct") @ApiModelProperty(value = "ct")
private Integer ct; private Double ct;
@ApiModelProperty(value = "pt") @ApiModelProperty(value = "pt")
private Integer pt; private Double pt;
@ApiModelProperty(value = "配电比") @ApiModelProperty(value = "配电比")
private Integer ride; private Double ride;
} }

43
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmParamServiceImpl.java

@ -45,28 +45,27 @@ public class EmParamServiceImpl extends BaseServiceImpl<EmParamMapper, EmParamEn
return null; return null;
} }
List<Long> collect = emParamEntities.stream().distinct().map(EmParamEntity::getInfoId).collect(Collectors.toList()); List<Long> collect = emParamEntities.stream().distinct().map(EmParamEntity::getInfoId).collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) { for (Long value : collect) {
Map<String,Double> map = new HashMap<>(); Map<String, Double> map = new HashMap<>();
int ct = 0; double ct = 0;
int pt = 0; double pt = 0;
double installedCapacity = 0; double installedCapacity = 0;
Long aLong = collect.get(i); List<EmParamEntity> pts = emParamEntities.stream().filter(o -> "pt".equals(o.getParamName()) && o.getInfoId().toString().equals(value.toString())).collect(Collectors.toList());
List<EmParamEntity> pts = emParamEntities.stream().filter(o -> "pt".equals(o.getParamName()) && o.getInfoId().toString().equals(aLong.toString())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(pts)) {
if (CollectionUtil.isNotEmpty(pts)) { pt = Double.parseDouble(pts.get(0).getParamValue());
pt = Integer.valueOf(pts.get(0).getParamValue()); }
} List<EmParamEntity> cts = emParamEntities.stream().filter(o -> "ct".equals(o.getParamName()) && o.getInfoId().toString().equals(value.toString())).collect(Collectors.toList());
List<EmParamEntity> cts = emParamEntities.stream().filter(o -> "ct".equals(o.getParamName()) && o.getInfoId().toString().equals(aLong.toString())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(cts)) {
if (CollectionUtil.isNotEmpty(cts)) { ct = Double.parseDouble(cts.get(0).getParamValue());
ct = Integer.valueOf(cts.get(0).getParamValue()); }
} List<EmParamEntity> installedCapacitys = emParamEntities.stream().filter(o -> "installedCapacity".equals(o.getParamName()) && o.getInfoId().toString().equals(value.toString())).collect(Collectors.toList());
List<EmParamEntity> installedCapacitys = emParamEntities.stream().filter(o -> "installedCapacity".equals(o.getParamName()) && o.getInfoId().toString().equals(aLong.toString())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(installedCapacitys)) {
if (CollectionUtil.isNotEmpty(installedCapacitys)) { installedCapacity = Double.parseDouble(installedCapacitys.get(0).getParamValue());
installedCapacity = Double.valueOf(installedCapacitys.get(0).getParamValue()); }
} map.put("installedCapacity", installedCapacity);
map.put("installedCapacity",installedCapacity); map.put("rideCount", (double) ct * pt);
map.put("rideCount",(double)ct * pt); result.put(value, map);
result.put(aLong, map); }
}
return result; return result;
} }

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

@ -64,13 +64,13 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceMapper, EmInfoEntit
if(CollectionUtil.isNotEmpty(itemParamList)) { if(CollectionUtil.isNotEmpty(itemParamList)) {
// 遍历设备配置参数 // 遍历设备配置参数
for (EmParamEntity paramEntity : itemParamList) { for (EmParamEntity paramEntity : itemParamList) {
String param_name = paramEntity.getParamName(); String paramName = paramEntity.getParamName();
switch (param_name) { switch (paramName) {
case "ct": case "ct":
rideDevice.setCt(Integer.parseInt(paramEntity.getParamValue())); rideDevice.setCt(Double.parseDouble(paramEntity.getParamValue()));
break; break;
case "pt": case "pt":
rideDevice.setPt(Integer.parseInt(paramEntity.getParamValue())); rideDevice.setPt(Double.parseDouble(paramEntity.getParamValue()));
break; break;
default: default:
break; break;
@ -81,7 +81,7 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceMapper, EmInfoEntit
rideDevice.setRide(rideDevice.getCt() * rideDevice.getPt()); rideDevice.setRide(rideDevice.getCt() * rideDevice.getPt());
} }
}else{ }else{
rideDevice.setRide(1); rideDevice.setRide(1.0);
} }
return rideDevice; return rideDevice;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

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

@ -1117,7 +1117,21 @@ public class HydropowerServiceImpl implements HydropowerService {
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key); List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
return stations.stream().map(station -> { return stations.stream().map(station -> {
AppHydropowerStationVo hydropower = new AppHydropowerStationVo(); AppHydropowerStationVo hydropower = new AppHydropowerStationVo();
hydropower.setDeptId(station.getRefDept()); if(!ObjectUtil.isEmpty(station.getRefDept())){
hydropower.setDeptId(station.getRefDept());
R<Dept> dept = sysClient.getDept(station.getRefDept());
if(dept.isSuccess() && !ObjectUtil.isEmpty(dept.getData())){
if(ObjectUtil.isEmpty(dept.getData().getSort())){
hydropower.setSort(999);
}else{
hydropower.setSort(dept.getData().getSort());
}
}else{
hydropower.setSort(999);
}
}else{
hydropower.setSort(999);
}
hydropower.setDeptName(station.getName()); hydropower.setDeptName(station.getName());
// 天气区间 // 天气区间
hydropower.setMaxTemp(this.intervalTemp(weekWeather,station.getCode(),true)); hydropower.setMaxTemp(this.intervalTemp(weekWeather,station.getCode(),true));

Loading…
Cancel
Save