2026-07-01 6b5f7c66fc40d7f6099d561e31a34fbd50dd20d3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package cn.iocoder.yudao.module.wms.controller.admin.home;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.wms.controller.admin.home.vo.WmsHomeInventorySummaryRespVO;
import cn.iocoder.yudao.module.wms.controller.admin.home.vo.WmsHomeOrderSummaryRespVO;
import cn.iocoder.yudao.module.wms.controller.admin.home.vo.WmsHomeOrderTrendRespVO;
import cn.iocoder.yudao.module.wms.service.home.WmsHomeStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
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;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
@Tag(name = "管理后台 - WMS 首页统计")
@RestController
@RequestMapping("/wms/home-statistics")
@Validated
public class WmsHomeStatisticsController {
 
    @Resource
    private WmsHomeStatisticsService homeStatisticsService;
 
    @GetMapping("/order-summary")
    @Operation(summary = "获得首页单据汇总统计")
    @Parameter(name = "warehouseId", description = "仓库编号", example = "1024")
    @PreAuthorize("@ss.hasPermission('wms:home:query')")
    public CommonResult<List<WmsHomeOrderSummaryRespVO>> getOrderSummary(
            @RequestParam(value = "warehouseId", required = false) Long warehouseId) {
        return success(homeStatisticsService.getOrderSummary(warehouseId));
    }
 
    @GetMapping("/order-trend")
    @Operation(summary = "获得首页单据趋势")
    @Parameter(name = "days", description = "天数", example = "7")
    @PreAuthorize("@ss.hasPermission('wms:home:query')")
    public CommonResult<List<WmsHomeOrderTrendRespVO>> getOrderTrend(
            @RequestParam(value = "days", defaultValue = "7") @Min(1) @Max(90) Integer days,
            @RequestParam(value = "warehouseId", required = false) Long warehouseId) {
        return success(homeStatisticsService.getOrderTrend(days, warehouseId));
    }
 
    @GetMapping("/inventory-summary")
    @Operation(summary = "获得首页库存汇总统计")
    @Parameter(name = "warehouseId", description = "仓库编号", example = "1024")
    @PreAuthorize("@ss.hasPermission('wms:home:query')")
    public CommonResult<WmsHomeInventorySummaryRespVO> getInventorySummary(
            @RequestParam(value = "warehouseId", required = false) Long warehouseId,
            @RequestParam(value = "goodsLimit", defaultValue = "5") @Min(1) @Max(20) Integer goodsLimit,
            @RequestParam(value = "warehouseLimit", defaultValue = "8") @Min(1) @Max(20) Integer warehouseLimit) {
        return success(homeStatisticsService.getInventorySummary(warehouseId, goodsLimit, warehouseLimit));
    }
 
}