package com.dsk.web.controller.dsk;

import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.domain.R;
import com.dsk.common.core.domain.model.*;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.system.dskService.IndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.Map;


/**
 * @ClassName IndexController
 * @Description TODO
 * @Author Dgm
 * @Date 2023/8/15 12:01
 * @Version 1.0
 */
@Api("首页数据相关")
@RestController
@RequestMapping("/index")
public class IndexController {

    @Autowired
    private IndexService enterpriseService;

    @ApiOperation(value = "企业中标排行榜")
    @PostMapping("/winningBidsRanking")
    public R winningBidsRanking(@RequestBody Map<String, Object> paramMap) throws Exception {
        return enterpriseService.winningBidsRanking(paramMap);
    }

    @ApiOperation(value = "企业中标排行-项目类型")
    @PostMapping("/rankingProjectType")
    public R rankingProjectType(@RequestBody Map<String, Object> paramMap) throws Exception {
        return enterpriseService.rankingProjectType(paramMap);
    }


    @ApiOperation(value = "大项目最新中标")
    @PostMapping(value = "bigWinningBidsPage")
    public TableDataInfo bigWinningBidsPage(@RequestBody IndexBigWinningBidsPageBody vo) throws Exception {
        return enterpriseService.bigWinningBidsPage(vo);
    }

    @ApiOperation(value = "大项目最新招标")
    @PostMapping(value = "bigBidPage")
    public TableDataInfo bigBidPage(@RequestBody IndexBigBidPageBody vo) throws Exception {
        return enterpriseService.bigBidPage(vo);
    }

    @ApiOperation(value = "企业中标排行-项目类型")
    @PostMapping("/bigBidProjectType")
    public R bigBidProjectType(@RequestBody Map<String, Object> paramMap) throws Exception {
        return enterpriseService.bigBidProjectType(paramMap);
    }

    @ApiOperation(value = "集团中标统计")
    @PostMapping("/countByCompany")
    public AjaxResult countByCompany(@RequestBody JSONObject object) {
        return enterpriseService.countByCompany(object);
    }

    @ApiOperation(value = "建筑企业中标排行榜")
    @PostMapping("/bidRank")
    public AjaxResult bidRank(@RequestBody JSONObject object) {
        return enterpriseService.bidRank(object);
    }
}
