|
@@ -25,6 +25,7 @@ import com.gyee.exam.modules.paper.dto.ext.PaperGroupExtDTO;
|
|
|
import com.gyee.exam.modules.paper.dto.ext.PaperQuAnswerExtDTO;
|
|
|
import com.gyee.exam.modules.paper.dto.ext.PaperQuDetailDTO;
|
|
|
import com.gyee.exam.modules.paper.dto.request.PaperListReqDTO;
|
|
|
+import com.gyee.exam.modules.paper.dto.request.PaperQuQueryDTO;
|
|
|
import com.gyee.exam.modules.paper.dto.response.ExamDetailRespDTO;
|
|
|
import com.gyee.exam.modules.paper.dto.response.ExamResultRespDTO;
|
|
|
import com.gyee.exam.modules.paper.dto.response.PaperListRespDTO;
|
|
@@ -61,6 +62,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -635,7 +637,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|
|
// 循环标准答案
|
|
|
for (PaperQuAnswerExtDTO an : answers) {
|
|
|
if (!StringUtils.isBlank(an.getAnswer())) {
|
|
|
- userList.add(an.getAnswer());
|
|
|
+ userList.add(an.getAnswer().trim());
|
|
|
qu.setAnswered(true);
|
|
|
}
|
|
|
}
|
|
@@ -651,10 +653,25 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|
|
List<PaperQuAnswer> list = BeanMapper.mapList(answers, PaperQuAnswer.class);
|
|
|
paperQuAnswerService.updateBatchById(list);
|
|
|
|
|
|
- boolean right = ListUtils.compareList(rightList, userList);
|
|
|
-
|
|
|
+ //boolean right = ListUtils.compareList(rightList, userList);
|
|
|
+ BigDecimal score = BigDecimal.valueOf(0);
|
|
|
+ boolean right = false;
|
|
|
+ List<String> reduce = rightList.stream().filter(item -> !userList.contains(item)).collect(Collectors.toList());
|
|
|
+ if (userList.size() == 0){
|
|
|
+ //没有答案
|
|
|
+ right = false;
|
|
|
+ score = pathScore;
|
|
|
+ } else if (reduce.size() == 0 && userList.size() == rightList.size()){
|
|
|
+ //答案全部正确
|
|
|
+ right = true;
|
|
|
+ score = qu.getScore();
|
|
|
+ } else if (reduce.size() > 0 && reduce.size() != rightList.size()){
|
|
|
+ //答案部分正确
|
|
|
+ right = true;
|
|
|
+ score = new BigDecimal(qu.getScore().doubleValue() / 2).setScale(1, BigDecimal.ROUND_CEILING);
|
|
|
+ }
|
|
|
qu.setIsRight(right);
|
|
|
- qu.setActualScore(right ? qu.getScore() : pathScore);
|
|
|
+ qu.setActualScore(score);
|
|
|
|
|
|
// 回写内部使用
|
|
|
reqDTO.setIsRight(right);
|
|
@@ -675,11 +692,11 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, Paper> implements
|
|
|
|
|
|
for (PaperQuAnswerExtDTO item : fullList) {
|
|
|
if (fill) {
|
|
|
- rightMap.add(item.getContent());
|
|
|
+ rightMap.add(item.getContent().trim());
|
|
|
continue;
|
|
|
}
|
|
|
if (item.getIsRight()) {
|
|
|
- rightMap.add(item.getAnswerId());
|
|
|
+ rightMap.add(item.getAnswerId().trim());
|
|
|
}
|
|
|
}
|
|
|
return rightMap;
|