|
|
@ -19,18 +19,13 @@ import com.hnac.hzims.operational.config.vo.StationRealVo; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; |
|
|
|
import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; |
|
|
|
import com.hnac.hzims.operational.main.service.IWeatherService; |
|
|
|
import com.hnac.hzims.operational.main.service.IWeatherService; |
|
|
|
import com.hnac.hzims.operational.main.vo.JointRelayVo; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.main.vo.WaterLevelVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationAttributeEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.entity.StationEntity; |
|
|
|
import com.hnac.hzims.operational.station.service.IRealMonitorService; |
|
|
|
import com.hnac.hzims.operational.station.service.IRealMonitorService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationAttrConfigService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationAttrConfigService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationAttributeService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationAttributeService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.main.vo.RealAttributeVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.vo.RealDeviceVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.vo.RealStationVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.vo.WeatherVo; |
|
|
|
|
|
|
|
import com.hnac.hzinfo.sdk.v5.redis.RedisClient; |
|
|
|
import com.hnac.hzinfo.sdk.v5.redis.RedisClient; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
@ -50,6 +45,7 @@ import org.springframework.web.socket.TextMessage; |
|
|
|
|
|
|
|
|
|
|
|
import javax.validation.constraints.NotNull; |
|
|
|
import javax.validation.constraints.NotNull; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -433,8 +429,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService { |
|
|
|
RealStationVo station = new RealStationVo(); |
|
|
|
RealStationVo station = new RealStationVo(); |
|
|
|
// 站点编码
|
|
|
|
// 站点编码
|
|
|
|
station.setStationCode(key); |
|
|
|
station.setStationCode(key); |
|
|
|
// 设置站点状态
|
|
|
|
|
|
|
|
this.setStationStatus(alarmList,station,key); |
|
|
|
|
|
|
|
// 名称、限制水位、服务类型、机构、排序
|
|
|
|
// 名称、限制水位、服务类型、机构、排序
|
|
|
|
this.stationParam(stationEntityList,station,deptAll.getData()); |
|
|
|
this.stationParam(stationEntityList,station,deptAll.getData()); |
|
|
|
// 根据设备名称分组
|
|
|
|
// 根据设备名称分组
|
|
|
@ -454,6 +448,8 @@ public class RealMonitorServiceImpl implements IRealMonitorService { |
|
|
|
this.getDeviceParam(emList, deviceClassifyMap, deviceList); |
|
|
|
this.getDeviceParam(emList, deviceClassifyMap, deviceList); |
|
|
|
// 运行设备状态设置
|
|
|
|
// 运行设备状态设置
|
|
|
|
this.deviceState(deviceList); |
|
|
|
this.deviceState(deviceList); |
|
|
|
|
|
|
|
// 设置站点状态
|
|
|
|
|
|
|
|
this.setStationStatus(alarmList,station,key,deviceList); |
|
|
|
station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); |
|
|
|
station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); |
|
|
|
stationList.add(station); |
|
|
|
stationList.add(station); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -503,8 +499,24 @@ public class RealMonitorServiceImpl implements IRealMonitorService { |
|
|
|
* @param station |
|
|
|
* @param station |
|
|
|
* @param key |
|
|
|
* @param key |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) { |
|
|
|
private void setStationStatus(List<String> alarmList, RealStationVo station, String key,List<RealDeviceVo> deviceList) { |
|
|
|
station.setStatus(0); |
|
|
|
station.setStatus(0); |
|
|
|
|
|
|
|
// 站点功率大于0为正常上送数据
|
|
|
|
|
|
|
|
double powerSum = deviceList.stream().mapToDouble(o->{ |
|
|
|
|
|
|
|
List<RealAttributeVo> attbts = o.getAttbtList(); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(attbts)){ |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 功率属性记录
|
|
|
|
|
|
|
|
List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(powers)){ |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return powers.stream().filter(power-> !"0.000000".equals(power.getValue()) && !"-".equals(power.getValue()) && !HomePageConstant.ON.equals(power.getValue())).mapToDouble(value->Double.parseDouble(value.getValue())).sum(); |
|
|
|
|
|
|
|
}).sum(); |
|
|
|
|
|
|
|
if(powerSum > 0){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if(alarmList.contains(key)){ |
|
|
|
if(alarmList.contains(key)){ |
|
|
|
station.setStatus(1); |
|
|
|
station.setStatus(1); |
|
|
|
} |
|
|
|
} |
|
|
@ -975,7 +987,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取设备中属性为P/p的value值总和
|
|
|
|
// 获取设备中属性为P/p的value值总和
|
|
|
|
powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
station.setPowerSum(powerSum); |
|
|
|
station.setPowerSum(powerSum); |
|
|
|
} |
|
|
|
} |
|
|
|