fix(ops): 区域设备 RPC 接口添加 @TenantIgnore 解决定时任务调用时租户上下文缺失
IoT 模块 BeaconRegistryServiceImpl 每30分钟通过 Feign 调用 /beacons/all 接口, 因定时任务无租户上下文导致 TenantContextHolder NPE。对跨租户查询的方法添加 @TenantIgnore 注解忽略多租户过滤。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.viewsh.module.ops.service.area;
|
||||
|
||||
import com.viewsh.framework.common.util.json.JsonUtils;
|
||||
import com.viewsh.framework.tenant.core.aop.TenantIgnore;
|
||||
import com.viewsh.module.ops.api.area.AreaDeviceDTO;
|
||||
import com.viewsh.module.ops.dal.dataobject.area.OpsAreaDeviceRelationDO;
|
||||
import com.viewsh.module.ops.dal.mysql.area.OpsAreaDeviceRelationMapper;
|
||||
@@ -164,16 +165,19 @@ public class AreaDeviceServiceImpl implements AreaDeviceService, InitializingBea
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore // RPC 接口,跨租户查询全量设备
|
||||
public List<OpsAreaDeviceRelationDO> listAllByType(String relationType) {
|
||||
return relationMapper.selectListByAreaIdAndRelationType(null, relationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore // RPC 接口,跨租户查询全量 Beacon
|
||||
public List<OpsAreaDeviceRelationDO> listAllEnabledBeacons() {
|
||||
return listAllByType("BEACON");
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore // 启动预热,跨租户加载全量配置
|
||||
public void initConfigCache() {
|
||||
log.info("[AreaDevice] 开始初始化区域设备配置缓存...");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user