反馈已提交

网络繁忙

您正在浏览的是 FineBI7.X 帮助文档,点击跳转至: FineBI6.X帮助文档

指标数据查询/校验接口

  • 文档创建者:April陶
  • 历史版本:5
  • 最近更新:April陶 于 2026-01-28
  • 1. 概述

    1.1 版本

    FineBI 版本
    功能变动
    7.0.7
    -

    1.2 应用场景

    本文讲解 FineBI 中发布到「数据目录」的指标维度的数据结果查询,以及数据校验相关的 API 接口。

    1.3 前置条件

    认证方式请参考文档:指标服务

    超管给需要调取接口数据的用户分配「指标管理」权限。如下图所示:

    有「指标管理」权限的用户在「数据目录」中查看发布的指标/维度可「查询配置」情况,在获取接口配置 body 请求 JSON 时可进行参考。

    注:返回的配置详情跟随数据校验的「预览数据」结果变化。

    2. 数据查询

    接口简介



    接口作用

    对维度/指标进行数据结果查询或进行数据校验。

    指标/维度支持配置维度、指标、过滤、排序、分页信息后进行数据查询。其中,日期维度支持设置分组方式,明细指标支持选择汇总方式

    接口URL/api/dc/{version}/indicator/query/data
    请求类型POST

    请求参数

    Path 参数

    参数名
    类型参数值是否必填
    versionstring

    接口版本号

    示例:v1

    Body 参数

    参数名
    类型参数值是否必填
    dimensions

    array[string]

    使用的维度

    metricsarray[string]

    使用的指标

    sourceobject 用到的所有指标维度map
    fieldIdstring指标/维度id
    resourceTypeinteger 类型
    summary

    object

    (分组汇总)汇总

    简单类型:

    • type(integer 

    百分位:

    • type( enum<integer>)固定值:27

    • paras(array[string])

    • 枚举值:

    • 0.05

    • 0.1

    • 0.25

    • 0.5

    • 0.75

    • 0.9

    • 0.95

    groupobject

    (分组汇总)分组

    简单类型:

    • type(integer 

    百分位:

    • type( enum<integer>)固定值:27

    • paras(array[string])

    • 枚举值:

    • 0.05

    • 0.1

    • 0.25

    • 0.5

    • 0.75

    • 0.9

    • 0.95

    filtersarray[object]过滤条件
    ordersarray[string]排序的字段
    limitobject 分页信息
    pageSizestring分页数据量
    pageIndexstring分页页码
    rowCountstring总数据量
    engineTypestring

    引擎类型

    响应实例




    请求示例

    http://secure.finedevelop.com:00000/webroot/decision/api/dc/v1/indicator/query/data

    响应成功

    返回数据校验结果

    截图示意

    在数据目录选择校验的指标「毛利率」进行校验并预览,点击「查询配置」复制信息获取数据校验配置,粘贴到请求body中。(若只查询结果,则直接点击「查询配置」)

    请求:

    响应:

    {
        "success": true,
        "code": "200",
        "message": "success",
        "data": {
            "fields": [
                {
                    "id": "b69615a3-6530-41c0-935e-7d2cb10c383b",
                    "name": "日期",
                    "type": 48
                },
                {
                    "id": "a2594100-58bf-4d4d-af00-839722e86a43",
                    "name": "毛利率",
                    "type": 32
                }
            ],
            "data": [
                [
                    "2019-01",
                    "0.61"
                ],
                [
                    "2019-02",
                    "0.53"
                ],
                [
                    "2019-03",
                    "0.59"
                ],
                [
                    "2019-04",
                    "0.61"
                ],
                [
                    "2019-05",
                    "0.6"
                ],
                [
                    "2019-06",
                    "0.59"
                ],
                [
                    "2019-07",
                    "0.61"
                ],
                [
                    "2019-08",
                    "0.48"
                ]
            ],
            "pageInfo": {
                "rowCount": 8,
                "pageSize": 100,
                "pageIndex": 1
            }
        },
        "errorCode": null,
        "detailErrorMsg": null,
        "errorMsg": null
    }


    响应参数说明

    参数参数值
    fields字段
    id字段id
    name字段名
    type

    数据类

    • 16:文本

    • 32:数值

    • 48:时间

    data维度值
    pageinfo分页
    pageCount分页数据量
    pageIndex分页页码
    rowCount总数据量


    3. SQL查询

    接口简介



    接口作用直连环境下,获取指标查询SQL
    接口URL/api/dc/{version}/indicator/query/sql
    请求类型POST

    请求参数

    Path 参数

    参数名
    类型参数值是否必填
    versionstring

    接口版本号

    示例:v1

    Body 参数

    参数名
    类型参数值是否必填
    dimensions

    array[string]

    使用的维度

    metricsarray[string]

    使用的指标

    sourceobject 用到的所有指标维度map
    fieldIdstring指标/维度id
    resourceTypeinteger 类型
    summary

    object

     

    (分组汇总)汇总

    简单类型:

    • type(integer 

    百分位:

    • type( enum<integer>)固定值:27

    • paras(array[string])

    • 枚举值:

    • 0.05

    • 0.1

    • 0.25

    • 0.5

    • 0.75

    • 0.9

    • 0.95

    groupobject

    (分组汇总)分组

    简单类型:

    • type(integer 

    百分位:

    • type( enum<integer>)固定值:27

    • paras(array[string])

    • 枚举值:

    • 0.05

    • 0.1

    • 0.25

    • 0.5

    • 0.75

    • 0.9

    • 0.95

    filtersarray[object]过滤条件
    ordersarray[string]排序的字段
    limitobject 分页信息
    pageSizestring分页数据量
    pageIndexstring分页页码
    rowCountstring总数据量
    engineTypestring

    引擎类型



    响应实例



    请求示例

    http://192.168.5.102:38899/webroot/decision/api/dc/v1/indicator/query/sql

    响应成功

    返回指标的 SQL 查询结果,与指标「请求配置>查询SQL」下的信息相同。

    select
      `t15`.`__fcol_72` as `__fcol_74`,
      `t15`.`__fcol_73` as `__fcol_75`
    from
      (
        select
          `t5`.`__fcol_25` as `__fcol_72`,
          sum(`t13`.`__fcol_69`) as `__fcol_73`
        from
          (
            select
              `t3`.`__fcol_12` as `__fcol_22`,
              `t3`.`__fcol_13` as `__fcol_23`,
              `t3`.`__fcol_14` as `__fcol_24`,
              `t0`.`__fcol_1` as `__fcol_25`
            from
              (
                select
                  date(`T_0ED77E705BA8425D9D1B0`.`注册时间`) as `__fcol_1`,
                  (
                    cast(year(`T_0ED77E705BA8425D9D1B0`.`注册时间`) as signed) - 1
                  ) as `__fcol_2`,
                  month(`T_0ED77E705BA8425D9D1B0`.`注册时间`) as `__fcol_3`,
                  day(`T_0ED77E705BA8425D9D1B0`.`注册时间`) as `__fcol_4`
                from
                  (
                    SELECT
                      *
                    FROM
                      合同信息表
                  ) as `T_0ED77E705BA8425D9D1B0`
                where
                  (
                    `T_0ED77E705BA8425D9D1B0`.`注册时间` >= timestamp('2025-12-17 10:23:22.0')
                    and `T_0ED77E705BA8425D9D1B0`.`注册时间` < timestamp('2026-01-16 10:23:23.0')
                  )
                group by
                  1,
                  2,
                  3,
                  4
              ) as `t0`
              join (
                select
                  date(`t1`.`__fcol_5`) as `__fcol_12`,
                  `T_E284FF5BF8344B10A1888`.`记录人` as `__fcol_13`,
                  `t1`.`__fcol_6` as `__fcol_14`,
                  cast(year(`t1`.`__fcol_5`) as signed) as `__fcol_15`,
                  month(`t1`.`__fcol_5`) as `__fcol_16`,
                  day(`t1`.`__fcol_5`) as `__fcol_17`
                from
                  (
                    select
                      `T_0ED77E705BA8425D9D1B0_0`.`注册时间` as `__fcol_5`,
                      `T_0ED77E705BA8425D9D1B0_0`.`合同签约时间` as `__fcol_6`,
                      `T_0ED77E705BA8425D9D1B0_0`.`合同ID` as `__fcol_7`
                    from
                      (
                        SELECT
                          *
                        FROM
                          合同信息表
                      ) as `T_0ED77E705BA8425D9D1B0_0`
                    where
                      (
                        `T_0ED77E705BA8425D9D1B0_0`.`注册时间` < timestamp('2025-01-16 10:23:23.0')
                        and `T_0ED77E705BA8425D9D1B0_0`.`注册时间` >= timestamp('2024-12-17 10:23:22.0')
                      )
                  ) as `t1`
                  join (
                    SELECT
                      *
                    FROM
                      合同回款信息
                  ) as `T_E284FF5BF8344B10A1888` on `t1`.`__fcol_7` = `T_E284FF5BF8344B10A1888`.`合同ID`
                group by
                  1,
                  2,
                  3,
                  4,
                  5,
                  6
              ) as `t3` on (
                ifnull(`t0`.`__fcol_2`, 0) = ifnull(`t3`.`__fcol_15`, 0)
                and case
                  when `t0`.`__fcol_2` is not null then 0
                  else 1
                end = case
                  when `t3`.`__fcol_15` is not null then 0
                  else 1
                end
                and ifnull(`t0`.`__fcol_3`, 0) = ifnull(`t3`.`__fcol_16`, 0)
                and case
                  when `t0`.`__fcol_3` is not null then 0
                  else 1
                end = case
                  when `t3`.`__fcol_16` is not null then 0
                  else 1
                end
                and ifnull(`t0`.`__fcol_4`, 0) = ifnull(`t3`.`__fcol_17`, 0)
                and case
                  when `t0`.`__fcol_4` is not null then 0
                  else 1
                end = case
                  when `t3`.`__fcol_17` is not null then 0
                  else 1
                end
              )
            group by
              1,
              2,
              3,
              4
          ) as `t5`
          join (
            select
              date(`t8`.`__fcol_42`) as `__fcol_66`,
              `t8`.`__fcol_40` as `__fcol_67`,
              `t8`.`__fcol_43` as `__fcol_68`,
              sum(
                case
                  when (
                    case
                      when (
                        `t8`.`__fcol_40` = '徐弘'
                        or (
                          '徐弘' is null
                          and `t8`.`__fcol_40` is null
                        )
                      ) then 1
                      else 0
                    end <> 0
                    and case
                      when (
                        `t8`.`__fcol_44` = '一次性付款'
                        or (
                          '一次性付款' is null
                          and `t8`.`__fcol_44` is null
                        )
                      ) then 1
                      else 0
                    end <> 0
                  ) then `t8`.`__fcol_41`
                  else null
                end
              ) as `__fcol_69`
            from
              (
                select
                  `t7`.`__fcol_32` as `__fcol_39`,
                  `t7`.`__fcol_33` as `__fcol_40`,
                  `t7`.`__fcol_34` as `__fcol_41`,
                  `t7`.`__fcol_35` as `__fcol_42`,
                  `t7`.`__fcol_36` as `__fcol_43`,
                  `t7`.`__fcol_37` as `__fcol_44`,
                  `t7`.`__fcol_38` as `__fcol_45`
                from
                  (
                    select
                      `T_E284FF5BF8344B10A1888_0`.`付款时间` as `__fcol_32`,
                      `T_E284FF5BF8344B10A1888_0`.`记录人` as `__fcol_33`,
                      `T_E284FF5BF8344B10A1888_0`.`回款金额` as `__fcol_34`,
                      `T_0ED77E705BA8425D9D1B0_1`.`注册时间` as `__fcol_35`,
                      `T_0ED77E705BA8425D9D1B0_1`.`合同签约时间` as `__fcol_36`,
                      `T_0ED77E705BA8425D9D1B0_1`.`合同付款类型` as `__fcol_37`,
                      date(`T_0ED77E705BA8425D9D1B0_1`.`注册时间`) as `__fcol_38`
                    from
                      (
                        SELECT
                          *
                        FROM
                          合同回款信息
                      ) as `T_E284FF5BF8344B10A1888_0`
                      left outer join (
                        SELECT
                          *
                        FROM
                          合同信息表
                      ) as `T_0ED77E705BA8425D9D1B0_1` on `T_E284FF5BF8344B10A1888_0`.`合同ID` = `T_0ED77E705BA8425D9D1B0_1`.`合同ID`
                  ) as `t7`
                where
                  (
                    `t7`.`__fcol_35` < timestamp('2025-01-16 10:23:23.0')
                    and `t7`.`__fcol_35` >= timestamp('2024-12-17 10:23:22.0')
                  )
              ) as `t8`
              left outer join (
                select
                  date(`t9`.`__fcol_46`) as `__fcol_54`,
                  `T_E284FF5BF8344B10A1888_1`.`记录人` as `__fcol_55`,
                  `t9`.`__fcol_47` as `__fcol_56`,
                  max(`T_E284FF5BF8344B10A1888_1`.`付款时间`) as `__fcol_57`
                from
                  (
                    SELECT
                      *
                    FROM
                      合同回款信息
                  ) as `T_E284FF5BF8344B10A1888_1`
                  join (
                    select
                      `T_0ED77E705BA8425D9D1B0_2`.`注册时间` as `__fcol_46`,
                      `T_0ED77E705BA8425D9D1B0_2`.`合同签约时间` as `__fcol_47`,
                      `T_0ED77E705BA8425D9D1B0_2`.`合同ID` as `__fcol_48`
                    from
                      (
                        SELECT
                          *
                        FROM
                          合同信息表
                      ) as `T_0ED77E705BA8425D9D1B0_2`
                    where
                      (
                        `T_0ED77E705BA8425D9D1B0_2`.`注册时间` < timestamp('2025-01-16 10:23:23.0')
                        and `T_0ED77E705BA8425D9D1B0_2`.`注册时间` >= timestamp('2024-12-17 10:23:22.0')
                      )
                  ) as `t9` on `T_E284FF5BF8344B10A1888_1`.`合同ID` = `t9`.`__fcol_48`
                group by
                  1,
                  2,
                  3
              ) as `t11` on (
                ifnull(`t8`.`__fcol_45`, date('2000-01-01')) = ifnull(`t11`.`__fcol_54`, date('2000-01-01'))
                and case
                  when `t8`.`__fcol_45` is not null then 0
                  else 1
                end = case
                  when `t11`.`__fcol_54` is not null then 0
                  else 1
                end
                and ifnull(`t8`.`__fcol_40`, '0') = ifnull(`t11`.`__fcol_55`, '0')
                and case
                  when `t8`.`__fcol_40` is not null then 0
                  else 1
                end = case
                  when `t11`.`__fcol_55` is not null then 0
                  else 1
                end
                and ifnull(`t8`.`__fcol_43`, date('2000-01-01')) = ifnull(`t11`.`__fcol_56`, date('2000-01-01'))
                and case
                  when `t8`.`__fcol_43` is not null then 0
                  else 1
                end = case
                  when `t11`.`__fcol_56` is not null then 0
                  else 1
                end
              )
            where
              not(
                cast((`t8`.`__fcol_39` = `t11`.`__fcol_57`) as signed) = 0
              )
            group by
              1,
              2,
              3
          ) as `t13` on (
            ifnull(`t5`.`__fcol_22`, date('2000-01-01')) = ifnull(`t13`.`__fcol_66`, date('2000-01-01'))
            and case
              when `t5`.`__fcol_22` is not null then 0
              else 1
            end = case
              when `t13`.`__fcol_66` is not null then 0
              else 1
            end
            and ifnull(`t5`.`__fcol_23`, '0') = ifnull(`t13`.`__fcol_67`, '0')
            and case
              when `t5`.`__fcol_23` is not null then 0
              else 1
            end = case
              when `t13`.`__fcol_67` is not null then 0
              else 1
            end
            and ifnull(`t5`.`__fcol_24`, date('2000-01-01')) = ifnull(`t13`.`__fcol_68`, date('2000-01-01'))
            and case
              when `t5`.`__fcol_24` is not null then 0
              else 1
            end = case
              when `t13`.`__fcol_68` is not null then 0
              else 1
            end
          )
        group by
          1
      ) as `t15`
    order by
      `t15`.`__fcol_72` asc
    limit
      5000


    截图示意

    点击「查询配置」复制信息获取数据校验请求配置,粘贴到请求body中。

    请求:

    响应:

    响应参数说明

    参数参数值
    sqlsql



    附件列表


    主题: 指标中心
    • 有帮助
    • 没帮助
    • 只是浏览
    中文(简体)

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭



    AI

    联系我们
    在线支持
    获取专业技术支持,快速帮助您解决问题
    工作日9:00-12:00,13:30-17:30在线
    页面反馈
    针对当前网页的建议、问题反馈
    售前咨询
    采购需求/获取报价/预约演示
    或拨打: 400-811-8890 转1
    qr
    热线电话
    咨询/故障救援热线:400-811-8890转2
    总裁办24H投诉:17312781526
    提交页面反馈
    仅适用于当前网页的意见收集,帆软产品问题请在 问答板块提问前往服务平台 获取技术支持