package com.fjhx.sale.controller.sale;

import com.fjhx.customer.entity.customer.dto.CustomerDto;
import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.sale.service.sale.SaleQuotationService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Map;


/**
 * <p>
 * 报价表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-14
 */
@RestController
@RequestMapping("/saleQuotation")
public class SaleQuotationController {

    @Autowired
    private SaleQuotationService saleQuotationService;


    /**
     * 报价表分页
     */
    @PostMapping("/page")
    public Page<SaleQuotationVo> page(@RequestBody SaleQuotationSelectDto dto) {
        return saleQuotationService.getPage(dto);
    }

    /**
     * 报价表明细
     */
    @PostMapping("/detail")
    public SaleQuotationVo detail(@RequestBody BaseSelectDto dto) {
        return saleQuotationService.detail(dto.getId());
    }
    /**
     * 报价表新增
     */
    @PostMapping("/add")
    public void detail(@RequestBody SaleQuotationDto saleQuotationDto) {
        saleQuotationService.add(saleQuotationDto);
    }

    /**
     * 报价单的复制功能
     */
    @PostMapping("/copy")
    public void copy(SaleQuotationDto saleQuotationDto){
        saleQuotationService.copy(saleQuotationDto);
    }

    /**
     * 最新跟进（客户画像）
     */
    @PostMapping("/latestFollowUp")
    public  Page<SaleQuotationVo> latestFollowUp(@RequestBody CustomerSelectDto dto) {
        return  saleQuotationService.latestFollowUp(dto);
    }

    /**
     * 销售统计（客户画像）
     */
    @PostMapping("/salesStatistics")
    public Map<String, Object> salesStatistics(@RequestBody CustomerDto dto) {
        return saleQuotationService.salesStatistics(dto);
    }


    /**
     * 销售走势（客户画像）
     */
    @PostMapping("/salesTrend")
    public Map<String,Object> salesTrend(@RequestBody CustomerDto dto) {
        return saleQuotationService.salesTrend(dto);
    }

    /**
     * 销售明细（客户画像）
     */
    @PostMapping("/saleDetail")
    public  Page<SaleQuotationVo> saleDetail(@RequestBody CustomerSelectDto dto) {
        return saleQuotationService.saleDetail(dto);

    }

    /**
     * 来源统计（客户分析）
     */
    @PostMapping("/sourceStatistics")
    public  Map<String,Object> sourceStatistics(@RequestBody CustomerDto dto){
        return saleQuotationService.sourceStatistics(dto);
    }

    /**
     * 类型统计（客户分析）
     */
    @PostMapping("/typeStatistics")
    public  Map<String,Object> typeStatistics(@RequestBody CustomerDto dto){
        return saleQuotationService.typeStatistics(dto);
    }

    /**
     * 趋势分析（客户分析）
     */
    @PostMapping("/trendAnalysis")
    public  Map<String,Object> trendAnalysis(@RequestBody CustomerDto dto){
        return saleQuotationService.trendAnalysis(dto);
    }


}
