package com.izouma.jmrh.web.stat;

import com.izouma.jmrh.service.stat.DataCenterService;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.time.YearMonth;

@RestController
@RequestMapping("/statDataCenter")
@AllArgsConstructor
public class DataCenterController {
    private DataCenterService dataCenterService;

    @GetMapping("/init")
    public String init() {
        dataCenterService.init();
        return "ok";
    }

    @ApiOperation("企业数量趋势")
    @GetMapping("/orgNumStat")
    public Object orgNum(@RequestParam String type) {
        return dataCenterService.orgNum(type);
    }

    @ApiOperation("各市企业数量对比")
    @GetMapping("/cityOrgNum")
    public Object cityOrgNum() {
        return dataCenterService.cityOrgNum();
    }

    @ApiOperation("各市项目数量对比")
    @GetMapping("/cityProjectNum")
    public Object cityProjectNum() {
        return dataCenterService.cityProjectNum();
    }

    @ApiOperation("各市融合指数对比")
    @GetMapping("/cityIndexStat")
    public Object cityIndexStat() {
        return dataCenterService.cityIndexStat();
    }

    @ApiOperation("各市融合指数对比")
    @GetMapping("/baseStat")
    public Object baseStat() {
        return dataCenterService.baseStat();
    }

    @ApiOperation("技术交易")
    @GetMapping("/techTradeStat")
    public Object techTradeStat() {
        return dataCenterService.techTradeStat();
    }

    @ApiOperation("需求供应互动")
    @GetMapping("/sndStat")
    public Object sndStat() {
        return dataCenterService.sndStat();
    }

    @ApiOperation("地图数据")
    @GetMapping("/cityData")
    public Object cityData(@RequestParam Long categoryId) {
        return dataCenterService.cityData(categoryId);
    }

    @ApiOperation("统计数据")
    @GetMapping("/numStat")
    public Object numStat(@RequestParam YearMonth start, @RequestParam YearMonth end, @RequestParam String type) {
        return dataCenterService.numStat(start, end, type);
    }
}
