MerchantController.java 8.19 KB
package com.glsk.controller2;

import com.glsk.service.BoutiqueService;
import com.glsk.service.BusinessAnalysisService2;
import com.glsk.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author Jinglf
 * @create 2023-07-02 10:46
 */

@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/merchant")
@Api(value = "经营分析--门店", tags = {"经营分析--门店"})
public class MerchantController {
    protected final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private BusinessAnalysisService2 businessAnalysisService;

    @Autowired
    private BoutiqueService boutiqueService;


    @GetMapping("/getMerchantList")
    @ApiOperation("获取门店列表")
    public RopResponse<ReqRet.MerchantListRet> getMerchantList(BusinessType business_type,String merchantname,String ids)  {
        logger.info("getMerchantList:req=" );



        if(business_type.equals(BusinessType.qinggai)){
            ReqRet.MerchantListRet ret = boutiqueService.getMerchantList(business_type,merchantname,ids);
            return RopResponse.success(ret);
        }else {
            ReqRet.MerchantListRet ret = businessAnalysisService.getMerchantList(business_type,merchantname,ids);
            return RopResponse.success(ret);
        }


    }



    @GetMapping("/getMerchantWeekList")
    @ApiOperation("获取门店周列表")
    public RopResponse<ReqRet.WeekListRet> getMerchantWeekList(BusinessType business_type,String merchantid)  {
        logger.info("getWeekList:req=" );
        if(business_type.equals(BusinessType.qinggai)){

            ReqRet.WeekListRet ret = boutiqueService.getMerchantWeekList(business_type,merchantid);
            return RopResponse.success(ret);
        }else {
            ReqRet.WeekListRet ret = businessAnalysisService.getMerchantWeekList(business_type,merchantid);
            return RopResponse.success(ret);
        }
    }



    @GetMapping("/queryMerchantOutputAndAtv")
    @ApiOperation("查询门店总产值和客单价")
    public RopResponse<ReqRet.MerchantOutputAndAtvRet> queryMerchantOutputAndAtv(String merchantid,BusinessType business_type,
                                                          QueryType queryType  , String startDay,String endDay)  {
        logger.info("查询门店总产值和客单价:req=" );




        if(business_type.equals(BusinessType.qinggai)){

            ReqRet.MerchantOutputAndAtvRet ret = boutiqueService.queryMerchantOutputAndAtv(merchantid, business_type,queryType,startDay,endDay);
            return RopResponse.success(ret);
        }else {
            ReqRet.MerchantOutputAndAtvRet ret = businessAnalysisService.queryMerchantOutputAndAtv(merchantid, business_type,queryType,startDay,endDay);
            return RopResponse.success(ret);
        }


    }




    @GetMapping("/queryMerchantOutputTrend")
    @ApiOperation("查询门店产值趋势")
    public RopResponse<ReqRet.OutputTrendRet> queryMerchantOutputTrend(String merchantid, BusinessType business_type,
                                                          QueryType queryType  , String startDay,String endDay)  {
        logger.info("查询门店产值趋势:req=" );

        if(business_type.equals(BusinessType.qinggai)){
            ReqRet.OutputTrendRet ret = boutiqueService.queryMerchantOutputTrend(merchantid,business_type,queryType,startDay,endDay);
            return RopResponse.success(ret);
        }else {
            ReqRet.OutputTrendRet ret = businessAnalysisService.queryMerchantOutputTrend(merchantid,business_type,queryType,startDay,endDay);
            return RopResponse.success(ret);
        }

    }


