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 {
@ApiModelProperty(value = "ct")
private Integer ct;
private Double ct;
@ApiModelProperty(value = "pt")
private Integer pt;
private Double pt;
@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;
}
List<Long> collect = emParamEntities.stream().distinct().map(EmParamEntity::getInfoId).collect(Collectors.toList());
for (int i = 0; i < collect.size(); i++) {
Map<String,Double> map = new HashMap<>();
int ct = 0;
int pt = 0;
double installedCapacity = 0;
Long aLong = collect.get(i);
List<EmParamEntity> pts = emParamEntities.stream().filter(o -> "pt".equals(o.getParamName()) && o.getInfoId().toString().equals(aLong.toString())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(pts)) {
pt = Integer.valueOf(pts.get(0).getParamValue());
}
List<EmParamEntity> cts = emParamEntities.stream().filter(o -> "ct".equals(o.getParamName()) && o.getInfoId().toString().equals(aLong.toString())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(cts)) {
ct = Integer.valueOf(cts.get(0).getParamValue());
}
List<EmParamEntity> installedCapacitys = emParamEntities.stream().filter(o -> "installedCapacity".equals(o.getParamName()) && o.getInfoId().toString().equals(aLong.toString())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(installedCapacitys)) {
installedCapacity = Double.valueOf(installedCapacitys.get(0).getParamValue());
}
map.put("installedCapacity",installedCapacity);
map.put("rideCount",(double)ct * pt);
result.put(aLong, map);
}
for (Long value : collect) {
Map<String, Double> map = new HashMap<>();
double ct = 0;
double pt = 0;
double installedCapacity = 0;
List<EmParamEntity> pts = emParamEntities.stream().filter(o -> "pt".equals(o.getParamName()) && o.getInfoId().toString().equals(value.toString())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(pts)) {
pt = Double.parseDouble(pts.get(0).getParamValue());
}
List<EmParamEntity> cts = emParamEntities.stream().filter(o -> "ct".equals(o.getParamName()) && o.getInfoId().toString().equals(value.toString())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(cts)) {
ct = Double.parseDouble(cts.get(0).getParamValue());
}
List<EmParamEntity> installedCapacitys = emParamEntities.stream().filter(o -> "installedCapacity".equals(o.getParamName()) && o.getInfoId().toString().equals(value.toString())).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(installedCapacitys)) {
installedCapacity = Double.parseDouble(installedCapacitys.get(0).getParamValue());
}
map.put("installedCapacity", installedCapacity);
map.put("rideCount", (double) ct * pt);
result.put(value, map);
}
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)) {
// 遍历设备配置参数
for (EmParamEntity paramEntity : itemParamList) {
String param_name = paramEntity.getParamName();
switch (param_name) {
String paramName = paramEntity.getParamName();
switch (paramName) {
case "ct":
rideDevice.setCt(Integer.parseInt(paramEntity.getParamValue()));
rideDevice.setCt(Double.parseDouble(paramEntity.getParamValue()));
break;
case "pt":
rideDevice.setPt(Integer.parseInt(paramEntity.getParamValue()));
rideDevice.setPt(Double.parseDouble(paramEntity.getParamValue()));
break;
default:
break;
@ -81,7 +81,7 @@ public class DeviceServiceImpl extends BaseServiceImpl<DeviceMapper, EmInfoEntit
rideDevice.setRide(rideDevice.getCt() * rideDevice.getPt());
}
}else{
rideDevice.setRide(1);
rideDevice.setRide(1.0);
}
return rideDevice;
}).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);
return stations.stream().map(station -> {
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.setMaxTemp(this.intervalTemp(weekWeather,station.getCode(),true));

Loading…
Cancel
Save