package com.dsk.biz.controller;

import com.dsk.biz.domain.bo.BusinessSearchDto;
import com.dsk.biz.service.IBusinessOverviewService;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.helper.LoginHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 项目概览
 *
 * @author lcl
 * @create 2023/8/14
 */
@RestController
@RequestMapping("/business/overview")
public class BusinessOverviewController extends BaseController {

    @Autowired
    private IBusinessOverviewService baseService;

    /**
     * 项目状态统计
     */
    @GetMapping("/status/statistics")
    public AjaxResult statusStatistics() {
        return AjaxResult.success(baseService.statusStatistics(new BusinessSearchDto(LoginHelper.getUserId())));
    }

    /**
     * 项目资金分析
     */
    @GetMapping("/amount/analyze")
    public AjaxResult amountAnalyze() {
        return AjaxResult.success(baseService.amountAnalyze(new BusinessSearchDto(LoginHelper.getUserId(), 0)));
    }

    /**
     * 项目类型分析
     */
    @GetMapping("/type/analyze/{status}")
    public AjaxResult typeAnalyze(@PathVariable Integer status) {
        return AjaxResult.success(baseService.typeAnalyze(new BusinessSearchDto(LoginHelper.getUserId(), status)));
    }

    /**
     * 项目类别分析
     */
    @GetMapping("/category/analyze/{status}")
    public AjaxResult categoryAnalyze(@PathVariable Integer status) {
        return AjaxResult.success(baseService.categoryAnalyze(new BusinessSearchDto(LoginHelper.getUserId(), status)));
    }

    /**
     * 公招项目地区统计
     *
     * @return
     */
    @RequestMapping("/countGroupByProvince")
    public AjaxResult countGroupByProvince(@RequestBody Map<String,Object> object) {
        return baseService.countGroupByProvince(object);
    }

    /**
     * 公招项目投资金额统计
     *
     * @return
     */
    @RequestMapping("/rangByMoney")
    public AjaxResult rangByMoney(@RequestBody Map<String,Object> object) {
        return baseService.rangByMoney(object);
    }
}
