package com.ym.mec.education.controller;

import com.ym.mec.education.base.BaseResponse;
import com.ym.mec.education.base.PageResponse;
import com.ym.mec.education.req.AttendClassReq;
import com.ym.mec.education.req.HomeWorkReq;
import com.ym.mec.education.service.IStudentAttendanceService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * @author : chengp
 * @version V1.0
 * @Description: TODO
 * @date Date : 2019年10月07日 10:08
 */
@RestController
@RequestMapping("api/attendClass")
@Api(tags = "上课记录")
@Slf4j
public class AttendClassController {

    @Autowired
    private IStudentAttendanceService studentAttendanceService;
    /**
     * 服务降级处理
     *
     * @return
     */
    private BaseResponse defaultFallback() {
        BaseResponse response = new BaseResponse();
        response.setReturnCode(500);
        response.setMessage("太拥挤了, 请稍后再试!");
        return response;
    }


    /**
     * 上课记录
     * @param req
     * @return
     */
    @PostMapping(value = "/attendRecord")
    public PageResponse attendRecord(@RequestBody AttendClassReq req) {

        return  studentAttendanceService.attendRecordList(req);
    }


    /**
     * 点名记录
     * @param req
     * @return
     */
    @PostMapping(value = "/callStudent")
    public PageResponse callStudent(@RequestBody HomeWorkReq req) {

        return  studentAttendanceService.callStudent(req);
    }


    /**
     * 签到
     * @param req
     * @return
     */
    @PostMapping(value = "/signInfo")
    public BaseResponse signInfo(@RequestBody HomeWorkReq req) {


        return studentAttendanceService.signInfo(req);
    }



}
