# update 权限相关
This commit is contained in:
@@ -117,8 +117,7 @@ public class TransferDeviceController extends BaseController {
|
|||||||
if (StringUtils.isEmpty(bindDTO.getPlatform())) {
|
if (StringUtils.isEmpty(bindDTO.getPlatform())) {
|
||||||
return AjaxResult.error("平台为空!");
|
return AjaxResult.error("平台为空!");
|
||||||
}
|
}
|
||||||
LoginUser user = getLoginUser();
|
transferDeviceService.releaseControl(bindDTO);
|
||||||
transferDeviceService.releaseControl(bindDTO, user);
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class DeviceThreadService {
|
|||||||
String[] parts = k.split(":");
|
String[] parts = k.split(":");
|
||||||
String deviceId = parts[1];
|
String deviceId = parts[1];
|
||||||
NettyDevice slaveDevice = sessionManager.getDevice(deviceId);
|
NettyDevice slaveDevice = sessionManager.getDevice(deviceId);
|
||||||
if (slaveDevice != null && slaveDevice.isOnline()) {
|
if (slaveDevice != null && slaveDevice.getOnlineStatus() == 1) {
|
||||||
Long siteId = slaveDevice.getDevice().getSiteId();
|
Long siteId = slaveDevice.getDevice().getSiteId();
|
||||||
Long orgId = slaveDevice.getDevice().getOrgId();
|
Long orgId = slaveDevice.getDevice().getOrgId();
|
||||||
log.debug("compare siteId:{},orgId:{}", siteId, orgId);
|
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 {
|
try {
|
||||||
String platform = bindDTO.getPlatform();
|
|
||||||
String userName = user.getUsername();
|
|
||||||
String masterId = userName + ":" + platform;
|
|
||||||
Integer type = bindDTO.getType();
|
Integer type = bindDTO.getType();
|
||||||
NettyDevice deviceMaster = sessionManager.getDevice(masterId);
|
String masterId = sessionManager.getMaster(bindDTO.getDeviceId());
|
||||||
if (type != null && deviceMaster != null) {
|
if (type != null && !StringUtils.isEmpty(masterId)) {
|
||||||
|
NettyDevice device = sessionManager.getDevice(masterId);
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
deviceMaster.setCurrentSlaveId(null);
|
device.setCurrentSlaveId(null);
|
||||||
deviceMaster.getConnectedConnectors().clear();
|
device.getConnectedConnectors().clear();
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
deviceMaster.setConnectorStatus(ConnectorStatus.RECEIVER);
|
device.setConnectorStatus(ConnectorStatus.RECEIVER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sessionManager.unLock(bindDTO.getDeviceId(), bindDTO.getToken(), false);
|
sessionManager.unLock(bindDTO.getDeviceId(), bindDTO.getToken(), false);
|
||||||
|
|||||||
Reference in New Issue
Block a user