|
|
@ -424,7 +424,18 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
return Maps.newHashMap(); |
|
|
return Maps.newHashMap(); |
|
|
} |
|
|
} |
|
|
//todo 这里主要是组态设计的websocket请求,可能需要修改 |
|
|
//todo 这里主要是组态设计的websocket请求,可能需要修改 |
|
|
return encapsulationQuery(dto.getThingCondition(), dto.getAttrCondition(), dto.getTimeCondition(), dto.getReqParams(), null, null, dto.getSort(), null); |
|
|
|
|
|
|
|
|
String remark = dto.getRemark(); |
|
|
|
|
|
Long tenantCode = dto.getTenantCode(); |
|
|
|
|
|
if (StringUtils.equals(remark, "0")) { |
|
|
|
|
|
tenantCode = UserContext.getRealTenantCode(); |
|
|
|
|
|
} |
|
|
|
|
|
// Map<String, Object> params = new HashMap<>(); |
|
|
|
|
|
// params.put("id", id); |
|
|
|
|
|
// params.put("reqParams", dto.getReqParams()); |
|
|
|
|
|
// Map<String, Object> stringObjectMap1 = telemetryById(params); |
|
|
|
|
|
// Map<String, Object> stringObjectMap = encapsulationQuery(dto.getThingCondition(), dto.getAttrCondition(), dto.getTimeCondition(), dto.getReqParams(), null, null, dto.getSort(), tenantCode); |
|
|
|
|
|
|
|
|
|
|
|
return encapsulationQuery(dto.getThingCondition(), dto.getAttrCondition(), dto.getTimeCondition(), dto.getReqParams(), null, null, dto.getSort(), tenantCode); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@ -489,19 +500,25 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
parmsMap.put("sort", sort); |
|
|
parmsMap.put("sort", sort); |
|
|
resultMap.put("param", parmsMap); |
|
|
resultMap.put("param", parmsMap); |
|
|
resultMap.put("filterParam", reqParams); |
|
|
resultMap.put("filterParam", reqParams); |
|
|
|
|
|
|
|
|
|
|
|
//属性查询类型 |
|
|
|
|
|
Map<String, Object> entityResultMap = new HashMap<>(); |
|
|
|
|
|
Map<String, IotThingViewDTO> entityInfoMap = new HashMap<>(); |
|
|
|
|
|
ApiEntityAttrDTO attrsEntity = ApiEntityAttrDTO.createFromJson(attrCondition); |
|
|
|
|
|
String type = attrsEntity.getType(); |
|
|
//过滤条件的封装 |
|
|
//过滤条件的封装 |
|
|
if (StringUtils.isNotBlank(reqParams)) { |
|
|
if (StringUtils.isNotBlank(reqParams)) { |
|
|
reqParams = packageQueryFilterParams(reqParams); |
|
|
reqParams = packageQueryFilterParams(reqParams); |
|
|
Map<String, Object> conditionMap = BeanUtil.jsonConvertMap(reqParams); |
|
|
Map<String, Object> conditionMap = BeanUtil.jsonConvertMap(reqParams); |
|
|
// thingCondition = (String)conditionMap.get("entitys"); |
|
|
|
|
|
attrCondition = (String) conditionMap.get("attrs"); |
|
|
|
|
|
|
|
|
if (StringUtils.equalsAnyIgnoreCase(type, ApiSeparateAttr.SEPARATE.getValue())) { |
|
|
|
|
|
attrCondition = conditionMap.get("splitAttrs").toString(); |
|
|
|
|
|
}else{ |
|
|
|
|
|
attrCondition = conditionMap.get("attrs").toString(); |
|
|
|
|
|
} |
|
|
//timeCondition = (String)conditionMap.get("times");TODO 暂时时间没有过滤 |
|
|
//timeCondition = (String)conditionMap.get("times");TODO 暂时时间没有过滤 |
|
|
} |
|
|
} |
|
|
//属性查询类型 |
|
|
|
|
|
Map<String, Object> entityResultMap = new HashMap<>(); |
|
|
|
|
|
Map<String, IotThingViewDTO> entityInfoMap = new HashMap<>(); |
|
|
|
|
|
ApiEntityAttrDTO attrsEntity = ApiEntityAttrDTO.createFromJson(attrCondition); |
|
|
|
|
|
String type = attrsEntity.getType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询物和属性的参数 |
|
|
//查询物和属性的参数 |
|
|
Map<String, Collection<String>> paramMap = Maps.newHashMap(); |
|
|
Map<String, Collection<String>> paramMap = Maps.newHashMap(); |
|
|
//分属性 |
|
|
//分属性 |
|
|
@ -563,7 +580,7 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
Map<String, IotThingDictRelationDTO> collect = dictRelationDTOS.stream() |
|
|
Map<String, IotThingDictRelationDTO> collect = dictRelationDTOS.stream() |
|
|
.collect(Collectors.toMap(IotThingDictRelationParamDTO::getCode, |
|
|
.collect(Collectors.toMap(IotThingDictRelationParamDTO::getCode, |
|
|
s-> ConvertUtils.sourceToTarget(s,IotThingDictRelationDTO.class) |
|
|
s-> ConvertUtils.sourceToTarget(s,IotThingDictRelationDTO.class) |
|
|
,(existing, replacement) -> existing)); |
|
|
|
|
|
|
|
|
,(existing, replacement) -> existing)); |
|
|
optional.get().setAttrs(collect); |
|
|
optional.get().setAttrs(collect); |
|
|
entityInfoMap.put(entityCode, optional.get()); |
|
|
entityInfoMap.put(entityCode, optional.get()); |
|
|
} |
|
|
} |
|
|
@ -665,8 +682,8 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
Optional<List<IotThingDictRelationDTO>> dictRelationDTOList = thingManageContextService.findDictRelationAllByIds(attrIds); |
|
|
Optional<List<IotThingDictRelationDTO>> dictRelationDTOList = thingManageContextService.findDictRelationAllByIds(attrIds); |
|
|
Collection<String> dictCodes = dictRelationDTOList.orElseGet(Collections::emptyList).stream().map(IotThingDictRelationDTO::getCode).toList(); |
|
|
Collection<String> dictCodes = dictRelationDTOList.orElseGet(Collections::emptyList).stream().map(IotThingDictRelationDTO::getCode).toList(); |
|
|
paramMap.put(code, dictCodes); |
|
|
paramMap.put(code, dictCodes); |
|
|
// Map<String, IotThingDictRelationDTO> collect = dictRelationDTOList.orElseGet(Collections::emptyList).stream().collect(Collectors.toMap(IotThingDictRelationDTO::getCode, Function.identity(),(existing, replacement) -> existing)); |
|
|
|
|
|
// optional.get().setAttrs(collect); |
|
|
|
|
|
|
|
|
// Map<String, IotThingDictRelationDTO> collect = dictRelationDTOList.orElseGet(Collections::emptyList).stream().collect(Collectors.toMap(IotThingDictRelationDTO::getCode, Function.identity(),(existing, replacement) -> existing)); |
|
|
|
|
|
// optional.get().setAttrs(collect); |
|
|
entityInfoMap.put(code, optional.get()); |
|
|
entityInfoMap.put(code, optional.get()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
@ -681,7 +698,7 @@ public class IotThingApiServiceImpl extends BaseServiceImpl<IotThingApiMapper, I |
|
|
List<String> dictCodes = dictRelationDTOS.stream().map(IotThingDictRelationDTO::getCode).toList(); |
|
|
List<String> dictCodes = dictRelationDTOS.stream().map(IotThingDictRelationDTO::getCode).toList(); |
|
|
paramMap.put(code, dictCodes); |
|
|
paramMap.put(code, dictCodes); |
|
|
//Map<String, IotThingDictRelationDTO> collect = dictRelationDTOS.stream().collect(Collectors.toMap(IotThingDictRelationDTO::getCode, Function.identity())); |
|
|
//Map<String, IotThingDictRelationDTO> collect = dictRelationDTOS.stream().collect(Collectors.toMap(IotThingDictRelationDTO::getCode, Function.identity())); |
|
|
// optional.get().setAttrs(collect); |
|
|
|
|
|
|
|
|
// optional.get().setAttrs(collect); |
|
|
entityInfoMap.put(code, optional.get()); |
|
|
entityInfoMap.put(code, optional.get()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|