案例专家:修改白名单校验逻辑

This commit is contained in:
liu.zixi
2025-10-11 16:57:24 +08:00
parent 24bc40b6ec
commit cb103442e7

View File

@@ -7,6 +7,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 案例AI权限服务实现类
*/
@@ -34,8 +36,10 @@ public class CaseAiPermissionServiceImpl implements ICaseAiPermissionService {
}
// 启用白名单时,判断当前用户是否在白名单中
boolean isInWhiteList = caseAiProperties.getWhiteUserCodeList() != null
&& caseAiProperties.getWhiteUserCodeList().contains(userCode);
List<String> whiteUserCodeList = caseAiProperties.getWhiteUserCodeList();
log.info("白名单列表:{}", whiteUserCodeList);
boolean isInWhiteList = whiteUserCodeList != null
&& whiteUserCodeList.stream().anyMatch(userCode::equals);
log.info("用户[{}]{}在白名单中", userCode, isInWhiteList ? "" : "");
return isInWhiteList;