40 lines
1.4 KiB
Java
40 lines
1.4 KiB
Java
package com.haisen.laop.controller;
|
|
|
|
import com.haisen.laop.common.Result;
|
|
import com.haisen.laop.service.DashboardService;
|
|
import com.haisen.laop.vo.DashboardVO;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* 数据驾驶舱 —— Web 后台首页统计聚合 Controller。
|
|
*
|
|
* <p><b>消费端:</b>Web 管理后台 Dashboard 首页。
|
|
* <p><b>路径前缀:</b>{@code /dashboard/*},单接口聚合返回全部统计数据,避免多接口瀑布加载。
|
|
* <p><b>职责:</b>Controller 层只做路由与 Result 包装,业务逻辑全部委托 {@link DashboardService}。</p>
|
|
*
|
|
* @author duhao
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/dashboard")
|
|
@RequiredArgsConstructor
|
|
public class DashboardController {
|
|
|
|
private final DashboardService dashboardService;
|
|
|
|
/**
|
|
* 获取数据驾驶舱全量统计数据。
|
|
*
|
|
* <p>一次性返回用户/商家/飞手总量、任务总量与状态分布、近 6 个月月度增长趋势、
|
|
* 任务类型分布等所有 Dashboard 图表所需数据。</p>
|
|
*
|
|
* @return Dashboard 聚合 VO
|
|
*/
|
|
@GetMapping("/stats")
|
|
public Result<DashboardVO> getStats() {
|
|
return Result.success(dashboardService.getDashboardStats());
|
|
}
|
|
}
|