1. 自助分析
1.1. 资源说明
1.1.1. 看板的定义
看板为新的resource, 展现形式与Dashboard一样,权限与App一样。在看板列表中可以看到我自己创建的和别人授权给我的。展示模式分卡片样式和列表样式。有搜索、排序、分类功能。
看板结构说明
Kanban
字段 | 类型 | 描述 |
---|---|---|
id | LONG | 看板id |
folderId | LONG | 看板所在文件夹的id |
area | STRING | 看板所在区域,默认为SELF_SERVICE |
title | STRING | 看板的标题 |
createdBy | LONG | 看板创建者的userId |
createdAt | DATE | 看板创建时间 |
updatedBy | LONG | 看板更新者的userId |
updatedAt | DATE | 看板更新时间 |
hsVersion | LONG | 可选,本次编辑的版本号,从0开始,修改前先GET待修改资源获取当前版本号,修改时带上刚刚获取的版本号,服务端会检查并发冲突。不带版本号不检查并发冲突 |
tenantId | LONG | 租户Id |
options | OBJECT | 看板配置信息 |
options.config | OBJECT | 看板配置信息 |
options.config.version | LONG | 看板创建版本,与系统版本一致 |
options.layouts | MAP | 看板里的图表布局信息 |
KanbanDto
字段 | 类型 | 描述 |
---|---|---|
creator | OBJECT | 看板创建者信息 |
updater | OBJECT | 看板更新者信息 |
action | STRING | 权限描述, admin-read-write是管理者权限,read-write是编辑者权限,read是查看者权限 |
isCollaborated | BOOLEAN | 是否协作 |
parents | OBJECT 数组 | 看板所在的文件夹列表 |
menus | LIST | 看板的三点菜单列表 |
1.2. 接口说明
1.2.1. 1、新增看板
请求URL
POST /api/kanbans
请求参数
request body 请求体
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data | OBJECT | 看板的共同结构见看板结构说明 |
接口示例
- 请求
POST /api/kanbans
{
"title": "新建看板",
"options": {
"config": {
"version": 4300
},
"layouts": {
}
}
}
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#eda33e4",
"code": 0,
"msg": "success",
"data": {
"id": 57,
"folderId": 0,
"area": "SELF_SERVICE",
"title": "新建看板",
"options": {
"config": {
"version": 4300
},
"layouts": {
}
},
"createdBy": 28130,
"createdAt": "2023-02-08 18:00:55",
"updatedBy": 28130,
"updatedAt": "2023-02-08 18:00:55"
}
}
1.2.2. 2、复制看板
请求URL
POST /api/kanbans/{kanbanId}/duplicate
请求参数
request body 请求体
无
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data | OBJECT | 看板的共同结构见看板结构说明 |
接口示例
- 请求
POST /api/kanbans/57/duplicate
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#eda33e4",
"code": 0,
"msg": "success",
"data": {
"id": 58,
"folderId": 0,
"area": "SELF_SERVICE",
"title": "新建看板 (1)",
"options": {
"config": {
"version": 4300
},
"layouts": {
}
},
"createdBy": 28130,
"createdAt": "2023-02-08 18:06:07",
"updatedBy": 28130,
"updatedAt": "2023-02-08 18:06:07",
"isDelete": false
}
}
1.2.3. 3、获取看板中所有的图表数据
请求URL
POST /api/kanbans/{kanbanId}/data
请求参数
request body 请求体
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
timeout | Integer | 否 | 查询超时时间 |
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data | OBJECT | 图表数据,每种图表的共同结构见ChartDto结构说明 |
接口示例
- 请求
POST /api/kanbans/25/data?timeout=3000
[
{
"cacheKey": "01GNXZK96N910XVNFSHPBAAB18",
"appId": 125783,
"options": {
"axes": [
{
"uid": "u125783_3_c10",
"label": "caseWhen",
"kind": "function",
"dataset": 3,
"op": "group",
"args": [
{
"dataset": 3,
"kind": "field",
"op": "c10"
}
],
"datasetId": 3
},
{
"appId": 125783,
"uid": "u125783_3_c22",
"label": "jn1",
"kind": "measure",
"op": "c22",
"datasetId": 3
}
],
"where": [
],
"having": [
],
"sort": [
{
"kind": "reference",
"op": "u125783_3_c22",
"direction": "desc",
"baseUid": "u125783_3_c10"
}
],
"timebar": {
"current": "dateExp",
"dateExp": "All Avaliable Date",
"dateRange": [
],
"show": false
},
"limit": 1000,
"outerWhere": [
]
},
"queryString": {
"refresh": false,
"offset": 0
}
}
]
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#eda33e4",
"code": 0,
"msg": "success",
"data": [
{
"cacheKey": "01GNXZK96N910XVNFSHPBAAB18",
"data": {
"data": [
[
"华东",
47014195
],
[
"中南",
41179330
],
[
"华北",
21889090
],
[
"西北",
7516840
],
[
"西南",
null
],
[
"东北",
null
]
],
"mapData": [
],
"schema": [
{
"fieldName": "u125783_3_c10",
"tags": {
},
"type": "string",
"originType": "string",
"config": {
},
"visible": true,
"nativeType": "text",
"suggestedTypes": [
"string"
],
"detectedType": "string",
"basicType": "string",
"hideValue": false,
"defaultAggrType": "count"
},
{
"fieldName": "u125783_3_c22",
"tags": {
},
"type": "number",
"originType": "number",
"config": {
"dialectName": "EngineDialect"
},
"visible": true,
"nativeType": "numeric",
"suggestedTypes": [
"number",
"string"
],
"detectedType": "number",
"basicType": "number",
"hideValue": false,
"defaultAggrType": "sum"
}
],
"pagable": true,
"importSwitchable": true,
"validFilterUids": [
]
}
}
]
}
1.2.4. 4、获取看板中单个图表数据
请求URL
POST /api/kanbans/{kanbanId}/chart-data
请求参数
request body 请求体
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
refresh | STRING | 否 | 是否强制刷新,取图表数据时,true表示不会用缓存,false表示可以使用缓存 |
enableSample | STRING | 否 | enableSample为true的话,后端计算时对基础数据进行采样,每次运算只取前10000行 |
返回对象的格式说明
接口示例
- 请求
POST /api/apps/125783/chart-data
{
"cacheKey": "01GRRANRV0Z8VA84MY52D3WB7F",
"options": {
"where": [
],
"having": [
],
"outerWhere": [
],
"axes": [
{
"uid": "u_1697bb6ffb9592e7_v",
"kind": "field",
"op": "省/自治区",
"dataset": 3
}
],
"sort": [
{
"baseUid": "u_1697bb6ffb9592e7_v",
"kind": "reference",
"op": "u_1697bb6ffb9592e7_v",
"direction": "asc"
}
]
},
"queryString": {
"limit": 100000
}
}
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#eda33e4",
"code": 0,
"msg": "success",
"data": {
"data": [
[
"上海"
],
[
"云南"
],
[
"内蒙古"
],
[
"北京"
],
[
"吉林"
],
[
"四川"
],
[
"天津"
],
[
"宁夏"
],
[
"安徽"
],
[
"山东"
],
[
"山西"
],
[
"广东"
],
[
"广西"
],
[
"新疆"
],
[
"江苏"
],
[
"江西"
],
[
"河北"
],
[
"河南"
],
[
"浙江"
],
[
"海南"
],
[
"湖北"
],
[
"湖南"
],
[
"甘肃"
],
[
"福建"
],
[
"西藏自治区"
],
[
"贵州"
],
[
"辽宁"
],
[
"重庆"
],
[
"陕西"
],
[
"青海"
],
[
"黑龙江"
]
],
"mapData": [
],
"schema": [
{
"fieldName": "u_1697bb6ffb9592e7_v",
"tags": {
},
"hideValue": false,
"defaultAggrType": "count",
"visible": true,
"type": "string",
"originType": "string",
"config": {
},
"nativeType": "text",
"basicType": "string",
"suggestedTypes": [
"string"
],
"detectedType": "string"
}
],
"pagable": true,
"importSwitchable": true,
"validFilterUids": [
]
}
}
1.2.5. 5、获取看板中的图表数据计数
请求URL
POST /api/kanbans/{kanbanId}/chart-data/count
请求参数
request body 请求体
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
refresh | STRING | 否 | 是否强制刷新,取图表数据时,true表示不会用缓存,false表示可以使用缓存 |
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data.totalHits | INTEGER | 图表数据的总行数 |
接口示例
- 请求
POST /api/kanbans/125783/chart-data/count
{
"cacheKey": "01GRRANRV0Z8VA84MY52D3WB7F",
"options": {
"where": [
],
"having": [
],
"outerWhere": [
],
"axes": [
{
"uid": "u_1697bb6ffb9592e7_v",
"kind": "field",
"op": "省/自治区",
"dataset": 3
}
],
"sort": [
{
"baseUid": "u_1697bb6ffb9592e7_v",
"kind": "reference",
"op": "u_1697bb6ffb9592e7_v",
"direction": "asc"
}
]
},
"queryString": {
"limit": 100000
}
}
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#eda33e4",
"code": 0,
"msg": "success",
"data": {
"data": [
],
"totalHits": 10
}
}
1.2.6. 6、轮询获取看板中的图表数据
请求URL
POST /api/kanbans/{kanbanId}/poll-data
请求参数
request body 请求体
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
originRequestId | STRING | 是 | 源请求Id |
timeout | Integer | 否 | 查询超时时间 |
返回对象的格式说明
接口示例
- 请求
POST /api/kanbans/25/poll-data
[
{
"cacheKey": "01GNXZK96N910XVNFSHPBAAB18",
"appId": 125783,
"options": {
"axes": [
{
"uid": "u125783_3_c10",
"label": "caseWhen",
"kind": "function",
"dataset": 3,
"op": "group",
"args": [
{
"dataset": 3,
"kind": "field",
"op": "c10"
}
],
"datasetId": 3
},
{
"appId": 125783,
"uid": "u125783_3_c22",
"label": "jn1",
"kind": "measure",
"op": "c22",
"datasetId": 3
}
],
"where": [
],
"having": [
],
"sort": [
{
"kind": "reference",
"op": "u125783_3_c22",
"direction": "desc",
"baseUid": "u125783_3_c10"
}
],
"timebar": {
"current": "dateExp",
"dateExp": "All Avaliable Date",
"dateRange": [
],
"show": false
},
"limit": 1000,
"outerWhere": [
]
},
"queryString": {
"refresh": false,
"offset": 0
}
}
]
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#eda33e4",
"code": 0,
"msg": "success",
"data": [
{
"cacheKey": "01GNXZK96N910XVNFSHPBAAB18",
"data": {
"data": [
[
"华东",
47014195
],
[
"中南",
41179330
],
[
"华北",
21889090
],
[
"西北",
7516840
],
[
"西南",
null
],
[
"东北",
null
]
],
"mapData": [
],
"schema": [
{
"fieldName": "u125783_3_c10",
"tags": {
},
"type": "string",
"originType": "string",
"config": {
},
"visible": true,
"nativeType": "text",
"suggestedTypes": [
"string"
],
"detectedType": "string",
"basicType": "string",
"hideValue": false,
"defaultAggrType": "count"
},
{
"fieldName": "u125783_3_c22",
"tags": {
},
"type": "number",
"originType": "number",
"config": {
"dialectName": "EngineDialect"
},
"visible": true,
"nativeType": "numeric",
"suggestedTypes": [
"number",
"string"
],
"detectedType": "number",
"basicType": "number",
"hideValue": false,
"defaultAggrType": "sum"
}
],
"pagable": true,
"importSwitchable": true,
"validFilterUids": [
]
}
}
]
}
1.2.7. 7、更新看板
请求URL
PUT /api/kanbans/{kanbanId}
请求参数
request body 请求体
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data | OBJECT | 看板的共同结构见看板结构说明 |
接口示例
- 请求
PUT /api/kanbans/59
{
"id": 59,
"folderId": 0,
"area": "SELF_SERVICE",
"title": "新建看板",
"options": {
"config": {
"version": 4300
},
"layouts": {
"01GRT32MSJF75XDVYAZVDNJYMQ": {
"i": "01GRT32MSJF75XDVYAZVDNJYMQ",
"x": 0,
"y": 0,
"w": 6,
"h": 6,
"moved": false,
"static": false,
"zIndex": 901,
"type": "chart",
"version": 4300,
"createdAt": "2023/2/9 11:21:33",
"updatedAt": "2023/2/9 11:21:33",
"measures": [
{
"enable": true,
"appId": 126243,
"datasetId": 32,
"fieldName": "c1",
"labelPlaceholder": "日期"
}
],
"dimensions": [
],
"filters": [
]
}
}
},
"createdBy": 11549,
"createdAt": "2023-02-08 18:33:26",
"updatedBy": 11549,
"updatedAt": "2023-02-08 18:33:26",
"isDelete": false
}
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#3d8a1a5",
"code": 0,
"msg": "success",
"data": {
"id": 59,
"folderId": 0,
"area": "SELF_SERVICE",
"title": "新建看板",
"options": {
"config": {
"version": 4300
},
"layouts": {
"01GRT32MSJF75XDVYAZVDNJYMQ": {
"static": false,
"moved": false,
"h": 6,
"i": "01GRT32MSJF75XDVYAZVDNJYMQ",
"filters": [
],
"type": "chart",
"version": 4300,
"createdAt": "2023/2/9 11:21:33",
"measures": [
{
"fieldName": "c1",
"enable": true,
"labelPlaceholder": "日期",
"appId": 126243,
"datasetId": 32
}
],
"w": 6,
"x": 0,
"y": 0,
"zIndex": 901,
"updatedAt": "2023/2/9 11:21:33",
"dimensions": [
]
}
}
},
"createdBy": 11549,
"createdAt": "2023-02-08 18:33:26",
"updatedBy": 11549,
"updatedAt": "2023-02-09 11:21:41",
"isDelete": false
}
}
1.2.8. 8、分页查询看板
请求URL
GET /api/kanbans
请求参数
request body 请求体
无
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
limit | INTEGER | 否 | 分页获取个数,默认是1000 |
offset | INTEGER | 否 | 分页偏移量,默认是0 |
orderBy | STRING | 否 | 排序字段 |
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data | OBJECT | 看板的共同结构见看板结构说明 |
totalHits | INTEGER | 看板总数量 |
offset | INTEGER | 当前分页偏移量 |
接口示例
- 请求
GET /api/kanbans
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#3d8a1a5",
"code": 0,
"msg": "success",
"data": [
{
"id": 1,
"folderId": 0,
"area": "SELF_SERVICE",
"title": "新建看板",
"options": {
"config": {
"version": 4300
},
"layouts": {
}
},
"createdBy": 28125,
"createdAt": "2022-12-27 10:27:47",
"updatedBy": 28125,
"updatedAt": "2022-12-27 10:27:47",
"isDelete": false
}
],
"totalHits": 44,
"offset": 0
}
1.2.9. 9、根据Id查询看板
请求URL
GET /api/kanbans/{kanbanId}
请求参数
request body 请求体
无
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
data | OBJECT | 看板的共同结构见看板结构说明 |
接口示例
- 请求
GET /api/kanbans/59
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#3d8a1a5",
"code": 0,
"msg": "success",
"data": {
"id": 59,
"folderId": 0,
"area": "SELF_SERVICE",
"title": "新建看板",
"options": {
"config": {
"version": 4300
},
"layouts": {
"01GRT32MSJF75XDVYAZVDNJYMQ": {
"static": false,
"moved": false,
"h": 6,
"i": "01GRT32MSJF75XDVYAZVDNJYMQ",
"filters": [
],
"type": "chart",
"version": 4300,
"createdAt": "2023/2/9 11:21:33",
"measures": [
{
"fieldName": "c1",
"enable": true,
"labelPlaceholder": "日期",
"appId": 126243,
"datasetId": 32
}
],
"w": 6,
"x": 0,
"y": 0,
"zIndex": 901,
"updatedAt": "2023/2/9 11:21:33",
"dimensions": [
]
}
}
},
"createdBy": 11549,
"createdAt": "2023-02-08 18:33:26",
"updatedBy": 11549,
"updatedAt": "2023-02-09 11:21:41",
"isDelete": false,
"creator": {
"id": 11549,
"name": "陈静",
"email": "1057998108@qq.com",
"loginName": "chenjing"
},
"updater": {
"id": 11549,
"name": "陈静",
"email": "1057998108@qq.com",
"loginName": "chenjing"
},
"action": "||admin|read|write",
"parents": [
{
"id": 0,
"title": "personal_area_root_folder",
"options": {
"rootType": "PERSONAL_ROOT_FOLDER"
},
"isDelete": false,
"area": "SELF_SERVICE"
}
]
}
}
1.2.10. 10、根据Id删除看板
请求URL
DELETE /api/kanbans/{kanbanId}
请求参数
request body 请求体
无
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
msg | STRING | 成功返回 success |
接口示例
- 请求
DELETE /api/kanbans/59
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#3d8a1a5",
"code": 0,
"msg": "success"
}
1.2.11. 11、导出看板数据
请求URL
POST /api/kanbans/{kanbanId}/async-download
请求参数
request body 请求体
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
chartOptions | OBJECT | 否 | 图表配置 |
chartNames | OBJECT | 否 | 图表名称 |
chartOuterWheres | OBJECT | 否 | 图表过滤条件 |
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
timeout | Integer | 否 | 导出超时时间 |
返回对象的格式说明
返回一个zip文件,文件名是看板的名称,解压后的excel文件中每个sheet对应一个图表的聚合数据
1.2.12. 12、轮询导出看板数据
请求URL
GET /api/kanbans/{kanbanId}/poll-download
请求参数
request body 请求体
无
URL 参数
字段 | 类型 | 是否必须 | 说明 |
---|---|---|---|
originRequestId | STRING | 是 | 源请求Id |
返回对象的格式说明
如果导出任务没有完成,返回PENDING状态;若任务已完成,返回一个zip文件,文件名是看板的名称,解压后的excel文件中每个sheet对应一个图表的聚合数据
1.2.13. 13、解除协作
请求URL
DELETE /api/kanbans/{kanbanId}/collaborate/cancel
请求参数
request body 请求体
无
返回对象的格式说明
字段 | 类型 | 说明 |
---|---|---|
version | STRING | 当前系统版本哈希值 |
msg | STRING | 成功返回 success |
接口示例
- 请求
DELETE /api/kanbans/59/collaborate/cancel
- 响应结果
{
"version": "4.3-SNAPSHOT@7074024#3d8a1a5",
"code": 0,
"msg": "success"
}