package cn.teammodel.controller.admin.controller;

import cn.teammodel.common.R;
import cn.teammodel.controller.admin.service.MoralEducationService;
import cn.teammodel.model.dto.admin.Moral.MoralDto;
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/moral")
@Api(tags = "管理员端-劳育分析")
public class MoralEducationController {
    @Resource
    private MoralEducationService moralEducationService;
    @PostMapping("getMoralAnalysis")
    @ApiOperation("获取劳育看板详细内容")
    public R<Map<String, Object>> getMoralAnalysis(@Valid @RequestBody MoralDto moralDto, HttpServletRequest request) {
        Map<String, Object> res = moralEducationService.getAnalysis(moralDto,request);
        return R.success(res);
    }
    @PostMapping("getDetails")
    @ApiOperation("获取指定学生评测和评价数据")
    public R<Map<String, Object>> getDetails(@Valid @RequestBody FindDto findDto, HttpServletRequest request) {
        Map<String, Object> res = moralEducationService.getDetails(findDto,request);
        return R.success(res);
    }
    @PostMapping("getStudentSemesterScores")
    @ApiOperation("分学期比对分析")
    public R<Map<String, Object>> getStudentSemesterScores(@Valid @RequestBody MoralDto moralDto, HttpServletRequest request) {
        Map<String, Object> res = moralEducationService.getStudentSemesterScores(moralDto,request);
        return R.success(res);
    }

    @PostMapping("getStudentMonthlyScores")
    @ApiOperation("按月比对分析")
    public R<Map<String,List<Map<String, Object>>>> getStudentMonthlyScores(@Valid @RequestBody MoralDto moralDto, HttpServletRequest request) {
        Map<String,List<Map<String, Object>>> res = moralEducationService.getStudentMonthlyScores(moralDto,request);
        return R.success(res);
    }

    @PostMapping("getExamDetails")
    @ApiOperation("获取指定考试数据")
    public R<Map<String, Object>> getExamDetails(@Valid @RequestBody MoralDto moralDto, HttpServletRequest request) {
        Map<String, Object> res = moralEducationService.getExamDetails(moralDto,request);
        return R.success(res);
    }
}
