Files
yidaima/RuoYi-Vue/docs/superpowers/plans/2026-07-07-diagram-paper-phase1.md

4.3 KiB

Diagram And Paper Phase 1 Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Add first-phase diagram generation and AI paper draft tools to the EasyCode front workbench project detail flow.

Architecture: Reuse the existing front project data model, DeepSeek-backed AI service, and AI task infrastructure. Add lightweight diagram and paper DTOs plus synchronous endpoints for MVP generation; expose them in easycode-web as project-level pages reachable from project detail cards.

Tech Stack: Java 8, Spring Boot 2.5, Fastjson2, Vue 3, Vite, Element Plus, SVG/HTML export in browser.

Global Constraints

  • Do not add automated tests because the user explicitly requested to test manually.
  • Do not create a new worktree because the current working tree contains uncommitted prerequisite platform changes.
  • Keep changes scoped to phase 1: ER/module/architecture/project diagrams, AI flow/use-case diagrams, paper outline, paper draft, and browser-side exports.
  • Reuse existing /front/project authentication and ownership checks.

Task 1: Backend AI DTOs And Service Methods

Files:

  • Modify: ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/IAiGenerateService.java

  • Modify: ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerateServiceImpl.java

  • Create: ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/GenerateDiagramRequest.java

  • Create: ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/DiagramDesignResponse.java

  • Create: ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/GeneratePaperOutlineRequest.java

  • Create: ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/PaperOutlineResponse.java

  • Create: ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/GeneratePaperDraftRequest.java

  • Create: ruoyi-generator/src/main/java/com/ruoyi/generator/domain/front/dto/PaperDraftResponse.java

  • Add DTOs with JavaBean getters/setters.

  • Add service interface methods for diagram, paper outline, and paper draft generation.

  • Implement project-context prompts and JSON/Markdown parsing in AiGenerateServiceImpl.

Task 2: Backend Routes And Task Types

Files:

  • Modify: ruoyi-admin/src/main/java/com/ruoyi/web/controller/front/FrontProjectController.java

  • Modify: ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerationTaskServiceImpl.java

  • Modify: ruoyi-generator/src/main/java/com/ruoyi/generator/service/front/AiGenerationTaskWorker.java

  • Add synchronous MVP endpoints under /front/project/{projectId}.

  • Permit async task types diagram_spec, paper_outline, and paper_draft.

  • Route async tasks to the new service methods for future long-running usage.

Task 3: Frontend API And Routing

Files:

  • Modify: easycode-web/src/api/project.js

  • Modify: easycode-web/src/router/index.js

  • Modify: easycode-web/src/views/ProjectListView.vue

  • Create: easycode-web/src/views/DiagramCenterView.vue

  • Create: easycode-web/src/views/PaperDraftView.vue

  • Add API calls for diagram, paper outline, and paper draft generation.

  • Add authenticated routes for diagram center and paper draft pages.

  • Add project card/detail actions that link to the new pages.

Task 4: Diagram Center MVP

Files:

  • Create: easycode-web/src/views/DiagramCenterView.vue

  • Load the selected project and database design.

  • Render ER, module, architecture, and project overview diagrams from saved project data.

  • Generate AI flow/use-case diagram specs and render them as simple editable text plus SVG preview.

  • Export SVG and PNG from the browser.

Task 5: Paper Draft MVP

Files:

  • Create: easycode-web/src/views/PaperDraftView.vue

  • Generate outline from project context.

  • Generate Markdown draft from confirmed outline.

  • Show editable draft preview.

  • Download Word-compatible .doc and Markdown from the browser.

Task 6: Verification

Files:

  • Existing project files only.

  • Run Java compile for touched backend modules if practical.

  • Run frontend production build if practical.

  • Report any skipped verification clearly.