package com.app.controller.admin;

import com.app.dto.Result;
import com.app.dto.report.ReportHobbySeriesDto;
import com.app.dto.report.SearchReportDto;
import com.app.dto.report.ReportAllDto;
import com.app.dto.report.ReportSchoolDto;
import com.app.service.report.ReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 功能描述：学校
 *
 * @Auther: 梁展鹏
 * @Date: 2018/7/24 11:38
 */
@Api(description = "报表")
@Slf4j
@Validated
@RestController("ReportController")
@RequestMapping("/admin/report")
public class ReportController {

    @Autowired
    private ReportService reportService;

    /**
     * 功能描述：审核退课
     *
     * @param
     * @return
     */
    @ApiOperation(value = "报表总览")
    @PostMapping("/reportAll")
    public ResponseEntity<Result<ReportAllDto>> reportAll(@Valid @RequestBody SearchReportDto searchReportDto) {
        ReportAllDto reportAllDto = reportService.reportAll(searchReportDto);
        return new ResponseEntity(new Result().ok(reportAllDto), HttpStatus.OK);
    }

    @ApiOperation(value = "行政班报表")
    @PostMapping("/findReportByClass")
    public  ResponseEntity<Result<ReportSchoolDto>> findReportByClass(@RequestBody SearchReportDto searchReportDto) {
        return new ResponseEntity(new Result().ok(reportService.findReportByClass(searchReportDto)), HttpStatus.OK);
    }

    @ApiOperation(value = "兴趣班报表")
    @PostMapping("/findReportByHobby")
    public  ResponseEntity<Result<ReportHobbySeriesDto>> findReportByHobby(@RequestBody SearchReportDto searchReportDto) {
        return new ResponseEntity(new Result().ok(reportService.findReportByHobby(searchReportDto)), HttpStatus.OK);
    }
}
