场景考试

This commit is contained in:
tiger_zhou 2023-02-10 16:06:14 +08:00
parent 8b491a0233
commit 4dc1fd6b09

View File

@ -23,6 +23,7 @@ import club.joylink.rtss.vo.paper.*;
import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo; import club.joylink.rtss.vo.training2.publish.PublishedTraining2DetailRspVo;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; 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())); // BusinessExceptionAssertEnum.DATA_ERROR.assertTrue(allDetailVOList.size() == answerDetailList.size(),String.format("场景实训[%s] 评分规则与提交的答案数量不陪配",puq.getQuestionId()));
Map<String,PaperTrainAnswerDetail> answerDetailMap = answerDetailList.stream().collect(Collectors.toMap(d->d.getStepId().toString(),Function.identity())); Map<String,PaperTrainAnswerDetail> answerDetailMap = answerDetailList.stream().collect(Collectors.toMap(d->d.getStepId().toString(),Function.identity()));
List<PaperTrainAnswerDetail> resultAnswerDetailList = new ArrayList<>(allDetailVOList.size());
for (ScoringRuleVO.DetailVO detailVO : allDetailVOList) { for (ScoringRuleVO.DetailVO detailVO : allDetailVOList) {
PaperTrainAnswerDetail answerDetail = answerDetailMap.get(detailVO.getElementId()); PaperTrainAnswerDetail answerDetail = answerDetailMap.get(detailVO.getElementId());
@ -172,19 +175,19 @@ public class PaperUserSubmitAnswerService {
}else{ }else{
answerDetail = new PaperTrainAnswerDetail(); answerDetail = new PaperTrainAnswerDetail();
answerDetail.setScore(0F);
answerDetail.setNotExistAppend(true);
answerDetail.setStepId(Long.parseLong(detailVO.getElementId())); 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())){ if(Objects.isNull(d.getScore())){
d.setScore(0F); d.setScore(0F);
d.setNotExistAppend(true); d.setNotExistAppend(true);
} }
}).collect(Collectors.toList()); }).collect(Collectors.toList());*/
req.getTrainAnswerDetail().setTrainDetail(answerDetailList); req.getTrainAnswerDetail().setTrainDetail(resultAnswerDetailList);
return new TrainAnswerVO(PaperQuestionState.SECEN_CUL,req.getTrainAnswerDetail()); return new TrainAnswerVO(PaperQuestionState.SECEN_CUL,req.getTrainAnswerDetail());
} }