package vip.xiaonuo.money.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSON;
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.money.entity.MoneyProduce;
import vip.xiaonuo.money.param.MoneyAnalysisParam;
import vip.xiaonuo.money.param.MoneyInOutParam;
import vip.xiaonuo.money.param.MoneyProduceIncomeParam;
import vip.xiaonuo.money.param.MoneyProduceParam;
import vip.xiaonuo.money.service.IMoneyProduceService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 财务产品销售收入 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-19
 */
@Api(tags = "财务图表控制器")
@ApiSupport(author = "SNOWY_TEAM", order = 1)
@RestController
@Validated
public class MoneyProduceController {

    @Autowired
    private IMoneyProduceService produceService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("收入占比分析")
    @PostMapping("/money-produce/analysisIncome")
    public CommonResult<MoneyProduce> analysisIncome(@RequestBody  MoneyAnalysisParam analysisParam) {
        return CommonResult.data(produceService.analysisIncome(analysisParam));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("产品销售分析")
    @PostMapping("/money-produce/produceAnalysis")
    public CommonResult<JSONArray> produceAnalysis(@RequestBody MoneyProduceParam moneyProduceParam) {
        return CommonResult.data(produceService.produceAnalysis(moneyProduceParam));
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation("国内外收入分析")
    @PostMapping("/money-produce/getInOut")
    public CommonResult<JSONObject> getInOut(@RequestBody MoneyInOutParam inOutParam) {
        return CommonResult.data(produceService.getInOut(inOutParam));
    }

    @ApiOperationSupport(order = 4)
    @ApiOperation("产品销售收入分析")
    @PostMapping("/money-produce/produceIncomeAnalysis")
    public CommonResult<JSONArray> produceIncomeAnalysis(@RequestBody MoneyProduceIncomeParam moneyProduceParam) {
        return CommonResult.data(produceService.produceIncomeAnalysis(moneyProduceParam));
    }
}
