package com.ruoyi.web.controller.statistics;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.member.MemberInfo;
import com.ruoyi.system.domain.sqmy.SqmyUnitReply;
import com.ruoyi.system.service.ISqmyInfoService;
import com.ruoyi.system.service.IStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;

/**
 * @Author: tjf
 * @Date: 2024/3/18 13:54
 * @Describe:
 */
@RestController
@RequestMapping("/statistics")
public class StatisticsController extends BaseController {
    @Autowired
    private IStatisticsService statisticsService;

    /**
     * 统计查询委员图形分析 界别
     */
    @PreAuthorize("@ss.hasPermi('statistics:boundary:find')")
    @PostMapping("/boundary")
    public AjaxResult boundary() {
        AjaxResult boundary = statisticsService.boundary();
        return AjaxResult.success(boundary);
    }


    /**
     * 统计查询导出
     */
    @PreAuthorize("@ss.hasPermi('statistics:boundary:exportForm')")
    @PostMapping("/exportForm")
    public void exportForm(HttpServletResponse response, MemberInfo memberInfo) {
        statisticsService.exportForm(response, memberInfo);
    }


    /**
     * pc首页（近三月）
     */
    @PreAuthorize("@ss.hasPermi('statistics:boundary:threeWyta')")
    @GetMapping("/threeData")
    public AjaxResult threeData() throws ParseException {
        return statisticsService.threeData();
    }

    /**
     * pc首页（本周提案/社情民意统计）
     */
    @PreAuthorize("@ss.hasPermi('statistics:boundary:weekData')")
    @GetMapping("/weekData")
    public AjaxResult weekData() throws ParseException {
        return statisticsService.weekData();
    }

    /**
     * pc首页（本季度提案统计）
     */
    @PreAuthorize("@ss.hasPermi('statistics:boundary:quarterData')")
    @GetMapping("/quarterData")
    public AjaxResult quarterData() throws ParseException {
        return statisticsService.quarterData();
    }

    /**
     * pc首页（本季度提案统计）
     */
    @PreAuthorize("@ss.hasPermi('statistics:boundary:personageData')")
    @GetMapping("/personageData")
    public AjaxResult personageData() throws ParseException {
        return statisticsService.personageData();
    }

}
