1
0
yin vor 10 Monaten
Ursprung
Commit
1c4b81a7f1

+ 19 - 9
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/mark/service/Impl/MarkServiceImpl.java

@@ -1112,8 +1112,11 @@ public class MarkServiceImpl implements MarkService {
             Collections.sort(partScoreList);
             if (policy == null || ScorePolicy.MAX.equals(policy)) {
                 Collections.reverse(partScoreList);
-            } else if (ScorePolicy.MIN_WITHOUT_ZERO.equals(policy)) {
-                partScoreList = partScoreList.stream().filter(s -> s.doubleValue() > 0).collect(Collectors.toList());
+            }  if (ScorePolicy.MIN_WITHOUT_ZERO.equals(policy)) {
+                while(partScoreList.size()>selectiveCount && partScoreList.get(0)==0){
+                    partScoreList.remove(0);
+                }
+//                partScoreList = partScoreList.stream().filter(s -> s.doubleValue() > 0).collect(Collectors.toList());
             }
             // 计算一个选做题分组得分
             for (int i = 0; i < partScoreList.size(); i++) {
@@ -1157,13 +1160,20 @@ public class MarkServiceImpl implements MarkService {
             }
         }
         // 更新考生多选做少选做
-        SelectiveStudent selectiveStudent = new SelectiveStudent();
-        selectiveStudent.setExamId(examId);
-        selectiveStudent.setSubjectCode(subjectCode);
-        selectiveStudent.setStudentId(studentId);
-        selectiveStudent.setLessSelective(lessSelective);
-        selectiveStudent.setMutiSelective(mutiSelective);
-        selectiveStudent.setNotSelective(notSelective);
+        SelectiveStudent selectiveStudent = selectiveStudentDao.findOne(studentId);
+        if(selectiveStudent == null){
+            selectiveStudent = new SelectiveStudent();
+            selectiveStudent.setExamId(examId);
+            selectiveStudent.setSubjectCode(subjectCode);
+            selectiveStudent.setStudentId(studentId);
+            selectiveStudent.setLessSelective(lessSelective);
+            selectiveStudent.setMutiSelective(mutiSelective);
+            selectiveStudent.setNotSelective(notSelective);
+        }else{
+            selectiveStudent.setLessSelective(selectiveStudent.getLessSelective()?selectiveStudent.getLessSelective():lessSelective);
+            selectiveStudent.setMutiSelective(selectiveStudent.getMutiSelective()?selectiveStudent.getMutiSelective():mutiSelective);
+            selectiveStudent.setNotSelective(selectiveStudent.getNotSelective()?selectiveStudent.getNotSelective():notSelective);
+        }
         selectiveStudentDao.saveAndFlush(selectiveStudent);
         // 计算非选做题总分
         for (Integer mainNumber : scoreMap.keySet()) {