package com.xhkjedu.smarking.controller.report;

import com.xhkjedu.smarking.model.report.reportsubject.MsrSubject;
import com.xhkjedu.smarking.service.report.report.*;
import com.xhkjedu.smarking.vo.report.reportstu.StudentParams;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

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

/**
 *@Description 校级报告
 *@Author ywx
 *Date 2025/1/10 14:31
 **/
@RestController
@RequestMapping("/rxj")
public class XjReportController {
    @Resource
    private MsrSubjectService msrSubjectService;
    @Resource
    private MsrStudentService msrStudentService;
    @Resource
    private MsrClassService msrClassService;

    /**
     * @Description 总体情况汇总分析-总分基本情况成绩分析
     * @Date 2025/1/10 14:54
     * @Author YWX
     * @Param [subject]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/hz_zf")
    public ResultVo getExamForHzZf(@RequestBody MsrSubject subject) {
        Integer examid = subject.getExamid();
        N_Utils.validation(new Object[]{examid, "考试id", 1});
        return new ResultVo(0, "获取成功", msrSubjectService.getExamForHzZf(examid));
    }

    /**
     * @Description 总体情况汇总分析-各学科基本数据对比情况
     * @Date 2025/1/10 15:04
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/hz_xk")
    public ResultVo listSubjectForHzXk(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{params.getExamid(), "考试id", 1});
        return new ResultVo(0, "获取成功", msrSubjectService.listSubjectForHzXk(params));
    }

    /**
     * @Description 总分分布
     * @Date 2025/1/10 17:28
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/zffb")
    public ResultVo listScoreForZfFb(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{params.getExamid(), "考试id", 1});
        return new ResultVo(0, "获取成功", msrStudentService.listScoreForZfFb(params));
    }

    /**
     * @Description 总分分档上线-列表
     * @Date 2025/1/15 9:15
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/fdsx_zf")
    public ResultVo listClassForFdSxZf(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        params.setSubjectid("zf");
        return new ResultVo(0, "获取成功", msrClassService.listClassForFdSxZf(params));
    }

    /**
     * @Description 临界生群体分析
     * @Date 2025/1/15 9:35
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/ljs_zf")
    public ResultVo listClassForLjsZf(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        params.setSubjectid("zf");
        return new ResultVo(0, "获取成功", msrClassService.listClassForLjsZf(params));
    }

    /**
     * @Description 学科分档上线-人数列表
     * @Date 2025/1/15 9:37
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/fdsx_xkrs")
    public ResultVo listClassForFdSxXkRs(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
                , params.getDworder(), "档位序号", 1
        });
        return new ResultVo(0, "获取成功", msrClassService.listClassForFdSxXkOneField(params, "sxnum"));
    }

    /**
     * @Description 学科分档上线-贡献率列表
     * @Date 2025/1/15 9:58
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/fdsx_xkgxl")
    public ResultVo listClassForFdSxXkGxl(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
                , params.getDworder(), "档位序号", 1
        });
        params.setReportcode("glx");
        return new ResultVo(0, "获取成功", msrClassService.listClassForFdSxXkOneField(params, "gxrate"));
    }

    /**
     * @Description 班级考试基本表现-列表
     * @Date 2025/1/15 10:24
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/ksbx")
    public ResultVo listScoreForKsBx(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{params.getExamid(), "考试id", 1, params.getClassids(), "班级id", 3});
        return new ResultVo(0, "获取成功", msrStudentService.listScoreForKsBx(params));
    }

    /**
     * @Description 分段人数分布-列表
     * @Date 2025/1/15 15:23
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/fsd")
    public ResultVo listClassForFsd(@RequestBody StudentParams params) {
        List<Integer> classids = params.getClassids();
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
                , classids, "班级", 3
        });
        params.setType(1);
        params.setSubjectid("zf");
        params.setReportcode("xj");
        return new ResultVo(0, "获取成功", msrClassService.listClassForFsd(params, "fzfw,fzfwnum"));
    }

    /**
     * @Description 学科考试表现-各班级平均水平-列表
     * @Date 2025/1/15 16:02
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/xkbx_pjsp")
    public ResultVo listClassForXkBxPjSp(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        return new ResultVo(0, "获取成功", msrClassService.listClassForXkBxPjSp(params));
    }

    /**
     * @Description 学科考试表现-各班级学科平均水平贡献率-列表
     * @Date 2025/1/15 16:24
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/xkbx_gxl")
    public ResultVo listClassForXkBxGxl(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        return new ResultVo(0, "获取成功", msrClassService.listClassForXkBxGxl(params));
    }

    /**
     * @Description 学科考试表现-各学科成绩等级结构比例（得分率）-列表
     * @Date 2025/1/15 16:52
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/xkbx_dfl")
    public ResultVo listClassForXkBxDfl(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        return new ResultVo(0, "获取成功", msrClassService.listClassForXkBxDfl(params));
    }

    /**
     * @Description 学科考试表现-总分等级结构表现-列表
     * @Date 2025/1/15 17:17
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/xkbx_zfdj")
    public ResultVo listClassForXkBxZfDj(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        return new ResultVo(0, "获取成功", msrClassService.listClassForXkBxZfDj(params));
    }

    /**
     * @Description 学科表现-学科的平均得分率差异
     * @Date 2025/1/15 17:35
     * @Author YWX
     * @Param [params]
     * @Return com.xhkjedu.vo.ResultVo
     **/
    @PostMapping("/xkbx_dfl_cy")
    public ResultVo listSubjectForDflCy(@RequestBody StudentParams params) {
        N_Utils.validation(new Object[]{
                params.getExamid(), "考试id", 1
        });
        return new ResultVo(0, "获取成功", msrSubjectService.listSubjectForDflCy(params));
    }

}
