|
|
@@ -613,15 +613,28 @@ public class AssessmentTemplatePlanServiceImpl extends MPJBaseServiceImpl<Assess
|
|
|
oneQuestion.setChildren(twoList);
|
|
|
}
|
|
|
List<AssessmentPlanAnswerDetailVo> questionResult = resultMapper.getStudentQuestionResultList(assessmentTemplatePlanId, studentUserId);
|
|
|
- Map<Long, String> answerResultMap = new HashMap<>();
|
|
|
- for (AssessmentPlanAnswerDetailVo countVo : questionResult) {
|
|
|
- answerResultMap.put(countVo.getQuestionId(), countVo.getAnswerId());
|
|
|
- }
|
|
|
+
|
|
|
+ Map<Long, List<AssessmentPlanAnswerDetailVo>> answerResultMap = questionResult.stream().collect(Collectors.groupingBy(AssessmentPlanAnswerDetailVo::getQuestionId));
|
|
|
|
|
|
//循环选项
|
|
|
for (OneQuestionAnswerVo oneQuestion : oneList) {
|
|
|
for (TwoQuestionAnswerVo twoQuestion : oneQuestion.getChildren()) {
|
|
|
- twoQuestion.setResult(answerResultMap.get(twoQuestion.getId()));
|
|
|
+ List<AssessmentPlanAnswerDetailVo> resultList = answerResultMap.get(twoQuestion.getId());
|
|
|
+ if(AssessQuestionTypeEnum.MULTI.getCode().equals(twoQuestion.getType())){
|
|
|
+ String answerStr = "";
|
|
|
+ for(int i = 0; i < resultList.size(); i ++){
|
|
|
+ if(i > 0){
|
|
|
+ answerStr += "\r\n";
|
|
|
+ }
|
|
|
+ answerStr += resultList.get(i).getAnswerId() + "";
|
|
|
+ }
|
|
|
+ twoQuestion.setResult(answerStr);
|
|
|
+ }else if(AssessQuestionTypeEnum.SCALE.getCode().equals(twoQuestion.getType())){
|
|
|
+ twoQuestion.setResult(resultList.get(0).getAnswerId() + "星");
|
|
|
+ }else{
|
|
|
+ List<String> answerList = resultList.stream().map(AssessmentPlanAnswerDetailVo::getAnswerId).collect(Collectors.toList());
|
|
|
+ twoQuestion.setResult(answerList.toString().replace("[", "").replace("]", ""));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
vo.setChildren(oneList);
|
|
|
@@ -654,6 +667,7 @@ public class AssessmentTemplatePlanServiceImpl extends MPJBaseServiceImpl<Assess
|
|
|
List<AssessmentPlanAnswerDetailVo> results = resultMapper.getPlanQuestionResultList(dto.getAssessmentTemplatePlanId());
|
|
|
Map<Long, List<AssessmentPlanAnswerDetailVo>> studentAnswerMaps = results.stream().collect(Collectors.groupingBy(AssessmentPlanAnswerDetailVo::getStudentUserId));
|
|
|
//查询已答题学生
|
|
|
+ dto.setSubmitStatus(1);
|
|
|
List<AssessmentPlanAnswerStudentVo> studentList = this.baseMapper.getAnswerStudentList(dto);
|
|
|
List<List<String>> dataList = new ArrayList<>();
|
|
|
int sortCode = 1;
|
|
|
@@ -683,6 +697,17 @@ public class AssessmentTemplatePlanServiceImpl extends MPJBaseServiceImpl<Assess
|
|
|
rowData.add(answerStr);
|
|
|
}else if(AssessQuestionTypeEnum.SCALE.getCode().equals(question.getType())){
|
|
|
rowData.add(resultList.get(0).getAnswerId() + "星");
|
|
|
+ }else if(AssessQuestionTypeEnum.TEXT.getCode().equals(question.getType())){
|
|
|
+ rowData.add(resultList.get(0).getAnswerId() + "星");
|
|
|
+ }else if(AssessQuestionTypeEnum.JUDGE.getCode().equals(question.getType())){
|
|
|
+ List<String> answerList = resultList.stream().filter(x -> x.getAnswerId() != null)
|
|
|
+ .map(AssessmentPlanAnswerDetailVo::getAnswerId).collect(Collectors.toList());
|
|
|
+ String replace = answerList.toString().replace("[", "").replace("]", "");
|
|
|
+ if("1".equals(replace)){
|
|
|
+ rowData.add("是");
|
|
|
+ }else if("0".equals(replace)){
|
|
|
+ rowData.add("否");
|
|
|
+ }
|
|
|
}else{
|
|
|
List<String> answerList = resultList.stream().map(AssessmentPlanAnswerDetailVo::getAnswerId).collect(Collectors.toList());
|
|
|
rowData.add(answerList.toString().replace("[", "").replace("]", ""));
|