重构后端服务架构并优化前端错误处理

This commit is contained in:
ylweng
2025-09-17 22:23:44 +08:00
parent 7d1e00dfc5
commit aa1e08baa5
3 changed files with 26 additions and 209 deletions

View File

@@ -1,207 +0,0 @@
# Live Cattle Procurement Intelligent Digital System - Product Requirements Document
## Version History
| Version | Date | Author | Description |
|---------|------|--------|-------------|
| v1.0 | 2024-01-20 | Product Manager | Initial PRD |
## 1. Project Overview
### 1.1 Project Background
To address issues of information opacity, non-standard processes, and difficult risk control in live cattle procurement, develop a digital management system for live cattle procurement SOP.
### 1.2 Project Objectives
- Achieve standardized, digital management of procurement processes
- Improve procurement efficiency and reduce operational risks
- Ensure traceable cattle quality and secure transactions
### 1.3 Success Criteria
- 30% reduction in procurement process time
- Operational error rate reduced to below 1%
- Customer satisfaction rate reaches 95% or higher
## 2. User Roles and Use Cases
### 2.1 User Roles
| Role | Responsibilities | System Permissions |
|------|-----------------|-------------------|
| Purchaser | Initiate procurement needs, confirm acceptance, approve payments | Order creation, acceptance confirmation, payment approval |
| Trader | Forward orders, manage suppliers, handle fund settlement | Order management, supplier management, settlement processing |
| Supplier | Prepare cattle, manage loading, provide documents | Cattle information maintenance, loading management, document upload |
| Driver | Execute transportation, report status, handle document transfer | Transport tracking, status reporting, document confirmation |
| Internal Staff | Internal operations and management | Internal system access and management functions |
### 2.2 Core Use Cases
1. **Procurement Order Management** - Purchaser creates orders, trader forwards orders
2. **Cattle Verification Management** - Supplier prepares cattle, uploads quarantine certificates
3. **Transport Tracking Management** - Driver reports real-time transport status
4. **Arrival Acceptance Management** - Purchaser confirms acceptance, handles exceptions
5. **Settlement Payment Management** - Automatic calculation of payments, online payment
## 3. Functional Requirements
### 3.1 Procurement Planning Phase
#### User Story: As a Purchaser, I want to create procurement orders, so that procurement requirements are clear
**Acceptance Criteria:**
- Given the purchaser logs into the system
- When filling in "Procurement Order" information
- Then the system generates a pending confirmation order
- And includes complete information such as breed, weight, quantity, unit price
#### User Story: As a Trader, I want to review supplier qualifications, so that supplier compliance is ensured
**Acceptance Criteria:**
- Given the trader views supplier information
- When verifying business license and quarantine certificate issuance capability
- Then the system records review results
- And supports document file upload and viewing
### 3.2 Pre-loading Preparation
#### User Story: As a Driver, I want to complete vehicle registration, so that transport vehicles are compliant
**Acceptance Criteria:**
- Given the driver prepares for loading
- When uploading empty truck weighing video and disinfection certificate
- Then the system verifies video completeness
- And on-site veterinarian confirms disinfection certificate online
#### User Story: As a Supplier, I want to prepare cattle verification, so that cattle meet requirements
**Acceptance Criteria:**
- Given the supplier prepares for loading
- When providing "Animal Quarantine Qualification Certificate"
- And ensuring empty water and empty trough time ≥ 8 hours
- Then the system records verification information
- And supports weight range configuration for different breeds
### 3.3 Transport Delivery
#### User Story: As a Driver, I want to report real-time transport status, so that the purchasing party knows transport progress
**Acceptance Criteria:**
- Given the driver is during transport
- When automatically reporting location and cattle status every 10 minutes
- Then the system records transport trajectory
- And supports video status reporting
#### User Story: As a Purchaser, I want to perform arrival acceptance, so that cattle quality is ensured
**Acceptance Criteria:**
- Given within 2 hours after cattle arrival
- When the purchaser accepts the cattle
- Then the system records acceptance results
- And supports exception situation recording and handling
### 3.4 Settlement Payment
#### User Story: As a System, I want to automatically calculate settlement amount, so that manual errors are reduced
**Acceptance Criteria:**
- Given acceptance is completed
- When the system obtains loading weight and unit price
- Then automatically calculates: loading weight × unit price - advance payment
- And generates settlement statement
#### User Story: As a Purchaser, I want to make online payment of balance, so that transaction is completed
**Acceptance Criteria:**
- Given within 3 hours after acceptance
- When the purchaser confirms the settlement statement
- Then the system supports online payment
- And generates payment voucher
### 3.5 Exception Handling
#### User Story: As a System, I want to automatically calculate penalty fees, so that违约处理 is standardized
**Acceptance Criteria:**
- Given违约情况 occurs
- When the system identifies违约类型
- Then calculates penalty at 0.5% of daily contract amount
- And generates违约处理单
## 4. Non-Functional Requirements
### 4.1 Performance Requirements
- System response time: < 2 seconds
- Concurrent users: Support 100+ users online simultaneously
- Data storage: Video files permanently saved
### 4.2 Security Requirements
- Data transmission encryption: HTTPS protocol
- Identity authentication: Multi-factor authentication
- Permission control: Role-based access control
- Data backup: Automatic daily backup
### 4.3 Reliability Requirements
- System availability: 99.9%
- Fault recovery: < 30 minutes
- Data consistency: Transaction integrity guarantee
## 5. Technical Architecture
### 5.1 Mini-Program Matrix (uni-app Technology)
- **Client Mini-Program**: For purchasers to create orders and track progress
- **Supplier Mini-Program**: For suppliers to manage cattle preparation and documents
- **Driver Mini-Program**: For drivers to report transport status and locations
- **Internal Staff Mini-Program**: For internal operations and management
### 5.2 Unified System Architecture
- **Single Database**: All three systems (Website, Admin System, Mini-Programs) use the same database
- **Unified User Center**: Single sign-on across all platforms with consistent authentication
- **Consistent Interaction Design**: Unified UI/UX design standards across all interfaces
- **Real-time Data Sync**: WebSocket-based real-time data synchronization
### 5.3 System Integration
- **API Gateway**: Unified API management and authentication
- **Microservices Architecture**: Modular service design for scalability
- **Message Queue**: Asynchronous processing for better performance
- **Cloud Storage**: Secure file and video storage solution
## 6. Prototype Description
### 6.1 Interface Key Elements
- **Dashboard View**: Visualized procurement process status
- **Order Management**: Integrated order creation, review, and tracking
- **Map View**: Real-time transport trajectory display
- **Video Monitoring**: Loading and unloading process video viewing
- **Settlement Center**: Automatic calculation, online payment
### 6.2 Interaction Flow
1. Purchaser creates order Trader confirms forwarding Supplier accepts order
2. Supplier prepares cattle Uploads certificate documents Driver vehicle registration
3. Loading monitoring Transport tracking Arrival acceptance
4. System automatic settlement Online payment Document archiving
## 7. Scope Definition
### This Version Includes:
- Complete digital management of live cattle procurement process
- Full functionality for five user roles (including internal staff)
- Dual order process (PurchaserTraderSupplier)
- Real-time transport tracking and status reporting
- Automated settlement and payment processing
- Uni-app based mini-program matrix
- Unified database and user center
- Consistent interaction design across all platforms
### This Version Excludes:
- Cattle breeding management functionality
- Sales-side functionality
- Complex financial accounting functions
- Multi-language support
## 8. Priority Ranking
### P0 (Highest Priority)
- Procurement order creation and management
- Cattle verification and document management
- Real-time transport status tracking
- Arrival acceptance and exception handling
- Unified user authentication system
- Real-time data synchronization
### P1 (High Priority)
- Automated settlement calculation
- Online payment functionality
- Document archiving and management
- Data statistics and analysis
- Mini-program development (uni-app)
- API gateway implementation
### P2 (Medium Priority)
- Mobile APP development
- System integration interfaces
- Advanced reporting functionality
- Message notification system
- Performance optimization
- Security enhancement features

