### 00\_初始化巡检任务

- 接口地址：/api/publishkit/inspection/initTask
- 接口方法：POST
- 接口入参

```json
{
    "appId": 1071844015435243521
}
```

- 接口响应

```json
{
    "code": 200,
    "msg": "接口返回成功",
    "status": true,
    "data": {
        "id": "1078963190198607872",
        "createTime": 1734415694000,
        "updateTime": 1734415694000,
        "creator": "3573816849586689557",
        "tenantKey": "t2k74i3rjo",
        "deleteType": 0,
        "appId": "1071844015435243521",
        "appName": "页面变量HYL",
        "groupModule": "crm",
        "taskStatus": 2,
        "inspectMode": 0
    },
    "fail": false
}
```

### 01\_获取任务详情

- 接口地址：/api/publishkit/inspection/getTask?taskId=1069333637258321920
- 接口方法：POST
- 接口入参：暂无
- 接口响应：

```json
{
    "code": 200,
    "msg": "接口返回成功",
    "status": true,
    "data": {
        "currentStep": 2,
        "columns": [
            {
                "title": "服务名",
                "dataIndex": "exeService"
            },
            {
                "title": "任务名称",
                "dataIndex": "exeTaskName"
            },
            {
                "title": "状态",
                "dataIndex": "statusVo"
            },
            {
                "title": "错误",
                "dataIndex": "exeMsg"
            }
        ],
        "details": [
            {
                "id": "1078963207185539072",
                "createTime": 1734415698000,
                "updateTime": 1734415698000,
                "tenantKey": "t2k74i3rjo",
                "deleteType": 0,
                "appId": "1071844015435243521",
                "exeService": "weaver-basic-web-service",
                "exeStatus": "running",
                "exeTaskId": "1078963190198607872",
                "exeTaskName": "form_AppInfoService",
                "exeIp": "10.12.102.25",
                "statusVo": {
                    "text": "刷新中",
                    "color": "primary"
                }
            }
         
        ],
        "taskStatus": 2,
        "steps": [
            {
                "id": "1078963190198607873",
                "createTime": 1734415695000,
                "updateTime": 1734415695000,
                "tenantKey": "t2k74i3rjo",
                "deleteType": 0,
                "taskId": 1078963190198607872,
                "inspectionStep": 0,
                "inspectionTitle": "初始化",
                "inspectionDesc": "finish"
            },
            {
                "id": "1078963190198607874",
                "createTime": 1734415695000,
                "updateTime": 1734415695000,
                "tenantKey": "t2k74i3rjo",
                "deleteType": 0,
                "taskId": 1078963190198607872,
                "inspectionStep": 1,
                "inspectionTitle": "服务状态巡检",
                "inspectionDesc": "finish"
            },
            {
                "id": "1078963190198607875",
                "createTime": 1734415695000,
                "updateTime": 1734415695000,
                "tenantKey": "t2k74i3rjo",
                "deleteType": 0,
                "taskId": 1078963190198607872,
                "inspectionStep": 2,
                "inspectionTitle": "引用配置巡检",
                "inspectionDesc": "process"
            },
            {
                "id": "1078963190198607876",
                "createTime": 1734415695000,
                "updateTime": 1734415695000,
                "tenantKey": "t2k74i3rjo",
                "deleteType": 0,
                "taskId": 1078963190198607872,
                "inspectionStep": 3,
                "inspectionTitle": "应用配置巡检",
                "inspectionDesc": "wait"
            }
        ]
    },
    "fail": false
}
```

### **02\_获取任务列表**

- 接口地址：/api/publishkit/inspection/getTasks
- 接口方法：POST
- 接口入参：

```json
{
    "page": 1,
    "pageSize": 10
}
```

- 接口响应：

```json
{
    "code": 200,
    "msg": "接口返回成功",
    "status": true,
    "data": {
        "records": [
            {
                "id": "1078963190198607872",
                "createTime": 1734415694000,
                "updateTime": 1734415694000,
                "creator": "3573816849586689557",
                "tenantKey": "t2k74i3rjo",
                "deleteType": 0,
                "appId": "1071844015435243521",
                "appName": "页面变量HYL",
                "groupModule": "crm",
                "taskStatus": 2, // 任务状态：0-等待调度；1-初始化；2-巡检中；3-成功；4-失败;5-取消巡检
                "inspectResult": 0, // 巡检结果：0-通过；1-巡检有错误（此时展示【巡检报告】按钮）
                "inspectMode": 0, // 巡检模式：0-单个巡检；1-批量巡检
                "creatorName": "梁威"
            }
        ],
        "total": 2,
        "size": 10,
        "current": 1,
        "orders": [],
        "optimizeCountSql": true,
        "hitCount": false,
        "searchCount": true,
        "pages": 1
    },
    "fail": false
}
```

> 修改点1：【巡检报告】按钮显示条件改为 inspectResult = 1
> 
> [图片附件未整合: ../_assets/288831275014291456/001-dd928d64fb.png]

### **03\_获取巡检报告**

- 接口地址：/api/publishkit/inspection/getReport?taskId=1069333637258321920&onlyError=true
- 接口方法：POST
- 接口入参：无
- 接口响应：

```json
{
	"code": 200,
	"msg": "接口返回成功",
	"status": true,
	"data": [
		{
			"currentStep": 2,
			"columns": [],
			"details": []
		},
		{
			"currentStep": 3,
			"columns": [],
			"details": []
		}
	],
	"fail": false
}
```

### **04\_停止任务**

- 接口地址：/api/publishkit/inspection/stopTask?taskId=1068950934052323329
- 接口方法：POST
- 接口入参：无
- 接口响应:

```json
{
	"code": 200,
	"msg": "接口返回成功",
	"status": true,
	"data": true,
	"fail": false
}
```
