package com.ruoyi.screen.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.screen.domain.request.ZongzhiSentimenClassificationRequest;
import com.ruoyi.screen.domain.response.*;
import com.ruoyi.screen.service.ZongzhiScreenOpinionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 太仓综治网络舆情大屏接口
 */
@RestController
@RequestMapping("/zongzhi/opinionscreen")
@Api(tags = " 太仓综治网络舆情大屏接口")
public class ZongzhiScreenOpinionController {

    @Resource
    private ZongzhiScreenOpinionService zongzhiScreenOpinionService;


    /**
     * 舆情走势图
     */
    @ApiOperation(value = "舆情走势图", response = ZongzhiSentimentTypeResponse.class)
    @GetMapping("/sentimentype")
    private AjaxResult getSentimentType() {

        return AjaxResult.success(zongzhiScreenOpinionService.getSentimentType());
    }


    /**
     * 舆情信息量统计
     */
    @ApiOperation(value = "舆情信息量统计", response = ZongzhiSentimentCountResponse.class)
    @GetMapping("/sentimencount")
    private AjaxResult getSentimenCount() {

        return AjaxResult.success(zongzhiScreenOpinionService.getSentimenCount());
    }


    /**
     * 舆情分类
     */
    @ApiOperation(value = "舆情分类", response = ZongzhiSentimenClassificationResponse.class)
    @PostMapping("/sentimenclassification")
    private AjaxResult getSentimenClassification(@RequestBody @Valid ZongzhiSentimenClassificationRequest req) {
        List<ZongzhiSentimenClassificationResponse> zongzhiSentimenClassificationResponse = null;
        if (req.getType().equals(1)) {
            //媒体类型
            zongzhiSentimenClassificationResponse = zongzhiScreenOpinionService.getSentimenClassificationBymediaType();
        } else {
            zongzhiSentimenClassificationResponse = zongzhiScreenOpinionService.getSentimenClassificationByeventType();
        }
        return AjaxResult.success(zongzhiSentimenClassificationResponse);
    }



    /**
     * 词云
     */
    @ApiOperation(value = "词云", response = ZongzhiSentimenWordCloudResponse.class)
    @GetMapping("/wordcloud")
    private AjaxResult getWordCloud() {

        return AjaxResult.success(zongzhiScreenOpinionService.getWordCloud());
    }

    /**
     * 舆情报告
     */
    @ApiOperation(value = "舆情报告", response = ZongzhiSentimentReportResponse.class)
    @GetMapping("/sentimentreport")
    private AjaxResult getSentimentReport() {

        ZongzhiSentimentReportResponse zongzhiSentimentReportResponse = zongzhiScreenOpinionService.getSentimentReport();
        zongzhiSentimentReportResponse.setReportList(zongzhiScreenOpinionService.getSentimentReportbyReportType());
        return AjaxResult.success(zongzhiSentimentReportResponse);
    }



    /**
     * 部门专办情况
     */
    @ApiOperation(value = "部门专办情况", response = ZongzhiSentimentDeptResponse.class)
    @GetMapping("/sentimentdept")
    private AjaxResult getSentimentDept() {
        ;
        return AjaxResult.success(zongzhiScreenOpinionService.getSentimentDept());
    }



    /**
     * 动态筛选
     */
    @ApiOperation(value = "动态筛选", response = ZongzhiSentimentfilterResponse.class)
    @GetMapping("/sentimentfilter")
    private AjaxResult getSentimentFiltering() {
        ;
        return AjaxResult.success(zongzhiScreenOpinionService.getSentimentFiltering());
    }


}
