Дэшборд
Получение отчетов для дэшборда
/api/lite/reports
Возвращает список всех отчетов для дэшборда.
Опционально можно указать список интересующих отчетов, чтобы не загружать все.
Параметр types, например ?types=report_sales_sum_1,report_sales_avg_order_1
Пример данных по отчетам:
{
"success": true,
"errors": [],
"report_sales_sum_1":{
"currency": "RUB",
"today": 99500,
"week": 929000,
"diffPercent": 12.2,
"diffDirection": "UP"
},
"report_orders_sum_1":{
"today": 41,
"week": 120,
"diffPercent": 8.2,
"diffDirection": "DOWN"
},
"report_sales_avg_order_1":{
"currency": "RUB",
"month": 2330,
"allTime": 1700,
"diffPercent": 8.2,
"diffDirection": "DOWN"
},
"report_orders_sale_percent_1":{
"month": 96.5,
"allTime": 94.2,
"diffPercent": 8.2,
"diffDirection": "DOWN"
},
"report_sales_dynamic_1":{
"currency": "RUB",
"week": 7800,
"previousWeek": 140000,
"previousWeekDiffDirection": "UP"
"previousMonth": 820000,
"previousMonthDiffDirection": "DOWN"
"weeklyData":[
{"point": "Пн", "currentValue": 10, "previousValue": 8},
{"point": "Вт", "currentValue": 12, "previousValue": 11},
{"point": "Ср", "currentValue": 10, "previousValue": 8},
{"point": "Чт", "currentValue": 10, "previousValue": 8},
{"point": "Пт", "currentValue": 10, "previousValue": 8},
{"point": "Сб", "currentValue": null, "previousValue": null},
{"point": "Вс", "currentValue": null, "previousValue": null}
],
"monthlyData":[
{"point": 1, "currentValue": 10, "previousValue": 8},
{"point": 2, "currentValue": 12, "previousValue": 11},
{"point": 3, "currentValue": 10, "previousValue": 8},
{"point": 4, "currentValue": 10, "previousValue": 8},
...
{"point": 31, "currentValue": null, "previousValue": null}
],
"annuallyData":[
{"point": "Янв", "currentValue": 10, "previousValue": 8},
{"point": "Фев", "currentValue": 12, "previousValue": 11},
{"point": "Мар", "currentValue": 10, "previousValue": 8},
{"point": "Апр", "currentValue": 10, "previousValue": 8},
...
{"point": "Дек", "currentValue": null, "previousValue": null}
]
},
"report_sales_dynamic_1_delivered":{
"currency": "RUB",
"week": 7800,
"previousWeek": 140000,
"previousWeekDiffDirection": "UP"
"previousMonth": 820000,
"previousMonthDiffDirection": "DOWN"
"weeklyData":[
{"point": "Пн", "currentValue": 10, "previousValue": 8},
{"point": "Вт", "currentValue": 12, "previousValue": 11},
{"point": "Ср", "currentValue": 10, "previousValue": 8},
{"point": "Чт", "currentValue": 10, "previousValue": 8},
{"point": "Пт", "currentValue": 10, "previousValue": 8},
{"point": "Сб", "currentValue": null, "previousValue": null},
{"point": "Вс", "currentValue": null, "previousValue": null}
],
"monthlyData":[
{"point": 1, "currentValue": 10, "previousValue": 8},
{"point": 2, "currentValue": 12, "previousValue": 11},
{"point": 3, "currentValue": 10, "previousValue": 8},
{"point": 4, "currentValue": 10, "previousValue": 8},
...
{"point": 31, "currentValue": null, "previousValue": null}
],
"annuallyData":[
{"point": "Янв", "currentValue": 10, "previousValue": 8},
{"point": "Фев", "currentValue": 12, "previousValue": 11},
{"point": "Мар", "currentValue": 10, "previousValue": 8},
{"point": "Апр", "currentValue": 10, "previousValue": 8},
...
{"point": "Дек", "currentValue": null, "previousValue": null}
]
},
"report_orders_dynamic_1":{
"currency": "RUB",
"week": 7800,
"previousWeek": 140000,
"previousWeekDiffDirection": "UP"
"previousMonth": 820000,
"previousMonthDiffDirection": "DOWN"
"weeklyData":[
{"point": "Пн", "currentValue": 10, "previousValue": 8},
{"point": "Вт", "currentValue": 12, "previousValue": 11},
{"point": "Ср", "currentValue": 10, "previousValue": 8},
{"point": "Чт", "currentValue": 10, "previousValue": 8},
{"point": "Пт", "currentValue": 10, "previousValue": 8},
{"point": "Сб", "currentValue": null, "previousValue": null},
{"point": "Вс", "currentValue": null, "previousValue": null}
],
"monthlyData":[
{"point": 1, "currentValue": 10, "previousValue": 8},
{"point": 2, "currentValue": 12, "previousValue": 11},
{"point": 3, "currentValue": 10, "previousValue": 8},
{"point": 4, "currentValue": 10, "previousValue": 8},
...
{"point": 31, "currentValue": null, "previousValue": null}
],
"annuallyData":[
{"point": "Янв", "currentValue": 10, "previousValue": 8},
{"point": "Фев", "currentValue": 12, "previousValue": 11},
{"point": "Мар", "currentValue": 10, "previousValue": 8},
{"point": "Апр", "currentValue": 10, "previousValue": 8},
...
{"point": "Дек", "currentValue": null, "previousValue": null}
]
},
"report_orders_dynamic_1_with_canceled":{
"currency": "RUB",
"week": 7800,
"previousWeek": 140000,
"previousWeekDiffDirection": "UP"
"previousMonth": 820000,
"previousMonthDiffDirection": "DOWN"
"weeklyData":[
{"point": "Пн", "currentValue": 10, "previousValue": 8},
{"point": "Вт", "currentValue": 12, "previousValue": 11},
{"point": "Ср", "currentValue": 10, "previousValue": 8},
{"point": "Чт", "currentValue": 10, "previousValue": 8},
{"point": "Пт", "currentValue": 10, "previousValue": 8},
{"point": "Сб", "currentValue": null, "previousValue": null},
{"point": "Вс", "currentValue": null, "previousValue": null}
],
"monthlyData":[
{"point": 1, "currentValue": 10, "previousValue": 8},
{"point": 2, "currentValue": 12, "previousValue": 11},
{"point": 3, "currentValue": 10, "previousValue": 8},
{"point": 4, "currentValue": 10, "previousValue": 8},
...
{"point": 31, "currentValue": null, "previousValue": null}
],
"annuallyData":[
{"point": "Янв", "currentValue": 10, "previousValue": 8},
{"point": "Фев", "currentValue": 12, "previousValue": 11},
{"point": "Мар", "currentValue": 10, "previousValue": 8},
{"point": "Апр", "currentValue": 10, "previousValue": 8},
...
{"point": "Дек", "currentValue": null, "previousValue": null}
]
},
"report_goods_turnover_1":{
"week":1500,
"previousWeek":4300,
"previousWeekDiffDirection": "UP",
"previousMonth": 6400,
"previousMonthDiffDirection": "DOWN",
"weeklyData":[
{"point": "Пн", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Вт", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Ср", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Чт", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Пт", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Сб", "warehoused": null, "shipped": null, "available": null},
{"point": "Вс", "warehoused": null, "shipped": null, "available": null}
],
"annuallyData":[
{"point": "Янв", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Фев", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Мар", "warehoused": 10, "shipped": 8, "available": 2},
{"point": "Апр", "warehoused": 10, "shipped": 8, "available": 2},
...
{"point": "Авг, "warehoused": null, "shipped": null, "available": null}
]
},
"report_sales_channels_1":{
"channelSales":[
{"channel": "Ozon", "amount": 3487},
{"channel": "Beru", "amount": 3100},
{"channel": "Goods", "amount": 2900},
{"channel": "Aliexpress", "amount": 2850},
{"channel": "Online", "amount": 4865}
]
},
"report_sales_avg_order_full_1":{
"currency": "RUB",
"week": 1256,
"month": 2330,
"allTime": 1700,
"annuallyData":[
{"point": "Янв", "amount": 3487},
{"point": "Фев", "amount": 4569},
{"point": "Мар", "amount": 1223},
{"point": "Апр", "amount": 4755},
...
{"point": "Авг", "warehoused": null, "shipped": null, "available": null}
]
},
"report_orders_sum_full_1":{
"week": 12,
"month": 25,
"allTime": 36,
"annuallyData":[
{"point": "Янв", "amount": 10, "amount_no_cod": 8, "amount_online": 2, "amount_cod": 3},
{"point": "Фев", "amount": 10, "amount_no_cod": 8, "amount_online": 2, "amount_cod": 3},
{"point": "Мар", "amount": 10, "amount_no_cod": 8, "amount_online": 2, "amount_cod": 3},
{"point": "Апр", "amount": 10, "amount_no_cod": 8, "amount_online": 2, "amount_cod": 3},
...
{"point": "Авг", "amount": null, "amount_no_cod": null, "amount_online": null, "amount_cod": null}
]
},
"report_top_selling_products_1":{
"currency": "RUB",
"products":[
{"name": "Ботинки мужские, модель Privet, размер 41", "productId": 1001, "variantId": 1020, "amount": 56, "totalSum": 6598.65, "avgItemSum": 117.8},
{"name": "Ботинки мужские, модель Privet, размер 42", "productId": 1003, "variantId": 1018 "amount": 48, "totalSum": 5598.65, "avgItemSum": 120.8}
]
},
"report_last_changed_orders_1":{
"orders":[
{"id": "5966-5698", "updateTs": "2020-08-01 16:35:45", "status": "ORDER_INFO_SHIPPED", "totalOrderSum": 6598.65},
{"id": "5966-5695", "updateTs": "2020-08-01 16:28:41", "status": "ORDER_INFO_DELIVERED", "totalOrderSum": 256.65}
]
}
}
Отчеты сформированы под визуализацию, описанную в задачах:
https://openproject.notasoft.ru/work_packages/1003
https://openproject.notasoft.ru/work_packages/1009
https://openproject.notasoft.ru/work_packages/1010
https://openproject.notasoft.ru/projects/lk2/work_packages/1034/activity
Пример макета визуализации по указанным отчетам:
Обновление данных для графика оборота товаров
/api/lite/report/update_goods
Принудительно обновляет пересчет по обороту из БД.