|
|
@ -209,13 +209,14 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<StationAttributeVo> bandingMonitor(String emCode,String stationType,String emType) { |
|
|
|
public List<StationAttributeVo> bandingMonitor(String stationCode,String emCode,String stationType,String setType) { |
|
|
|
List<StationAttributeVo> result; |
|
|
|
List<StationAttributeVo> result; |
|
|
|
// 获取集中监控属性配置
|
|
|
|
// 获取集中监控属性配置
|
|
|
|
List<FocusAttributeEntity> attributes = attributeService.list(Wrappers.<FocusAttributeEntity>lambdaQuery() |
|
|
|
List<FocusAttributeEntity> attributes = attributeService.list(Wrappers.<FocusAttributeEntity>lambdaQuery() |
|
|
|
.eq(FocusAttributeEntity::getDomainId, stationType) |
|
|
|
.eq(FocusAttributeEntity::getDomainId, stationType) |
|
|
|
.eq(FocusAttributeEntity::getGroupId, emType) |
|
|
|
.eq(FocusAttributeEntity::getGroupId, setType) |
|
|
|
.eq(FocusAttributeEntity::getStatus, 0) |
|
|
|
.eq(FocusAttributeEntity::getStatus, 0) |
|
|
|
|
|
|
|
.orderByAsc(FocusAttributeEntity::getSort) |
|
|
|
); |
|
|
|
); |
|
|
|
// 标识
|
|
|
|
// 标识
|
|
|
|
List<String> signages = attributes.stream().map(FocusAttributeEntity::getSignage).filter(Func::isNotEmpty).collect(Collectors.toList()); |
|
|
|
List<String> signages = attributes.stream().map(FocusAttributeEntity::getSignage).filter(Func::isNotEmpty).collect(Collectors.toList()); |
|
|
@ -225,19 +226,64 @@ public class StationAttributeServiceImpl extends BaseServiceImpl<StationAttribut |
|
|
|
deviceChildrenDTO.setDeviceCode(emCode); |
|
|
|
deviceChildrenDTO.setDeviceCode(emCode); |
|
|
|
deviceChildrenDTO.setType("attr"); |
|
|
|
deviceChildrenDTO.setType("attr"); |
|
|
|
Result<List<DeviceChildrenVO>> deviceChildrenListResult = deviceClient.getRealId(deviceChildrenDTO); |
|
|
|
Result<List<DeviceChildrenVO>> deviceChildrenListResult = deviceClient.getRealId(deviceChildrenDTO); |
|
|
|
boolean facAttrFlag = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData()); |
|
|
|
List<DeviceChildrenVO> modelAttr = deviceChildrenListResult.isSuccess() && CollectionUtil.isNotEmpty(deviceChildrenListResult.getData()) |
|
|
|
// 根据集中监控属性配置获取站点集中监控属性配置
|
|
|
|
? deviceChildrenListResult.getData() : new ArrayList<>(); |
|
|
|
Function<FocusAttributeEntity,StationAttributeVo> convert = focusAttr -> { |
|
|
|
// 获取
|
|
|
|
StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class); |
|
|
|
LambdaQueryWrapper<StationAttributeEntity> queryWrapper = Wrappers.<StationAttributeEntity>lambdaQuery() |
|
|
|
if(facAttrFlag) { |
|
|
|
.eq(StationAttributeEntity::getStationId, stationCode) |
|
|
|
List<DeviceChildrenVO> data = deviceChildrenListResult.getData(); |
|
|
|
.eq(StationAttributeEntity::getEmCode, emCode); |
|
|
|
Optional<DeviceChildrenVO> facAttrOptional = data.stream().filter(attr -> focusAttr.getSignage().equals(attr.getSignage())).findAny(); |
|
|
|
List<StationAttributeEntity> stationAttrList = this.list(queryWrapper); |
|
|
|
vo.setMonitorId(facAttrOptional.map(DeviceChildrenVO::getRealId).orElse(null)); |
|
|
|
result = attributes.stream().map(focusAttr -> this.fillFacAttr(modelAttr,focusAttr,stationCode,emCode)) |
|
|
|
vo.setMonitorName(facAttrOptional.map(DeviceChildrenVO::getName).orElse(null)); |
|
|
|
.map(stationAttr -> this.fillAttrId(stationAttrList,stationAttr)) |
|
|
|
} |
|
|
|
.sorted(Comparator.comparing(StationAttributeVo::getSort,Comparator.nullsLast(Integer::compareTo))) |
|
|
|
return vo; |
|
|
|
.collect(Collectors.toList()); |
|
|
|
}; |
|
|
|
|
|
|
|
result = attributes.stream().map(convert).collect(Collectors.toList()); |
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 根据请求设备实例物模型属性填充集中监控属性配置采集点 |
|
|
|
|
|
|
|
* @param modelAttr 设备实例物模型属性 |
|
|
|
|
|
|
|
* @param focusAttr 集中监控属性配置 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private StationAttributeVo fillFacAttr(List<DeviceChildrenVO> modelAttr,FocusAttributeEntity focusAttr,String stationCode,String emCode) { |
|
|
|
|
|
|
|
StationAttributeVo vo = BeanUtil.copy(focusAttr,StationAttributeVo.class); |
|
|
|
|
|
|
|
Optional<DeviceChildrenVO> facAttrOptional = modelAttr.stream().filter(attr -> focusAttr.getSignage().equals(attr.getSignage())).findAny(); |
|
|
|
|
|
|
|
vo.setMonitorId(facAttrOptional.map(DeviceChildrenVO::getRealId).orElse(null)); |
|
|
|
|
|
|
|
vo.setMonitorName(facAttrOptional.map(DeviceChildrenVO::getName).orElse(null)); |
|
|
|
|
|
|
|
vo.setStationId(stationCode); |
|
|
|
|
|
|
|
vo.setEmCode(emCode); |
|
|
|
|
|
|
|
vo.setEnableShow(true); |
|
|
|
|
|
|
|
vo.setId(null); |
|
|
|
|
|
|
|
vo.setCreateUser(null); |
|
|
|
|
|
|
|
vo.setCreateDept(null); |
|
|
|
|
|
|
|
vo.setCreateTime(null); |
|
|
|
|
|
|
|
vo.setUpdateTime(null); |
|
|
|
|
|
|
|
vo.setUpdateUser(null); |
|
|
|
|
|
|
|
return vo; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 填充属性ID |
|
|
|
|
|
|
|
* @param stationAttrList 已保存进数据库的记录 |
|
|
|
|
|
|
|
* @param stationAttr 填充采集点后的属性模板 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private StationAttributeVo fillAttrId(List<StationAttributeEntity> stationAttrList,StationAttributeVo stationAttr) { |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(stationAttrList)) { |
|
|
|
|
|
|
|
Optional<StationAttributeEntity> attribute = stationAttrList.stream().filter(sa -> stationAttr.getAttributes().equals(sa.getAttributes())).findAny(); |
|
|
|
|
|
|
|
if(attribute.isPresent()) { |
|
|
|
|
|
|
|
StationAttributeVo result = BeanUtil.copy(attribute.get(),StationAttributeVo.class); |
|
|
|
|
|
|
|
result.setSignage(stationAttr.getSignage()); |
|
|
|
|
|
|
|
result.setSignageName(stationAttr.getSignageName()); |
|
|
|
|
|
|
|
result.setMonitorId(stationAttr.getMonitorId()); |
|
|
|
|
|
|
|
result.setMonitorName(stationAttr.getMonitorName()); |
|
|
|
|
|
|
|
result.setUpdateUser(null); |
|
|
|
|
|
|
|
result.setUpdateTime(null); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
stationAttr.setSort(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return stationAttr; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|