需求:求独立访客数
前奏准备
打开Sugar



在静态JSON中找到其数据格式
{"status": 0,"msg": "","data": {"categories": ["苹果","三星","华为","oppo","vivo","小米86"],"series": [{"name": "手机品牌","data": [5583,6956,5576,7942,5269,5255]}]}}
SQL语句测试
select ch,sum(uv_ct) uv,sum(uj_ct) uj from dws_traffic_vc_ch_ar_is_new_page_view_window where toYYYYMMDD(stt) = 20220906 group by ch order by uv desc;
在ClickHouse中写入

把ch 替换为categories 中的内容,uv替换为data中的内容。
代码编写
UvMapper接口
UvService接口
SugarContrller类
https://gitee.com/luan_hao/gmall-flink/commit/e465b1a85499d15edb41e885c7abb2b898e2bee8
UvServiceImpl类
启动SpringBoot程序
测试
简单测试

开启内网工具

在Sugar上测试,使用内网穿透,将网站复制到Sugar API 拉取中

可视化图表
开启 https://www.yuque.com/manyanshanhe/duxfre/dnuyat#aWAtM 的内容 与 SpringBoot 主程序

