package cn.teammodel.controller.admin.controller;

import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.ExamService;
import cn.teammodel.controller.admin.service.LaborEducationService;
import cn.teammodel.model.dto.admin.exam.OverViewDto;
import cn.teammodel.model.dto.admin.labor.FindDto;
import cn.teammodel.model.dto.admin.labor.LaborDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("admin/labor")
@Api(tags = "管理员端-德育分析")
public class LaborEducationController {
    @Resource
    private LaborEducationService laborEducationService;
    @PostMapping("getLaborAnalysis")
    @ApiOperation("获取德育看板详细内容")
    public R<Map<String, Object>> getLaborAnalysis(@Valid @RequestBody LaborDto laborDto, HttpServletRequest request) {
        Map<String, Object> res = laborEducationService.getAnalysis(laborDto,request);
        return R.success(res);
    }
    @PostMapping("getDetails")
    @ApiOperation("获取指定学生评测和评价数据")
    public R<Map<String, Object>> getDetails(@Valid @RequestBody FindDto findDto, HttpServletRequest request) {
        Map<String, Object> res = laborEducationService.getDetails(findDto,request);
        return R.success(res);
    }
    @PostMapping("getStudentSemesterScores")
    @ApiOperation("分学期比对分析")
    public R<Map<String, Object>> getStudentSemesterScores(@Valid @RequestBody LaborDto laborDto, HttpServletRequest request) {
        Map<String, Object> res = laborEducationService.getStudentSemesterScores(laborDto,request);
        return R.success(res);
    }

    @PostMapping("getStudentMonthlyScores")
    @ApiOperation("按月比对分析")
    public R<Map<String,List<Map<String, Object>>>> getStudentMonthlyScores(@Valid @RequestBody LaborDto laborDto, HttpServletRequest request) {
        Map<String,List<Map<String, Object>>> res = laborEducationService.getStudentMonthlyScores(laborDto,request);
        return R.success(res);
    }
    @PostMapping("getExamDetails")
    @ApiOperation("获取指定考试数据")
    public R<Map<String, Object>> getExamDetails(@Valid @RequestBody LaborDto laborDto, HttpServletRequest request) {
        Map<String, Object> res = laborEducationService.getExamDetails(laborDto,request);
        return R.success(res);
    }
}
