task-reminder/test-bug-api.md

131 lines
3.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 禅道统一项目状态提醒功能测试指南
## 功能概述
已成功实现禅道统一项目状态提醒功能,现在系统支持:
1. **统一项目状态提醒** - 一个通知包含任务和BUG推荐
2. **单独任务提醒** - 仅任务通知(兼容性)
3. **单独BUG提醒** - 仅BUG通知兼容性
## 新增的API接口
### 1. 测试禅道BUG连接
```
GET /api/reminder/zentao/bugs/test/{groupId}
```
**功能**: 测试禅道BUG API连接获取未解决的BUG列表
**响应示例**:
```json
{
"success": true,
"message": "禅道BUG API连接成功",
"bugCount": 5,
"bugs": [
{
"id": "123",
"title": "登录页面显示异常",
"status": "active",
"severity": "2",
"assignedTo": "zhangsan",
"deadline": "2025-06-01"
}
]
}
```
### 2. 手动触发禅道BUG提醒
```
POST /api/reminder/zentao/bugs/reminder/{groupId}
```
**功能**: 手动发送禅道BUG提醒到企业微信群
**响应示例**:
```json
{
"success": true,
"message": "禅道BUG提醒已发送"
}
```
## 配置说明
BUG功能直接使用现有的 `project-id` 配置,无需额外配置:
```yaml
zentao:
api-url: "https://zentao.iscmtech.com"
username: "admin"
password: "password"
project-id: 38 # 同时用于获取任务和BUG
```
## 消息格式
### BUG提醒消息示例
```
**禅道BUG提醒**
项目: 一站式平台
未解决BUG: 3个已过期: 1个
张三 (2个BUG)
- 🔴 [238] 测试任务2 [严重] (2025-05-28)
- 🐛 [236] 测试任务 [一般] (2025-05-28)
请及时登录禅道系统处理BUG
```
## 技术实现
### 新增文件:
1. `ZentaoBug.java` - BUG数据模型
2. `ZentaoBugReminderTest.java` - BUG功能测试
### 修改文件:
1. `ZentaoApiService.java` - 添加获取BUG的API方法
2. `ZentaoTaskReminderService.java` - 添加BUG提醒逻辑
3. `TaskReminderController.java` - 添加BUG相关API接口
4. `TaskReminderConfig.java` - 添加productId配置字段
5. `application.yml` - 添加产品ID配置
6. `ZENTAO_INTEGRATION.md` - 更新文档
## 测试步骤
1. **启动应用程序**
2. **测试BUG连接**:
```bash
curl http://localhost:8080/api/reminder/zentao/bugs/test/zentao-team
```
3. **手动触发BUG提醒**:
```bash
curl -X POST http://localhost:8080/api/reminder/zentao/bugs/reminder/zentao-team
```
## 特性说明
- **自动过滤**: 只显示未解决的BUG状态不是 resolved 或 closed
- **过期标识**: 🔴 表示已过期的BUG🐛 表示普通未解决BUG
- **严重程度**: 显示BUG的严重程度致命、严重、一般、轻微
- **@人功能**: 支持根据用户映射配置@相关负责人
- **统计信息**: 显示总BUG数和过期BUG数
## 注意事项
1. **项目ID复用**: 系统直接使用 `project-id` 作为产品ID来获取BUG在大多数禅道配置中项目ID和产品ID是相同的
2. **API兼容性**: 使用禅道开源版 RESTful API v1
3. **权限要求**: 配置的禅道用户需要有产品的BUG查看权限
4. **数据格式**: BUG数据结构与任务数据结构不同使用专门的ZentaoBug模型处理
## 后续扩展
可以考虑添加:
- 定时BUG提醒类似任务提醒的定时功能
- BUG优先级过滤
- BUG类型分类显示
- BUG处理时间统计