This commit is contained in:
Zzzz
2026-04-28 20:57:31 +08:00
parent e8c46311b9
commit acbd873fbc
15 changed files with 200 additions and 15 deletions
@@ -0,0 +1,2 @@
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
{"file": ".trellis/spec/frontend/index.md", "reason": "Frontend JSP/CSS context for verifying the refreshed preview"}
@@ -0,0 +1,2 @@
{"_example": "Fill with {\"file\": \"<path>\", \"reason\": \"<why>\"}. Put spec/research files only — no code paths. Run `python3 .trellis/scripts/get_context.py --mode packages` to list available specs. Delete this line once real entries are added."}
{"file": ".trellis/spec/frontend/index.md", "reason": "Frontend JSP/CSS context for preview verification"}
@@ -0,0 +1,47 @@
# Rebuild Current Frontend Preview
## Goal
Rebuild the current Java Web application and refresh the local Tomcat deployment so the user can view the latest frontend effect in the browser.
## What I already know
* The user asked to rebuild the program to inspect the new frontend.
* The project is a Java 11 Maven WAR application.
* Maven produces `target/library-management.war`.
* Frontend JSP/CSS assets live under `src/main/webapp`.
* Local Tomcat path recorded by prior work is `/home/sjy/apps/tomcat/apache-tomcat-9.0.117/apache-tomcat-9.0.117`.
* The Tomcat context should be `/library-management`.
## Requirements
* Run a clean Maven package build.
* Deploy the new WAR to the local Tomcat `webapps` directory.
* Remove the expanded old deployment directory before restart so stale frontend assets are not reused.
* Start or restart Tomcat.
* Verify the frontend login URL is reachable.
* Provide the local browser URL to the user.
## Acceptance Criteria
* [x] `mvn clean package` succeeds.
* [x] `target/library-management.war` exists.
* [x] Tomcat deployment is refreshed with the new WAR.
* [x] `/library-management/login` returns HTTP 200.
* [x] User receives the local preview URL.
## Out of Scope
* Source code changes.
* New UI requirements or redesign decisions.
* Database schema or seed data changes.
## Technical Notes
* Build command from README: `mvn clean package`; fallback Maven path: `/home/sjy/.sdkman/candidates/maven/current/bin/mvn clean package`.
* Deployment target: `/home/sjy/apps/tomcat/apache-tomcat-9.0.117/apache-tomcat-9.0.117/webapps/library-management.war`.
* Build completed at 2026-04-28 20:21 +0800.
* Previous Tomcat deployment was moved to `/home/sjy/apps/tomcat/apache-tomcat-9.0.117/apache-tomcat-9.0.117/deploy-backups/_pre-preview-20260428-202206/`.
* Tomcat is running in tmux session `mzh-library-tomcat`.
* Verified `http://localhost:8080/library-management/login` returns `HTTP 200` with `Content-Type: text/html;charset=UTF-8`.
* Verified demo login redirects to `/library-management/dashboard`, and the authenticated dashboard returns `HTTP 200`.
@@ -0,0 +1,26 @@
{
"id": "04-28-rebuild-current-frontend-preview",
"name": "04-28-rebuild-current-frontend-preview",
"title": "rebuild current frontend preview",
"description": "",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "Zzzz",
"assignee": "Zzzz",
"createdAt": "2026-04-28",
"completedAt": null,
"branch": null,
"base_branch": "master",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}
@@ -0,0 +1,6 @@
{"file": ".trellis/spec/frontend/index.md", "reason": "Review JSP changes against presentation-layer conventions."}
{"file": ".trellis/spec/frontend/component-guidelines.md", "reason": "Verify button/action removal keeps page composition and primary operations intact."}
{"file": ".trellis/spec/frontend/state-management.md", "reason": "Ensure JSP changes do not alter request/session contracts."}
{"file": ".trellis/spec/frontend/quality-guidelines.md", "reason": "Run UI-oriented quality review for removed redundant actions."}
{"file": ".trellis/spec/backend/database-guidelines.md", "reason": "Review Chinese demo data against schema and seed-data conventions."}
{"file": ".trellis/spec/backend/quality-guidelines.md", "reason": "Verify backend layer boundaries and checks for schema-only data changes."}
@@ -0,0 +1,9 @@
{"file": ".trellis/spec/frontend/index.md", "reason": "JSP presentation-layer conventions and required pre-development checklist for removing redundant page actions."}
{"file": ".trellis/spec/frontend/directory-structure.md", "reason": "Location and ownership of JSP pages, shared fragments, and static assets."}
{"file": ".trellis/spec/frontend/component-guidelines.md", "reason": "Rules for JSP fragments, forms, tables, buttons, and page composition."}
{"file": ".trellis/spec/frontend/state-management.md", "reason": "Server-rendered request/session/form state constraints for JSP changes."}
{"file": ".trellis/spec/frontend/type-safety.md", "reason": "JSP/Servlet display contracts and safe rendering expectations."}
{"file": ".trellis/spec/frontend/quality-guidelines.md", "reason": "UI quality checks for JSP/CSS changes."}
{"file": ".trellis/spec/backend/index.md", "reason": "Backend architecture overview for database initialization changes."}
{"file": ".trellis/spec/backend/database-guidelines.md", "reason": "MySQL schema and seed-data conventions for readers, categories, and books."}
{"file": ".trellis/spec/backend/quality-guidelines.md", "reason": "Layer-boundary and verification expectations for database-only backend changes."}
@@ -0,0 +1,58 @@
# remove redundant page actions and add Chinese demo data
## Goal
精简已登录页面中与侧边栏重复的右侧跨模块跳转按钮,并补充更贴近中文图书馆场景的演示图书与读者数据。
## What I already know
* 用户希望移除以下重复入口:报表中心右侧“借阅记录”;馆藏检索右侧“管理图书”;图书管理右侧“分类”“查看馆藏”;管理分类右侧“管理图书”;读者档案右侧“管理登录账户”;用户账户与角色右侧“读者档案”。
* 侧边栏已经提供这些模块之间的跳转,因此页面标题栏和工具栏中的跨模块二级入口会显得重复。
* “新增图书”“新增分类”“新增读者档案”“新增账户”等当前页面内的主要操作仍应保留。
* 演示数据位于 `src/main/resources/db/schema.sql`,当前包含英文读者名、英文分类和英文图书。
* 项目是 JSP + Servlet + MySQL 架构,前端页面在 `src/main/webapp/WEB-INF/jsp/`,数据库初始化脚本使用 `utf8mb4`
## Assumptions
* 本任务只调整冗余跨模块按钮,不改变侧边栏导航、权限控制、Servlet 路由或业务流程。
* 数据初始化仍使用 `INSERT IGNORE` / `ON DUPLICATE KEY UPDATE` 的现有风格,避免重复执行脚本破坏已有本地数据。
* 中文演示数据可以替换或扩充现有英文样例,但登录测试账号用户名和密码保持不变。
## Requirements
* 报表中心页面不再显示跳转到借阅记录的右侧按钮。
* 馆藏检索页面不再显示跳转到管理图书的右侧按钮。
* 图书管理页面不再显示跳转到分类管理或馆藏检索的右侧按钮;保留新增图书入口。
* 分类管理页面不再显示跳转到管理图书的右侧按钮;保留新增分类入口。
* 读者档案页面不再显示跳转到管理登录账户的右侧按钮;保留新增读者档案入口。
* 用户账户与角色页面不再显示跳转到读者档案的右侧按钮;保留新增账户入口。
* 数据库初始化脚本加入中文图书分类、中文书名、中文作者和中文读者姓名。
* 本地演示账号仍能用于登录验证。
## Acceptance Criteria
* [x] 指定页面中的重复跨模块按钮被移除,侧边栏仍能导航到对应模块。
* [x] 页面内新增操作按钮未被误删。
* [x] `schema.sql` 包含多条中文图书数据和多条中文读者数据。
* [x] 中文演示数据使用 `utf8mb4` 兼容的文本,不引入新表或迁移机制。
* [x] 相关检查或可用的构建验证通过;若环境缺少 Maven,记录 fallback 验证。
## Definition of Done
* Tests/checks run where available.
* Lint/typecheck/build status reported.
* Specs reviewed for whether new conventions need recording.
## Out of Scope
* 不重设计侧边栏或整体视觉风格。
* 不新增页面、权限、路由或服务层能力。
* 不改变借阅记录、报表、用户账户或读者档案的业务逻辑。
## Technical Notes
* Likely JSP files: `src/main/webapp/WEB-INF/jsp/reports/dashboard.jsp`, `src/main/webapp/WEB-INF/jsp/books/catalog.jsp`, `src/main/webapp/WEB-INF/jsp/books/manage.jsp`, `src/main/webapp/WEB-INF/jsp/books/categories.jsp`, `src/main/webapp/WEB-INF/jsp/readers/manage.jsp`, `src/main/webapp/WEB-INF/jsp/admin/users/manage.jsp`.
* Data file: `src/main/resources/db/schema.sql`.
* Relevant specs: frontend JSP/component/state/quality guidelines and backend database/quality guidelines.
* Final verification: `git diff --check`, JSP scriptlet/SQL/JDBC scan, removed-link scan, and `/home/sjy/.sdkman/candidates/maven/current/bin/mvn clean package` passed.
* Spec update decision: no `.trellis/spec/` update needed because this task did not introduce new routes, APIs, tables, cross-layer contracts, or reusable implementation conventions.
@@ -0,0 +1,26 @@
{
"id": "remove-redundant-actions-add-cn-data",
"name": "remove-redundant-actions-add-cn-data",
"title": "remove redundant page actions and add Chinese demo data",
"description": "",
"status": "in_progress",
"dev_type": null,
"scope": null,
"package": null,
"priority": "P2",
"creator": "Zzzz",
"assignee": "Zzzz",
"createdAt": "2026-04-28",
"completedAt": null,
"branch": null,
"base_branch": "master",
"worktree_path": null,
"commit": null,
"pr_url": null,
"subtasks": [],
"children": [],
"parent": null,
"relatedFiles": [],
"notes": "",
"meta": {}
}
+24 -3
View File
@@ -190,13 +190,22 @@ INSERT IGNORE INTO users (username, password_hash, display_name, role_code, acti
INSERT IGNORE INTO readers (reader_identifier, user_id, full_name, phone, email, status, max_borrow_count) VALUES
('RD-0001', (SELECT id FROM users WHERE username = 'reader'), 'Demo Reader', '13800000000',
'reader@example.com', 'active', 5),
('RD-0002', NULL, 'Suspended Reader', '13900000000', 'suspended.reader@example.com', 'suspended', 3);
('RD-0002', NULL, 'Suspended Reader', '13900000000', 'suspended.reader@example.com', 'suspended', 3),
('RD-0101', NULL, '张晓雨', '13600010001', 'zhang.xiaoyu@example.com', 'active', 6),
('RD-0102', NULL, '李明远', '13600010002', 'li.mingyuan@example.com', 'active', 5),
('RD-0103', NULL, '王思涵', '13600010003', 'wang.sihan@example.com', 'active', 4),
('RD-0104', NULL, '赵晨', '13600010004', 'zhao.chen@example.com', 'suspended', 3);
INSERT INTO book_categories (name, description) VALUES
('Computer Science', 'Programming, software engineering, and systems books'),
('Literature', 'Classic and modern literature'),
('History', 'World and regional history'),
('Science', 'Natural science and popular science')
('Science', 'Natural science and popular science'),
('中国文学', '中国现当代文学、经典小说和散文作品'),
('计算机技术', '程序设计、软件工程、数据库和信息技术图书'),
('历史文化', '中国历史、世界历史和文化研究读物'),
('自然科学', '数学、物理、生命科学和科普读物'),
('社会科学', '社会学、管理学和公共事务读物')
ON DUPLICATE KEY UPDATE
description = VALUES(description);
@@ -208,4 +217,16 @@ INSERT IGNORE INTO books (book_identifier, title, author, category_id, total_cop
('BK-0003', 'Pride and Prejudice', 'Jane Austen',
(SELECT id FROM book_categories WHERE name = 'Literature'), 3, 3, 'available'),
('BK-0004', 'A Brief History of Time', 'Stephen Hawking',
(SELECT id FROM book_categories WHERE name = 'Science'), 2, 1, 'available');
(SELECT id FROM book_categories WHERE name = 'Science'), 2, 1, 'available'),
('BK-0101', '活着', '余华',
(SELECT id FROM book_categories WHERE name = '中国文学'), 6, 5, 'available'),
('BK-0102', '平凡的世界', '路遥',
(SELECT id FROM book_categories WHERE name = '中国文学'), 5, 5, 'available'),
('BK-0103', '深入理解Java虚拟机', '周志明',
(SELECT id FROM book_categories WHERE name = '计算机技术'), 4, 3, 'available'),
('BK-0104', '中国通史', '吕思勉',
(SELECT id FROM book_categories WHERE name = '历史文化'), 3, 3, 'available'),
('BK-0105', '乡土中国', '费孝通',
(SELECT id FROM book_categories WHERE name = '社会科学'), 4, 4, 'available'),
('BK-0106', '科学史十五讲', '江晓原',
(SELECT id FROM book_categories WHERE name = '自然科学'), 3, 2, 'available');
@@ -20,7 +20,6 @@
</div>
<div class="hero-actions">
<a class="button button-primary" href="${pageContext.request.contextPath}/admin/users/new">新增用户账户</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/readers">读者档案</a>
</div>
</section>
@@ -60,9 +60,6 @@
<button class="button button-primary" type="submit">检索</button>
<a class="button button-secondary" href="${pageContext.request.contextPath}/catalog">清空</a>
<c:if test="${canManageBooks}">
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">管理图书</a>
</c:if>
</form>
</section>
@@ -19,7 +19,6 @@
</div>
<div class="hero-actions">
<a class="button button-primary" href="${pageContext.request.contextPath}/book-categories/new">新增分类</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">管理图书</a>
</div>
</section>
@@ -20,7 +20,6 @@
</div>
<div class="hero-actions">
<a class="button button-primary" href="${pageContext.request.contextPath}/books/new">新增图书</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">分类</a>
</div>
</section>
@@ -69,8 +68,6 @@
<button class="button button-primary" type="submit">检索</button>
<a class="button button-secondary" href="${pageContext.request.contextPath}/books">清空</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/catalog">查看馆藏</a>
<a class="button button-secondary" href="${pageContext.request.contextPath}/book-categories">分类</a>
</form>
</section>
@@ -20,9 +20,6 @@
</div>
<div class="hero-actions">
<a class="button button-primary" href="${pageContext.request.contextPath}/readers/new">新增读者档案</a>
<c:if test="${sessionScope.userRole == 'administrator'}">
<a class="button button-secondary" href="${pageContext.request.contextPath}/admin/users">管理登录账户</a>
</c:if>
</div>
</section>
@@ -17,7 +17,6 @@
<h1 id="reports-title">报表中心</h1>
<p>查看馆藏库存、借阅状况、逾期借阅和热门图书。</p>
</div>
<a class="button button-secondary" href="${pageContext.request.contextPath}/borrowing">借阅记录</a>
</section>
<c:if test="${not empty errorMessage}">