# 巡檢計畫(調整參與人)
## 一、接口認證说明
1. 通過登入認證
* token: 管理後台 -> 流程管理 -> 調用權限取token(如果没有紀錄,需要點擊生成)
* appname: appname和token是一一對應的, 管理後台生成,獲取方式同token.
* username: 管理後台系统用户名。比如admin、工單相關的用户名(創建人、責任人、参與人)
* 生成如下訊息加入 Request header 中:
```
{
"signature":(token).md5(), // token).md5
"appname":appname,
"username": admin
}
```
## 二、人員列表

```
GET
/api/v1.0/accounts/users/brief_info
```
**Request參數**
```
Headers
Content-Type
選填
string
application/json
```
**返回结果**
**200: OK**
```
{
"code": 0,
"data": [
{
"id": 7,
"username": "b10",
"alias": "Q2EWE",
"is_admin": false
},
{
"id": 6,
"username": "lark",
"alias": "小明",
"is_admin": false
},
{
"id": 4,
"username": "alice",
"alias": "Alice",
"is_admin": false
}
],
"msg": ""
}
```
## 三、巡檢計畫列表

```
GET
/api/v1.0/inspection/schedules
```
獲取巡檢計畫列表。
**Request參數**
**Headers**
| Key |type |Value |
| -------- | -------- | -------- |
| appname | string | test |
| signature | string | 91caad0403f52370d69985fcfbbbb606 |
| appname | string | test |
| username | string | admin |
**Query Parameters**
| Key |type |Value |
| -------- | -------- | -------- |
| page | string | 1 |
| per_page | string | 100 |
**返回结果**
**200: OK**
```
{
"code": 0,
"data": {
"value": [
{
"id": 4,
"creator": "admin",
"gmt_created": "2022-11-04 15:30:10",
"gmt_modified": "2022-11-04 15:30:10",
"is_deleted": false,
"tenant_id": "1",
"schedule_id": "4eb5e532-ef64-4c93-89f2-67007ee27be4",
//計畫id
"sn": "Schedule-202211040002",
"schedule_name": "test2",
//計畫名稱
"workflow_id": -1,
"workflow_name": "",
"participant": [
// 計畫參與人
{
"alias": "Alice",
"username": "alice"
}
],
"enable_schedule": false,
"schedule": {
"repeat": true,
"pre_notice": {
"time": 1,
"unit": "minute"
},
"start_time": "",
"repeat_info": {
"repeat_end": {
"type": "on",
"type_value": ""
},
"repeat_every": {
"time": 1,
"unit": "minute"
}
}
},
"comment": "",
"details": [
{
"id": "f9240323-ea3f-40bd-a521-9487021fc941",
"type": "content",
"order": 1,
"required": false
},
{
"id": "a31fe1fb-fb32-43f6-9668-d3379ea7087a",
"type": "content",
"order": 2,
"required": false
}
],
"deadline": null,
"last_start_time": "2022-11-04 15:30:10",
//上次觸發时间
"next_start_time": "2022-11-05 15:30:10",
//下次執行时间
"status": "Finished",
//
"enable_timeout": false,
"timeout_rule": [],
"enable_sign": false,
"signer_list": [],
"checkin_mode": [],
"location_radius": 50,
"creator_info": {
"username": "admin",
"alias": "Admin"
}
}
],
"per_page": 1,
"page": 1,
"total": 4
},
"msg": ""
}
```
## 四、修改計畫參與人

```
PATCH
/api/v1.0/inspection/schedules/participant
```
批量修改計畫參與人
**Request參數**
**Headers**
| Key |type |Value |
| -------- | -------- | -------- |
| Content-Type | string | application/json |
| signature | string | 91caad0403f52370d69985fcfbbbb606 |
| appname | string | test |
| username | string | admin |
**Body Parameters**
| Key |type |Value |
| -------- | -------- | -------- |
| schedule_ids | array| [uuid1, uuid2] //計畫id數組 |
| participants | array| [username1, username2] //参與人用户名 |
**返回结果**
**200: OK**
正常成功
```
{
"code": 0,
"data": true,
"msg": "success"
}
```
**404: Not Found**
如果設置的用户不存在,返回如下
```
{
"code": -1,
"data": {},
"msg": "username=alice1 not found"
}
```