# update 权限相关

This commit is contained in:
2026-08-25 12:36:10 +08:00
parent 33df2ff0f7
commit 544efbd0f9
3 changed files with 9 additions and 12 deletions

View File

@@ -117,8 +117,7 @@ public class TransferDeviceController extends BaseController {
if (StringUtils.isEmpty(bindDTO.getPlatform())) {
return AjaxResult.error("平台为空!");
}
LoginUser user = getLoginUser();
transferDeviceService.releaseControl(bindDTO, user);
transferDeviceService.releaseControl(bindDTO);
return AjaxResult.success();
}
}

View File

@@ -96,7 +96,7 @@ public class DeviceThreadService {
String[] parts = k.split(":");
String deviceId = parts[1];
NettyDevice slaveDevice = sessionManager.getDevice(deviceId);
if (slaveDevice != null && slaveDevice.isOnline()) {
if (slaveDevice != null && slaveDevice.getOnlineStatus() == 1) {
Long siteId = slaveDevice.getDevice().getSiteId();
Long orgId = slaveDevice.getDevice().getOrgId();
log.debug("compare siteId:{},orgId:{}", siteId, orgId);

View File

@@ -344,19 +344,17 @@ public class TransferDeviceService {
}
}
public void releaseControl(DeviceBindDTO bindDTO, LoginUser user) {
public void releaseControl(DeviceBindDTO bindDTO) {
try {
String platform = bindDTO.getPlatform();
String userName = user.getUsername();
String masterId = userName + ":" + platform;
Integer type = bindDTO.getType();
NettyDevice deviceMaster = sessionManager.getDevice(masterId);
if (type != null && deviceMaster != null) {
String masterId = sessionManager.getMaster(bindDTO.getDeviceId());
if (type != null && !StringUtils.isEmpty(masterId)) {
NettyDevice device = sessionManager.getDevice(masterId);
if (type == 1) {
deviceMaster.setCurrentSlaveId(null);
deviceMaster.getConnectedConnectors().clear();
device.setCurrentSlaveId(null);
device.getConnectedConnectors().clear();
} else if (type == 2) {
deviceMaster.setConnectorStatus(ConnectorStatus.RECEIVER);
device.setConnectorStatus(ConnectorStatus.RECEIVER);
}
}
sessionManager.unLock(bindDTO.getDeviceId(), bindDTO.getToken(), false);