From 4dc1fd6b0983d2495502278d19f50f07c3396189 Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Fri, 10 Feb 2023 16:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E8=80=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../paper/PaperUserSubmitAnswerService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/club/joylink/rtss/services/paper/PaperUserSubmitAnswerService.java b/src/main/java/club/joylink/rtss/services/paper/PaperUserSubmitAnswerService.java index c470d1f4b..1a40271c2 100644 --- a/src/main/java/club/joylink/rtss/services/paper/PaperUserSubmitAnswerService.java +++ b/src/main/java/club/joylink/rtss/services/paper/PaperUserSubmitAnswerService.java @@ -23,6 +23,7 @@ import club.joylink.rtss.vo.paper.*; import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo; import com.google.common.base.Joiner; import com.google.common.base.Strings; +import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -164,6 +165,8 @@ public class PaperUserSubmitAnswerService { // BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(allDetailVOList.size() == answerDetailList.size(),String.format("场景实训[%s] 评分规则与提交的答案数量不陪配",puq.getQuestionId())); Map answerDetailMap = answerDetailList.stream().collect(Collectors.toMap(d->d.getStepId().toString(),Function.identity())); + List resultAnswerDetailList = new ArrayList<>(allDetailVOList.size()); + for (ScoringRuleVO.DetailVO detailVO : allDetailVOList) { PaperTrainAnswerDetail answerDetail = answerDetailMap.get(detailVO.getElementId()); @@ -172,19 +175,19 @@ public class PaperUserSubmitAnswerService { }else{ answerDetail = new PaperTrainAnswerDetail(); + answerDetail.setScore(0F); + answerDetail.setNotExistAppend(true); answerDetail.setStepId(Long.parseLong(detailVO.getElementId())); - answerDetailList.add(answerDetail); } + resultAnswerDetailList.add(answerDetail); } - - - answerDetailList = answerDetailList.stream().peek(d->{ +/* answerDetailList = answerDetailList.stream().peek(d->{ if(Objects.isNull(d.getScore())){ d.setScore(0F); d.setNotExistAppend(true); } - }).collect(Collectors.toList()); - req.getTrainAnswerDetail().setTrainDetail(answerDetailList); + }).collect(Collectors.toList());*/ + req.getTrainAnswerDetail().setTrainDetail(resultAnswerDetailList); return new TrainAnswerVO(PaperQuestionState.SECEN_CUL,req.getTrainAnswerDetail()); }