package com.xhkjedu.sapi.controller.analyze;

import com.xhkjedu.sapi.service.analyze.SchoolTaskService;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import com.xhkjedu.sapi.vo.analyze.SchoolParams;
import com.xhkjedu.sapi.vo.analyze.work.SchoolWorkSubjectVo;
import com.xhkjedu.sapi.vo.analyze.work.SchoolWorkVo;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;

/**
 * @ClassName SchoolTaskController
 * Description TODO 作业概况
 * Author WN
 * Date 2020/8/10 14:23
 **/

@RestController
@RequestMapping("/schoolt")
public class SchoolTaskController {
    @Autowired
    private SchoolTaskService schoolTaskService;

    /**
     *功能描述 常规作业
     * @author WN
     * @date 2020/8/10
     * @param  * @param srparams
     * @return com.xhkjedu.vo.ResultVo
     */
    @PostMapping("/twork")
    public ResultVo listSchoolTaskWork(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级id",1,srparams.getYear(),"学年",1});
        SchoolWorkVo schoolWorkVo = schoolTaskService.listSchoolTaskWork(srparams);
        return new ResultVo(0,"",schoolWorkVo);
    }

    /**
     * 常规作业--详情
     * @param srparams
     * @return
     */
    @PostMapping("/tworkd")
    public ResultVo listSchoolTaskWorkDetail(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        List<SchoolWorkSubjectVo> lst = schoolTaskService.listSchoolTaskWorkDetail(srparams);
        return new ResultVo(0,"",lst);
    }

    /**
     *功能描述 学生预习
     * @author WN
     * @date 2020/8/10
     * @param  * @param srparams
     * @return com.xhkjedu.vo.ResultVo
     */
    @PostMapping("/tguide")
    public ResultVo listSchoolTaskGuide(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        SchoolWorkVo schoolWorkVo = schoolTaskService.listSchoolTaskGuide(srparams);
        return new ResultVo(0,"",schoolWorkVo);
    }

    /**
     * 学生预习-详情
     * @param srparams
     * @return
     */
    @PostMapping("/tguided")
    public ResultVo listSchoolTaskGuideDetail(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        List<SchoolWorkSubjectVo> lst = schoolTaskService.listSchoolTaskGuideDetail(srparams);
        return new ResultVo(0,"",lst);
    }

    /**
     *功能描述 背诵
     * @author WN
     * @date 2020/8/10
     * @param  * @param srparams
     * @return com.xhkjedu.vo.ResultVo
     */
    @PostMapping("/trecite")
    public ResultVo listSchoolTaskRecite(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        SchoolWorkVo schoolWorkVo = schoolTaskService.listSchoolTaskRecite(srparams);
        return new ResultVo(0,"",schoolWorkVo);
    }

    /**
     * 背诵-详情
     * @param srparams
     * @return
     */
    @PostMapping("/trecited")
    public ResultVo listSchoolTaskReciteDetail(@RequestBody SchoolParams srparams){
        N_Utils.validation(new Object[]{srparams.getSchoolid(),"学校id",1,
                srparams.getGradeid(),"年级",1,srparams.getYear(),"学年",1});
        List<SchoolWorkSubjectVo> lst = schoolTaskService.listSchoolTaskReciteDetail(srparams);
        return new ResultVo(0,"",lst);
    }
}
