From bf07843c67b084eb68a1a18f9531e18ddac59a37 Mon Sep 17 00:00:00 2001 From: wangxy <1481820854@qq.com> Date: Fri, 8 Nov 2024 10:15:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=80=9A=E9=AB=98=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/manager/ExamManager.java | 2 +- .../web/controller/manager/PaperManager.java | 25 +++++++++++-------- .../web/controller/manager/QuManager.java | 8 ++++-- .../controller/manager/UserExamManager.java | 2 +- .../templates/system/elExam/exam/add.html | 4 +-- .../templates/system/elExam/exam/edit.html | 4 +-- .../templates/system/elExam/qu/add.html | 18 ++++++------- .../templates/system/elExam/qu/edit.html | 18 ++++++------- .../ruoyi/system/domain/exam/dto/ExamDTO.java | 6 ++--- .../ruoyi/system/domain/paper/ElPaper.java | 2 +- .../ruoyi/system/domain/paper/ElPaperQu.java | 4 +-- .../system/domain/paper/ElPaperQuAnswer.java | 4 +-- .../system/domain/paper/dto/PaperDTO.java | 2 +- .../domain/paper/dto/PaperQuAnswerDTO.java | 4 +-- .../system/domain/paper/dto/PaperQuDTO.java | 4 +-- .../ruoyi/system/domain/qu/ElQuAnswer.java | 2 +- .../system/domain/qu/dto/QuAnswerDTO.java | 2 +- .../system/domain/userexam/ElUserExam.java | 2 +- .../domain/userexam/dto/UserExamDTO.java | 2 +- .../mapper/system/ElPaperQuMapper.xml | 6 ++--- 20 files changed, 64 insertions(+), 57 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java index 2c02f33..3e32a7f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/ExamManager.java @@ -64,7 +64,7 @@ public class ExamManager { this.calcScore(reqDTO); ElExam elExam = Convert.convert(ElExam.class, reqDTO); // 修复状态 - if (Objects.nonNull(reqDTO.getTimeLimit()) && !reqDTO.getTimeLimit() + if (Objects.nonNull(reqDTO.getTimeLimit()) && Objects.nonNull(reqDTO.getState()) && Objects.equals(reqDTO.getState(), 2)) { elExam.setState(0); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java index a9a21f9..c5061fb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/PaperManager.java @@ -218,8 +218,8 @@ public class PaperManager { //保存试题信息 ElPaperQu paperQu = new ElPaperQu(); paperQu.setQuId(qu.getId()); - paperQu.setAnswered(false); - paperQu.setIsRight(false); + paperQu.setAnswered(0); + paperQu.setIsRight(0); paperQu.setQuType(qu.getQuType()); if (QuType.RADIO.equals(qu.getQuType())) { @@ -265,7 +265,7 @@ public class PaperManager { paper.setUpdateTime(new Date()); paper.setQualifyScore(exam.getQualifyScore()); paper.setState(PaperState.ING); - paper.setHasSaq(false); + paper.setHasSaq(0); // 截止时间 Calendar cl = Calendar.getInstance(); cl.setTimeInMillis(System.currentTimeMillis()); @@ -303,7 +303,7 @@ public class PaperManager { paperQuAnswer.setPaperId(paperId); paperQuAnswer.setQuId(answer.getQuId()); paperQuAnswer.setAnswerId(answer.getId()); - paperQuAnswer.setChecked(false); + paperQuAnswer.setChecked(0); paperQuAnswer.setSort(ii); paperQuAnswer.setAbc(ABC.get(ii)); paperQuAnswer.setIsRight(answer.getIsRight()); @@ -403,18 +403,18 @@ public class PaperManager { .eq(ElPaperQuAnswer::getQuId, reqDTO.getQuId()); List list = paperQuAnswerService.list(wrapper); //是否正确 - boolean right = true; + int right = 1; //更新正确答案 for (ElPaperQuAnswer item : list) { if (reqDTO.getAnswers().contains(item.getId())) { - item.setChecked(true); + item.setChecked(1); } else { - item.setChecked(false); + item.setChecked(0); } //有一个对不上就是错的 if (item.getIsRight()!=null && !item.getIsRight().equals(item.getChecked())) { - right = false; + right = 0; } paperQuAnswerService.updateById(item); } @@ -424,7 +424,7 @@ public class PaperManager { qu.setPaperId(reqDTO.getPaperId()); qu.setIsRight(right); qu.setAnswer(reqDTO.getAnswer()); - qu.setAnswered(true); + qu.setAnswered(1); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(ElPaperQu::getPaperId, qu.getPaperId()) .eq(ElPaperQu::getQuId, qu.getQuId()); @@ -457,8 +457,11 @@ public class PaperManager { if(Boolean.TRUE.equals(paper.getHasSaq())) { paper.setState(PaperState.WAIT_OPT); }else { - // 同步保存考试成绩 - userExamManager.joinResult(paper.getUserId(), paper.getExamId(), objScore, objScore>=paper.getQualifyScore()); + if(objScore>=paper.getQualifyScore()){ + // 同步保存考试成绩 + }else{ + userExamManager.joinResult(paper.getUserId(), paper.getExamId(), objScore, 0); + } paper.setState(PaperState.FINISHED); } paper.setUpdateTime(new Date()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/QuManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/QuManager.java index 3c1661a..54c5f1a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/QuManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/QuManager.java @@ -182,7 +182,7 @@ public class QuManager { if (StringUtils.isEmpty(a.getContent())) { throw new ServiceException( no + "选项内容不为空!"); } - if (a.getIsRight()) { + if (a.getIsRight().equals(1)) { trueCount += 1; } } @@ -267,7 +267,11 @@ public class QuManager { List list = new ArrayList<>(16); for (QuExportDTO item : importList) { QuAnswerDTO a = new QuAnswerDTO(); - a.setIsRight("1".equals(item.getAIsRight())); + if("1".equals(item.getAIsRight())){ + a.setIsRight(1); + }else{ + a.setIsRight(0); + } a.setContent(item.getAContent()); a.setAnalysis(item.getAAnalysis()); a.setId(""); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java index b5dcd4e..79bf1d7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserExamManager.java @@ -62,7 +62,7 @@ public class UserExamManager { * @return void */ - public void joinResult(Long userId, String examId, Integer score, boolean passed) { + public void joinResult(Long userId, String examId, Integer score, Integer passed) { //查询条件 ElUserExam record = elUserExamService.lambdaQuery() .eq(ElUserExam::getUserId, userId) diff --git a/ruoyi-admin/src/main/resources/templates/system/elExam/exam/add.html b/ruoyi-admin/src/main/resources/templates/system/elExam/exam/add.html index 449a474..7c5df3b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/elExam/exam/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/elExam/exam/add.html @@ -116,9 +116,9 @@ - + - + - + - + @@ -42,7 +43,7 @@ public class ExamDTO implements Serializable { private Integer state; @ApiModelProperty(value = "是否限时") - private Boolean timeLimit; + private Integer timeLimit; @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty(value = "开始时间") @@ -80,8 +81,7 @@ public class ExamDTO implements Serializable { */ public Integer getState(){ - if(this.timeLimit!=null && this.timeLimit){ - + if(this.timeLimit != null && this.timeLimit != 0){ if(System.currentTimeMillis() < startTime.getTime() ){ return ExamState.READY_START; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaper.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaper.java index 4e604f7..ea5142b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaper.java @@ -81,7 +81,7 @@ public class ElPaper implements Serializable { /** * 是否包含简答题 */ - private Boolean hasSaq; + private Integer hasSaq; /** * 试卷状态 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQu.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQu.java index 43805f0..ef71e60 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQu.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQu.java @@ -40,7 +40,7 @@ public class ElPaperQu implements Serializable { /** * 是否已答 */ - private Boolean answered; + private Integer answered; /** * 主观答案 @@ -65,7 +65,7 @@ public class ElPaperQu implements Serializable { /** * 是否答对 */ - private Boolean isRight; + private Integer isRight; @TableField(exist = false) private static final long serialVersionUID = 1L; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQuAnswer.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQuAnswer.java index f2e531f..6bce114 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQuAnswer.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/ElPaperQuAnswer.java @@ -40,12 +40,12 @@ public class ElPaperQuAnswer implements Serializable { /** * 是否正确项 */ - private Boolean isRight; + private Integer isRight; /** * 是否选中 */ - private Boolean checked; + private Integer checked; /** * 排序 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperDTO.java index d629b45..69ea6dd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperDTO.java @@ -62,7 +62,7 @@ public class PaperDTO implements Serializable { private Integer userScore; @ApiModelProperty(value = "是否包含简答题") - private Boolean hasSaq; + private Integer hasSaq; @ApiModelProperty(value = "试卷状态") private Integer state; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuAnswerDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuAnswerDTO.java index aad9c1a..753a840 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuAnswerDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuAnswerDTO.java @@ -34,10 +34,10 @@ public class PaperQuAnswerDTO implements Serializable { private String quId; @ApiModelProperty(value = "是否正确项") - private Boolean isRight; + private Integer isRight; @ApiModelProperty(value = "是否选中") - private Boolean checked; + private Integer checked; @ApiModelProperty(value = "排序") private Integer sort; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuDTO.java index 677b539..0255314 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/paper/dto/PaperQuDTO.java @@ -34,7 +34,7 @@ public class PaperQuDTO implements Serializable { private Integer quType; @ApiModelProperty(value = "是否已答") - private Boolean answered; + private Integer answered; @ApiModelProperty(value = "主观答案") private String answer; @@ -49,6 +49,6 @@ public class PaperQuDTO implements Serializable { private Integer actualScore; @ApiModelProperty(value = "是否答对") - private Boolean isRight; + private Integer isRight; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/ElQuAnswer.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/ElQuAnswer.java index a21b48b..ec99c0e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/ElQuAnswer.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/ElQuAnswer.java @@ -30,7 +30,7 @@ public class ElQuAnswer implements Serializable { /** * 是否正确 */ - private Boolean isRight; + private Integer isRight; /** * 选项图片 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/dto/QuAnswerDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/dto/QuAnswerDTO.java index 4fada4c..29dd598 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/dto/QuAnswerDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/qu/dto/QuAnswerDTO.java @@ -30,7 +30,7 @@ public class QuAnswerDTO implements Serializable { private String quId; @ApiModelProperty(value = "是否正确") - private Boolean isRight; + private Integer isRight; @ApiModelProperty(value = "选项图片") private String image; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/ElUserExam.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/ElUserExam.java index 0dba06b..f9bbb11 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/ElUserExam.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/ElUserExam.java @@ -47,7 +47,7 @@ public class ElUserExam implements Serializable { /** * 是否通过 */ - private Boolean passed; + private Integer passed; /** * 创建时间 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/UserExamDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/UserExamDTO.java index 129554e..3f58705 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/UserExamDTO.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/UserExamDTO.java @@ -37,7 +37,7 @@ public class UserExamDTO implements Serializable { private Integer maxScore; @ApiModelProperty(value = "是否通过") - private Boolean passed; + private Integer passed; @ApiModelProperty(value = "创建时间") private Date createTime; diff --git a/ruoyi-system/src/main/resources/mapper/system/ElPaperQuMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ElPaperQuMapper.xml index 86d6978..b89a8c6 100644 --- a/ruoyi-system/src/main/resources/mapper/system/ElPaperQuMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/ElPaperQuMapper.xml @@ -27,11 +27,11 @@