| | |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale.ErpSaleCustomerSummaryRespVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale.ErpSaleProductSummaryRespVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale.ErpSaleSummaryRespVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale.ErpSaleTimeSummaryRespVO; |
| | | import cn.iocoder.yudao.module.erp.service.statistics.ErpSaleStatisticsService; |
| | |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | |
| | | import java.util.List; |
| | | |
| | | import static cn.hutool.core.date.DatePattern.NORM_MONTH_PATTERN; |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管理后台 - ERP 销售统计") |
| | |
| | | return success(summary); |
| | | } |
| | | |
| | | @GetMapping("/customer-summary") |
| | | @Operation(summary = "获得客户销售统计(销售额、已收款、未收款、订单数)") |
| | | @Parameter(name = "customerId", description = "客户编号,为空表示全部客户") |
| | | @Parameter(name = "beginTime", description = "下单时间开始", example = "2026-01-01 00:00:00") |
| | | @Parameter(name = "endTime", description = "下单时间结束", example = "2026-12-31 23:59:59") |
| | | public CommonResult<List<ErpSaleCustomerSummaryRespVO>> getCustomerSummary( |
| | | @RequestParam(value = "customerId", required = false) Long customerId, |
| | | @RequestParam(value = "beginTime", required = false) |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime", required = false) |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime endTime) { |
| | | return success(saleStatisticsService.getCustomerSummary(customerId, beginTime, endTime)); |
| | | } |
| | | |
| | | @GetMapping("/product-summary") |
| | | @Operation(summary = "获得产品销售统计(销量、销售额、成本、毛利)") |
| | | @Parameter(name = "productId", description = "产品编号,为空表示全部产品") |
| | | public CommonResult<List<ErpSaleProductSummaryRespVO>> getProductSummary( |
| | | @RequestParam(value = "productId", required = false) Long productId, |
| | | @RequestParam(value = "beginTime", required = false) |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime beginTime, |
| | | @RequestParam(value = "endTime", required = false) |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime endTime) { |
| | | return success(saleStatisticsService.getProductSummary(productId, beginTime, endTime)); |
| | | } |
| | | |
| | | @GetMapping("/time-summary") |
| | | @Operation(summary = "获得销售时间段统计") |
| | | @Parameter(name = "count", description = "时间段数量", example = "6") |