Browse Source

fix:设备绑定其它站点(集控中心)的厂信息点查不到数据

show
luyie 4 weeks ago
parent
commit
32e6d5b459
  1. 160
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/monitor/impl/MonitorServiceImpl.java
  2. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/StFocusPropertiesController.java
  3. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/StFocusPropertiesService.java
  4. 9
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StFocusPropertiesServiceImpl.java
  5. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  6. 26
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

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

@ -48,6 +48,7 @@ import java.util.stream.Stream;
/**
* 集中监控数据获取实现类
*
* @author ysj
*/
@Service
@ -103,12 +104,13 @@ public class MonitorServiceImpl implements MonitorService {
public void loadRealId(String param) {
// 所有站点
List<StationEntity> stationList = stationService.list();
if(CollectionUtil.isEmpty(stationList)){
if (CollectionUtil.isEmpty(stationList)) {
return;
}
// 设备监测点list
Object json = redisTemplate.opsForValue().get(device_cache_final);
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {
});
// 厂房监测点list
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign();
// 实时监控监测点list
@ -119,56 +121,58 @@ public class MonitorServiceImpl implements MonitorService {
}});
// 监测点存储list
List<StationRealVo> list = new ArrayList<>();
stationList.forEach(station->{
stationList.forEach(station -> {
StationRealVo stationRealVo = new StationRealVo();
stationRealVo.setStation(station.getCode());
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams);
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(), eminfoAndEmParams);
// 厂站匹配站点监测点集合
List<String> realWsList = wsMonitorList.stream().filter(
o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode())
).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList());
// 实时监控匹配站点监测点集合
List<String> realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(realTimeList)){
if (CollectionUtil.isNotEmpty(realTimeList)) {
realDeviceList.addAll(realTimeList);
}
if(CollectionUtil.isNotEmpty(realWsList)) {
if (CollectionUtil.isNotEmpty(realWsList)) {
realDeviceList.addAll(realWsList);
}
if(CollectionUtil.isEmpty(realDeviceList)){
if (CollectionUtil.isEmpty(realDeviceList)) {
return;
}
List<String> realList = realDeviceList.stream().distinct().collect(Collectors.toList());
String[] realArr = StringUtil.join(realList,",").split(",");
String[] realArr = StringUtil.join(realList, ",").split(",");
stationRealVo.setRealId(realArr);
list.add(stationRealVo);
});
redisTemplate.opsForValue().set(moniter_realId_cache_final,list);
redisTemplate.opsForValue().set(moniter_realId_cache_final, list);
}
@Override
public void loadRealData(String param) {
// 获取设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});;
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {
});
;
// 设备开关机集合监测点
List<String> switchOnOff = devices.stream().map(o->{
Map<String,String> points = o.getPoint();
if(CollectionUtil.isEmpty(points)){
List<String> switchOnOff = devices.stream().map(o -> {
Map<String, String> points = o.getPoint();
if (CollectionUtil.isEmpty(points)) {
return "";
}
String jointRelay = points.get(HomePageConstant.JOINT_RELAY);
if(!StringUtil.isEmpty(jointRelay)){
if (!StringUtil.isEmpty(jointRelay)) {
return jointRelay;
}
String onOff = points.get(HomePageConstant.SWITCH_ON_OFF);
if(!StringUtil.isEmpty(onOff)){
if (!StringUtil.isEmpty(onOff)) {
return onOff;
}
return "";
}).collect(Collectors.toList());
// 获取站点缓存数据
List<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_cache_final);
if(CollectionUtil.isEmpty(stationRealVos)){
if (CollectionUtil.isEmpty(stationRealVos)) {
return;
}
// 数据切割
@ -176,33 +180,52 @@ public class MonitorServiceImpl implements MonitorService {
List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList());
ExecutorService pool = Executors.newFixedThreadPool(limit);
// <real,value>
Map<String,String> valueMap = new ConcurrentHashMap<>();
Map<String, String> valueMap = new ConcurrentHashMap<>();
// <real,<attribute,value>>
Map<String,Map<String,String>> keyMap = new ConcurrentHashMap<>();
Map<String, Map<String, String>> keyMap = new ConcurrentHashMap<>();
CountDownLatch countDownLatch = new CountDownLatch(limit);
pool.execute(()-> list.forEach(stations -> {
pool.execute(() -> list.forEach(stations -> {
stations.forEach(stationReal -> {
String[] realIdArr = stationReal.getRealId();
List<String> realIds = Stream.of(realIdArr).collect(Collectors.toList());
if(CollectionUtil.isEmpty(realIds)){
if (CollectionUtil.isEmpty(realIds)) {
return;
}
log.error("real_time_data: {},{}",stationReal.getStation(),realIds);
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds);
for(int i = 0; i < realIds.size() ;i++){
if(ObjectUtil.isEmpty(objects.get(i))){
log.error(realIds.get(i) + "is null");
}else{
Map<String,String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i));
attribute.put("realId",attribute.get("k"));
attribute.put("value",attribute.get("v"));
attribute.put("time",attribute.get("t"));
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(), realIds);
List<String> emptyIds = new ArrayList<>();
for (int i = 0; i < realIds.size(); i++) {
if (ObjectUtil.isEmpty(objects.get(i))) {
emptyIds.add(realIds.get(i));
} else {
Map<String, String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i));
attribute.put("realId", attribute.get("k"));
attribute.put("value", attribute.get("v"));
attribute.put("time", attribute.get("t"));
attribute.remove("v");
attribute.remove("k");
attribute.remove("t");
this.getCheckMap(attribute,switchOnOff);
valueMap.put(realIdArr[i],attribute.get("value"));
keyMap.put(realIdArr[i],attribute);
this.getCheckMap(attribute, switchOnOff);
valueMap.put(realIdArr[i], attribute.get("value"));
keyMap.put(realIdArr[i], attribute);
}
}
if (CollectionUtil.isNotEmpty(emptyIds)) {
List<String> restList = redisClient.getBatchRealDataByRealId("901200000034", emptyIds);
for (int i = 0; i < emptyIds.size(); i++) {
if (ObjectUtil.isEmpty(restList.get(i))) {
log.error("获取数据失败:{}", emptyIds.get(i));
} else {
Map<String, String> attribute = (Map<String, String>) JSONObject.parse(restList.get(i));
attribute.put("realId", attribute.get("k"));
attribute.put("value", attribute.get("v"));
attribute.put("time", attribute.get("t"));
attribute.remove("v");
attribute.remove("k");
attribute.remove("t");
this.getCheckMap(attribute, switchOnOff);
valueMap.put(emptyIds.get(i), attribute.get("value"));
keyMap.put(emptyIds.get(i), attribute);
}
}
}
});
@ -217,8 +240,8 @@ public class MonitorServiceImpl implements MonitorService {
}
pool.shutdown();
// redis 存储
redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap));
redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap));
redisTemplate.opsForValue().set(real_cache_final, JSONObject.toJSONString(valueMap));
redisTemplate.opsForValue().set(real_gather_cache_final, JSONObject.toJSONString(keyMap));
}
/**
@ -230,27 +253,29 @@ public class MonitorServiceImpl implements MonitorService {
/**
* 监测点过期数据检查
*
* @param value
* @return
*/
private void getCheckMap(Map<String, String> value,List<String> switchOnOff){
private void getCheckMap(Map<String, String> value, List<String> switchOnOff) {
// 不处理开机状态监测点
if(switchOnOff.contains(value.get("realId"))){
if (switchOnOff.contains(value.get("realId"))) {
return;
}
String time = value.get("time");
if(StringUtil.isEmpty(time)){
if (StringUtil.isEmpty(time)) {
return;
}
Date date = DateUtil.parse(time,DateUtil.PATTERN_DATETIME);
Date date = DateUtil.parse(time, DateUtil.PATTERN_DATETIME);
// 实时数据超出10分钟未刷新,值置为 0 显示
if(System.currentTimeMillis() - date.getTime() > 10 * 60 * 1000L){
value.put("value","0");
if (System.currentTimeMillis() - date.getTime() > 10 * 60 * 1000L) {
value.put("value", "0");
}
}
/**
* 集中监控数据处理
*
* @param param
*/
@Override
@ -284,12 +309,13 @@ public class MonitorServiceImpl implements MonitorService {
// 所有设备分类
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final);
// 所有设备
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {
});
// 根据站点分组
Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId));
// 获取站点列表
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.in(StationEntity::getCode,new ArrayList<>(stationAttbtMap.keySet())));
.in(StationEntity::getCode, new ArrayList<>(stationAttbtMap.keySet())));
// 隐藏设备列表
List<String> hideList = attrConfigService.getHideList();
// 分割,每个map限制10个长度
@ -302,17 +328,17 @@ public class MonitorServiceImpl implements MonitorService {
R<List<Dept>> deptAll = sysClient.getDeptList();
// 存储数据节点
List<RealStationVo> stationList = new CopyOnWriteArrayList<>();
pool.execute(()->{
pool.execute(() -> {
// 线程处理数据
for(Map<String, List<StationAttributeEntity>> item : handleList){
item.forEach((key,value)->{
for (Map<String, List<StationAttributeEntity>> item : handleList) {
item.forEach((key, value) -> {
RealStationVo station = new RealStationVo();
// 站点编码
station.setStationCode(key);
// 设置站点状态
this.setStationStatus(alarmList,station,key);
this.setStationStatus(alarmList, station, key);
// 名称、限制水位、服务类型、机构、排序
this.stationParam(stationEntityList,station,deptAll.getData());
this.stationParam(stationEntityList, station, deptAll.getData());
// 根据设备名称分组
Map<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName));
List<RealDeviceVo> deviceList = new ArrayList<>();
@ -363,7 +389,7 @@ public class MonitorServiceImpl implements MonitorService {
RealAttributeVo realAttributeVo = new RealAttributeVo();
// 设备重点属性处理 : 单条-item
Map<String, String> real = map.get(item.getMonitorId());
if(MapUtils.isEmpty(real)){
if (MapUtils.isEmpty(real)) {
realAttributeVo.setName(item.getAttributes());
realAttributeVo.setType(item.getAttributeType());
realAttributeVo.setRealId(item.getMonitorId());
@ -385,19 +411,20 @@ public class MonitorServiceImpl implements MonitorService {
/**
* 获取站点属性
*
* @param stationEntityList
* @param item
*/
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item,List<Dept> deptAll) {
if(CollectionUtil.isEmpty(stationEntityList)){
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item, List<Dept> deptAll) {
if (CollectionUtil.isEmpty(stationEntityList)) {
return;
}
List<StationEntity> filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filterList)){
List<StationEntity> filterList = stationEntityList.stream().filter(o -> item.getStationCode().equals(o.getCode())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(filterList)) {
return;
}
StationEntity station = filterList.get(0);
if(ObjectUtil.isEmpty(station)){
if (ObjectUtil.isEmpty(station)) {
return;
}
item.setStationName(station.getName());
@ -405,8 +432,8 @@ public class MonitorServiceImpl implements MonitorService {
item.setServerType(station.getServeType());
item.setStationDeptId(station.getRefDept());
// 排序
List<Dept> list = deptAll.stream().filter(o-> station.getRefDept().equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){
List<Dept> list = deptAll.stream().filter(o -> station.getRefDept().equals(o.getId())).collect(Collectors.toList());
if (CollectionUtil.isEmpty(list)) {
return;
}
item.setSort(list.get(0).getSort());
@ -626,7 +653,7 @@ public class MonitorServiceImpl implements MonitorService {
past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime();
}
boolean exist = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList)));
if (exist){
if (exist) {
Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId());
attest.setId(alertId);
attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus());
@ -646,13 +673,14 @@ public class MonitorServiceImpl implements MonitorService {
/**
* 设置站点状态
*
* @param alarmList
* @param station
* @param key
*/
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) {
station.setStatus(0);
if(alarmList.contains(key)){
if (alarmList.contains(key)) {
station.setStatus(1);
}
}
@ -705,17 +733,18 @@ public class MonitorServiceImpl implements MonitorService {
/**
* 获取厂房监测点
*
* @return
*/
private List<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() {
List<WorkshopInfoEntity> wsInfoList = workshopInfoService.list();
if(CollectionUtil.isEmpty(wsInfoList)) {
if (CollectionUtil.isEmpty(wsInfoList)) {
return Lists.newArrayList();
}
Function<String, MultiAnalyzeCodePO> getAnalyzeCodePO = wsCode -> {
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO();
multiAnalyzeCodePO.setDeviceCode(wsCode);
multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY,HomePageConstant.PV_REACTIVE_POWER,HomePageConstant.PV_GENERATION_CAPACITY));
multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY, HomePageConstant.PV_REACTIVE_POWER, HomePageConstant.PV_GENERATION_CAPACITY));
return multiAnalyzeCodePO;
};
List<MultiAnalyzeCodePO> analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList());
@ -725,24 +754,25 @@ public class MonitorServiceImpl implements MonitorService {
/**
* 获取站点realId
*
* @param refDept
* @param eminfoAndEmParams
* @return
*/
private List<String> getRealDeviceList(Long refDept, List<EminfoAndEmParamVo> eminfoAndEmParams) {
// 参数检查
if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){
if (CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)) {
return new ArrayList<>();
}
// 有效设备
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList());
if(CollectionUtil.isEmpty(filters)){
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o -> o.getCreateDept().equals(refDept)).collect(Collectors.toList());
if (CollectionUtil.isEmpty(filters)) {
return new ArrayList<>();
}
// 遍历设备
List<String> result = new ArrayList<>();
for(EminfoAndEmParamVo device : filters){
if(CollectionUtil.isEmpty(device.getPoint())){
for (EminfoAndEmParamVo device : filters) {
if (CollectionUtil.isEmpty(device.getPoint())) {
continue;
}
result.addAll(device.getPoint().values());

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/StFocusPropertiesController.java

@ -7,6 +7,7 @@ import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.config.entity.StFocusPropertiesEntity;
import com.hnac.hzims.operational.config.service.StFocusPropertiesService;
import com.hnac.hzims.operational.config.vo.StationRealVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.core.log.annotation.ApiLog;
@ -81,4 +82,10 @@ public class StFocusPropertiesController {
public R remove(@RequestParam("ids") String ids){
return R.data(stFocusPropertiesService.removeByIds(Func.toLongList(ids)));
}
@ApiOperation(value = "获取站点实时ID")
@GetMapping(value = "/getStationRealIds")
public R<List<StationRealVo>> getStationRealIds(@RequestParam(value = "params", required = false) String params){ ;
return R.data(stFocusPropertiesService.getStationRealIds(params));
}
}

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/StFocusPropertiesService.java

@ -11,7 +11,7 @@ public interface StFocusPropertiesService extends BaseService<StFocusPropertiesE
String getRealIds();
void getStationRealIds(String param);
List<StationRealVo> getStationRealIds(String param);
List<AnalyzeCodeBySignagesVO> getRealIdByEmCodeAndSign();

9
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StFocusPropertiesServiceImpl.java

@ -22,6 +22,7 @@ import com.hnac.hzinfo.datasearch.analyse.IAnalyseDataSearchClient;
import com.hnac.hzinfo.datasearch.analyse.vo.AnalyzeCodeBySignagesVO;
import com.hnac.hzinfo.sdk.analyse.po.MultiAnalyzeCodePO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.base.BaseServiceImpl;
@ -41,6 +42,7 @@ import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Slf4j
public class StFocusPropertiesServiceImpl extends BaseServiceImpl<StFocusPropertiesMapper, StFocusPropertiesEntity> implements StFocusPropertiesService {
private final IStationService stationService;
@ -73,11 +75,12 @@ public class StFocusPropertiesServiceImpl extends BaseServiceImpl<StFocusPropert
}
@Override
public void getStationRealIds(String param) {
public List<StationRealVo> getStationRealIds(String param) {
// 所有站点
List<StationEntity> stationList = stationService.getAll();
log.error("所有站点:{}", JSONObject.toJSONString(stationList));
if(CollectionUtil.isEmpty(stationList)){
return;
return Lists.newArrayList();
}
// 设备监测点list
Object json = redisTemplate.opsForValue().get(em_info_list_path);
@ -116,7 +119,9 @@ public class StFocusPropertiesServiceImpl extends BaseServiceImpl<StFocusPropert
stationRealVo.setRealId(realArr);
list.add(stationRealVo);
});
log.error("实时监控站点实时设备:{}", JSONObject.toJSONString(list));
redisTemplate.opsForValue().set(moniter_realId_key,list);
return list;
}
/**

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

@ -1539,6 +1539,7 @@ public class HydropowerServiceImpl implements HydropowerService {
Map<String, HeWeatherWeatherDailyResponse> weekWeather = this.weatherService.getWeekWeather(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()));
// 实时监测点数据
List<HydropowerUnitRealVo> reals = (List<HydropowerUnitRealVo>) redisTemplate.opsForValue().get(load_hydropower_unit_real_key);
log.error("实时数据:{}",JSONObject.toJSONString(reals));
/**
* 水位
*/

26
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/RealMonitorServiceImpl.java

@ -170,11 +170,11 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
if(CollectionUtil.isEmpty(realIds)){
return;
}
log.error("real_time_data: {},{}",stationReal.getStation(),realIds);
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds);
List<String> emptyIds = new ArrayList<>();
for(int i = 0; i < realIds.size() ;i++){
if(ObjectUtil.isEmpty(objects.get(i))){
log.error(realIds.get(i) + "is null");
emptyIds.add(realIds.get(i));
}else{
Map<String,String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i));
attribute.put("realId",attribute.get("k"));
@ -188,6 +188,25 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
keyMap.put(realIdArr[i],attribute);
}
}
if (CollectionUtil.isNotEmpty(emptyIds)) {
List<String> restList = redisClient.getBatchRealDataByRealId("901200000034", emptyIds);
for (int i = 0; i < emptyIds.size(); i++) {
if (ObjectUtil.isEmpty(restList.get(i))) {
log.error("获取数据失败:{}", emptyIds.get(i));
} else {
Map<String, String> attribute = (Map<String, String>) JSONObject.parse(restList.get(i));
attribute.put("realId", attribute.get("k"));
attribute.put("value", attribute.get("v"));
attribute.put("time", attribute.get("t"));
attribute.remove("v");
attribute.remove("k");
attribute.remove("t");
this.getCheckMap(attribute, switchOnOff);
valueMap.put(emptyIds.get(i), attribute.get("value"));
keyMap.put(emptyIds.get(i), attribute);
}
}
}
});
countDownLatch.countDown();
}));
@ -195,7 +214,7 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
try {
countDownLatch.await();
} catch (InterruptedException e) {
e.printStackTrace();
log.error("线程等待异常",e);
Thread.currentThread().interrupt();
}
pool.shutdown();
@ -204,7 +223,6 @@ public class RealMonitorServiceImpl implements IRealMonitorService {
redisTemplate.opsForValue().set(real_id_key_gather_path,JSONObject.toJSONString(keyMap));
Long endTime = System.currentTimeMillis();
Long time = endTime - beginTime;
log.error("处理redis实时数据 耗时 : {}",time);
}
/**

Loading…
Cancel
Save