Commit 37fa55ac5b4b3e3b6b8f0e4f6f7708af4d80f0a3

Authored by xp.Huang
2 parents 50edfb21 bf5327e1

Merge branch '20220301' into 'master'

fix: 修复脚本转换脚本阻塞RPC调用

See merge request huang/thingsboard3.3.2!52
... ... @@ -137,7 +137,7 @@ public class YtDeviceProfileController extends BaseController {
137 137 @RequestParam(value = ORDER_FILED, required = false) String orderBy,
138 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 141 return ytDeviceProfileService.page(pageLink, getCurrentUser().getCurrentTenantId(), transportType);
142 142 }
143 143
... ...
... ... @@ -373,11 +373,17 @@ public class ConvertConfigServiceImpl
373 373 int newFirstNodeIndex = ruleChainMetaData.getNodes().size() - 1;
374 374 ruleChainMetaData.setFirstNodeIndex(newFirstNodeIndex);
375 375 // 3. Add Connection
  376 + NodeConnectionInfo failedConnectionInfo = new NodeConnectionInfo();
  377 + failedConnectionInfo.setFromIndex(newFirstNodeIndex);
  378 + failedConnectionInfo.setType("Failure");
  379 + failedConnectionInfo.setToIndex(firstNodeIndex);
  380 +
376 381 NodeConnectionInfo nodeConnectionInfo = new NodeConnectionInfo();
377 382 nodeConnectionInfo.setFromIndex(newFirstNodeIndex);
378 383 nodeConnectionInfo.setType(connectionType);
379 384 nodeConnectionInfo.setToIndex(firstNodeIndex);
380 385 ruleChainMetaData.getConnections().add(nodeConnectionInfo);
  386 + ruleChainMetaData.getConnections().add(failedConnectionInfo);
381 387 }
382 388
383 389 private void addSceneRuleNode(RuleNode ruleNode, RuleChainMetaData ruleChainMetaData) {
... ...
... ... @@ -124,6 +124,9 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap
124 124 if (sceneLinkage == null) {
125 125 throw new YtDataValidationException("此场景已不存在");
126 126 }
  127 + if (!sceneLinkage.getCreator().equals(currentUserId)) {
  128 + throw new YtDataValidationException("你不是此场景的创建者");
  129 + }
127 130 String organizationId = sceneLinkage.getOrganizationId();
128 131 List<DeviceDTO> organizationDevices = findDeviceList(organizationId,tenantAdmin,tenantId,currentUserId);
129 132
... ... @@ -277,10 +280,8 @@ public class SceneLinkageServiceImpl extends AbstractBaseService<SceneLinkageMap
277 280 if (null != organizationId && !StringUtils.isEmpty(organizationId)) {
278 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 286 IPage<SceneLinkage> page = getPage(queryMap, FastIotConstants.DefaultOrder.CREATE_TIME, false);
286 287 IPage<SceneLinkageDTO> scenePage = baseMapper.getScenePage(page, queryMap);
... ...
... ... @@ -42,6 +42,9 @@
42 42 #{organizationId}
43 43 </foreach>
44 44 </if>
  45 + <if test="queryMap.currentUser !=null">
  46 + AND s.creator = #{queryMap.currentUser}
  47 + </if>
45 48 </where>
46 49 </select>
47 50
... ...