heheng
7 天以前 d8012ee77b6a9e86611aae9074d5925826f4210d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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.*;
 
/**
 * <p>
 * 课程学习学习日志表 前端控制器
 * </p>
 *
 * @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();
    }
}