Compare commits
83 Commits
f22bab6586
...
v0.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 229f930538 | |||
| ca7409a68b | |||
| 0af91622d3 | |||
| ddd95ec512 | |||
| 35376df79b | |||
| 4586747331 | |||
| a8587ad08f | |||
| fc990bc624 | |||
| 9a2bb6b020 | |||
| a294ce791d | |||
| dffbb5ff6a | |||
| d5300ed752 | |||
| 8d8dc7bf1d | |||
| dc88984a8b | |||
| 6db64917a2 | |||
| a841652fd4 | |||
| c409cf47e5 | |||
| abf82f86ab | |||
| 891c461aff | |||
| 04361a5880 | |||
| 0eba587459 | |||
| 453193e857 | |||
| c8a221acbc | |||
| 184452404d | |||
| 4573c41c0e | |||
| 26f9bcf696 | |||
| bd956bcb35 | |||
| fce2c6bc4a | |||
| d81c297381 | |||
| 5ddfba2045 | |||
| 68815b1fda | |||
| 3cfe205dfa | |||
| 83d5e9dfae | |||
| a267786e5a | |||
| 5aba83561e | |||
| ed24350443 | |||
| 268a29364b | |||
| 7f12dd35c8 | |||
| b6a30e0b7c | |||
| 82a0a7fc50 | |||
| 3744c8c3be | |||
| 2a53e8e2c0 | |||
| 26fa2dfaa2 | |||
| e6202187ec | |||
| be2c22e440 | |||
| b8b06e0292 | |||
| efaab4e03a | |||
| 5bc1e9e634 | |||
| 8312859b39 | |||
| f42ef76527 | |||
| 428d4e10fd | |||
| 3fdc4edfe0 | |||
| f65a39b902 | |||
| bc2d555eb3 | |||
| b531be0d5b | |||
| b569371005 | |||
| 2df6b3f26c | |||
| c3c244a6f5 | |||
| eae5a6bb3a | |||
| 1be0b420c8 | |||
| 588dd82638 | |||
| 5bd2f6758f | |||
| c6b482fa2b | |||
| 08825ddb12 | |||
| e272b8ec5f | |||
| 9a4d72bba4 | |||
| 10a4e087ea | |||
| de7fe04c0c | |||
| 8861b6c8dc | |||
| f445c61f92 | |||
| 62bbdd4b87 | |||
| 2daeb43c5a | |||
| f84aecf8f5 | |||
| e0a695978c | |||
| 2a40cbd69e | |||
| 34bc1fe41e | |||
| 4db4a7d371 | |||
| 55a991d3e4 | |||
| bf24589424 | |||
| 4be9c8147e | |||
| 191811b643 | |||
| 2d97858680 | |||
| 79a5799502 |
@@ -1,17 +0,0 @@
|
||||
FROM mcr.microsoft.com/devcontainers/java:3-25-bookworm
|
||||
|
||||
ARG INSTALL_MAVEN="true"
|
||||
ARG MAVEN_VERSION=""
|
||||
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
||||
# [Optional] Uncomment this line to install global node packages.
|
||||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
|
||||
@@ -1,28 +0,0 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/java-postgres
|
||||
{
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/git:1": {},
|
||||
"ghcr.io/devcontainers/features/sshd:1": {}
|
||||
},
|
||||
"name": "Java & PostgreSQL",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "app",
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {}
|
||||
|
||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||
// This can be used to network with other containers or with the host.
|
||||
// "forwardPorts": [5432],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
// "postCreateCommand": "java -version",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
// "customizations": {},
|
||||
|
||||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
||||
// "remoteUser": "root"
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
volumes:
|
||||
postgres-data:
|
||||
|
||||
services:
|
||||
app:
|
||||
container_name: javadev
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
# NOTE: POSTGRES_DB/USER/PASSWORD should match values in db container
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_HOSTNAME: db
|
||||
|
||||
volumes:
|
||||
- ../..:/workspaces:cached
|
||||
|
||||
# Overrides default command so things don't shut down after the process ends.
|
||||
command: sleep infinity
|
||||
|
||||
# Use proper Docker networking instead of network_mode: service:db
|
||||
# to ensure reliable DNS resolution in all environments
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- app-network
|
||||
|
||||
# Use "forwardPorts" in **devcontainer.json** to forward an app port locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
db:
|
||||
container_name: postgresdb
|
||||
image: postgres:latest
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- app-network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql
|
||||
environment:
|
||||
# NOTE: POSTGRES_DB/USER/PASSWORD should match values in app container
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_DB: postgres
|
||||
|
||||
# Add "forwardPorts": ["5432"] to **devcontainer.json** to forward PostgreSQL locally.
|
||||
# (Adding the "ports" property to this file will not forward from a Codespace.)
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
driver: bridge
|
||||
15
.gitignore
vendored
15
.gitignore
vendored
@@ -7,9 +7,22 @@
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
bin/
|
||||
|
||||
.flattened-pom.xml
|
||||
|
||||
######################################################################
|
||||
# Tooling caches
|
||||
|
||||
.pnpm-store/
|
||||
|
||||
######################################################################
|
||||
# Local agent tooling (never commit)
|
||||
|
||||
.agents/
|
||||
skills-lock.json
|
||||
.serena/
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
@@ -52,4 +65,4 @@ application-my.yaml
|
||||
|
||||
/yudao-ui-app/unpackage/
|
||||
.DS_Store
|
||||
**/.DS_Store
|
||||
**/.DS_Store
|
||||
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
[submodule "yudao-ui/yudao-ui-admin-vben"]
|
||||
path = yudao-ui/yudao-ui-admin-vben
|
||||
url = https://git.gongxue100.com/wangziqi/yudao-ui-admin-vben.git
|
||||
36
compose.yaml
Normal file
36
compose.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
name: gongxue-local
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
ports:
|
||||
- "127.0.0.1::5432"
|
||||
environment:
|
||||
POSTGRES_DB: ruoyi-vue-pro
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: 123456
|
||||
volumes:
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
- ./sql/postgresql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/000-platform.sql:ro
|
||||
- ./script/docker/init-local-roles.sql:/docker-entrypoint-initdb.d/010-local-roles.sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d ruoyi-vue-pro"]
|
||||
interval: 2s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
|
||||
redis:
|
||||
image: redis:6-alpine
|
||||
ports:
|
||||
- "127.0.0.1::6379"
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 2s
|
||||
timeout: 5s
|
||||
retries: 30
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
5
docs/adr/0001-native-question-authoring-authority.md
Normal file
5
docs/adr/0001-native-question-authoring-authority.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Native question authoring follows the active catalog authority
|
||||
|
||||
Education exposes local question authoring only when `catalog-mode=JAVA_READ`; `SCALAR_READ` and other modes fail with an explicit business error before any database access. Tenant questions start as `DRAFT`, retain immutable content versions, are placed optimistically on an allowed Content Node, move only through `DRAFT → PUBLISHED → ARCHIVED`, and append an Education-owned lifecycle audit in the same transaction, because a local write under Scalar authority would be invisible to students and the platform's asynchronous operation log cannot prove atomic publication.
|
||||
|
||||
Question Placement has its own optimistic version, is available only to current-tenant `TENANT_OWNED` drafts, and becomes immutable at publication. Publication requires a stable active, visible, selectable PUBLIC or same-tenant Content Node. `ARCHIVED` is terminal for the current command surface, and `RETIRED` is not introduced until its distinct business and restoration semantics are decided. Direct question visibility follows the question's own publication state; entry, node, and collection state gates discovery through those routes rather than rewriting the question lifecycle.
|
||||
@@ -1,12 +1,22 @@
|
||||
# Current State
|
||||
|
||||
> Phase 0 static assessment generated on 2026-07-29. No build, test, application startup, PostgreSQL connection, or Flyway migration was executed during this assessment.
|
||||
> Phase 0 static assessment originally generated on 2026-07-29. Current delivery status updated on 2026-08-01 through V4450/EDU-033; the original investigation remains below as provenance.
|
||||
|
||||
## Executive summary
|
||||
## Current implementation summary
|
||||
|
||||
Phase 0 remains a read-only architecture assessment, not an implementation claim. Verified evidence shows the target is on feature/education-core-loop with a heavily dirty worktree, while the source checkout has no local or remote feature/education-core-loop ref and is main at 033701a. The target contains a meaningful committed core-loop slice (ce02f8a) plus substantial dirty provider/catalog/session work, so all roadmap status must distinguish committed, dirty, absent, and runtime-unverified behavior. EDU-003 has now decided public tenant resolution: Origin/Referer are forgeable browser-context claims rather than trusted identity; headless lookup uses the constrained System-name Public Tenant Handle; successful lookup accepts tenant-existence disclosure while unknown/disabled/expired failures are identical; exact wire errors, canonical host-only websites, a secure-default local flag, and abuse controls are assigned to EDU-004. This is distinct from the already verified authenticated tenant mismatch rejection in TenantSecurityWebFilter; /education/context still requires EDU-004 Member/UserType enforcement. The most reliable core-loop slice remains provider-neutral fail-closed question content handling across the active default Scalar path, conditional Java path, safe catalog projection, and persisted session restoration. Core-loop schema is not proven to be in active Flyway: V4010 is a placeholder, V4020 is catalog-only, and practice/report/idempotency DDL is untracked manual SQL. Native reads are an intentional explicit-scope bypass requiring mapper audit, while schema foreign keys do not enforce tenant-consistent graphs. Phase 0 coverage must also add first-class Auth/Profile/extended Learning, granular tenant-admin, and granular platform-admin groups. Paid access, provider authority, option schema, public graph semantics, and source baseline remain product/architecture decisions.
|
||||
The target branch now contains the student core loop, tenant/identity enforcement, bounded content/operations/appearance/activation-code capabilities, and module-owned PostgreSQL Flyway migrations V4010–V4450. Native RuoYi Pay, Product, Coupon, normal Trade order, Discount/Reward checkout, delivery, after-sale, brokerage, Seckill, and Combination administration are activated with tenant-composite persistence and their existing APIs, RBAC, services, and Vben pages; Education does not own shadow financial, catalog, order, delivery, refund, commission, or promotion ledgers. The full Flyway suite passes 52 PostgreSQL scenarios through V4450; EDU-031 proves tenant-isolated two-level commission/statistics, EDU-032 proves same-number cross-tenant seckill state plus atomic last-stock competition, and EDU-033 proves tenant-isolated group records plus atomic last-place competition and Trade Order/head consistency. The required non-clean Maven compile chain and complete Vben typecheck pass without interrupting the running server. This is isolated disposable-schema evidence, not proof that a shared Pilot or production database was migrated. Explicit legacy Product/coupon/order/refund mapping, source referral CRM and settlement proof/export import, Bargain/Point and other special-order Promotion families, production deployment/data, automatic purchase fulfillment/refund revocation, and selected deferred learning/platform families remain open.
|
||||
|
||||
## Verified program decisions
|
||||
This document retains the original Phase 0 findings below as provenance. Current ticket status is authoritative in [`issues/README.md`](issues/README.md), and rollout evidence is tracked by [`../pilot-acceptance-runbook.md`](../pilot-acceptance-runbook.md).
|
||||
|
||||
## Original Phase 0 executive summary
|
||||
|
||||
Verified evidence showed the target on `feature/education-core-loop` with a heavily dirty worktree, while the source checkout had no local or remote branch with that name and remained at `033701a`. The assessment identified a meaningful committed core-loop slice plus substantial provider/catalog/session work that still required classification. It selected provider-neutral fail-closed question handling, tenant/principal enforcement, atomic idempotency, PostgreSQL/Flyway takeover, and catalog graph integrity as the immediate blockers. Those bounded blockers have since been implemented and verified; this paragraph is retained only as historical context.
|
||||
|
||||
## Original Phase 0 decisions and unknowns
|
||||
|
||||
The remaining sections are the immutable investigation record from 2026-07-29. Items phrased as pending may now be resolved by later tickets and migrations; use the current summary and ticket index above for delivery status.
|
||||
|
||||
### Decisions recorded during Phase 0
|
||||
|
||||
- Verified source provenance is limited: /Users/tiku1/code/tiku-backend has only main and origin/main at 033701a785c7012139e7f86995eea6041225592e; no local or remote feature/education-core-loop ref exists. Use main/033701a provisionally only, or obtain explicit approval for that baseline.
|
||||
- Verified target branch is feature/education-core-loop and its worktree is dirty. Current read-only inventory reports 65 modified tracked files and 97 untracked entries; preserve all, and do not rely on an older 21-untracked count.
|
||||
@@ -22,7 +32,7 @@ Phase 0 remains a read-only architecture assessment, not an implementation claim
|
||||
- Do not expose paid/private practice until entitlement semantics and public target contracts are decided.
|
||||
- No tests, builds, PostgreSQL connections, Flyway execution, or runtime verification were performed; all conclusions are static repository evidence unless explicitly marked otherwise.
|
||||
|
||||
## Unknowns
|
||||
### Unknowns recorded during Phase 0
|
||||
|
||||
- EDU-003 decided the public resolver threat model and contract. Browser headers are forgeable context claims; a constrained Public Tenant Handle supports headless clients; success discloses tenant existence; unknown/disabled/expired failures are identical; exact errors, canonical websites, local activation, Member-only context, and abuse controls are assigned to EDU-004.
|
||||
- Whether a future System-owned immutable Tenant Code or authenticated/signed locator is required beyond the accepted public-handle contract.
|
||||
|
||||
@@ -2,6 +2,30 @@
|
||||
|
||||
> Phase 0 static assessment generated on 2026-07-29. No build, test, application startup, PostgreSQL connection, or Flyway migration was executed during this assessment.
|
||||
|
||||
> Execution update 2026-08-01: the `Auth, student profile, and extended learning` row's original `pending migration` cell is superseded by EDU-014 and is now **partially migrated**. V4160–V4200 deliver Member/System-backed auth context, vocabulary, reminders, fixed learning awards, feedback submission, bounded summaries and leaderboard; V4250–V4280 add idempotent Member point business keys, tenant-admin feedback handling/audit, resolved-feedback rewards, configurable badge definitions, automatic practice/vocabulary/feedback rules, lifetime-once grants, System notifications, learning-risk supervision and follow-up tasks, RBAC/data scope, and Vben UI. Generic check-in/point tasks/exchange, check-in/mock-exam/activity badge triggers, automatic scheduled supervision execution, broader trends/exports, and identity-history import remain open and must not be treated as complete.
|
||||
|
||||
> Execution update 2026-08-01: the `Tenant education operations, appearance, integrations, secrets, and codes` row's original `pending migration` cell is now **partially migrated**. V4140 delivered classes, Member relationships, and invitations; V4230 delivered the first class UI; V4270 adds native learning-risk preview, supervision rules, idempotent follow-up tasks, System AdminUser/RBAC/department-self data scopes, and Vben UI. V4290 adds System-fallback branding, public/admin settings, three platform theme templates, optimistic draft/publish lifecycle, a tenant-context public projection, closed secret/rendering validation, four independent permissions, PostgreSQL evidence, and the fourteenth custom Education Vben page. V4300 exposes Pay application/channel and tenant-scoped System social-client administration below Education using their original controllers, permissions, and existing Vben pages; V4320 makes Pay App/Channel operational with fail-closed tenant-scoped PostgreSQL tables and parent validation. V4330/EDU-021 adds a Pay-owned redacted audit plus explicit single-account import for safe `tenant_collect` WeChat/Alipay manifests. V4340/EDU-022 activates tenant-scoped native Pay order/extension/refund/notification tables, callbacks/retry processing, and the three existing Pay administration pages without an Education financial ledger. V4350/EDU-023 adds terminal-only reconciled legacy order/payment/refund aggregate import into those Pay-owned ledgers, a redacted event-digest audit, and an import/history modal on the native order page. V4360/EDU-024 activates empty tenant-scoped native Transfer/Wallet ledgers, tenant-qualified locks, safe amount-changing paths, granular permissions, and the three existing Pay Transfer/Wallet Vben pages; it does not infer historical balances. V4310 adds tenant-owned learning activation-code batches/codes and the fifteenth custom Education Vben page while composing Mall-owned SPU binding, Member principal, and the idempotent Education entitlement pipeline. Plaintext activation codes are returned once; only SHA-256 digest and mask persist. Domains remain System-owned and coupons remain Mall Promotion-owned. Production bulk financial export/runbooks and reviewed opening balances, automatic purchase fulfillment/refund revocation, tenant SMS/PNVS, encrypted secret rotation, non-equivalent payment modes/providers, legacy activation-code import, coupons, scheduled production rule execution, and the rest of tenant operations remain open.
|
||||
|
||||
> Execution update 2026-08-01: V4370/EDU-025 enables the Mall reactor and Product server module, changes all nine Product records to `TenantBaseDO`, creates tenant-composite PostgreSQL catalog tables and constraints, and reuses the five native Product Vben pages with their exact controller permissions.
|
||||
|
||||
> EDU-025 supersedes older matrix cells that list Mall Product activation as open. V4370 activates the tenant-scoped native brand/category/property/SPU/SKU/comment/favorite/history catalog and five existing Product administration pages. It deliberately does not infer SPUs, SKUs, prices, stock, brands, or properties from the legacy display-only `products` projection.
|
||||
|
||||
> Execution update 2026-08-01: V4380/EDU-026 enables the Promotion server module, changes native `CouponTemplateDO` and `CouponDO` to `TenantBaseDO`, creates tenant-composite coupon template/instance persistence, and reuses the two native Promotion coupon Vben pages with exact controller permissions. It does not reinterpret legacy code campaigns/redemptions as pre-issued member coupons. EDU-027 subsequently activates the normal Trade order core; Statistics, other Promotion/Trade table families, and explicit legacy Product/code-coupon import remain separate.
|
||||
|
||||
> Execution update 2026-08-01: V4390/EDU-027 enables the native Trade server module, tenantizes order/cart/config records, supplies tenant-composite order-core persistence, and reuses the native order/config Vben pages and permissions. Legacy orders remain unimported because verified Member, SPU/SKU, price-allocation, and lifecycle mappings are absent. Trade after-sale/delivery/brokerage tables, special-order Promotion families, Statistics, and explicit legacy order import remain separate.
|
||||
|
||||
> Execution update 2026-08-01: V4400/EDU-028 tenantizes native Discount Activity/Product and Reward Activity records, creates the three PostgreSQL tables queried by every normal Trade price calculation, and reuses the native discount/reward APIs, exact permissions, and two existing Vben pages. Empty real API lookups now succeed against PostgreSQL; delivery, configured payment runtime, special-order Promotion families, and end-to-end checkout evidence remain separate.
|
||||
|
||||
> Execution update 2026-08-01: V4410/EDU-029 tenantizes all five native Trade delivery records, creates express-company/template/charge/free/pickup persistence, connects Product templates and pickup orders through tenant-qualified references, and reuses the three existing Vben pages with exact permissions. A real Spring/MyBatis calculation resolves a persisted tenant template and adds the expected freight. Configured Pay runtime, after-sale/brokerage, special orders, and target-environment checkout evidence remain separate.
|
||||
|
||||
> Execution update 2026-08-01: V4420/EDU-030 tenantizes native Trade after-sale and log records, creates their PostgreSQL persistence and tenant-qualified Order/Order Item/Product/Pay Refund/Delivery references, and reuses the native app/admin state machine plus the corrected Vben list/detail page with five exact permissions. A real Spring/MyBatis test proves tenant-isolated create/page/detail/log behavior. Source aggregate UUID refunds remain unimported until verified legacy Member/Product/Order Item mappings exist; Trade brokerage, special orders, fulfillment/revocation orchestration, and target-environment refund evidence remain separate.
|
||||
|
||||
> Execution update 2026-08-01: V4430/EDU-031 tenantizes native Trade brokerage user/record/withdrawal records, creates tenant-composite PostgreSQL relationships and Pay Transfer/Order references, and reuses native Member-backed two-level commissions, freeze/unfreeze, withdrawal APIs/jobs, eight exact permissions, and three corrected Vben pages. A real Spring/MyBatis test proves same-ID cross-tenant teams, balances, summaries, and annotated ranking SQL remain isolated. Source referral CRM, UUID settlement aggregates, and proof/export events remain unimported pending explicit Member/lead/Order/evidence mapping.
|
||||
|
||||
> Execution update 2026-08-01: V4440/EDU-032 tenantizes native Promotion seckill configuration/activity/product records, creates tenant-composite PostgreSQL Product/Trade references and consistency triggers, and reuses native time-slot/activity/atomic-stock services, nine exact permissions, and two corrected Vben pages. A real Spring/MyBatis test proves same-ID cross-tenant records, isolated reads, atomic last-stock competition, restoration, close propagation, and used-slot protection. The source has no seckill capability, so the native tables intentionally start empty; later Combination activation and remaining families are tracked separately.
|
||||
|
||||
> Execution update 2026-08-01: V4450/EDU-033 tenantizes native Promotion Combination activity/product/record objects, creates tenant-composite Product/Trade/record/head references and capacity/snapshot triggers, and reuses native activity/group/job services, six exact permissions, and corrected Vben pages. A real Spring/MyBatis test proves same-ID cross-tenant activities/products, isolated page/record/summary reads, snapshot propagation, real head IDs, atomic last-place competition, order/head consistency, and record-backed deletion protection. The source `combination` token is an education question type rather than group buying, so native tables intentionally start empty; Bargain, Point, and other special-order families remain separate.
|
||||
|
||||
Statuses are restricted to the Goal vocabulary. Evidence marked as verified is static repository evidence.
|
||||
|
||||
| Legacy capability | Legacy code location | Legacy database objects | Business value | Target module | Existing capability to reuse | Education gap | Other-module change | Priority | Risk | Verification | Status | Evidence | Open decision |
|
||||
@@ -10,8 +34,8 @@ Statuses are restricted to the Goal vocabulary. Evidence marked as verified is s
|
||||
| Student core learning loop | /Users/tiku1/code/tiku-backend/apps/api/src/nest/learning.module.ts:23-113<br>/Users/tiku1/code/tiku-backend/apps/api/src/features/learning/use-cases.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/features/learning/access.ts | Education catalog and practice/report/idempotency/wrong-question/favorite tables.<br>Verified: native catalog V4020 is a dirty module resource; practice/report/idempotency DDL is currently in untracked sql/postgresql/education files rather than proven active Flyway history. | Provides the student loop from published catalog browsing through practice creation, answer saving, restore, submission, report, wrong questions, and favorites. | Education | Education provider/adapter boundary, Member/System identity, database uniqueness and transactions, framework locks/idempotency only as supplements—not replacements—for atomic database claims. | Verified: commit ce02f8a contains committed access/core controllers, safe projections, and focused tests, while native provider/catalog and additional core-loop work are dirty; these statuses must be separated. Verified: native and Scalar providers disagree on malformed/absent options; QuestionCatalogService and SessionResponseAssembler can emit apparently valid empty options. Verified: submit idempotency performs check-then-insert rather than atomic initial reservation. Inference: core-loop completion and concurrency guarantees are not established. | Education owns education-domain state and orchestration; Member/System context is reused. Paid/private access remains blocked on an entitlement decision. | P0 | High: corrupt assessment content, mode-dependent behavior, duplicate state transitions, answer leakage, or unauthorized access. | Provider-neutral tests across Scalar and Java, browsing/collection/practice-create/restore safe projections, malformed/unavailable/unpublished fail-closed cases, cross-tenant cases, and PostgreSQL concurrent same-key/different-key submit tests. | partially migrated | Verified ce02f8a, target repository, for committed EducationAccessService, core controllers/services, projections, and HTTP/service tests.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/java/cn/iocoder/yudao/module/education/config/EducationProperties.java:34-36 defaults to SCALAR_READ.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/java/cn/iocoder/yudao/module/education/integration/scalar/config/ScalarAutoConfiguration.java:30-35 selects Scalar for SCALAR_READ/missing mode.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/java/cn/iocoder/yudao/module/education/service/catalog/provider/JavaCatalogProvider.java:397-417, ScalarCatalogProvider.java:736-751, QuestionCatalogServiceImpl.java:182-202, SessionResponseAssembler.java:69-89.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/java/cn/iocoder/yudao/module/education/service/practice/PracticeSessionServiceImpl.java:294-307,397-409.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/sql/postgresql/education/009-education-idempotency-unified.sql:81, but no execution evidence. | Select the pilot-authoritative provider or require a provider-neutral contract; define valid option structure by question type and absent-option semantics; define atomic submit claim/crash recovery; decide entitlement contract before paid/private practice. |
|
||||
| Education catalog and question content | /Users/tiku1/code/tiku-backend/apps/api/src/nest/catalog.module.ts:74-138<br>/Users/tiku1/code/tiku-backend/apps/nest/tenant-content.module.ts | V4020 native catalog tables for regions, schools, majors, subjects, categories, banks, questions, versions, content, collections, blueprints, and bindings.<br>Legacy catalog/question/content/asset tables, constraints, functions, triggers, grants, and RLS are reference objects requiring semantic mapping. | Supplies reusable published catalog, question, classification, and content reads for student and future admin workflows. | Education | Education Provider boundary, explicit CatalogScopeQuery, framework tenant context, Infra File public API for future assets. | Verified: current native reads intentionally run inside TenantUtils.executeIgnore and apply explicit scope predicates; this is a controlled manual-isolation boundary, not proof of a current leak. Verified: V4020 uses ordinary single-column foreign keys, so tenant-owned/public graph consistency is not enforced. Inference: every mapper needs audit and content admission needs composite constraints or equivalent enforcement. | Education owns domain reads; Infra File may later provide asset transport. No provider expansion should occur before provider authority and graph-integrity rules are decided. | P0 | High if manual scope is bypassed or invalid cross-tenant/public relationships are admitted. | Inventory every mapper, provider contract tests, invalid graph insert tests, malformed/unpublished tests, PostgreSQL Flyway syntax/resource-packaging checks, and runtime migration evidence only when executed. | partially migrated | Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/java/cn/iocoder/yudao/module/education/service/catalog/provider/JavaCatalogProvider.java:82-89.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/java/cn/iocoder/yudao/module/education/dal/mysql/catalog/CatalogScopeQuery.java:12-20.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-education/src/main/resources/db/migration/education/V4020__create_native_catalog.sql:38-123,133-152,160-265,324-386.<br>Verified /Users/tiku1/code/tiku-backend/supabase/migrations/202606210008_content_navigation_practice.sql:3-178. | Choose Scalar-only, native PostgreSQL, or explicit coexistence; define tenant_id=0 PUBLIC graph semantics and composite-key strategy; decide whether source RLS/functions/triggers are contractual. |
|
||||
| Auth, student profile, and extended learning | /Users/tiku1/code/tiku-backend/apps/api/src/nest/auth.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/profile.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/learning.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/features/profile/ | Legacy auth/session/verification/OAuth/phone-binding objects.<br>Legacy profile/check-in/points/tasks/exchange/notifications/badges/feedback/exam-countdown objects.<br>Legacy leaderboard/history/report/stats/trend/vocabulary progress/review/favorites/stats objects. | Covers broader student learning and profile experiences beyond the core loop, preserving discoverable legacy behavior and its disposition. | Member + System + Education, with Infra composition | Member/System auth and profile primitives, System/Infra notifications, Member points/levels where semantics match, Education-specific projections and authorization. | Verified source inventory shows these are distinct required Phase 0 domains, not merely generic context or secondary engagement. Target ownership and compatibility are not established. Inference: the definition-of-done is unsupported until each endpoint/state family is classified. | Member/System own authentication and generic membership; Education owns education-specific profile/progress projections. System/Infra may own notifications, while product owners must decide points, badges, feedback, exams, and vocabulary ownership. | P1 | High for auth compatibility and medium for omitted student progress/profile behavior. | Endpoint/API mapping, principal and tenant tests, profile redaction, progress/report compatibility, vocabulary state transitions, and explicit retired/product-decision checks. | pending migration | Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/auth.module.ts:31-56.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/profile.module.ts:38-87.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/learning.module.ts:23-60,70-113.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/docs/education/migration/GOAL.md:126-141,393-405. | For every Auth/Profile/extended Learning family, assign Member/System/Education/Infra ownership, compatibility requirement, data disposition, and phase; decide vocabulary, analytics, feedback, exam dates, notifications, points, and badges. |
|
||||
| Tenant education operations, appearance, integrations, secrets, and codes | /Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-classes.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-appearance.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-integrations.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-secrets.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-codes.module.ts | Legacy classes, student relationships, supervision, roles/configuration, branding/settings/themes, domains, payment accounts, auth-provider configuration, tenant secrets, activation codes, coupons/redemptions, integrations, and marketing objects. | Enables tenant administrators to operate education organizations while preserving separate security and ownership boundaries. | Education + System + Member + Mall/Pay + Infra | System Tenant/RBAC/DataPermission/AdminUserApi, Member relationships, Mall/Pay/Member APIs, Infra secret/file/message/audit facilities. | Verified: classes/supervision were only part of the source tenant-admin surface. Appearance/theme lifecycle, domains/payment/auth integrations, secret rotation, and codes/coupons are separate migration/security surfaces with no verified target equivalent. Inference: collapsing them into one row would hide authorization and secret-handling decisions. | System RBAC/DataPermission and tenant configuration are reused; Mall/Pay/Member own commercial primitives; Infra owns secrets/messaging/files where applicable; Education owns only domain relationships and configuration extensions. | P1 | High: admin scope, secret leakage, payment configuration, and code redemption errors. | Permission matrix, row-scope negatives, secret redaction/rotation, integration authorization, code/coupon idempotency, audit, and cross-tenant tests. | pending migration | Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-appearance.module.ts:17-41.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-integrations.module.ts:18-42.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-secrets.module.ts:13-21.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-codes.module.ts:12-31.<br>Verified /Users/tiku1/code/tiku-backend/supabase/migrations/202606290002_tenant_classes.sql.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/annotation/DataPermission.java:12-32. | Define class/student/teacher scope semantics and separately decide appearance, domain, payment/auth integration, secret, activation-code, coupon, public-bank grant, and marketing ownership or retirement. |
|
||||
| Tenant education operations, appearance, integrations, secrets, and codes | /Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-classes.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-appearance.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-integrations.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-secrets.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/tenant-admin-codes.module.ts | Legacy classes, student relationships, supervision, roles/configuration, branding/settings/themes, domains, payment accounts, auth-provider configuration, tenant secrets, activation codes, coupons/redemptions, integrations, and marketing objects. | Enables tenant administrators to operate education organizations while preserving separate security and ownership boundaries. | Education + System + Member + Mall/Pay + Infra | System Tenant/RBAC/DataPermission/AdminUserApi, tenant-scoped System Social Client, native Pay App/Channel/Order/Refund/Notify/Transfer/Wallet, Member relationships, Mall Product, Promotion Coupon/Seckill/Combination, Trade Order/Cart/Config/Delivery/After Sale/Brokerage, Education entitlement events, and Infra secret/file/message/audit facilities. | V4290 owns only presentation extensions. V4300–V4330 reuse native Pay/System configuration and bounded Pay account import. V4340–V4360 activate Pay transactions and Transfer/Wallet; V4370 activates Product; V4380 activates coupon templates/instances; V4390 activates the native Trade order/cart/config core; V4400 activates always-invoked Discount/Reward rules; V4410 activates delivery; V4420 activates native after-sale; V4430 activates native brokerage; V4440 activates native Seckill; V4450 activates native Combination activity/product/group records, capacity protection, Trade bridge, and corrected Vben pages. V4310 owns only activation-code issuance/redemption and composes product binding/entitlement. Production bulk tooling and reviewed opening balances, legacy product/code-coupon/order/refund and referral/settlement-proof import, Bargain/Point and other Promotion families, fulfillment/refund revocation, System-global SMS versus tenant PNVS, encrypted secrets, public-bank grants, and other marketing remain distinct gaps. | System RBAC/DataPermission and tenant configuration are reused; Pay owns payment configuration and ledgers, System owns social providers, Mall owns SPUs/coupons/promotions/orders/delivery/after-sale/brokerage, Member owns principals, Education owns activation-code state and learning-entitlement orchestration, and Infra owns secrets/messaging/files where applicable. | P1 | High: admin scope, secret leakage, payment/order/refund/commission/promotion lifecycle, and code redemption errors. | Native permission/menu shape, Pay/System/Mall tenant-scope tests, provider-data import tests, native Pay/Product/Coupon/Trade/Promotion regressions, secret redaction/rotation, activation/code-coupon idempotency, stock/capacity concurrency, audit, and cross-tenant tests. | partially migrated | Verified V4290 appearance through V4450 Promotion Combination contracts, including native Pay/Product/Coupon/Trade/Promotion UI and tenant-aware records.<br>Verified provider mapping, reconciliation, replay/conflict, audit redaction, composite tenant references, wallet locks/amount safety, delivery calculation, after-sale service/log isolation, brokerage relationship/commission/statistics isolation, seckill stock concurrency, combination group capacity/order consistency, and fail-closed global-table adoption.<br>Verified digest-only activation-code persistence, tenant isolation, atomic redemption, dependency rejection, and concurrent unique winner.<br>Verified System Social Client remains tenant-aware and legacy integration/secrets/codes controllers remain inventoried. | Keep domains in System; use Pay for payment and System Social Client for supported OAuth providers. Activation codes are Education learning-access credentials; Product, coupons, promotions, orders, delivery, after-sale, brokerage, and special-order promotion remain Mall-owned. Continue other special-order Promotion families, production financial/order/refund reconciliation, explicit legacy commerce/referral/settlement-proof import, automatic fulfillment/refund revocation, non-equivalent provider replacement, tenant PNVS, encrypted secrets, public-bank grants, and other marketing separately. |
|
||||
| Platform administration and governance | /Users/tiku1/code/tiku-backend/apps/api/src/nest/platform-admin-overview.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/platform-admin-permissions.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/platform-admin-*.module.ts | Legacy platform staff, tenant lifecycle/billing profiles, public question-bank grant/sync, SaaS plan/invoice/usage/overage/dunning, audit/export/alert/notification-channel, and permission objects. | Provides platform staff and governance over tenants, staff lifecycle, public-bank grants, SaaS plans, billing, usage, dunning, audits, alerts, and permissions. | System + Pay + Mall + Infra + CRM with Education extensions | System RBAC/DataPermission/AdminUserApi, authorized tenant-ignore mechanisms, Pay/Mall/Infra/CRM public APIs, audit/logging. | Verified source surface is broader than one aggregated platform-admin row. Target seams exist, but object-level ownership, data scopes, and cross-tenant operation policy remain incomplete. | System, Pay, Mall, Infra, CRM, and Education-specific extension permissions; Education must not duplicate platform ledgers or generic administration. | P1 | High access-control and financial-governance risk. | Permission matrix, platform-admin integration, cross-tenant negative, audit-redaction, billing/usage reconciliation, and alert/export tests. | pending migration | Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/platform-admin-overview.module.ts.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/platform-admin-permissions.module.ts.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/api/permission/PermissionApi.java:12-20.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/service/SecurityFrameworkService.java:7-57. | Define separate Student App, Tenant Admin, Platform Admin, public, and internal policies; map each platform surface to System/Pay/Mall/Infra/CRM/Education or explicit retirement. |
|
||||
| Commercialization and growth | /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-orders.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-payments.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/referral-growth.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/referral-crm.module.ts | Legacy product/order/payment/event/entitlement/coupon/refund/reconciliation/commission/referral/points/dunning objects.<br>Target Mall/Pay/Member tables remain authoritative; Education may add minimal binding records. | Supports paid products, fulfillment, entitlements, refunds, reconciliation, commissions, referrals, and CRM conversion without recreating platform ledgers. | Mall + Pay + Member + CRM with Education binding | Mall/Pay DTO APIs, Member identity/entitlement/points, CRM services, Infra Job/MQ/audit. | Verified target Pay/Mall APIs expose core seams, but scoped entitlement issuance/revocation, activation codes, reconciliation, commissions, dunning, and referral semantics are not proven. One prior evidence path was malformed; corrected source location is /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts. | Mall Trade/Product, Pay, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only. | P2 | High financial and authorization risk. | Callback/idempotency/amount/refund, entitlement lifecycle, reconciliation, and education fulfillment contract tests. | product decision required | Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/api/order/PayOrderApi.java:13-38.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-pay/src/main/java/cn/iocoder/yudao/module/pay/api/refund/PayRefundApi.java:12-30.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-mall/yudao-module-trade-api/src/main/java/cn/iocoder/yudao/module/trade/api/order/TradeOrderApi.java:12-38.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-orders.module.ts:15-70 and /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/docs/education/migration/GOAL.md:36-40,226-228. | Choose entitlement/activation-code/coupon model and confirm issuance, revocation, callback, refund, reconciliation, commission, and referral contracts before paid practice. |
|
||||
| Commercialization and growth | /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-orders.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-payments.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/referral-growth.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/referral-crm.module.ts | Legacy product/order/payment/event/entitlement/coupon/refund/reconciliation/commission/referral/points/dunning objects.<br>Target Mall/Pay/Member tables remain authoritative; Education adds only binding/entitlement records. | Supports paid products, fulfillment, entitlements, refunds, reconciliation, commissions, referrals, and CRM conversion without recreating platform ledgers. | Mall + Pay + Member + CRM with Education binding | Native Pay, Mall Product/Promotion Coupon/Seckill/Combination/Trade Order/Brokerage APIs, controllers, jobs, permissions and Vben pages; Member identity/points, CRM, Infra Job/MQ/audit. | Bounded Education binding/entitlement and activation redemption are proven. V4340–V4360 activate/import Pay; V4370 activates Product; V4380 activates Coupon; V4390–V4420 activate normal Trade order/checkout/delivery/after-sale; V4430 activates native two-level brokerage; V4440 activates empty native Seckill; V4450 activates empty native Combination activity/product/group state because the source has no group-buying equivalent. The source combination-question token remains Education content. Explicit legacy Product/code-coupon/order/refund/referral/settlement-proof import, automatic fulfillment/refund revocation, Bargain/Point and other Promotion families, dunning, and source CRM conversion remain open. | Mall Product/Promotion/Trade, Pay, Member, CRM, and Infra remain owners; Education owns product-to-learning binding, activation credentials, and access orchestration only. | P2 | High financial and authorization risk. | Delivered native Pay/Product/Coupon/Trade/Seckill/Combination tenant and PostgreSQL tests; still require reviewed legacy mapping, production reconciliation/runbooks, callback/idempotency, entitlement lifecycle, source settlement/proof/CRM mapping, and fulfillment tests. | partially migrated | Verified V4130 binding/entitlement through V4450 native Combination, native module tenant contracts, exact permissions/routes, composite references, unsafe-state checks, real service/statistics/stock/capacity isolation, and fail-closed legacy/deferred table adoption.<br>Verified native Pay, Product, Promotion Coupon/Seckill/Combination, Trade Order/After Sale/Brokerage APIs/pages are the public seams. | Keep activation codes separate from coupons; complete Bargain/Point and other Promotion families, explicit legacy commerce/referral/settlement-proof mapping, production reconciliation/runbooks and reviewed balances, automatic issuance/fulfillment/refund revocation, dunning, and CRM conversion contracts before broader paid-practice fulfillment. |
|
||||
| Background processing, assets, and operational platform | /Users/tiku1/code/tiku-backend/apps/worker/src/worker-jobs.ts<br>/Users/tiku1/code/tiku-backend/apps/worker/src/jobs/imports.ts<br>/Users/tiku1/code/tiku-backend/apps/worker/src/jobs/exports.ts<br>/Users/tiku1/code/tiku-backend/apps/asset-scanner/src/ | Legacy worker queues, leases, retries/dead letters, imports/exports, reconciliation, notification/audit, usage, and security scan state.<br>Target owns business state in domain modules and uses platform execution primitives; do not copy queue tables wholesale. | Preserves operational reliability for imports, exports, payments, CRM, scanning, notifications, retries, and audit while removing dependence on NestJS workers. | Infra platform plus owning domain modules | Infra Job, Redis MQ, File, locks, idempotency, logging, tracing, Excel utilities, tenant propagation. | Verified target primitives exist, but durable claim/lease/heartbeat/retry and malware-scanner equivalence are not proven. Education import/export business state is absent or not verified. | Infra Job/MQ/File/logging/observability plus owning Education/Pay/Mall/CRM handlers; scanner deployment or adapter ownership must be decided. | P1 | High operational and security risk. | Concurrent claim/lease/recovery, retries/dead letters, scan fail-closed, file access, tenant propagation, audit, and deployment smoke tests. | partially migrated | Verified /Users/tiku1/code/tiku-backend/apps/worker/src/worker-jobs.ts:24-220 and /Users/tiku1/code/tiku-backend/apps/worker/src/jobs/imports.ts:87-260.<br>Verified /Users/tiku1/code/tiku-backend/apps/asset-scanner/src/scanner.service.ts:23-50.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/redis/core/RedisMQTemplate.java.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandler.java. | Confirm Infra claim/lease semantics and scanner ownership, file privacy/retention, legacy asset migration/re-scan, and duplicate-safe at-least-once processing. |
|
||||
| Secondary learning, media, AI, and engagement | /Users/tiku1/code/tiku-backend/apps/api/src/nest/scoreline.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/video.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/nest/ai.module.ts<br>/Users/tiku1/code/tiku-backend/apps/api/src/features/profile/ | Legacy scoreline, vocabulary, handbook, video entitlement/progress, recommendation, notification, badge, exam-date, and analytics objects. | Delivers selected recommendation, scoreline, vocabulary, handbook, video, AI, notification, badge, exam-date, and engagement experiences after ownership and priority are explicit. | Education plus AI/Infra/Member/System | AI services, Infra File/notifications, Member points/levels, Education authorization/projections. | Verified legacy capabilities exist, but target equivalence and priority are not established. These cannot remain an undifferentiated P3 bucket if Phase 0 must give every capability a disposition. | AI, Infra File/messaging, Member growth primitives, System notifications, and Education extensions. | P3 | Medium-to-high due to entitlement, media access, sensitive reporting, and unclear scope. | Per-capability contract, authorization, entitlement, export/redaction, and migration compatibility tests. | product decision required | Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/scoreline.module.ts:207-226.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/video.module.ts:431-464.<br>Verified /Users/tiku1/code/tiku-backend/apps/api/src/nest/ai.module.ts:120-139.<br>Verified /Users/tiku1/code/tiku-backend/supabase/migrations/202606210009_content_import_vocabulary_handbook.sql.<br>Verified /Users/tiku1/code/ruoyi-vue-pro/yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/service/chat/AiChatMessageService.java. | For each capability, assign Education, existing platform ownership, explicit retirement, or later product scope; decide entitlement and safe export/redaction requirements. |
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
> Phase 0 static assessment generated on 2026-07-29. No build, test, application startup, PostgreSQL connection, or Flyway migration was executed during this assessment.
|
||||
|
||||
> Runtime mapping update 2026-08-01: EDU-027 keeps native Trade order/config contracts authoritative, EDU-028 keeps native Discount/Reward APIs authoritative, EDU-029 activates delivery, EDU-030 activates after-sale/Pay Refund, EDU-031 activates Member-backed brokerage, EDU-032 activates native Promotion Seckill, and EDU-033 activates native Promotion Combination activity/group/Trade Order contracts. Education adds no shadow commerce, refund, commission, or special-order API. Configured target Pay runtime, Bargain/Point and other special orders, legacy commerce/referral/settlement-proof mapping, fulfillment/revocation, and deployed checkout/refund/commission/promotion evidence remain open.
|
||||
|
||||
This Phase 0 artifact maps API families rather than all 342 operations. Endpoint-level method/path/request/response mapping remains required before implementing each family.
|
||||
|
||||
## Tenant resolution, identity, and student context
|
||||
@@ -60,10 +62,28 @@ This Phase 0 artifact maps API families rather than all 342 operations. Endpoint
|
||||
- **Legacy authorization semantics to preserve:** tenant boundary, principal type, visibility, idempotency, state transitions, and redaction as applicable.
|
||||
- **Target:** Education + System + Member + Mall/Pay + Infra
|
||||
- **Reuse:** System Tenant/RBAC/DataPermission/AdminUserApi, Member relationships, Mall/Pay/Member APIs, Infra secret/file/message/audit facilities.
|
||||
- **Migration conclusion:** pending migration
|
||||
- **Contract gap:** Verified: classes/supervision were only part of the source tenant-admin surface. Appearance/theme lifecycle, domains/payment/auth integrations, secret rotation, and codes/coupons are separate migration/security surfaces with no verified target equivalent. Inference: collapsing them into one row would hide authorization and secret-handling decisions.
|
||||
- **Required verification:** Permission matrix, row-scope negatives, secret redaction/rotation, integration authorization, code/coupon idempotency, audit, and cross-tenant tests.
|
||||
- **Open decision:** Define class/student/teacher scope semantics and separately decide appearance, domain, payment/auth integration, secret, activation-code, coupon, public-bank grant, and marketing ownership or retirement.
|
||||
- **Migration conclusion:** partially migrated — class/supervision, appearance, native Pay/System integration and ledgers, learning activation codes, native Mall Product/Coupon, and V4390–V4450 normal Trade order/checkout/delivery/after-sale/brokerage/seckill/combination activation delivered
|
||||
- **Delivered activation-code contracts:** Admin `GET /education/activation-code/batch/page`, `POST /batch`, `PUT /batch/{id}`, `POST /batch/{id}/generate`, `GET /code/page`, and `PUT /code/{id}/disable`; Member-only app `POST /education/activation-code/check` and `POST /education/activation-code/redeem`. Query/manage/generate permissions are independent. Generation returns plaintext once, while persistence and later reads expose only digest/mask. Redemption locks the code row and composes `EducationEntitlementService` with `sourceSystem=ACTIVATION_CODE`.
|
||||
- **Delivered legacy Pay import contracts:** Pay-owned `POST /pay/legacy-account-import/import` requires App+Channel create permissions and maps one explicitly reviewed `tenant_collect` WeChat/Alipay manifest through native Pay services. `GET /pay/legacy-account-import/page` requires both query permissions and returns the tenant-filtered redacted audit. Same source-account/checksum replays; checksum conflicts, non-equivalent modes/providers, channel-family mismatch, ambiguous rotating keys, and unsafe Alipay endpoints fail closed. The existing Pay App Vben page owns the import modal.
|
||||
- **Delivered native Pay transaction contracts:** Existing `/pay/order`, `/pay/refund`, and `/pay/notify` query/detail/export/callback contracts and the `pay/order/index`, `pay/refund/index`, and `pay/notify/index` Vben pages are reused. V4340 supplies tenant-scoped PostgreSQL order/extension/refund/notification tables and composite tenant foreign keys; callback processing retains channel-derived `TenantUtils` context and notification retries retain `@TenantJob` execution.
|
||||
- **Delivered legacy transaction bridge:** `POST /pay/legacy-transaction-import/import` accepts one terminal, reconciled order/payment/refund manifest under `pay:legacy-transaction:import`; `GET /pay/legacy-transaction-import/page` exposes redacted tenant audit under `pay:legacy-transaction:query`. It requires an EDU-021 account mapping, exact cent/status/provider reconciliation, source UUID/checksum idempotency, and explicit optional native Member ID. It writes native Pay ledgers without SDK calls, callbacks, notifications, raw payloads, or error originals. The native order page owns the import/history modal.
|
||||
- **Delivered native Transfer/Wallet contracts:** Existing `/pay/transfer`, `/pay/wallet`, `/pay/wallet-transaction`, `/pay/wallet-recharge`, and `/pay/wallet-recharge-package` controllers remain authoritative. V4360 activates empty tenant-scoped native ledgers and existing `pay/transfer/index`, `pay/wallet/balance/index`, and `pay/wallet/rechargePackage/index` pages. Five data objects use `TenantBaseDO`, Transfer sync retains `@TenantJob`, wallet locks include tenant ID, administrator reductions use conditional subtraction, and recharge refund has a dedicated permission. No legacy wallet balance is inferred.
|
||||
- **Delivered native Product contracts:** Existing `/product/brand`, `/product/category`, `/product/property`, `/product/property/value`, `/product/spu`, `/product/comment`, `/product/favorite`, and `/product/browse-history` controllers remain authoritative. V4370 activates nine tenant-scoped Product tables and the existing SPU, Category, Brand, Property, and Comment Vben pages. Nine Product data objects use `TenantBaseDO`; PostgreSQL composite tenant references enforce the catalog graph. The legacy display-only `products` projection is not automatically imported.
|
||||
- **Delivered native Coupon contracts:** Existing `/promotion/coupon-template`, `/promotion/coupon`, and app coupon controllers remain authoritative. V4380 activates tenant-scoped template/issued-instance persistence, Product SPU/category scope validation, Member lookup/issuance, registration issuance, expiry processing, and the existing template/record Vben pages. Both coupon records use `TenantBaseDO`; the template reference is tenant-qualified. Legacy code campaigns/redemptions are not automatically imported.
|
||||
- **Delivered native Trade contracts:** Existing `/trade/order`, `/trade/config`, `/app-api/trade/order`, and `/app-api/trade/cart` controllers remain authoritative. V4390 activates tenant-scoped Order/Item/Log/Cart/Config persistence, native `TradeOrderApiImpl`, exact order/config permissions, and the existing Vben pages. Legacy aggregate orders are not automatically imported.
|
||||
- **Delivered native checkout Promotion contracts:** Existing `/promotion/discount-activity`, `/promotion/reward-activity`, `DiscountActivityApi`, and `RewardActivityApi` remain authoritative. V4400 activates tenant-scoped Discount Activity/Product and Reward Activity persistence, exact action permissions, and the two existing Vben pages. Real empty API lookups are proven on PostgreSQL; no legacy campaigns are inferred.
|
||||
- **Delivered native delivery contracts:** Existing `/trade/delivery/express`, `/trade/delivery/express-template`, `/trade/delivery/pick-up-store`, app delivery reads, and `TradeDeliveryPriceCalculator` remain authoritative. V4410 activates tenant-scoped company/template/rule/store persistence, Product/Order references, exact permissions, three existing Vben pages, and a real PostgreSQL express-fee calculation; no source delivery data is inferred.
|
||||
- **Delivered native after-sale contracts:** Existing Member application/cancel/delivery reads, `/trade/after-sale/page`, `/get-detail`, `/agree`, `/disagree`, `/receive`, `/refuse`, `/refund`, Pay refund callback handling, and operation logs remain authoritative. V4420 supplies tenant-scoped persistence/references and exact permissions. Vben now sends `auditReason`, requires `refuseMemo`, shows the application `createTime`, and permission-guards every action.
|
||||
- **Legacy refund mapping:** `commerce_refund_requests` and `commerce_refund_events` are aggregate UUID records without verified native Member, Order Item, Product/SKU, return-logistics, or Pay Refund identities. V4420 deliberately imports none; mapping follows explicit legacy Product/Member/Order Item reconciliation.
|
||||
- **Delivered native brokerage contracts:** Existing app/admin relationship, eligibility, team/rank, commission-record, freeze/unfreeze/cancel, withdrawal/audit, Pay Transfer callback, and scheduled job contracts remain authoritative. V4430 supplies tenant-owned persistence, references, exact eight permissions, and corrected user/record/withdrawal pages. Immediate settlements now participate in time-range statistics.
|
||||
- **Legacy referral/settlement mapping:** Source referral codes/leads/team edges/tracks/QR/CRM assignment and UUID settlement/item/proof/export rows lack verified native Member, Order, relationship, Pay Transfer, and evidence identities. V4430 deliberately imports none; they remain explicit mapping/import work rather than being treated as native-equivalent.
|
||||
- **Delivered native Seckill contracts:** Existing `/promotion/seckill-config`, `/promotion/seckill-activity`, supporting app reads, Product lookups, atomic stock updates, and Trade Order seckill fields remain authoritative. V4440 supplies empty tenant-owned time/activity/product persistence, Product/Trade references, consistency triggers, exact nine permissions, and corrected activity/config pages. Duplicate SKU, price/stock overrun, invalid time/limit inputs, unsafe restoration, and deletion of an in-use slot fail closed.
|
||||
- **Source Seckill disposition:** Repository-wide source inventory found no seckill capability. V4440 deliberately starts empty; ordinary products, coupons, and aggregate orders are not reinterpreted as activities.
|
||||
- **Delivered native Combination contracts:** Existing `/promotion/combination-activity`, `/promotion/combination-record`, supporting app reads/jobs, Product/Member lookups, and Trade Order combination fields remain authoritative. V4450 supplies empty tenant-owned activity/product/record persistence, capacity and reference triggers, exact six permissions, and corrected activity/record pages. Duplicate/mismatched SKUs, price/time/limit errors, cross-activity heads, over-capacity joins, inconsistent orders, and deletion with records fail closed.
|
||||
- **Source Combination disposition:** The source `combination` token is an education combination-question type, not group buying. V4450 deliberately starts empty; no content question, ordinary product, or aggregate order is reinterpreted as a promotion group.
|
||||
- **Contract gap:** Native Pay, Product, Coupon, normal Trade order, Promotion discount/reward/seckill/combination, Trade delivery, Trade after-sale, and native Trade brokerage administration are operational. Production bulk export/runbooks, reviewed UUID-to-Member/opening-balance artifacts, explicit legacy commerce/referral/settlement-proof mapping, Bargain/Point and other special-order activation, provider settlement equivalence, XPay/Xunhu replacement, and generic credential encryption remain open. V4310 does not claim legacy activation-code data import. Domains remain System Tenant websites. Tenant PNVS, private encrypted secrets, fulfillment, refund-to-entitlement revocation, and other marketing surfaces remain separate.
|
||||
- **Required verification:** Permission matrix, row-scope negatives, secret redaction/rotation, integration authorization, legacy import idempotency/audit, and cross-tenant tests. Pay/Coupon/Trade/Seckill/Combination tests are delivered through V4450, including composite after-sale/brokerage/special-order references, state/amount/stock/capacity validation, exact menus, real tenant-isolated service/statistics/concurrency reads and writes, and fail-closed adoption.
|
||||
- **Open decision:** Compose payments through Pay, products/coupons/promotions/orders/refunds/commissions through Mall Product/Promotion/Trade, and auth providers through System/Member. Continue Bargain/Point and other Promotion families, explicit legacy commerce/referral/settlement-proof imports, production financial/order/refund runbooks, reviewed balances, non-equivalent provider replacement, private secret rotation, automatic fulfillment, and refund revocation separately. Activation codes remain Education-owned learning credentials composed with Mall SPU binding and the entitlement pipeline.
|
||||
|
||||
## Platform administration and governance
|
||||
|
||||
@@ -82,10 +102,10 @@ This Phase 0 artifact maps API families rather than all 342 operations. Endpoint
|
||||
- **Legacy authorization semantics to preserve:** tenant boundary, principal type, visibility, idempotency, state transitions, and redaction as applicable.
|
||||
- **Target:** Mall + Pay + Member + CRM with Education binding
|
||||
- **Reuse:** Mall/Pay DTO APIs, Member identity/entitlement/points, CRM services, Infra Job/MQ/audit.
|
||||
- **Migration conclusion:** product decision required
|
||||
- **Contract gap:** Verified target Pay/Mall APIs expose core seams, but scoped entitlement issuance/revocation, activation codes, reconciliation, commissions, dunning, and referral semantics are not proven. One prior evidence path was malformed; corrected source location is /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts.
|
||||
- **Required verification:** Callback/idempotency/amount/refund, entitlement lifecycle, reconciliation, and education fulfillment contract tests.
|
||||
- **Open decision:** Choose entitlement/activation-code/coupon model and confirm issuance, revocation, callback, refund, reconciliation, commission, and referral contracts before paid practice.
|
||||
- **Migration conclusion:** partially migrated — bounded Education binding/entitlement and activation redemption, native Pay ledgers, terminal legacy aggregate import, tenant-scoped native Mall Product persistence/UI, and native Promotion Coupon template/instance persistence/UI are proven; commerce orchestration remains open
|
||||
- **Contract gap:** V4340 provides tenant-scoped native transaction ledgers, callbacks, retry tasks, and existing admin UI; V4350 adds bounded terminal import; V4360 activates native Transfer/Wallet ledgers; V4370 activates native Product; V4380 activates native coupon templates/instances without translating legacy code campaigns. These slices do not connect successful purchases to Education entitlements. Explicit legacy product/code-coupon import, production bulk migration, reviewed opening balances, automatic Pay/Mall fulfillment, refund-driven entitlement revocation, legacy activation-code import, Trade/other Promotion families, settlement reconciliation, commissions, dunning, and referral semantics remain unproven. One prior evidence path was malformed; corrected source location is /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts.
|
||||
- **Required verification:** Native order/refund/notify service, tenant-database, and terminal amount/status/provider mapping contracts are delivered. Production export/reconciliation evidence, callback/idempotency integration, entitlement lifecycle, settlement reconciliation, and education fulfillment contract tests remain required.
|
||||
- **Open decision:** Keep V4310 activation codes separate from Mall Promotion coupons; confirm automatic issuance, callback, refund, reconciliation, coupon, commission, and referral contracts before broader commerce migration.
|
||||
|
||||
## Background processing, assets, and operational platform
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
> Phase 0 static assessment generated on 2026-07-29. No build, test, application startup, PostgreSQL connection, or Flyway migration was executed during this assessment.
|
||||
|
||||
> Runtime mapping update 2026-08-01: V4390/EDU-027 owns the native Trade order core, V4400/EDU-028 owns normal-checkout Discount/Reward persistence, V4410/EDU-029 owns delivery, V4420/EDU-030 owns after-sale/log persistence, and V4430/EDU-031 owns brokerage persistence. V4440/EDU-032 adds tenant-composite Seckill tables; V4450/EDU-033 adds tenant-composite `promotion_combination_activity`, `promotion_combination_product`, and `promotion_combination_record` plus tenant-qualified Product, Trade Order, order-record, and head references. The source has neither seckill nor group-buying state, so these tables start empty; its combination-question token stays Education content. Legacy aggregate orders/refunds/campaigns and UUID referral/settlement/proof objects remain unmapped; Bargain/Point and other Promotion tables require dedicated tenant-safe migrations.
|
||||
|
||||
## Global disposition rules
|
||||
|
||||
- Ordinary education tables and constraints become immutable module-owned PostgreSQL Flyway migrations.
|
||||
@@ -81,10 +83,10 @@
|
||||
### Disposition
|
||||
|
||||
- **Target owner:** Education + System + Member + Mall/Pay + Infra
|
||||
- **Current status:** pending migration
|
||||
- **Required cross-module treatment:** System RBAC/DataPermission and tenant configuration are reused; Mall/Pay/Member own commercial primitives; Infra owns secrets/messaging/files where applicable; Education owns only domain relationships and configuration extensions.
|
||||
- **Risk:** High: admin scope, secret leakage, payment configuration, and code redemption errors.
|
||||
- **Decision still required:** Define class/student/teacher scope semantics and separately decide appearance, domain, payment/auth integration, secret, activation-code, coupon, public-bank grant, and marketing ownership or retirement.
|
||||
- **Current status:** partially migrated — V4290 owns appearance/settings/theme extensions; V4300 reuses native Pay/System administration; V4310 adds activation-code tables; V4320–V4360 create/adopt native Pay configuration, transaction, Transfer, and Wallet tables plus bounded import audits; V4370 creates native Product; V4380 creates Coupon; V4390–V4430 create tenant-scoped normal Trade order, checkout Promotion, delivery, after-sale/log, and brokerage tables; V4440 creates Seckill tables and V4450 creates Combination activity/product/record tables plus their Trade bridges
|
||||
- **Required cross-module treatment:** System RBAC/DataPermission and tenant configuration are reused. Native Pay tables remain Pay-owned and tenant-aware. Native Product tables remain Mall-owned, all nine records use `TenantBaseDO`, and composite tenant references protect the catalog graph. Native Promotion Coupon, Seckill, and Combination tables remain Mall-owned and tenant-qualified; Product validates SPU/SKU scope, Member supplies principals, and Trade owns order lifecycle. V4330 stores digests/mapping notes but no credentials. Tenant-scoped `system_social_client` remains System-owned. Global `system_sms_channel` is not a safe substitute for tenant PNVS. Education owns resource binding and entitlement state; activation-code rows store digest/mask, never plaintext.
|
||||
- **Risk:** High: admin scope, secret leakage, payment configuration, promotion stock, and code redemption errors.
|
||||
- **Decision still required:** Domains stay in System. EDU-021–EDU-033 resolve bounded Pay/Product/Coupon/normal-Trade/delivery/after-sale/native-brokerage/Seckill/Combination activation. Decide Bargain/Point and other Promotion families, explicit legacy product/code-coupon/order/refund/referral/settlement-proof import, production export/runbooks, Member mapping and reviewed opening balances, non-equivalent providers, fulfillment/refund revocation, legacy activation-code import, tenant PNVS, encrypted generic private secrets, public-bank grants, and other marketing as separate contracts.
|
||||
|
||||
## Platform administration and governance
|
||||
|
||||
@@ -110,10 +112,10 @@
|
||||
### Disposition
|
||||
|
||||
- **Target owner:** Mall + Pay + Member + CRM with Education binding
|
||||
- **Current status:** product decision required
|
||||
- **Required cross-module treatment:** Mall Trade/Product, Pay, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only.
|
||||
- **Current status:** partially migrated — product binding, entitlement events, activation-code redemption, native Pay ledgers/import, Product/Coupon, and V4390–V4450 normal Trade order/checkout/delivery/after-sale/brokerage/Seckill/Combination persistence/UI are implemented; explicit legacy product/code-coupon/order/refund/referral/settlement-proof import, Bargain/Point and other Promotion families, production bulk migration, and broader commerce orchestration remain open
|
||||
- **Required cross-module treatment:** Mall Trade/Product/Promotion, Pay transaction/callback APIs, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only. Legacy financial rows may enter Pay only through EDU-023's reviewed aggregate contract; incompatible legacy code campaigns may not be silently copied into native coupon instances.
|
||||
- **Risk:** High financial and authorization risk.
|
||||
- **Decision still required:** Choose entitlement/activation-code/coupon model and confirm issuance, revocation, callback, refund, reconciliation, commission, and referral contracts before paid practice.
|
||||
- **Decision still required:** Keep activation codes as Education learning credentials and coupons/seckill as Mall Promotion objects; native Trade owns new two-level commissions and special-order order fields, while other Promotion families, source CRM referral and settlement-proof import, automatic issuance, revocation callbacks, refunds, and reconciliation require separate contracts before broader paid-practice fulfillment.
|
||||
|
||||
## Background processing, assets, and operational platform
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
> Phase 0 static assessment generated on 2026-07-29. No build, test, application startup, PostgreSQL connection, or Flyway migration was executed during this assessment.
|
||||
|
||||
> Runtime reuse update 2026-08-01: EDU-027 activates Mall Trade order/cart/config, EDU-028 reuses native Promotion Discount/Reward, EDU-029 reuses delivery, EDU-030 reuses after-sale/Pay Refund, and EDU-031 reuses native Trade brokerage. EDU-032 reuses native Promotion Seckill; EDU-033 reuses native Combination app/admin controllers, services, mappers, jobs, Product/Member lookups, group lifecycle, Trade Order bridge, RBAC, and corrected Vben pages while supplying tenant-safe PostgreSQL persistence. Education owns no duplicate commerce, promotion, delivery, refund, commission, stock, or group aggregate.
|
||||
|
||||
Education must call public APIs, framework extension points, or events. It must not depend on another module's internal ServiceImpl, Mapper, or DO.
|
||||
|
||||
## Tenant resolution, identity, and student context
|
||||
@@ -36,8 +38,8 @@ Education must call public APIs, framework extension points, or events. It must
|
||||
|
||||
- **Target owner:** Education + System + Member + Mall/Pay + Infra
|
||||
- **Public/framework capability to reuse:** System Tenant/RBAC/DataPermission/AdminUserApi, Member relationships, Mall/Pay/Member APIs, Infra secret/file/message/audit facilities.
|
||||
- **Education-owned gap:** Verified: classes/supervision were only part of the source tenant-admin surface. Appearance/theme lifecycle, domains/payment/auth integrations, secret rotation, and codes/coupons are separate migration/security surfaces with no verified target equivalent. Inference: collapsing them into one row would hide authorization and secret-handling decisions.
|
||||
- **Allowed external-module change:** System RBAC/DataPermission and tenant configuration are reused; Mall/Pay/Member own commercial primitives; Infra owns secrets/messaging/files where applicable; Education owns only domain relationships and configuration extensions.
|
||||
- **Education-owned gap:** V4290 owns presentation extensions. V4300–V4380 expose and activate native Pay/System/Product/Promotion administration without Education shadow ledgers. V4390–V4430 activate native Trade order core, Discount/Reward checkout dependencies, delivery, after-sale, and brokerage; V4440 activates native Seckill and V4450 activates native Combination activity, SKU pricing, group records, capacity protection, and Trade bridge with their real APIs/services and existing pages. Education adds no financial, product, coupon, cart, order, promotion, delivery, refund, commission, stock, or group ledger. V4310 adds only activation-code state and composes Mall-owned SPU binding, Member authentication, and the existing entitlement event. Explicit legacy product/code-coupon/order/refund/referral/settlement-proof import, Bargain/Point and other Promotion families, production bulk export/runbooks and reviewed wallet opening balances, non-equivalent provider/mode replacement, automatic fulfillment/refund revocation, and legacy activation-code import remain unhandled; global System SMS Channel cannot satisfy per-tenant PNVS. Infra/private generic secrets remain separate gaps.
|
||||
- **Allowed external-module change:** System RBAC/DataPermission and tenant configuration are reused; Mall owns products/coupons/promotions/orders, Pay owns payment, Member owns principals, and Infra owns secrets/messaging/files. Education owns learning relationships/configuration, activation-code credentials, and access orchestration without duplicating those platform ledgers.
|
||||
|
||||
## Platform administration and governance
|
||||
|
||||
@@ -50,15 +52,16 @@ Education must call public APIs, framework extension points, or events. It must
|
||||
|
||||
- **Target owner:** Mall + Pay + Member + CRM with Education binding
|
||||
- **Public/framework capability to reuse:** Mall/Pay DTO APIs, Member identity/entitlement/points, CRM services, Infra Job/MQ/audit.
|
||||
- **Education-owned gap:** Verified target Pay/Mall APIs expose core seams, but scoped entitlement issuance/revocation, activation codes, reconciliation, commissions, dunning, and referral semantics are not proven. One prior evidence path was malformed; corrected source location is /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts.
|
||||
- **Allowed external-module change:** Mall Trade/Product, Pay, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only.
|
||||
- **Education-owned gap:** Bounded resource binding, entitlement issuance/revocation, activation-code redemption, native Pay ledgers/import, native Product/Coupon, and V4390–V4450 Trade order/checkout/delivery/after-sale/brokerage/Seckill/Combination persistence/admin are proven. Legacy display-only Product, incompatible code campaigns, aggregate orders/refunds, and UUID referral/settlement/proof objects are not imported; the source has no seckill or group-buying state to import, and its combination-question token remains Education content. Bargain/Point and other Promotion families, production bulk migration and reviewed balances remain open, and successful native Pay/Trade events are not yet composed into automatic Education fulfillment or refund revocation. Native two-level commission, Seckill stock isolation, and Combination capacity isolation are proven, but source CRM referral, proof/export, dunning, and settlement equivalence remain unproven. One prior evidence path was malformed; corrected source location is /Users/tiku1/code/tiku-backend/apps/api/src/nest/commerce-reconciliation.module.ts.
|
||||
- **Allowed external-module change:** Mall Trade/Product/Promotion, Pay, Member entitlement/points, CRM, Infra jobs/events/audit; Education owns product-to-education bindings and fulfillment orchestration only.
|
||||
|
||||
## Background processing, assets, and operational platform
|
||||
|
||||
- **Target owner:** Infra platform plus owning domain modules
|
||||
- **Public/framework capability to reuse:** Infra Job, Redis MQ, File, locks, idempotency, logging, tracing, Excel utilities, tenant propagation.
|
||||
- **Education-owned gap:** Verified target primitives exist, but durable claim/lease/heartbeat/retry and malware-scanner equivalence are not proven. Education import/export business state is absent or not verified.
|
||||
- **Allowed external-module change:** Infra Job/MQ/File/logging/observability plus owning Education/Pay/Mall/CRM handlers; scanner deployment or adapter ownership must be decided.
|
||||
- **Public/framework capability to reuse:** Public Infra File APIs and framework tenant context; generic locks, logging, tracing, and scheduling remain platform capabilities when exposed through public contracts.
|
||||
- **Education-owned delivered scope:** EDU-011 owns tenant import asset metadata and import jobs, including the five states `PREVIEW`, `PENDING`, `PROCESSING`, `COMPLETED`, and `FAILED`; lease/heartbeat/expired-lease recovery; bounded attempts; and duplicate safety. V4130 is the only delivered EDU-011 migration. Scanner absence defaults to fail-closed `UNAVAILABLE`; CSV/XLSX preview is metadata-only when no parser is available; execution requires both a clean scan and executable parsed content.
|
||||
- **Deferred scope:** The export boundary currently defines request redaction only—answers and private fields are excluded—but generates no export file or export job. Production scanner integration, full parser availability, retention automation, dead-letter/operator tooling, partial-row reporting, and legacy asset migration remain deferred.
|
||||
- **Allowed external-module change:** Education may call public Infra APIs only. It must not depend on Infra DOs, mappers, `ServiceImpl` classes, or implementation packages, and it does not move Education job state into Infra.
|
||||
|
||||
## Secondary learning, media, AI, and engagement
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ The durable artifact classification, adoption matrix, version allocation, backfi
|
||||
3. V4030 owns the final Practice core-loop schema, including sessions/questions, reports/details, wrong questions, favorites, and unified `education_idempotency`. Fresh schema does not create legacy answer/submit idempotency tables.
|
||||
4. Existing manually bootstrapped databases require explicit schema comparison and adoption. A verified V4020-equivalent catalog may use an environment-specific 4020 baseline; incompatible environments require a higher-version correction, never falsified history.
|
||||
5. Legacy idempotency data is backfilled into the unified table before any later forward cleanup. Legacy tables are preserved during initial adoption.
|
||||
6. The Education capability menu seed is a separate conditional V4040 owner only if the administrator endpoint remains approved; role assignment is not seeded.
|
||||
6. The earlier V4040 capability-seed plan was superseded after V4040 was allocated to the submit-claim lease. V4080/V4090 conditionally seed the approved capability plus question author/classify/publish/archive permissions when `system_menu` exists; role assignment is not seeded.
|
||||
7. Docker/manual SQL initialization and MySQL rollback runbooks must be removed from active operations when EDU-006 lands. EDU-016's temporary test bridge becomes Flyway-driven after equivalence is proven.
|
||||
8. The inspected local disposable `postgresdb` had no Flyway history and no Education tables. EDU-005 ran no migration and makes no migration-success claim.
|
||||
|
||||
@@ -49,18 +49,141 @@ The durable artifact classification, adoption matrix, version allocation, backfi
|
||||
12. Do not expose paid/private practice until entitlement semantics and public target contracts are decided.
|
||||
13. No tests, builds, PostgreSQL connections, Flyway execution, or runtime verification were performed by the Phase 0 assessment unless a later ticket explicitly records otherwise.
|
||||
|
||||
## Resolved decisions (post-Phase 0)
|
||||
|
||||
### Provider-authority decision (resolved 2026-07-30)
|
||||
|
||||
**Decision:** Coexistence with Scalar as the authoritative primary. ScalarCatalogProvider (HTTP data source, `SCALAR_READ`) is the authoritative primary for catalog read operations. JavaCatalogProvider (PostgreSQL direct, `JAVA_READ`) is the conditionally-activated secondary for tenants that have completed a catalog data migration into native PostgreSQL tables.
|
||||
|
||||
**Rules:**
|
||||
1. `SCALAR_READ` is the default and authoritative mode. It is the source of real tenant catalog content from the running tiku-backend NestJS service.
|
||||
2. `JAVA_READ` is conditionally activated only when `yudao.education.catalog-mode=JAVA_READ` is explicitly set.
|
||||
3. Both providers implement the same `CatalogProvider` + `QuestionCatalogProvider` interfaces; `QuestionContentSafety` and `QuestionCatalogServiceImpl` enforce provider-neutral fail-closed rules.
|
||||
4. JavaCatalogProvider must not be promoted to default without: (a) runtime-verified V4020 catalog tables, (b) dedicated contract test suite, (c) mapper audit of `TenantUtils.executeIgnore` boundary.
|
||||
5. Provider mode is currently global; per-tenant override is a future concern.
|
||||
|
||||
**Rationale:** Scalar is the running production data source with 1084 lines of dedicated tests; Java native catalog is dirty, uncommitted, runtime-unverified. The code already implements coexistence through the provider interface — this decision formalizes the existing architecture.
|
||||
|
||||
**Actions:**
|
||||
- Document as ADR in `docs/education/migration/decisions/provider-authority.md`
|
||||
- Add `JavaCatalogProviderTest` contract test suite
|
||||
- Add provider-neutral integration test for equivalent safe projections
|
||||
- Update `CatalogProviderMode` Javadoc
|
||||
|
||||
**Evidence:** Multi-agent code audit of ScalarCatalogProvider (1084 lines of tests, 13 catalog endpoints, comprehensive error handling), JavaCatalogProvider (0 dedicated tests, `TenantUtils.executeIgnore` pattern, dirty V4020), provider switch mechanism.
|
||||
|
||||
### PUBLIC graph-semantics decision (resolved 2026-07-30)
|
||||
|
||||
**Decision:** Combination enforcement via database triggers, immutable ownership scope, and application-layer validation.
|
||||
|
||||
**Rules:**
|
||||
1. **PUBLIC rows (tenant_id=0, scope='PUBLIC')** may only reference PUBLIC parents. PUBLIC is a self-contained content tree.
|
||||
2. **Tenant-owned rows (tenant_id>0, scope='TENANT_OWNED')** may reference PUBLIC rows — this is the primary content-sharing mechanism.
|
||||
3. **Tenant-owned rows referencing other-tenant rows** is forbidden.
|
||||
4. Composite foreign keys `(tenant_id, parent_id)` are NOT used because the `tenant_id=0` sentinel naturally breaks FK matching for tenant→PUBLIC references.
|
||||
5. A catalog row's `tenant_id` and `scope` are immutable after insert. Moving content between tenant-owned and PUBLIC scope requires an explicit copy/adoption workflow; publication changes lifecycle, not ownership.
|
||||
|
||||
**Enforcement strategy (combination):**
|
||||
- **Database triggers** (primary guard): `education_check_reference_scope()` function with BEFORE INSERT/UPDATE triggers on every FK column of every catalog table. SECURITY DEFINER, fail-closed on violation.
|
||||
- **Ownership immutability triggers** on all 11 catalog tables prevent parent mutations from invalidating existing references and remove the concurrent child-insert/parent-move race.
|
||||
- **Application-layer validation** in service write paths (first line of defense).
|
||||
- **Migration pre-validation** DO block that fails if existing data contains cross-scope violations.
|
||||
|
||||
**Flyway delivery:**
|
||||
- V4070: Create reference and ownership-scope guard functions, attach triggers, then run historical pre-validation while migration DDL locks prevent concurrent writes.
|
||||
|
||||
**Rationale:** Legacy Supabase enforced tenant graph integrity via RLS policies and staged composite FK migration. The target's `tenant_id=0` sentinel breaks composite FK for tenant→PUBLIC references — only triggers handle all three reference scenarios correctly. Application-only enforcement is insufficient per fail-closed requirements (GOAL.md §2.3). Implementation review rejected redundant `UNIQUE (tenant_id, id)` constraints because V4020 IDs are already globally unique primary keys and no current query, conflict target, or composite FK consumes those indexes.
|
||||
|
||||
**Actions:**
|
||||
- Done: create V4070 (19 reference guards, 11 immutable-scope guards, and historical pre-validation) via `flyway-postgresql`
|
||||
- Add application-layer scope validation in catalog write services
|
||||
- Extend `CatalogScopeQuery` with explicit tenant_id/disallowed-scope predicates
|
||||
- Add focused integration tests for all reference scenarios
|
||||
|
||||
**Evidence:** Schema graph analysis of V4020 (11 catalog tables, all single-column FKs, no composite tenant enforcement), legacy RLS/trigger audit (Supabase RLS + staged composite FK migration), current CHECK constraints provide row-level but not cross-row enforcement.
|
||||
|
||||
### Native question authoring authority and lifecycle (resolved 2026-07-30)
|
||||
|
||||
**Decision:** Local tenant question authoring is available only under explicit `JAVA_READ` authority and fails before persistence access in `SCALAR_READ`. New questions are `DRAFT`; the current command surface permits only `DRAFT → PUBLISHED → ARCHIVED`, with no restore or retire command.
|
||||
|
||||
**Rules:**
|
||||
1. Create, place, publish, and archive are explicit commands with separate System RBAC permissions; clients cannot submit tenant, scope, lifecycle, or actor fields.
|
||||
2. Tenant authoring always creates `TENANT_OWNED` content for the current framework tenant. PUBLIC/platform-curator authoring is not part of this slice.
|
||||
3. Question Content Versions are immutable. Publication changes lifecycle state for the current version and never changes `tenant_id`, `scope`, or content version.
|
||||
4. Education appends a lifecycle audit in the same transaction as each state transition. The asynchronous platform operation log remains supplementary, not proof of atomic publication.
|
||||
5. Direct question visibility follows the question's Publication State. Entry, node, and collection availability gates their own discovery routes and does not mutate the question lifecycle or historical practice snapshots.
|
||||
6. Historical `HIDDEN`, `INACTIVE`, and `PUBLISHED/is_published=false` rows map to `ARCHIVED`; historical `DRAFT` rows become non-published; only consistent published rows remain `PUBLISHED`.
|
||||
7. V4080 adds Question Version → Question as the twentieth guarded catalog edge. A version must have exactly the same tenant and scope as its question, and the version table becomes the twelfth catalog table whose ownership cannot change after insert.
|
||||
8. Question Placement means assigning a DRAFT question's `node_id`; it does not mean Category CRUD. The `education_category` table has no Question relationship in the current target model.
|
||||
9. Placement targets must be visible, active, selectable PUBLIC or same-tenant Content Nodes. Placement has an independent optimistic version, becomes immutable after publication, and publication CAS includes that version.
|
||||
10. Node-route student visibility is evaluated atomically in the Question/Content Node query. Node availability gates that route but does not change direct question visibility or historical snapshots.
|
||||
11. Tenant Content Node authoring is JAVA_READ-only, current-tenant TENANT_OWNED-only, and uses `DRAFT → ACTIVE → ARCHIVED` with one CAS `authoring_version` shared by revisions and transitions.
|
||||
12. Content Node activation requires a structurally available entry and parent. Student discovery and Question Placement treat only ACTIVE nodes as available. Content Node lifecycle audit is transactional and append-only.
|
||||
13. Content Node permissions are `education:content-node:author`, `education:content-node:publish`, and `education:content-node:archive`; V4100 seeds no permission, menu, role, or role grant.
|
||||
14. The next bounded EDU-010 slice is a JAVA_READ-only current-tenant `TENANT_OWNED` Manual Question Collection attached to one existing ACTIVE, visible Content Node. Content Entry creation is excluded, so the target node and its structurally available Content Entry must be pre-provisioned.
|
||||
15. A Manual Question Collection uses `DRAFT → ACTIVE → ARCHIVED` with one optimistic authoring version. Only DRAFT metadata and membership may change; ACTIVE collection content and membership are immutable, and ARCHIVED is terminal.
|
||||
16. Membership is an ordered replace-all command available only in DRAFT. Every member must be a current-tenant `TENANT_OWNED` PUBLISHED Question, and duplicate Question IDs are rejected rather than collapsed or upserted.
|
||||
17. Activation exposes the collection route only when the collection and its existing Content Node are available. Archiving closes only collection-route discovery; it does not alter direct Question visibility or historical Practice Question Snapshots.
|
||||
18. `access_rules` is descriptive reserved metadata in this slice, not entitlement enforcement. PUBLIC Question curation, dynamic filters, paid/private access, Category, Practice Blueprint, and Content Entry creation are excluded.
|
||||
19. Protected lifecycle transition tokens rely on PostgreSQL object ownership separation: an explicit Flyway owner role creates V4080/V4100/V4110 token tables, while the runtime master datasource role must neither own nor write them. Local/dev configuration requires explicit `FLYWAY_USER`/`FLYWAY_PASSWORD`; startup fails closed when any protected table is missing, runtime-owned, inherited through role membership, or runtime-writable. Deployment automation provisions roles and grants outside Flyway because migrations cannot safely create shared login roles or know credential policy.
|
||||
|
||||
20. V4120 closes the bounded EDU-010 Category and Practice Blueprint scope. Category is a standalone Subject-scoped catalog aggregate, not Question classification. Blueprint authoring is limited to exactly one current-tenant NODE or active Manual COLLECTION target; target ownership, route, and counts are server-derived.
|
||||
21. Category and Practice Blueprint use the same `DRAFT → ACTIVE → ARCHIVED`, `authoring_version` CAS, transactional append-only audit, current-tenant ownership, and `JAVA_READ` authority rules as Content Node and Collection. Student reads require ACTIVE lifecycle plus route availability.
|
||||
22. The six added permissions are `education:category:{author,publish,archive}` and `education:practice-blueprint:{author,publish,archive}`. V4120 conditionally seeds permission rows at IDs 6809-6814, fails on conflicting IDs, and assigns no roles.
|
||||
|
||||
**Permission and data-scope matrix:**
|
||||
|
||||
| Actor capability | Permission | Allowed rows | Data scope |
|
||||
|---|---|---|---|
|
||||
| Author | `education:question:author` | Create current-tenant `TENANT_OWNED` drafts | Current tenant; no request-supplied owner or tenant |
|
||||
| Classifier | `education:question:classify` | Place or re-place current-tenant `TENANT_OWNED` drafts on allowed Content Nodes | Tenant-wide shared catalog asset; PUBLIC/same-tenant targets only |
|
||||
| Publisher | `education:question:publish` | Current-tenant `TENANT_OWNED` drafts | Tenant-wide shared catalog asset; department/self DataPermission does not expand access |
|
||||
| Archiver | `education:question:archive` | Current-tenant `TENANT_OWNED` published questions | Tenant-wide shared catalog asset; department/self DataPermission does not expand access |
|
||||
| Content Node author | `education:content-node:author` | Create/revise current-tenant TENANT_OWNED drafts | Current tenant; structural entry/parent validation |
|
||||
| Content Node publisher | `education:content-node:publish` | Activate current-tenant TENANT_OWNED drafts | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Content Node archiver | `education:content-node:archive` | Archive current-tenant TENANT_OWNED active nodes | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Collection author | `education:collection:author` | Create/revise current-tenant TENANT_OWNED Manual Question Collection drafts and replace ordered membership | Current tenant; DRAFT-only; existing ACTIVE node and PUBLISHED tenant questions |
|
||||
| Collection publisher | `education:collection:publish` | Activate current-tenant TENANT_OWNED Manual Question Collection drafts | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Collection archiver | `education:collection:archive` | Archive current-tenant TENANT_OWNED active Manual Question Collections | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Category author | `education:category:author` | Create/revise current-tenant TENANT_OWNED Category drafts | Current tenant; active PUBLIC or same-tenant Subject reference |
|
||||
| Category publisher | `education:category:publish` | Activate current-tenant TENANT_OWNED Category drafts | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Category archiver | `education:category:archive` | Archive current-tenant TENANT_OWNED active Categories | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Practice Blueprint author | `education:practice-blueprint:author` | Create/revise bounded NODE or COLLECTION blueprint drafts | Current tenant; target ownership and counts derived server-side |
|
||||
| Practice Blueprint publisher | `education:practice-blueprint:publish` | Activate current-tenant TENANT_OWNED blueprint drafts | Tenant-wide shared catalog asset; target revalidation and CAS |
|
||||
| Practice Blueprint archiver | `education:practice-blueprint:archive` | Archive current-tenant TENANT_OWNED active blueprints | Tenant-wide shared catalog asset; authoring-version CAS |
|
||||
| Platform curator | none in this slice | No PUBLIC writes through these endpoints | Fail closed |
|
||||
|
||||
V4080/V4090 conditionally seed the five Education permissions (`education:capability` plus author/classify/publish/archive). V4110 conditionally seeds the collection author/publish/archive permissions at IDs 6806-6808. Seeds run only when `system_menu` exists, fail when a fixed ID is occupied by a different permission, and deliberately assign no role.
|
||||
|
||||
**Rationale:** A successful PostgreSQL write while Scalar remains authoritative would be student-invisible. Department/self DataPermission has no truthful meaning for tenant-wide shared catalog rows without a separate ownership model, so action permissions plus framework tenant isolation are explicit rather than applying a misleading annotation.
|
||||
|
||||
**ADR:** `docs/adr/0001-native-question-authoring-authority.md`.
|
||||
|
||||
The accepted Manual Question Collection slice does not warrant a separate ADR: it applies the already-recorded native-authority, tenant-ownership, lifecycle, optimistic-concurrency, route-gating, and snapshot-preservation decisions to one narrower aggregate, without adding a hard-to-reverse architectural trade-off.
|
||||
|
||||
### EDU-011 bounded import/export-assets capability (resolved 2026-07-31)
|
||||
|
||||
**Decision:** Education owns tenant import asset metadata and durable import-job business state. Infra remains the owner of generic private-file/platform facilities and is consumed only through public APIs.
|
||||
|
||||
1. The import job has exactly five persisted states: `PREVIEW`, `PENDING`, `PROCESSING`, `COMPLETED`, and `FAILED`.
|
||||
2. Processing uses atomic claim, fenced lease token, heartbeat, expired-lease recovery, bounded attempts, and duplicate-safe tenant command keys.
|
||||
3. Scanning fails closed. With no configured scanner adapter the result is `UNAVAILABLE`, never implicitly clean.
|
||||
4. CSV/XLSX may produce metadata-only preview when no parser is available. Such a preview is not executable; execute requires a clean scan and explicit executable parsed content.
|
||||
5. Export scope is request redaction policy only: answers and private fields must be excluded. No generated export file, export worker, or export-job persistence is delivered.
|
||||
6. V4130 is the only EDU-011 migration. Production scanner integration, full parser delivery, retention/deletion automation, dead-letter/operator tooling, partial-row reporting, and legacy asset migration remain deferred.
|
||||
7. Education may use public Infra APIs but may not depend on Infra DOs, mappers, `ServiceImpl` classes, or private implementation packages.
|
||||
|
||||
The bounded slice does not require a separate ADR: it keeps domain job state with Education and applies the repository's established public-module-boundary rule without introducing a new platform abstraction.
|
||||
|
||||
## Unresolved decisions
|
||||
|
||||
1. The valid option schema for each question type, including whether absent options are legal; whether malformed published content is omitted or produces a controlled source failure.
|
||||
2. Whether PUBLIC tenant_id=0 rows may reference only PUBLIC parents, whether tenant-owned rows may reference global rows, and the precise composite constraint/trigger strategy.
|
||||
3. Whether untracked /Users/tiku1/code/ruoyi-vue-pro/sql/postgresql/education files are intended for promotion into Flyway or are design/manual artifacts.
|
||||
4. Whether V4010/V4020 or any manual core-loop DDL has ever run successfully in PostgreSQL; no runtime migration evidence exists.
|
||||
5. Which Auth/Profile/extended Learning semantics are replaced by Member/System/Infra versus Education-owned, including vocabulary, leaderboard, stats, trend, feedback, exam dates, notifications, points, and badges.
|
||||
6. Whether tenant appearance, domains, payment accounts, auth providers, secrets, activation codes, coupons, integrations, marketing, public-bank grants, and sync are in scope or explicitly retired.
|
||||
7. Whether legacy assets are migrated, re-uploaded, re-scanned, or retired, and who owns ClamAV/scanner integration.
|
||||
8. Which legacy RLS, triggers, functions, grants, seeds, queue leases, retry behavior, and operational semantics are contractual and need Java/constraint/event/job reproduction.
|
||||
9. Whether the ten required Phase 0 artifacts must be committed files or may remain in reviewed scratch form during discovery.
|
||||
10. Whether a future System-owned immutable Tenant Code or signed bootstrap locator is required beyond the accepted public-handle/existence-disclosure contract.
|
||||
1. Which Auth/Profile/extended Learning semantics are replaced by Member/System/Infra versus Education-owned, including vocabulary, leaderboard, stats, trend, feedback, exam dates, notifications, points, and badges.
|
||||
2. Whether tenant appearance, domains, payment accounts, auth providers, secrets, activation codes, coupons, integrations, marketing, public-bank grants, and sync are in scope or explicitly retired.
|
||||
3. Whether legacy assets are migrated, re-uploaded, re-scanned, or retired, and who owns ClamAV/scanner integration.
|
||||
4. Which legacy RLS, triggers, functions, grants, seeds, queue leases, retry behavior, and operational semantics are contractual and need Java/constraint/event/job reproduction.
|
||||
5. Whether the ten required Phase 0 artifacts must be committed files or may remain in reviewed scratch form during discovery.
|
||||
6. Whether a future System-owned immutable Tenant Code or signed bootstrap locator is required beyond the accepted public-handle/existence-disclosure contract.
|
||||
7. Which shared environments already carry V4010/V4020 or manual equivalents and what explicit baseline/adoption record each requires. The root `sql/postgresql/education/` classification and the module-owned Flyway authority are resolved; disposable PostgreSQL execution evidence exists, but no shared-environment migration is claimed.
|
||||
|
||||
## Decision rule
|
||||
|
||||
|
||||
@@ -114,16 +114,17 @@ Tickets are vertical behaviors, not technical layers. Work blockers first and us
|
||||
|
||||
## EDU-P4-S8 — Tenant configuration, integrations, and access operations
|
||||
|
||||
- **Progress:** V4290/EDU-017 completed bounded appearance, public settings, and theme lifecycle. V4300–V4360 reuse and activate native Pay/System integration, transaction, import, Transfer, and Wallet capabilities. V4310/EDU-019 delivers secure learning activation codes and entitlement composition. V4370/EDU-025 activates Product; V4380/EDU-026 activates coupons; V4390/EDU-027 activates normal Trade order; V4400/EDU-028 activates Discount/Reward; V4410/EDU-029 activates delivery; V4420/EDU-030 activates after-sale/Pay Refund; V4430/EDU-031 activates native brokerage; V4440/EDU-032 activates tenant-aware Seckill; V4450/EDU-033 activates tenant-aware Combination activities, SKU pricing, group records, atomic capacity, Trade Order/head bridges, exact permissions, and corrected Vben pages. Domains remain with their RuoYi owners; source referral CRM/settlement-proof import, Bargain/Point and other Promotion families, explicit legacy Product/code-coupon/order/refund import, production bulk export/runbooks and reviewed balances, automatic fulfillment/refund revocation, non-equivalent provider/mode replacement, tenant PNVS, legacy activation-code import, generic private secrets, and public-bank access remain separate.
|
||||
- **Outcome:** Selected tenant appearance, integrations, secrets, activation codes, coupons, and public-bank access capabilities have explicit owners and safe contracts.
|
||||
- **Risk:** High because secret, payment configuration, redemption, and public-bank synchronization boundaries differ.
|
||||
- **Blockers:**
|
||||
- Appearance/domain/integration/secrets/codes ownership decisions.
|
||||
- System tenant configuration and secret APIs.
|
||||
- Mall/Pay/Member entitlement and code contracts.
|
||||
- Mall/Pay/Member entitlement and coupon contracts; EDU-019 resolves bounded new activation codes, EDU-021–EDU-024 resolve bounded Pay activation/import/ledgers, EDU-025 resolves Product, EDU-026 resolves coupons, EDU-027 resolves normal Trade order, EDU-028 resolves Discount/Reward, EDU-029 resolves delivery, EDU-030 resolves after-sale, EDU-031 resolves native brokerage, EDU-032 resolves native Seckill, and EDU-033 resolves native Combination activation. Explicit legacy Product/code-coupon/order/refund/referral/settlement-proof import, Bargain/Point and other Promotion families, legacy activation-code import, production financial bulk migration and reviewed opening balances, fulfillment, and refund revocation remain open.
|
||||
- **Verification:**
|
||||
- Secret redaction/rotation and authorization tests.
|
||||
- Domain/auth-provider/payment-account configuration tests.
|
||||
- Code/coupon redemption idempotency and audit tests.
|
||||
- Domain/auth-provider/payment-account configuration tests; EDU-021 covers bounded account mapping/replay/redaction, EDU-022 covers transaction tenant inheritance, composite database references, notification uniqueness, native service regressions, and menu shape, EDU-023 covers terminal reconciliation, redacted audit, idempotency/conflict, and native order-page UI, EDU-024 covers Transfer/Wallet tenant inheritance, tenant-qualified locks, amount safety, composite references, and native UI/menu shape, and EDU-025 covers nine Product tenant records, catalog graph references, category parent isolation, amount/score safety, global-table refusal, and native UI/menu shape.
|
||||
- Native coupon tenant/reference/counter/discount/use-state and menu-shape tests are delivered by V4380. V4390 adds Trade tenant inheritance, composite Order/Cart/Product references, state/amount checks, global/deferred-table refusal, sequences, and exact order/config UI/menu shape. Legacy code and order import/reconciliation remain open. V4310 already covers activation-code digest, tenant, replay, conflict, disabled dependency, entitlement-event, and concurrent-winner behavior.
|
||||
- Public-bank grant/sync and cross-tenant tests.
|
||||
|
||||
## EDU-P5-S9 — Education commercialization binding
|
||||
@@ -131,8 +132,8 @@ Tickets are vertical behaviors, not technical layers. Work blockers first and us
|
||||
- **Outcome:** Education products bind to commerce purchases and Member entitlements without duplicated financial ledgers.
|
||||
- **Risk:** High financial and authorization risk.
|
||||
- **Blockers:**
|
||||
- Product binding model.
|
||||
- Mall/Pay public APIs.
|
||||
- Product binding model; EDU-025 supplies the tenant-scoped native Product owner but binding authoring/import semantics remain open.
|
||||
- Mall/Pay public APIs; Product, native coupons, normal Trade order/delivery/after-sale, native brokerage, Seckill, and Combination are active, while Bargain/Point and other Promotion families, source referral/settlement-proof mapping, and purchase/refund-to-entitlement composition remain open.
|
||||
- Member entitlement decision and callback/refund semantics.
|
||||
- **Verification:**
|
||||
- Order/payment/refund callback contracts.
|
||||
|
||||
282
docs/education/migration/12-admin-authoring-ui.md
Normal file
282
docs/education/migration/12-admin-authoring-ui.md
Normal file
@@ -0,0 +1,282 @@
|
||||
# Education Admin UI
|
||||
|
||||
> Implemented on 2026-07-31 as the first two Vben management UI slices. This record covers build-time and disposable PostgreSQL evidence only; it is not Pilot or production runtime evidence.
|
||||
|
||||
## Delivered pages
|
||||
|
||||
The Vben admin submodule now contains the four routes seeded by Education Flyway migration V4220:
|
||||
|
||||
| Menu component | Capability |
|
||||
|---|---|
|
||||
| `education/content-node/index` | Page, create, revise, activate, and archive tenant content nodes |
|
||||
| `education/question/index` | Page, create/revise drafts, place on a content node, publish, and archive questions |
|
||||
| `education/collection/index` | Page, create/revise drafts, replace ordered question membership, activate, and archive collections |
|
||||
| `education/practice-blueprint/index` | Page, create/revise NODE or COLLECTION blueprints, activate, and archive blueprints |
|
||||
|
||||
Flyway migration V4230 adds four further routes over existing backend contracts:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `education/import-job/index` | Infra File-backed upload and malware scan, parser preview, explicit execution, and job lookup |
|
||||
| `education/classroom/index` | Class creation, Member user membership display, and expiring idempotent invitations |
|
||||
| `education/commercialization/index` | Question-collection binding to Mall SPU and idempotent Member entitlement events suitable for Pay/Mall callbacks |
|
||||
| `education/operations/index` | Read-only dependency, Worker, Scanner, and dead-letter health with server-sanitized diagnostics |
|
||||
|
||||
Flyway migration V4240 adds the remaining bounded admin contracts:
|
||||
|
||||
| Menu component | Capability |
|
||||
|---|---|
|
||||
| `education/category/index` | Tenant category page/detail reads plus create, revise, activate, and archive lifecycle |
|
||||
| `education/content-export/index` | Export field-policy evaluation with separate answer-inclusion permission; explicitly does not claim artifact generation |
|
||||
|
||||
Member migration V4250 and Education migration V4260 add the first member-learning operations slice:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `education/learning-operations/index` | Tenant learning summary, student feedback handling/audit, resolved-feedback point rewards, and learning award/badge projection. Member remains authoritative for users, levels, balances, and point records; System remains authoritative for admin identity and notifications. |
|
||||
|
||||
V4250 adds a fail-closed unique business key for Education-owned entries in the Member point ledger. `MemberPointApi.addPointOnce` treats only a verified matching ledger row as an idempotent replay, so a retry cannot double-credit a member and unrelated unique-key failures are not hidden. V4260 adds tenant-owned feedback events, optimistic feedback versions, reward delivery state, separate query/feedback/reward RBAC permissions, and menu rows.
|
||||
|
||||
Education migration V4270 adds the tenant student-supervision slice:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `education/supervision/index` | Risk-student preview over native practice reports, wrong questions, active sessions, and vocabulary progress; configurable supervision rules; idempotent follow-up generation; and optimistic follow-up handling. Member remains authoritative for student accounts. System AdminUser, RBAC, department data scopes, and simple-list selectors remain authoritative for operators. |
|
||||
|
||||
V4270 adds `dept_id` and `owner_user_id` authorization projections to Education classes and registers classes, supervision rules, and follow-ups with RuoYi `DeptDataPermissionRule`. It does not copy System users, departments, roles, or Member profiles. Stable `(tenant_id, batch_key, student_user_id)` uniqueness plus PostgreSQL `ON CONFLICT DO NOTHING` prevents both sequential and concurrent retries from duplicating work without aborting the surrounding transaction. The risk query keeps `education_class` in the main select so RuoYi's department/self interceptor can scope candidate students; a real `LoginUser` and `DeptDataPermissionRespDTO` PostgreSQL test verifies the negative department case.
|
||||
|
||||
Education migration V4280 adds configurable tenant badges and the thirteenth Education admin page:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `education/badge/index` | Badge definition filtering, creation, optimistic editing, manual Member grant, and grant-history audit. Member remains authoritative for student identity; System remains authoritative for administrator identity, RBAC, and the `education_badge_granted` notify template/message. |
|
||||
|
||||
V4280 extends the existing `education_learning_award` ledger instead of creating a second user-badge table. `(tenant_id, user_id, badge_definition_id)` makes a badge a lifetime-once grant and PostgreSQL `ON CONFLICT DO NOTHING` makes manual and automatic replay safe. Automatic evaluation is attached only to real migrated events: practice submission, vocabulary review, and feedback resolution/reward. Check-in, mock-exam, and activity-reward triggers remain unavailable until those source capabilities are migrated; the rule editor does not advertise invented event sources.
|
||||
|
||||
Education migration V4290 adds tenant appearance/settings/theme lifecycle and the fourteenth Education admin page:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `education/tenant-appearance/index` | Branding, public/admin JSON settings, three platform theme templates, draft preview, and explicit publication. System Tenant remains authoritative for tenant name and websites; System RBAC, tenant validation, AdminUser projection, and operation/access logging are reused. |
|
||||
|
||||
V4290 adds one tenant-owned optimistic configuration row and one global platform-template table. `classic`, `focus`, and `high-contrast` use the exact legacy theme token/assets payloads. The anonymous public appearance endpoint stays under the normal validated `tenant-id` context and excludes admin flags, drafts, and operator data. It is deliberately separate from `/education/tenant/resolve`, whose minimal two-field locator response remains unchanged. Public JSON recursively rejects sensitive key names except `secretRef`, while renderable theme fields, CSS variables, icons, URLs, modes, densities, colors, and radii are validated by a closed policy at both preview and publication boundaries.
|
||||
|
||||
Education migration V4300 adds two Education-menu entry points while reusing existing native UI and backend contracts:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `pay/app/index` | Tenant payment applications and channels through Pay's existing controllers, V4320 tenant-scoped App/Channel persistence, channel configuration forms, eight granular app/channel permissions, and V4330's explicit legacy-account import modal. |
|
||||
| `system/social/client/index.vue` | Tenant-scoped third-party login clients through System's existing controller, `TenantBaseDO`, Vben page, and four granular permissions. |
|
||||
|
||||
V4300 creates no Education page, endpoint, payment account, auth-provider, or credential table. Its unique route names allow the native components to coexist with their original menu locations. System SMS Channel remains a platform-global `@TenantIgnore` object and does not provide legacy tenant-level PNVS equivalence, so V4300 deliberately does not expose it as a migrated tenant auth provider.
|
||||
|
||||
V4330/EDU-021 extends the same native Pay page rather than adding a sixteenth Education page. Operators paste one reviewed manifest containing source IDs/checksum, explicit native channel, new business callbacks, and provider configuration. The modal warns that only `tenant_collect` WeChat/Alipay is supported and that native Pay retains channel credentials using its existing storage. The action is visible only when both App-create and Channel-create permissions are present, matching the backend AND check. Its template is instructional and contains placeholders that must be replaced. The tenant-filtered audit API stores mappings and digests but no second raw configuration or credential copy; import request-body logging is also disabled across access, non-production, and unexpected-error logs. Account-import audit history does not yet have a dedicated table view.
|
||||
|
||||
Education migration V4340 adds three more Education-menu entry points while continuing to reuse native Pay UI and controllers:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `pay/order/index` | Tenant-scoped native Pay order/detail queries and export using `pay:order:query` / `pay:order:export`. |
|
||||
| `pay/refund/index` | Tenant-scoped native Pay refund queries and export using `pay:refund:query` / `pay:refund:export`. |
|
||||
| `pay/notify/index` | Tenant-scoped callback task/detail/log inspection using `pay:notify:query`. |
|
||||
|
||||
V4340/EDU-022 adds no custom Education transaction page. It activates Pay-owned PostgreSQL order, extension, refund, notification-task, and notification-log persistence, makes every corresponding data object tenant-aware, and preserves channel-derived callback context plus the native tenant job. The pages begin with empty ledgers: no legacy order/payment/refund row is imported by inference.
|
||||
|
||||
V4350/EDU-023 extends the native `pay/order/index` page with **迁移旧支付交易**. The modal accepts one reviewed terminal aggregate JSON manifest, warns that live states and inconsistent totals fail closed, locks submission while importing, and switches to a compact recent-audit table after success. Import and audit-query permissions are independent; an audit-only operator can open the history tab without receiving write access. The importer does not call channel SDKs, callbacks, or notification jobs, and the UI never renders raw payloads or error originals. The template remains instructional: source UUID/checksum, optional explicit native Member ID, and event digests must come from a controlled export/reconciliation process.
|
||||
|
||||
Education migration V4360/EDU-024 adds three more Education-menu entry points while continuing to reuse native Pay UI and controllers:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `pay/transfer/index` | Tenant-scoped native transfer query/detail/export using `pay:transfer:query` and `pay:transfer:export`; the existing sync job remains tenant-aware. |
|
||||
| `pay/wallet/balance/index` | Tenant-scoped native member wallet and transaction inspection using `pay:wallet:query`; the existing Member page retains the guarded `pay:wallet:update-balance` action. |
|
||||
| `pay/wallet/rechargePackage/index` | Native recharge-package create/update/delete administration with independent CRUD permissions; recharge refund uses `pay:wallet-recharge:refund`. |
|
||||
|
||||
V4360 creates empty Transfer/Wallet ledgers and never derives balances from legacy payments. Tenant-qualified Redis locks, conditional administrator subtraction, positive-amount validation, composite tenant foreign keys, and non-negative database constraints protect the existing UI operations without adding an Education financial page or API.
|
||||
|
||||
Education migration V4370/EDU-025 adds a nested `商品中心` and five Education-menu entry points while reusing native Mall Product UI and controllers:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `mall/product/spu/index` | Native SPU/SKU create, update, status, delete, query, and export using the original Product services and five granular action permissions. |
|
||||
| `mall/product/category/index` | Tenant-scoped two-level category tree administration with query/create/update/delete permissions. |
|
||||
| `mall/product/brand/index` | Tenant-scoped brand query/create/update/delete administration. |
|
||||
| `mall/product/property/index` | Native property and property-value query/create/update/delete administration. |
|
||||
| `mall/product/comment/index` | Native comment query, visibility changes, and merchant replies using query/update permissions. |
|
||||
|
||||
V4370 activates nine Product-owned PostgreSQL tables and makes all corresponding data objects tenant-aware. It creates an empty catalog: the legacy `products` endpoint exposes display labels, links, and media but no authoritative SKU, integer price, stock, brand, property, or delivery facts, so no automatic product import is performed. The existing SPU form was normalized by oxfmt; no new UI component or runtime dependency was introduced.
|
||||
|
||||
Education migration V4380/EDU-026 adds a nested `优惠券中心` and reuses two native Mall Promotion pages:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `mall/promotion/coupon/template/index` | Native coupon-template query/create/update/status/delete with Product SPU/category scope validation and four granular template permissions. |
|
||||
| `mall/promotion/coupon/index` | Native issued-coupon/member records, administrator send, query, and safe recovery using three granular coupon permissions. |
|
||||
|
||||
V4380 activates tenant-scoped `promotion_coupon_template` and `promotion_coupon`, including composite tenant references, counter/validity/discount/use-state checks, registration issuance and expiry-job compatibility. It starts empty because legacy code campaigns/redemptions are not equivalent to pre-issued native member coupons. No Education coupon API or custom UI page was added.
|
||||
|
||||
Education migration V4390/EDU-027 adds a nested `交易中心` and reuses two native Mall Trade pages:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `mall/trade/order/index` | Tenant-scoped native order page/summary/detail, remark, price/address update, delivery and pick-up verification using `trade:order:query`, `trade:order:update`, and `trade:order:pick-up`. |
|
||||
| `mall/trade/config/index` | One active tenant-owned Trade configuration using `trade:config:query` and `trade:config:save`. |
|
||||
|
||||
V4390 activates tenant-scoped `trade_config`, `trade_cart`, `trade_order`, `trade_order_item`, and `trade_order_log`, replaces Promotion's temporary absent-Trade adapter with the native `TradeOrderApiImpl`, and starts the order ledger empty. Existing legacy payment totals do not prove normalized member/SPU/SKU line items or order lifecycle, so no automatic order import or Education order API/UI was added. Delivery master data is activated by EDU-029; after-sale, brokerage, and special-order tables remain later slices.
|
||||
|
||||
Education migration V4400/EDU-028 adds a nested `营销活动` group and reuses two native Mall Promotion pages:
|
||||
|
||||
| Menu component | Capability |
|
||||
|---|---|
|
||||
| `mall/promotion/discountActivity/index` | Native limited-time SKU discount query/create/update/close/delete with the original five action permissions. |
|
||||
| `mall/promotion/rewardActivity/index` | Native full-reduction/gift rule query/create/update/close/delete with the original five action permissions. |
|
||||
|
||||
V4400 activates the three Promotion-owned tables consulted by normal Trade price calculation, tenantizes their native records, and preserves the existing PostgreSQL-compatible `findInSet` mapper path. No new frontend component or Education promotion API is introduced.
|
||||
|
||||
Education migration V4410/EDU-029 adds `配送管理` below the native Trade group and reuses three native pages:
|
||||
|
||||
| Menu component | Capability |
|
||||
|---|---|
|
||||
| `mall/trade/delivery/express/index` | Tenant-scoped express-company query/create/update/delete/export with the original five permissions. |
|
||||
| `mall/trade/delivery/expressTemplate/index` | Express template and area-based charge/free rule query/create/update/delete with four permissions. |
|
||||
| `mall/trade/delivery/pickUpStore/index` | Pickup-store query/create/update/delete and verifier binding through the existing native controller. |
|
||||
|
||||
V4410 activates all five Trade-owned delivery tables, connects Product SPUs to templates and pickup orders to stores through tenant-qualified references, and drives the native express calculator over real PostgreSQL persistence. The source has no physical-delivery master data, so no companies, stores, rules, or Product assignments are fabricated and no Education delivery API/UI is introduced.
|
||||
|
||||
Education migration V4420/EDU-030 adds `售后退款` below the native Trade group and reuses the native list/detail page:
|
||||
|
||||
| Menu component | Capability |
|
||||
|---|---|
|
||||
| `mall/trade/afterSale/index` | Tenant-scoped after-sale query/detail, agree/disagree, return receipt/refusal, Pay Refund handling, and operation logs using the five exact `trade:after-sale:*` permissions. |
|
||||
|
||||
V4420 activates Trade-owned `trade_after_sale` and `trade_after_sale_log`, connects Order, Order Item, Product, Pay Refund, Delivery, logs, and the order-item back-reference through tenant-qualified constraints, and retains the native app/admin services. The Vben page now sends `auditReason`, collects required `refuseMemo` in a validated locked modal, displays `createTime` as the application time, and applies exact permission guards to all actions. Source aggregate UUID refunds are not imported because they do not prove native Member, line-item, Product/SKU, return-logistics, or Pay Refund identities; no Education refund API/UI is introduced.
|
||||
|
||||
Education migration V4310 adds secure learning activation codes and the fifteenth custom Education admin page:
|
||||
|
||||
| Menu component | Capability and reused RuoYi module |
|
||||
|---|---|
|
||||
| `education/activation-code/index` | Batch filtering/creation/optimistic editing, one-time plaintext generation, masked status queries, and confirmed disable. Mall-owned SPUs are referenced through the existing Education resource-product binding; Member supplies the redeeming principal; the existing Education entitlement event pipeline grants access. |
|
||||
|
||||
The page separates query, management, and generation permissions. A generated plaintext set exists only in the controlled modal state: operators receive a prominent one-time warning, copy/download actions, and a second confirmation before discarding an unsaved set. Closing the modal clears plaintext; later tables return only masks. Batch product, duration, and prefix become immutable after the first code is generated. The app check/redeem endpoints reject administrator principals and use only the authenticated Member ID.
|
||||
|
||||
The operations page also loads `/education/capability` and shows feature flags, capabilities, migration themes, evidence levels, blockers, owning modules, and remaining legacy dependencies.
|
||||
|
||||
Custom Education HTTP contracts are isolated under `apps/web-antd/src/api/education/`; the Pay-owned legacy bridge remains under `apps/web-antd/src/api/pay/legacy-account-import/`. Page actions use the exact System RBAC permissions declared by the corresponding controllers and migration menu rows. Mutations use server-returned content, placement, or authoring versions rather than client-invented values.
|
||||
|
||||
## UI contract
|
||||
|
||||
- Uses the existing Vben, Ant Design Vue, `requestClient`, VXE Grid, and `TableAction` interfaces.
|
||||
- Preserves the existing application typography and theme; no new runtime design dependency or external font was added.
|
||||
- Shows explicit lifecycle labels and confirmations for publish/activate/archive actions.
|
||||
- Locks modal submissions during requests and reports validation or request failures through the existing message layer.
|
||||
- Rejects invalid question-option JSON and option-level correctness flags before submission.
|
||||
- Normalizes optional metadata/access-rule JSON objects and validates ordered membership IDs.
|
||||
- Enforces blueprint target selection and `minimum <= suggested <= maximum` before submission.
|
||||
- Keeps import execution separate from upload and preview, surfaces scan/parser state, and never writes an uploaded file directly into the question catalog.
|
||||
- Uses Member user IDs for classroom and entitlement subjects instead of introducing a second education account table.
|
||||
- Uses server-returned product-binding versions for deactivation and source-system event IDs for entitlement idempotency.
|
||||
- Keeps operational health read-only and displays only the bounded, sanitized detail returned by the backend.
|
||||
- Displays the module's honest migration/capability manifest alongside health instead of hiding deferred dependencies.
|
||||
- Separates `education:content-export` from the stronger `education:content-export:answers` permission and labels artifact generation as not yet implemented.
|
||||
- Keeps member lookup and point enrichment behind `MemberUserApi`/`MemberPointApi`; no Education account, level, balance, or generic point-ledger table was added.
|
||||
- Requires a feedback to be `RESOLVED` before a bounded 1–100 point reward can be scheduled, records retry state in Education, and uses the feedback ID as the stable Member ledger business key.
|
||||
- Uses optimistic feedback versions, independent feedback/reward permissions, and immutable tenant-owned status events for administrator handling.
|
||||
- Applies RuoYi department/self data permission to classes, supervision rules, candidate class scope, and follow-up tasks, while keeping action permissions independent for query, rule authoring, generation, and handling.
|
||||
- Computes supervision evidence from Education's existing learning tables, enriches students through `MemberUserApi`, validates assignees through `AdminUserApi`, and never creates a duplicate student or administrator directory.
|
||||
- Uses optimistic follow-up versions and a tenant/batch/member database key so stale handling and duplicate generation both fail closed.
|
||||
- Separates badge query, definition-write, and manual-grant permissions; definition updates use optimistic versions and disabled badges cannot be granted.
|
||||
- Validates manual recipients through `MemberUserApi`, enriches grant history through Member/System public APIs, and sends badge messages through `NotifyMessageSendApi` without rolling back a durable grant when notification delivery fails.
|
||||
- Keeps System Tenant name and websites authoritative; Education stores only presentation extensions and never adds branding/theme fields to the public locator contract.
|
||||
- Separates appearance query, branding, settings, and theme permissions; every mutation uses a server-returned optimistic version.
|
||||
- Keeps platform templates global while tenant drafts/published state uses RuoYi tenant injection; public projection contains neither admin feature flags nor drafts.
|
||||
- Applies recursive public-secret rejection and a closed renderable-theme policy on the server, with matching JSON-object and obvious-secret preflight checks in Vben.
|
||||
- Uses responsive Ant Design grids, visible labels, loading states, confirmation before publication, and keyboard-operable template choices without adding a new UI dependency or font.
|
||||
- Separates activation-code query, management, and generation permissions; all updates/generation/disable actions submit server-returned optimistic versions.
|
||||
- Never lists activation-code plaintext after generation. The one-time modal offers explicit copy/download, warns before unsaved dismissal, clears plaintext after close, and confirms permanent disable actions.
|
||||
- Uses Mall SPU IDs, Member principals, and the existing Education resource binding/entitlement event pipeline instead of adding shadow product, account, coupon, or access-ledger models.
|
||||
- Reuses native Pay order/refund/notify pages and permissions over composite-tenant PostgreSQL tables; Education does not own a duplicate financial ledger, callback controller, retry worker, or export implementation.
|
||||
- Reuses the native order page for EDU-023 terminal aggregate import and recent redacted audit; Pay owns the importer, permissions, native ledgers, and audit tables.
|
||||
- Reuses native Pay Transfer, Wallet Balance, and Recharge Package pages for EDU-024; V4360 supplies tenant-scoped empty ledgers and granular permissions, while Member administration retains the existing balance-adjustment form.
|
||||
- Reuses native Mall Product SPU/SKU, Category, Brand, Property, and Comment pages for EDU-025; V4370 supplies tenant-scoped catalog persistence, composite graph references, and the original granular Product permissions without adding an Education product API.
|
||||
- Reuses native Mall Promotion Coupon Template and Issued Coupon pages for EDU-026; V4380 supplies tenant-scoped template/instance persistence, Product/Member composition, exact coupon permissions, and fail-closed adoption without adding an Education coupon API.
|
||||
- Reuses native Mall Trade Order and Config pages for EDU-027; V4390 supplies tenant-scoped order/cart/config persistence, Pay/Product/Coupon composition, exact Trade permissions, and fail-closed deferred-table adoption without adding an Education order API.
|
||||
- Reuses native Mall Promotion Discount Activity and Reward Activity pages for EDU-028; V4400 supplies tenant-scoped persistence, Product references, validated rule JSON, exact permissions, and real PostgreSQL API lookup evidence without adding an Education promotion API.
|
||||
- Reuses native Trade Express, Express Template, and Pickup Store pages for EDU-029; V4410 supplies tenant-scoped persistence, Product/Order references, exact permissions, and real PostgreSQL freight-calculation evidence without adding an Education delivery API.
|
||||
- Reuses the native Trade After Sale list/detail page for EDU-030; V4420 supplies tenant-scoped state/log persistence, Order/Product/Pay/Delivery references, exact permissions, and real PostgreSQL service isolation. Required audit/refusal fields, application time, loading locks, responsive forms, and action guards match the backend contract without adding an Education refund API.
|
||||
|
||||
## Backend contract correction
|
||||
|
||||
The question revise endpoint previously delegated to the default `TenantQuestionLifecycleService.reviseDraft` implementation and could throw `UnsupportedOperationException`. It now performs tenant-scoped DRAFT/content-version CAS, increments `content_version`, and appends an immutable `education_question_version` snapshot. V4220 protects the same invariant in PostgreSQL. V4220 also backfills the education root and early question permission rows when a `system_menu` table is introduced after V4080/V4090, while still failing closed on conflicting IDs.
|
||||
|
||||
## Verification
|
||||
|
||||
Successful commands from the Vben submodule root:
|
||||
|
||||
```text
|
||||
node --max-old-space-size=8192 node_modules/vue-tsc/bin/vue-tsc.js --noEmit --skipLibCheck -p apps/web-antd/tsconfig.json
|
||||
./node_modules/.bin/oxfmt --check apps/web-antd/src/api/education apps/web-antd/src/views/education
|
||||
./node_modules/.bin/oxlint apps/web-antd/src/api/education apps/web-antd/src/views/education
|
||||
node --max-old-space-size=8192 ../../node_modules/vite/bin/vite.js build --mode production # from apps/web-antd
|
||||
```
|
||||
|
||||
All four commands passed. Production builds emit independent chunks for all fifteen Education pages, including `learning-operations-*.js`, `supervision-*.js`, `badge-*.js`, `tenant-appearance-*.js`, and `activation-code-*.js`, and only report the existing non-blocking Lightning CSS warnings for unrelated `:deep` selectors.
|
||||
|
||||
Backend evidence:
|
||||
|
||||
```text
|
||||
mvn -pl yudao-server -am -DskipTests compile
|
||||
mvn -pl yudao-module-education -am -DskipTests test-compile
|
||||
mvn -pl yudao-module-education -am -Dtest=EducationFlywayMigrationIntegrationTest -Dsurefire.failIfNoSpecifiedTests=false test
|
||||
JAVA_HOME=/Users/tiku1/.sdkman/candidates/java/21.0.12-amzn \
|
||||
mvn -pl yudao-module-education -am \
|
||||
-Dtest=TenantQuestionLifecycleServiceImplTest,InfraFileImportObjectScanGatewayTest,StandardQuestionImportParserTest,QuestionImportJobServiceImplTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
JAVA_HOME=/Users/tiku1/.sdkman/candidates/java/21.0.12-amzn \
|
||||
mvn -pl yudao-module-education -am \
|
||||
-Dtest=MemberPointApiImplTest,LearningOperationsAdminServiceImplTest,LearningOperationsAdminControllerContractTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
JAVA_HOME=/Users/tiku1/.sdkman/candidates/java/21.0.12-amzn \
|
||||
mvn -pl yudao-module-education -am \
|
||||
-Dtest=StudentSupervisionAdminServiceImplTest,StudentSupervisionAdminControllerContractTest,StudentSupervisionPostgreSqlIntegrationTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
JAVA_HOME=/Users/tiku1/.sdkman/candidates/java/21.0.12-amzn \
|
||||
mvn -pl yudao-module-education -am \
|
||||
-Dtest=BadgeAdminControllerContractTest,BadgeAdminServiceImplTest,BadgeGrantServiceImplTest,BadgePostgreSqlIntegrationTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
JAVA_HOME=/Users/tiku1/.sdkman/candidates/java/21.0.12-amzn \
|
||||
mvn -pl yudao-module-education -am \
|
||||
-Dtest=TenantAppearanceAdminControllerContractTest,TenantAppearancePolicyTest,TenantAppearanceServiceImplTest,TenantAppearancePostgreSqlIntegrationTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
mvn -pl yudao-module-education -am \
|
||||
-Dtest=ActivationCodeServiceImplTest,ActivationCodeAdminControllerContractTest,ActivationCodeAppControllerHttpTest,ActivationCodePostgreSqlIntegrationTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
mvn -pl yudao-module-pay -am \
|
||||
-Dtest=PayLegacyAccountImportServiceImplTest,PayLegacyAccountImportControllerContractTest,PayChannelServiceTest,PayAppTenantContractTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
mvn -pl yudao-module-pay -am \
|
||||
-Dtest=PayOrderServiceTest,PayRefundServiceTest,PayNotifyServiceTest,PayTransactionTenantContractTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
mvn -pl yudao-module-pay -am \
|
||||
-Dtest=PayTransferServiceTest,PayTransferWalletTenantContractTest,PayWalletLockRedisDAOTest,PayWalletControllerTest,PayWalletServiceImplTest,PayWalletRechargeServiceImplTest,WalletPayClientTest \
|
||||
-Dsurefire.failIfNoSpecifiedTests=false test
|
||||
```
|
||||
|
||||
Compilation and test compilation passed. All 46 Flyway integration tests, all 35 selected question/import tests, all 13 selected category/export tests, all 8 selected Member point / learning-operations tests, all 8 selected supervision service/controller/PostgreSQL tests, all 7 selected badge controller/service/PostgreSQL tests, all 14 selected appearance controller/policy/service/PostgreSQL tests, and all 11 selected activation-code controller/service/PostgreSQL tests passed. The prior combined regression run executed 101 tests with no failures; V4310 then added the 11 focused activation-code checks. The EDU-021 Pay selection passes 29 tests: 17 Pay channel checks, two tenant/permission contracts, nine V4330 importer checks, and one request-log/dual-permission controller contract. The EDU-022 native transaction selection passes 86 tests: 46 order, 28 refund, 11 notify, and one tenant-inheritance contract. EDU-023 adds nine focused terminal importer/controller checks. EDU-024 adds 12 focused Transfer/Wallet checks. EDU-025 adds the Product tenant contract and the 44th Flyway scenario. EDU-026 adds the Promotion coupon tenant contract and the 45th Flyway scenario. EDU-027 adds the Trade tenant contract and the 46th Flyway scenario. V4390 evidence covers five tenant-aware Trade records, cross-tenant ID reuse and Cart/Order Item reference rejection, order/config state safety, exact order/config permissions/routes, five explicit sequences, and fail-closed global/deferred Trade adoption. V4380 evidence covers tenant-owned coupon templates/instances, cross-tenant identifier reuse and template-reference rejection, issue/use counter and discount/use-state safety, exact coupon permissions/routes, explicit identity sequences, and fail-closed global Coupon adoption. V4370 evidence covers nine tenant-scoped Product tables, cross-tenant identifier reuse and reference rejection, category-parent isolation, non-negative prices/stock/sales/commission/browse counts, rating bounds, active uniqueness, exact Product permissions/routes, and fail-closed global Product adoption. V4360 evidence covers cross-tenant composite references, per-tenant identifier reuse, same-tenant wallet uniqueness, negative-balance rejection, fail-closed global-wallet adoption, exact permission mappings, tenant-qualified Redis locking, safe administrator subtraction, recharge-refund wallet identity, and correct wallet-transfer lookup. V4350 evidence covers cross-tenant references, per-target-tenant source reuse, event count/digest consistency, sensitive-column absence, fail-closed global audit tables, and exact permission mappings. V4340 evidence covers composite tenant references, same merchant identifier across tenants, notification-task uniqueness and soft-delete recreation, fail-closed global transaction tables, and exact native menu/permission mappings. V4330 evidence covers provider/config mapping, safe disable mapping, replay/checksum conflict, mode/provider/channel rejection, unsafe endpoint/key rejection, audit/log redaction, composite tenant targets, and fail-closed global-audit adoption. V4310 evidence covers independent permissions, Member-only app principals, digest/mask-only persistence, tenant isolation, atomic entitlement/event creation, same-member replay, different-member conflict, disabled batch/binding rejection, and a concurrent unique winner. The current JDK emits Mockito's forward-looking dynamic-agent warning but does not fail the tests.
|
||||
|
||||
The normal `pnpm --filter @vben/web-antd run typecheck` entry point completed successfully with the configured workspace toolchain.
|
||||
|
||||
EDU-028 advances the PostgreSQL total to 47 passing Flyway scenarios and adds one real Spring/MyBatis Promotion API lookup test plus the Promotion activity tenant contract. The reused Discount/Reward page set passes Vben typecheck, scoped oxlint, and scoped oxfmt checks; V4400 proves exact routes/permissions, three explicit sequences, tenant-qualified Product references, PostgreSQL scope matching, rule validation, and fail-closed global-table adoption.
|
||||
|
||||
EDU-029 advances the PostgreSQL total to 48 passing Flyway scenarios and adds the five-record delivery tenant contract plus a real Spring/MyBatis template-service and `TradeDeliveryPriceCalculator` test. The reused delivery page set passes Vben typecheck and scoped lint/format checks; V4410 proves exact routes/permissions, five explicit sequences, tenant-qualified Product/Order references, area/location/amount/state constraints, persisted freight calculation, and fail-closed global-table adoption.
|
||||
|
||||
EDU-030 advances the PostgreSQL total to 49 passing Flyway scenarios and adds the two-record after-sale tenant contract plus a real Spring/MyBatis service/log integration test with the production tenant SQL interceptor. The corrected after-sale page passes Vben typecheck, scoped oxlint, and scoped oxfmt checks; V4420 proves exact route/permissions, two explicit sequences, tenant-qualified Order/Order Item/Product/Pay Refund/Delivery/log references, state/JSON/audit/return/refund constraints, isolated create/page/detail/log reads, and fail-closed global-table adoption.
|
||||
|
||||
## Remaining scope
|
||||
|
||||
- Run browser/API integration against a target deployment with V4220 applied and roles explicitly granted.
|
||||
- Add management pages and backend contracts for each later capability selected from the deferred legacy families.
|
||||
- Add real check-in, mock-exam, and activity-reward domains before exposing those legacy badge triggers; V4280 intentionally supports only migrated event sources.
|
||||
- Keep domains in System Tenant websites. V4300–V4330 expose operational Pay configuration and bounded account import; V4340–V4360 activate native Pay transaction/Transfer/Wallet ledgers and pages; V4370 activates Product; V4380 activates coupons; V4390–V4420 activate the normal Trade order, Promotion, delivery, and after-sale dependencies/pages. Explicit legacy Product/code-coupon/order/refund import, Trade brokerage and special-order Promotion families, production export/Member-map/opening-balance/runbook evidence, non-equivalent payment modes/providers, tenant PNVS, generic private secret storage/rotation, automatic Mall/Pay fulfillment, and refund-to-entitlement revocation remain dedicated decisions. V4310 resolves new activation-code ownership but not legacy-code import.
|
||||
- Add the scheduled worker adapter for `DAILY`/`WEEKLY` supervision rules; V4270 persists the schedule and supports safe manual/interactive execution, but does not claim an automatic production worker deployment.
|
||||
- Replace raw relationship IDs with searchable selectors when stable simple-list contracts are exposed by Education.
|
||||
- Commit the UI changes in the UI repository and then advance the parent gitlink as part of the normal integration workflow.
|
||||
@@ -409,15 +409,7 @@ The migration is complete only when:
|
||||
|
||||
Phase 0 inventory and the first safe-question slice have been executed. Continue through the blocker-aware tickets under [`docs/education/migration/issues/`](issues/README.md).
|
||||
|
||||
Current execution order:
|
||||
|
||||
1. `EDU-002` — restore the full Practice regression baseline;
|
||||
2. `EDU-003` — decide tenant resolution and student-principal policy;
|
||||
3. `EDU-004` — enforce the selected tenant/identity policy;
|
||||
4. `EDU-005` — decide PostgreSQL/Flyway takeover;
|
||||
5. `EDU-006` — deliver the approved Practice schema through module-owned Flyway;
|
||||
6. `EDU-007` through `EDU-009` — verify and complete the student core loop;
|
||||
7. later phases proceed only when their ticket blockers are complete.
|
||||
Current execution order is maintained in [`docs/education/migration/issues/README.md`](issues/README.md). Do not duplicate the live order here; completed bounded tickets remain historical dependencies, while current work follows the ticket index and its blockers.
|
||||
|
||||
Before every ticket:
|
||||
|
||||
|
||||
@@ -57,12 +57,12 @@ FavoriteServiceImplTest
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] Every target class starts its Spring/JUnit context.
|
||||
- [ ] No target class fails because `ScoringService` is missing.
|
||||
- [ ] No target class fails from avoidable Mapper bean-name/type injection ambiguity.
|
||||
- [ ] EDU-001 safe-content assertions remain green.
|
||||
- [ ] Any actual behavior failure is documented with reproducible command and assigned a separate ticket.
|
||||
- [ ] No production behavior or database schema is changed unless a failing regression proves it is necessary and the ticket is explicitly amended.
|
||||
- [x] Every target class starts its Spring/JUnit context.
|
||||
- [x] No target class fails because `ScoringService` is missing.
|
||||
- [x] No target class fails from avoidable Mapper bean-name/type injection ambiguity.
|
||||
- [x] EDU-001 safe-content assertions remain green.
|
||||
- [x] Any actual behavior failure is documented with reproducible command and assigned a separate ticket.
|
||||
- [x] No production behavior or database schema is changed unless a failing regression proves it is necessary and the ticket is explicitly amended.
|
||||
|
||||
## Test command
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ Exact objects and versions are determined by EDU-005 and `flyway-postgresql`.
|
||||
- [x] Annotated SQL and Mapper behavior match PostgreSQL constraints.
|
||||
- [x] Focused repository/integration tests cover uniqueness and tenant scope.
|
||||
- [x] Real PostgreSQL Flyway migrate/validate succeeds in an isolated disposable test environment.
|
||||
- [x] Forward migration V4180 validates adopted Practice scalar types, required nullability, and identifier lengths without modifying V4030–V4060.
|
||||
- [x] Operational docs no longer instruct users to apply MySQL or manual Education SQL for these objects.
|
||||
|
||||
## Verification
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# EDU-010 — Tenant content publication and graph integrity
|
||||
|
||||
- **Status:** blocked
|
||||
- **Status:** done — bounded JAVA_READ tenant Question, Placement, Content Node, Manual Collection, Category, and Practice Blueprint authoring/publication lifecycles are delivered; broader excluded workflows remain separately scoped
|
||||
- **Type:** implementation program
|
||||
- **Phase:** 3
|
||||
- **Blockers:** EDU-004, EDU-009, provider-authority decision, PUBLIC graph-semantics decision
|
||||
- **Blockers:** EDU-004 ✓ (done), EDU-009 ✓ (done), provider-authority decision ✓ (resolved 2026-07-30, see decisions.md), PUBLIC graph-semantics decision ✓ (resolved 2026-07-30, see decisions.md)
|
||||
|
||||
## Tenant-admin outcome
|
||||
|
||||
@@ -20,14 +20,150 @@ Authorized tenant administrators can author, classify, publish, archive, and ret
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] Admin permission and data-scope matrix is explicit.
|
||||
- [ ] Cross-tenant graph relationships cannot be persisted.
|
||||
- [ ] PUBLIC and tenant-owned reference rules are enforced and tested.
|
||||
- [ ] Unpublished/archived content is never student-visible.
|
||||
- [ ] Publication is transactional and auditable.
|
||||
- [ ] Database changes use `flyway-postgresql` and forward migrations.
|
||||
- [x] Admin permission and data-scope matrix is explicit.
|
||||
- [x] Cross-tenant graph relationships cannot be persisted in the current V4020 catalog graph.
|
||||
- [x] PUBLIC and tenant-owned reference rules are enforced across the current 19 reference edges, with exact trigger-mapping and focused behavior tests.
|
||||
- [x] V4080 extends the graph guard to the new Question Version → Question edge and makes the version table the twelfth ownership-protected catalog table.
|
||||
- [x] Unpublished/archived content is never student-visible.
|
||||
- [x] Publication is transactional and auditable.
|
||||
- [x] Tenant Question Placement is permission-separated, tenant-safe, optimistic, and frozen after publication.
|
||||
- [x] Database graph-integrity changes use `flyway-postgresql` and forward migrations V4070/V4090.
|
||||
- [x] The next Manual Question Collection bounded contract, exclusions, pre-provisioning constraint, and readiness gates are explicit before implementation.
|
||||
- [x] A current-tenant `TENANT_OWNED` Manual Question Collection can be authored only in `JAVA_READ` on an existing ACTIVE, visible Content Node.
|
||||
- [x] Collection lifecycle is `DRAFT → ACTIVE → ARCHIVED` with one optimistic authoring version; ACTIVE content/membership is immutable and archive is terminal.
|
||||
- [x] DRAFT membership is ordered replace-all, accepts only current-tenant `TENANT_OWNED` PUBLISHED Questions, and rejects duplicates.
|
||||
- [x] Collection archive gates only collection-route discovery while direct Question visibility and historical Practice snapshots remain unchanged.
|
||||
|
||||
## Delivery progress — graph-integrity slice (2026-07-30)
|
||||
|
||||
Delivered:
|
||||
|
||||
- `V4070__enforce_catalog_reference_scope.sql` guards all 19 current foreign-key edges and makes ownership scope immutable on all 11 catalog tables:
|
||||
- PUBLIC children may reference only PUBLIC parents;
|
||||
- tenant-owned children may reference PUBLIC or same-tenant parents;
|
||||
- cross-tenant and PUBLIC-to-tenant references fail closed;
|
||||
- `tenant_id` and `scope` cannot change after insert, so parent mutations and concurrent ownership moves cannot invalidate existing children.
|
||||
- V4070 installs write guards before historical pre-validation, eliminating the migration-time validation/write window. The reference trigger function uses a fixed `search_path`, locks referenced rows during validation, and exposes no PUBLIC execute grant.
|
||||
- Real PostgreSQL/Flyway integration tests cover fresh and 4009-baselined migration histories, allowed and rejected references, parent ownership immutability, exact configuration of all 19 reference guards and 11 scope guards, function ACLs, and historical invalid-data failure.
|
||||
|
||||
No non-Education module changed. Application rollback can disable native authoring when it is introduced; database recovery remains a higher forward migration and must preserve existing content.
|
||||
|
||||
## Publication-slice constraints (resolved)
|
||||
|
||||
Do not add a local-only admin write path while `SCALAR_READ` remains the default authoritative provider: a successful PostgreSQL write would not be visible to students. The implemented bounded slice is a `JAVA_READ`-only tenant question `draft → publish → archive → student read` path that fails closed in unsupported provider modes.
|
||||
|
||||
The slice resolves the prerequisite decisions as follows:
|
||||
|
||||
1. the command surface is `DRAFT → PUBLISHED → ARCHIVED`; `RETIRED` remains undefined, and V4020 `HIDDEN/INACTIVE` rows map to `ARCHIVED`;
|
||||
2. Education owns immutable question versions and transactional lifecycle audit;
|
||||
3. a question's state controls direct visibility while entry/node/collection availability gates only route-specific discovery;
|
||||
4. tenant admin action permissions are separate, tenant-wide, and tenant-bound; platform-curator/PUBLIC writes fail closed in this slice.
|
||||
|
||||
## Delivery progress — JAVA_READ tenant-question lifecycle slice (2026-07-30)
|
||||
|
||||
Delivered:
|
||||
|
||||
- Explicit Admin APIs and independent RBAC permissions for tenant question author, publish, and archive operations. Requests cannot choose tenant, scope, lifecycle, or actor identity:
|
||||
- `POST /admin-api/education/questions/drafts` — `education:question:author`;
|
||||
- `PUT /admin-api/education/questions/{id}/publish` — `education:question:publish`;
|
||||
- `PUT /admin-api/education/questions/{id}/archive` — `education:question:archive`.
|
||||
- Provider-authority guard: authoring is accepted only for `JAVA_READ`; `SCALAR_READ` fails before any Mapper access.
|
||||
- V4080 changes native defaults to `DRAFT/false`, normalizes legacy visibility states, fails closed on unsafe historical published content, constrains the single direction `DRAFT → PUBLISHED → ARCHIVED`, creates immutable Question Content Versions, and creates append-only lifecycle audit facts.
|
||||
- V4080 adds the Question Version → Question reference as the twentieth guarded catalog edge. In addition to the generic scope rule, a version's tenant and scope must exactly equal its question's ownership; the version table is the twelfth catalog table protected against ownership mutation.
|
||||
- When the adopted platform schema contains `system_menu`, V4080 conditionally seeds the Education capability plus author/publish/archive permissions. A fixed ID already occupied by a different permission aborts migration, and no role assignment is seeded.
|
||||
- Publication and archive use tenant/scope/expected-state CAS updates and append audit facts in the same transaction. Audit failure rolls back the state change.
|
||||
- PostgreSQL integration-test coverage exercises the student read-after-write seam: draft is invisible, published content is returned only through the existing Safe Question projection, and archived content is invisible while stored snapshots remain independent.
|
||||
- Direct question visibility is controlled by the question lifecycle. Container availability is a route-level discovery gate; Question Placement is delivered separately below, while Category, Collection, and platform-curator write paths remain outside the lifecycle slice.
|
||||
|
||||
Permission and data-scope matrix is recorded in `07-decisions.md`. The three lifecycle endpoints manage tenant-wide shared catalog assets within the current framework tenant; department/self DataPermission does not grant additional row access, PUBLIC authoring fails closed, and the V4080 seed intentionally grants no role.
|
||||
|
||||
The listed acceptance criteria are satisfied for the native catalog graph, tenant-question lifecycle, and Question Placement slices. EDU-010 remains in progress because its tenant-admin outcome also includes Category, Collection, Blueprint, Retire, and platform-curator workflows that are not part of these bounded slices.
|
||||
|
||||
## Delivery progress — JAVA_READ Question Placement slice (2026-07-30)
|
||||
|
||||
Delivered:
|
||||
|
||||
- `PUT /admin-api/education/questions/{id}/placement` uses the independent `education:question:classify` permission. The request contains only `nodeId` and `expectedPlacementVersion`; tenant, scope, actor, lifecycle, and ownership remain server-controlled.
|
||||
- Only current-tenant `TENANT_OWNED` drafts can be placed. A target must be a visible, active, selectable PUBLIC or same-tenant Content Node. `SCALAR_READ` fails before Mapper access, and tenant endpoints cannot manage PUBLIC questions.
|
||||
- Placement uses a monotonic optimistic version and tenant/scope/status/version CAS. Repeating the current placement is rejected as a conflict; two writers using the same expected version have one winner.
|
||||
- Publication requires a stable available placement and includes the validated placement version in its lifecycle CAS. V4090 prevents direct PUBLIC placement, requires exact placement-version advancement, freezes placement after publication, and rejects publication without an available node.
|
||||
- Student node-route reads join Question and Content Node in one PostgreSQL statement. A hidden, inactive, non-selectable, cross-scope, or deleted node cannot expose questions through that route; direct question visibility still follows the question Publication State.
|
||||
- V4090 conditionally seeds `education:question:classify` at fixed ID 6805, fails closed on conflicting rows, and grants no role.
|
||||
|
||||
Category CRUD, Collection/Blueprint authoring, PUBLIC curator workflows, and a distinct Retire state remain outside the delivered slices. In the target domain, `education_category` is not connected to Question; classification remains Question Placement through `question.node_id`.
|
||||
|
||||
## Delivery progress — JAVA_READ tenant Content Node lifecycle slice (2026-07-30)
|
||||
|
||||
Delivered:
|
||||
|
||||
- Current-tenant `TENANT_OWNED` Content Nodes expose draft create/revise, activate, and archive commands only in `JAVA_READ`. PUBLIC writes and Category CRUD fail closed/outside the surface.
|
||||
- The command surface is strictly `DRAFT → ACTIVE → ARCHIVED`. One `authoring_version` CAS advances on every draft revision and lifecycle transition; ACTIVE content and ARCHIVED rows are immutable.
|
||||
- Entry and parent validation accepts only active, visible PUBLIC or same-tenant graph parents, requires the parent to belong to the same entry, and rejects self-parenting.
|
||||
- `education:content-node:author`, `education:content-node:publish`, and `education:content-node:archive` are independent controller permissions. V4100 deliberately seeds neither permissions nor roles.
|
||||
- Activation/archive append an actor/version/status audit in the same transaction. V4100 makes that audit append-only and uses a deferred constraint trigger to reject lifecycle changes without the matching audit.
|
||||
- Student catalog discovery and Question Placement continue to require `is_active=true`; V4100 constrains that flag to `publication_status='ACTIVE'`, so drafts/archives cannot appear or accept placement.
|
||||
|
||||
## Next slice — Manual Question Collection bounded contract (accepted 2026-07-31)
|
||||
|
||||
This section records domain and readiness decisions only. No production Java, SQL, Flyway migration, permission seed, or runtime behavior is delivered by this documentation step.
|
||||
|
||||
Accepted boundary:
|
||||
|
||||
1. Native authority only: every collection command is available only in `JAVA_READ`; unsupported modes must fail before persistence access.
|
||||
2. Tenant ownership only: tenant APIs manage current-tenant `TENANT_OWNED` collections. PUBLIC Questions, PUBLIC collection curation, and platform-curator workflows are excluded.
|
||||
3. Placement boundary: a collection belongs to one existing ACTIVE, visible Content Node. Content Entry creation is excluded, so that node and its structurally available Content Entry must already be provisioned before collection authoring.
|
||||
4. Manual assembly only: membership is an explicit ordered list, not a dynamic filter, Category result, Question Bank query, node-descendant query, or Practice Blueprint.
|
||||
5. Lifecycle and concurrency: collections move only `DRAFT → ACTIVE → ARCHIVED`. One optimistic authoring version covers accepted draft revisions, ordered membership replacement, activation, and archive. ACTIVE collection fields and membership are immutable; ARCHIVED is terminal.
|
||||
6. Membership replacement: only a DRAFT collection accepts an ordered replace-all membership command. Every member must be a current-tenant `TENANT_OWNED` PUBLISHED Question. Duplicate Question IDs are a request conflict and are not deduplicated or upserted.
|
||||
7. Visibility: an ACTIVE collection may be discovered only through its available Content Node. Archive closes collection listing and collection-question discovery, but does not archive member Questions, change their direct visibility, or invalidate immutable Practice Question Snapshots already captured.
|
||||
8. Access metadata: `access_rules` remains descriptive reserved metadata. This slice does not interpret it as paid, private, member, SVIP, quota, or other entitlement enforcement.
|
||||
9. Explicit exclusions: dynamic filters, paid/private access, Category CRUD, Practice Blueprint authoring, Content Entry creation, PUBLIC content/curation, Retire, and legacy section/score/required membership extensions.
|
||||
|
||||
### Readiness and implementation gates
|
||||
|
||||
- [x] Current target evidence identifies `education_question_collection_question` as the sole collection-membership fact, with tenant-scoped duplicate prevention and deterministic membership order.
|
||||
- [x] Legacy evidence confirms manual collections, transactional replace-all membership, server-derived counts, active-parent route gating, and an independent `DRAFT/ACTIVE/ARCHIVED` lifecycle; richer dynamic/filter and per-member scoring semantics are deliberately excluded.
|
||||
- [x] Provider-neutral option safety is already resolved by EDU-001 and `QuestionContentSafety`; it is not an EDU-010 blocker.
|
||||
- [x] Root Education SQL is already classified as non-operational manual/design history by EDU-005; module-owned PostgreSQL Flyway remains authoritative. Shared-environment adoption inventory remains an operational rollout gate, not an unresolved schema-owner decision.
|
||||
- [x] Before implementation, allocate V4110 through `flyway-postgresql` and deliver forward adoption from the boolean collection availability fields.
|
||||
- [x] Collection listing and collection-question reads validate ACTIVE collection lifecycle and Content Node availability at the route boundary.
|
||||
- [x] Separate collection author/publish/archive permissions, tenant-bound commands, transactional lifecycle audit, CAS conflicts, server-derived `question_count`, and transaction boundaries are implemented.
|
||||
- [x] Focused service, method-security, and real-PostgreSQL tests cover duplicate/ineligible membership, stale versions, ACTIVE immutability, terminal archive, route gating, and direct Question visibility.
|
||||
|
||||
No new ADR is added: this bounded slice consistently applies the existing native-authority and lifecycle decisions and does not introduce a separate hard-to-reverse architectural trade-off.
|
||||
|
||||
## Delivery progress — JAVA_READ Category and Practice Blueprint slice (2026-07-31)
|
||||
|
||||
Delivered:
|
||||
|
||||
- Category draft create/revise, activate, and archive commands manage only current-tenant `TENANT_OWNED` rows. Subject ownership is server-validated against active PUBLIC or same-tenant Subjects; student category discovery requires `publication_status='ACTIVE'` and `is_active=true`.
|
||||
- Practice Blueprint draft create/revise, activate, and archive commands support only bounded `NODE` and `COLLECTION` modes. Exactly one target is selected by the request, while `entry_id`, effective node, tenant/scope, eligible/total counts, and lifecycle are server-controlled.
|
||||
- NODE blueprints require an existing ACTIVE visible current-tenant Content Node and count current-tenant Published Questions on that node. COLLECTION blueprints require an ACTIVE current-tenant Manual Question Collection and derive counts from its maintained membership count.
|
||||
- Both aggregates use `DRAFT → ACTIVE → ARCHIVED`, one monotonic `authoring_version` CAS, immutable ACTIVE content, terminal ARCHIVED state, transactional actor/version/status audit, append-only audit tables, and fail-before-mapper `JAVA_READ` authority checks.
|
||||
- Separate Category and Practice Blueprint author/publish/archive permissions are conditionally seeded by V4120 without assigning any role. PUBLIC/platform-curator writes remain unavailable.
|
||||
- Student blueprint lookup uses one availability query across the blueprint, Content Node, Content Entry, and optional Collection so draft, archived, or route-unavailable blueprints fail closed.
|
||||
- `V4120__add_category_and_practice_blueprint_authoring.sql` is the only new migration version and was executed by focused real-PostgreSQL tests.
|
||||
|
||||
## Remaining exclusions after EDU-010
|
||||
|
||||
EDU-010 intentionally does not deliver PUBLIC/platform-curator authoring, Content Entry authoring, Question Bank authoring, dynamic/filter blueprints, mixed or descendant-node blueprint selection, type/difficulty-specific authoring semantics, paid/private entitlement enforcement, Retire/restore transitions, per-member score/required flags, legacy asset/import workflows, or administrative list/detail/delete endpoints. Category remains a separately discoverable catalog aggregate and is not a Question relationship; Question classification continues through Placement.
|
||||
|
||||
## Verification evidence (2026-07-31)
|
||||
|
||||
- `mvn -pl yudao-module-education test` with `EDU_TEST_POSTGRES_*` pointed at the local disposable PostgreSQL: **554 tests passed**, including 27 Flyway migration tests and the Category/Practice Blueprint PostgreSQL lifecycle tests. V4120 was actually executed in fresh disposable schemas.
|
||||
- Focused Category/Practice Blueprint suite: **20 tests passed**, covering independent RBAC, fail-before-mapper provider guards, tenant ownership, stale CAS, student draft/active/archive visibility, target/count derivation, and append-only audit enforcement.
|
||||
- `mvn -pl yudao-server -am -DskipTests clean compile`: **22 reactor modules passed**.
|
||||
- `git diff --check`: passed.
|
||||
- `target/classes/db/migration/education/V4120__add_category_and_practice_blueprint_authoring.sql`: present after compilation.
|
||||
|
||||
- Earlier lifecycle evidence remains valid: `mvn -pl yudao-module-education clean test` with the five `EDU_TEST_POSTGRES_*` variables pointed at the local Docker PostgreSQL: **502 tests passed**, including 20 Flyway migration tests and nine lifecycle/placement PostgreSQL integration tests. V4090 was actually executed in disposable PostgreSQL schemas.
|
||||
- The lifecycle integration tests prove concurrent double-publish has one success and one lifecycle conflict with exactly one publish audit, cross-tenant and PUBLIC management fail closed, and `draft → publish → archive` matches student visibility.
|
||||
- The real Spring Method Security contract tests prove each of author/classify/publish/archive requires its own permission and rejected calls do not reach the lifecycle service.
|
||||
- `mvn -pl yudao-server -am -DskipTests clean compile`: **22 reactor modules passed**.
|
||||
- `git diff --check`: passed.
|
||||
- `target/classes/db/migration/education/V4080__add_question_publication_lifecycle.sql` and `V4090__add_question_placement.sql`: present after the module build.
|
||||
|
||||
## Risk and rollback
|
||||
|
||||
- **Risk:** High content-integrity and authorization risk.
|
||||
- **Rollback:** Disable authoring/publishing and roll back application; preserve data and correct forward.
|
||||
- **Rollback:** Before rolling the application back behind V4090, disable native authoring by switching away from `JAVA_READ` (or disable Education when no alternate read authority is configured). Preserve V4090 data and schema, then correct forward. A V4080 application left writable in `JAVA_READ` is intentionally rejected when it attempts to publish an unplaced draft.
|
||||
|
||||
@@ -1,32 +1,51 @@
|
||||
# EDU-011 — Content import, export, assets, and scanning
|
||||
# EDU-011 — Bounded content import assets, jobs, and export policy
|
||||
|
||||
- **Status:** blocked
|
||||
- **Status:** bounded capability delivered
|
||||
- **Type:** implementation program
|
||||
- **Phase:** 3 / 6
|
||||
- **Blockers:** EDU-010, Infra File contract, scanner ownership decision, durable job claim decision
|
||||
- **Delivered migration:** V4130 only
|
||||
|
||||
## Tenant-admin outcome
|
||||
## Delivered tenant-admin outcome
|
||||
|
||||
Administrators can import and export education content through durable, duplicate-safe jobs, with secure files, malware scanning, tenant propagation, audit, retries, and partial-failure reporting.
|
||||
Education owns tenant-scoped import asset metadata and durable import jobs while reusing only public Infra APIs for private-file operations and other platform primitives. The delivered job lifecycle has exactly five states: `PREVIEW_PENDING`, `PREVIEW_READY`, `EXECUTE_PENDING`, `COMPLETED`, and `FAILED`.
|
||||
|
||||
## Reuse
|
||||
The bounded capability provides:
|
||||
|
||||
- Education owns import/export business state and content validation.
|
||||
- Infra owns File, Job/MQ, locks, logging, and audit primitives.
|
||||
- Scanner integration sits behind a clear adapter; Education does not implement generic storage or scheduling.
|
||||
- durable atomic claim with lease token, heartbeat, expired-lease recovery, bounded attempts, and terminal failure;
|
||||
- tenant-scoped duplicate safety for preview requests and execution, so at-least-once delivery does not create a second logical job or repeat completed effects;
|
||||
- fail-closed scanning: the default scanner result is `UNAVAILABLE`, and unavailable, infected, or errored scans are never executable;
|
||||
- CSV/XLSX preview metadata when no parser is available; this reports file/type metadata only and does not claim row parsing or content validation;
|
||||
- execution only after the scan is clean and the preview explicitly reports executable parsed content;
|
||||
- an export-request redaction policy that excludes answers and private fields from authorized export requests.
|
||||
|
||||
## Acceptance criteria
|
||||
## Ownership and reuse boundary
|
||||
|
||||
- [ ] Preview and execute are distinct states.
|
||||
- [ ] Jobs use atomic claim/lease/heartbeat/recovery semantics.
|
||||
- [ ] At-least-once retries are duplicate-safe.
|
||||
- [ ] File type, size, object key, access, and retention are enforced.
|
||||
- [ ] Scanning fails closed.
|
||||
- [ ] Tenant context propagates into asynchronous handlers.
|
||||
- [ ] Exports redact answers and private fields according to authorization.
|
||||
- [ ] Partial failures and dead letters are visible and auditable.
|
||||
- Education owns `education_content_import_asset`, `education_content_import_job`, their business state, duplicate keys, lease/recovery semantics, preview policy, and execution orchestration.
|
||||
- Infra continues to own generic file storage and platform facilities. Education integrates through public Infra APIs only; it does not depend on Infra DOs, mappers, `ServiceImpl` classes, or private implementation packages.
|
||||
- V4130 is the only EDU-011 schema migration in this slice. No additional migration, generic scanner platform, generic scheduler, or Infra-internal extension is delivered.
|
||||
|
||||
## Deferred scope
|
||||
|
||||
- Production preview requests reference an admitted tenant asset ID; object keys, filenames, media types, and sizes are derived server-side from `education_content_import_asset` and are never accepted from the request body.
|
||||
- The executable question-import service uses the V4130 `education_content_import_job` aggregate directly; the obsolete parallel `education_question_import_job` path has been removed.
|
||||
- Per-job claims, heartbeat/finish fencing, expired lease recovery, bounded attempts, and terminal exhaustion failure use the production PostgreSQL mapper contract.
|
||||
- No generated export file, downloadable export artifact, export worker, or export-job persistence is delivered. Only the request-time redaction policy is established.
|
||||
- No production malware-scanner integration is delivered; the default remains fail-closed `UNAVAILABLE` until an external scanner adapter is configured.
|
||||
- No full CSV/XLSX parser is promised by the fallback. Without an available parser, preview remains metadata-only and execution is blocked.
|
||||
- File retention/deletion automation, dead-letter tooling, operator UI, partial-row import reporting, and legacy asset migration/re-scan remain deferred.
|
||||
|
||||
## Acceptance record
|
||||
|
||||
- [x] Education-owned import assets and durable jobs are represented by V4130.
|
||||
- [x] Jobs use the five-state lifecycle `PREVIEW_PENDING`, `PREVIEW_READY`, `EXECUTE_PENDING`, `COMPLETED`, `FAILED`.
|
||||
- [x] Claim, lease, heartbeat, expired-lease recovery, retry bounds, and duplicate safety are defined.
|
||||
- [x] Scanning fails closed, with default `UNAVAILABLE`.
|
||||
- [x] CSV/XLSX can return metadata-only preview when the parser is unavailable.
|
||||
- [x] Execute is blocked unless scanning is clean and preview content is executable.
|
||||
- [x] Export requests apply answer/private-field redaction policy.
|
||||
- [x] Generated export files, retention automation, production parser/scanner adapters, operator UI, and legacy re-scan are explicitly outside this bounded capability; their absence is exposed through blockers and fail-closed behavior rather than represented as available.
|
||||
|
||||
## Risk and rollback
|
||||
|
||||
- **Risk:** High operational and file-security risk.
|
||||
- **Rollback:** Disable job handlers and preserve job/business state for forward recovery.
|
||||
- **Risk:** Import processing remains security-sensitive; scanner or parser absence intentionally removes executability rather than degrading silently.
|
||||
- **Rollback:** Disable import handlers while preserving Education asset/job state for inspection and forward recovery. Do not bypass scan or executable-preview gates.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# EDU-012 — Classes and education relationships
|
||||
|
||||
- **Status:** blocked
|
||||
- **Type:** implementation program
|
||||
- **Status:** implemented
|
||||
- **Type:** bounded vertical capability
|
||||
- **Phase:** 4
|
||||
- **Blockers:** EDU-004, education relationship model decision, Member relationship contract, System data-scope policy
|
||||
- **Decision:** Education owns tenant-local classes, student/teacher relationships, learning-risk rules, and follow-up tasks. System RBAC, AdminUser, departments, and data-permission policy remain authoritative; Member owns student accounts. Class roles never become System roles.
|
||||
|
||||
## Tenant-admin outcome
|
||||
|
||||
@@ -18,14 +18,36 @@ Tenant administrators manage classes, student education relationships, invitatio
|
||||
- Supervision relationships and data scopes if retained.
|
||||
- Audit and operation logging.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- V4140 creates `education_class`, `education_class_member`, `education_class_invitation`, and append-only invitation audit.
|
||||
- Both students and teachers are existing tenant-scoped Member users validated through `MemberUserApi`; Education stores only IDs and domain roles.
|
||||
- Management permissions are independent: `education:class:create`, `education:class:query`, `education:class-member:query`, and `education:class-invitation:create`. Permissions are provisioned separately by System RBAC and are not represented in class relationships.
|
||||
- All aggregate tenant IDs come from `TenantContextHolder`; tenant-qualified mapper predicates and PostgreSQL triggers reject cross-tenant relationships.
|
||||
- Invitation creation is idempotent per tenant, actor, and key with request-hash conflict detection. Acceptance locks the invitation, checks invitee and expiry, and writes relationship plus audit in one transaction.
|
||||
- This capability intentionally excludes account creation, password handling, platform tenant-ignore operations, and education profile duplication.
|
||||
- V4270 adds supervision without changing account ownership: risk evidence is aggregated from existing Education practice, wrong-question, session, and vocabulary tables; Member and System data are API projections only.
|
||||
- Classes, rules, and follow-ups carry only `dept_id`/`owner_user_id` authorization projections and are registered with RuoYi `DeptDataPermissionRule` for department/self row scope.
|
||||
- Risk preview, rule authoring, idempotent task generation, and optimistic task handling have independent System permissions. `(tenant_id, batch_key, student_user_id)` is the retry-safe generation key; atomic PostgreSQL conflict-ignore and a subsequent scoped read return the same committed task to concurrent callers without recovering from a failed transaction.
|
||||
|
||||
## Role and permission semantics
|
||||
|
||||
- `STUDENT` and `TEACHER` are Education relationship labels only; they do not grant System RBAC permissions or authorize administrative endpoints.
|
||||
- Tenant administrators act through explicit System permissions (`education:class:*` and `education:class-invitation:*`).
|
||||
- A Member principal may only accept an invitation addressed to their own member user ID; accepting a `STUDENT` or `TEACHER` invitation creates that relationship but no additional API authority in this bounded slice.
|
||||
- Future teacher actions require a separate permission matrix and endpoints; no implicit role-based elevation is implemented.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] Generic account, password, token, tenant, and role tables are not duplicated.
|
||||
- [ ] Student/teacher/class permission matrix is documented and tested.
|
||||
- [ ] Cross-class and cross-tenant access is denied.
|
||||
- [ ] Invitation acceptance is idempotent and auditable.
|
||||
- [ ] Platform-admin tenant-ignore operations are explicit and permission guarded.
|
||||
- [ ] Database changes use `flyway-postgresql`.
|
||||
- [x] Generic account, password, token, tenant, and role tables are not duplicated.
|
||||
- [x] Student/teacher/class permission matrix is documented and tested.
|
||||
- [x] Cross-class and cross-tenant access is denied.
|
||||
- [x] Invitation acceptance is idempotent and auditable.
|
||||
- [x] Platform-admin tenant-ignore operations are explicit and permission guarded (none are exposed by this bounded capability).
|
||||
- [x] Database changes use `flyway-postgresql`.
|
||||
- [x] Risk preview and follow-up reads respect tenant plus System department/self data scope, including an unfiltered-class CTE aggregation path verified against a real `LoginUser`/`DeptDataPermissionRespDTO` PostgreSQL context.
|
||||
- [x] Supervision assignees are validated by `AdminUserApi`, and students are enriched by `MemberUserApi`.
|
||||
- [x] Follow-up generation and handling are duplicate-safe and stale-write-safe.
|
||||
|
||||
## Risk and rollback
|
||||
|
||||
|
||||
@@ -1,9 +1,32 @@
|
||||
# EDU-013 — Education commercialization binding
|
||||
|
||||
- **Status:** blocked
|
||||
- **Type:** decision and implementation program
|
||||
- **Status:** in-progress
|
||||
- **Type:** bounded implementation
|
||||
- **Phase:** 5
|
||||
- **Blockers:** product/entitlement model, Mall/Pay API assessment, Member entitlement decision, EDU-004
|
||||
- **Blockers:** Mall order-item paid/refunded public event, CRM referral/commission public contract
|
||||
|
||||
## Delivered bounded slice
|
||||
|
||||
Education now owns only:
|
||||
|
||||
- `QUESTION_COLLECTION` to Mall SPU bindings;
|
||||
- tenant/member/resource entitlement aggregate;
|
||||
- duplicate-safe grant, revoke, refund, and time-based expiry decisions;
|
||||
- admin fulfillment endpoints and an internal public Java API;
|
||||
- fail-closed collection question and new-practice access checks.
|
||||
|
||||
`education_question_collection.access_mode` is authoritative (`FREE`, `PRIVATE`, `PAID`). Existing `access_rules` remains descriptive metadata and is never evaluated for authorization. Financial orders, payment status, refund status, amounts, and ledgers remain outside Education.
|
||||
|
||||
The Product public API can validate SPUs when a Product adapter is installed, but the current reactor does not enable Mall. Current Trade public DTOs omit order items/SKU data and Pay callbacks cannot fan out, so no adapter pretends to infer fulfillment from insufficient signatures. Mall-owned automatic fulfillment remains blocked on a public paid/refunded order-item event.
|
||||
|
||||
## Public/admin interfaces
|
||||
|
||||
- `EducationEntitlementApi`: idempotent grant/revoke/refund and access check for trusted module adapters.
|
||||
- `POST /admin-api/education/commercialization/bindings`
|
||||
- `PUT /admin-api/education/commercialization/bindings/{resourceType}/{resourceId}/deactivate`
|
||||
- `POST /admin-api/education/commercialization/entitlement-events`
|
||||
|
||||
Permissions: `education:commercialization:binding`, `education:commercialization:entitlement`.
|
||||
|
||||
## Outcome
|
||||
|
||||
@@ -17,15 +40,21 @@ Education may own only domain bindings and fulfillment orchestration, such as:
|
||||
- entitlement scope and education-resource association;
|
||||
- duplicate-safe fulfillment event state where no platform facility exists.
|
||||
|
||||
## Deferred automatic integrations
|
||||
|
||||
Automatic fulfillment from Mall paid/refunded order-item events and CRM referral/commission processing remains blocked because those public events/contracts are not available in the current reactor. The delivered admin endpoint and `EducationEntitlementApi` are trusted ingestion seams; they do not imply that Pay callbacks or Mall orders currently fan out automatically.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] Mall/Pay/Member/CRM public contracts are mapped before implementation.
|
||||
- [ ] Payment callbacks and refunds remain in Pay.
|
||||
- [ ] Generic products/orders remain in Mall where applicable.
|
||||
- [ ] Entitlement issuance, revocation, expiry, and refund effects are explicit and idempotent.
|
||||
- [ ] Paid/private practice remains inaccessible until entitlement checks are complete.
|
||||
- [ ] Reconciliation and commission/referral ownership is explicit.
|
||||
- [ ] Financial and authorization tests cover duplicate callbacks and cross-tenant access.
|
||||
- [x] Mall/Pay/Member/CRM public contracts are mapped before implementation.
|
||||
- [x] Payment callbacks and refunds remain in Pay; no automatic fan-out is claimed.
|
||||
- [x] Generic products/orders remain in Mall where applicable.
|
||||
- [x] Entitlement issuance, revocation, expiry, and refund effects are explicit and idempotent through the trusted ingestion seams.
|
||||
- [x] Paid/private practice remains inaccessible until entitlement checks are complete.
|
||||
- [x] Reconciliation and commission/referral ownership is explicit; automatic CRM integration remains deferred.
|
||||
- [x] Financial and authorization tests cover duplicate trusted events and cross-tenant access.
|
||||
- [x] Automatic Mall paid/refunded order-item fulfillment is explicitly unsupported until a Mall-owned public event exists; paid access remains fail-closed.
|
||||
- [x] Automatic CRM referral/commission processing is explicitly unsupported until a CRM-owned public contract exists; no financial or referral behavior is simulated in Education.
|
||||
|
||||
## Risk and rollback
|
||||
|
||||
|
||||
@@ -1,37 +1,55 @@
|
||||
# EDU-014 — Extended student and secondary learning waves
|
||||
|
||||
- **Status:** blocked
|
||||
- **Type:** decision map followed by implementation tickets
|
||||
- **Status:** partial implementation; bounded representative wave delivered
|
||||
- **Type:** family disposition plus executable vertical slices
|
||||
- **Phase:** 5
|
||||
- **Blockers:** explicit product scope, EDU-004, entitlement model, AI/File/Member/System/Infra contract assessment
|
||||
- **Migration:** `V4160__add_bounded_learning_wave.sql`
|
||||
|
||||
## Outcome
|
||||
## Delivered bounded wave
|
||||
|
||||
Every legacy Auth/Profile/extended Learning, scoreline, vocabulary, video, AI, notification, badge, feedback, and exam-date capability receives a traceable conclusion: replaced, migrated, retired, deferred, or product decision required.
|
||||
| Family | Target owner / reused public capability | Data and API disposition | Priority | Verification disposition |
|
||||
|---|---|---|---|---|
|
||||
| Auth compatibility and phone/OAuth binding | Member + System auth APIs | **Replaced/reused.** Education does not copy credentials, sessions, phone binding, or OAuth state. Existing Member login remains the student entry point. Legacy auth data requires a separate identity migration, outside V4160. | Reuse now | Existing auth tests; no EDU-014 schema |
|
||||
| Profile and education profile extensions | Member owns generic profile; Education owns learning projections | **Partially migrated.** Learning summary is Education-owned and exposes aggregate counts only. New generic profile fields are deferred. | P1 bounded | Summary service/API tests and tenant isolation |
|
||||
| Vocabulary learning/review | Education | **Migrated for new writes.** Tenant/student/key progress and deterministic review scheduling are delivered. Legacy vocabulary history is retained at source pending an explicit import mapping; no silent import. | P1 | State, due-review, validation, tenant isolation |
|
||||
| Scoreline and admissions content | Education catalog, when selected | **Deferred.** No safe authoritative dataset or freshness contract is established. Existing legacy data is retained read-only; no endpoint compatibility is claimed. | P2 | Retirement/defer compatibility contract only |
|
||||
| Video entitlement and progress | Entitlement owner unresolved; media delivery outside Education | **Explicitly retired from this wave.** No video endpoint, token, progress write, or metadata-based access bypass is added. Legacy video/progress data is retained until an entitlement-led child slice defines import and deletion policy. | P3 blocked | Capability manifest must expose no video interface |
|
||||
| Recommendation and AI generation | AI public services plus Education authorization | **Explicitly deferred.** No student profile or learning history is sent to AI, and no AI recommendation endpoint is exposed. Legacy recommendation data remains retained but non-authoritative. | P3 blocked | Capability manifest must expose no AI interface |
|
||||
| Notifications and reminders | Education schedule + System `NotifyMessageSendApi` | **Migrated for exam reminders.** Education owns claim/retry state; System owns message rendering/storage. A stable `education_exam_reminder` template is conditionally seeded. | P1 | Due claim, retry, tenant context, notify-port tests |
|
||||
| Points, badges, check-ins, feedback, exam countdowns | Education orchestration + Member `MemberPointApi`; feedback/reminders/badge rules Education; System Notify | **Partially migrated.** Fixed server-side learning awards, configurable tenant badge definitions, automatic practice/vocabulary/feedback rules, lifetime-once manual grants, tenant-admin handling/audit, bounded resolved-feedback rewards, and exam reminder/countdown data are delivered. Generic check-in/task exchange and badge triggers that depend on not-yet-migrated check-in/mock-exam/activity domains remain deferred. | P1 bounded | Duplicate award/grant, invalid rule, optimistic conflict, notify failure, feedback ownership |
|
||||
| Learning analytics, leaderboard, trends, reports | Education projections over immutable reports/vocabulary/awards | **Partially migrated.** Own summary and bounded tenant leaderboard are delivered. Leaderboard is anonymized and contains no user IDs or report details. Trend/export surfaces are deferred. | P1 bounded | Tenant isolation, deterministic ranking, redaction |
|
||||
|
||||
## Required decomposition
|
||||
## Executable APIs
|
||||
|
||||
Do not implement this as one large ticket. Create one child ticket per selected capability family after ownership is decided. At minimum assess:
|
||||
Student identity and tenant are always derived from the authenticated context; no API accepts `userId` or `tenantId`.
|
||||
|
||||
- Auth compatibility and phone/OAuth binding;
|
||||
- profile and education profile extensions;
|
||||
- vocabulary learning/review;
|
||||
- scoreline and admissions content;
|
||||
- video entitlement and progress;
|
||||
- recommendation and AI generation;
|
||||
- notifications and reminders;
|
||||
- points, badges, check-ins, feedback, exam countdowns;
|
||||
- learning analytics, leaderboard, trends, and reports.
|
||||
- Vocabulary progress/review: `/app-api/education/vocabulary/*`
|
||||
- Exam reminder create/list/cancel: `/app-api/education/exam-reminders`
|
||||
- Student feedback: `/app-api/education/learning/feedback`
|
||||
- Learning award orchestration: `/app-api/education/learning/awards`
|
||||
- Own learning summary: `/app-api/education/learning/summary`
|
||||
- Anonymous tenant leaderboard: `/app-api/education/learning/leaderboard`
|
||||
- Tenant-admin learning operations: `/admin-api/education/learning-operations/*`
|
||||
- Student badge projection: `/app-api/education/engagement/badges`
|
||||
- Tenant-admin badge definitions and grants: `/admin-api/education/badge/*`
|
||||
- Scheduled dispatch bean: `examReminderSendJob` using System Notify public API
|
||||
|
||||
## Acceptance criteria
|
||||
## Security and reversibility
|
||||
|
||||
- [ ] Each family has target owner, reusable public capability, data disposition, API conclusion, priority, and tests.
|
||||
- [ ] Member/System/Infra/AI capabilities are reused rather than copied.
|
||||
- [ ] Sensitive reports and exports are redacted.
|
||||
- [ ] Media and AI access follows entitlement and tenant rules.
|
||||
- [ ] Retired capabilities have compatibility and data-retention conclusions.
|
||||
- All Education state is tenant-owned and uses explicit tenant/user predicates in addition to framework interception.
|
||||
- Client requests cannot choose point values, badge codes, notify templates, delivery users, or leaderboard tenant.
|
||||
- Exam reminder delivery uses a token-fenced, expiring database claim. An interrupted `SENDING` row is reclaimed after lease expiry, attempts are bounded, and exhausted claims become observable `FAILED` rows through V4200.
|
||||
- Award rows and reminder rows are durable retry authorities; cross-module tables are never written directly by Education application code.
|
||||
- Education point calls use stable Member ledger business keys backed by V4250 uniqueness. Feedback rewards require `RESOLVED` state, a separate reward permission, and a bounded server-validated value.
|
||||
- Badge definitions and automatic rules are tenant-owned. Badge grants reuse the Education award ledger, validate manual targets through Member, project administrators through System, and use a partial unique key for lifetime-once delivery. A failed System notification is recorded as `FAILED` without undoing the grant.
|
||||
- Automatic badge rules can subscribe only to implemented Education events (`PRACTICE_SUBMIT`, `VOCABULARY_REVIEW`, `FEEDBACK_RESOLVED`); absent legacy domains are not represented as fake triggers.
|
||||
- Leaderboard output uses deterministic tenant-local aliases and aggregate score only. No phone, profile, member ID, answer, explanation, feedback content, or report detail is exported.
|
||||
- Rollback disables/removes executable application paths while retaining V4160 data. Destructive rollback is not provided; later correction uses a higher forward migration.
|
||||
- Video and AI remain fail-closed: this wave exposes no executable interface and establishes no entitlement through access metadata.
|
||||
|
||||
## Risk and rollback
|
||||
## Acceptance evidence required before production rollout
|
||||
|
||||
- **Risk:** Medium-to-high scope and entitlement risk.
|
||||
- **Rollback:** Per child ticket; this parent is a planning gate.
|
||||
- Focused unit/controller tests for each delivered family.
|
||||
- Real PostgreSQL Flyway migration and tenant-isolation tests.
|
||||
- Compile and migration packaging verification.
|
||||
- Operational creation of the Quartz schedule for `examReminderSendJob`; V4160 provides state/template, not an environment-specific cron row.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# EDU-015 — Operational independence and legacy exit
|
||||
|
||||
- **Status:** blocked
|
||||
- **Status:** implemented-contracts
|
||||
- **Type:** integration and deployment program
|
||||
- **Phase:** 6
|
||||
- **Blockers:** EDU-011, EDU-013, EDU-014 child decisions, all temporary-adapter owners and exit plans
|
||||
- **Blockers:** production deployment evidence and implementation of each future EDU-011 worker/scanner workload
|
||||
|
||||
## Outcome
|
||||
|
||||
@@ -18,15 +18,26 @@ The target backend runs its selected education capabilities without depending on
|
||||
- Reconcile migrated data and operational runbooks.
|
||||
- Prove deployment, startup, Flyway, and core user flows.
|
||||
|
||||
## Delivered contracts
|
||||
|
||||
- `/admin-api/education/operations/health` exposes the runtime dependency registry plus durable Worker/Scanner and open dead-letter summaries.
|
||||
- `JAVA_READ` performs a target-only PostgreSQL schema readiness proof; Scalar is explicitly `NOT_SELECTED` in that mode.
|
||||
- `SCALAR_READ` is marked legacy, required only when selected, uses `FAIL_CLOSED`, and records success/failure telemetry without exposing URL or credentials.
|
||||
- V4170 owns durable `education_operational_component` and tenant-scoped `education_dead_letter` contracts without retaining business payloads.
|
||||
- `EducationTenantContextPropagation` re-establishes and restores tenant context for executor tasks.
|
||||
- `tools/education-target-smoke/java-read-readiness.sh` asserts target-only provider selection against a running target deployment.
|
||||
|
||||
Production migration and deployment evidence remain release activities and are not claimed by this change.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- [ ] Every temporary legacy dependency has an owner, telemetry, failure policy, and exit date.
|
||||
- [ ] At-least-once consumers are duplicate-safe.
|
||||
- [ ] Job retries/dead letters and scanner health are observable.
|
||||
- [ ] PostgreSQL migrations are actually executed and validated in an authorized environment.
|
||||
- [ ] Student and selected admin E2E flows pass against the target only.
|
||||
- [ ] Runbooks contain no active MySQL/manual-SQL or obsolete NestJS startup requirement.
|
||||
- [ ] Rollback and incident procedures are documented.
|
||||
- [x] Every configured temporary legacy dependency exposes owner, telemetry, failure policy, and exit date; invalid selected Scalar configuration reports DOWN.
|
||||
- [x] Implemented at-least-once import and reminder consumers use duplicate-safe keys or token-fenced leases with bounded recovery.
|
||||
- [x] Job retries/dead letters and scanner/component health have durable persistence and an admin health projection; undeployed components are not fabricated as UP.
|
||||
- [x] Module-owned migrations V4010–V4200 execute and validate in isolated disposable PostgreSQL test schemas; shared Pilot/production execution remains a release-evidence activity.
|
||||
- [x] The fixture-based Student harness passes target API contract/browser flows; a real deployed Student Web/H5 application remains outside this repository and is explicitly not claimed.
|
||||
- [x] Runbooks contain no active MySQL/manual-SQL or obsolete NestJS startup requirement.
|
||||
- [x] Rollback and incident procedures are documented in the Pilot acceptance runbook.
|
||||
|
||||
## Verification
|
||||
|
||||
|
||||
38
docs/education/migration/issues/EDU-017-tenant-appearance.md
Normal file
38
docs/education/migration/issues/EDU-017-tenant-appearance.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# EDU-017 — Tenant appearance, public settings, and theme lifecycle
|
||||
|
||||
- **Status:** done — bounded appearance/theme slice implemented and verified
|
||||
- **Type:** tenant administration / public presentation configuration
|
||||
- **Phase:** 4 / tenant operations
|
||||
- **Blockers:** EDU-003, System Tenant authority, Vben admin foundation
|
||||
|
||||
## Decision
|
||||
|
||||
System Tenant remains authoritative for tenant identity, display name, lifecycle, and bound websites. Education owns only presentation-specific configuration: branding extensions, student/admin feature flags, public runtime configuration, and draft/published theme state. The public tenant locator response remains the minimal EDU-003 contract; appearance is exposed separately under the normal request tenant context.
|
||||
|
||||
Platform theme templates are global trusted configuration and are explicitly excluded from MyBatis tenant injection. Tenant appearance rows extend `TenantBaseDO`, retain one live row per tenant, and use optimistic versions for every update. RuoYi System RBAC, tenant validation, admin projection, API access/operation logging, and the normal `tenant-id` security filter remain authoritative.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- Admin read, branding write, settings write, theme preview, and theme publish endpoints with independent permissions.
|
||||
- `GET /education/tenant-appearance/public` is anonymous but not tenant-ignored; it requires the normal validated tenant header/context and returns no admin flags or draft data.
|
||||
- System tenant name is the lazy-row default and fallback; no duplicate Education tenant identity or domain authority is created.
|
||||
- Three legacy-compatible templates are seeded: `classic`, `focus`, and `high-contrast`.
|
||||
- Theme preview is a shallow template/override merge. Publication revalidates the persisted draft and clears it atomically.
|
||||
- Recursively rejects secret/password/token/private-key/API-key-like public keys except `secretRef`; theme tokens, CSS variables, icons, assets, colors, radii, modes, and density are allowlisted and unsafe renderable strings fail closed.
|
||||
- Vben page `education/tenant-appearance/index` manages branding, JSON settings, templates, draft preview, and explicit publication with client-side preflight checks.
|
||||
|
||||
## Verification
|
||||
|
||||
- Policy unit tests cover recursive secret rejection, closed theme/asset key sets, colors/radii/CSS, URLs, and shallow merge.
|
||||
- Service unit tests cover System-name fallback, optimistic conflict, sanitized draft persistence, and public projection.
|
||||
- Method-security contract tests prove query, branding, settings, and theme permissions are independent.
|
||||
- Real PostgreSQL service tests prove lazy defaults, shared templates, settings, draft/publish, public projection, stale-version rejection, and cross-tenant isolation through the production MyBatis interceptor.
|
||||
- Flyway tests prove the V4290 schema, exact template seeds, menu shape, unique tenant row, and draft/publish database state.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Domains stay in System Tenant `websites`; no Education domain CRUD authority is planned.
|
||||
- Payment-account configuration must compose Pay rather than copy the legacy table.
|
||||
- Authentication-provider configuration must reuse System/Member authentication seams.
|
||||
- Tenant secret storage/rotation needs a dedicated encrypted private-storage decision and must never be added to the public appearance table.
|
||||
- Activation codes and coupons need a Mall Promotion/Member entitlement ownership and idempotent redemption decision.
|
||||
@@ -0,0 +1,33 @@
|
||||
# EDU-018 — Reuse native payment and social-provider administration
|
||||
|
||||
- **Status:** done — bounded native-administration reuse implemented and verified
|
||||
- **Type:** tenant administration / module reuse
|
||||
- **Phase:** 4 / tenant operations
|
||||
- **Blockers:** EDU-017, Pay module, System social-client module, Vben admin foundation
|
||||
|
||||
## Decision
|
||||
|
||||
Legacy `tenant_payment_accounts` and supported OAuth-provider administration must not become Education-owned shadow tables. Payment applications/channels remain authoritative in Pay; tenant third-party login clients remain authoritative in System. V4300 places their existing Vben pages under the Education menu and grants only their original granular permissions.
|
||||
|
||||
The duplicated menu locations use unique route names, so roles may receive Education-scoped navigation without changing the original Pay/System routes. All requests still reach the native controllers and services. No credential is copied into Education and no compatibility facade invents a second status model.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- Education menu entry for native `pay/app/index` with Pay App and Pay Channel query/create/update/delete permissions.
|
||||
- Education menu entry for native `system/social/client/index.vue` with Social Client query/create/update/delete permissions.
|
||||
- Fail-closed Flyway menu-shape validation and collision detection.
|
||||
- Existing Pay/System Vben forms, controllers, tenant interception, and validation are reused. EDU-020/V4320 subsequently activates the Pay runtime and supplies the missing tenant-scoped App/Channel PostgreSQL contract.
|
||||
|
||||
## Verification
|
||||
|
||||
- Real PostgreSQL Flyway test verifies both route components, unique route names, all twelve native permissions, and V4300 history.
|
||||
- A conflicting pre-existing menu ID causes V4300 to fail rather than silently binding the wrong permission.
|
||||
- The existing Vben production build already compiles both reused native pages; V4300 adds no frontend source or dependency.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- EDU-021 now maps bounded `tenant_collect` WeChat/Alipay accounts into native Pay with a redacted audit. Platform/service-provider modes, XPay/Xunhu replacement, and production bulk export/runbook work remain open.
|
||||
- `system_sms_channel` is global and `@TenantIgnore`; it is not legacy tenant-level auth-provider equivalence.
|
||||
- Aliyun PNVS has no proven native target provider and remains a separate auth/SMS slice.
|
||||
- Generic tenant secret storage/rotation remains separate. Native Pay/System credentials stay owned by those modules.
|
||||
- Activation codes and coupons remain a Mall Promotion/Member entitlement and idempotent-redemption slice.
|
||||
@@ -0,0 +1,34 @@
|
||||
# EDU-019 — Secure learning activation codes
|
||||
|
||||
## Status
|
||||
|
||||
Done for the bounded V4310 contract. Legacy activation-code import and coupons remain separate.
|
||||
|
||||
## Decision
|
||||
|
||||
Activation codes are Education learning-access credentials, not Mall Promotion coupons. They reference a Mall-owned SPU through the existing tenant-scoped `education_resource_product_binding`, authenticate redemption with the existing Member principal, and grant access through the existing idempotent `EducationEntitlementService` event pipeline. No product, member, coupon, or second entitlement ledger is introduced.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- Tenant-owned activation-code batches and codes with database constraints, tenant-composite foreign keys, optimistic versions, and separate query/manage/generate permissions.
|
||||
- Admin batch page/create/update/generate and masked code page/disable endpoints.
|
||||
- Member-only app check/redeem endpoints; administrator and anonymous principals fail closed.
|
||||
- Cryptographically random codes normalized for redemption. Plaintext is returned only by the successful generation response; persistence stores SHA-256 digest and a mask.
|
||||
- `SELECT ... FOR UPDATE` serializes redemption. A successful grant writes the existing entitlement event/aggregate, marks the code redeemed, and increments the batch count in one transaction.
|
||||
- Same-member retry returns the existing entitlement idempotently; another member receives an already-used conflict.
|
||||
- Batch SPU, duration, and prefix become immutable after generation. Disabled batches, codes, or resource bindings cannot be redeemed. `durationDays=0` intentionally means no expiry.
|
||||
- Vben page `education/activation-code/index` provides batch and masked-code tables, create/edit/generate flows, copy/download, unsaved-plaintext dismissal warning, and disable confirmation. Closing the generation modal clears plaintext.
|
||||
|
||||
## Verification
|
||||
|
||||
- PostgreSQL Flyway verifies both tables, constraints, cross-tenant batch references, four menu rows, and migration history through V4310.
|
||||
- Controller contracts verify independent admin permissions and Member-only app access.
|
||||
- Unit tests verify digest/mask persistence, entitlement composition, replay/conflict, target validation, and generated-batch immutability.
|
||||
- Real PostgreSQL service tests verify digest-only persistence, tenant isolation, entitlement/event creation, same/different-member behavior, disabled dependencies, and one winner under concurrent redemption.
|
||||
- Vben formatting, lint, Vue typecheck, and production build cover the fifteenth custom Education page.
|
||||
|
||||
## Explicit non-goals
|
||||
|
||||
- Importing or preserving plaintext from legacy activation-code rows.
|
||||
- Coupon templates, claims, discounts, stacking, or redemption; those remain Mall Promotion-owned.
|
||||
- Payment/order/refund fulfillment, legacy payment mode/provider mapping, tenant PNVS, or generic encrypted secret rotation.
|
||||
@@ -0,0 +1,36 @@
|
||||
# EDU-020 — Activate tenant-scoped native Pay administration
|
||||
|
||||
- **Status:** done — bounded Pay App/Channel runtime activation implemented and verified
|
||||
- **Type:** platform reuse / tenant security / database takeover
|
||||
- **Phase:** 4 / tenant operations
|
||||
- **Blockers:** EDU-018, native Pay module, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
V4300 deliberately reused the native Pay App/Channel controllers, permissions, and Vben page, but the repository reactor and `yudao-server` still excluded `yudao-module-pay`, and the active PostgreSQL baseline had no `pay_app` or `pay_channel` tables. The menu was therefore only navigational evidence, not an operational payment-configuration backend.
|
||||
|
||||
Stock/global Pay tables are also unsafe to adopt silently in a multi-tenant education deployment. A channel supplied with an arbitrary `appId` must not bind to an application outside the current tenant.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `yudao-module-pay` is included in the reactor and server runtime.
|
||||
- V4320 creates Pay-owned `pay_app` and `pay_channel` tables with tenant columns, logical-delete audit fields, active-row uniqueness, status checks, and tenant-first indexes.
|
||||
- Existing Pay tables without `tenant_id` fail migration with an explicit mapping error; V4320 never assigns legacy credentials to tenant `0` or another guessed tenant.
|
||||
- `PayAppDO` explicitly extends `TenantBaseDO`, so framework MyBatis tenant interception is a declared contract rather than an implicit table convention.
|
||||
- Channel create/update verifies that the referenced application is visible to the current tenant before persisting the channel.
|
||||
- `/pay/app/list` now uses the actual `pay:app:query` permission already granted by V4300 instead of the obsolete `pay:merchant:query` permission.
|
||||
- The existing `pay/app/index` Vben page remains authoritative; no Education payment form or credential table is duplicated.
|
||||
|
||||
## Verification
|
||||
|
||||
- 17 `PayChannelServiceTest` checks pass, including missing/cross-tenant-parent rejection seams.
|
||||
- Two Pay tenant/permission contract checks pass.
|
||||
- All 45 current PostgreSQL Flyway tests pass through V4380, including same `app_key` across tenants, duplicate rejection within a tenant, channel uniqueness, V4320 history, and fail-closed adoption of a global `pay_app` table.
|
||||
- `mvn -pl yudao-server -am -DskipTests compile` includes and compiles the native Pay module.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- EDU-021 now provides an explicit, audited single-account import for `tenant_collect` WeChat/Alipay manifests. Platform/service-provider modes, unsupported providers, and production bulk export/runbook work remain open.
|
||||
- EDU-022 now activates tenant-scoped native Pay order, refund, and notification persistence/UI; EDU-023 adds bounded terminal legacy transaction import; EDU-024 activates native Transfer/Wallet persistence and UI without inventing opening balances.
|
||||
- Payment credentials remain Pay-owned. Generic tenant secret encryption/rotation and PNVS remain separate slices.
|
||||
- EDU-025 delivers native Mall Product activation. Explicit legacy product import, Promotion/Trade, coupon redemption, purchase fulfillment, refund-to-entitlement revocation, and reconciliation remain separate commercialization slices.
|
||||
@@ -0,0 +1,51 @@
|
||||
# EDU-021 — Import legacy tenant payment accounts into native Pay
|
||||
|
||||
- **Status:** done — bounded single-account import, audit, and native Pay UI entry implemented and verified
|
||||
- **Type:** legacy data bridge / payment security / tenant isolation
|
||||
- **Phase:** 4 / tenant operations
|
||||
- **Blockers:** EDU-020, native Pay App/Channel runtime, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
The legacy `tenant_payment_accounts` and `app_private.tenant_secrets` records cannot be copied directly into native Pay. Provider aliases, collection modes, channel variants, callback ownership, credential shapes, and status values are not one-to-one. Guessing any of them can route money or callbacks to the wrong party.
|
||||
|
||||
The migration also needs durable evidence without creating an Education payment shadow model or persisting a second plaintext credential copy.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- The bridge is Pay-owned and creates native `pay_app` and `pay_channel` rows through `PayAppService` and `PayChannelService`; Education owns neither a payment account nor a credential table.
|
||||
- `POST /pay/legacy-account-import/import` imports exactly one explicitly reviewed manifest. It requires both `pay:app:create` and `pay:channel:create`.
|
||||
- `GET /pay/legacy-account-import/page` exposes tenant-filtered audit history and requires both Pay App and Channel query permissions.
|
||||
- The existing `pay/app/index` Vben page adds a **迁移旧支付账号** action and JSON manifest modal. The button uses explicit AND permission visibility, matching the controller.
|
||||
- Import request-body logging is disabled for database access logs, non-production request logs, and unexpected-error logs so the manifest does not become a plaintext logging side channel.
|
||||
- Only `tenant_collect` is accepted. `platform_collect` and `service_provider` fail closed because their settlement and merchant ownership semantics are not equivalent.
|
||||
- Historical WeChat and Alipay aliases normalize to `wechat_pay` or `alipay`. Non-equivalent providers such as XPay/Xunhu fail closed.
|
||||
- Operators must explicitly select a native channel such as `wx_lite`, `wx_pub`, or an Alipay variant. Provider family and channel family must match; the importer never guesses a WeChat client type.
|
||||
- WeChat V3 and Alipay public-key configurations map into native Pay configuration objects. Multiple rotating WeChat platform keys require an explicit choice. Alipay accepts only the native production or sandbox official gateway.
|
||||
- Old provider callbacks are not reused. The manifest must provide new business order/refund callbacks and may provide a transfer callback.
|
||||
- `active` maps to enabled. `disabled` and `pending` map to disabled with an audit note.
|
||||
- Within the current target tenant, `sourceAccountId` is the idempotency key. A replay with the same source SHA-256 returns the existing mapping; a different checksum is rejected rather than overwriting it.
|
||||
|
||||
## Audit and database contract
|
||||
|
||||
V4330 creates tenant-scoped `pay_legacy_account_import` with source identifiers/checksum, normalized provider/config digest, target App/Channel IDs, mapping notes, operator, and timestamp. It deliberately has no `config_public`, `secret_json`, raw config, or secret-value column.
|
||||
|
||||
Composite foreign keys `(tenant_id,target_app_id)` and `(tenant_id,target_channel_id)` prevent an audit row from pointing across tenants. A target tenant may import the same legacy UUID independently, while duplicate active source IDs inside one tenant are rejected. An existing global audit table without `tenant_id` causes migration failure and requires explicit disposition.
|
||||
|
||||
Credentials still enter native `pay_channel.config` using Pay's existing configuration storage. EDU-021 prevents an extra audit copy; it does not introduce generic encryption or key rotation for native Pay credentials.
|
||||
|
||||
## Verification
|
||||
|
||||
- Nine focused importer tests pass for WeChat/Alipay mapping, aliases, disabled-state mapping, replay, checksum conflict, unsupported modes/providers, channel mismatch, unsafe endpoints/rotating keys, and audit redaction. A controller contract verifies dual write permission and request-body logging suppression.
|
||||
- The combined Pay selection passes 29 tests, including the prior tenant App/Channel contracts.
|
||||
- All 45 PostgreSQL Flyway integration tests pass through V4380. V4330 coverage verifies tenant-independent legacy UUID reuse, no raw credential columns, cross-tenant composite-FK rejection, mode constraints, migration history, and fail-closed global-table adoption.
|
||||
- The Vben `@vben/web-antd` typecheck passes with the import API, modal, and explicit dual-permission button.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Audit history currently has a backend/Vben API contract but no dedicated history table in the account-import modal. EDU-023 provides its own recent transaction-import history table on the native order page.
|
||||
- A controlled export job from the legacy database and operator runbook are still required before production bulk migration. The UI template contains placeholders and must never be submitted unchanged.
|
||||
- Concurrent first imports of the same source account rely on the database unique constraint and transaction rollback; a friendly concurrent-replay response is not claimed.
|
||||
- Platform/service-provider settlement, XPay/Xunhu replacement, generic credential encryption/rotation, and tenant PNVS require separate decisions.
|
||||
- EDU-022 activates tenant-scoped native Pay order, refund, and notification ledgers; EDU-023 adds bounded terminal legacy transaction import; EDU-024 activates empty native Transfer/Wallet ledgers. Production bulk tooling and reviewed opening-balance migration remain open.
|
||||
- EDU-025 delivers native Mall Product activation. Explicit legacy product import, Promotion/Trade, coupon import/redemption, purchase fulfillment, refunds-to-entitlement revocation, and reconciliation remain separate commercialization work.
|
||||
@@ -0,0 +1,45 @@
|
||||
# EDU-022 — Activate tenant-scoped native Pay transactions
|
||||
|
||||
- **Status:** done — bounded order/refund/notification takeover and native administration UI verified
|
||||
- **Type:** platform reuse / financial isolation / database takeover
|
||||
- **Phase:** 4 / commercialization foundation
|
||||
- **Blockers:** EDU-020, EDU-021, native Pay runtime, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
EDU-020 made native Pay application/channel configuration operational, but the active PostgreSQL baseline still had no order, order-extension, refund, notification-task, or notification-log tables. The existing Pay controllers and Vben pages therefore could not administer real transaction state.
|
||||
|
||||
The stock transaction data objects were also inconsistent: notification tasks were tenant-aware, while orders, order extensions, refunds, and notification logs inherited only `BaseDO`. Silently creating global financial tables or assigning existing rows to a guessed tenant would make callbacks, exports, and background retries cross tenant boundaries.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- V4340 creates Pay-owned `pay_order`, `pay_order_extension`, `pay_refund`, `pay_notify_task`, and `pay_notify_log` tables for PostgreSQL. Education does not create a parallel order, refund, or webhook ledger.
|
||||
- `PayOrderDO`, `PayOrderExtensionDO`, `PayRefundDO`, `PayNotifyTaskDO`, and `PayNotifyLogDO` all inherit `TenantBaseDO`, so normal MyBatis tenant interception scopes native admin queries and mutations.
|
||||
- Composite tenant foreign keys bind orders to Pay applications/channels, extensions to orders/channels, refunds to their application/channel/order, and logs to their notification task. Cross-tenant references fail in PostgreSQL even if application code is bypassed.
|
||||
- Active merchant order/refund identifiers are unique inside a tenant application but may be reused by another tenant. Native Pay numbers and extension numbers are tenant-scoped.
|
||||
- One active notification task is allowed for each `(tenant_id,type,data_id)`. This closes duplicate terminal-callback races; a deliberately soft-deleted task may be recreated.
|
||||
- Existing transaction tables without `tenant_id` fail V4340. No global financial row is assigned to tenant `0` or inferred from an application ID.
|
||||
- The native order/refund callback entry points continue to resolve the channel first and execute the business update inside `TenantUtils.execute(channel.tenantId, ...)`. The existing notification retry job continues to use `@TenantJob`.
|
||||
- Existing Pay controllers remain authoritative: `/pay/order` and `/pay/refund` provide tenant-filtered query/export contracts, while `/pay/notify` provides tenant-filtered task/detail reads and the provider callback entry points.
|
||||
- V4340 exposes the existing `pay/order/index`, `pay/refund/index`, and `pay/notify/index` Vben pages below Education with the original `pay:order:*`, `pay:refund:*`, and `pay:notify:query` permissions. No custom Education transaction page was added.
|
||||
|
||||
## Database safety
|
||||
|
||||
The circular order/extension relationship is created in two steps. The final `fk_pay_order_extension` installation is guarded through `pg_constraint`: an equivalent named composite tenant foreign key is accepted, a conflicting named constraint fails closed, and a missing constraint is installed. V4340 also verifies the complete required column shape after table creation.
|
||||
|
||||
The migration intentionally creates empty native transaction ledgers. It does **not** import legacy `orders`, `payments`, `payment_events`, or `commerce_refund_requests`; importing those records requires an explicit, reconciled mapping with amount/status/identifier/callback ownership rules.
|
||||
|
||||
## Verification
|
||||
|
||||
- All 45 PostgreSQL Flyway integration tests pass through V4380. V4340 coverage proves same merchant order ID across tenants, composite-FK cross-tenant rejection, active notification-task uniqueness and soft-delete recreation, native menu/permission shape, successful migration history, and fail-closed adoption of a global `pay_order` table.
|
||||
- The combined native Pay transaction regression passes 86 tests: 46 order, 28 refund, 11 notification, and one tenant-inheritance contract.
|
||||
- The previously disabled `PayNotifyServiceTest` is active; its asynchronous scheduling assertions and retry-count fixtures now match the production contract.
|
||||
- `mvn -pl yudao-server -am -DskipTests compile` and the Vben `@vben/web-antd` typecheck are the closing reactor/UI gates for this slice.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- EDU-023 now supplies a bounded, terminal-only reconciled import. Production export tooling, reviewed Member-ID mapping, dry-run/runbook evidence, and operator sign-off remain required; direct table copying is still forbidden.
|
||||
- EDU-024 now activates tenant-aware native Pay Transfer and Wallet persistence plus the existing administration pages. Historical opening balances remain deliberately unpopulated pending a reviewed source artifact.
|
||||
- EDU-025 delivers native Mall Product activation and EDU-026 delivers native Promotion Coupon activation. Explicit legacy product/code-coupon import, Trade/other Promotion activation, and automatic purchase-to-entitlement fulfillment are not delivered.
|
||||
- Refund completion does not yet revoke or shorten Education entitlements; commerce reconciliation must define partial-refund and replay semantics first.
|
||||
- Coupons, commissions, referrals, dunning, settlement/reconciliation, generic Pay credential encryption/rotation, tenant PNVS, production deployment, and browser/API integration evidence remain separate work.
|
||||
@@ -0,0 +1,41 @@
|
||||
# EDU-023 — Import reconciled terminal legacy Pay transactions
|
||||
|
||||
- **Status:** done — bounded terminal aggregate import, redacted audit, and native Pay order-page UI verified
|
||||
- **Type:** legacy data bridge / financial reconciliation / privacy
|
||||
- **Phase:** 4 / commercialization foundation
|
||||
- **Blockers:** EDU-021, EDU-022, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
The legacy `orders`, `payments`, `payment_events`, and `commerce_refund_requests` rows cannot be copied into native Pay independently. Their statuses, identifiers, and totals form one aggregate; importing a live or inconsistent aggregate could make native jobs, callbacks, or operators charge or refund it again. Raw provider payloads and error bodies also contain data that does not belong in a second audit store.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `POST /pay/legacy-transaction-import/import` imports one explicitly reviewed aggregate and requires `pay:legacy-transaction:import`. `GET /pay/legacy-transaction-import/page` exposes tenant-filtered audit history under `pay:legacy-transaction:query`.
|
||||
- Only terminal order, payment, and refund states are accepted. Amounts are already denominated in cents and must reconcile exactly: one verifiable successful payment at most, payment amount equals order price, successful refund sum equals `refundedPrice`, and order/refund status agrees with that sum.
|
||||
- Every aggregate must reference an EDU-021 `pay_legacy_account_import` from the same source tenant. All payment and refund provider families must match that reviewed mapping.
|
||||
- Imported data is written into Pay-owned `pay_order`, `pay_order_extension`, and `pay_refund`; Education does not gain a financial shadow ledger.
|
||||
- Import does not call a provider SDK, enqueue notification tasks, invoke business callbacks, or copy provider credentials. `raw_payload`, event payloads, channel notification bodies, and error originals are excluded. Payment-event evidence is reduced to a count and SHA-256 digest.
|
||||
- A target tenant uses source order UUID as its idempotency key. The same checksum replays the audit result without rewriting native ledgers; a different checksum is rejected. Native merchant order, payment extension, and refund-number collisions fail with a reconciliation error before writes.
|
||||
- The legacy model has no reliable client IP or channel fee. Native rows therefore use `0.0.0.0` and zero fee, and the audit records that limitation.
|
||||
- `targetUserId` is an explicit optional native Member ID. The importer does not infer a UUID-to-Member mapping and Pay does not depend directly on Member, avoiding a module cycle. Export tooling or the operator owns that reviewed mapping.
|
||||
- Request-body access logging is disabled. The existing native `pay/order/index` page exposes a permission-aware JSON manifest modal and the most recent 50 audit rows; no raw provider payload is rendered.
|
||||
|
||||
## Database contract
|
||||
|
||||
V4350 adds tenant-scoped `pay_legacy_transaction_import`, `pay_legacy_transaction_payment_import`, and `pay_legacy_transaction_refund_import`. Composite tenant foreign keys bind audit rows to the reviewed account mapping and native App, Channel, Order, Extension, and Refund targets. Existing global tables fail closed. The same legacy source UUID may be imported independently by distinct target tenants.
|
||||
|
||||
The schema enforces terminal status sets, non-negative counts/totals, event-count/digest consistency, lowercase SHA-256 shapes, tenant-scoped source uniqueness, and exact expected table shape. None of the three tables contains a raw payload, credential, notification body, or error-original column.
|
||||
|
||||
## Verification
|
||||
|
||||
- Nine focused service/controller tests pass, covering reconciled full-refund import, redaction, replay, checksum conflict, provider mismatch, refund/status mismatch, event digest mismatch, refund-without-payment rejection, native-number collision, permission, and request-log suppression.
|
||||
- All 45 PostgreSQL Flyway integration tests pass through V4380. V4350 coverage proves composite cross-tenant rejection, per-target-tenant source reuse, event digest consistency, sensitive-column absence, exact menu/permission shape, migration history, and fail-closed global-table adoption.
|
||||
- Vben lint, formatting, and `@vben/web-antd` typecheck pass for the API, import/history modal, and native order-page integration.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- A controlled legacy export tool, Member-ID mapping artifact, operator runbook, dry-run report, backup, and production reconciliation sign-off are required before bulk import. The UI template contains placeholders and is not an unattended bulk migrator.
|
||||
- Concurrent first imports and native-number races still rely on database uniqueness and transaction rollback; a friendlier conflict replay is not claimed.
|
||||
- Failed/cancelled historical attempts are preserved as closed native extensions/refunds only inside a reconciled terminal aggregate. No live state is resumed.
|
||||
- EDU-024 activates native Pay Transfer/Wallet with empty tenant-owned ledgers, and EDU-025 activates an empty native Product catalog. Reviewed opening balances, explicit legacy product import, Promotion/Trade, automatic purchase fulfillment, refund-to-entitlement revocation, settlement reconciliation, coupons, commissions, referrals, dunning, generic credential encryption/rotation, tenant PNVS, and production browser/API evidence remain separate slices.
|
||||
@@ -0,0 +1,41 @@
|
||||
# EDU-024 — Activate native Pay Transfer and Wallet
|
||||
|
||||
- **Status:** done — tenant-owned native ledgers, security hardening, existing Pay APIs/UI, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / financial ledger / tenant isolation
|
||||
- **Phase:** 4 / commercialization foundation
|
||||
- **Blockers:** EDU-020, EDU-022, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
RuoYi already provides Transfer and Wallet services, callbacks, jobs, permissions, and Vben pages, but their persistence was not activated by the Education PostgreSQL migration line and the corresponding data objects were not tenant-aware. Reimplementing those capabilities inside Education would create a second financial ledger. Inferring a wallet balance from the legacy backend would be unsafe because the legacy schema has no equivalent authoritative balance aggregate.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- Existing native Pay contracts remain authoritative: `/pay/transfer`, `/pay/wallet`, `/pay/wallet-transaction`, `/pay/wallet-recharge`, and `/pay/wallet-recharge-package`. No Education transfer, balance, recharge, or transaction controller was added.
|
||||
- `PayTransferDO`, `PayWalletDO`, `PayWalletTransactionDO`, `PayWalletRechargeDO`, and `PayWalletRechargePackageDO` now extend `TenantBaseDO`. Transfer synchronization keeps `@TenantJob`, and framework tenant injection scopes all normal mapper access.
|
||||
- Wallet locks now use `pay_wallet:lock:{tenantId}:{walletOrUserId}` so the same native identifier in two tenants cannot serialize against or interfere with the other tenant's operation.
|
||||
- Amount-changing service methods reject null, zero, and negative amounts. Administrator balance reductions use the conditional subtract path and cannot create a negative balance or incorrectly increase the member's lifetime expense total. `Integer.MIN_VALUE` cannot be negated through the admin request contract.
|
||||
- Wallet recharge refund completion uses the persisted recharge `walletId`; it does not dereference a separately loaded wallet. The refund action has its own `pay:wallet-recharge:refund` permission.
|
||||
- Wallet-provider transfer status lookup uses the native transfer number, matching the business key used when the wallet transaction was created.
|
||||
- Request DTOs validate positive user/package IDs, valid wallet business types, positive add amounts, non-zero admin adjustments, package name/amount/status shape, and non-negative bonus amounts.
|
||||
- The existing Vben `pay/transfer/index`, `pay/wallet/balance/index`, and `pay/wallet/rechargePackage/index` pages and APIs are reused. Member administration continues to provide the permission-aware balance-adjustment action.
|
||||
|
||||
## Database contract
|
||||
|
||||
V4360 creates empty tenant-scoped `pay_transfer`, `pay_wallet`, `pay_wallet_transaction`, `pay_wallet_recharge`, and `pay_wallet_recharge_package` ledgers. It never imports or invents a historical wallet balance.
|
||||
|
||||
Composite tenant foreign keys bind transfers to native Pay App/Channel and wallet rows to their Wallet, Package, Order, and Refund owners. Balances, frozen amounts, and cumulative totals cannot be negative. A tenant can have only one active wallet per `(userId,userType)`, while the same identifiers remain valid in another tenant. Non-administrator transaction business keys are tenant-idempotent. Existing global tables fail closed instead of being silently adopted.
|
||||
|
||||
V4360 also seeds the existing Vben routes and granular Transfer query/export, Wallet query/update, Recharge Package CRUD, and Recharge refund permissions.
|
||||
|
||||
## Verification
|
||||
|
||||
- Twelve focused Pay tests pass across transfer service behavior, tenant-aware DO/job/permission contracts, tenant-qualified Redis locking, safe positive/negative admin adjustments, non-positive amount rejection, recharge-refund wallet identity, and wallet-provider transfer lookup.
|
||||
- All 45 PostgreSQL Flyway integration tests pass through V4380. V4360 coverage proves same identifiers across tenants, same-tenant wallet uniqueness, cross-tenant Wallet Transaction and Transfer foreign-key rejection, database rejection of negative balances, exact menu/permission shape, migration history, and fail-closed global-wallet adoption.
|
||||
- The existing Vben Transfer/Wallet/Recharge Package APIs and pages pass formatting, lint, and `@vben/web-antd` typecheck as part of the combined UI verification.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Production opening balances require a separately reviewed, reconciled source artifact and operator runbook. This slice deliberately creates empty wallet ledgers because the legacy system has no equivalent balance authority.
|
||||
- Transfer initiation, wallet recharge, channel callbacks, and refunds still require target-environment credentials, App/Channel setup, explicit role grants, and browser/API integration evidence.
|
||||
- EDU-025 now activates native Mall Product persistence and existing administration without importing legacy display rows. Promotion/Trade, explicit legacy product import, automatic purchase fulfillment, refund-driven entitlement revocation, settlement reconciliation, commissions, referrals, dunning, generic credential encryption/rotation, tenant PNVS, legacy activation-code import, coupons, and production bulk financial migration remain separate slices.
|
||||
@@ -0,0 +1,58 @@
|
||||
# EDU-025 — Activate native Mall Product
|
||||
|
||||
- **Status:** done — tenant-owned native Product persistence, existing Product APIs/UI, RBAC, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / product catalog / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-013, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
RuoYi Vue Pro already provides Product controllers, services, mappers, permissions, and Vben pages for brands, categories, properties, SPUs, SKUs, comments, favorites, and browse history. The Mall reactor and Product server dependency were disabled, however, and the Product data objects were not tenant-aware. Rebuilding those capabilities inside Education would create a second product catalog.
|
||||
|
||||
The legacy `public.products` object is only a tenant/region presentation projection with `title`, a display `price_label`, links, tags, cover/iframe/detail images, ordering, and lifecycle status. It has no authoritative SKU, integer price, stock, brand, property, delivery, commission, or sales model. An automatic conversion would invent commercial facts.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- The root build now includes `yudao-module-mall`, while `yudao-server` activates only `yudao-module-product`. Promotion, Trade, and Statistics runtime dependencies remain off until their own tenant-ledger slices are verified.
|
||||
- Existing native `/product/brand`, `/product/category`, `/product/property`, `/product/property/value`, `/product/spu`, `/product/comment`, `/product/favorite`, and `/product/browse-history` controllers remain authoritative. No Education product controller or duplicate catalog service was added.
|
||||
- `ProductBrandDO`, `ProductCategoryDO`, `ProductPropertyDO`, `ProductPropertyValueDO`, `ProductSpuDO`, `ProductSkuDO`, `ProductCommentDO`, `ProductFavoriteDO`, and `ProductBrowseHistoryDO` now extend `TenantBaseDO`, so normal MyBatis access participates in framework tenant injection.
|
||||
- Existing Vben pages are reused for SPU/SKU authoring, category trees, brands, property/value management, and comment moderation. V4370 seeds their original permissions below an Education `商品中心` route with unique component names.
|
||||
- The Product Vben scope passes typecheck, oxlint, and oxfmt. The formatter normalized one pre-existing multiline expression in the SPU form without changing behavior.
|
||||
|
||||
## Database contract
|
||||
|
||||
V4370 creates tenant-scoped PostgreSQL tables:
|
||||
|
||||
- `product_brand`
|
||||
- `product_category`
|
||||
- `product_property`
|
||||
- `product_property_value`
|
||||
- `product_spu`
|
||||
- `product_sku`
|
||||
- `product_comment`
|
||||
- `product_favorite`
|
||||
- `product_browse_history`
|
||||
|
||||
Every table uses `(tenant_id,id)` as its primary ownership key, allowing an explicit native identifier to be reused in another tenant while keeping every reference tenant-qualified. Composite foreign keys enforce Property Value → Property, SPU → Category/Brand, SKU → SPU, Comment → SPU/SKU, and Favorite/Browse History → SPU. Category root `parent_id=0` remains a sentinel; a trigger requires non-root parents to exist in the same tenant and limits the native category model to two levels.
|
||||
|
||||
Database checks reject negative prices, stock, sales, integral, commission, weight, volume, and browse counts, and restrict comment scores to 1–5. Partial unique indexes protect active brand/property/value names, one active favorite per member/SPU, one active browse-history row per member/SPU, and one active comment per member/order item. Existing global Product tables fail closed instead of being silently assigned to a tenant.
|
||||
|
||||
V4370 seeds menu IDs 6920–6944 for the Product root, five native pages, and the exact SPU, Category, Brand, Property, and Comment controller permissions.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4370 creates an empty native catalog and does not read or transform legacy `public.products`. A later import, if required, must provide an explicit reviewed mapping for tenant UUIDs, region semantics, integer prices, SPU/SKU structure, stock authority, brand/category/property ownership, delivery mode, media admission, and Education resource bindings. A display price label or URL is not sufficient evidence for any of those fields.
|
||||
|
||||
## Verification
|
||||
|
||||
- The focused Product tenant contract passes and proves all nine native Product records inherit `TenantBaseDO`.
|
||||
- The Product reactor test run succeeds; the repository's 33 pre-existing Product service tests remain disabled by their existing test configuration, while the new tenant contract executes successfully.
|
||||
- All 45 PostgreSQL Flyway integration tests pass through V4380. V4370 coverage proves cross-tenant ID reuse, same-tenant uniqueness, composite foreign-key rejection, category parent isolation/two-level enforcement, amount/stock and score checks, exact menu shape, migration history, and fail-closed global-table adoption.
|
||||
- `mvn -pl yudao-server -am -DskipTests compile` succeeds with Product enabled.
|
||||
- `@vben/web-antd` typecheck and scoped Product oxlint/oxfmt checks pass.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Native Product pages require target-environment role grants, browser/API smoke evidence, media/file configuration, and deliberate catalog population.
|
||||
- Promotion coupons are delivered by EDU-026; Promotion discounts and other activity families, Trade cart/order/after-sale/delivery, Statistics, automatic purchase fulfillment, refund-driven entitlement revocation, and Education product-binding workflows remain separate slices.
|
||||
- Legacy `products` import remains blocked on an explicit semantic mapping and reconciled source artifact; no SKU, stock, price, or category is inferred.
|
||||
@@ -0,0 +1,51 @@
|
||||
# EDU-026 — Activate native Mall Promotion coupons
|
||||
|
||||
- **Status:** done — tenant-owned native coupon templates/instances, existing APIs/UI, RBAC, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / coupon lifecycle / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-025, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
RuoYi Vue Pro already provides coupon-template and issued-coupon controllers, services, Product-scope validation, Member lookup, registration issuance, expiry processing, permissions, and Vben pages. The Promotion server dependency was disabled and its two coupon records inherited only `BaseDO`, so reimplementing coupons inside Education would create a second marketing ledger without fixing tenant ownership.
|
||||
|
||||
Legacy `public.coupons` are code-based campaign rules with plan/region restrictions, first-order rules, usage counters, and `coupon_redemptions`. Native Promotion coupons are templates that issue member-owned coupon instances before order use. They are not losslessly interchangeable.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `yudao-server` now activates `yudao-module-promotion` in addition to Product; Trade and Statistics remain disabled until their own ledger slices are verified.
|
||||
- Existing native `/promotion/coupon-template`, `/promotion/coupon`, `/app-api/promotion/coupon-template`, and `/app-api/promotion/coupon` contracts remain authoritative. Education adds no coupon controller or duplicate service.
|
||||
- `CouponTemplateDO` and `CouponDO` extend `TenantBaseDO`, so native mapper/service access participates in the framework tenant interceptor.
|
||||
- Native template creation reuses Product SPU/category validation. Native coupon administration reuses Member lookup, direct/admin/registration issuance, expiry processing, use/return, and soft-delete recovery rules.
|
||||
- Promotion's unrelated bargain/combination beans require `TradeOrderApi`. EDU-027 now activates the native Trade implementation and removes the temporary fail-closed adapter that was used while Trade was absent.
|
||||
- V4380 mounts the existing Vben template and issued-coupon pages below an Education `优惠券中心` using the original seven controller permissions and unique component names.
|
||||
|
||||
## Database contract
|
||||
|
||||
V4380 creates tenant-scoped PostgreSQL tables:
|
||||
|
||||
- `promotion_coupon_template`
|
||||
- `promotion_coupon`
|
||||
|
||||
Both use `(tenant_id,id)` ownership keys and explicitly named identity sequences. Coupon → Template is a tenant-qualified composite foreign key, so an identifier valid in another tenant cannot be referenced. Checks enforce native status/take/scope/validity/discount enums, fixed-date or relative-term validity, non-negative thresholds and discounts, issue/use counter consistency, positive members/orders, and complete used-coupon state. Indexes support template discovery, member/status lookup, template issuance lookup, and expiry jobs. Existing global coupon tables fail closed instead of being silently assigned to a tenant.
|
||||
|
||||
V4380 seeds menu IDs 6950–6959 for the coupon root, template page, issued-coupon page, and exact query/create/update/delete/send permissions.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4380 starts the native coupon ledger empty. It does not reinterpret a legacy code campaign as a pre-issued member coupon, invent template/instance IDs, discard plan/region/first-order semantics, or attach historical redemptions to unverified native orders and members. A later compatibility/import slice must explicitly decide whether to preserve code redemption as a separate adapter or transform reviewed campaigns and redemption history.
|
||||
|
||||
## Verification
|
||||
|
||||
- The Promotion coupon tenant contract proves both native coupon records inherit `TenantBaseDO`; EDU-027 separately verifies the native Trade dependency that replaced the temporary fallback.
|
||||
- The focused V4380 Flyway scenario passes and proves same IDs can exist across tenants, cross-tenant template references fail, invalid counters/discounts/used state fail, explicit sequences exist, exact menus/permissions are installed, and global-table adoption fails closed.
|
||||
- All 45 PostgreSQL Flyway integration tests pass.
|
||||
- `mvn -pl yudao-server -am -DskipTests compile` succeeds with Product and Promotion enabled.
|
||||
- `@vben/web-antd` typecheck and scoped Coupon oxlint/oxfmt checks pass.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Legacy code-campaign and redemption compatibility/import remains a separate mapping slice.
|
||||
- EDU-027 activates the tenant-scoped normal-order core. Coupon-to-special-order and refund composition still depend on deferred Promotion and Trade after-sale slices.
|
||||
- Discount/reward/seckill/combination/bargain/point/Diy/KeFu Promotion families are not activated at the database/menu level by this slice.
|
||||
- Target-environment role grants, browser/API smoke evidence, and deliberate template population remain operational work.
|
||||
@@ -0,0 +1,53 @@
|
||||
# EDU-027 — Activate native Mall Trade order core
|
||||
|
||||
- **Status:** done — tenant-owned order core, native APIs/UI, RBAC, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / order lifecycle / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-020, EDU-024, EDU-025, EDU-026, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
RuoYi Vue Pro already provides the normalized Trade order aggregate, cart and price orchestration, Pay/Product/Promotion/Member composition, administrator order/config controllers, jobs, permissions, and Vben pages. The Server dependency was disabled and its core data objects inherited only `BaseDO`. Rebuilding orders inside Education would create a second commerce ledger and duplicate native payment, member, catalog, and coupon boundaries.
|
||||
|
||||
Legacy orders cannot be copied safely from terminal payment aggregates or display-only product rows. Native Trade requires verified Member identities, SPU/SKU line items, price allocation, delivery mode, payment linkage, status history, and promotion state that those projections do not contain.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `yudao-server` activates `yudao-module-trade`; native `TradeOrderApiImpl` is now authoritative and the temporary Promotion fallback from EDU-026 is removed.
|
||||
- Existing `/trade/order`, `/trade/config`, `/app-api/trade/order`, and `/app-api/trade/cart` contracts remain owned by Trade. Education adds no shadow order or cart API. This slice proves the administrator order/config interface and core persistence; it does not yet claim successful app checkout.
|
||||
- `TradeOrderDO`, `TradeOrderItemDO`, `TradeOrderLogDO`, `TradeConfigDO`, and `CartDO` extend `TenantBaseDO`, so their native mapper/service access participates in framework tenant injection.
|
||||
- V4390 mounts the existing order and trade-config Vben pages below an Education `交易中心` with the exact native query/update/pick-up/config permissions.
|
||||
- Deferred after-sale, delivery-master-data, and brokerage tables are not silently activated. V4390 rejects any pre-existing version of those tables until a dedicated tenant-safe slice owns their schema and UI.
|
||||
|
||||
## Database contract
|
||||
|
||||
V4390 creates tenant-scoped PostgreSQL tables:
|
||||
|
||||
- `trade_config`
|
||||
- `trade_cart`
|
||||
- `trade_order`
|
||||
- `trade_order_item`
|
||||
- `trade_order_log`
|
||||
|
||||
All use `(tenant_id,id)` ownership keys and explicitly named identity sequences. Order Item → Order/Cart/Product and Order Log → Order references are tenant-qualified. Cart → Product, Order → Pay Order, and Order → Promotion Coupon references are also tenant-qualified. Checks enforce native order/type/terminal/delivery/refund/cancel/log enums, amount/count bounds, payment/cancel/delivery shapes, after-sale reference shape, and one active config per tenant. Indexes match administrator paging, member history, cart selection, auto-cancel/receive jobs, order details, and log history.
|
||||
|
||||
V4390 seeds menu IDs 6960–6967 for the Trade root, order page, config page, and exact five controller permissions.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
The native Trade ledger starts empty. V4390 does not fabricate line items from Pay totals, guess tenant/member/SPU/SKU links, translate terminal statuses into a richer order lifecycle, or attach historical coupons and refunds without reviewed source identities. A later import slice requires an explicit reconciliation contract and quarantine path.
|
||||
|
||||
## Verification
|
||||
|
||||
- The focused Trade tenant contract proves all five activated records inherit `TenantBaseDO`.
|
||||
- The focused V4390 Flyway scenario proves same IDs can exist across tenants, cross-tenant Cart/Order Item references fail, invalid cancel/config states fail, five explicit sequences exist, exact menus/permissions are installed, core global-table adoption fails closed, and deferred Trade tables fail closed.
|
||||
- The full PostgreSQL Flyway suite passes with 46 scenarios through V4390.
|
||||
- `mvn -pl yudao-server -am -DskipTests compile` succeeds with Product, Promotion, and Trade enabled.
|
||||
- The existing Vben order/config pages pass the web app typecheck and scoped lint/format checks.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Native after-sale, delivery express/template/pick-up-store, and brokerage persistence/UI require later tenant-safe slices.
|
||||
- Normal checkout still invokes native Promotion discount and reward lookups whose tables are deferred, and special orders require additional Promotion families. V4390 therefore does not claim end-to-end purchase creation, seckill, bargain, combination, point, discount, or reward orders.
|
||||
- Legacy order import, automatic education-entitlement fulfillment, refund-driven revocation, and production reconciliation/runbooks remain separate work.
|
||||
- Target-environment role grants, scheduled-job deployment, and browser/API smoke evidence remain operational work.
|
||||
@@ -0,0 +1,36 @@
|
||||
# EDU-028 — Activate native checkout Promotion activities
|
||||
|
||||
- **Status:** done — tenant-owned discount/reward persistence, native APIs/UI, RBAC, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / checkout dependency / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-025, EDU-026, EDU-027, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
Every normal RuoYi Trade price calculation invokes the native limited-time discount and reward calculators. Those calculators call `DiscountActivityApi` and `RewardActivityApi` even when no activity is configured, so V4390's order core still failed with missing Promotion tables before it could return an empty promotion result. Replacing these APIs inside Education would duplicate Promotion ownership and bypass the native administration UI.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `DiscountActivityDO`, `DiscountProductDO`, and `RewardActivityDO` extend `TenantBaseDO`; their existing services, mappers, controllers, and public APIs remain authoritative.
|
||||
- V4400 creates tenant-scoped `promotion_discount_activity`, `promotion_discount_product`, and `promotion_reward_activity` tables with explicit PostgreSQL sequences and `(tenant_id,id)` ownership keys.
|
||||
- Discount Product → Activity/SPU/SKU references are tenant-qualified. Active SKU uniqueness, status/time, discount type/value, reward condition/scope, and JSON reward-rule checks fail closed in PostgreSQL.
|
||||
- The native cross-database `MyBatisUtils.findInSetWithParamIndex` already renders PostgreSQL `POSITION(...)` against the comma-separated `LongListTypeHandler` value; no mapper fork or Education shadow interface is introduced.
|
||||
- Menu IDs 6970–6982 mount the existing `mall/promotion/discountActivity/index` and `mall/promotion/rewardActivity/index` Vben pages with the exact ten native controller permissions.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4400 starts both activity families empty. Legacy coupon/code campaigns are not equivalent to time-boxed SKU discounts or structured full-reduction/gift rules, and no activity, product scope, time range, or reward rule is inferred.
|
||||
|
||||
## Verification
|
||||
|
||||
- The Promotion tenant contract proves all three activated records participate in framework tenant isolation.
|
||||
- The focused V4400 scenario proves cross-tenant identifier reuse, composite reference rejection, active-SKU uniqueness, PostgreSQL scope membership semantics, reward-rule/scope rejection, three explicit sequences, exact routes/permissions, and fail-closed global-table adoption.
|
||||
- A Spring/MyBatis integration test invokes the real `DiscountActivityApiImpl` and `RewardActivityApiImpl` against migrated PostgreSQL tables and proves empty normal-checkout lookups return empty lists rather than missing-table errors.
|
||||
- The full PostgreSQL Flyway suite passes 47 scenarios through V4400.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- This slice removes the normal price pipeline's discount/reward missing-table blocker; it does not claim end-to-end order creation. Delivery express/template/pick-up persistence and configured Pay App/Channel runtime data remain prerequisites for applicable checkout modes.
|
||||
- Seckill, bargain, combination, point, and other special-order Promotion tables remain separate tenant-safe activations.
|
||||
- Legacy Product/campaign/order import, purchase-driven Education entitlement fulfillment, refund-driven revocation, and production API/browser smoke evidence remain separate work.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
# EDU-029 — Activate native Trade delivery
|
||||
|
||||
- **Status:** done — tenant-owned delivery persistence, native checkout calculation, RBAC, UI, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / checkout dependency / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-025, EDU-027, EDU-028, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
Normal native Trade checkout supports express delivery and store pickup. Express pricing reads Product SPU delivery-template IDs, Member addresses, per-tenant Trade configuration, template charge/free rules, and delivery areas. Pickup validates an enabled store. The source backend has no equivalent physical-shipping aggregate, so implementing an Education-owned delivery API would duplicate RuoYi Trade and leave its existing administration UI disconnected.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `DeliveryExpressDO`, `DeliveryExpressTemplateDO`, `DeliveryExpressTemplateChargeDO`, `DeliveryExpressTemplateFreeDO`, and `DeliveryPickUpStoreDO` extend `TenantBaseDO`; the native services, mappers, controllers, calculators, and Vben pages remain authoritative.
|
||||
- V4410 creates all five tables with explicit sequences, `(tenant_id,id)` ownership, tenant-qualified template-child references, and a charge-mode-qualified reference that prevents child/template mode drift.
|
||||
- Comma-separated area/user IDs are validated in the database using the formats consumed by `IntegerListTypeHandler` and `LongListTypeHandler`. Amounts, counts, charge modes, status, address, business hours, and coordinates fail closed.
|
||||
- Product SPU → delivery template and Trade Order → pickup store references are tenant-qualified. Pickup orders require a store; relevant lookup indexes are installed.
|
||||
- Menu IDs 6990–7006 mount the existing Express, Express Template, and Pickup Store pages with the exact thirteen permissions exposed by the native controllers.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4410 starts delivery configuration empty. The source backend contains no authoritative express company, freight rule, delivery area, store, coordinates, hours, or verifier mapping. No product is silently assigned a template and no store is fabricated.
|
||||
|
||||
## Verification
|
||||
|
||||
- The delivery tenant contract proves all five activated records participate in framework tenant isolation.
|
||||
- The focused V4410 Flyway scenario proves cross-tenant identifier reuse, Product/template and Order/store ownership, charge-mode consistency, area/location checks, pickup-order shape, five explicit sequences, exact routes/permissions, and fail-closed global-table adoption.
|
||||
- A Spring/MyBatis PostgreSQL integration test uses the production tenant SQL interceptor, creates same-named native templates in two tenants, proves isolated mapper results, reads real charge/free rules, and drives `TradeDeliveryPriceCalculator` through the persisted express template to a 700-cent delivery fee.
|
||||
- The full Flyway suite passes 48 scenarios through V4410; server and Vben verification are recorded in the migration UI report.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Delivery persistence and calculation are active, but configured Pay App/Channel data and a target-environment order/payment smoke remain prerequisites for an end-to-end paid checkout claim.
|
||||
- Trade after-sale and brokerage, special-order Promotion families, explicit legacy Product/coupon/order import, purchase-driven Education entitlement fulfillment, and refund-driven revocation remain separate slices.
|
||||
@@ -0,0 +1,36 @@
|
||||
# EDU-030 — Activate native Trade after-sale
|
||||
|
||||
- **Status:** done — tenant-owned after-sale persistence, native state machine, Pay Refund bridge, RBAC, corrected Vben UI, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / refund lifecycle / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-022, EDU-025, EDU-027, EDU-029, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
The source backend stores order-level UUID rows in `public.commerce_refund_requests` and append-only `public.commerce_refund_events`, with statuses `requested`, `approved`, `processing`, `succeeded`, `failed`, `rejected`, and `cancelled`. RuoYi already owns a richer line-item after-sale state machine: Member application, administrator agree/disagree, return logistics, receipt/refusal, Pay Refund creation/callback, order-item state updates, immutable operation logs, exact RBAC, and an existing Vben list/detail page. Reimplementing that lifecycle in Education would create a second refund ledger and bypass native Trade/Pay coordination.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `AfterSaleDO` and `AfterSaleLogDO` extend `TenantBaseDO`; existing app/admin controllers, `AfterSaleServiceImpl`, `AfterSaleLogServiceImpl`, order updates, and `PayRefundApi` remain authoritative.
|
||||
- V4420 creates `trade_after_sale` and `trade_after_sale_log` with explicit sequences and `(tenant_id,id)` ownership. Order, order item, SPU, SKU, Pay Refund, delivery express, log, and order-item back-reference constraints are tenant-qualified.
|
||||
- Database checks enforce native status/type/way values, non-negative amounts, required audit/return/refund facts, JSON arrays, valid log actor/operation/status values, unique tenant numbers, and at most one active after-sale per order item.
|
||||
- Menu IDs 7010–7015 reuse `mall/trade/afterSale/index` with exactly `trade:after-sale:query`, `agree`, `disagree`, `receive`, and `refund` permissions.
|
||||
- The Vben page sends the backend's `auditReason` field, requires `refuseMemo` in a locked/validated refusal modal, displays the actual application `createTime`, and guards every action with its exact permission. Backend request validation now rejects blank refusal notes and the detail response exposes `createTime`.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4420 starts the native after-sale ledger empty. A source request identifies an aggregate UUID order but does not identify a verified native Member, `trade_order_item`, SPU/SKU allocation, return quantity, delivery company, or Pay Refund row. Its status history also does not prove the native line-item and return-logistics transitions. Automatic import would invent ownership and lifecycle facts, so explicit legacy refund import is deferred until legacy Product, Order, Order Item, and Member mappings are reviewed.
|
||||
|
||||
## Verification
|
||||
|
||||
- The after-sale tenant contract proves both native records participate in framework tenant isolation.
|
||||
- The focused V4420 Flyway scenario proves cross-tenant identifier reuse, tenant-qualified ownership/back-references, two explicit sequences, audit/log rejection, exact route/permissions, and fail-closed adoption of a pre-existing global table.
|
||||
- A Spring/MyBatis PostgreSQL integration test imports the real services and production tenant SQL interceptor, creates same-ID Product/Order/Order Item fixtures in tenants 10 and 20, and proves isolated create, page, detail, and log reads plus order-item update calls.
|
||||
- The full PostgreSQL Flyway suite passes 49 scenarios through V4420. The server reactor compiles, and the corrected Vben page passes typecheck plus scoped oxlint/oxfmt checks.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Trade brokerage and special-order Promotion families remain separate native activation slices.
|
||||
- Legacy Product/coupon/order/refund import requires explicit UUID-to-native mappings and reconciliation artifacts; V4420 does not reinterpret source refunds.
|
||||
- Configured target Pay App/Channel data and a deployed order/payment/refund smoke are still required for end-to-end production evidence.
|
||||
- Purchase-driven Education entitlement fulfillment and refund-driven entitlement revocation remain separate orchestration work.
|
||||
@@ -0,0 +1,43 @@
|
||||
# EDU-031 — Activate native Trade brokerage
|
||||
|
||||
- **Status:** done — native tenant-owned relationships, commission records, withdrawal/Pay Transfer bridge, exact RBAC, corrected Vben UI, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / two-level commission / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-024, EDU-027, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
The source backend has referral codes, leads, team edges, tracks, QR codes, CRM assignment, tenant commission settings, settlement aggregates/items, and proof/export events. RuoYi already owns a different but substantial Trade brokerage lifecycle: Member-backed promoter relationships, first/second-level order commissions, freeze/unfreeze, cancellation, withdrawals, Pay Transfer composition, app/admin APIs, scheduled settlement work, exact permissions, and three Vben administration pages. Rebuilding those overlapping behaviors in Education would create a second commission ledger and bypass native Member/Trade/Pay coordination.
|
||||
|
||||
Primary source evidence remains in:
|
||||
|
||||
- `/Users/tiku1/code/tiku-backend/supabase/migrations/202606210006_growth_referral_crm.sql`
|
||||
- `/Users/tiku1/code/tiku-backend/supabase/migrations/202606290009_commission_settlements.sql`
|
||||
- `/Users/tiku1/code/tiku-backend/supabase/migrations/202606290027_commission_settlement_proofs.sql`
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `BrokerageUserDO`, `BrokerageRecordDO`, and `BrokerageWithdrawDO` extend `TenantBaseDO`; native app/admin controllers, services, mappers, jobs, Member lookups, Trade order integration, and Pay Transfer API remain authoritative.
|
||||
- V4430 creates `trade_brokerage_user`, `trade_brokerage_record`, and `trade_brokerage_withdraw` with `(tenant_id,id)` ownership, explicit record/withdraw sequences, tenant-qualified relationship/source/withdrawal/Pay Transfer/Trade Order references, commission idempotency, amount/state/account/audit/transfer checks, and a 0–99 withdrawal-fee range.
|
||||
- Menu IDs 7020–7031 reuse the existing user, record, and withdrawal pages with exactly eight controller permissions: user query/create/update-bind/clear-bind/update-enable, record query, and withdrawal query/audit.
|
||||
- The Vben user page uses those real permissions for both drill-downs, disables the eligibility switch without update permission, exposes responsive forms/tables, and its API types now match the backend responses. Withdrawal rejection trims and requires a non-blank reason on both sides.
|
||||
- Immediate-settlement commission records now persist a settlement time, so the native time-range summary and ranking SQL includes zero-freeze commissions.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4430 activates the native ledger empty. Source referral/settlement rows use UUID identities and carry CRM lead assignment, referral-code/track attribution, settlement-batch state, and proof/export semantics that have no verified one-to-one mapping to native Member IDs, `trade_order` rows, two-level promoter relations, Pay Transfer rows, or immutable evidence artifacts. Importing them now would invent identity and settlement facts. Explicit referral CRM and commission-settlement import stays deferred until Member, lead, Order, payment, and proof mappings are reviewed; those source-only semantics are not declared retired.
|
||||
|
||||
## Verification
|
||||
|
||||
- The focused V4430 scenario proves table/sequence/check/index shape, same-number cross-tenant identities, tenant-qualified references, exact routes/permissions, and fail-closed adoption of a pre-existing global table.
|
||||
- The tenant contract proves all three native records participate in framework tenant isolation and withdrawal inputs reject missing type, non-positive price, and blank audit reason.
|
||||
- A Spring/MyBatis PostgreSQL integration test imports the real user/record services and production tenant SQL interceptor. Tenants 10 and 20 create the same Member IDs and business ID with different commission percentages; relationship/page reads, balances, MyBatis-Join summaries, and native annotated summary/ranking SQL remain isolated.
|
||||
- The corrected Vben pages pass workspace typecheck and scoped oxlint/oxfmt checks.
|
||||
- The full PostgreSQL Flyway suite passes 50 scenarios through V4430, and the server clean reactor compiles all 28 modules.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Source referral code/lead/team-edge/track/QR/CRM-assignment semantics and settlement proof/export aggregates require dedicated mapping/import slices.
|
||||
- Special-order Promotion families and explicit legacy Product/coupon/order/refund import remain separate.
|
||||
- Purchase-driven Education entitlement fulfillment and refund-driven entitlement revocation remain separate orchestration work.
|
||||
- Configured Pay runtime, scheduled unfreeze/transfer operation, and deployed order-to-commission-to-withdrawal smoke evidence remain required for production acceptance.
|
||||
@@ -0,0 +1,39 @@
|
||||
# EDU-032 — Activate native Promotion seckill
|
||||
|
||||
- **Status:** done — native tenant-owned seckill configuration, activities, SKU stock, Trade Order bridge, exact RBAC, corrected Vben UI, and PostgreSQL evidence delivered
|
||||
- **Type:** native module takeover / special-order promotion / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-025, EDU-027, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
The source backend has no seckill table, endpoint, job, or administration surface. RuoYi already owns a complete Promotion seckill lifecycle: time configurations, SPU/SKU activity authoring, atomic stock changes, Trade Order integration, app/admin APIs, exact permissions, and two Vben administration pages. Rebuilding those behaviors in Education would create a second promotion inventory and bypass native Product, Promotion, Trade, Member, and tenant/RBAC coordination.
|
||||
|
||||
Repository-wide source inventory under `/Users/tiku1/code/tiku-backend` found no seckill or 秒杀 capability. That absence is a data decision: the target capability starts empty and no legacy records are invented.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `SeckillConfigDO`, `SeckillActivityDO`, and `SeckillProductDO` extend `TenantBaseDO`; the native controllers, services, mappers, Product APIs, Trade Order fields, and Vben pages remain authoritative.
|
||||
- V4440 creates `promotion_seckill_config`, `promotion_seckill_activity`, and `promotion_seckill_product` with `(tenant_id,id)` ownership, explicit PostgreSQL sequences, tenant-qualified Product SPU/SKU and activity references, JSON/time/price/stock/limit/state constraints, and fail-closed adoption of pre-existing global tables.
|
||||
- Tenant-aware triggers validate every configured time slot, keep product activity snapshots aligned, and reject deletion of a slot still used by an activity. `trade_order` gains a tenant-qualified seckill-activity reference and an order-type/activity consistency constraint.
|
||||
- Menu IDs 7040–7051 reuse the existing activity and time-config pages with exactly nine controller permissions: five activity permissions and four configuration permissions.
|
||||
- Service validation rejects duplicate SKUs, seckill prices above native SKU prices, stock above native SKU stock, invalid limit relationships, and unsafe stock restoration. Closing an activity transactionally disables its product snapshots; a used time configuration cannot be deleted.
|
||||
- The Vben pages use the real backend field shapes and permissions, validate time/limit/product relationships, handle empty products and prices safely, use the correct `0=enabled` switch direction, and provide responsive forms.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4440 activates all three native tables empty. There is no source seckill state to import, reconcile, or retire. This ticket does not reinterpret ordinary products, coupons, referral campaigns, or aggregate orders as seckill activities.
|
||||
|
||||
## Verification
|
||||
|
||||
- All 51 PostgreSQL Flyway scenarios pass through V4440, including the focused table/sequence/constraint/trigger/menu shape and fail-closed adoption cases.
|
||||
- A Spring/MyBatis PostgreSQL integration test imports the real native seckill services and production tenant SQL interceptor. Tenants 10 and 20 create the same numeric config/activity/product IDs; page and detail reads remain isolated; two concurrent attempts for the final unit produce exactly one success; restoration, close-state propagation, and used-slot deletion protection are verified.
|
||||
- Promotion contract tests prove the three records participate in framework tenant isolation and activity/config/product requests reject invalid time, limit, SKU, price, stock, status, and slider-image inputs.
|
||||
- The scoped Vben seckill files pass oxlint and oxfmt checks, and the complete `@vben/web-antd` typecheck passes.
|
||||
- The non-clean Maven reactor install through Education succeeds across 26 required modules without stopping the running server.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Combination, Bargain, Point, and any other special-order Promotion families require separate tenant-safe activation slices.
|
||||
- Explicit legacy Product/coupon/order/refund/referral/settlement-proof import remains separate; no source seckill import is needed.
|
||||
- Purchase-driven Education entitlement fulfillment, refund-driven entitlement revocation, configured Pay runtime, and deployed end-to-end seckill checkout evidence remain required for production acceptance.
|
||||
@@ -0,0 +1,39 @@
|
||||
# EDU-033 — Activate native Promotion combination
|
||||
|
||||
- **Status:** done — native tenant-owned combination activities, SKU pricing, group records, Trade Order bridge, exact RBAC, corrected Vben UI, and PostgreSQL concurrency evidence delivered
|
||||
- **Type:** native module takeover / special-order promotion / tenant isolation
|
||||
- **Phase:** 5 / commercialization foundation
|
||||
- **Blockers:** EDU-025, EDU-027, PostgreSQL Flyway
|
||||
|
||||
## Problem
|
||||
|
||||
RuoYi already owns the complete group-buying lifecycle: SPU/SKU activity authoring, head/member records, group capacity and expiry, Trade Order integration, app/admin APIs, Member and Product lookups, permissions, and Vben administration. Rebuilding it in Education would create a second promotion/order aggregate and bypass the native Product, Promotion, Trade, Member, tenant, and RBAC boundaries.
|
||||
|
||||
The source backend has no group-buying capability. Its only `combination` value appears in `docs/pb_schema.json` and `apps/api/src/features/tenant-content/imports.ts`, where it means an education combination-question type. It must not be interpreted as a promotion activity, product, order, or group record.
|
||||
|
||||
## Delivered contract
|
||||
|
||||
- `CombinationActivityDO`, `CombinationProductDO`, and `CombinationRecordDO` extend `TenantBaseDO`; native controllers, services, mappers, Product/Member/Trade APIs, jobs, app endpoints, and Vben pages remain authoritative.
|
||||
- V4450 creates `promotion_combination_activity`, `promotion_combination_product`, and `promotion_combination_record` with `(tenant_id,id)` ownership, PostgreSQL sequences, tenant-qualified Product SPU/SKU/activity/order/head references, snapshot/time/price/limit/state constraints, and fail-closed adoption of pre-existing global tables.
|
||||
- Product triggers require activity/SPU/SKU/status/time consistency and prevent a combination price above the native SKU price. Record and Trade triggers lock the head row, enforce capacity and activity/order/user/head consistency, allow the order-before-record bridge state, and reject deletion of an activity with group records.
|
||||
- Menu IDs 7060–7067 reuse the existing activity and record pages with exactly six controller permissions: five activity permissions and one record query permission.
|
||||
- Request and service validation reject blank/oversized names, invalid time and limit relationships, groups smaller than two, duplicate or mismatched SKUs, non-positive identifiers/prices/counts, prices above the native SKU price, and cross-activity parent groups. Closing an activity transactionally disables product snapshots; activity updates retain and refresh snapshot status/time.
|
||||
- Head creation returns the persisted head-record ID rather than the `0` sentinel. Joining locks the head before validation/insertion, preventing concurrent over-capacity membership.
|
||||
- The Vben activity and record pages use the backend VO shapes and combination-record dictionary, validate positive/time/limit/product inputs, handle missing prices/products, pass the correct head ID to the member dialog, expose exact permission guards, and use viewport-bounded dialogs and keyboard-operable showcase controls.
|
||||
|
||||
## Legacy data decision
|
||||
|
||||
V4450 activates the native tables empty. No legacy rows are imported or invented. Education combination questions remain Education content and are not mapped to Mall group buying; ordinary products and aggregate orders are likewise not reinterpreted.
|
||||
|
||||
## Verification
|
||||
|
||||
- All 52 PostgreSQL Flyway scenarios pass through V4450, including focused table/sequence/constraint/trigger/menu shape, order bridge, cross-tenant same-ID, and fail-closed adoption cases.
|
||||
- A Spring/MyBatis PostgreSQL integration test imports the real native activity and record services plus the production tenant SQL interceptor. Tenants 10 and 20 create the same numeric activity/product IDs; page, record, and summary reads remain isolated; activity edits and closure propagate product snapshots; a head returns its real record ID; two concurrent members competing for the final place produce exactly one success; cross-activity joins and deletion with records fail closed; Trade Order/record/head references remain consistent.
|
||||
- Promotion contract tests prove all three records participate in framework tenant isolation, request DTOs carry the required validation annotations and relationship checks, and the head response conversion never returns the sentinel.
|
||||
- Scoped Vben combination files pass oxlint and oxfmt checks, and the complete `@vben/web-antd` typecheck passes.
|
||||
|
||||
## Explicitly open
|
||||
|
||||
- Bargain, Point, and any other special-order Promotion families require separate tenant-safe activation slices.
|
||||
- Explicit legacy Product/coupon/order/refund/referral/settlement-proof import remains separate; no source combination import is needed.
|
||||
- Purchase-driven Education entitlement fulfillment, refund-driven entitlement revocation, configured Pay runtime, virtual-group expiry job operations, and deployed end-to-end combination checkout evidence remain required for production acceptance.
|
||||
@@ -36,23 +36,46 @@ EDU-000 Phase 0 artifacts done
|
||||
└── EDU-005 PostgreSQL/Flyway takeover decision done
|
||||
|
||||
EDU-009 + provider/content decisions
|
||||
└── EDU-010 Tenant content publication blocked
|
||||
└── EDU-011 Import/export/assets/scanning blocked
|
||||
└── EDU-010 Tenant content publication done (bounded JAVA_READ publication scope delivered)
|
||||
└── EDU-011 Import/export/assets/scanning bounded capability delivered; production adapters/export artifacts deferred
|
||||
|
||||
EDU-004
|
||||
└── EDU-012 Classes and education relationships blocked
|
||||
└── EDU-012 Classes and education relationships implemented (bounded class/invitation capability)
|
||||
|
||||
Commerce ownership decisions
|
||||
└── EDU-013 Education commercialization blocked
|
||||
└── EDU-013 Education commercialization bounded entitlement/binding capability implemented; platform events deferred
|
||||
|
||||
All owner/contract decisions
|
||||
└── EDU-014 Extended learning waves blocked
|
||||
└── EDU-015 Operational independence blocked
|
||||
└── EDU-014 Extended learning waves bounded representative wave delivered; blocked families explicitly deferred
|
||||
└── EDU-015 Operational independence contracts implemented; release/deployment evidence remains
|
||||
|
||||
EDU-003 + tenant-admin inventory
|
||||
└── EDU-017 Tenant appearance/theme bounded appearance/settings/theme lifecycle delivered; integrations/secrets/codes deferred
|
||||
└── EDU-018 Native payment/social admin Pay/System controllers, RBAC, and Vben pages reused
|
||||
├── EDU-019 Learning activation codes bounded generation/redemption, entitlement composition, and Vben page delivered
|
||||
└── EDU-020 Native Pay activation Pay module plus tenant App/Channel schema and parent isolation delivered
|
||||
└── EDU-021 Legacy Pay import explicit tenant-account mapping into native Pay with redacted audit delivered
|
||||
└── EDU-022 Native Pay transactions tenant order/refund/notify ledgers and native UI delivered
|
||||
└── EDU-023 Legacy Pay transactions reconciled terminal import and redacted audit delivered
|
||||
└── EDU-024 Native Pay Transfer/Wallet tenant ledgers and native UI delivered
|
||||
└── EDU-025 Native Mall Product tenant catalog and native UI delivered
|
||||
└── EDU-026 Native Mall Promotion coupon templates/instances and native UI delivered
|
||||
└── EDU-027 Native Mall Trade order core and native UI delivered
|
||||
└── EDU-028 Native checkout discount/reward activities and native UI delivered
|
||||
└── EDU-029 Native Trade delivery and native UI delivered
|
||||
└── EDU-030 Native Trade after-sale and corrected native UI delivered
|
||||
└── EDU-031 Native Trade brokerage and corrected native UI delivered
|
||||
└── EDU-032 Native Promotion Seckill and corrected native UI delivered
|
||||
└── EDU-033 Native Promotion Combination and corrected native UI delivered
|
||||
```
|
||||
|
||||
## Recommended execution order
|
||||
|
||||
1. Select the next unblocked content-management decision/ticket after EDU-009.
|
||||
1. Complete production release evidence for **EDU-015** using the Pilot runbook and target-only `JAVA_READ` deployment.
|
||||
2. Add deferred EDU-011 scanner/parser/export adapters only when their owning platform contracts and deployment are available.
|
||||
3. Add automatic EDU-013 fulfillment only after Mall/Pay/CRM expose the recorded public events; keep manual trusted fulfillment and access fail-closed meanwhile.
|
||||
4. EDU-025 activates native Product, EDU-026 activates coupons, EDU-027 activates the normal Trade order core, EDU-028 activates discount/reward, EDU-029 activates delivery, EDU-030 activates after-sale/Pay Refund, EDU-031 activates native brokerage, EDU-032 activates native Seckill, and EDU-033 activates native Combination activities, group records, atomic capacity, exact RBAC, and corrected administration pages. Continue with Bargain/Point and other Promotion families, source referral CRM/settlement-proof import, explicit legacy product/coupon/order/refund import, automatic Mall/Pay fulfillment, refund-driven entitlement revocation, production export/runbook evidence, legacy activation-code import, tenant PNVS, and encrypted generic secret storage as separate slices.
|
||||
5. Select the next EDU-014 family only after its entitlement, privacy, and owner decisions are recorded.
|
||||
|
||||
## Phase 0 completion caveat
|
||||
|
||||
|
||||
@@ -13,28 +13,32 @@ yudao:
|
||||
catalog-read-enabled: true
|
||||
practice-write-enabled: true
|
||||
pilot-tenant-ids: [<pilot-tenant-id>]
|
||||
catalog-mode: SCALAR_READ
|
||||
catalog-mode: JAVA_READ
|
||||
scalar:
|
||||
enabled: true
|
||||
base-url: ${EDUCATION_SCALAR_BASE_URL}
|
||||
token: ${EDUCATION_SCALAR_TOKEN}
|
||||
enabled: false
|
||||
owner: <required-only-when-scalar-read>
|
||||
exit-date: <yyyy-MM-dd>
|
||||
```
|
||||
|
||||
要求:
|
||||
|
||||
- `pilot-tenant-ids` 在 Pilot 环境必须显式配置,不能使用空列表。
|
||||
- Scalar token 只能通过密钥管理或环境变量注入,不写入仓库、日志或测试报告。
|
||||
- 发布前调用管理端 `/admin-api/education/capability`,核对模块、题库读取、练习写入和 Pilot 租户数量。
|
||||
- Pilot 默认以 `JAVA_READ` 启动,只依赖目标 PostgreSQL;不得启动旧 NestJS API、旧 Worker、Supabase 或旧资产扫描服务作为前置条件。
|
||||
- 仅在有明确负责人、告警、故障策略和退出日期的兼容窗口内切换 `SCALAR_READ`。Scalar token 只能通过密钥管理或环境变量注入。
|
||||
- 发布前调用管理端 `/admin-api/education/capability` 和 `/admin-api/education/operations/health`;后者必须显示 `java-read-postgresql=UP`、`scalar-catalog=NOT_SELECTED`。
|
||||
|
||||
## 3. 发布步骤
|
||||
|
||||
1. 备份 Education 相关表,并记录应用版本与 `flyway_schema_history`。
|
||||
2. 使用 Server 配置的 PostgreSQL Flyway 执行 migrate 和 validate,检查版本、脚本、checksum 与 success;不得手工应用 Education SQL 或执行 rollback SQL。
|
||||
3. 先以 `catalog-read-enabled=false`、`practice-write-enabled=false` 部署应用。
|
||||
4. 验证 System、Infra、Member 基础 smoke。
|
||||
5. 仅对 Pilot 租户开启题库读取,完成 Scalar 只读 smoke。
|
||||
6. 对 Pilot 租户开启练习写入,完成会话、答案、交卷、报告、错题和收藏 smoke。
|
||||
7. 观察错误率、延迟和数据库写入后再扩大租户列表。
|
||||
2. 由数据库管理员预置彼此独立的 Flyway owner LOGIN role 与 runtime LOGIN role。Flyway role 拥有目标 schema;runtime role 只获得业务表所需权限,且不得拥有、继承所有者角色或写入 `education_question_lifecycle_transition_token`、`education_content_node_lifecycle_transition_token`、`education_question_collection_lifecycle_transition_token`、`education_question_collection_membership_token`。角色/密码不由 migration 创建。
|
||||
3. 显式注入 `FLYWAY_USER`、`FLYWAY_PASSWORD`(不得回退到 master datasource 账号),使用 Server 配置的 PostgreSQL Flyway 执行 migrate 和 validate,检查版本、脚本、checksum、success 以及四张 token 表 owner 均为 Flyway role。
|
||||
4. 以 runtime datasource 账号验证四张 token 表均无 INSERT/UPDATE/DELETE/TRUNCATE,随后启动应用;同角色、继承 owner 或可写授权会导致 Education 启动检查 fail closed。
|
||||
5. 先以 `catalog-read-enabled=false`、`practice-write-enabled=false` 部署应用。
|
||||
6. 验证 System、Infra、Member 基础 smoke。
|
||||
7. 仅对 Pilot 租户开启题库读取,完成 JAVA_READ 只读 smoke,并运行 `tools/education-target-smoke/java-read-readiness.sh`。
|
||||
8. 对 Pilot 租户开启练习写入,完成会话、答案、交卷、报告、错题和收藏 smoke。
|
||||
9. 若部署 Worker 或 Scanner,先确认其持续写入 `education_operational_component`,且 `/admin-api/education/operations/health` 无 `DOWN` 组件和未处理死信。
|
||||
10. 观察错误率、延迟和数据库写入后再扩大租户列表。
|
||||
|
||||
## 4. Smoke 清单
|
||||
|
||||
@@ -60,7 +64,17 @@ yudao:
|
||||
|
||||
## 5. 故障与回滚
|
||||
|
||||
### Scalar 故障
|
||||
### JAVA_READ / PostgreSQL 故障
|
||||
|
||||
1. 设置 `catalog-read-enabled=false`,停止新的目录和题目读取;不得静默切回 Scalar。
|
||||
2. 保持 `enabled=true`,使已有会话、报告、错题和收藏仍可访问。
|
||||
3. 检查 `/admin-api/education/operations/health` 的 `java-read-postgresql` 结果和 Flyway 历史。
|
||||
4. 如需冻结新写入,再设置 `practice-write-enabled=false`。
|
||||
5. 通过应用回滚或更高版本 Flyway 前滚修复,不执行 `flyway clean` 或手工回滚 SQL。
|
||||
|
||||
### Scalar 兼容窗口故障
|
||||
|
||||
仅当部署明确选择 `SCALAR_READ` 时适用:
|
||||
|
||||
1. 设置 `catalog-read-enabled=false`,停止新的 Scalar 读取。
|
||||
2. 保持 `enabled=true`,使已有会话、报告、错题和收藏仍可访问。
|
||||
@@ -88,7 +102,10 @@ yudao:
|
||||
|
||||
发布窗口至少观察:
|
||||
|
||||
- Scalar 请求成功率、4xx/5xx/timeout、P95/P99 延迟;
|
||||
- `/admin-api/education/operations/health` 的必需依赖、Worker/Scanner 心跳和 open dead-letter 数;
|
||||
- `education_operational_component` 的 `last_heartbeat_at`、最后成功/失败和 backlog;
|
||||
- `education_dead_letter` 仅保留负载指纹与脱敏错误分类,不得保存业务 payload、凭据或个人数据;
|
||||
- Scalar 兼容模式请求成功率、4xx/5xx/timeout、P95/P99 延迟;
|
||||
- 练习创建成功/冲突数;
|
||||
- 答案保存成功、幂等重放、版本冲突和旧序号拒绝数;
|
||||
- 交卷成功、并发冲突和事务失败数;
|
||||
@@ -97,6 +114,14 @@ yudao:
|
||||
|
||||
Scalar 日志只能记录脱敏路径、tenant ID、上游 request ID、状态、耗时和错误分类;不得记录 Authorization、Scalar token、学生答案、正确答案或完整响应体。RuoYi access/error log 中的 trace ID 用于关联入口请求;验收时需保存一条从入口日志到 Scalar request ID 的关联证据。
|
||||
|
||||
### Worker、Scanner 与死信处置
|
||||
|
||||
1. Worker/Scanner 每次心跳使用固定 `component_key` upsert;部署实例变化写入 `instance_id`。
|
||||
2. 心跳状态只能为 `STARTING/UP/DEGRADED/DOWN`,`detail` 必须脱敏且有界。
|
||||
3. 重试耗尽后写入 `education_dead_letter`;同一租户、组件、workload 只允许一个 OPEN 记录。
|
||||
4. 排障后先把原 OPEN 记录标记为 `REQUEUED` 并填写 `resolved_at`/`resolution_note`,再通过所属业务服务重入队;禁止直接修改业务结果或把原 payload 写入死信表。
|
||||
5. 未部署对应 Worker/Scanner 时不得伪造 UP 心跳;能力清单应保持未交付状态。
|
||||
|
||||
## 7. 验证命令
|
||||
|
||||
```bash
|
||||
|
||||
4
pom.xml
4
pom.xml
@@ -20,8 +20,8 @@
|
||||
<!-- <module>yudao-module-bpm</module>-->
|
||||
<!-- <module>yudao-module-report</module>-->
|
||||
<!-- <module>yudao-module-mp</module>-->
|
||||
<!-- <module>yudao-module-pay</module>-->
|
||||
<!-- <module>yudao-module-mall</module>-->
|
||||
<module>yudao-module-pay</module>
|
||||
<module>yudao-module-mall</module>
|
||||
<!-- <module>yudao-module-crm</module>-->
|
||||
<!-- <module>yudao-module-erp</module>-->
|
||||
<!-- <module>yudao-module-iot</module>-->
|
||||
|
||||
25
script/docker/init-local-roles.sql
Normal file
25
script/docker/init-local-roles.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
CREATE ROLE yudao_flyway LOGIN NOINHERIT PASSWORD '123456';
|
||||
CREATE ROLE yudao_runtime LOGIN NOINHERIT PASSWORD '123456';
|
||||
|
||||
ALTER SCHEMA public OWNER TO yudao_flyway;
|
||||
DO $$
|
||||
DECLARE
|
||||
object RECORD;
|
||||
BEGIN
|
||||
FOR object IN
|
||||
SELECT format('%I.%I', schemaname, tablename) AS name
|
||||
FROM pg_tables
|
||||
WHERE schemaname = 'public'
|
||||
LOOP
|
||||
EXECUTE 'ALTER TABLE ' || object.name || ' OWNER TO yudao_flyway';
|
||||
END LOOP;
|
||||
FOR object IN
|
||||
SELECT format('%I.%I', sequence_schema, sequence_name) AS name
|
||||
FROM information_schema.sequences
|
||||
WHERE sequence_schema = 'public'
|
||||
LOOP
|
||||
EXECUTE 'ALTER SEQUENCE ' || object.name || ' OWNER TO yudao_flyway';
|
||||
END LOOP;
|
||||
END
|
||||
$$;
|
||||
GRANT USAGE ON SCHEMA public TO yudao_runtime;
|
||||
25
tools/education-target-smoke/java-read-readiness.sh
Executable file
25
tools/education-target-smoke/java-read-readiness.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
BASE_URL="${BASE_URL:-http://127.0.0.1:48080}"
|
||||
TOKEN="${EDUCATION_ADMIN_TOKEN:?EDUCATION_ADMIN_TOKEN is required}"
|
||||
TENANT_ID="${EDUCATION_TENANT_ID:?EDUCATION_TENANT_ID is required}"
|
||||
|
||||
response="$(curl --fail --silent --show-error \
|
||||
-H "Authorization: Bearer ${TOKEN}" \
|
||||
-H "tenant-id: ${TENANT_ID}" \
|
||||
"${BASE_URL}/admin-api/education/operations/health")"
|
||||
|
||||
python3 - "$response" <<'PY'
|
||||
import json, sys
|
||||
body = json.loads(sys.argv[1])
|
||||
assert body.get("code") == 0, body
|
||||
health = body["data"]
|
||||
deps = {item["key"]: item for item in health["dependencies"]}
|
||||
java = deps.get("java-read-postgresql")
|
||||
scalar = deps.get("scalar-catalog")
|
||||
assert java and java["required"] and java["status"] == "UP", deps
|
||||
assert scalar and not scalar["required"] and scalar["status"] == "NOT_SELECTED", deps
|
||||
assert health["status"] in ("UP", "DEGRADED"), health
|
||||
print("target-only JAVA_READ readiness proof passed")
|
||||
PY
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.spring.SpringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
@@ -43,13 +44,19 @@ public class ApiAccessLogInterceptor implements HandlerInterceptor {
|
||||
|
||||
// 打印 request 日志
|
||||
if (!SpringUtils.isProd()) {
|
||||
Map<String, String> queryString = ServletUtils.getParamMap(request);
|
||||
String requestBody = ServletUtils.getBody(request);
|
||||
if (CollUtil.isEmpty(queryString) && StrUtil.isEmpty(requestBody)) {
|
||||
log.info("[preHandle][开始请求 URL({}) 无参数]", request.getRequestURI());
|
||||
ApiAccessLog accessLog = handlerMethod != null
|
||||
? handlerMethod.getMethodAnnotation(ApiAccessLog.class) : null;
|
||||
if (accessLog != null && !accessLog.requestEnable()) {
|
||||
log.info("[preHandle][开始请求 URL({}) 参数日志已关闭]", request.getRequestURI());
|
||||
} else {
|
||||
log.info("[preHandle][开始请求 URL({}) 参数({})]", request.getRequestURI(),
|
||||
StrUtil.blankToDefault(requestBody, queryString.toString()));
|
||||
Map<String, String> queryString = ServletUtils.getParamMap(request);
|
||||
String requestBody = ServletUtils.getBody(request);
|
||||
if (CollUtil.isEmpty(queryString) && StrUtil.isEmpty(requestBody)) {
|
||||
log.info("[preHandle][开始请求 URL({}) 无参数]", request.getRequestURI());
|
||||
} else {
|
||||
log.info("[preHandle][开始请求 URL({}) 参数({})]", request.getRequestURI(),
|
||||
StrUtil.blankToDefault(requestBody, queryString.toString()));
|
||||
}
|
||||
}
|
||||
// 计时
|
||||
StopWatch stopWatch = new StopWatch();
|
||||
|
||||
@@ -5,6 +5,8 @@ import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.apilog.core.interceptor.ApiAccessLogInterceptor;
|
||||
import cn.iocoder.yudao.framework.common.biz.infra.logger.ApiErrorLogCommonApi;
|
||||
import cn.iocoder.yudao.framework.common.biz.infra.logger.dto.ApiErrorLogCreateReqDTO;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
@@ -34,6 +36,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
|
||||
import org.springframework.web.multipart.MaxUploadSizeExceededException;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
@@ -372,9 +375,13 @@ public class GlobalExceptionHandler {
|
||||
errorLog.setTraceId(TracerUtils.getTraceId());
|
||||
errorLog.setApplicationName(applicationName);
|
||||
errorLog.setRequestUrl(request.getRequestURI());
|
||||
HandlerMethod handlerMethod = (HandlerMethod) request.getAttribute(
|
||||
ApiAccessLogInterceptor.ATTRIBUTE_HANDLER_METHOD);
|
||||
ApiAccessLog accessLog = handlerMethod != null ? handlerMethod.getMethodAnnotation(ApiAccessLog.class) : null;
|
||||
Map<String, Object> requestParams = MapUtil.<String, Object>builder()
|
||||
.put("query", ServletUtils.getParamMap(request))
|
||||
.put("body", ServletUtils.getBody(request)).build();
|
||||
.put("body", accessLog != null && !accessLog.requestEnable() ? null : ServletUtils.getBody(request))
|
||||
.build();
|
||||
errorLog.setRequestParams(JsonUtils.toJsonString(requestParams));
|
||||
errorLog.setRequestMethod(request.getMethod());
|
||||
errorLog.setUserAgent(ServletUtils.getUserAgent(request));
|
||||
|
||||
@@ -32,6 +32,102 @@ _Avoid_: Answer, choice answer
|
||||
The immutable, student-visible Question Content captured when a practice session is created so that later content edits do not change that session. It excludes answers and explanations; protected scoring data is not part of this projection even when stored beside it.
|
||||
_Avoid_: Question cache
|
||||
|
||||
**Question Content Version**:
|
||||
An immutable revision of Question Content identified by its question and positive version number. Publication selects lifecycle state for the current version; it does not rewrite an existing version or change content ownership.
|
||||
_Avoid_: Editable version row, question backup
|
||||
|
||||
**Publication State**:
|
||||
The server-controlled lifecycle of tenant Question Content: `DRAFT → PUBLISHED → ARCHIVED`. The current command surface has no reverse transition, and `RETIRED` is not yet a defined state.
|
||||
_Avoid_: Arbitrary status field, published boolean as an independent state
|
||||
|
||||
**Draft Question Content**:
|
||||
Tenant-owned Question Content that may still be completed by an author and is never available to fresh student reads.
|
||||
_Avoid_: Unpublished live question
|
||||
|
||||
**Published Question Content**:
|
||||
Question Content whose current immutable version passed publication safety checks and may be returned as a Safe Question to fresh student reads.
|
||||
_Avoid_: Public content (publication does not mean `scope=PUBLIC`)
|
||||
|
||||
**Archived Question Content**:
|
||||
Previously Published Question Content withdrawn from fresh student reads without changing ownership or previously captured Question Snapshots. It is terminal in the current command surface.
|
||||
_Avoid_: Deleted question, retired question
|
||||
|
||||
**Content Write Authority**:
|
||||
The catalog source allowed to accept authoring commands and produce student-visible read-after-write behavior. Native PostgreSQL authoring is authoritative only in `JAVA_READ`; other provider modes fail before persistence access.
|
||||
_Avoid_: Read provider switch as implicit write permission
|
||||
|
||||
**Question Lifecycle Audit**:
|
||||
An append-only Education domain fact recording actor, content version, and a valid Publication State transition in the same transaction as that transition.
|
||||
_Avoid_: Asynchronous operation log as publication proof
|
||||
|
||||
**Question Placement**:
|
||||
The optimistic assignment of a tenant Draft Question Content item to one active, visible, selectable Content Node that the current tenant may reference. Placement is mutable only while the question is DRAFT and is frozen by publication. It is the current question-classification seam; it is not Category CRUD.
|
||||
_Avoid_: Category assignment, editable published classification
|
||||
|
||||
**Placement Version**:
|
||||
A non-negative optimistic concurrency version for Question Placement. It advances exactly once when the node changes, is independent from the immutable Question Content Version, and participates in publication CAS.
|
||||
_Avoid_: Content version, lifecycle version
|
||||
|
||||
**Content Node Publication State**:
|
||||
The explicit state of a tenant-owned Content Node: Draft is author-editable and student-invisible, Active is immutable and available for student discovery/Question Placement, and Archived is terminal and unavailable.
|
||||
_Avoid_: `is_active` as an independent lifecycle, Category lifecycle
|
||||
|
||||
**Content Node Authoring Version**:
|
||||
The single non-negative optimistic concurrency version advanced exactly once by each Content Node draft revision or lifecycle transition.
|
||||
_Avoid_: Question Placement Version, Question Content Version
|
||||
|
||||
**Content Node Lifecycle Audit**:
|
||||
An append-only Education domain fact recording actor, authoring version, and a valid Content Node Publication State transition in the same transaction.
|
||||
_Avoid_: Operation log as activation proof
|
||||
|
||||
**Manual Question Collection**:
|
||||
A tenant-owned, author-curated ordered set of Published Question Content attached to one existing active, visible Content Node. Its membership is selected explicitly rather than derived from filters, categories, or blueprints.
|
||||
_Avoid_: Dynamic question bank, Category, Practice Blueprint
|
||||
|
||||
**Collection Publication State**:
|
||||
The lifecycle of a Manual Question Collection: Draft is author-editable and undiscoverable, Active is immutable and discoverable through its Content Node, and Archived is terminal and undiscoverable through the collection route.
|
||||
_Avoid_: Question Publication State, hidden flag
|
||||
|
||||
**Collection Authoring Version**:
|
||||
The single non-negative optimistic concurrency version advanced by each accepted draft revision, membership replacement, or collection lifecycle transition.
|
||||
_Avoid_: Question Content Version, Question Placement Version
|
||||
|
||||
**Collection Membership**:
|
||||
The complete ordered list of Published Question Content explicitly curated into a Manual Question Collection. It is replaceable only as a whole while the collection is Draft, and the same question cannot occur more than once.
|
||||
_Avoid_: Dynamic filter result, incremental published playlist
|
||||
|
||||
**Collection Route Discovery**:
|
||||
Student discovery of questions through an Active Manual Question Collection on its Content Node. Archiving the collection closes only this route and does not withdraw directly visible Question Content or alter historical Question Snapshots.
|
||||
_Avoid_: Question publication, snapshot invalidation
|
||||
|
||||
**Collection Access Rules**:
|
||||
Descriptive collection metadata reserved for a future access contract. Its presence does not grant, deny, or prove paid, private, membership, or other entitlement in the current Education model.
|
||||
_Avoid_: Entitlement policy, authorization rule
|
||||
|
||||
**Content Import Asset**:
|
||||
Tenant-owned metadata that identifies one private Infra-managed source object for an Education import. Education owns the business reference and checksum metadata, not generic file storage or a public download URL.
|
||||
_Avoid_: Uploaded file owned by Education, public asset URL
|
||||
|
||||
**Content Import Job**:
|
||||
A tenant-owned durable Education job that previews and, only when safe and executable, imports content from one Content Import Asset. Its five states are `PREVIEW_PENDING`, `PREVIEW_READY`, `EXECUTE_PENDING`, `COMPLETED`, and `FAILED`.
|
||||
_Avoid_: Generic Infra job, export job
|
||||
|
||||
**Import Job Lease**:
|
||||
A fenced, expiring claim on a pending Content Import Job, identified by worker and lease token and kept alive by heartbeat. The aggregate remains `PREVIEW_PENDING` or `EXECUTE_PENDING` while claimed; expiry permits bounded recovery and is not proof that the prior worker stopped.
|
||||
_Avoid_: Redis lock as job ownership, permanent worker assignment
|
||||
|
||||
**Executable Import Preview**:
|
||||
A preview whose source scan is clean and whose available parser produced executable content. Metadata-only CSV/XLSX preview is informative but not executable.
|
||||
_Avoid_: Successful upload, clean scan alone
|
||||
|
||||
**Unavailable Import Scan**:
|
||||
The fail-closed default when no scanner adapter can produce a clean result. `UNAVAILABLE`, infected, and errored scan outcomes all block execution.
|
||||
_Avoid_: Scan skipped, assumed clean
|
||||
|
||||
**Export Redaction Policy**:
|
||||
The request-time rule that authorized Education exports must omit answers and private fields. The current bounded capability defines this policy only; it does not generate an export file or persist an export job.
|
||||
_Avoid_: Delivered export pipeline, downloadable export artifact
|
||||
|
||||
**Protected Answer Key**:
|
||||
Server-only correctness and explanation data captured for stable scoring of a practice session. It is never included in a Safe Question, Question Snapshot JSON, or pre-submit response.
|
||||
_Avoid_: Question Snapshot, frontend answer
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
## 当前状态
|
||||
|
||||
此模块提供教育业务功能骨架、题库目录浏览 tracer bullet,以及题目预览与练习配置预览。
|
||||
此模块提供教育业务功能骨架、题库目录浏览、题目预览与练习闭环,以及 `JAVA_READ` 下的租户题目草稿、目录放置、发布和归档 tracer bullet。
|
||||
|
||||
**已实现**:
|
||||
- 模块骨架与包结构
|
||||
@@ -16,9 +16,10 @@
|
||||
- 练习配置预览端点 (见下方 Practice API) — 学生端已认证
|
||||
- 答案保存端点 (见下方 Answer API) — 幂等保存,安全重试
|
||||
- 题目安全过滤(答案/解析绝不暴露到前端)
|
||||
- 管理端题目创作、目录放置、发布和归档端点 — 仅在 `JAVA_READ` 下接受写入
|
||||
- 独立的功能开关配置 + Scalar 数据源配置
|
||||
- 错误码常量(通用 + 租户 + Catalog/Scalar + 题目/练习)
|
||||
- 权限注解(`education:capability`);菜单种子尚未纳入正式 Flyway,管理员授权需在后续产品决策后交付
|
||||
- System RBAC 权限注解及 V4080/V4090 条件种子(`education:capability`、`education:question:author`、`education:question:classify`、`education:question:publish`、`education:question:archive`);迁移不自动向任何角色授权
|
||||
|
||||
## 功能配置
|
||||
|
||||
@@ -34,9 +35,12 @@ yudao:
|
||||
practice-write-enabled: true
|
||||
# Pilot 灰度租户;空列表表示不限制,生产 Pilot 应显式配置目标租户 ID
|
||||
pilot-tenant-ids: [1024]
|
||||
# SCALAR_READ 是默认读取权威;只有 JAVA_READ 允许本地题目创作
|
||||
catalog-mode: SCALAR_READ
|
||||
```
|
||||
|
||||
`catalog-mode=SCALAR_READ` 时管理端题目写命令会在访问 Mapper 前失败关闭;要使用下述创作 API,必须显式配置 `catalog-mode=JAVA_READ`,确保写入 PostgreSQL 的题目也是学生读取的数据源。
|
||||
|
||||
灰度与回滚约束:
|
||||
|
||||
- `enabled=false`:移除 Education HTTP 能力,不执行任何数据删除。
|
||||
@@ -44,6 +48,7 @@ yudao:
|
||||
- `practice-write-enabled=false`:拒绝新建练习、保存答案和交卷;会话恢复、报告与历史查询保持可用。
|
||||
- `pilot-tenant-ids`:非空时仅允许列表内租户使用题库和练习写入能力。
|
||||
- 应用回滚只回滚应用版本或开关;不得执行 `*-rollback.sql`。SQL 回滚脚本仅用于明确的数据销毁场景。
|
||||
- 回滚到 V4090 之前的应用版本前,必须先切离 `JAVA_READ` 以停止原生题目写入;没有可用替代读取权威时应关闭 Education。V4090 Schema 保留并通过后续更高版本向前修正。
|
||||
|
||||
## API
|
||||
|
||||
@@ -69,6 +74,57 @@ GET /admin-api/education/capability
|
||||
}
|
||||
```
|
||||
|
||||
### 管理后台 - 题目创作与发布
|
||||
|
||||
这些端点只管理当前框架租户的 `TENANT_OWNED` 题目,不提供 PUBLIC/platform-curator 写入口。客户端不能提交 `tenantId`、`scope`、生命周期状态或 actor;新题固定以 `DRAFT/false` 创建,放置到可用 Content Node 后才可发布,并且只允许 `DRAFT → PUBLISHED → ARCHIVED`。
|
||||
|
||||
| 端点 | 权限 | 说明 |
|
||||
|------|------|------|
|
||||
| `POST /admin-api/education/questions/drafts` | `education:question:author` | 创建当前租户草稿,返回题目 ID |
|
||||
| `PUT /admin-api/education/questions/{id}/placement` | `education:question:classify` | 将草稿放置或重新放置到允许的 Content Node,返回放置版本 |
|
||||
| `PUT /admin-api/education/questions/{id}/publish` | `education:question:publish` | 发布当前租户草稿 |
|
||||
| `PUT /admin-api/education/questions/{id}/archive` | `education:question:archive` | 归档当前租户已发布题目 |
|
||||
|
||||
创建草稿请求示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"stem": "2 + 2 = ?",
|
||||
"type": "choice",
|
||||
"difficulty": "easy",
|
||||
"options": [
|
||||
{"label": "A", "content": "4", "order": 1.0},
|
||||
{"label": "B", "content": "5", "order": 2.0}
|
||||
],
|
||||
"correctAnswer": "A",
|
||||
"explanation": "基础加法",
|
||||
"analysis": null
|
||||
}
|
||||
```
|
||||
|
||||
目录放置请求示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"nodeId": 200,
|
||||
"expectedPlacementVersion": 0
|
||||
}
|
||||
```
|
||||
|
||||
放置目标必须是当前租户可读的 PUBLIC 或同租户 Content Node,并且处于 active、非 hidden、selectable 状态。放置使用独立乐观版本;发布后不可重新放置。学生按 node 查询时会在同一条 PostgreSQL 查询中再次检查节点可用性。
|
||||
|
||||
`correctAnswer`、`explanation` 和 `analysis` 是服务端受保护内容;学生端仍只返回下文列出的安全题目投影。发布和归档采用 tenant/scope/expected-state CAS,并在同一事务追加生命周期审计。`SCALAR_READ` 或其他不支持的 provider mode 返回 `1_005_003_070`,不会查询或修改题目。
|
||||
|
||||
| 错误码 | 说明 |
|
||||
|--------|------|
|
||||
| `1_005_003_070` | 当前 provider mode 不支持本地题目创作 |
|
||||
| `1_005_003_071` | 题目不存在或无权管理 |
|
||||
| `1_005_003_072` | 状态已变化或生命周期转换非法 |
|
||||
| `1_005_003_073` | 题目内容不完整或不安全,不能发布 |
|
||||
| `1_005_003_074` | 归类目标不存在或不可用 |
|
||||
| `1_005_003_075` | 归类版本或题目状态已变化 |
|
||||
| `1_005_003_076` | 题目尚未归类,不能发布 |
|
||||
|
||||
### 用户 APP - 教育租户识别
|
||||
|
||||
```
|
||||
@@ -179,12 +235,21 @@ yudao-module-education/src/main/resources/db/migration/education/
|
||||
|
||||
- `V4010` 和 `V4020` 是不可变迁移历史,不得修改。
|
||||
- `V4030` 创建或接管 Practice 核心闭环表,并在存在旧答案/交卷幂等表时向统一 `education_idempotency` 回填数据。
|
||||
- `V4070` 对 19 条目录引用边执行历史预校验并安装写入守卫,同时将 11 张目录表的 `tenant_id/scope` 设为插入后不可变,阻止 PUBLIC→租户、跨租户以及父节点归属变更造成的非法关系。
|
||||
- `V4080` 增加第 20 条目录引用边 `education_question_version.question_id → education_question.id`,并为版本表增加第 12 个 ownership/scope 守卫;版本归属必须与题目完全一致。该迁移还建立 draft-first 生命周期、不可变题目版本、同事务追加式审计及历史已发布内容的 fail-closed 预检。
|
||||
- `V4090` 增加 Question Placement 乐观版本、PUBLIC 管理拒绝、发布后放置冻结、发布前可用节点约束,以及 `education:question:classify` 权限种子。
|
||||
- `V4100` 增加租户 Content Node 的 `DRAFT → ACTIVE → ARCHIVED` 生命周期、统一 `authoring_version` CAS、同事务追加式审计和 entry/parent 结构约束;不写入权限或角色种子。
|
||||
- `V4110` 增加租户 Manual Question Collection 生命周期、ordered replace-all membership 和受保护的生命周期/成员变更 token;`V4210` 通过向前 migration 将物理删除保护扩展到历史 PUBLIC 题集。
|
||||
- `V4120` 增加租户 Category 与 bounded Practice Blueprint 的 `DRAFT → ACTIVE → ARCHIVED` 生命周期、统一 `authoring_version` CAS、事务内追加式审计、独立 RBAC 和学生端路由可见性约束;不授予任何角色。
|
||||
- V4080/V4090 在平台 `system_menu` 已存在时条件写入 Education 权限种子;固定 ID 已被不同 permission 占用时迁移失败,且迁移不会向角色写入授权关系。
|
||||
- 旧 `education_answer_idempotency`、`education_submit_idempotency` 在首次接管时保留,后续清理必须使用更高版本的独立向前 migration。
|
||||
- `sql/postgresql/education/` 是手工初始化/设计历史,`sql/mysql/education/` 是过时归档;两者都不是运行时交付入口。
|
||||
- 禁止使用 `flyway clean` 或 `*-rollback.sql` 回退共享环境。应用回滚后如有 Schema 兼容问题,通过更高版本向前修复。
|
||||
|
||||
首次接管已有 PostgreSQL 平台库时使用既定的 `4009` baseline。任何已存在 Education 表的环境都必须先核对实际表结构和 `flyway_schema_history`,不能仅凭表名视为兼容,也不能伪造 V4010/V4020 执行历史。
|
||||
|
||||
Flyway 必须使用显式的 `FLYWAY_USER`/`FLYWAY_PASSWORD` 迁移所有者账号,且该账号必须与 master 运行时 datasource 账号不同。运维先创建两个互不继承的 LOGIN role,由 Flyway role 拥有目标 schema 和 migration 对象,再仅向 runtime role 授予业务表所需权限;不得授予、继承或拥有 V4080/V4100/V4110 的四张 `*_token` 表。应用启动会检查当前 runtime role 及其成员角色既不是这些表的 owner,也没有 INSERT/UPDATE/DELETE/TRUNCATE 权限;缺表、同角色、继承 owner 或错误授权都会 fail closed。角色创建、密码轮换与 schema 授权由部署平台预置,不由 migration 创建或转移。
|
||||
|
||||
编译后确认 migration 已打包:
|
||||
|
||||
```bash
|
||||
@@ -199,7 +264,7 @@ find yudao-module-education/target/classes/db/migration/education -type f -print
|
||||
**当前工作区未检出完整的前端源码。** `yudao-ui/yudao-ui-admin-vue3/` 仅包含部分 MES 相关文件(`src/api/mes/`、`src/views/mes/`),缺少 `package.json`、`router/`、`store/`、`config/` 等核心框架文件。
|
||||
|
||||
因此:
|
||||
- **管理后台教育菜单项**:当前仅保留 `education:capability` 权限契约,正式 Flyway 尚未写入菜单种子;前端无路由/页面组件可渲染,因此不声明已有可见教育菜单。
|
||||
- **管理后台教育菜单项**:V4080/V4090 已条件写入 Education 权限/菜单记录,但不分配角色;前端仍无路由或页面组件,因此不声明已有可操作的可见教育页面。
|
||||
- **Student Web/H5 应用外壳**:前端源码不存在,无法建立。
|
||||
|
||||
### Student 端前端集成契约
|
||||
|
||||
@@ -24,6 +24,20 @@
|
||||
<artifactId>yudao-module-system</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-infra</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-member</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
@@ -31,6 +45,23 @@
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-promotion</artifactId>
|
||||
<version>${revision}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-trade</artifactId>
|
||||
<version>${revision}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>testcontainers-postgresql</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.education.api.entitlement;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public interface EducationEntitlementApi {
|
||||
Long grant(String sourceSystem, String sourceEventId, Long userId, String resourceType, Long resourceId,
|
||||
Long productSpuId, LocalDateTime validFrom, LocalDateTime expiresAt, LocalDateTime occurredAt);
|
||||
Long revoke(String sourceSystem, String sourceEventId, Long userId, String resourceType, Long resourceId,
|
||||
LocalDateTime occurredAt);
|
||||
Long refund(String sourceSystem, String sourceEventId, Long userId, String resourceType, Long resourceId,
|
||||
LocalDateTime occurredAt);
|
||||
boolean hasAccess(Long tenantId, Long userId, String resourceType, Long resourceId, LocalDateTime now);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.education.api.entitlement;
|
||||
|
||||
import cn.iocoder.yudao.module.education.service.commercialization.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Service
|
||||
public class EducationEntitlementApiImpl implements EducationEntitlementApi {
|
||||
private final EducationEntitlementService service;
|
||||
public EducationEntitlementApiImpl(EducationEntitlementService service) { this.service = service; }
|
||||
public Long grant(String sourceSystem, String sourceEventId, Long userId, String resourceType, Long resourceId,
|
||||
Long productSpuId, LocalDateTime validFrom, LocalDateTime expiresAt, LocalDateTime occurredAt) {
|
||||
return service.apply(new EntitlementCommand(sourceSystem, sourceEventId, "GRANT", userId, resourceType, resourceId,
|
||||
productSpuId, validFrom, expiresAt, occurredAt));
|
||||
}
|
||||
public Long revoke(String sourceSystem, String sourceEventId, Long userId, String resourceType, Long resourceId, LocalDateTime occurredAt) {
|
||||
return service.apply(new EntitlementCommand(sourceSystem, sourceEventId, "REVOKE", userId, resourceType, resourceId,
|
||||
null, null, null, occurredAt));
|
||||
}
|
||||
public Long refund(String sourceSystem, String sourceEventId, Long userId, String resourceType, Long resourceId, LocalDateTime occurredAt) {
|
||||
return service.apply(new EntitlementCommand(sourceSystem, sourceEventId, "REFUND", userId, resourceType, resourceId,
|
||||
null, null, null, occurredAt));
|
||||
}
|
||||
public boolean hasAccess(Long tenantId, Long userId, String resourceType, Long resourceId, LocalDateTime now) {
|
||||
return service.hasAccess(tenantId, userId, resourceType, resourceId, now);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.education.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Verifies that the runtime database role cannot forge protected lifecycle tokens.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class EducationProtectedTokenRoleValidator implements ApplicationRunner {
|
||||
|
||||
private static final List<String> PROTECTED_TABLES = List.of(
|
||||
"education_question_lifecycle_transition_token",
|
||||
"education_content_node_lifecycle_transition_token",
|
||||
"education_question_collection_lifecycle_transition_token",
|
||||
"education_question_collection_membership_token");
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
validate(dataSource);
|
||||
}
|
||||
|
||||
public static void validate(DataSource dataSource) {
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
List<String> unsafeTables = jdbcTemplate.queryForList("""
|
||||
SELECT protected.table_name
|
||||
FROM (VALUES (?), (?), (?), (?)) AS protected(table_name)
|
||||
LEFT JOIN pg_namespace namespace ON namespace.nspname = current_schema()
|
||||
LEFT JOIN pg_class token_table
|
||||
ON token_table.relnamespace = namespace.oid
|
||||
AND token_table.relname = protected.table_name
|
||||
AND token_table.relkind IN ('r', 'p')
|
||||
WHERE token_table.oid IS NULL
|
||||
OR pg_has_role(current_user, token_table.relowner, 'MEMBER')
|
||||
OR has_table_privilege(current_user, token_table.oid, 'INSERT,UPDATE,DELETE,TRUNCATE')
|
||||
ORDER BY protected.table_name
|
||||
""", String.class, PROTECTED_TABLES.toArray());
|
||||
if (!unsafeTables.isEmpty()) {
|
||||
throw new IllegalStateException("Education runtime database role must not own or write protected token tables: "
|
||||
+ String.join(", ", unsafeTables));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +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.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;
|
||||
@@ -36,7 +38,12 @@ public class EducationCapabilityController {
|
||||
.enabled(educationProperties.isEnabled())
|
||||
.version(educationProperties.getVersion())
|
||||
.capabilities(List.of("shell", "catalog", "questions", "practice-preview",
|
||||
"answer-save", "session-submit", "practice-report"))
|
||||
"answer-save", "session-submit", "practice-report", "vocabulary-review",
|
||||
"exam-reminder", "learning-award", "student-feedback", "learning-summary",
|
||||
"tenant-leaderboard", "content-import-assets", "content-import-jobs",
|
||||
"content-export-policy", "class-management", "class-invitations",
|
||||
"education-entitlements", "resource-product-bindings"))
|
||||
.themes(describeThemes())
|
||||
.catalogReadEnabled(educationProperties.isCatalogReadEnabled())
|
||||
.practiceWriteEnabled(educationProperties.isPracticeWriteEnabled())
|
||||
.pilotTenantCount(educationProperties.getPilotTenantIds().size())
|
||||
@@ -44,4 +51,51 @@ 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", "PARTIAL",
|
||||
List.of("education", "infra"),
|
||||
List.of("production-scanner-adapter", "production-import-parser", "export-artifact-generation"),
|
||||
List.of(), "FEATURE_FLAG", "POSTGRESQL_INTEGRATION_TESTED"),
|
||||
theme("EDU-012", "classes-relationships", "BOUNDED_IMPLEMENTED",
|
||||
List.of("education", "member", "system"),
|
||||
List.of("teacher-role-expansion", "platform-admin-cross-tenant-operations"),
|
||||
List.of(), "FEATURE_FLAG", "POSTGRESQL_INTEGRATION_TESTED",
|
||||
List.of("/admin-api/education/classes", "/app-api/education/class-invitations")),
|
||||
theme("EDU-013", "commercialization", "BOUNDED_IMPLEMENTED",
|
||||
List.of("education", "mall", "pay", "member", "crm"),
|
||||
List.of("mall-order-item-public-event", "pay-refund-public-event", "crm-referral-contract"),
|
||||
List.of(), "ACCESS_FAIL_CLOSED", "POSTGRESQL_INTEGRATION_TESTED",
|
||||
List.of("/admin-api/education/commercialization", "EducationEntitlementApi")),
|
||||
theme("EDU-014", "extended-learning", "PARTIAL",
|
||||
List.of("education", "member", "system"),
|
||||
List.of("video-entitlement-contract", "ai-recommendation-contract", "legacy-data-import"),
|
||||
List.of(), "FEATURE_FLAG", "INTEGRATION_TESTED",
|
||||
List.of("vocabulary-review", "exam-reminder", "learning-award", "student-feedback",
|
||||
"learning-summary", "tenant-leaderboard")),
|
||||
theme("EDU-015", "operational-independence",
|
||||
catalogDependencies.isEmpty() ? "TARGET_READY" : "LEGACY_DEPENDENT",
|
||||
List.of("education", "infra"),
|
||||
List.of(),
|
||||
catalogDependencies, "PROVIDER_SWITCH", "RUNTIME_PROBED",
|
||||
List.of("/admin-api/education/operations/health")));
|
||||
}
|
||||
|
||||
private EducationThemeRespVO theme(String key, String name, String status, List<String> owningModules,
|
||||
List<String> blockers, List<String> legacyDependencies, String rollbackCategory, String evidenceLevel) {
|
||||
return theme(key, name, status, owningModules, blockers, legacyDependencies, rollbackCategory, evidenceLevel,
|
||||
List.of());
|
||||
}
|
||||
|
||||
private EducationThemeRespVO theme(String key, String name, String status, List<String> owningModules,
|
||||
List<String> blockers, List<String> legacyDependencies, String rollbackCategory, String evidenceLevel,
|
||||
List<String> executableInterfaces) {
|
||||
return EducationThemeRespVO.builder()
|
||||
.key(key).name(name).status(status).owningModules(owningModules)
|
||||
.executableInterfaces(executableInterfaces).blockers(blockers).legacyDependencies(legacyDependencies)
|
||||
.rollbackCategory(rollbackCategory).evidenceLevel(evidenceLevel).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.activationcode;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.*;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.activationcode.vo.ActivationCodeAdminVOs.*;
|
||||
import cn.iocoder.yudao.module.education.service.activationcode.ActivationCodeService;
|
||||
import io.swagger.v3.oas.annotations.*;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name="管理后台 - 学习激活码") @RestController @RequestMapping("/education/activation-code") @Validated
|
||||
public class ActivationCodeAdminController {
|
||||
private final ActivationCodeService service;
|
||||
public ActivationCodeAdminController(ActivationCodeService service){this.service=service;}
|
||||
@GetMapping("/batch/page") @Operation(summary="分页查询激活码批次")
|
||||
@PreAuthorize("@ss.hasPermission('education:activation-code:query')")
|
||||
public CommonResult<PageResult<BatchResp>> batchPage(@Valid BatchPageReq req){return success(service.batchPage(req));}
|
||||
@PostMapping("/batch") @Operation(summary="创建激活码批次")
|
||||
@PreAuthorize("@ss.hasPermission('education:activation-code:manage')")
|
||||
public CommonResult<BatchResp> create(@Valid @RequestBody BatchSaveReq req){return success(service.createBatch(req,getLoginUserId()));}
|
||||
@PutMapping("/batch/{id}") @Operation(summary="修改激活码批次")
|
||||
@PreAuthorize("@ss.hasPermission('education:activation-code:manage')")
|
||||
public CommonResult<BatchResp> update(@PathVariable Long id,@Valid @RequestBody BatchSaveReq req){return success(service.updateBatch(id,req,getLoginUserId()));}
|
||||
@PostMapping("/batch/{id}/generate") @Operation(summary="安全生成激活码(明文仅在本次响应返回)")
|
||||
@PreAuthorize("@ss.hasPermission('education:activation-code:generate')")
|
||||
public CommonResult<GenerateResp> generate(@PathVariable Long id,@Valid @RequestBody GenerateReq req){return success(service.generate(id,req,getLoginUserId()));}
|
||||
@GetMapping("/code/page") @Operation(summary="分页查询激活码掩码与兑换状态")
|
||||
@PreAuthorize("@ss.hasPermission('education:activation-code:query')")
|
||||
public CommonResult<PageResult<CodeResp>> codePage(@Valid CodePageReq req){return success(service.codePage(req));}
|
||||
@PutMapping("/code/{id}/disable") @Operation(summary="停用未兑换激活码")
|
||||
@PreAuthorize("@ss.hasPermission('education:activation-code:manage')")
|
||||
public CommonResult<CodeResp> disable(@PathVariable Long id,@RequestParam Integer expectedVersion){return success(service.disable(id,expectedVersion));}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.activationcode.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public final class ActivationCodeAdminVOs {
|
||||
private ActivationCodeAdminVOs() {}
|
||||
|
||||
@Data @EqualsAndHashCode(callSuper = true)
|
||||
public static class BatchPageReq extends PageParam { @Size(max=120) private String keyword; private String status; }
|
||||
@Data public static class BatchSaveReq {
|
||||
@NotBlank @Size(max=120) private String name;
|
||||
@NotNull @Positive private Long productSpuId;
|
||||
@NotNull @Min(0) @Max(3650) private Integer durationDays;
|
||||
@Pattern(regexp="[A-Za-z0-9]{0,12}") private String codePrefix;
|
||||
private String status;
|
||||
private Integer expectedVersion;
|
||||
}
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor public static class BatchResp {
|
||||
private Long id; private String name; private Long productSpuId; private Integer durationDays;
|
||||
private String codePrefix; private String status; private Integer totalCount; private Integer redeemedCount;
|
||||
private Integer version; private LocalDateTime createTime; private LocalDateTime updateTime;
|
||||
}
|
||||
@Data public static class GenerateReq { @NotNull @Min(1) @Max(1000) private Integer count; @NotNull private Integer expectedVersion; }
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor public static class GeneratedCodeResp {
|
||||
private Long id; private String code; private String codeMasked; private Integer version;
|
||||
}
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor public static class GenerateResp {
|
||||
private BatchResp batch; private List<GeneratedCodeResp> codes;
|
||||
}
|
||||
@Data @EqualsAndHashCode(callSuper = true)
|
||||
public static class CodePageReq extends PageParam { private Long batchId; private String status; }
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor public static class CodeResp {
|
||||
private Long id; private Long batchId; private String codeMasked; private String status; private Long redeemedBy;
|
||||
private LocalDateTime redeemedAt; private Long entitlementId; private Integer version; private LocalDateTime createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.appearance;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.appearance.vo.TenantAppearanceVOs.*;
|
||||
import cn.iocoder.yudao.module.education.service.appearance.TenantAppearanceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 教育租户外观")
|
||||
@RestController
|
||||
@RequestMapping("/education/tenant-appearance")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class TenantAppearanceAdminController {
|
||||
|
||||
private final TenantAppearanceService service;
|
||||
|
||||
public TenantAppearanceAdminController(TenantAppearanceService service) { this.service = service; }
|
||||
|
||||
@GetMapping
|
||||
@Operation(summary = "获取当前租户外观、公开设置与主题草稿")
|
||||
@PreAuthorize("@ss.hasPermission('education:tenant-appearance:query')")
|
||||
public CommonResult<AppearanceResp> get() { return success(service.getAppearance()); }
|
||||
|
||||
@PutMapping("/branding")
|
||||
@Operation(summary = "更新品牌外观")
|
||||
@PreAuthorize("@ss.hasPermission('education:tenant-appearance:branding')")
|
||||
public CommonResult<AppearanceResp> updateBranding(@Valid @RequestBody BrandingSaveReq req) {
|
||||
return success(service.updateBranding(req, getLoginUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/settings")
|
||||
@Operation(summary = "更新学生端与管理端功能设置")
|
||||
@PreAuthorize("@ss.hasPermission('education:tenant-appearance:settings')")
|
||||
public CommonResult<AppearanceResp> updateSettings(@Valid @RequestBody SettingsSaveReq req) {
|
||||
return success(service.updateSettings(req, getLoginUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/theme-templates")
|
||||
@Operation(summary = "获取平台主题模板")
|
||||
@PreAuthorize("@ss.hasPermission('education:tenant-appearance:query')")
|
||||
public CommonResult<List<ThemeTemplateResp>> templates() { return success(service.getThemeTemplates()); }
|
||||
|
||||
@PostMapping("/theme/preview")
|
||||
@Operation(summary = "保存主题预览草稿")
|
||||
@PreAuthorize("@ss.hasPermission('education:tenant-appearance:theme')")
|
||||
public CommonResult<AppearanceResp> preview(@Valid @RequestBody ThemePreviewReq req) {
|
||||
return success(service.previewTheme(req, getLoginUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/theme/publish")
|
||||
@Operation(summary = "发布主题草稿或模板")
|
||||
@PreAuthorize("@ss.hasPermission('education:tenant-appearance:theme')")
|
||||
public CommonResult<AppearanceResp> publish(@Valid @RequestBody ThemePublishReq req) {
|
||||
return success(service.publishTheme(req, getLoginUserId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.appearance.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
public final class TenantAppearanceVOs {
|
||||
private TenantAppearanceVOs() {}
|
||||
|
||||
@Data
|
||||
public static class BrandingSaveReq {
|
||||
@NotBlank @Size(max = 120) private String brandName;
|
||||
@Size(max = 80) private String shortName;
|
||||
@Size(max = 240) private String slogan;
|
||||
@Size(max = 160) private String orgName;
|
||||
@Size(max = 500) private String logoUrl;
|
||||
@Size(max = 500) private String faviconUrl;
|
||||
@Size(max = 120) private String serviceWechat;
|
||||
@Size(max = 120) private String serviceAccountName;
|
||||
@NotNull @Min(0) private Integer expectedVersion;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class SettingsSaveReq {
|
||||
private Map<String, Object> featureFlags;
|
||||
private Map<String, Object> adminFeatureFlags;
|
||||
private Map<String, Object> publicConfig;
|
||||
@NotNull @Min(0) private Integer expectedVersion;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ThemePreviewReq {
|
||||
@NotBlank @Pattern(regexp = "[A-Za-z0-9][A-Za-z0-9_-]{1,63}") private String templateCode;
|
||||
private Map<String, Object> theme;
|
||||
private Map<String, Object> publicAssets;
|
||||
@NotNull @Min(0) private Integer expectedVersion;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ThemePublishReq {
|
||||
private Boolean useDraft;
|
||||
@Pattern(regexp = "[A-Za-z0-9][A-Za-z0-9_-]{1,63}") private String templateCode;
|
||||
private Map<String, Object> theme;
|
||||
private Map<String, Object> publicAssets;
|
||||
@NotNull @Min(0) private Integer expectedVersion;
|
||||
}
|
||||
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
||||
public static class AppearanceResp {
|
||||
private Long tenantId;
|
||||
private String systemTenantName;
|
||||
private String brandName;
|
||||
private String shortName;
|
||||
private String slogan;
|
||||
private String orgName;
|
||||
private String logoUrl;
|
||||
private String faviconUrl;
|
||||
private String serviceWechat;
|
||||
private String serviceAccountName;
|
||||
private Map<String, Object> featureFlags;
|
||||
private Map<String, Object> adminFeatureFlags;
|
||||
private Map<String, Object> publicConfig;
|
||||
private String activeTemplateCode;
|
||||
private Map<String, Object> activeTheme;
|
||||
private Map<String, Object> activePublicAssets;
|
||||
private String draftTemplateCode;
|
||||
private Map<String, Object> draftTheme;
|
||||
private Map<String, Object> draftPublicAssets;
|
||||
private String themeStatus;
|
||||
private LocalDateTime publishedTime;
|
||||
private Long publishedBy;
|
||||
private String publishedByNickname;
|
||||
private Long draftUpdatedBy;
|
||||
private String draftUpdatedByNickname;
|
||||
private Integer version;
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
||||
public static class ThemeTemplateResp {
|
||||
private String code;
|
||||
private String name;
|
||||
private String description;
|
||||
private String previewImageUrl;
|
||||
private Map<String, Object> theme;
|
||||
private Map<String, Object> publicAssets;
|
||||
private Integer sortOrder;
|
||||
}
|
||||
|
||||
@Schema(description = "学生端公开租户外观与功能配置")
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
||||
public static class PublicAppearanceResp {
|
||||
private Long tenantId;
|
||||
private String brandName;
|
||||
private String shortName;
|
||||
private String slogan;
|
||||
private String logoUrl;
|
||||
private String faviconUrl;
|
||||
private String serviceWechat;
|
||||
private String serviceAccountName;
|
||||
private Map<String, Object> theme;
|
||||
private Map<String, Object> publicAssets;
|
||||
private Map<String, Object> featureFlags;
|
||||
private Map<String, Object> publicConfig;
|
||||
private LocalDateTime publishedTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.asset;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.asset.vo.EducationImportAssetRespVO;
|
||||
import cn.iocoder.yudao.module.education.service.asset.EducationAssetAdmissionService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestPart;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/import-assets")
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class EducationAssetAdmissionController {
|
||||
|
||||
private final EducationAssetAdmissionService service;
|
||||
|
||||
public EducationAssetAdmissionController(EducationAssetAdmissionService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPermission('education:import-asset:create')")
|
||||
public CommonResult<EducationImportAssetRespVO> admit(@RequestPart("file") MultipartFile file) {
|
||||
return success(service.admit(file, getLoginUserId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.asset.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class EducationImportAssetRespVO {
|
||||
private Long id;
|
||||
private String originalName;
|
||||
private String contentType;
|
||||
private Long size;
|
||||
private String sha256;
|
||||
private String scanStatus;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.badge;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.badge.vo.BadgeAdminVOs.*;
|
||||
import cn.iocoder.yudao.module.education.service.badge.BadgeAdminService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 学习徽章")
|
||||
@RestController
|
||||
@RequestMapping("/education/badge")
|
||||
@Validated
|
||||
public class BadgeAdminController {
|
||||
private final BadgeAdminService service;
|
||||
public BadgeAdminController(BadgeAdminService service) { this.service = service; }
|
||||
|
||||
@GetMapping("/definition/page") @Operation(summary = "分页查询徽章定义")
|
||||
@PreAuthorize("@ss.hasPermission('education:badge:query')")
|
||||
public CommonResult<PageResult<DefinitionResp>> definitionPage(@Valid DefinitionPageReq req) {
|
||||
return success(service.getDefinitionPage(req));
|
||||
}
|
||||
@PostMapping("/definition") @Operation(summary = "创建徽章定义")
|
||||
@PreAuthorize("@ss.hasPermission('education:badge:write')")
|
||||
public CommonResult<DefinitionResp> create(@Valid @RequestBody DefinitionSaveReq req) {
|
||||
return success(service.createDefinition(req, getLoginUserId()));
|
||||
}
|
||||
@PutMapping("/definition/{id}") @Operation(summary = "修改徽章定义")
|
||||
@PreAuthorize("@ss.hasPermission('education:badge:write')")
|
||||
public CommonResult<DefinitionResp> update(@PathVariable Long id, @Valid @RequestBody DefinitionSaveReq req) {
|
||||
return success(service.updateDefinition(id, req, getLoginUserId()));
|
||||
}
|
||||
@GetMapping("/grant/page") @Operation(summary = "分页查询徽章发放记录")
|
||||
@PreAuthorize("@ss.hasPermission('education:badge:query')")
|
||||
public CommonResult<PageResult<GrantResp>> grantPage(@Valid GrantPageReq req) {
|
||||
return success(service.getGrantPage(req));
|
||||
}
|
||||
@PostMapping("/grant") @Operation(summary = "向会员手工发放徽章")
|
||||
@PreAuthorize("@ss.hasPermission('education:badge:grant')")
|
||||
public CommonResult<GrantResp> grant(@Valid @RequestBody ManualGrantReq req) {
|
||||
return success(service.grant(req, getLoginUserId()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.badge.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
public final class BadgeAdminVOs {
|
||||
private BadgeAdminVOs() {}
|
||||
|
||||
@Data @EqualsAndHashCode(callSuper = true)
|
||||
public static class DefinitionPageReq extends PageParam {
|
||||
@Size(max = 120) private String keyword;
|
||||
private String category;
|
||||
private String triggerType;
|
||||
private String status;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class DefinitionSaveReq {
|
||||
@NotBlank @Pattern(regexp = "[A-Za-z0-9][A-Za-z0-9_-]{1,63}") private String code;
|
||||
@NotBlank @Size(max = 120) private String name;
|
||||
@Size(max = 1000) private String description;
|
||||
private String category;
|
||||
@Size(max = 500) private String iconUrl;
|
||||
@Min(0) @Max(100) private Integer level;
|
||||
private String triggerType;
|
||||
private String metric;
|
||||
private String operator;
|
||||
@DecimalMin("0") private BigDecimal thresholdValue;
|
||||
private Map<String, Object> conditionExtra;
|
||||
@Min(0) @Max(100000) private Integer sortOrder;
|
||||
private String status;
|
||||
private Integer expectedVersion;
|
||||
}
|
||||
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
||||
public static class DefinitionResp {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String name;
|
||||
private String description;
|
||||
private String category;
|
||||
private String iconUrl;
|
||||
private Integer level;
|
||||
private String triggerType;
|
||||
private String metric;
|
||||
private String operator;
|
||||
private BigDecimal thresholdValue;
|
||||
private Map<String, Object> conditionExtra;
|
||||
private Integer sortOrder;
|
||||
private String status;
|
||||
private Integer version;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
@Data @EqualsAndHashCode(callSuper = true)
|
||||
public static class GrantPageReq extends PageParam {
|
||||
private Long userId;
|
||||
private Long badgeDefinitionId;
|
||||
private String awardSource;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class ManualGrantReq {
|
||||
@NotNull private Long badgeDefinitionId;
|
||||
@NotNull private Long userId;
|
||||
@Size(max = 1000) private String note;
|
||||
private Map<String, Object> evidence;
|
||||
}
|
||||
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
||||
public static class GrantResp {
|
||||
private Long id;
|
||||
private Long userId;
|
||||
private String userNickname;
|
||||
private Long badgeDefinitionId;
|
||||
private String badgeCode;
|
||||
private String badgeName;
|
||||
private String badgeCategory;
|
||||
private String awardSource;
|
||||
private String grantNote;
|
||||
private Map<String, Object> grantEvidence;
|
||||
private Long grantedBy;
|
||||
private String grantedByNickname;
|
||||
private String notifyStatus;
|
||||
private String notifyError;
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
||||
@Data @Builder @NoArgsConstructor @AllArgsConstructor
|
||||
public static class MemberBadgeResp {
|
||||
private Long badgeDefinitionId;
|
||||
private String code;
|
||||
private String name;
|
||||
private String description;
|
||||
private String category;
|
||||
private String iconUrl;
|
||||
private Integer level;
|
||||
private boolean earned;
|
||||
private String awardSource;
|
||||
private Map<String, Object> evidence;
|
||||
private LocalDateTime grantedTime;
|
||||
@JsonIgnore private Long grantId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.blueprint;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.blueprint.vo.*;
|
||||
import cn.iocoder.yudao.module.education.service.blueprint.authoring.*;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/practice-blueprints")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class PracticeBlueprintAuthoringController {
|
||||
private final PracticeBlueprintAuthoringService service;
|
||||
public PracticeBlueprintAuthoringController(PracticeBlueprintAuthoringService service) { this.service = service; }
|
||||
|
||||
@GetMapping("/page") @PreAuthorize("@ss.hasPermission('education:practice-blueprint:query')")
|
||||
public CommonResult<PageResult<PracticeBlueprintAuthoringRespVO>> getPage(@Valid PageParam pageParam) {
|
||||
return success(BeanUtils.toBean(service.getPage(pageParam), PracticeBlueprintAuthoringRespVO.class));
|
||||
}
|
||||
@GetMapping("/get") @PreAuthorize("@ss.hasPermission('education:practice-blueprint:query')")
|
||||
public CommonResult<PracticeBlueprintAuthoringRespVO> get(@RequestParam("id") Long id) {
|
||||
return success(BeanUtils.toBean(service.get(id), PracticeBlueprintAuthoringRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/drafts") @PreAuthorize("@ss.hasPermission('education:practice-blueprint:author')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody PracticeBlueprintDraftReqVO request) {
|
||||
return success(service.createDraft(toCommand(request, null)));
|
||||
}
|
||||
@PutMapping("/{id}/draft") @PreAuthorize("@ss.hasPermission('education:practice-blueprint:update')")
|
||||
public CommonResult<Integer> revise(@PathVariable Long id, @Valid @RequestBody PracticeBlueprintReviseReqVO request) {
|
||||
return success(service.reviseDraft(id, toCommand(request, request.getExpectedAuthoringVersion())));
|
||||
}
|
||||
@PutMapping("/{id}/activate") @PreAuthorize("@ss.hasPermission('education:practice-blueprint:publish')")
|
||||
public CommonResult<Integer> activate(@PathVariable Long id, @RequestParam int expectedAuthoringVersion) {
|
||||
return success(service.activate(id, expectedAuthoringVersion, getLoginUserId()));
|
||||
}
|
||||
@PutMapping("/{id}/archive") @PreAuthorize("@ss.hasPermission('education:practice-blueprint:archive')")
|
||||
public CommonResult<Integer> archive(@PathVariable Long id, @RequestParam int expectedAuthoringVersion) {
|
||||
return success(service.archive(id, expectedAuthoringVersion, getLoginUserId()));
|
||||
}
|
||||
private PracticeBlueprintAuthoringCommand toCommand(PracticeBlueprintDraftReqVO r, Integer version) {
|
||||
return new PracticeBlueprintAuthoringCommand(r.getMode(), r.getNodeId(), r.getCollectionId(),
|
||||
r.getQuestionLimit(), r.getDurationMinutes(), r.getAvailableTypes(), r.getMinQuestions(),
|
||||
r.getMaxQuestions(), r.getSuggestedCount(), version);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.blueprint.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PracticeBlueprintAuthoringRespVO {
|
||||
private Long id;
|
||||
private String mode;
|
||||
private Long entryId;
|
||||
private Long nodeId;
|
||||
private Long collectionId;
|
||||
private Integer questionLimit;
|
||||
private Integer durationMinutes;
|
||||
private Integer eligibleCount;
|
||||
private Integer totalCount;
|
||||
private String availableTypes;
|
||||
private String availableDifficulties;
|
||||
private Integer minQuestions;
|
||||
private Integer maxQuestions;
|
||||
private Integer suggestedCount;
|
||||
private Boolean isActive;
|
||||
private String publicationStatus;
|
||||
private Integer authoringVersion;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.blueprint.vo;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PracticeBlueprintDraftReqVO {
|
||||
@NotBlank @Pattern(regexp = "NODE|COLLECTION") private String mode;
|
||||
private Long nodeId;
|
||||
private Long collectionId;
|
||||
@Positive private Integer questionLimit;
|
||||
@Positive private Integer durationMinutes;
|
||||
private List<@NotBlank @Size(max = 32) String> availableTypes;
|
||||
@NotNull @Positive private Integer minQuestions;
|
||||
@NotNull @Positive private Integer maxQuestions;
|
||||
@NotNull @Positive private Integer suggestedCount;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.blueprint.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PracticeBlueprintReviseReqVO extends PracticeBlueprintDraftReqVO {
|
||||
@NotNull private Integer expectedAuthoringVersion;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.category;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.category.vo.CategoryAuthoringRespVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.category.vo.CategoryDraftReqVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.category.vo.CategoryReviseReqVO;
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.CategoryDO;
|
||||
import cn.iocoder.yudao.module.education.service.category.authoring.CategoryAuthoringCommand;
|
||||
import cn.iocoder.yudao.module.education.service.category.authoring.CategoryAuthoringService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/categories")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class CategoryAuthoringController {
|
||||
private final CategoryAuthoringService service;
|
||||
|
||||
public CategoryAuthoringController(CategoryAuthoringService service) { this.service = service; }
|
||||
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('education:category:query')")
|
||||
public CommonResult<PageResult<CategoryAuthoringRespVO>> page(@Valid PageParam pageParam) {
|
||||
PageResult<CategoryDO> source = service.getPage(pageParam);
|
||||
return success(new PageResult<>(source.getList().stream()
|
||||
.map(CategoryAuthoringRespVO::from)
|
||||
.toList(), source.getTotal()));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('education:category:query')")
|
||||
public CommonResult<CategoryAuthoringRespVO> get(@PathVariable("id") Long id) {
|
||||
return success(CategoryAuthoringRespVO.from(service.get(id)));
|
||||
}
|
||||
|
||||
@PostMapping("/drafts")
|
||||
@PreAuthorize("@ss.hasPermission('education:category:author')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody CategoryDraftReqVO request) {
|
||||
return success(service.createDraft(toCommand(request, null)));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/draft")
|
||||
@PreAuthorize("@ss.hasPermission('education:category:author')")
|
||||
public CommonResult<Integer> revise(@PathVariable("id") Long id, @Valid @RequestBody CategoryReviseReqVO request) {
|
||||
return success(service.reviseDraft(id, toCommand(request, request.getExpectedAuthoringVersion())));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/activate")
|
||||
@PreAuthorize("@ss.hasPermission('education:category:publish')")
|
||||
public CommonResult<Integer> activate(@PathVariable("id") Long id,
|
||||
@RequestParam("expectedAuthoringVersion") int expectedVersion) {
|
||||
return success(service.activate(id, expectedVersion, getLoginUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/archive")
|
||||
@PreAuthorize("@ss.hasPermission('education:category:archive')")
|
||||
public CommonResult<Integer> archive(@PathVariable("id") Long id,
|
||||
@RequestParam("expectedAuthoringVersion") int expectedVersion) {
|
||||
return success(service.archive(id, expectedVersion, getLoginUserId()));
|
||||
}
|
||||
|
||||
private CategoryAuthoringCommand toCommand(CategoryDraftReqVO request, Integer expectedVersion) {
|
||||
return new CategoryAuthoringCommand(request.getSubjectId(), request.getLegacyNodeId(), request.getName(),
|
||||
request.getSortOrder(), expectedVersion);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.category.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.catalog.CategoryDO;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CategoryAuthoringRespVO {
|
||||
private Long id;
|
||||
private Long subjectId;
|
||||
private String legacyNodeId;
|
||||
private String name;
|
||||
private Boolean active;
|
||||
private String status;
|
||||
private Integer authoringVersion;
|
||||
private Integer sortOrder;
|
||||
|
||||
public static CategoryAuthoringRespVO from(CategoryDO source) {
|
||||
CategoryAuthoringRespVO target = new CategoryAuthoringRespVO();
|
||||
target.id = source.getId();
|
||||
target.subjectId = source.getSubjectId();
|
||||
target.legacyNodeId = source.getLegacyNodeId();
|
||||
target.name = source.getName();
|
||||
target.active = source.getIsActive();
|
||||
target.status = source.getPublicationStatus();
|
||||
target.authoringVersion = source.getAuthoringVersion();
|
||||
target.sortOrder = source.getSortOrder();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.category.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CategoryDraftReqVO {
|
||||
@NotNull private Long subjectId;
|
||||
@Size(max = 100) private String legacyNodeId;
|
||||
@NotBlank @Size(max = 200) private String name;
|
||||
private Integer sortOrder;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.category.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CategoryReviseReqVO extends CategoryDraftReqVO {
|
||||
@NotNull private Integer expectedAuthoringVersion;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.classroom;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.classroom.vo.*;
|
||||
import cn.iocoder.yudao.module.education.service.classroom.EducationClassService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/classes")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class EducationClassController {
|
||||
private final EducationClassService service;
|
||||
public EducationClassController(EducationClassService service) { this.service = service; }
|
||||
|
||||
@PostMapping
|
||||
@PreAuthorize("@ss.hasPermission('education:class:create')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody EducationClassCreateReqVO request) {
|
||||
return success(service.createClass(request.getName(), request.getDescription()));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@PreAuthorize("@ss.hasPermission('education:class:query')")
|
||||
public CommonResult<List<EducationClassRespVO>> list() {
|
||||
return success(service.listClasses().stream().map(EducationClassRespVO::from).toList());
|
||||
}
|
||||
|
||||
@GetMapping("/{classId}/members")
|
||||
@PreAuthorize("@ss.hasPermission('education:class-member:query')")
|
||||
public CommonResult<List<EducationClassMemberRespVO>> members(@PathVariable Long classId) {
|
||||
return success(service.listMembers(classId).stream().map(EducationClassMemberRespVO::from).toList());
|
||||
}
|
||||
|
||||
@PostMapping("/{classId}/invitations")
|
||||
@PreAuthorize("@ss.hasPermission('education:class-invitation:create')")
|
||||
public CommonResult<EducationClassInvitationRespVO> invite(
|
||||
@PathVariable Long classId, @Valid @RequestBody EducationClassInvitationCreateReqVO request) {
|
||||
return success(EducationClassInvitationRespVO.from(service.createInvitation(classId,
|
||||
request.getInviteeMemberUserId(), request.getRole(), request.getExpiresAt(),
|
||||
request.getIdempotencyKey(), getLoginUserId())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.classroom.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EducationClassCreateReqVO {
|
||||
@NotBlank @Size(max = 100) private String name;
|
||||
@Size(max = 500) private String description;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.classroom.vo;
|
||||
|
||||
import jakarta.validation.constraints.Future;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class EducationClassInvitationCreateReqVO {
|
||||
@NotNull private Long inviteeMemberUserId;
|
||||
@NotBlank @Pattern(regexp = "STUDENT|TEACHER") private String role;
|
||||
@NotNull @Future private LocalDateTime expiresAt;
|
||||
@NotBlank @Size(max = 64) private String idempotencyKey;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.classroom.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.classroom.EducationClassInvitationDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class EducationClassInvitationRespVO {
|
||||
private Long id;
|
||||
private Long classId;
|
||||
private Long inviteeMemberUserId;
|
||||
private String role;
|
||||
private String status;
|
||||
private LocalDateTime expiresAt;
|
||||
private LocalDateTime acceptedAt;
|
||||
|
||||
public static EducationClassInvitationRespVO from(EducationClassInvitationDO source) {
|
||||
EducationClassInvitationRespVO target = new EducationClassInvitationRespVO();
|
||||
target.id = source.getId(); target.classId = source.getClassId();
|
||||
target.inviteeMemberUserId = source.getInviteeMemberUserId(); target.role = source.getRole();
|
||||
target.status = source.getStatus(); target.expiresAt = source.getExpiresAt();
|
||||
target.acceptedAt = source.getAcceptedAt();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.classroom.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.classroom.EducationClassMemberDO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class EducationClassMemberRespVO {
|
||||
private Long id;
|
||||
private Long classId;
|
||||
private Long memberUserId;
|
||||
private String role;
|
||||
private LocalDateTime joinedAt;
|
||||
|
||||
public static EducationClassMemberRespVO from(EducationClassMemberDO source) {
|
||||
EducationClassMemberRespVO target = new EducationClassMemberRespVO();
|
||||
target.id = source.getId(); target.classId = source.getClassId(); target.memberUserId = source.getMemberUserId();
|
||||
target.role = source.getRole(); target.joinedAt = source.getJoinedAt();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.classroom.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.dal.dataobject.classroom.EducationClassDO;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EducationClassRespVO {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String description;
|
||||
private String status;
|
||||
|
||||
public static EducationClassRespVO from(EducationClassDO source) {
|
||||
EducationClassRespVO target = new EducationClassRespVO();
|
||||
target.id = source.getId(); target.name = source.getName(); target.description = source.getDescription();
|
||||
target.status = source.getStatus();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.collection;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.collection.vo.*;
|
||||
import cn.iocoder.yudao.module.education.service.collection.authoring.*;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/question-collections")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class QuestionCollectionAuthoringController {
|
||||
private final QuestionCollectionAuthoringService service;
|
||||
public QuestionCollectionAuthoringController(QuestionCollectionAuthoringService service) { this.service = service; }
|
||||
|
||||
@GetMapping("/page") @PreAuthorize("@ss.hasPermission('education:collection:query')")
|
||||
public CommonResult<PageResult<QuestionCollectionAuthoringRespVO>> getPage(@Valid PageParam pageParam) {
|
||||
return success(BeanUtils.toBean(service.getPage(pageParam), QuestionCollectionAuthoringRespVO.class));
|
||||
}
|
||||
@GetMapping("/get") @PreAuthorize("@ss.hasPermission('education:collection:query')")
|
||||
public CommonResult<QuestionCollectionAuthoringRespVO> get(@RequestParam("id") Long id) {
|
||||
return success(BeanUtils.toBean(service.get(id), QuestionCollectionAuthoringRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/drafts") @PreAuthorize("@ss.hasPermission('education:collection:author')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody QuestionCollectionDraftReqVO request) {
|
||||
return success(service.createDraft(toCommand(request, null)));
|
||||
}
|
||||
@PutMapping("/{id}/draft") @PreAuthorize("@ss.hasPermission('education:collection:update')")
|
||||
public CommonResult<Integer> revise(@PathVariable Long id, @Valid @RequestBody QuestionCollectionReviseReqVO request) {
|
||||
return success(service.reviseDraft(id, toCommand(request, request.getExpectedAuthoringVersion())));
|
||||
}
|
||||
@PutMapping("/{id}/membership") @PreAuthorize("@ss.hasPermission('education:collection:update')")
|
||||
public CommonResult<Integer> replaceMembership(@PathVariable Long id, @Valid @RequestBody QuestionCollectionMembershipReqVO request) {
|
||||
return success(service.replaceMembership(id, request.getQuestionIds(), request.getExpectedAuthoringVersion()));
|
||||
}
|
||||
@PutMapping("/{id}/activate") @PreAuthorize("@ss.hasPermission('education:collection:publish')")
|
||||
public CommonResult<Integer> activate(@PathVariable Long id, @RequestParam int expectedAuthoringVersion) {
|
||||
return success(service.activate(id, expectedAuthoringVersion, getLoginUserId()));
|
||||
}
|
||||
@PutMapping("/{id}/archive") @PreAuthorize("@ss.hasPermission('education:collection:archive')")
|
||||
public CommonResult<Integer> archive(@PathVariable Long id, @RequestParam int expectedAuthoringVersion) {
|
||||
return success(service.archive(id, expectedAuthoringVersion, getLoginUserId()));
|
||||
}
|
||||
private QuestionCollectionAuthoringCommand toCommand(QuestionCollectionDraftReqVO r, Integer version) {
|
||||
return new QuestionCollectionAuthoringCommand(r.getNodeId(), r.getName(), r.getTitle(),
|
||||
r.getDurationMinutes(), r.getAccessRules(), r.getSortOrder(), r.getMetadata(), version);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.collection.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuestionCollectionAuthoringRespVO {
|
||||
private Long id;
|
||||
private Long entryId;
|
||||
private Long nodeId;
|
||||
private String name;
|
||||
private String title;
|
||||
private String collectionType;
|
||||
private Integer questionCount;
|
||||
private Integer durationMinutes;
|
||||
private String accessRules;
|
||||
private String accessMode;
|
||||
private Boolean isHidden;
|
||||
private Boolean isActive;
|
||||
private Integer sortOrder;
|
||||
private String metadata;
|
||||
private String publicationStatus;
|
||||
private Integer authoringVersion;
|
||||
private Integer membershipVersion;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.collection.vo;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuestionCollectionDraftReqVO {
|
||||
@NotNull private Long nodeId;
|
||||
@NotBlank @Size(max = 200) private String name;
|
||||
@Size(max = 200) private String title;
|
||||
@Positive private Integer durationMinutes;
|
||||
private String accessRules;
|
||||
private Integer sortOrder;
|
||||
private String metadata;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.collection.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class QuestionCollectionMembershipReqVO {
|
||||
@NotNull private Integer expectedAuthoringVersion;
|
||||
@NotNull @Size(max = 1000) private List<@NotNull Long> questionIds;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.collection.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuestionCollectionReviseReqVO extends QuestionCollectionDraftReqVO {
|
||||
@NotNull private Integer expectedAuthoringVersion;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.commercialization;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.commercialization.vo.*;
|
||||
import cn.iocoder.yudao.module.education.service.commercialization.*;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/commercialization")
|
||||
public class EducationCommercializationController {
|
||||
private final ResourceProductBindingService bindingService;
|
||||
private final EducationEntitlementService entitlementService;
|
||||
public EducationCommercializationController(ResourceProductBindingService bindingService, EducationEntitlementService entitlementService) {
|
||||
this.bindingService = bindingService; this.entitlementService = entitlementService;
|
||||
}
|
||||
@PostMapping("/bindings")
|
||||
@PreAuthorize("@ss.hasPermission('education:commercialization:binding')")
|
||||
public CommonResult<ResourceProductBindingResult> bind(@Valid @RequestBody ResourceProductBindReqVO request) {
|
||||
return success(bindingService.bind(request.getResourceType(), request.getResourceId(), request.getProductSpuId()));
|
||||
}
|
||||
@PutMapping("/bindings/{resourceType}/{resourceId}/deactivate")
|
||||
@PreAuthorize("@ss.hasPermission('education:commercialization:binding')")
|
||||
public CommonResult<ResourceProductBindingResult> deactivate(@PathVariable String resourceType, @PathVariable Long resourceId,
|
||||
@RequestParam int expectedVersion) {
|
||||
return success(bindingService.deactivate(resourceType, resourceId, expectedVersion));
|
||||
}
|
||||
@PostMapping("/entitlement-events")
|
||||
@PreAuthorize("@ss.hasPermission('education:commercialization:entitlement')")
|
||||
public CommonResult<Long> apply(@Valid @RequestBody EntitlementEventReqVO request) {
|
||||
return success(entitlementService.apply(new EntitlementCommand(request.getSourceSystem(), request.getSourceEventId(),
|
||||
request.getEventType(), request.getUserId(), request.getResourceType(), request.getResourceId(), request.getProductSpuId(),
|
||||
request.getValidFrom(), request.getExpiresAt(), request.getOccurredAt())));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.commercialization.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class EntitlementEventReqVO {
|
||||
@NotBlank private String sourceSystem;
|
||||
@NotBlank private String sourceEventId;
|
||||
@NotBlank private String eventType;
|
||||
@NotNull private Long userId;
|
||||
@NotBlank private String resourceType;
|
||||
@NotNull private Long resourceId;
|
||||
private Long productSpuId;
|
||||
private LocalDateTime validFrom;
|
||||
private LocalDateTime expiresAt;
|
||||
@NotNull private LocalDateTime occurredAt;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.commercialization.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ResourceProductBindReqVO {
|
||||
@NotBlank private String resourceType;
|
||||
@NotNull private Long resourceId;
|
||||
@NotNull private Long productSpuId;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.contentexport;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.security.core.service.SecurityFrameworkService;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.contentexport.vo.ContentExportRequestReqVO;
|
||||
import cn.iocoder.yudao.module.education.service.contentexport.ContentExportAnswerMode;
|
||||
import cn.iocoder.yudao.module.education.service.contentexport.ContentExportPolicy;
|
||||
import cn.iocoder.yudao.module.education.service.contentexport.ContentExportPolicyService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 教育内容导出请求")
|
||||
@RestController
|
||||
@RequestMapping("/education/content-exports")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class ContentExportController {
|
||||
|
||||
private static final String ANSWERS_PERMISSION = "education:content-export:answers";
|
||||
|
||||
private final ContentExportPolicyService policyService;
|
||||
private final SecurityFrameworkService securityFrameworkService;
|
||||
|
||||
public ContentExportController(ContentExportPolicyService policyService,
|
||||
SecurityFrameworkService securityFrameworkService) {
|
||||
this.policyService = policyService;
|
||||
this.securityFrameworkService = securityFrameworkService;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "评估内容导出请求的字段策略")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-export')")
|
||||
public CommonResult<ContentExportPolicy> requestExport(
|
||||
@Valid @RequestBody ContentExportRequestReqVO reqVO) {
|
||||
if (reqVO.getAnswerMode() == ContentExportAnswerMode.INCLUDE
|
||||
&& !securityFrameworkService.hasPermission(ANSWERS_PERMISSION)) {
|
||||
throw new AccessDeniedException("Including answers requires " + ANSWERS_PERMISSION);
|
||||
}
|
||||
return success(policyService.evaluate(reqVO.getAnswerMode()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.contentexport.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.service.contentexport.ContentExportAnswerMode;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 内容导出请求")
|
||||
@Data
|
||||
public class ContentExportRequestReqVO {
|
||||
|
||||
@Schema(description = "答案处理方式;省略时默认脱敏", example = "REDACT")
|
||||
private ContentExportAnswerMode answerMode;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.contentnode;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.contentnode.vo.ContentNodeAuthoringRespVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.contentnode.vo.ContentNodeDraftReqVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.contentnode.vo.ContentNodeReviseReqVO;
|
||||
import cn.iocoder.yudao.module.education.service.contentnode.authoring.ContentNodeAuthoringCommand;
|
||||
import cn.iocoder.yudao.module.education.service.contentnode.authoring.ContentNodeAuthoringService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/content-nodes")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class ContentNodeAuthoringController {
|
||||
private final ContentNodeAuthoringService service;
|
||||
public ContentNodeAuthoringController(ContentNodeAuthoringService service) { this.service = service; }
|
||||
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-node:query')")
|
||||
public CommonResult<PageResult<ContentNodeAuthoringRespVO>> getPage(@Valid PageParam pageParam) {
|
||||
return success(BeanUtils.toBean(service.getPage(pageParam), ContentNodeAuthoringRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-node:query')")
|
||||
public CommonResult<ContentNodeAuthoringRespVO> get(@RequestParam("id") Long id) {
|
||||
return success(BeanUtils.toBean(service.get(id), ContentNodeAuthoringRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/drafts")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-node:author')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody ContentNodeDraftReqVO request) {
|
||||
return success(service.createDraft(toCommand(request, null)));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/draft")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-node:update')")
|
||||
public CommonResult<Integer> revise(@PathVariable("id") Long id,
|
||||
@Valid @RequestBody ContentNodeReviseReqVO request) {
|
||||
return success(service.reviseDraft(id, toCommand(request, request.getExpectedAuthoringVersion())));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/activate")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-node:publish')")
|
||||
public CommonResult<Integer> activate(@PathVariable("id") Long id,
|
||||
@RequestParam("expectedAuthoringVersion") int expectedVersion) {
|
||||
return success(service.activate(id, expectedVersion, getLoginUserId()));
|
||||
}
|
||||
|
||||
@PutMapping("/{id}/archive")
|
||||
@PreAuthorize("@ss.hasPermission('education:content-node:archive')")
|
||||
public CommonResult<Integer> archive(@PathVariable("id") Long id,
|
||||
@RequestParam("expectedAuthoringVersion") int expectedVersion) {
|
||||
return success(service.archive(id, expectedVersion, getLoginUserId()));
|
||||
}
|
||||
|
||||
private ContentNodeAuthoringCommand toCommand(ContentNodeDraftReqVO request, Integer expectedVersion) {
|
||||
return new ContentNodeAuthoringCommand(request.getEntryId(), request.getParentId(), request.getName(),
|
||||
request.getTitle(), request.getNodeType(), request.getMarkerType(), request.getSelectable(),
|
||||
request.getSortOrder(), request.getMetadata(), expectedVersion);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.contentnode.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ContentNodeAuthoringRespVO {
|
||||
private Long id;
|
||||
private Long entryId;
|
||||
private Long parentId;
|
||||
private String name;
|
||||
private String title;
|
||||
private String nodeType;
|
||||
private String markerType;
|
||||
private Integer depth;
|
||||
private Boolean isLeaf;
|
||||
private Boolean isSelectable;
|
||||
private Boolean isHidden;
|
||||
private Boolean isActive;
|
||||
private String publicationStatus;
|
||||
private Integer authoringVersion;
|
||||
private Integer sortOrder;
|
||||
private String metadata;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.contentnode.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 创建内容节点草稿 Request VO")
|
||||
@Data
|
||||
public class ContentNodeDraftReqVO {
|
||||
@NotNull private Long entryId;
|
||||
private Long parentId;
|
||||
@NotBlank @Size(max = 200) private String name;
|
||||
@Size(max = 200) private String title;
|
||||
@NotBlank @Size(max = 50) private String nodeType;
|
||||
@Size(max = 50) private String markerType;
|
||||
@NotNull private Boolean selectable;
|
||||
private Integer sortOrder;
|
||||
private String metadata;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.contentnode.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ContentNodeReviseReqVO extends ContentNodeDraftReqVO {
|
||||
@NotNull private Integer expectedAuthoringVersion;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.exportjob;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.security.core.service.SecurityFrameworkService;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.exportjob.vo.*;
|
||||
import cn.iocoder.yudao.module.education.service.exportjob.ContentExportJobService;
|
||||
import cn.iocoder.yudao.module.education.service.exportjob.CreateContentExportCommand;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/content-export-jobs")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix="yudao.education", name="enabled", havingValue="true")
|
||||
public class ContentExportJobController {
|
||||
private final ContentExportJobService service;
|
||||
private final SecurityFrameworkService security;
|
||||
public ContentExportJobController(ContentExportJobService service, SecurityFrameworkService security) {
|
||||
this.service=service; this.security=security;
|
||||
}
|
||||
@PostMapping @PreAuthorize("@ss.hasPermission('education:content-export:create')")
|
||||
public CommonResult<ContentExportJobRespVO> create(@Valid @RequestBody ContentExportCreateReqVO req) {
|
||||
return success(ContentExportJobRespVO.from(service.create(new CreateContentExportCommand(req.getCommandKey(),
|
||||
req.getScope(), req.getCollectionId(), req.getFormat(), req.getAnswerMode()), getLoginUserId(),
|
||||
security.hasPermission("education:content-export:answers"))));
|
||||
}
|
||||
@GetMapping @PreAuthorize("@ss.hasPermission('education:content-export:query')")
|
||||
public CommonResult<PageResult<ContentExportJobRespVO>> page(@Valid ContentExportPageReqVO req) {
|
||||
var page=service.page(getLoginUserId(),req.getPageNo(),req.getPageSize());
|
||||
return success(new PageResult<>(page.getList().stream().map(ContentExportJobRespVO::from).toList(),page.getTotal()));
|
||||
}
|
||||
@GetMapping("/{id}") @PreAuthorize("@ss.hasPermission('education:content-export:query')")
|
||||
public CommonResult<ContentExportJobRespVO> get(@PathVariable Long id) {
|
||||
return success(ContentExportJobRespVO.from(service.get(id,getLoginUserId())));
|
||||
}
|
||||
@GetMapping("/{id}/download-url") @PreAuthorize("@ss.hasPermission('education:content-export:download')")
|
||||
public CommonResult<String> downloadUrl(@PathVariable Long id) { return success(service.downloadUrl(id,getLoginUserId())); }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.exportjob.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ContentExportCreateReqVO {
|
||||
@NotBlank @Pattern(regexp = "[A-Za-z0-9._:-]{1,128}") private String commandKey;
|
||||
@NotBlank private String scope;
|
||||
@NotNull private Long collectionId;
|
||||
@NotBlank private String format;
|
||||
@NotBlank private String answerMode;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.exportjob.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.service.exportjob.ContentExportJobProjection;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class ContentExportJobRespVO {
|
||||
private Long id; private String scope; private Long collectionId; private String format; private String answerMode;
|
||||
private String status; private Integer attemptCount; private Integer maxAttempts; private Integer questionCount;
|
||||
private String fileName; private Long fileSizeBytes; private String checksumSha256; private String failureCode;
|
||||
private LocalDateTime createTime; private LocalDateTime finishedAt;
|
||||
public static ContentExportJobRespVO from(ContentExportJobProjection p) {
|
||||
ContentExportJobRespVO v = new ContentExportJobRespVO(); v.id=p.id(); v.scope=p.scope(); v.collectionId=p.collectionId();
|
||||
v.format=p.format(); v.answerMode=p.answerMode(); v.status=p.status(); v.attemptCount=p.attemptCount();
|
||||
v.maxAttempts=p.maxAttempts(); v.questionCount=p.questionCount(); v.fileName=p.fileName();
|
||||
v.fileSizeBytes=p.fileSizeBytes(); v.checksumSha256=p.checksumSha256(); v.failureCode=p.failureCode();
|
||||
v.createTime=p.createTime(); v.finishedAt=p.finishedAt(); return v;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.exportjob.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
public class ContentExportPageReqVO extends PageParam {}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.importjob;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.importjob.vo.QuestionImportExecuteReqVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.importjob.vo.QuestionImportJobRespVO;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.importjob.vo.QuestionImportPreviewReqVO;
|
||||
import cn.iocoder.yudao.module.education.service.importjob.ExecuteQuestionImportCommand;
|
||||
import cn.iocoder.yudao.module.education.service.importjob.PreviewQuestionImportCommand;
|
||||
import cn.iocoder.yudao.module.education.service.importjob.QuestionImportJobService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/education/question-import-jobs")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class QuestionImportJobController {
|
||||
private final QuestionImportJobService service;
|
||||
public QuestionImportJobController(QuestionImportJobService service) { this.service = service; }
|
||||
|
||||
@PostMapping("/preview")
|
||||
@PreAuthorize("@ss.hasPermission('education:question-import:create')")
|
||||
public CommonResult<QuestionImportJobRespVO> preview(@Valid @RequestBody QuestionImportPreviewReqVO request) {
|
||||
return success(QuestionImportJobRespVO.from(service.requestPreview(new PreviewQuestionImportCommand(
|
||||
request.getCommandKey(), request.getAssetId()), getLoginUserId())));
|
||||
}
|
||||
|
||||
@PostMapping("/{id}/execute")
|
||||
@PreAuthorize("@ss.hasPermission('education:question-import:execute')")
|
||||
public CommonResult<QuestionImportJobRespVO> execute(@PathVariable("id") Long id,
|
||||
@Valid @RequestBody QuestionImportExecuteReqVO request) {
|
||||
return success(QuestionImportJobRespVO.from(service.requestExecute(
|
||||
new ExecuteQuestionImportCommand(id, request.getCommandKey()), getLoginUserId())));
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@ss.hasPermission('education:question-import:query')")
|
||||
public CommonResult<QuestionImportJobRespVO> get(@PathVariable("id") Long id) {
|
||||
return success(QuestionImportJobRespVO.from(service.get(id)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.importjob.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuestionImportExecuteReqVO {
|
||||
@NotBlank private String commandKey;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.importjob.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.education.service.importjob.QuestionImportJobProjection;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuestionImportJobRespVO {
|
||||
private Long id;
|
||||
private String status;
|
||||
private String scanStatus;
|
||||
private String parserStatus;
|
||||
private String fileName;
|
||||
private Long fileSize;
|
||||
private Integer previewQuestionCount;
|
||||
private Integer importedQuestionCount;
|
||||
private String failureCode;
|
||||
private String previewPayload;
|
||||
private String resultSummary;
|
||||
|
||||
public static QuestionImportJobRespVO from(QuestionImportJobProjection source) {
|
||||
QuestionImportJobRespVO target = new QuestionImportJobRespVO();
|
||||
target.id = source.id(); target.status = source.status(); target.scanStatus = source.scanStatus();
|
||||
target.parserStatus = source.parserStatus(); target.fileName = source.fileName(); target.fileSize = source.fileSize();
|
||||
target.previewQuestionCount = source.previewQuestionCount(); target.importedQuestionCount = source.importedQuestionCount();
|
||||
target.failureCode = source.failureCode(); target.previewPayload = source.previewPayload();
|
||||
target.resultSummary = source.resultSummary();
|
||||
return target;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.importjob.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QuestionImportPreviewReqVO {
|
||||
@NotBlank private String commandKey;
|
||||
@NotNull @Positive private Long assetId;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.education.controller.admin.learningoperations;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.education.controller.admin.learningoperations.vo.*;
|
||||
import cn.iocoder.yudao.module.education.service.engagement.LearningOperationsAdminService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 会员学习运营")
|
||||
@RestController
|
||||
@RequestMapping("/education/learning-operations")
|
||||
@Validated
|
||||
@ConditionalOnProperty(prefix = "yudao.education", name = "enabled", havingValue = "true")
|
||||
public class LearningOperationsAdminController {
|
||||
|
||||
private final LearningOperationsAdminService service;
|
||||
|
||||
public LearningOperationsAdminController(LearningOperationsAdminService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GetMapping("/overview")
|
||||
@Operation(summary = "获取租户学习运营汇总")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:query')")
|
||||
public CommonResult<LearningOperationsOverviewRespVO> overview() {
|
||||
return success(service.getOverview());
|
||||
}
|
||||
|
||||
@GetMapping("/feedback/page")
|
||||
@Operation(summary = "分页查询学生反馈")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:query')")
|
||||
public CommonResult<PageResult<StudentFeedbackAdminRespVO>> feedbackPage(
|
||||
@Valid StudentFeedbackPageReqVO reqVO) {
|
||||
return success(service.getFeedbackPage(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/feedback/{feedbackId}/events")
|
||||
@Operation(summary = "查询反馈处理事件")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:query')")
|
||||
public CommonResult<List<StudentFeedbackEventRespVO>> feedbackEvents(@PathVariable Long feedbackId) {
|
||||
return success(service.getFeedbackEvents(feedbackId));
|
||||
}
|
||||
|
||||
@PutMapping("/feedback/{feedbackId}/handle")
|
||||
@Operation(summary = "处理学生反馈")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:feedback')")
|
||||
public CommonResult<StudentFeedbackAdminRespVO> handleFeedback(@PathVariable Long feedbackId,
|
||||
@Valid @RequestBody StudentFeedbackHandleReqVO reqVO) {
|
||||
return success(service.handleFeedback(feedbackId, reqVO, getLoginUserId()));
|
||||
}
|
||||
|
||||
@PostMapping("/feedback/{feedbackId}/reward")
|
||||
@Operation(summary = "为已解决反馈发放积分奖励")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:reward')")
|
||||
public CommonResult<StudentFeedbackAdminRespVO> rewardFeedback(@PathVariable Long feedbackId,
|
||||
@Valid @RequestBody StudentFeedbackRewardReqVO reqVO) {
|
||||
service.scheduleReward(feedbackId, reqVO);
|
||||
return success(service.deliverReward(feedbackId));
|
||||
}
|
||||
|
||||
@PostMapping("/feedback/{feedbackId}/reward/retry")
|
||||
@Operation(summary = "重试反馈积分奖励")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:reward')")
|
||||
public CommonResult<StudentFeedbackAdminRespVO> retryFeedbackReward(@PathVariable Long feedbackId) {
|
||||
return success(service.deliverReward(feedbackId));
|
||||
}
|
||||
|
||||
@GetMapping("/award/page")
|
||||
@Operation(summary = "分页查询学习积分与徽章奖励")
|
||||
@PreAuthorize("@ss.hasPermission('education:learning-operations:query')")
|
||||
public CommonResult<PageResult<LearningAwardAdminRespVO>> awardPage(@Valid LearningAwardPageReqVO reqVO) {
|
||||
return success(service.getAwardPage(reqVO));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user