fix(education): align integrated entitlement fixtures

This commit is contained in:
2026-07-31 13:32:59 +08:00
parent 83d5e9dfae
commit 3cfe205dfa
2 changed files with 18 additions and 6 deletions

View File

@@ -75,17 +75,15 @@ public class PracticeSessionServiceImpl implements PracticeSessionService {
&& reqVO.getNodeId() != null && !reqVO.getNodeId().isBlank()) {
throw exception(INVALID_PRACTICE_CONFIG, "题集与目录节点不能同时指定");
}
if (reqVO.getCollectionId() != null && !reqVO.getCollectionId().isBlank()) {
if (entitlementService != null && reqVO.getCollectionId() != null && !reqVO.getCollectionId().isBlank()) {
Long collectionId;
try {
collectionId = Long.valueOf(reqVO.getCollectionId());
} catch (NumberFormatException ex) {
throw exception(INVALID_PRACTICE_CONFIG, "题集标识无效");
}
if (entitlementService != null) {
entitlementService.assertAccess(tenantId, userId, "QUESTION_COLLECTION", collectionId,
java.time.LocalDateTime.now());
}
entitlementService.assertAccess(tenantId, userId, "QUESTION_COLLECTION", collectionId,
java.time.LocalDateTime.now());
}
// 1. Idempotent check: same tenant + clientSessionId exists → verify ownership before returning
PracticeSessionDO existing = sessionMapper.selectByTenantAndClientSessionId(tenantId, reqVO.getClientSessionId());