
package com.wzj.soopin.statistics.controller;


import com.wzj.soopin.statistics.entity.dto.GoodsStatisticsQueryParam;
import com.wzj.soopin.statistics.entity.vo.CategoryStatisticsDataVO;
import com.wzj.soopin.statistics.entity.vo.GoodsStatisticsDataVO;
import com.wzj.soopin.statistics.service.StoreFlowStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.dromara.common.core.domain.R;
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 java.util.List;

/**
 * 管理端,商品统计接口
 *
 * @author Bulbasaur
 * @since 2020/12/9 19:04
 */
@Tag(name = "管理端,商品流水统计接口")
@RestController
@RequestMapping("/manager/statistics/goods")
public class GoodsStatisticsManagerController {
    @Autowired
    private StoreFlowStatisticsService storeFlowStatisticsService;

    @Operation(summary = "获取统计列表,排行前一百的数据")
    @GetMapping
    public R<List<GoodsStatisticsDataVO>> getByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
        return R.ok(storeFlowStatisticsService.getGoodsStatisticsData(goodsStatisticsQueryParam, 100));
    }

    @Operation(summary = "获取行业统计列表")
    @GetMapping("/getCategoryByPage")
    public R<List<CategoryStatisticsDataVO>> getCategoryByPage(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
        return R.ok(storeFlowStatisticsService.getCategoryStatisticsData(goodsStatisticsQueryParam));
    }


}
