|
|
|
@ -3,6 +3,7 @@ package com.hnac.hzims.operational.station.service.impl;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.google.common.collect.Lists; |
|
|
|
|
import com.hnac.hzims.common.service.UserAuthDataService; |
|
|
|
|
import com.hnac.hzims.fdp.vo.FdpFaultStatusVo; |
|
|
|
|
import com.hnac.hzims.operational.station.entity.StationAttrConfigEntity; |
|
|
|
@ -13,20 +14,25 @@ import com.hnac.hzims.operational.station.service.IStationAttrConfigService;
|
|
|
|
|
import com.hnac.hzims.operational.station.service.IStationAttributeService; |
|
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
|
import com.hnac.hzims.operational.station.vo.StationAttributeVo; |
|
|
|
|
import com.hnac.hzinfo.sdk.v5.device.client.DeviceClient; |
|
|
|
|
import com.hnac.hzinfo.sdk.v5.device.vo.DeviceInstanceAttrVO; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
import org.springblade.core.tool.utils.CollectionUtil; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.HashMap; |
|
|
|
@ -45,6 +51,7 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
|
|
|
|
|
private final UserAuthDataService userAuthDataService; |
|
|
|
|
private final IStationAttrConfigService stationAttrConfigService; |
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
private final DeviceClient deviceClient; |
|
|
|
|
|
|
|
|
|
@Value("${hzims.equipment.fdp.redisData}") |
|
|
|
|
public String redisFdpFaultDataAddr; |
|
|
|
@ -192,4 +199,37 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut
|
|
|
|
|
this.deleteLogic(list.stream().map(StationAttributeEntity::getId).collect(Collectors.toList())); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 根据设备编码更新集中监控监测点绑定 |
|
|
|
|
* @param emCode 设备编码 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public List<StationAttributeVo> bandingMonitor(String emCode) { |
|
|
|
|
List<StationAttributeVo> result = new ArrayList<>(); |
|
|
|
|
LambdaQueryWrapper<StationAttributeEntity> wq = Wrappers.<StationAttributeEntity>lambdaQuery().eq(StationAttributeEntity::getEmCode, emCode); |
|
|
|
|
List<StationAttributeEntity> attributeEntities = this.list(wq); |
|
|
|
|
if(CollectionUtil.isEmpty(attributeEntities)) { |
|
|
|
|
return Lists.newArrayList(); |
|
|
|
|
} |
|
|
|
|
// 获取设备实例物模型绑定数据
|
|
|
|
|
R<List<DeviceInstanceAttrVO>> onlineAttrR= deviceClient.getOnlineAttr(emCode); |
|
|
|
|
Assert.isTrue(onlineAttrR.isSuccess(),() -> { |
|
|
|
|
throw new ServiceException(onlineAttrR.getMsg()); |
|
|
|
|
}); |
|
|
|
|
if(CollectionUtil.isNotEmpty(onlineAttrR.getData())) { |
|
|
|
|
Map<String, List<DeviceInstanceAttrVO>> stringListMap = onlineAttrR.getData().stream().collect(Collectors.groupingBy(DeviceInstanceAttrVO::getSignage)); |
|
|
|
|
result = attributeEntities.stream().map(attributeEntity -> { |
|
|
|
|
StationAttributeVo attributeVo = BeanUtil.copy(attributeEntity, StationAttributeVo.class); |
|
|
|
|
List<DeviceInstanceAttrVO> deviceInstanceAttrVOS = stringListMap.get(attributeEntity.getSignage()); |
|
|
|
|
if(CollectionUtil.isNotEmpty(deviceInstanceAttrVOS)) { |
|
|
|
|
attributeVo.setMonitorId(deviceInstanceAttrVOS.get(0).getFacDeviceAttrId()); |
|
|
|
|
attributeVo.setMonitorName(deviceInstanceAttrVOS.get(0).getFacDeviceAttrName()); |
|
|
|
|
} |
|
|
|
|
return attributeVo; |
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|