|
@@ -0,0 +1,87 @@
|
|
|
+package cn.iselab.mooctest.site.web.ctrl;
|
|
|
+
|
|
|
+import cn.iselab.mooctest.site.common.constant.UrlConstants;
|
|
|
+import cn.iselab.mooctest.site.models.CodeCov;
|
|
|
+import cn.iselab.mooctest.site.service.CodeCovService;
|
|
|
+import cn.iselab.mooctest.site.web.data.json.CodeCovJson;
|
|
|
+import cn.iselab.mooctest.site.web.data.response.ResponseVO;
|
|
|
+import cn.iselab.mooctest.site.web.logic.CodeVisualizeLogic;
|
|
|
+import org.apache.shiro.SecurityUtils;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresRoles;
|
|
|
+import org.bson.types.Code;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author yyy
|
|
|
+ * @date 2020/3/14 14:12
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+public class CodingVisualizeController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CodeVisualizeLogic codeVisualizeLogic;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CodeCovService codeCovService;
|
|
|
+
|
|
|
+ @PostMapping(UrlConstants.API +"/codeVisualize/saveCodeCov")
|
|
|
+ public ResponseVO getCovMatrix(@RequestBody CodeCovJson cc){
|
|
|
+ try{
|
|
|
+ return codeVisualizeLogic.saveCodeCov(cc.getExamId(), cc.getCaseId(), cc.getWorkerId(), cc.getCovMatrix());
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseVO<>(50000, e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(UrlConstants.API +"/codeVisualize/getCodeCov")
|
|
|
+ public ResponseVO getCovMatrix(@RequestParam long examId,
|
|
|
+ @RequestParam long caseId,
|
|
|
+ @RequestParam long workerId){
|
|
|
+ try{
|
|
|
+ return codeVisualizeLogic.getCodeCov(examId, caseId, workerId);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseVO<>(50000, e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping(UrlConstants.API + "/codeVisualize/getWorkingBlock")
|
|
|
+ public ResponseVO getWorkingBlock(@RequestParam long examId,
|
|
|
+ @RequestParam long workerId,
|
|
|
+ @RequestParam long startTime,
|
|
|
+ @RequestParam long endTime,
|
|
|
+ @RequestParam int stepMinutes){
|
|
|
+
|
|
|
+ return codeVisualizeLogic.getWorkingBlock(examId,workerId,startTime,endTime,stepMinutes);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequiresRoles(value = "manager")
|
|
|
+ @GetMapping(UrlConstants.API +"/codeVisualize/classCodeCov")
|
|
|
+ public ResponseVO getClassCovMatrix(@RequestParam long examId,
|
|
|
+ @RequestParam long caseId,
|
|
|
+ @RequestParam long groupId){
|
|
|
+ try{
|
|
|
+ return codeVisualizeLogic.getClassCodeCov(examId, caseId, groupId);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseVO<>(50000, e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequiresRoles(value = "manager")
|
|
|
+ @PostMapping(UrlConstants.API +"/codeVisualize/classWorkBlock")
|
|
|
+ public ResponseVO getClassWorkBlock(@RequestParam long examId,
|
|
|
+ @RequestParam long groupId,
|
|
|
+ @RequestParam long startTime,
|
|
|
+ @RequestParam long endTime,
|
|
|
+ @RequestParam int stepMinutes){
|
|
|
+ try{
|
|
|
+ return codeVisualizeLogic.getClassWorkingBlock(examId, groupId, startTime, endTime, stepMinutes);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseVO<>(50000, e.getMessage(), null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|