package com.gkhy.exam.admin.controller.app; import com.gkhy.exam.common.annotation.RepeatSubmit; import com.gkhy.exam.common.api.CommonResult; import com.gkhy.exam.system.domain.ExStudentStudy; import com.gkhy.exam.system.service.ExStudentStudyService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; /** *
* 课程学习学习日志表 前端控制器 *
* * @author kzy * @since 2024-06-06 13:53:17 */ @Api(tags = "APP学员学习记录前端控制器") @RestController @RequestMapping("/app/student-study") public class AppStudentStudyController { @Autowired private ExStudentStudyService studentStudyService; @RepeatSubmit @PreAuthorize("hasAnyAuthority('train:exam:student')") @ApiOperation(value = "新增学习记录") @PostMapping public CommonResult add(@Validated @RequestBody ExStudentStudy studentStudy){ return CommonResult.success(studentStudyService.insertStudentStudy(studentStudy)); } @PreAuthorize("hasAnyAuthority('train:exam:student')") @ApiOperation(value = "上报学习进度") @ApiImplicitParams({ @ApiImplicitParam(paramType = "body", name = "id", dataType = "long", required = true, value = "学习记录id"), @ApiImplicitParam(paramType = "body", name = "phaseId", dataType = "long", required = true, value = "批次id"), @ApiImplicitParam(paramType = "body", name = "periodId", dataType = "long", required = true, value = "课时id"), @ApiImplicitParam(paramType = "body", name = "resourceId", dataType = "long", required = true, value = "资源id"), @ApiImplicitParam(paramType = "body", name = "currentDuration", dataType = "int", required = false, value = "当前学习时长,单位秒"), @ApiImplicitParam(paramType = "body", name = "currentPage", dataType = "int", required = false, value = "当前学习页数,单位页") }) @PostMapping("/progress") public CommonResult progress(@RequestBody ExStudentStudy studentStudy){ System.out.println("progress info:"+studentStudy.getId()+","+studentStudy.getPhaseId()+","+studentStudy.getPeriodId()+","+studentStudy.getStudentId()); studentStudyService.progress(studentStudy); return CommonResult.success(); } }