View File

@@ -4,6 +4,7 @@
| 版本 | 日期 | 作者 | 说明 |
|------|------|------|------|
| v1.0 | 2024-01-25 | 产品经理 | 初版官网需求文档 |
| v1.1 | 2024-01-26 | 产品经理 | 更新用户类型,明确核心价值,完善业务规则,添加中英文双语支持需求 |
## 1. 项目概述
@@ -12,7 +13,7 @@
### 1.2 项目目标
- 建立专业的企业形象和品牌展示
- 清晰传达活牛采购智能数字化系统的核心价值
- 清晰传达活牛采购智能数字化系统的核心价值:安全、高效的交易全流程监管模式
- 提供系统功能演示和客户咨询入口
- 支持潜在客户了解和试用系统
@@ -31,6 +32,8 @@
| 贸易商 | 中介服务,需要效率工具 | 寻找订单管理和结算工具 |
| 供应商 | 牛只供应,需要客户资源 | 展示资质,接入采购平台 |
| 行业从业者 | 职业发展,行业信息 | 了解行业动态和技术趋势 |
| 终端客户 | 牛肉消费,关注品质溯源 | 下载APP/小程序,了解产品信息 |
| 供应链资金方 | 资金融通,风险控制 | 了解平台交易数据和风控机制 |
### 2.2 用户场景
1. **信息获取型**:通过搜索引擎找到官网,了解系统功能
@@ -117,6 +120,7 @@
- 企业信息收集
- 需求描述字段
- 自动邮件确认
- 留下联系方式即可完成申请
#### 3.2.3 资料下载功能
**用户故事**As a 深入研究用户, I want to 下载详细资料, so that 后续参考
@@ -133,6 +137,7 @@
- 时间段选择
- 参会人员信息
- 自动提醒和确认
- 留下联系方式即可完成预约
## 4. 非功能需求
@@ -161,6 +166,12 @@
- 屏幕阅读器兼容
- 颜色对比度达标
### 4.5 多语言支持要求
- 支持中英文双语切换
- 语言切换按钮在页面显眼位置
- 所有页面内容均需支持双语显示
- 未来可扩展至其他语言
## 5. 设计规范
### 5.1 视觉设计
@@ -194,6 +205,12 @@
- 面包屑导航
- 页脚全面链接
- 返回顶部按钮
- 语言切换按钮位于导航栏显眼位置
**多语言切换设计:**
- 提供清晰的语言标识/EN
- 切换时保持当前页面位置
- 确保所有UI元素适配不同语言文本长度
**表单设计:**
- 清晰标签和占位符
@@ -249,6 +266,7 @@ website/
- **邮件服务**SendGrid或Mailchimp
- **地图服务**高德地图API
- **表单处理**Formspree或自定义后端
- **翻译服务**可集成Google翻译API或百度翻译API未来扩展
## 7. 内容策略
@@ -279,6 +297,11 @@ website/
- 养殖业数字化
- 牲畜交易管理
**多语言内容要求:**
- 所有核心页面内容需提供中英文版本
- 产品介绍和解决方案需双语支持
- 新闻动态和客户案例优先提供双语版本
**内容类型:**
- 产品功能详细介绍
- 行业解决方案文章
@@ -304,7 +327,7 @@ website/
- 在线客服集成
- 数据分析配置
- 性能优化
- 多语言支持可选
- 多语言支持中英文双语
## 9. 成功度量指标

View File

@@ -23,6 +23,7 @@ services:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
command: --default-authentication-plugin=mysql_native_password
volumes:
db_data: