|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
package com.supervision.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.supervision.constant.UserTokenConstant;
|
|
|
|
|
import com.supervision.service.DiagnoseHallService;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -13,9 +16,18 @@ public class DiagnoseHallServiceImpl implements DiagnoseHallService {
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate<String,String> redisTemplate;
|
|
|
|
|
|
|
|
|
|
@Value("${human.resourceMaxNumber}")
|
|
|
|
|
private String resourceNumber;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean achieveDiagnoseResource() {
|
|
|
|
|
return false;
|
|
|
|
|
long humanMaxNumber = Long.parseLong(resourceNumber);
|
|
|
|
|
Long currentUserNum = redisTemplate.opsForSet().size(UserTokenConstant.USER_ID_CACHE);
|
|
|
|
|
// 如果小于数字人最大连接数,则可以连接
|
|
|
|
|
if (null == currentUserNum){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return currentUserNum <= humanMaxNumber;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|