Files
FT501-WMS/ruoyi-admin/src/main/java/com/ruoyi/api/controller/JobStatisticsController.java
2025-06-12 08:58:54 +08:00

69 lines
2.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.ruoyi.api.controller;
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.RestController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.api.service.IJobStatisticsService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.stock.stock.domain.BasStock;
import com.ruoyi.stock.stock.service.IBasStockService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 作业统计 Controller
*/
@RestController
@RequestMapping("/api")
public class JobStatisticsController {
@Autowired
private IJobStatisticsService jobStatisticsService;
@Autowired
private IBasStockService basStockService;
/**
* 获取统计数据,包含:
* 1. 当日入库和出库数量统计
* 2. 货位状态统计
* 3. 当前任务列表
* 4. 当月每日入库和出库数量统计
*/
@GetMapping("/daily")
public AjaxResult getDailyStatistics() {
Map<String, Object> result = jobStatisticsService.getDailyStatistics();
return AjaxResult.success(result);
}
/**
* 获取库存信息(前50条)
*/
@GetMapping("/list")
public AjaxResult getStockList() {
// 查询所有库存数据
List<BasStock> list = basStockService.selectBasStockList(new BasStock());
// 截取前50条数据
List<BasStock> topList = list.stream()
.limit(50)
.collect(Collectors.toList());
// 构建返回结果
Map<String, Object> result = new HashMap<>();
result.put("stockMsg", topList);
return AjaxResult.success(result);
}
@GetMapping("/device/info")
public AjaxResult getDeviceInfo() {
// 获取设备信息
return jobStatisticsService.getDeviceInfo();
}
}