# update 权限相关
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user