package com.ruoyi.interfaces.controller.web;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.interfaces.service.StatisticsService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LinQiLong
 * @date 2022/1/14 10:14
 */
@RestController
@RequestMapping("/statistics")
public class StatisticsController extends BaseController {

    @Autowired
    private StatisticsService statisticsService;

    /**
     * 获取各个目录访问量前十的
     */
    @GetMapping("/total")
    public AjaxResult total() {
        return AjaxResult.success(statisticsService.total());
    }

    /**
     * 获取各个目录访问量前十的
     */
    @GetMapping("/cntByCatalog")
    public AjaxResult srvNumByCatalog() {
        return AjaxResult.success(statisticsService.cntByCatalog());
    }

    /**
     * 获取各个目录访问量前十的
     */
    @GetMapping("/srvNumByServiceDept")
    public AjaxResult srvNumByServiceDept() {
        return AjaxResult.success(statisticsService.srvNumByServiceDept());
    }

    /**
     * 获取各个目录访问量前十的
     */
    @GetMapping("/keywords")
    public AjaxResult keywords() {
        return AjaxResult.success(statisticsService.keywords());
    }

    /**
     * 获取各个目录访问量前十的
     */
    @GetMapping("/viewNumByCity")
    public AjaxResult viewNumByCity() {
        return AjaxResult.success(statisticsService.viewNumByCity());
    }

    /**
     * 获取各个目录访问量前十的
     */
    @GetMapping("/serviceByCnt")
    public AjaxResult serviceByCnt() {
        return AjaxResult.success(statisticsService.serviceByCnt());
    }

    /**
     * 获取前两周调用次数
     */
    @GetMapping("/lastTwoWeeksCnt")
    public AjaxResult lastTwoWeeksCnt() {
        return AjaxResult.success(statisticsService.lastTwoWeeksCnt());
    }

    /**
     * 获取前两周调用次数
     */
    @GetMapping("/totalByParam/{param}")
    public AjaxResult totalByParam(@PathVariable String param) {
        return AjaxResult.success(statisticsService.totalByParam(param));
    }

    /**
     * 获取运维单位、归属系统树状列表
     */
    @GetMapping("/getMaintainUnitSystemTree")
    public AjaxResult getMaintainUnitSystemTree() {
        return AjaxResult.success(statisticsService.getMaintainUnitSystemTree());
    }

    /**
     * 获取运维单位、归属系统、部门桑基图树状列表
     */
    @GetMapping("/getUnitSystemDept")
    public AjaxResult getUnitSystemDept() {
        return AjaxResult.success(statisticsService.getUnitSystemDept());
    }

    /**
     * 根据目录统计服务个数
     */
    @GetMapping("/totalByCatalog")
    public AjaxResult totalByCatalog() {
        return AjaxResult.success(statisticsService.totalByCatalog());
    }

}
