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