    @GetMapping("/queryMerchantBuyAndTostore")
    @ApiOperation("查询门店新车交付数、新车到店流量、售后到店流量、成交量")
    public RopResponse<ReqRet.MerchantBuyAndTostoreRet> queryMerchantBuyAndTostore(String merchantid,BusinessType business_type,
                                                                                 QueryType queryType  , String startDay,String endDay)  {
        logger.info("queryMerchantBuyAndTostore:req=" );
        System.out.println(business_type);

        if(business_type.equals(BusinessType.qinggai)){
            ReqRet.MerchantBuyAndTostoreRet ret = boutiqueService.queryMerchantBuyAndTostore(merchantid, business_type,queryType,startDay,endDay);
            return RopResponse.success(ret);
        }else {
            ReqRet.MerchantBuyAndTostoreRet ret = businessAnalysisService.queryMerchantBuyAndTostore(merchantid, business_type,queryType,startDay,endDay);
            return RopResponse.success(ret);
        }

    }






    @GetMapping("/queryStaffRanking")
    @ApiOperation("查询员工排名")
    public RopResponse<ReqRet.StaffRankingRet> queryStaffRanking(String merchantid, BusinessType business_type,
                                                          QueryType queryType  , String startDay,String endDay,Rankfield rankfield,RankType rankType)  {
        logger.info("queryStaffRanking:req=" );

        if(business_type.equals(BusinessType.qinggai)){

            ReqRet.StaffRankingRet ret = boutiqueService.queryStaffRanking(merchantid,business_type,queryType,startDay,endDay,rankfield,rankType);
            return RopResponse.success(ret);
        }else {
            ReqRet.StaffRankingRet ret = businessAnalysisService.queryStaffRanking(merchantid,business_type,queryType,startDay,endDay,rankfield,rankType);
            return RopResponse.success(ret);
        }
    }



    @GetMapping("/queryFlowContributeRanking")
    @ApiOperation("查询流量贡献排行")
    public RopResponse<ReqRet.FlowContributeRankingRet> queryFlowContributeRanking(String merchantid, BusinessType business_type,
                                                          QueryType queryType  , String startDay,String endDay,RankType rankType)  {
        logger.info("queryFlowContributeRanking:req=" );


        if(business_type.equals(BusinessType.qinggai)){
            ReqRet.FlowContributeRankingRet ret = boutiqueService.queryFlowContributeRanking(merchantid,business_type,queryType,startDay,endDay,rankType);
            return RopResponse.success(ret);
        }else {
            ReqRet.FlowContributeRankingRet ret = businessAnalysisService.queryFlowContributeRanking(merchantid,business_type,queryType,startDay,endDay,rankType);
            return RopResponse.success(ret);
        }

    }

    @GetMapping("/queryServiceSupervisionSale")
    @ApiOperation("门店+业务场景下的所属服务商老板、区域督导、销售名称")
    public RopResponse<ReqRet.ServiceSupervisionSaleRet> queryServiceSupervisionSale(String merchantid, BusinessType business_type, String startDay,String endDay)  {
        logger.info("queryServiceSupervisionSale:req=" );


        if(business_type.equals(BusinessType.qinggai)){
            ReqRet.ServiceSupervisionSaleRet ret = boutiqueService.queryServiceSupervisionSale(merchantid,business_type,startDay,endDay);
            return RopResponse.success(ret);
        }else {
            ReqRet.ServiceSupervisionSaleRet ret = businessAnalysisService.queryServiceSupervisionSale(merchantid,business_type,startDay,endDay);
            return RopResponse.success(ret);
        }

    }


    @GetMapping("/queryProductOutput")
    @ApiOperation("品类分析")
    public RopResponse<ReqRet.ProductOutputRet> queryProductOutput(String merchantid, BusinessType business_type, String startDay,String endDay)  {
        logger.info("queryProductOutput:req=" );


        if(!business_type.equals(BusinessType.qinggai)){
            ReqRet.ProductOutputRet ret = new ReqRet.ProductOutputRet();
            ret.setCode(-1);
                ret.setMessage("请检查参数");
            return RopResponse.success(ret);
        }

        ReqRet.ProductOutputRet ret = boutiqueService.queryProductOutput(merchantid,business_type,startDay,endDay);
        return RopResponse.success(ret);
    }








}