package cn.iocoder.yudao.module.crm.controller.admin.crmanalysis;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.ContractVO;
import cn.iocoder.yudao.module.crm.controller.admin.crmanalysis.vo.TimeQueryVO;
import cn.iocoder.yudao.module.crm.service.crmanalysis.RankService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;


@Tag(name = "管理后台 - 排名分析")
@RestController
@RequestMapping("/crm/analysis-rank")
@Validated
public class RankController {

    @Resource
    private RankService rankService;


    @GetMapping("/contract")
    @Operation(summary = "获得合同排名")
    public CommonResult<List<ContractVO>> getContractRank(TimeQueryVO vo) {
        return success(rankService.getContractRank(vo));
    }

    @GetMapping("/receivables")
    @Operation(summary = "获得回款排名")
    public CommonResult<List<ContractVO>> getRecevablesRank(TimeQueryVO vo) {
        return success(rankService.getReceivablesRank(vo));
    }


}
