Browse Source

# 站点集中监控属性绑定采集点更新操作接口提供

# 站点管理新增时bug处理
zhongwei
haungxing 2 years ago
parent
commit
b7d5411390
  1. 6
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationAttributeEntity.java
  2. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java
  3. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java
  4. 40
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java
  5. 7
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java
  6. 3
      hzims-service/operational/src/main/resources/db/1.0.2.sql

6
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/station/entity/StationAttributeEntity.java

@ -94,4 +94,10 @@ public class StationAttributeEntity extends TenantEntity implements Serializable
@ApiModelProperty("单位")
private String unit;
@ApiModelProperty("监测点映射标识")
private String signage;
@ApiModelProperty("物模型属性名称")
private String signageName;
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/StationAttributeController.java

@ -90,4 +90,11 @@ public class StationAttributeController extends BladeController {
public R removeByIds(@RequestParam String ids) {
return R.status(stationAttributeService.deleteLogic(Func.toLongList(ids)));
}
@PutMapping("/bandingMonitor/{emCode}")
@ApiOperation("根据设备编码更新集中监控监测点绑定")
@ApiOperationSupport(order = 4)
public R<List<StationAttributeVo>> bandingMonitor(@PathVariable @ApiParam(value = "设备编码",required = true) String emCode) {
return R.data(stationAttributeService.bandingMonitor(emCode));
}
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationAttributeService.java

@ -3,9 +3,12 @@ package com.hnac.hzims.operational.station.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.station.dto.StationAttributeDto;
import com.hnac.hzims.operational.station.entity.StationAttributeEntity;
import com.hnac.hzims.operational.station.vo.StationAttributeVo;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
import java.util.Map;
@ -41,4 +44,6 @@ public interface IStationAttributeService extends BaseService<StationAttributeEn
* @param stationCode 站点编码
*/
void removeByStationCode(String stationCode);
List<StationAttributeVo> bandingMonitor(String emCode);
}

40
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationAttributeServiceImpl.java

@ -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;
}
}

7
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -98,11 +98,8 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
});
// 如果设备数据来源未选定其他 则进行站点初始化操作
if (!StationConstants.HZ3000_OTHER.equals(req.getDataSource())) {
// 智能诊断站点推送
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(() -> questionClient.submitStationInfo(req.getCode(), ""));
// 新建项目
executor.submit(() -> this.instanceProject(req));
new Thread(()->questionClient.submitStationInfo(req.getCode(), ""),"智能诊断站点推送").start();
new Thread(()->this.instanceProject(req),"新建项目").start();
}
}

3
hzims-service/operational/src/main/resources/db/1.0.2.sql

@ -0,0 +1,3 @@
-- 站点集中监控属性表添加物模型属性标识、名称
alter table hzims_station_attribute add column `SIGNAGE` VARCHAR(50) default null comment '加物模型属性标识';
alter table hzims_station_attribute add column `SIGNAGE_NAME` VARCHAR(100) default null comment '加物模型属性标识名称';
Loading…
Cancel
Save