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()); }