4 天以前 06321d70dd7617fdc7d475b190e629143fec3263
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
package cn.iocoder.yudao.module.mes.controller.admin.home;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.mes.controller.admin.home.vo.MesBagCodeHomeSummaryRespVO;
import cn.iocoder.yudao.module.mes.controller.admin.home.vo.MesBagCodeHomeTrendRespVO;
import cn.iocoder.yudao.module.mes.service.home.MesBagCodeHomeStatisticsService;
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 = "管理后台 - MES 基础数据与一袋一码 首页统计")
@RestController
@RequestMapping("/mes/bag-code-home-statistics")
@Validated
public class MesBagCodeHomeStatisticsController {
 
    @Resource
    private MesBagCodeHomeStatisticsService homeStatisticsService;
 
    @GetMapping("/summary")
    @Operation(summary = "获得首页汇总统计")
    @PreAuthorize("@ss.hasPermission('mes:home:query')")
    public CommonResult<MesBagCodeHomeSummaryRespVO> getHomeSummary() {
        return success(homeStatisticsService.getHomeSummary());
    }
 
    @GetMapping("/trend")
    @Operation(summary = "获得袋码生成趋势")
    @Parameter(name = "days", description = "天数", example = "7")
    @PreAuthorize("@ss.hasPermission('mes:home:query')")
    public CommonResult<List<MesBagCodeHomeTrendRespVO>> getBagCodeTrend(
            @RequestParam(value = "days", defaultValue = "7") @Min(1) @Max(90) Integer days) {
        return success(homeStatisticsService.getBagCodeTrend(days));
    }
 
}