package com.dsk.web.controller.business;

import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.service.IBusinessOverviewService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目概览
 * @author lcl
 * @create 2023/8/14
 */
@Api("项目概览")
@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(SecurityUtils.getUserId())));
    }
    /**
     * 项目资金分析
     */
    @GetMapping("/amount/analyze")
    public AjaxResult amountAnalyze(){
        return AjaxResult.success(baseService.amountAnalyze(new BusinessSearchDto(SecurityUtils.getUserId(),0)));
    }

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

    /**
     * 公招项目地区统计
     * @return
     */
    @GetMapping("/countGroupByProvince")
    public AjaxResult countGroupByProvince(@RequestBody JSONObject object){
        return baseService.countGroupByProvince(object);
    }

    /**
     * 公招项目投资金额统计
     * @return
     */
    @GetMapping("/rangByMoney")
    public AjaxResult rangByMoney(@RequestBody JSONObject object){
        return baseService.rangByMoney(object);
    }
}
