forked from wangziqi/ruoyi-vue-pro
fix(education): keep capability manifest self-contained
This commit is contained in:
@@ -3,7 +3,8 @@ package cn.iocoder.yudao.module.education.controller.admin;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.config.EducationProperties;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.vo.EducationCapabilityRespVO;
|
||||
import cn.iocoder.yudao.module.education.service.capability.EducationThemeCatalog;
|
||||
import cn.iocoder.yudao.module.education.enums.CatalogProviderMode;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.vo.EducationThemeRespVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -28,9 +29,6 @@ public class EducationCapabilityController {
|
||||
@Resource
|
||||
private EducationProperties educationProperties;
|
||||
|
||||
@Resource
|
||||
private EducationThemeCatalog educationThemeCatalog;
|
||||
|
||||
@GetMapping("/capability")
|
||||
@Operation(summary = "获得教育模块能力信息")
|
||||
@PreAuthorize("@ss.hasPermission('education:capability')")
|
||||
@@ -41,7 +39,7 @@ public class EducationCapabilityController {
|
||||
.version(educationProperties.getVersion())
|
||||
.capabilities(List.of("shell", "catalog", "questions", "practice-preview",
|
||||
"answer-save", "session-submit", "practice-report"))
|
||||
.themes(educationThemeCatalog.describeThemes())
|
||||
.themes(describeThemes())
|
||||
.catalogReadEnabled(educationProperties.isCatalogReadEnabled())
|
||||
.practiceWriteEnabled(educationProperties.isPracticeWriteEnabled())
|
||||
.pilotTenantCount(educationProperties.getPilotTenantIds().size())
|
||||
@@ -49,4 +47,39 @@ public class EducationCapabilityController {
|
||||
return success(resp);
|
||||
}
|
||||
|
||||
private List<EducationThemeRespVO> describeThemes() {
|
||||
List<String> catalogDependencies = educationProperties.getCatalogMode() == CatalogProviderMode.SCALAR_READ
|
||||
? List.of("scalar-catalog") : List.of();
|
||||
return List.of(
|
||||
theme("EDU-011", "content-import-export-assets", "BLOCKED",
|
||||
List.of("education", "infra"),
|
||||
List.of("asset-admission-contract", "scanner-ownership", "durable-job-lease"),
|
||||
List.of(), "FEATURE_FLAG", "CONTRACT_ONLY"),
|
||||
theme("EDU-012", "classes-relationships", "BLOCKED",
|
||||
List.of("education", "member", "system"),
|
||||
List.of("relationship-role-model", "class-data-scope", "invitation-contract"),
|
||||
List.of(), "FEATURE_FLAG", "CONTRACT_ONLY"),
|
||||
theme("EDU-013", "commercialization", "DECISION_REQUIRED",
|
||||
List.of("education", "mall", "pay", "member", "crm"),
|
||||
List.of("entitlement-owner", "grant-revoke-refund-contract"),
|
||||
List.of(), "ACCESS_FAIL_CLOSED", "CONTRACT_ONLY"),
|
||||
theme("EDU-014", "extended-learning", "DECISION_REQUIRED",
|
||||
List.of("education", "member", "system", "infra", "ai"),
|
||||
List.of("capability-family-disposition", "entitlement-and-export-policy"),
|
||||
List.of(), "FEATURE_FLAG", "CONTRACT_ONLY"),
|
||||
theme("EDU-015", "operational-independence",
|
||||
catalogDependencies.isEmpty() ? "PARTIAL" : "LEGACY_DEPENDENT",
|
||||
List.of("education", "infra"),
|
||||
List.of("target-only-runtime-evidence", "worker-scanner-exit-contract"),
|
||||
catalogDependencies, "PROVIDER_SWITCH", "INTEGRATION_TESTED"));
|
||||
}
|
||||
|
||||
private EducationThemeRespVO theme(String key, String name, String status, List<String> owningModules,
|
||||
List<String> blockers, List<String> legacyDependencies, String rollbackCategory, String evidenceLevel) {
|
||||
return EducationThemeRespVO.builder()
|
||||
.key(key).name(name).status(status).owningModules(owningModules)
|
||||
.executableInterfaces(List.of()).blockers(blockers).legacyDependencies(legacyDependencies)
|
||||
.rollbackCategory(rollbackCategory).evidenceLevel(evidenceLevel).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
package cn.iocoder.yudao.module.education.service.capability;
|
||||
|
||||
import cn.iocoder.yudao.module.education.config.EducationProperties;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.vo.EducationThemeRespVO;
|
||||
import cn.iocoder.yudao.module.education.enums.CatalogProviderMode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class EducationThemeCatalog {
|
||||
|
||||
private final EducationProperties properties;
|
||||
|
||||
public EducationThemeCatalog(EducationProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
public List<EducationThemeRespVO> describeThemes() {
|
||||
List<String> catalogDependencies = properties.getCatalogMode() == CatalogProviderMode.SCALAR_READ
|
||||
? List.of("scalar-catalog") : List.of();
|
||||
return List.of(
|
||||
theme("EDU-011", "content-import-export-assets", "BLOCKED",
|
||||
List.of("education", "infra"), List.of(),
|
||||
List.of("asset-admission-contract", "scanner-ownership", "durable-job-lease"),
|
||||
List.of(), "FEATURE_FLAG", "CONTRACT_ONLY"),
|
||||
theme("EDU-012", "classes-relationships", "BLOCKED",
|
||||
List.of("education", "member", "system"), List.of(),
|
||||
List.of("relationship-role-model", "class-data-scope", "invitation-contract"),
|
||||
List.of(), "FEATURE_FLAG", "CONTRACT_ONLY"),
|
||||
theme("EDU-013", "commercialization", "DECISION_REQUIRED",
|
||||
List.of("education", "mall", "pay", "member", "crm"), List.of(),
|
||||
List.of("entitlement-owner", "grant-revoke-refund-contract"),
|
||||
List.of(), "ACCESS_FAIL_CLOSED", "CONTRACT_ONLY"),
|
||||
theme("EDU-014", "extended-learning", "DECISION_REQUIRED",
|
||||
List.of("education", "member", "system", "infra", "ai"), List.of(),
|
||||
List.of("capability-family-disposition", "entitlement-and-export-policy"),
|
||||
List.of(), "FEATURE_FLAG", "CONTRACT_ONLY"),
|
||||
theme("EDU-015", "operational-independence",
|
||||
catalogDependencies.isEmpty() ? "PARTIAL" : "LEGACY_DEPENDENT",
|
||||
List.of("education", "infra"), List.of(),
|
||||
List.of("target-only-runtime-evidence", "worker-scanner-exit-contract"),
|
||||
catalogDependencies, "PROVIDER_SWITCH", "INTEGRATION_TESTED"));
|
||||
}
|
||||
|
||||
private EducationThemeRespVO theme(String key, String name, String status, List<String> owningModules,
|
||||
List<String> executableInterfaces, List<String> blockers, List<String> legacyDependencies,
|
||||
String rollbackCategory, String evidenceLevel) {
|
||||
return EducationThemeRespVO.builder()
|
||||
.key(key).name(name).status(status).owningModules(owningModules)
|
||||
.executableInterfaces(executableInterfaces).blockers(blockers)
|
||||
.legacyDependencies(legacyDependencies).rollbackCategory(rollbackCategory)
|
||||
.evidenceLevel(evidenceLevel).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.config.EducationProperties;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.vo.EducationCapabilityRespVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.vo.EducationThemeRespVO;
|
||||
import cn.iocoder.yudao.module.education.service.capability.EducationThemeCatalog;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
@@ -33,7 +32,7 @@ public class EducationCapabilityControllerTest {
|
||||
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(EducationProperties.class)
|
||||
@Import({EducationCapabilityController.class, EducationThemeCatalog.class})
|
||||
@Import(EducationCapabilityController.class)
|
||||
static class Config {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user