Commit e4889489b765b9469c14f1c4877a454bf36f9125

Authored by xp.Huang
2 parents ee415b50 6e7a9b96

Merge branch 'cherry-pick-3c4903c6' into 'master_dev'

fix: 修复场景联动执行动作设备输出选择全部bug

See merge request yunteng/thingskit!324
@@ -748,14 +748,15 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev @@ -748,14 +748,15 @@ public class TkDeviceServiceImpl extends AbstractBaseService<DeviceMapper, TkDev
748 return allDevices; 748 return allDevices;
749 } 749 }
750 @Cacheable( 750 @Cacheable(
751 - cacheNames = cacheName, key = "{#tenantId, #tbDeviceProfileId}") 751 + cacheNames = cacheName, key = "{#tenantId, #deviceProfileId}")
752 @Override 752 @Override
753 - public Map<String, List<String>> getDeviceIdsByDeviceProfileId(String tenantId, String tbDeviceProfileId) { 753 + public Map<String, List<String>> getDeviceIdsByDeviceProfileId(String tenantId, String deviceProfileId) {
754 Map<String, List<String>> result; 754 Map<String, List<String>> result;
755 List<TkDeviceEntity> organizationDevices = 755 List<TkDeviceEntity> organizationDevices =
756 baseMapper.selectList( 756 baseMapper.selectList(
757 new LambdaQueryWrapper<TkDeviceEntity>().eq(TkDeviceEntity::getTenantId,tenantId) 757 new LambdaQueryWrapper<TkDeviceEntity>().eq(TkDeviceEntity::getTenantId,tenantId)
758 - .eq(TkDeviceEntity::getProfileId, tbDeviceProfileId)); 758 + .eq(TkDeviceEntity::getProfileId, deviceProfileId)
  759 + .or().eq(TkDeviceEntity::getDeviceProfileId,deviceProfileId));
759 if(null !=organizationDevices && !organizationDevices.isEmpty()){ 760 if(null !=organizationDevices && !organizationDevices.isEmpty()){
760 result = new HashMap<>(); 761 result = new HashMap<>();
761 organizationDevices.stream().forEach(entity->{ 762 organizationDevices.stream().forEach(entity->{
@@ -219,10 +219,10 @@ public interface TkDeviceService extends BaseService<TkDeviceEntity> { @@ -219,10 +219,10 @@ public interface TkDeviceService extends BaseService<TkDeviceEntity> {
219 /** 219 /**
220 * 根据tbDeviceProfileId查询所有的组织与设备关系 220 * 根据tbDeviceProfileId查询所有的组织与设备关系
221 * @param tenantId 租户ID 221 * @param tenantId 租户ID
222 - * @param tbDeviceProfileId 设备配置ID 222 + * @param deviceProfileId 或 tk_device_profile id 设备配置ID
223 * @return 组织ID作为key,设备ID列表作为value 223 * @return 组织ID作为key,设备ID列表作为value
224 */ 224 */
225 - Map<String, List<String>> getDeviceIdsByDeviceProfileId(String tenantId, String tbDeviceProfileId); 225 + Map<String, List<String>> getDeviceIdsByDeviceProfileId(String tenantId, String deviceProfileId);
226 226
227 ListenableFuture<List<DeviceDTO>> findDeviceListByDeviceProfileId(String deviceProfileId,String tenantId,String organizationId); 227 ListenableFuture<List<DeviceDTO>> findDeviceListByDeviceProfileId(String deviceProfileId,String tenantId,String organizationId);
228 228
@@ -434,8 +434,7 @@ class ReactState { @@ -434,8 +434,7 @@ class ReactState {
434 if (ScopeEnum.ALL.equals(action.getEntityType())) { 434 if (ScopeEnum.ALL.equals(action.getEntityType())) {
435 rpcDevices = 435 rpcDevices =
436 tkDeviceService.getDevicesByOrganizationIdAndProjectId(action.getTenantId(), orgId, 436 tkDeviceService.getDevicesByOrganizationIdAndProjectId(action.getTenantId(), orgId,
437 - tkDeviceService.getDeviceIdsByDeviceProfileId(action.getTenantId(),  
438 - msg.getMetaData().getValue("deviceProfileId"))); 437 + tkDeviceService.getDeviceIdsByDeviceProfileId(action.getTenantId(),action.getDeviceProfileId()));
439 } 438 }
440 rpcMsg(ctx, msg, rpcDevices, action.getDoContext(), action.getCallType()); 439 rpcMsg(ctx, msg, rpcDevices, action.getDoContext(), action.getCallType());
441 break; 440 break;