package com.microservices.dms.achievementLibrary.controller;

import com.microservices.common.core.web.domain.AjaxResult;
import com.microservices.dms.achievementLibrary.service.MemoDashboardService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@Api(tags = "数据管理体系-社区动态可视化接口")
@RequestMapping("/memoDashboard")
public class MemoDashboardController {
    @Autowired
    private MemoDashboardService memoDashboardService;

    @GetMapping(value = "getMemoAduit")
    @ApiOperation(value = "帖子审核通过率、帖子总数")
    public AjaxResult getMemoAduit() {
        return AjaxResult.success(memoDashboardService.getMemoAduit());
    }

    @GetMapping(value = "getIsOriginalStatistic")
    @ApiOperation(value = "帖子原创、非原创")
    public AjaxResult getIsOriginalStatistic() {
        return AjaxResult.success(memoDashboardService.getIsOriginalStatistic());
    }

    @GetMapping(value = "getMemoTotalByYear")
    @ApiOperation(value = "年度论坛帖子总数")
    public AjaxResult getMemoTotalByYear() {
        return AjaxResult.success(memoDashboardService.getMemoTotalByYear());
    }

    @GetMapping(value = "getForumSectionStatistic")
    @ApiOperation(value = "帖子分类")
    public AjaxResult getForumSectionStatistic() {
        return AjaxResult.success(memoDashboardService.getForumSectionStatistic());
    }

    @GetMapping(value = "getAddMemoStatistic")
    @ApiOperation(value = "近一年新增帖子数")
    public AjaxResult getAddMemoStatistic() {
        return AjaxResult.success(memoDashboardService.getAddMemoStatistic());
    }

    @GetMapping(value = "getTop5Memos")
    @ApiOperation(value = "年度帖子热度top5")
    public AjaxResult getTop5Memos() {
        return AjaxResult.success(memoDashboardService.getTop5Memos());
    }

    @GetMapping(value = "get7DayPaise")
    @ApiOperation(value = "近7日帖子点赞数")
    public AjaxResult get7DayPaise() {
        return AjaxResult.success(memoDashboardService.get7DayPaise());
    }
}
