Commit 458462dfb5403f7a9ced0be89abb745d912dcca0
1 parent
a6ce8145
fix:api/yt/device/list 接口添加isExcludeCloud参数
Showing
8 changed files
with
31 additions
and
21 deletions
... | ... | @@ -393,25 +393,30 @@ public class TkDeviceController extends BaseController { |
393 | 393 | @ApiParam(value = "是否场景联动调用,是true") @RequestParam(value = "isSceneLinkage", required = false) Boolean isSceneLinkage, |
394 | 394 | @ApiParam(value = "是否边缘分配设备调用,是true") @RequestParam(value = "isEdgeDistribution", required = false) Boolean isEdgeDistribution, |
395 | 395 | @ApiParam(value = "edgeId") @RequestParam(value = "edgeId", required = false) String edgeId, |
396 | - @ApiParam(value = "排除边端设备是true") @RequestParam(value = "isExcludeEdge", required = false) Boolean isExcludeEdge | |
396 | + @ApiParam(value = "排除边端设备是true") @RequestParam(value = "isExcludeEdge", required = false) Boolean isExcludeEdge, | |
397 | + @ApiParam(value = "排除云端设备是true") @RequestParam(value = "isExcludeCloud", required = false) Boolean isExcludeCloud | |
397 | 398 | ) |
398 | 399 | throws ThingsboardException { |
399 | - if(isExcludeEdge==null){ | |
400 | - isExcludeEdge=false; | |
400 | + if (isExcludeEdge == null) { | |
401 | + isExcludeEdge = false; | |
402 | + } | |
403 | + if (isExcludeCloud == null) { | |
404 | + isExcludeCloud = false; | |
401 | 405 | } |
402 | 406 | return tkdeviceService.findDevicesByDeviceTypeAndOrganizationId( |
403 | - deviceType, | |
404 | - getCurrentUser().getTenantId().getId(), | |
405 | - organizationId, | |
406 | - deviceLabel, | |
407 | - StringUtils.isEmpty(deviceProfileId)?null:UUID.fromString(deviceProfileId), | |
408 | - transportType, | |
409 | - isSceneLinkage, | |
410 | - isEdgeDistribution, | |
411 | - StringUtils.isEmpty(edgeId)?null:UUID.fromString(edgeId), | |
412 | - isExcludeEdge | |
407 | + deviceType, | |
408 | + getCurrentUser().getTenantId().getId(), | |
409 | + organizationId, | |
410 | + deviceLabel, | |
411 | + StringUtils.isEmpty(deviceProfileId) ? null : UUID.fromString(deviceProfileId), | |
412 | + transportType, | |
413 | + isSceneLinkage, | |
414 | + isEdgeDistribution, | |
415 | + StringUtils.isEmpty(edgeId) ? null : UUID.fromString(edgeId), | |
416 | + isExcludeEdge, | |
417 | + isExcludeCloud | |
413 | 418 | ); |
414 | - } | |
419 | + } | |
415 | 420 | |
416 | 421 | |
417 | 422 | @PostMapping("/getListByDeviceProfileIds") | ... | ... |
... | ... | @@ -328,7 +328,8 @@ public class TkDeviceServiceImpl extends AbstractTbBaseService<DeviceMapper, TkD |
328 | 328 | Boolean isSceneLinkage, |
329 | 329 | Boolean isEdgeDistribution, |
330 | 330 | UUID edgeId, |
331 | - Boolean isExcludeEdge) { | |
331 | + Boolean isExcludeEdge, | |
332 | + Boolean isExcludeCloud) { | |
332 | 333 | List<String> orgIds = organizationService.organizationAllIds(tenantId.toString(), organizationId); |
333 | 334 | if (orgIds.isEmpty()) { |
334 | 335 | throw new TkDataValidationException(MessageUtils.message(ErrorMessage.ORGANIZATION_NOT_EXTIED.getI18nCode())); |
... | ... | @@ -336,7 +337,7 @@ public class TkDeviceServiceImpl extends AbstractTbBaseService<DeviceMapper, TkD |
336 | 337 | |
337 | 338 | List<TkDeviceEntity> listEntity = baseMapper.findDevicesByDeviceTypeAndOrganizationId(orgIds, |
338 | 339 | deviceType == null ? null : deviceType.name(), |
339 | - deviceLabel, deviceProfileId, transportTypeEnum,isSceneLinkage,isEdgeDistribution,edgeId,isExcludeEdge); | |
340 | + deviceLabel, deviceProfileId, transportTypeEnum,isSceneLinkage,isEdgeDistribution,edgeId,isExcludeEdge,isExcludeCloud); | |
340 | 341 | return listEntity.stream().map(entity -> { |
341 | 342 | return CopyUtils.copyAndReturn(entity, new DeviceDTO()); |
342 | 343 | } | ... | ... |
... | ... | @@ -62,7 +62,7 @@ public class TkDeviceStateLogServiceImpl |
62 | 62 | } |
63 | 63 | if(isPtCommonTenant){ |
64 | 64 | List<TkDeviceEntity> devices = deviceMapper.findDevicesByDeviceTypeAndOrganizationId((List<String>) queryMap.get("orgIds"), |
65 | - null,null,null,null,false,false,null,false); | |
65 | + null,null,null,null,false,false,null,false,false); | |
66 | 66 | List<String> finalTbDevices = new ArrayList<>(); |
67 | 67 | devices.forEach(item -> finalTbDevices.add(item.getTbDeviceId().toString())); |
68 | 68 | deviceIds = finalTbDevices; | ... | ... |
... | ... | @@ -250,7 +250,7 @@ public class TkHomePageServiceImpl implements HomePageService { |
250 | 250 | totalFilter.put("organizationIds",organizationIds); |
251 | 251 | //查询所有设备 |
252 | 252 | List<TkDeviceEntity> devices = deviceMapper.findDevicesByDeviceTypeAndOrganizationId(organizationIds,null, |
253 | - null,null,null,false,false,null,false); | |
253 | + null,null,null,false,false,null,false,false); | |
254 | 254 | List<String> finalTbDevices = new ArrayList<>(); |
255 | 255 | devices.forEach(item -> finalTbDevices.add(item.getTbDeviceId().toString())); |
256 | 256 | todayFilter.put("deviceIds",finalTbDevices); | ... | ... |
... | ... | @@ -113,7 +113,7 @@ public class TkVideoServiceImpl extends AbstractBaseService<TkVideoMapper, TkVid |
113 | 113 | List<TkVideoGbtDeviceDTO> deviceList = new ArrayList<>(); |
114 | 114 | List<DeviceDTO> deviceDTOS = tkdeviceService.findDevicesByDeviceTypeAndOrganizationId( |
115 | 115 | null, UUID.fromString(dto.getTenantId()),organizationId,null, |
116 | - null, TransportTypeEnum.GBT28181,false,false,null,true); | |
116 | + null, TransportTypeEnum.GBT28181,false,false,null,true,false); | |
117 | 117 | if(deviceDTOS.isEmpty()){ |
118 | 118 | return dto; |
119 | 119 | } | ... | ... |
... | ... | @@ -165,7 +165,8 @@ public interface DeviceMapper extends BaseMapper<TkDeviceEntity> { |
165 | 165 | @Param("isSceneLinkage")Boolean isSceneLinkage, |
166 | 166 | @Param("isEdgeDistribution")Boolean isEdgeDistribution, |
167 | 167 | @Param("edgeId")UUID edgeId, |
168 | - @Param("isExcludeEdge")Boolean isExcludeEdge) ; | |
168 | + @Param("isExcludeEdge")Boolean isExcludeEdge, | |
169 | + @Param("isExcludeCloud")Boolean isExcludeCloud) ; | |
169 | 170 | |
170 | 171 | |
171 | 172 | List<DeviceDTO> findDevicesByProfileIdAndOrganizationId( | ... | ... |
... | ... | @@ -81,7 +81,7 @@ public interface TkDeviceService extends TbBaseService<TkDeviceEntity> { |
81 | 81 | TransportTypeEnum transportTypeEnum, |
82 | 82 | Boolean isSceneLinkage, |
83 | 83 | Boolean isEdgeDistribution, |
84 | - UUID edgeId,Boolean excludeEdge); | |
84 | + UUID edgeId,Boolean excludeEdge,Boolean isExcludeCloud); | |
85 | 85 | |
86 | 86 | |
87 | 87 | List<DeviceDTO> findDevicesByOrganizationIds( | ... | ... |
... | ... | @@ -590,6 +590,9 @@ |
590 | 590 | <if test="isExcludeEdge == true"> |
591 | 591 | and ifd.id not in (SELECT dev.id from device dev inner join relation re_edge on dev.id=re_edge.to_id and re_edge.from_type = 'EDGE' and re_edge.relation_type = 'ManagedByEdge') |
592 | 592 | </if> |
593 | + <if test="isExcludeCloud == true"> | |
594 | + and ifd.id in (SELECT dev.id from device dev inner join relation re_edge on dev.id=re_edge.to_id and re_edge.from_type = 'EDGE' and re_edge.relation_type = 'ManagedByEdge') | |
595 | + </if> | |
593 | 596 | <if test="isSceneLinkage == true"> |
594 | 597 | and re.to_id is null |
595 | 598 | </if> | ... | ... |