package cn.com.qmth.stmms.ms.admin.api;

import cn.com.qmth.stmms.ms.admin.service.TrialService;
import cn.com.qmth.stmms.ms.core.vo.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 试评任务controller
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2019/11/4
 */
//@Api(tags = "试评任务接口controller")
@RestController
@RequestMapping("api/trial")
public class TrialController {

    @Autowired
    TrialService trialService;

    /**
     * 开始试评任务
     *
     * @param workId
     * @param subject
     * @throws Exception
     */
//    @ApiOperation(value = "开始试评任务接口")
    @RequestMapping(value = "startTrial", method = RequestMethod.GET)
    public void startTrial(
//            @ApiParam(value = "workId", required = true)
            @RequestParam Long workId,
//            @ApiParam(value = "科目", required = true)
            @RequestParam Subject subject) throws Exception {
        trialService.startTrial(workId, subject);
    }

    /**
     * 删除试评任务，保留标准卷
     *
     * @param workId
     * @param subject
     * @throws Exception
     */
//    @ApiOperation(value = "结束试评任务接口")
    @RequestMapping(value = "finishTrial", method = RequestMethod.GET)
    public boolean finishTrial(
//            @ApiParam(value = "workId", required = true)
            @RequestParam Long workId,
//            @ApiParam(value = "科目", required = true)
            @RequestParam Subject subject) throws Exception {
        trialService.finishTrial(workId, subject);
        return true;
    }

    /**
     * 检查任务状态
     *
     * @param workId
     * @param subject
     * @throws Exception
     */
//    @ApiOperation(value = "检查试评任务接口")
    @RequestMapping(value = "checkMissionStatus", method = RequestMethod.GET)
    public void checkMissionStatus(
//            @ApiParam(value = "workId", required = true)
            @RequestParam Long workId,
//            @ApiParam(value = "科目", required = true)
            @RequestParam Subject subject) throws Exception {
        trialService.checkMissionStatus(workId, subject);
    }
}
