feat:瀚高适配

hangao
wangxy 5 months ago
parent b4cac4c873
commit bf07843c67

@ -64,7 +64,7 @@ public class ExamManager {
this.calcScore(reqDTO); this.calcScore(reqDTO);
ElExam elExam = Convert.convert(ElExam.class, 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.nonNull(reqDTO.getState())
&& Objects.equals(reqDTO.getState(), 2)) { && Objects.equals(reqDTO.getState(), 2)) {
elExam.setState(0); elExam.setState(0);

@ -218,8 +218,8 @@ public class PaperManager {
//保存试题信息 //保存试题信息
ElPaperQu paperQu = new ElPaperQu(); ElPaperQu paperQu = new ElPaperQu();
paperQu.setQuId(qu.getId()); paperQu.setQuId(qu.getId());
paperQu.setAnswered(false); paperQu.setAnswered(0);
paperQu.setIsRight(false); paperQu.setIsRight(0);
paperQu.setQuType(qu.getQuType()); paperQu.setQuType(qu.getQuType());
if (QuType.RADIO.equals(qu.getQuType())) { if (QuType.RADIO.equals(qu.getQuType())) {
@ -265,7 +265,7 @@ public class PaperManager {
paper.setUpdateTime(new Date()); paper.setUpdateTime(new Date());
paper.setQualifyScore(exam.getQualifyScore()); paper.setQualifyScore(exam.getQualifyScore());
paper.setState(PaperState.ING); paper.setState(PaperState.ING);
paper.setHasSaq(false); paper.setHasSaq(0);
// 截止时间 // 截止时间
Calendar cl = Calendar.getInstance(); Calendar cl = Calendar.getInstance();
cl.setTimeInMillis(System.currentTimeMillis()); cl.setTimeInMillis(System.currentTimeMillis());
@ -303,7 +303,7 @@ public class PaperManager {
paperQuAnswer.setPaperId(paperId); paperQuAnswer.setPaperId(paperId);
paperQuAnswer.setQuId(answer.getQuId()); paperQuAnswer.setQuId(answer.getQuId());
paperQuAnswer.setAnswerId(answer.getId()); paperQuAnswer.setAnswerId(answer.getId());
paperQuAnswer.setChecked(false); paperQuAnswer.setChecked(0);
paperQuAnswer.setSort(ii); paperQuAnswer.setSort(ii);
paperQuAnswer.setAbc(ABC.get(ii)); paperQuAnswer.setAbc(ABC.get(ii));
paperQuAnswer.setIsRight(answer.getIsRight()); paperQuAnswer.setIsRight(answer.getIsRight());
@ -403,18 +403,18 @@ public class PaperManager {
.eq(ElPaperQuAnswer::getQuId, reqDTO.getQuId()); .eq(ElPaperQuAnswer::getQuId, reqDTO.getQuId());
List<ElPaperQuAnswer> list = paperQuAnswerService.list(wrapper); List<ElPaperQuAnswer> list = paperQuAnswerService.list(wrapper);
//是否正确 //是否正确
boolean right = true; int right = 1;
//更新正确答案 //更新正确答案
for (ElPaperQuAnswer item : list) { for (ElPaperQuAnswer item : list) {
if (reqDTO.getAnswers().contains(item.getId())) { if (reqDTO.getAnswers().contains(item.getId())) {
item.setChecked(true); item.setChecked(1);
} else { } else {
item.setChecked(false); item.setChecked(0);
} }
//有一个对不上就是错的 //有一个对不上就是错的
if (item.getIsRight()!=null && !item.getIsRight().equals(item.getChecked())) { if (item.getIsRight()!=null && !item.getIsRight().equals(item.getChecked())) {
right = false; right = 0;
} }
paperQuAnswerService.updateById(item); paperQuAnswerService.updateById(item);
} }
@ -424,7 +424,7 @@ public class PaperManager {
qu.setPaperId(reqDTO.getPaperId()); qu.setPaperId(reqDTO.getPaperId());
qu.setIsRight(right); qu.setIsRight(right);
qu.setAnswer(reqDTO.getAnswer()); qu.setAnswer(reqDTO.getAnswer());
qu.setAnswered(true); qu.setAnswered(1);
QueryWrapper<ElPaperQu> queryWrapper = new QueryWrapper<>(); QueryWrapper<ElPaperQu> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ElPaperQu::getPaperId, qu.getPaperId()) queryWrapper.lambda().eq(ElPaperQu::getPaperId, qu.getPaperId())
.eq(ElPaperQu::getQuId, qu.getQuId()); .eq(ElPaperQu::getQuId, qu.getQuId());
@ -457,8 +457,11 @@ public class PaperManager {
if(Boolean.TRUE.equals(paper.getHasSaq())) { if(Boolean.TRUE.equals(paper.getHasSaq())) {
paper.setState(PaperState.WAIT_OPT); paper.setState(PaperState.WAIT_OPT);
}else { }else {
// 同步保存考试成绩 if(objScore>=paper.getQualifyScore()){
userExamManager.joinResult(paper.getUserId(), paper.getExamId(), objScore, objScore>=paper.getQualifyScore()); // 同步保存考试成绩
}else{
userExamManager.joinResult(paper.getUserId(), paper.getExamId(), objScore, 0);
}
paper.setState(PaperState.FINISHED); paper.setState(PaperState.FINISHED);
} }
paper.setUpdateTime(new Date()); paper.setUpdateTime(new Date());

@ -182,7 +182,7 @@ public class QuManager {
if (StringUtils.isEmpty(a.getContent())) { if (StringUtils.isEmpty(a.getContent())) {
throw new ServiceException( no + "选项内容不为空!"); throw new ServiceException( no + "选项内容不为空!");
} }
if (a.getIsRight()) { if (a.getIsRight().equals(1)) {
trueCount += 1; trueCount += 1;
} }
} }
@ -267,7 +267,11 @@ public class QuManager {
List<QuAnswerDTO> list = new ArrayList<>(16); List<QuAnswerDTO> list = new ArrayList<>(16);
for (QuExportDTO item : importList) { for (QuExportDTO item : importList) {
QuAnswerDTO a = new QuAnswerDTO(); 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.setContent(item.getAContent());
a.setAnalysis(item.getAAnalysis()); a.setAnalysis(item.getAAnalysis());
a.setId(""); a.setId("");

@ -62,7 +62,7 @@ public class UserExamManager {
* @return void * @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() ElUserExam record = elUserExamService.lambdaQuery()
.eq(ElUserExam::getUserId, userId) .eq(ElUserExam::getUserId, userId)

@ -116,9 +116,9 @@
<el-input-number v-model="postForm.totalTime" ></el-input-number> <el-input-number v-model="postForm.totalTime" ></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="是否限时"> <el-form-item label="是否限时">
<el-checkbox v-model="postForm.timeLimit" ></el-checkbox> <el-checkbox v-model="postForm.timeLimit" :true-label="1" :false-label="0"></el-checkbox>
</el-form-item> </el-form-item>
<el-form-item v-if="postForm.timeLimit" label="考试时间" prop="totalTime"> <el-form-item v-if="postForm.timeLimit === 1" label="考试时间" prop="totalTime">
<el-date-picker <el-date-picker
v-model="dateValues" v-model="dateValues"
format="yyyy-MM-dd" format="yyyy-MM-dd"

@ -116,9 +116,9 @@
<el-input-number v-model="postForm.totalTime" ></el-input-number> <el-input-number v-model="postForm.totalTime" ></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="是否限时"> <el-form-item label="是否限时">
<el-checkbox v-model="postForm.timeLimit" ></el-checkbox> <el-checkbox v-model="postForm.timeLimit" :true-label="1" :false-label="0"></el-checkbox>
</el-form-item> </el-form-item>
<el-form-item v-if="postForm.timeLimit" label="考试时间" prop="totalTime"> <el-form-item v-if="postForm.timeLimit === 1" label="考试时间" prop="totalTime">
<el-date-picker <el-date-picker
v-model="dateValues" v-model="dateValues"
format="yyyy-MM-dd" format="yyyy-MM-dd"

@ -71,7 +71,7 @@
align="center" align="center"
> >
<template v-slot="scope"> <template v-slot="scope">
<el-checkbox v-model="scope.row.isRight">答案</el-checkbox> <el-checkbox v-model="scope.row.isRight" :true-label="1" :false-label="0">答案</el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -247,21 +247,21 @@
handleTypeChange(v) { handleTypeChange(v) {
this.postForm.answerList = [] this.postForm.answerList = []
if (v === 3) { if (v === 3) {
this.postForm.answerList.push({ isRight: true, content: '正确', analysis: '' }) this.postForm.answerList.push({ isRight: 1, content: '正确', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '错误', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '错误', analysis: '' })
} }
if (v === 1 || v === 2) { if (v === 1 || v === 2) {
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
} }
}, },
// 添加子项 // 添加子项
handleAdd() { handleAdd() {
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
}, },
removeItem(index) { removeItem(index) {
@ -297,7 +297,7 @@
submitForm() { submitForm() {
let rightCount = 0 let rightCount = 0
this.postForm.answerList.forEach(function(item) { this.postForm.answerList.forEach(function(item) {
if (item.isRight) { if (item.isRight === 1) {
rightCount += 1 rightCount += 1
} }
}) })

@ -70,7 +70,7 @@
align="center" align="center"
> >
<template v-slot="scope"> <template v-slot="scope">
<el-checkbox v-model="scope.row.isRight">答案</el-checkbox> <el-checkbox v-model="scope.row.isRight" :true-label="1" :false-label="0">答案</el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -258,21 +258,21 @@
handleTypeChange(v) { handleTypeChange(v) {
this.postForm.answerList = [] this.postForm.answerList = []
if (v === 3) { if (v === 3) {
this.postForm.answerList.push({ isRight: true, content: '正确', analysis: '' }) this.postForm.answerList.push({ isRight: 1, content: '正确', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '错误', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '错误', analysis: '' })
} }
if (v === 1 || v === 2) { if (v === 1 || v === 2) {
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
} }
}, },
// 添加子项 // 添加子项
handleAdd() { handleAdd() {
this.postForm.answerList.push({ isRight: false, content: '', analysis: '' }) this.postForm.answerList.push({ isRight: 0, content: '', analysis: '' })
}, },
removeItem(index) { removeItem(index) {
@ -308,7 +308,7 @@
submitForm() { submitForm() {
let rightCount = 0 let rightCount = 0
this.postForm.answerList.forEach(function(item) { this.postForm.answerList.forEach(function(item) {
if (item.isRight) { if (item.isRight === 1) {
rightCount += 1 rightCount += 1
} }
}) })

@ -9,6 +9,7 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects;
/** /**
* <p> * <p>
@ -42,7 +43,7 @@ public class ExamDTO implements Serializable {
private Integer state; private Integer state;
@ApiModelProperty(value = "是否限时") @ApiModelProperty(value = "是否限时")
private Boolean timeLimit; private Integer timeLimit;
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
@ -80,8 +81,7 @@ public class ExamDTO implements Serializable {
*/ */
public Integer getState(){ public Integer getState(){
if(this.timeLimit!=null && this.timeLimit){ if(this.timeLimit != null && this.timeLimit != 0){
if(System.currentTimeMillis() < startTime.getTime() ){ if(System.currentTimeMillis() < startTime.getTime() ){
return ExamState.READY_START; return ExamState.READY_START;
} }

@ -81,7 +81,7 @@ public class ElPaper implements Serializable {
/** /**
* *
*/ */
private Boolean hasSaq; private Integer hasSaq;
/** /**
* *

@ -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) @TableField(exist = false)
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -40,12 +40,12 @@ public class ElPaperQuAnswer implements Serializable {
/** /**
* *
*/ */
private Boolean isRight; private Integer isRight;
/** /**
* *
*/ */
private Boolean checked; private Integer checked;
/** /**
* *

@ -62,7 +62,7 @@ public class PaperDTO implements Serializable {
private Integer userScore; private Integer userScore;
@ApiModelProperty(value = "是否包含简答题") @ApiModelProperty(value = "是否包含简答题")
private Boolean hasSaq; private Integer hasSaq;
@ApiModelProperty(value = "试卷状态") @ApiModelProperty(value = "试卷状态")
private Integer state; private Integer state;

@ -34,10 +34,10 @@ public class PaperQuAnswerDTO implements Serializable {
private String quId; private String quId;
@ApiModelProperty(value = "是否正确项") @ApiModelProperty(value = "是否正确项")
private Boolean isRight; private Integer isRight;
@ApiModelProperty(value = "是否选中") @ApiModelProperty(value = "是否选中")
private Boolean checked; private Integer checked;
@ApiModelProperty(value = "排序") @ApiModelProperty(value = "排序")
private Integer sort; private Integer sort;

@ -34,7 +34,7 @@ public class PaperQuDTO implements Serializable {
private Integer quType; private Integer quType;
@ApiModelProperty(value = "是否已答") @ApiModelProperty(value = "是否已答")
private Boolean answered; private Integer answered;
@ApiModelProperty(value = "主观答案") @ApiModelProperty(value = "主观答案")
private String answer; private String answer;
@ -49,6 +49,6 @@ public class PaperQuDTO implements Serializable {
private Integer actualScore; private Integer actualScore;
@ApiModelProperty(value = "是否答对") @ApiModelProperty(value = "是否答对")
private Boolean isRight; private Integer isRight;
} }

@ -30,7 +30,7 @@ public class ElQuAnswer implements Serializable {
/** /**
* *
*/ */
private Boolean isRight; private Integer isRight;
/** /**
* *

@ -30,7 +30,7 @@ public class QuAnswerDTO implements Serializable {
private String quId; private String quId;
@ApiModelProperty(value = "是否正确") @ApiModelProperty(value = "是否正确")
private Boolean isRight; private Integer isRight;
@ApiModelProperty(value = "选项图片") @ApiModelProperty(value = "选项图片")
private String image; private String image;

@ -47,7 +47,7 @@ public class ElUserExam implements Serializable {
/** /**
* *
*/ */
private Boolean passed; private Integer passed;
/** /**
* *

@ -37,7 +37,7 @@ public class UserExamDTO implements Serializable {
private Integer maxScore; private Integer maxScore;
@ApiModelProperty(value = "是否通过") @ApiModelProperty(value = "是否通过")
private Boolean passed; private Integer passed;
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createTime; private Date createTime;

@ -27,11 +27,11 @@
<!-- 计算总分 --> <!-- 计算总分 -->
<select id="sumObjective" resultType="int"> <select id="sumObjective" resultType="int">
SELECT IFNULL(SUM(actual_score),0) as total SELECT COALESCE(SUM(CAST(actual_score AS INTEGER)), 0) AS total
FROM el_paper_qu FROM el_paper_qu
WHERE paper_id=#{paperId} WHERE paper_id=#{paperId}
AND is_right=true AND is_right='1'
AND qu_type &lt; 4 AND qu_type &lt; '4'
</select> </select>

Loading…
Cancel
Save