|
@@ -4,10 +4,12 @@ import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
|
|
import vip.xiaonuo.auth.core.pojo.SaBaseLoginUser;
|
|
|
|
|
+import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.exam.domain.*;
|
|
import vip.xiaonuo.exam.domain.*;
|
|
|
import vip.xiaonuo.exam.domain.enums.ExamPaperAnswerStatusEnum;
|
|
import vip.xiaonuo.exam.domain.enums.ExamPaperAnswerStatusEnum;
|
|
|
import vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum;
|
|
import vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum;
|
|
@@ -40,6 +42,7 @@ import java.util.stream.Collectors;
|
|
|
import static vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum.Task;
|
|
import static vip.xiaonuo.exam.domain.enums.ExamPaperTypeEnum.Task;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
|
|
+@Slf4j
|
|
|
public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer> implements ExamPaperAnswerService {
|
|
public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer> implements ExamPaperAnswerService {
|
|
|
|
|
|
|
|
private final ExamPaperAnswerMapper examPaperAnswerMapper;
|
|
private final ExamPaperAnswerMapper examPaperAnswerMapper;
|
|
@@ -329,4 +332,27 @@ public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer>
|
|
|
public List<String> studentIds(String id) {
|
|
public List<String> studentIds(String id) {
|
|
|
return examPaperAnswerMapper.studentIds(id);
|
|
return examPaperAnswerMapper.studentIds(id);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public CommonResult<com.alibaba.fastjson2.JSONObject> getSubmitCountAndJudgeCount(Integer examPaperId) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 先校验是否有此试卷
|
|
|
|
|
+ ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperId);
|
|
|
|
|
+ if (examPaper == null) {
|
|
|
|
|
+ return CommonResult.error("试卷不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取此试卷的提交次数
|
|
|
|
|
+ Integer submitCount = examPaperAnswerMapper.submitCountByExamPaperId(examPaperId);
|
|
|
|
|
+ // 获取此试卷的批改次数
|
|
|
|
|
+ Integer judgeCount = examPaperAnswerMapper.judgeCountByExamPaperId(examPaperId);
|
|
|
|
|
+ // 封装返回
|
|
|
|
|
+ com.alibaba.fastjson2.JSONObject result = new com.alibaba.fastjson2.JSONObject();
|
|
|
|
|
+ result.put("submitCount", submitCount);
|
|
|
|
|
+ result.put("judgeCount", judgeCount);
|
|
|
|
|
+ return CommonResult.data(result);
|
|
|
|
|
+ }catch (Exception ex) {
|
|
|
|
|
+ log.error("获取提交次数和批改次数失败", ex);
|
|
|
|
|
+ return CommonResult.error("获取提交次数和批改次数失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|