|
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
@@ -93,6 +94,8 @@ public class TrialController extends BaseExamController {
|
|
|
@Autowired
|
|
|
private SystemCache systemCache;
|
|
|
|
|
|
+ public static final String UN_SELECTIVE_SCORE = "-1";
|
|
|
+
|
|
|
@Logging(menu = "试评管理查询", type = LogType.QUERY)
|
|
|
@RequestMapping
|
|
|
public String list(Model model, HttpServletRequest request, TrialLibrarySearchQuery query,
|
|
@@ -116,6 +119,9 @@ public class TrialController extends BaseExamController {
|
|
|
Marker marker = markerService.findById(library.getMarkerId());
|
|
|
library.setMarkerLoginName(userService.findById(marker.getUserId()).getLoginName());
|
|
|
}
|
|
|
+ if (library.getMarkerScoreList() != null) {
|
|
|
+ library.setMarkerScoreList(library.getMarkerScoreList().replace(UN_SELECTIVE_SCORE, "/"));
|
|
|
+ }
|
|
|
}
|
|
|
for (MarkGroup group : groupList) {
|
|
|
group.setQuestionList(questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(examId,
|
|
@@ -268,29 +274,43 @@ public class TrialController extends BaseExamController {
|
|
|
vo.setGroupNumber(marker.getGroupNumber());
|
|
|
vo.setGroupTitle(groupTile);
|
|
|
List<TrialLibrary> libraryList = trialService.findLibraryByMarkerId(marker.getId());
|
|
|
- Double avgScore = libraryList.stream().mapToDouble(TrialLibrary::getMarkerScore).average().getAsDouble();
|
|
|
+ Double avgScore = 0d;
|
|
|
+ List<TrialLibrary> markedList= libraryList.stream().filter(s->s.getMarkerScore()!=null).collect(Collectors.toList());
|
|
|
+ vo.setTrialCount(markedList.size());
|
|
|
+ if(!markedList.isEmpty()){
|
|
|
+ avgScore =markedList.stream().mapToDouble(TrialLibrary::getMarkerScore).average()
|
|
|
+ .getAsDouble();
|
|
|
+ }
|
|
|
vo.setAvgScore(avgScore);
|
|
|
- Map<Integer,List<ScoreItem>> map = new HashMap<>();
|
|
|
- for (TrialLibrary library: libraryList) {
|
|
|
+ Map<Integer, List<ScoreItem>> map = new HashMap<>();
|
|
|
+ for (TrialLibrary library : markedList) {
|
|
|
List<ScoreItem> sList = library.getScoreList();
|
|
|
for (int i = 0; i < questionList.size(); i++) {
|
|
|
ExamQuestion question = questionList.get(i);
|
|
|
List<ScoreItem> qsList = map.get(question.getId());
|
|
|
- if(qsList==null){
|
|
|
- qsList =new ArrayList<>();
|
|
|
+ if (qsList == null) {
|
|
|
+ qsList = new ArrayList<>();
|
|
|
}
|
|
|
qsList.add(sList.get(i));
|
|
|
- map.put(question.getId(),qsList);
|
|
|
+ map.put(question.getId(), qsList);
|
|
|
}
|
|
|
}
|
|
|
List<TrialQuestionVO> list = new ArrayList<>();
|
|
|
for (ExamQuestion question : questionList) {
|
|
|
List<ScoreItem> qsList = map.get(question.getId());
|
|
|
- TrialQuestionVO trialQuestionVO =new TrialQuestionVO();
|
|
|
- trialQuestionVO.setAvgScore(qsList.stream().mapToDouble(ScoreItem::getScore).average().getAsDouble());
|
|
|
- trialQuestionVO.setScoreList(StringUtils.join(qsList, ","));
|
|
|
+ TrialQuestionVO trialQuestionVO = new TrialQuestionVO();
|
|
|
+ if (qsList!=null&&!qsList.isEmpty()) {
|
|
|
+ trialQuestionVO.setAvgScore(qsList.stream().filter(s -> s.getScore() >= 0)
|
|
|
+ .mapToDouble(ScoreItem::getScore).average().getAsDouble());
|
|
|
+ String scoreList = StringUtils.join(qsList, ",");
|
|
|
+ if (scoreList != null) {
|
|
|
+ trialQuestionVO.setScoreList(scoreList.replace(UN_SELECTIVE_SCORE, "/"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(trialQuestionVO);
|
|
|
}
|
|
|
vo.setQuestionList(list);
|
|
|
+ markerList.add(vo);
|
|
|
}
|
|
|
}
|
|
|
model.addAttribute("markerList", markerList);
|