fix: 修复设备数限制
This commit is contained in:
@@ -269,13 +269,16 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
|
|||||||
.eq(UClient::getClientMac, client.getMac()), false);
|
.eq(UClient::getClientMac, client.getMac()), false);
|
||||||
if (ObjectUtil.isNull(loginClient) || ObjectUtil.isNull(loginClient.getUserId())) {
|
if (ObjectUtil.isNull(loginClient) || ObjectUtil.isNull(loginClient.getUserId())) {
|
||||||
wifiApi.cancelAuthClient(site.getSiteId(), client.getMac());
|
wifiApi.cancelAuthClient(site.getSiteId(), client.getMac());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
UAccount account = this.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, loginClient.getUserId()), false);
|
UAccount account = this.getOne(Wrappers.<UAccount>lambdaQuery().eq(UAccount::getUserId, loginClient.getUserId()), false);
|
||||||
if (ObjectUtil.isNull(account)) {
|
if (ObjectUtil.isNull(account)) {
|
||||||
wifiApi.cancelAuthClient(site.getSiteId(), client.getMac());
|
wifiApi.cancelAuthClient(site.getSiteId(), client.getMac());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (!AccountUtil.isValid(account, current)) {
|
if (!AccountUtil.isValid(account, current)) {
|
||||||
wifiApi.cancelAuthClient(site.getSiteId(), client.getMac());
|
wifiApi.cancelAuthClient(site.getSiteId(), client.getMac());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
// 设备数超出限制的话,取消在线时间短的设备
|
// 设备数超出限制的话,取消在线时间短的设备
|
||||||
if (account.getClientNumEnable()) {
|
if (account.getClientNumEnable()) {
|
||||||
@@ -284,7 +287,7 @@ public class UAccountServiceImpl extends ServiceImpl<UAccountMapper, UAccount> i
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
int limitNum = currentClients.size() - account.getClientNum();
|
int limitNum = currentClients.size() - account.getClientNum();
|
||||||
List<UClientCurrentVo> cancelClients = currentClients.stream().sorted(Comparator.comparing(UClientCurrentVo::getUpTime).reversed())
|
List<UClientCurrentVo> cancelClients = currentClients.stream().sorted(Comparator.comparing(UClientCurrentVo::getUpTime))
|
||||||
.limit(limitNum).collect(Collectors.toList());
|
.limit(limitNum).collect(Collectors.toList());
|
||||||
for (UClientCurrentVo cancelClient : cancelClients) {
|
for (UClientCurrentVo cancelClient : cancelClients) {
|
||||||
wifiApi.cancelAuthClient(cancelClient.getSiteId(), cancelClient.getClientMac());
|
wifiApi.cancelAuthClient(cancelClient.getSiteId(), cancelClient.getClientMac());
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class UClientServiceImpl extends ServiceImpl<UClientMapper, UClient> impl
|
|||||||
}
|
}
|
||||||
boolean flag = this.saveOrUpdate(uClient);
|
boolean flag = this.saveOrUpdate(uClient);
|
||||||
// 登录时如果当前用户有可用套餐和余额授权当前设备访问wifi,且根据套餐限制带宽
|
// 登录时如果当前用户有可用套餐和余额授权当前设备访问wifi,且根据套餐限制带宽
|
||||||
if (StrUtil.isNotBlank(uClientBo.getClientName()) && StrUtil.isNotBlank(uClientBo.getSiteId())) {
|
if (StrUtil.isNotBlank(uClientBo.getClientMac()) && StrUtil.isNotBlank(uClientBo.getSiteId())) {
|
||||||
accountService.authClientAndRateLimit(uClientBo);
|
accountService.authClientAndRateLimit(uClientBo);
|
||||||
}
|
}
|
||||||
return flag;
|
return flag;
|
||||||
|
|||||||
Reference in New Issue
Block a user