package com.ruoyi.kpi.controller; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.kpi.service.KpiService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; /** * KPI 统计分析 * * @author gw * @date 2025-05-21 */ @RestController @RequestMapping("/kpi") public class KpiController extends BaseController { @Autowired private KpiService kpiService; /** * 获取入库均匀分析数据 * * @param warehouseId 仓库ID * @param yearMonth 年月,格式:yyyy-MM * @return 入库均匀分析数据 */ @GetMapping("/inAnalysis") public AjaxResult getInAnalysis(@RequestParam("warehouseId") String warehouseId, @RequestParam(value = "yearMonth", required = false) String yearMonth) { return success(kpiService.getInAnalysis(warehouseId, yearMonth)); } /** * 获取出库均匀分析数据 * * @param warehouseId 仓库ID * @param yearMonth 年月,格式:yyyy-MM * @return 入库均匀分析数据 */ @GetMapping("/outAnalysis") public AjaxResult getOutAnalysis(@RequestParam("warehouseId") String warehouseId, @RequestParam(value = "yearMonth", required = false) String yearMonth) { return success(kpiService.getOutAnalysis(warehouseId, yearMonth)); } /** * 获取巷道均匀分析数据 * * @param warehouseId 仓库ID * @param startTime 开始时间,格式:yyyy-MM-dd HH:mm:ss * @param endTime 结束时间,格式:yyyy-MM-dd HH:mm:ss * @return 巷道分析数据,格式:{tunnels: [巷道名称列表], inCounts: [入库数量列表], outCounts: [出库数量列表]} */ @GetMapping("/roadwayAnalysis") public AjaxResult getRoadwayAnalysis(@RequestParam("warehouseId") String warehouseId, @RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "endTime", required = false) String endTime) { return success(kpiService.getRoadwayAnalysis(warehouseId, startTime, endTime)); } /** * 获取货位分析数据 * * @param warehouseId 仓库ID * @return 货位分析数据} */ @GetMapping("/spaceAnalysis") public AjaxResult getSpaceAnalysis(@RequestParam("warehouseId") String warehouseId) { return success(kpiService.getSpaceAnalysis(warehouseId)); } }