Commit 37fa55ac5b4b3e3b6b8f0e4f6f7708af4d80f0a3
Merge branch '20220301' into 'master'
fix: 修复脚本转换脚本阻塞RPC调用 See merge request huang/thingsboard3.3.2!52
Showing
4 changed files
with
15 additions
and
5 deletions
@@ -137,7 +137,7 @@ public class YtDeviceProfileController extends BaseController { | @@ -137,7 +137,7 @@ public class YtDeviceProfileController extends BaseController { | ||
137 | @RequestParam(value = ORDER_FILED, required = false) String orderBy, | 137 | @RequestParam(value = ORDER_FILED, required = false) String orderBy, |
138 | @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) throws ThingsboardException { | 138 | @RequestParam(value = ORDER_TYPE, required = false) OrderTypeEnum orderType) throws ThingsboardException { |
139 | 139 | ||
140 | - PageLink pageLink = createPageLink(pageSize, page > 1 ? page - 1 : 0, name, orderBy, orderType == null ? "" : orderType.name()); | 140 | + PageLink pageLink = createPageLink(pageSize, page > 1 ? page - 1 : 0, name, orderBy==null ? "createdTime":orderBy, orderType == null ? OrderTypeEnum.DESC.name(): orderType.name()); |
141 | return ytDeviceProfileService.page(pageLink, getCurrentUser().getCurrentTenantId(), transportType); | 141 | return ytDeviceProfileService.page(pageLink, getCurrentUser().getCurrentTenantId(), transportType); |
142 | } | 142 | } |
143 | 143 |
@@ -373,11 +373,17 @@ public class ConvertConfigServiceImpl | @@ -373,11 +373,17 @@ public class ConvertConfigServiceImpl | ||
373 | int newFirstNodeIndex = ruleChainMetaData.getNodes().size() - 1; | 373 | int newFirstNodeIndex = ruleChainMetaData.getNodes().size() - 1; |
374 | ruleChainMetaData.setFirstNodeIndex(newFirstNodeIndex); | 374 | ruleChainMetaData.setFirstNodeIndex(newFirstNodeIndex); |
375 | // 3. Add Connection | 375 | // 3. Add Connection |
376 | + NodeConnectionInfo failedConnectionInfo = new NodeConnectionInfo(); | ||
377 | + failedConnectionInfo.setFromIndex(newFirstNodeIndex); | ||
378 | + failedConnectionInfo.setType("Failure"); | ||
379 | + failedConnectionInfo.setToIndex(firstNodeIndex); | ||
380 | + | ||
376 | NodeConnectionInfo nodeConnectionInfo = new NodeConnectionInfo(); | 381 | NodeConnectionInfo nodeConnectionInfo = new NodeConnectionInfo(); |
377 | nodeConnectionInfo.setFromIndex(newFirstNodeIndex); | 382 | nodeConnectionInfo.setFromIndex(newFirstNodeIndex); |
378 | nodeConnectionInfo.setType(connectionType); | 383 | nodeConnectionInfo.setType(connectionType); |
379 | nodeConnectionInfo.setToIndex(firstNodeIndex); | 384 | nodeConnectionInfo.setToIndex(firstNodeIndex); |
380 | ruleChainMetaData.getConnections().add(nodeConnectionInfo); | 385 | ruleChainMetaData.getConnections().add(nodeConnectionInfo); |
386 | + ruleChainMetaData.getConnections().add(failedConnectionInfo); | ||
381 | } | 387 | } |
382 | 388 | ||
383 | private void addSceneRuleNode(RuleNode ruleNode, RuleChainMetaData ruleChainMetaData) { | 389 | private void addSceneRuleNode(RuleNode ruleNode, RuleChainMetaData ruleChainMetaData) { |
@@ -124,6 +124,9 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap | @@ -124,6 +124,9 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap | ||
124 | if (sceneLinkage == null) { | 124 | if (sceneLinkage == null) { |
125 | throw new YtDataValidationException("此场景已不存在"); | 125 | throw new YtDataValidationException("此场景已不存在"); |
126 | } | 126 | } |
127 | + if (!sceneLinkage.getCreator().equals(currentUserId)) { | ||
128 | + throw new YtDataValidationException("你不是此场景的创建者"); | ||
129 | + } | ||
127 | String organizationId = sceneLinkage.getOrganizationId(); | 130 | String organizationId = sceneLinkage.getOrganizationId(); |
128 | List<DeviceDTO> organizationDevices = findDeviceList(organizationId,tenantAdmin,tenantId,currentUserId); | 131 | List<DeviceDTO> organizationDevices = findDeviceList(organizationId,tenantAdmin,tenantId,currentUserId); |
129 | 132 | ||
@@ -277,10 +280,8 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap | @@ -277,10 +280,8 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap | ||
277 | if (null != organizationId && !StringUtils.isEmpty(organizationId)) { | 280 | if (null != organizationId && !StringUtils.isEmpty(organizationId)) { |
278 | queryMap.put("organizationIds", getQueryOrganizationIds(tenantId, Arrays.asList(organizationId))); | 281 | queryMap.put("organizationIds", getQueryOrganizationIds(tenantId, Arrays.asList(organizationId))); |
279 | } | 282 | } |
280 | - if (null == organizationId && isCustomerUser) { | ||
281 | - String currentUserId = (String) queryMap.get("currentUser"); | ||
282 | - List<String> ids = userOrganizationMappingService.getOrganizationIdsByUserId(currentUserId); | ||
283 | - queryMap.put("organizationIds", getQueryOrganizationIds(tenantId, ids)); | 283 | + if (!isCustomerUser) { |
284 | + queryMap.remove("currentUser"); | ||
284 | } | 285 | } |
285 | IPage<SceneLinkage> page = getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false); | 286 | IPage<SceneLinkage> page = getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false); |
286 | IPage<SceneLinkageDTO> scenePage = baseMapper.getScenePage(page, queryMap); | 287 | IPage<SceneLinkageDTO> scenePage = baseMapper.getScenePage(page, queryMap); |