anxin-ruoyi/.kiro/specs/contract-confirm-api-fix/requirements.md
2025-12-23 18:33:17 +08:00

51 lines
3.3 KiB
Markdown

# Requirements Document
## Introduction
This specification addresses the API parameter mismatch issue in the contract confirmation functionality. The backend expects a `partyType` query parameter, but the frontend is not providing it, resulting in a "Required request parameter 'partyType' for method parameter type String is not present" error.
## Glossary
- **Contract_Confirmation_System**: The system component responsible for handling contract confirmation operations
- **Frontend_API_Client**: The Vue.js frontend application that makes API calls to the backend
- **Backend_API_Controller**: The Spring Boot controller that handles contract confirmation requests
- **Party_Type**: A string parameter indicating which party is confirming the contract (SECURITY_COMPANY/CLIENT_COMPANY)
- **Contract_ID**: A unique identifier for the contract being confirmed
## Requirements
### Requirement 1
**User Story:** As a frontend developer, I want the API call to include the required partyType parameter, so that the contract confirmation request succeeds without parameter errors.
#### Acceptance Criteria
1. WHEN the Frontend_API_Client calls the contract confirmation endpoint, THE Contract_Confirmation_System SHALL include the partyType parameter as a query parameter
2. WHEN the partyType parameter is provided, THE Backend_API_Controller SHALL accept the request without parameter validation errors
3. WHEN the user's role is client_company, THE Contract_Confirmation_System SHALL set partyType to CLIENT_COMPANY
4. WHEN the user's role is admin or security_company, THE Contract_Confirmation_System SHALL set partyType to SECURITY_COMPANY
5. WHEN the partyType parameter is missing, THE Backend_API_Controller SHALL return a clear error message indicating the missing parameter
### Requirement 2
**User Story:** As a system administrator, I want the contract confirmation to properly identify which party is confirming, so that the system can track confirmation status correctly.
#### Acceptance Criteria
1. WHEN a contract confirmation is processed, THE Contract_Confirmation_System SHALL record which party type performed the confirmation
2. WHEN the confirmation is successful, THE Contract_Confirmation_System SHALL update the contract status appropriately
3. WHEN the partyType is CLIENT_COMPANY, THE Contract_Confirmation_System SHALL mark the client confirmation status
4. WHEN the partyType is SECURITY_COMPANY, THE Contract_Confirmation_System SHALL mark the security company confirmation status
5. WHEN both parties have confirmed, THE Contract_Confirmation_System SHALL update the overall contract status to confirmed
### Requirement 3
**User Story:** As a user, I want clear error messages when API calls fail, so that I can understand what went wrong and how to fix it.
#### Acceptance Criteria
1. WHEN an API parameter is missing, THE Contract_Confirmation_System SHALL return a descriptive error message
2. WHEN the user lacks permission to confirm, THE Contract_Confirmation_System SHALL return an authorization error
3. WHEN the contract is in an invalid state for confirmation, THE Contract_Confirmation_System SHALL return a state validation error
4. WHEN a system error occurs, THE Contract_Confirmation_System SHALL log the error and return a user-friendly message
5. WHEN the API response contains an error, THE Frontend_API_Client SHALL display the error message to the user