package vip.xiaonuo.sale.controller;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.sale.entity.SaleDetail;
import vip.xiaonuo.sale.param.SaleDetailParam;
import vip.xiaonuo.sale.param.SaleProduceParam;
import vip.xiaonuo.sale.service.ISaleProduceService;

import java.util.List;

/**
 * <p>
 * 销售二级指标 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-12-13
 */
@RestController
@Api(tags = "销售二级指标")
@ApiSupport(author = "wang", order = 1)
@Validated
public class SaleProduceController {

    @Autowired
    private ISaleProduceService produceService;

    @PostMapping("/sale-produce/getList")
    @ApiOperationSupport(order = 1)
    @ApiOperation("二级指标")
    public CommonResult<JSONObject> getList(@RequestBody SaleProduceParam produceParam) {
        return CommonResult.data(produceService.getProduceOne(produceParam));
    }


    @PostMapping("/sale-produce/getPriceList")
    @ApiOperationSupport(order = 2)
    @ApiOperation("二级产品销售额趋势")
    public CommonResult<JSONArray> getPriceList(@RequestBody SaleProduceParam produceParam) {
        return CommonResult.data(produceService.getPriceList(produceParam));
    }
}
