8.5 KiB
8.5 KiB
制度模块API测试文档
1. 获取制度列表 (流程管理页面)
请求信息
- URL:
GET /api/regulation?page=1&size=10
- Method: GET
请求参数
page
: 页码,从1开始(必填)size
: 每页数量(必填)
响应格式
{
"status": 200,
"data": {
"records": [
{
"regulationId": "reg001",
"title": "员工考勤管理制度优化提案",
"content": "建议优化考勤管理制度,增加弹性工作时间,提高员工工作积极性...",
"regulationType": "人事制度",
"status": "VOTING",
"publisherId": "2",
"publisherName": "张三",
"publishTime": "2024-01-01T12:00:00",
"effectiveTime": "2024-01-01T12:00:00",
"expireTime": "2024-01-08T12:00:00",
"scope": "全体员工",
"level": "MEDIUM",
"version": "1.0",
"remark": "需要与人事部门协调实施",
"createBy": "admin",
"updateBy": "admin",
"createTime": "2024-01-01 10:00:00",
"updateTime": "2024-01-01 12:00:00",
"page": 1,
"pageSize": 10,
"delFlag": "0",
"voteFor": 15,
"voteAgainst": 3,
"voteAbstain": 2
}
],
"total": 4,
"size": 10,
"current": 1,
"pages": 1
}
}
2. 创建制度提案
请求信息
- URL:
POST /api/regulation/proposal
- Content-Type:
application/json
请求参数
{
"title": "员工考勤管理制度优化提案",
"content": "建议优化考勤管理制度,增加弹性工作时间...",
"regulationType": "人事制度",
"scope": "全体员工",
"level": "MEDIUM",
"remark": "需要与人事部门协调实施"
}
响应格式
{
"status": 200,
"data": {
"regulationId": "reg005",
"title": "员工考勤管理制度优化提案",
"content": "建议优化考勤管理制度,增加弹性工作时间...",
"regulationType": "人事制度",
"status": "DRAFT",
"publisherId": "1",
"publisherName": "当前用户",
"publishTime": "2024-01-25T10:30:00",
"effectiveTime": "2024-01-25T10:30:00",
"expireTime": "2025-01-25T10:30:00",
"scope": "全体员工",
"level": "MEDIUM",
"version": "1.0",
"remark": "需要与人事部门协调实施",
"createBy": "admin",
"updateBy": "admin",
"createTime": "2024-01-25 10:30:00",
"updateTime": "2024-01-25 10:30:00",
"page": 1,
"pageSize": 10,
"delFlag": "0"
}
}
3. 更新制度提案
请求信息
- URL:
PUT /api/regulation/proposal/{regulationId}
- Content-Type:
application/json
请求参数
{
"title": "员工考勤管理制度优化提案",
"content": "建议优化考勤管理制度,增加弹性工作时间...",
"regulationType": "人事制度",
"scope": "全体员工",
"level": "MEDIUM",
"remark": "需要与人事部门协调实施"
}
响应格式
{
"status": 200,
"message": "制度提案更新成功"
}
4. 删除制度提案
请求信息
- URL:
DELETE /api/regulation/proposal/{regulationId}
- Method: DELETE
响应格式
{
"status": 200,
"data": {
"success": true
}
}
5. 获取制度详情
请求信息
- URL:
GET /api/regulation/{regulationId}
- Method: GET
响应格式
{
"status": 200,
"data": {
"regulationId": "reg001",
"title": "员工考勤管理制度优化提案",
"content": "建议优化考勤管理制度,增加弹性工作时间...",
"regulationType": "人事制度",
"status": "VOTING",
"publisherId": "1",
"publisherName": "张三",
"publishTime": "2024-01-01T12:00:00",
"effectiveTime": "2024-01-01T12:00:00",
"expireTime": "2024-01-08T12:00:00",
"scope": "全体员工",
"level": "MEDIUM",
"version": "1.0",
"remark": "需要与人事部门协调实施",
"createBy": "admin",
"updateBy": "admin",
"createTime": "2024-01-01 10:00:00",
"updateTime": "2024-01-01 12:00:00",
"page": 1,
"pageSize": 10,
"delFlag": "0",
"voteFor": 15,
"voteAgainst": 3,
"voteAbstain": 2
}
}
6. 获取讨论列表
请求信息
- URL:
GET /api/regulation/{regulationId}/discussions
- Method: GET
响应格式
{
"status": 200,
"data": [
{
"id": "1",
"regulationId": "reg001",
"authorId": "2",
"authorName": "李四",
"content": "这个提案很有建设性,建议增加一些具体的实施细则。",
"createTime": "2024-01-01 11:00:00"
},
{
"id": "2",
"regulationId": "reg001",
"authorId": "3",
"authorName": "王五",
"content": "同意这个提案,但需要考虑实施成本。",
"createTime": "2024-01-01 14:30:00"
}
]
}
7. 发表评论
请求信息
- URL:
POST /api/regulation/{regulationId}/discussions
- Content-Type:
application/json
请求参数
{
"content": "这个提案很有建设性,建议增加一些具体的实施细则。"
}
响应格式
{
"status": 200,
"data": {
"id": "3",
"regulationId": "reg001",
"authorId": "1",
"authorName": "当前用户",
"content": "这个提案很有建设性,建议增加一些具体的实施细则。",
"createTime": "2024-01-25 10:30:00"
}
}
8. 提交投票
请求信息
- URL:
POST /api/regulation/{regulationId}/vote
- Content-Type:
application/json
请求参数
{
"voteType": "FOR", // FOR: 赞成, AGAINST: 反对, ABSTAIN: 弃权
"reason": "这个提案很有建设性" // 可选
}
响应格式
{
"status": 200,
"data": {
"success": true
}
}
9. 获取投票结果
请求信息
- URL:
GET /api/regulation/{regulationId}/vote-result
- Method: GET
响应格式
{
"status": 200,
"data": {
"regulationId": "reg001",
"voteFor": 15,
"voteAgainst": 3,
"voteAbstain": 2,
"totalVotes": 20,
"approvalRate": 0.75
}
}
10. 发布制度
请求信息
- URL:
POST /api/regulation/{regulationId}/publish
- Method: POST
响应格式
{
"status": 200,
"data": {
"success": true
}
}
11. 获取已发布制度列表
请求信息
- URL:
GET /api/regulation/published?page=1&size=10
- Method: GET
请求参数
page
: 页码(必填)size
: 页大小(必填)
响应格式
{
"status": 200,
"data": {
"records": [
{
"regulationId": "reg002",
"title": "财务报销流程简化提案",
"content": "建议简化财务报销流程,提高工作效率...",
"regulationType": "财务制度",
"status": "PUBLISHED",
"publisherId": "2",
"publisherName": "李四",
"publishTime": "2024-01-15T14:30:00",
"effectiveTime": "2024-01-15T14:30:00",
"expireTime": "2024-12-31T23:59:59",
"scope": "财务部门及相关员工",
"level": "HIGH",
"version": "1.0",
"remark": "已获得财务部门支持",
"createBy": "admin",
"updateBy": "admin",
"createTime": "2024-01-15 14:30:00",
"updateTime": "2024-01-15 14:30:00",
"confirmStatus": "pending" // pending: 待确认, confirmed: 已确认
}
],
"total": 2,
"size": 10,
"current": 1,
"pages": 1
}
}
12. 确认制度知晓
请求信息
- URL:
POST /api/regulation/{regulationId}/confirm
- Content-Type:
application/json
请求参数
{
"agreeTerms": true
}
响应格式
{
"status": 200,
"data": {
"success": true
}
}
13. 批量确认制度
请求信息
- URL:
POST /api/regulation/confirm-all
- Method: POST
响应格式
{
"status": 200,
"data": {
"success": true,
"confirmedCount": 5
}
}
测试步骤
- 执行建表语句: 运行
regulation_tables.sql
- 插入测试数据: 运行
regulation_test_data.sql
- 启动应用: 确保后端服务正常运行
- 测试接口: 使用Postman或其他工具测试上述接口
注意事项
- 所有接口都需要用户登录认证
- ID字段使用UUID自动生成,无需手动设置
- 创建时间和更新时间会自动设置
- 创建人和更新人会从当前登录用户获取
- 制度状态包括:DRAFT(草稿)、VOTING(投票中)、PUBLISHED(已发布)、ARCHIVED(已归档)
- 投票类型:FOR(赞成)、AGAINST(反对)、ABSTAIN(弃权)