package cn.iocoder.yudao.module.srm.controller.admin.statistics;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.module.srm.controller.admin.statistics.vo.SrmCostAnalysisRespVO;
|
import cn.iocoder.yudao.module.srm.controller.admin.statistics.vo.SrmTenderStatisticsRespVO;
|
import cn.iocoder.yudao.module.srm.service.statistics.SrmCostAnalysisService;
|
import cn.iocoder.yudao.module.srm.service.statistics.SrmStatisticsService;
|
import jakarta.validation.Valid;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import jakarta.annotation.Resource;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@Tag(name = "管理后台 - SRM 统计分析")
|
@RestController
|
@RequestMapping("/srm/statistics")
|
@Validated
|
public class SrmStatisticsController {
|
|
@Resource
|
private SrmStatisticsService statisticsService;
|
@Resource
|
private SrmCostAnalysisService costAnalysisService;
|
|
@GetMapping("/tender")
|
@Operation(summary = "获取招标统计数据")
|
@PreAuthorize("@ss.hasPermission('srm:statistics:query')")
|
public CommonResult<SrmTenderStatisticsRespVO> getTenderStatistics(@RequestParam("year") String year) {
|
return success(statisticsService.getTenderStatistics(year));
|
}
|
|
@GetMapping("/cost-analysis")
|
@Operation(summary = "采购成本分析",
|
description = "基于 SRM 招标需求量与供应商报价聚合:采购量、加权均价、最低/最高价、价格变动;不依赖 ERP")
|
@PreAuthorize("@ss.hasPermission('srm:statistics:query')")
|
public CommonResult<PageResult<SrmCostAnalysisRespVO>> getCostAnalysis(
|
@Valid PageParam page,
|
@RequestParam(value = "productName", required = false) String productName) {
|
return success(costAnalysisService.page(page, productName));
|
}
|
|
@GetMapping("/cost-trend")
|
@Operation(summary = "物料价格趋势", description = "按月汇总该物料的平均报价")
|
@PreAuthorize("@ss.hasPermission('srm:statistics:query')")
|
public CommonResult<java.util.List<SrmCostAnalysisRespVO.TrendPoint>> getCostTrend(
|
@RequestParam("productId") Long productId) {
|
return success(costAnalysisService.trend(productId));
|
}
|
|
}
|