Sfoglia il codice sorgente

新增小题仲裁

yin 1 anno fa
parent
commit
af2bcbc965

+ 2 - 0
install/mysql/upgrade/1.5.0.sql

@@ -6,3 +6,5 @@ VALUES (4, 'STUDENT_SHEET_COUNT', null, '2021-08-09 15:38:58');
 ALTER TABLE eb_mark_group ADD COLUMN `arbitrate_type`      varchar(16)  DEFAULT NULL COMMENT '仲裁方式';
 ALTER TABLE eb_exam_question ADD COLUMN `arbitrate_threshold` double    DEFAULT NULL COMMENT '仲裁阈值';
 ALTER TABLE m_arbitrate_history ADD COLUMN `question_index` text        DEFAULT NULL COMMENT '题目序号';
+
+update eb_mark_group set arbitrate_type='GROUP' where double_rate is not null and double_rate>0;

+ 7 - 6
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/dao/ExamQuestionDao.java

@@ -1,6 +1,7 @@
 package cn.com.qmth.stmms.biz.exam.dao;
 
-import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
+import java.util.List;
+import java.util.Set;
 
 import org.springframework.data.domain.Sort;
 import org.springframework.data.jpa.repository.JpaRepository;
@@ -8,8 +9,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 
-import java.util.List;
-import java.util.Set;
+import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
 
 public interface ExamQuestionDao extends JpaRepository<ExamQuestion, Integer>, JpaSpecificationExecutor<ExamQuestion> {
 
@@ -18,7 +18,8 @@ public interface ExamQuestionDao extends JpaRepository<ExamQuestion, Integer>, J
     public List<ExamQuestion> findByExamIdAndSubjectCodeAndObjective(Integer examId, String subjectCode,
             boolean objective);
 
-    // @Query("select q from ExamQuestion q where q.examId=?1 and q.subjectCode=?2 and q.objective=?3 "
+    // @Query("select q from ExamQuestion q where q.examId=?1 and q.subjectCode=?2
+    // and q.objective=?3 "
     // +
     // " group by q.mainNumber, q.subNumber order by q.mainNumber, q.subNumber")
     // public List<ExamQuestion>
@@ -95,7 +96,7 @@ public interface ExamQuestionDao extends JpaRepository<ExamQuestion, Integer>, J
     public Double sumTotalScore(int examId, String subjectCode, boolean objective);
 
     @Modifying
-    @Query("update ExamQuestion q set q.groupNumber = null"
+    @Query("update ExamQuestion q set q.groupNumber = null, q.arbitrateThreshold = null "
             + " where q.examId=?1 and q.subjectCode=?2 and q.objective=?3 and q.groupNumber=?4")
     public void resetByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(Integer examId, String subjectCode,
             boolean objective, Integer number);
@@ -112,6 +113,6 @@ public interface ExamQuestionDao extends JpaRepository<ExamQuestion, Integer>, J
 
     @Modifying
     @Query("update ExamQuestion q set q.mainTitle = ?2,q.name=?3 where q.id=?1 ")
-	public void updateMainTitle(Integer id, String mainTitle, String name);
+    public void updateMainTitle(Integer id, String mainTitle, String name);
 
 }

+ 10 - 5
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/exam/dao/MarkGroupDao.java

@@ -1,15 +1,16 @@
 package cn.com.qmth.stmms.biz.exam.dao;
 
-import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
-import cn.com.qmth.stmms.biz.exam.model.MarkGroupPK;
-import cn.com.qmth.stmms.common.enums.*;
+import java.util.Date;
+import java.util.List;
+
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
 import org.springframework.data.jpa.repository.Query;
 import org.springframework.data.repository.PagingAndSortingRepository;
 
-import java.util.Date;
-import java.util.List;
+import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
+import cn.com.qmth.stmms.biz.exam.model.MarkGroupPK;
+import cn.com.qmth.stmms.common.enums.*;
 
 public interface MarkGroupDao
         extends PagingAndSortingRepository<MarkGroup, MarkGroupPK>, JpaSpecificationExecutor<MarkGroup> {
@@ -83,6 +84,10 @@ public interface MarkGroupDao
     @Query("update MarkGroup g set g.scorePolicy=?4 where g.pk.examId=?1 and g.pk.subjectCode=?2 and g.pk.number=?3")
     void updateScorePolicy(Integer examId, String subjectCode, Integer number, ScorePolicy policy);
 
+    @Modifying(clearAutomatically = true)
+    @Query("update MarkGroup g set g.arbitrateType=?4 where g.pk.examId=?1 and g.pk.subjectCode=?2 and g.pk.number=?3")
+    void updateArbitrateType(Integer examId, String subjectCode, Integer number, ArbitrateType arbitrateType);
+
     @Modifying(clearAutomatically = true)
     @Query("update MarkGroup g set g.buildTime=?4 where g.pk.examId=?1 and g.pk.subjectCode=?2 and g.pk.number=?3")
     void updateBuildTime(Integer examId, String subjectCode, Integer number, Date time);

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

@@ -2,13 +2,7 @@ package cn.com.qmth.stmms.biz.mark.service.Impl;
 
 import java.math.BigDecimal;
 import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -20,64 +14,19 @@ import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import cn.com.qmth.stmms.biz.exam.dao.MarkGroupDao;
-import cn.com.qmth.stmms.biz.exam.dao.MarkGroupStudentDao;
-import cn.com.qmth.stmms.biz.exam.dao.MarkerDao;
-import cn.com.qmth.stmms.biz.exam.dao.SelectiveStudentDao;
-import cn.com.qmth.stmms.biz.exam.dao.SubjectiveScoreDao;
-import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
-import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
-import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
-import cn.com.qmth.stmms.biz.exam.model.MarkGroupStudent;
-import cn.com.qmth.stmms.biz.exam.model.Marker;
-import cn.com.qmth.stmms.biz.exam.model.SelectiveGroup;
-import cn.com.qmth.stmms.biz.exam.model.SelectiveStudent;
-import cn.com.qmth.stmms.biz.exam.model.SubjectiveScore;
-import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
-import cn.com.qmth.stmms.biz.exam.service.ExamService;
-import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
-import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
-import cn.com.qmth.stmms.biz.exam.service.InspectHistoryService;
-import cn.com.qmth.stmms.biz.exam.service.InspectedService;
-import cn.com.qmth.stmms.biz.exam.service.MarkerService;
-import cn.com.qmth.stmms.biz.exam.service.SelectiveGroupService;
-import cn.com.qmth.stmms.biz.exam.service.SubjectiveScoreService;
+import cn.com.qmth.stmms.biz.exam.dao.*;
+import cn.com.qmth.stmms.biz.exam.model.*;
+import cn.com.qmth.stmms.biz.exam.service.*;
 import cn.com.qmth.stmms.biz.lock.LockService;
-import cn.com.qmth.stmms.biz.mark.dao.ArbitrateHistoryDao;
-import cn.com.qmth.stmms.biz.mark.dao.HeaderTagDao;
-import cn.com.qmth.stmms.biz.mark.dao.HeaderTrackDao;
-import cn.com.qmth.stmms.biz.mark.dao.MarkLibraryDao;
-import cn.com.qmth.stmms.biz.mark.dao.MarkSpecialTagDao;
-import cn.com.qmth.stmms.biz.mark.dao.MarkTrackDao;
-import cn.com.qmth.stmms.biz.mark.dao.ProblemHistoryDao;
-import cn.com.qmth.stmms.biz.mark.dao.RejectHistoryDao;
-import cn.com.qmth.stmms.biz.mark.dao.TrialLibraryDao;
-import cn.com.qmth.stmms.biz.mark.dao.TrialTagDao;
-import cn.com.qmth.stmms.biz.mark.dao.TrialTrackDao;
-import cn.com.qmth.stmms.biz.mark.model.ArbitrateHistory;
-import cn.com.qmth.stmms.biz.mark.model.HeaderTrack;
-import cn.com.qmth.stmms.biz.mark.model.MarkLibrary;
-import cn.com.qmth.stmms.biz.mark.model.MarkResult;
-import cn.com.qmth.stmms.biz.mark.model.MarkStepDTO;
-import cn.com.qmth.stmms.biz.mark.model.MarkTrack;
-import cn.com.qmth.stmms.biz.mark.model.ProblemHistory;
-import cn.com.qmth.stmms.biz.mark.model.RejectHistory;
-import cn.com.qmth.stmms.biz.mark.model.SubmitResult;
-import cn.com.qmth.stmms.biz.mark.model.TrialLibrary;
+import cn.com.qmth.stmms.biz.mark.dao.*;
+import cn.com.qmth.stmms.biz.mark.model.*;
 import cn.com.qmth.stmms.biz.mark.query.MarkLibrarySearchQuery;
 import cn.com.qmth.stmms.biz.mark.service.MarkService;
 import cn.com.qmth.stmms.biz.report.service.ReportSubjectService;
 import cn.com.qmth.stmms.biz.utils.ScoreItem;
 import cn.com.qmth.stmms.biz.utils.TaskLock;
 import cn.com.qmth.stmms.biz.utils.TaskLockUtil;
-import cn.com.qmth.stmms.common.enums.HistoryStatus;
-import cn.com.qmth.stmms.common.enums.LibraryStatus;
-import cn.com.qmth.stmms.common.enums.LockType;
-import cn.com.qmth.stmms.common.enums.MarkStatus;
-import cn.com.qmth.stmms.common.enums.ObjectiveStatus;
-import cn.com.qmth.stmms.common.enums.ScorePolicy;
-import cn.com.qmth.stmms.common.enums.SubjectiveStatus;
-import cn.com.qmth.stmms.common.enums.ThirdPolicy;
+import cn.com.qmth.stmms.common.enums.*;
 import cn.com.qmth.stmms.common.utils.BigDecimalUtils;
 
 /**
@@ -240,8 +189,8 @@ public class MarkServiceImpl implements MarkService {
             if (group.getStatus() == MarkStatus.TRIAL) {
                 return trialLibraryDao.countByMarkerId(marker.getId());
             } else {
-                return libraryDao.countByMarkerAndStatus(marker.getId(), LibraryStatus.MARKED,
-                        LibraryStatus.ARBITRATED, LibraryStatus.INSPECTED);
+                return libraryDao.countByMarkerAndStatus(marker.getId(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED,
+                        LibraryStatus.INSPECTED);
             }
         }
         return 0;
@@ -305,8 +254,8 @@ public class MarkServiceImpl implements MarkService {
         markerDao.deleteByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(), group.getSubjectCode(),
                 group.getNumber());
         // 小题数据
-        questionService.resetByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(group.getExamId(),
-                group.getSubjectCode(), false, group.getNumber());
+        questionService.resetByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(group.getExamId(), group.getSubjectCode(),
+                false, group.getNumber());
         // 考生分组状态与得分明细
         groupStudentDao.deleteByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(), group.getSubjectCode(),
                 group.getNumber());
@@ -345,12 +294,13 @@ public class MarkServiceImpl implements MarkService {
      */
     @Override
     @Transactional
-    public void updateGroup(MarkGroup group, List<ExamQuestion> questionList, ScorePolicy policy, ThirdPolicy third,
-            boolean selective) {
+    public void updateGroup(MarkGroup group, List<ExamQuestion> questionList, ScorePolicy policy,
+            ArbitrateType arbitrateType, ThirdPolicy third, boolean selective) {
         List<ExamQuestion> old = questionService.findByExamAndSubjectAndObjectiveAndGroupNumber(group.getExamId(),
                 group.getSubjectCode(), false, group.getNumber());
         for (ExamQuestion question : old) {
             question.setGroupNumber(null);
+            question.setArbitrateThreshold(null);
             questionService.saveAndFlush(question);
         }
         BigDecimal totalScore = BigDecimal.ZERO;
@@ -362,6 +312,7 @@ public class MarkServiceImpl implements MarkService {
         groupDao.updateTotalScore(group.getExamId(), group.getSubjectCode(), group.getNumber(),
                 totalScore.doubleValue());
         groupDao.updateScorePolicy(group.getExamId(), group.getSubjectCode(), group.getNumber(), policy);
+        groupDao.updateArbitrateType(group.getExamId(), group.getSubjectCode(), group.getNumber(), arbitrateType);
         groupDao.updateThirdPolicy(group.getExamId(), group.getSubjectCode(), group.getNumber(), third);
         groupDao.updateSelective(group.getExamId(), group.getSubjectCode(), group.getNumber(), selective);
 
@@ -538,7 +489,8 @@ public class MarkServiceImpl implements MarkService {
         }
         updateMarkedCount(group);
         releaseByMarker(marker);
-//        inspectHistoryService.deleteByExamIdAndSubjectCode(marker.getExamId(), marker.getSubjectCode());
+        // inspectHistoryService.deleteByExamIdAndSubjectCode(marker.getExamId(),
+        // marker.getSubjectCode());
     }
 
     /**
@@ -703,8 +655,8 @@ public class MarkServiceImpl implements MarkService {
             return false;
         }
         // 是否多评情况下已处理过该考生评卷任务
-        if (libraryDao
-                .countByStudentIdAndMarkerIdAndIdNotEqual(library.getStudentId(), marker.getId(), library.getId()) > 0) {
+        if (libraryDao.countByStudentIdAndMarkerIdAndIdNotEqual(library.getStudentId(), marker.getId(),
+                library.getId()) > 0) {
             return false;
         }
         // 未选做
@@ -761,7 +713,8 @@ public class MarkServiceImpl implements MarkService {
                 }
                 // 其中一个有分另一个未选做 直接进入仲裁
                 if ((other.getMarkerScore() != UN_SELECTIVE_SCORE && result.getMarkerScore() == UN_SELECTIVE_SCORE)
-                        || (other.getMarkerScore() == UN_SELECTIVE_SCORE && result.getMarkerScore() != UN_SELECTIVE_SCORE)) {
+                        || (other.getMarkerScore() == UN_SELECTIVE_SCORE
+                                && result.getMarkerScore() != UN_SELECTIVE_SCORE)) {
                     history = buildArbitrateHistory(library, now);
                     break;
                 }
@@ -769,12 +722,13 @@ public class MarkServiceImpl implements MarkService {
                 if (Math.abs(other.getMarkerScore() - result.getMarkerScore()) > group.getArbitrateThreshold()) {
                     // 开启三评
                     if (group.getThirdPolicy().equals(ThirdPolicy.LOW_DIFF_HIGH_AVG)) {
-                        if (libraryDao.countByStudentIdAndGroupNumber(library.getStudentId(), library.getGroupNumber()) == 2) {
+                        if (libraryDao.countByStudentIdAndGroupNumber(library.getStudentId(),
+                                library.getGroupNumber()) == 2) {
                             buildThirdLibrary(library, group);
                         } else {
                             // 两两比较,触发仲裁
-                            List<MarkLibrary> libraries = libraryDao.findByStudentIdAndGroupNumber(
-                                    library.getStudentId(), library.getGroupNumber());
+                            List<MarkLibrary> libraries = libraryDao
+                                    .findByStudentIdAndGroupNumber(library.getStudentId(), library.getGroupNumber());
                             history = buildArbitrateHistory(libraries, group.getArbitrateThreshold(), now);
                         }
                     } else {
@@ -869,8 +823,9 @@ public class MarkServiceImpl implements MarkService {
         history.setUserId(userId);
         history.setReason(reason);
         Date now = new Date();
-        if (libraryDao.resetById(library.getId(), null, reason, userId, now, isRest ? LibraryStatus.WAITING
-                : LibraryStatus.REJECTED, LibraryStatus.MARKED, LibraryStatus.PROBLEM, LibraryStatus.INSPECTED) > 0) {
+        if (libraryDao.resetById(library.getId(), null, reason, userId, now,
+                isRest ? LibraryStatus.WAITING : LibraryStatus.REJECTED, LibraryStatus.MARKED, LibraryStatus.PROBLEM,
+                LibraryStatus.INSPECTED) > 0) {
             if (!isRest) {
                 markerService.updateRejectCountById(library.getMarkerId());
                 rejectHistoryDao.save(history);
@@ -1173,8 +1128,8 @@ public class MarkServiceImpl implements MarkService {
                 // 有非完成状态的评卷任务,直接返回
                 return false;
             }
-            double markerScore = library.getStatus() == LibraryStatus.ARBITRATED ? library.getHeaderScore() : library
-                    .getMarkerScore();
+            double markerScore = library.getStatus() == LibraryStatus.ARBITRATED ? library.getHeaderScore()
+                    : library.getMarkerScore();
             if (markerScore == UN_SELECTIVE_SCORE) {
                 selectiveAll = true;
             }
@@ -1194,12 +1149,12 @@ public class MarkServiceImpl implements MarkService {
                 }
                 return -1;
             });
-            Double score1 = list.get(0).getHeaderScore() != null ? list.get(0).getHeaderScore() : list.get(0)
-                    .getMarkerScore();
-            Double score2 = list.get(1).getHeaderScore() != null ? list.get(1).getHeaderScore() : list.get(1)
-                    .getMarkerScore();
-            Double score3 = list.get(2).getHeaderScore() != null ? list.get(2).getHeaderScore() : list.get(2)
-                    .getMarkerScore();
+            Double score1 = list.get(0).getHeaderScore() != null ? list.get(0).getHeaderScore()
+                    : list.get(0).getMarkerScore();
+            Double score2 = list.get(1).getHeaderScore() != null ? list.get(1).getHeaderScore()
+                    : list.get(1).getMarkerScore();
+            Double score3 = list.get(2).getHeaderScore() != null ? list.get(2).getHeaderScore()
+                    : list.get(2).getMarkerScore();
             if ((score3 - score2) <= (score2 - score1)) {
                 list.remove(0);
             } else {
@@ -1278,9 +1233,10 @@ public class MarkServiceImpl implements MarkService {
     @Transactional
     public void updateMarkedCount(MarkGroup group) {
         if (group.getStatus() == MarkStatus.FORMAL || group.getStatus() == MarkStatus.FINISH) {
-            groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(), (int) libraryDao
-                    .countByExamIdAndSubjectCodeAndGroupNumberAndStatus(group.getExamId(), group.getSubjectCode(),
-                            group.getNumber(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED, LibraryStatus.INSPECTED));
+            groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
+                    (int) libraryDao.countByExamIdAndSubjectCodeAndGroupNumberAndStatus(group.getExamId(),
+                            group.getSubjectCode(), group.getNumber(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED,
+                            LibraryStatus.INSPECTED));
         } else if (group.getStatus() == MarkStatus.TRIAL) {
             groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
                     (int) trialLibraryDao.countMarked(group.getExamId(), group.getSubjectCode(), group.getNumber()));
@@ -1334,7 +1290,7 @@ public class MarkServiceImpl implements MarkService {
     private String getGroupKey(Marker marker) {
         return marker.getExamId() + "_" + marker.getSubjectCode() + "_" + marker.getGroupNumber();
     }
-    
+
     private String getGroupKey(MarkLibrary library) {
         return library.getExamId() + "_" + library.getSubjectCode() + "_" + library.getGroupNumber();
     }
@@ -1399,8 +1355,9 @@ public class MarkServiceImpl implements MarkService {
             if (library.getStatus() == LibraryStatus.MARKED || library.getStatus() == LibraryStatus.INSPECTED) {
                 validCount++;
             }
-            double score = library.getMarkerScore() != null && library.getMarkerScore() != UN_SELECTIVE_SCORE ? library
-                    .getMarkerScore() : 0;
+            double score = library.getMarkerScore() != null && library.getMarkerScore() != UN_SELECTIVE_SCORE
+                    ? library.getMarkerScore()
+                    : 0;
             int spent = library.getMarkerSpent() != null ? library.getMarkerSpent() : 0;
 
             sumScore += score;
@@ -1690,8 +1647,8 @@ public class MarkServiceImpl implements MarkService {
                         || library.getStatus().equals(LibraryStatus.INSPECTED)) {
                     List<ScoreItem> sList = library.getMarkerScoreItem();
                     for (MarkStepDTO markStepDTO : qList) {
-                        trackDao.deleteByLibraryIdAndQuestionNumber(library.getId(), markStepDTO.getMainNumber() + "."
-                                + markStepDTO.getSubNumber());
+                        trackDao.deleteByLibraryIdAndQuestionNumber(library.getId(),
+                                markStepDTO.getMainNumber() + "." + markStepDTO.getSubNumber());
                         scoreDao.updateRejected(library.getStudentId(), markStepDTO.getMainNumber(),
                                 markStepDTO.getSubNumber(), true);
                         for (int i = 0; i < questions.size(); i++) {
@@ -1807,8 +1764,8 @@ public class MarkServiceImpl implements MarkService {
         Date now = new Date();
         List<ScoreItem> sList = library.getMarkerScoreItem();
         for (MarkStepDTO markStepDTO : questionList) {
-            trackDao.deleteByLibraryIdAndQuestionNumber(library.getId(), markStepDTO.getMainNumber() + "."
-                    + markStepDTO.getSubNumber());
+            trackDao.deleteByLibraryIdAndQuestionNumber(library.getId(),
+                    markStepDTO.getMainNumber() + "." + markStepDTO.getSubNumber());
             scoreDao.updateRejected(library.getStudentId(), markStepDTO.getMainNumber(), markStepDTO.getSubNumber(),
                     true);
             for (int i = 0; i < questions.size(); i++) {
@@ -1871,10 +1828,10 @@ public class MarkServiceImpl implements MarkService {
         reportSubjectService.deleteByExamIdAndSubjectCode(examId, subjectCode);
     }
 
-	@Override
-	public void releaseByLibrary(MarkLibrary library) {
-		TaskLock taskLock = TaskLockUtil.getFormalTask(getGroupKey(library));
-        taskLock.remove(library.getStudentId(), library.getTaskNumber(),library.getMarkerId());
+    @Override
+    public void releaseByLibrary(MarkLibrary library) {
+        TaskLock taskLock = TaskLockUtil.getFormalTask(getGroupKey(library));
+        taskLock.remove(library.getStudentId(), library.getTaskNumber(), library.getMarkerId());
         taskLock.refresh(library.getMarkerId());
-	}
+    }
 }

+ 7 - 6
stmms-biz/src/main/java/cn/com/qmth/stmms/biz/mark/service/MarkService.java

@@ -1,18 +1,19 @@
 package cn.com.qmth.stmms.biz.mark.service;
 
+import java.util.List;
+
 import cn.com.qmth.stmms.biz.exam.model.ExamQuestion;
 import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
 import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
 import cn.com.qmth.stmms.biz.exam.model.Marker;
 import cn.com.qmth.stmms.biz.mark.model.*;
+import cn.com.qmth.stmms.common.enums.ArbitrateType;
 import cn.com.qmth.stmms.common.enums.ScorePolicy;
 import cn.com.qmth.stmms.common.enums.ThirdPolicy;
 
-import java.util.List;
-
 public interface MarkService {
-	
-	void releaseByLibrary(MarkLibrary library);
+
+    void releaseByLibrary(MarkLibrary library);
 
     /**
      * 释放某个评卷员已完成的评卷任务
@@ -49,8 +50,8 @@ public interface MarkService {
      * @param group
      * @param third
      */
-    void updateGroup(MarkGroup group, List<ExamQuestion> questionList, ScorePolicy policy, ThirdPolicy third,
-            boolean selective);
+    void updateGroup(MarkGroup group, List<ExamQuestion> questionList, ScorePolicy policy, ArbitrateType arbitrateType,
+            ThirdPolicy third, boolean selective);
 
     /**
      * 评卷员申请领取某个正式评卷任务

+ 34 - 6
stmms-web/src/main/java/cn/com/qmth/stmms/admin/exam/MarkGroupController.java

@@ -305,6 +305,7 @@ public class MarkGroupController extends BaseExamController {
         model.addAttribute("subject", subject);
         model.addAttribute("markModeList", MarkMode.values());
         model.addAttribute("scorePolicyList", ScorePolicy.values());
+        model.addAttribute("arbitrateTypeList", ArbitrateType.values());
         model.addAttribute("thirdPolicyList", ThirdPolicy.values());
         model.addAttribute("exam", examService.findById(examId));
         List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjective(examId, subjectCode, false);
@@ -386,6 +387,7 @@ public class MarkGroupController extends BaseExamController {
             model.addAttribute("pictureConfig", group.getPicList());
             model.addAttribute("markModeList", MarkMode.values());
             model.addAttribute("scorePolicyList", ScorePolicy.values());
+            model.addAttribute("arbitrateTypeList", ArbitrateType.values());
             model.addAttribute("thirdPolicyList", ThirdPolicy.values());
             model.addAttribute("subject", subjectService.find(examId, subjectCode));
             model.addAttribute("exam", examService.findById(examId));
@@ -457,11 +459,13 @@ public class MarkGroupController extends BaseExamController {
             @RequestParam(required = false) String picList, @RequestParam(required = false) Double doubleRate,
             @RequestParam(required = false) Double arbitrateThreshold,
             @RequestParam(required = false) Integer thirdPolicy, @RequestParam(required = false) Integer scorePolicy,
-            @RequestParam(required = false) MarkMode markMode, @RequestParam(required = false) Integer trialCount,
+            @RequestParam(required = false) Integer arbitrateType, @RequestParam(required = false) MarkMode markMode,
+            @RequestParam(required = false) Integer trialCount,
             @RequestParam(required = false, defaultValue = "false") Boolean sheetView,
             @RequestParam(required = false, defaultValue = "false") Boolean enableAllZero,
             @RequestParam(required = false) Integer[] questionIds,
             @RequestParam(required = false) String intervalScoreList,
+            @RequestParam(required = false) String arbitrateThresholdList,
             @RequestParam(required = false) String deleteCode) {
         int examId = getSessionExamId(request);
         Exam exam = examService.findById(examId);
@@ -486,9 +490,20 @@ public class MarkGroupController extends BaseExamController {
                         return "redirect:/admin/exam/group/edit-simple";
                     }
                     List<ExamQuestion> questionList = new ArrayList<ExamQuestion>();
+                    ArbitrateType at = arbitrateType != null ? ArbitrateType.findByValue(arbitrateType)
+                            : ArbitrateType.GROUP;
+                    if (ArbitrateType.QUESTION.equals(at)) {
+                        arbitrateThreshold = null;
+                    }
+                    List<Double> arbitrateThresholds = buildDoubleList(arbitrateThresholdList);
                     boolean selective = false;
-                    for (Integer questionId : questionIds) {
-                        ExamQuestion question = questionService.findById(questionId);
+                    for (int i = 0; i < questionIds.length; i++) {
+                        ExamQuestion question = questionService.findById(questionIds[i]);
+                        if (ArbitrateType.QUESTION.equals(at)) {
+                            question.setArbitrateThreshold(arbitrateThresholds.get(i));
+                        } else {
+                            question.setArbitrateThreshold(null);
+                        }
                         questionList.add(question);
                         if (selective == false && selectiveGroupService.findOne(examId, subjectCode,
                                 question.getMainNumber()) != null) {
@@ -502,7 +517,7 @@ public class MarkGroupController extends BaseExamController {
                         try {
                             lockService.waitlock(LockType.GROUP, true, group.getExamId(), group.getSubjectCode(),
                                     group.getNumber());
-                            markService.updateGroup(group, questionList, policy, third, selective);
+                            markService.updateGroup(group, questionList, policy, at, third, selective);
                         } catch (Exception e) {
                             log.error("update group error", e);
                             throw new RuntimeException("重置更新大题失败", e);
@@ -514,12 +529,18 @@ public class MarkGroupController extends BaseExamController {
                 } else {
                     // simple update
                     List<Double> intervalScores = buildDoubleList(intervalScoreList);
+                    List<Double> arbitrateThresholds = buildDoubleList(arbitrateThresholdList);
                     List<ExamQuestion> questionList = questionService
                             .findByExamAndSubjectAndObjectiveAndGroupNumber(examId, subjectCode, false, number);
                     if (intervalScores.size() == questionList.size()) {
                         for (int i = 0; i < questionList.size(); i++) {
                             ExamQuestion q = questionList.get(i);
                             q.setIntervalScore(intervalScores.get(i));
+                            if (ArbitrateType.QUESTION.equals(group.getArbitrateType())) {
+                                q.setArbitrateThreshold(arbitrateThresholds.get(i));
+                            } else {
+                                q.setArbitrateThreshold(null);
+                            }
                             questionService.save(q);
                         }
                     }
@@ -598,7 +619,6 @@ public class MarkGroupController extends BaseExamController {
     }
 
     @Logging(menu = "新增大题", type = LogType.ADD)
-    @SuppressWarnings("unchecked")
     @RequestMapping("/insert")
     @RoleRequire({ Role.SCHOOL_ADMIN, Role.SUBJECT_HEADER, Role.COLLEGE_ADMIN })
     @Transactional
@@ -607,6 +627,7 @@ public class MarkGroupController extends BaseExamController {
             @RequestParam String picList, @RequestParam(required = false) Double doubleRate,
             @RequestParam(required = false) Double arbitrateThreshold,
             @RequestParam(required = false) Integer thirdPolicy, @RequestParam(required = false) Integer scorePolicy,
+            @RequestParam(required = false) String arbitrateThresholdList,
             @RequestParam(required = false) Integer arbitrateType, @RequestParam(required = false) String markMode,
             @RequestParam(required = false) Integer trialCount,
             @RequestParam(required = false, defaultValue = "false") boolean sheetView,
@@ -640,9 +661,16 @@ public class MarkGroupController extends BaseExamController {
                     List<ExamQuestion> list = new ArrayList<ExamQuestion>();
                     BigDecimal totalScore = BigDecimal.ZERO;
                     boolean selective = false;
-                    for (Integer questionId : questionIds) {
+                    List<Double> arbitrateThresholds = buildDoubleList(arbitrateThresholdList);
+                    for (int i = 0; i < questionIds.length; i++) {
+                        Integer questionId = questionIds[i];
                         ExamQuestion question = questionService.findById(questionId);
                         question.setGroupNumber(number);
+                        if (ArbitrateType.QUESTION.equals(ArbitrateType.findByValue(arbitrateType))) {
+                            question.setArbitrateThreshold(arbitrateThresholds.get(i));
+                        } else {
+                            question.setArbitrateThreshold(null);
+                        }
                         list.add(question);
                         totalScore = totalScore.add(BigDecimal.valueOf(question.getTotalScore()));
                         if (selective == false && selectiveGroupService.findOne(examId, subjectCode,

+ 230 - 149
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/groupAdd.jsp

@@ -33,30 +33,65 @@
                     $("#thirdPolicy").attr("value", "");
                     $("#arbitrateThreshold").attr("value", "");
                     $(".doubleDiv").hide();
+                    $('.arbitrateThreshold-input').each(function () {
+                        $(this).attr("value", "");
+                    });
+                }
+            });
+            $(".arbitrateTypeQuestion").hide();
+            $("#arbitrateType").change(function () {
+                if ($("#arbitrateType").val() == 0) {
+                    $(".arbitrateTypeQuestion").hide();
+                    $(".arbitrateTypeGroup").show();
+                } else {
+                    $(".arbitrateTypeQuestion").show();
+                    $(".arbitrateTypeGroup").hide();
+
+                    var check_list = []
+                    $("input[name='questionIds']:checked").each(function () {
+                        if ($(this).val() != "") {
+                            check_list.push($(this).val())
+                        }
+                    })
+                    $("div[name='arbitrateThreshold-div']").each(function () {
+                        var questionId = $(this).children().eq(0).val();
+                        if (check_list.includes(questionId)) {
+                            $(this).show()
+                        } else {
+                            $(this).hide();
+                        }
+                    })
                 }
             });
             $("#btnNext").click(function () {
-            	var check_list = []
-            	$("input[name='questionIds']:checked").each(function(){
-	            	if($(this).val()!=""){
-	            		check_list.push($(this).val())
-            		}
-            	})
-                if(check_list.length==0) {
+                var check_list = []
+                $("input[name='questionIds']:checked").each(function () {
+                    if ($(this).val() != "") {
+                        check_list.push($(this).val())
+                    }
+                })
+                if (check_list.length == 0) {
                     alert('请选择题目');
                     return false;
                 }
-            	$("#nextDiv").show();
-            	$("#nextLi").attr("class","active");
-            	$("#preDiv").hide();
-            	$("#preLi").attr("class","");
-            	
+                $("#nextDiv").show();
+                $("#nextLi").attr("class", "active");
+                $("#preDiv").hide();
+                $("#preLi").attr("class", "");
+                $("div[name='arbitrateThreshold-div']").each(function () {
+                    var questionId = $(this).children().eq(0).val();
+                    if (check_list.includes(questionId)) {
+                        $(this).show()
+                    } else {
+                        $(this).hide();
+                    }
+                })
             });
-			$("#btnPre").click(function () {
-            	$("#nextDiv").hide();
-				$("#preDiv").show();
-            	$("#nextLi").attr("class","");
-				$("#preLi").attr("class","active");
+            $("#btnPre").click(function () {
+                $("#nextDiv").hide();
+                $("#preDiv").show();
+                $("#nextLi").attr("class", "");
+                $("#preLi").attr("class", "active");
             });
         });
     </script>
@@ -72,162 +107,208 @@
     <tags:message content="${message}"/>
     <form:hidden path="subjectCode"/>
     <input type="hidden" id="questionDetail" name="questionDetail"/>
-<div id="preDiv">
-	<div>
-        <table id="contentTable" class="table table-striped table-bordered table-condensed">
-        <caption><h4>${subject.code }-${subject.name } 主观题<fmt:formatNumber pattern="###.###" value="${subject.subjectiveScore }"/>分</h4></caption>
-        	<thead>
-        	<tr>
-       			 <th>大题号</th>
-        		 <th>小题号</th>
-        		 <th>名称</th>
-        		 <th>分数</th>
-        		 <th>是否选做题</th>
-        		 <th>选做题分组</th>
-				 <th>选做题区</th>
-        		 <th></th>
-			</tr>
-        	</thead>
-			<c:forEach items="${questionList}" var="item">
-		    <tr>
-		    <td>${item.mainNumber }</td>
-		    <td>${item.subNumber }</td>
-			<td>${item.mainTitle }</td>
-			<td><fmt:formatNumber pattern="###.###" value="${item.totalScore}"/></td>
-			<td><c:if test="${item.selective }">选做题</c:if></td>
-			<td>${item.selectiveIndex}</td>
-			<td>${item.selectiveIndex}-${item.selectivePart}</td>
-			<td><input type="checkbox" name="questionIds" value="${item.id }" <c:if test="${item.groupNumber!=null}"> disabled="disabled"</c:if>></td>
-			</tr>
-			</c:forEach>
-		</table>
-	</div>
-    <div class="pull-right">
-        <a href="${ctx}/admin/exam/group?subjectCode=${group.subjectCode}" class="btn">取&nbsp;消</a>&nbsp;&nbsp;
-        <a id="btnNext" href="##" class="btn btn-primary">下一步 </a>
-    </div>
-</div>
-<div id="nextDiv" class ="hide">
-    <div class="control-group">
-        <label class="control-label">分组号</label>
-        <div class="controls">
-            <form:input path="number" type="number" htmlEscape="false" max="100" min="1" class="required digits" value="${group.number }"/>
+    <div id="preDiv">
+        <div>
+            <table id="contentTable" class="table table-striped table-bordered table-condensed">
+                <caption><h4>${subject.code }-${subject.name } 主观题<fmt:formatNumber pattern="###.###"
+                                                                                       value="${subject.subjectiveScore }"/>分</h4>
+                </caption>
+                <thead>
+                <tr>
+                    <th>大题号</th>
+                    <th>小题号</th>
+                    <th>名称</th>
+                    <th>分数</th>
+                    <th>是否选做题</th>
+                    <th>选做题分组</th>
+                    <th>选做题区</th>
+                    <th></th>
+                </tr>
+                </thead>
+                <c:forEach items="${questionList}" var="item">
+                    <tr>
+                        <td>${item.mainNumber }</td>
+                        <td>${item.subNumber }</td>
+                        <td>${item.mainTitle }</td>
+                        <td><fmt:formatNumber pattern="###.###" value="${item.totalScore}"/></td>
+                        <td><c:if test="${item.selective }">选做题</c:if></td>
+                        <td>${item.selectiveIndex}</td>
+                        <td>${item.selectiveIndex}-${item.selectivePart}</td>
+                        <td><input type="checkbox" name="questionIds" value="${item.id }" <c:if
+                                test="${item.groupNumber!=null}"> disabled="disabled"</c:if>></td>
+                    </tr>
+                </c:forEach>
+            </table>
         </div>
-    </div>
-    <c:if test="${groupCount==0 }">
-    <div class="control-group">
-        <label class="control-label">试评数量</label>
-        <div class="controls">
-            <input name="trialCount" htmlEscape="false" min="0" class="digits" type="number" value="0"/>
-            <label>0表示跳过试评</label>
+        <div class="pull-right">
+            <a href="${ctx}/admin/exam/group?subjectCode=${group.subjectCode}" class="btn">取&nbsp;消</a>&nbsp;&nbsp;
+            <a id="btnNext" href="##" class="btn btn-primary">下一步 </a>
         </div>
     </div>
-    </c:if>
-    <c:if test="${exam.type!='MULTI_MEDIA' && exam.markMode!='TRACK'}">
-	    <div class="control-group">
-	        <label class="control-label">评卷模式</label>
-	        <div class="controls">
-	            <select name="markMode">
-	                <option value="">不限</option>
-	                <c:forEach items="${markModeList}" var="item">
-	                    <option value="${item}">${item.name}</option>
-	                </c:forEach>
-	            </select>
-	        </div>
-	    </div>
-    </c:if>
-     <c:if test="${exam.type!='MULTI_MEDIA'}">
+    <div id="nextDiv" class="hide">
         <div class="control-group">
-            <label class="control-label">图片显示</label>
+            <label class="control-label">分组号</label>
             <div class="controls">
-                <a href="${ctx}/admin/exam/group/getPictureConfig?subjectCode=${group.subjectCode}&number=${group.number}"
-                   target="_blank" id="configuration" rel="opener">设置</a>
+                <form:input path="number" type="number" htmlEscape="false" max="100" min="1" class="required digits"
+                            value="${group.number }"/>
             </div>
         </div>
-	</c:if>
-    <form:input path="picList" class="required" id="picList" type="hidden"/>
-    <div class="control-group">
-        <label class="control-label">双评</label>
-        <div class="controls">
-            <input type="checkbox" id="openDouble">开启
-        </div>
-    </div>
-    <div class="doubleDiv">
-        <div class="control-group">
-            <label class="control-label">双评比例</label>
-            <div class="controls">
-                <form:input path="doubleRate" id="doubleRate" htmlEscape="false" maxlength="100" class="required"
-                            type="number"/>*比例范围为0-1
+        <c:if test="${groupCount==0 }">
+            <div class="control-group">
+                <label class="control-label">试评数量</label>
+                <div class="controls">
+                    <input name="trialCount" htmlEscape="false" min="0" class="digits" type="number" value="0"/>
+                    <label>0表示跳过试评</label>
+                </div>
             </div>
-        </div>
-        <div class="control-group">
-            <label class="control-label">仲裁阀值</label>
-            <div class="controls">
-                <form:input path="arbitrateThreshold" id="arbitrateThreshold" htmlEscape="false" maxlength="100"
-                            class="required" type="number"/>*阈值为分数且大于等于0
+        </c:if>
+        <c:if test="${exam.type!='MULTI_MEDIA' && exam.markMode!='TRACK'}">
+            <div class="control-group">
+                <label class="control-label">评卷模式</label>
+                <div class="controls">
+                    <select name="markMode">
+                        <option value="">不限</option>
+                        <c:forEach items="${markModeList}" var="item">
+                            <option value="${item}">${item.name}</option>
+                        </c:forEach>
+                    </select>
+                </div>
             </div>
-        </div>
-        <div class="control-group">
-            <label class="control-label">合分策略</label>
-            <div class="controls">
-                <select name="scorePolicy">
-                    <c:forEach items="${scorePolicyList}" var="item">
-                        <option value="${item.value}">${item.name}</option>
-                    </c:forEach>
-                </select>
+        </c:if>
+        <c:if test="${exam.type!='MULTI_MEDIA'}">
+            <div class="control-group">
+                <label class="control-label">图片显示</label>
+                <div class="controls">
+                    <a href="${ctx}/admin/exam/group/getPictureConfig?subjectCode=${group.subjectCode}&number=${group.number}"
+                       target="_blank" id="configuration" rel="opener">设置</a>
+                </div>
             </div>
-        </div>
+        </c:if>
+        <form:input path="picList" class="required" id="picList" type="hidden"/>
         <div class="control-group">
-            <label class="control-label">三评规则</label>
+            <label class="control-label">双评</label>
             <div class="controls">
-                <select name="thirdPolicy">
-                    <c:forEach items="${thirdPolicyList}" var="item">
-                        <option value="${item.value}">${item.name}</option>
-                    </c:forEach>
-                </select>
+                <input type="checkbox" id="openDouble">开启
             </div>
         </div>
-    </div>
-    <c:if test="${exam.type!='MULTI_MEDIA'}">
-    	<c:if test="${exam.sheetView}">
-        <div class="control-group">
-	        <label class="control-label">原卷显示</label>
-	        <div class="controls">
-	        <input name="sheetView" type="checkbox" <c:if test="${group.sheetView}">checked</c:if>/>
-	        </div>
+        <div class="doubleDiv">
+            <div class="control-group">
+                <label class="control-label">仲裁方式</label>
+                <div class="controls">
+                    <select name="arbitrateType" id="arbitrateType">
+                        <c:forEach items="${arbitrateTypeList}" var="item">
+                            <option value="${item.value}">按${item.name}仲裁</option>
+                        </c:forEach>
+                    </select>
+                </div>
+            </div>
+            <div class="control-group">
+                <label class="control-label">双评比例</label>
+                <div class="controls">
+                    <form:input path="doubleRate" id="doubleRate" htmlEscape="false" maxlength="100" class="required"
+                                type="number"/>*比例范围为0-1
+                </div>
+            </div>
+            <div class="control-group arbitrateTypeGroup">
+                <label class="control-label">仲裁阀值</label>
+                <div class="controls">
+                    <form:input path="arbitrateThreshold" id="arbitrateThreshold" htmlEscape="false" maxlength="100"
+                                class="required" type="number"/>*阈值为分数且大于等于0
+                </div>
+            </div>
+            <div class=" arbitrateTypeQuestion">
+                <input type="hidden" id="arbitrateThresholdList" name="arbitrateThresholdList" value=""/>
+                <c:forEach items="${questionList}" var="question">
+                    <div class="control-group" name="arbitrateThreshold-div">
+                        <input type="hidden" value="${question.id}">
+                        <label class="control-label">${question.mainNumber}-${question.subNumber}仲裁阀值</label>
+                        <div class="controls">
+                            <input type="number" class="required arbitrateThreshold-input" htmlEscape="false"
+                                   maxlength="10"
+                                   value="${question.arbitrateThreshold}"/>*阈值为分数且大于等于0
+                        </div>
+                    </div>
+                </c:forEach>
+            </div>
+            <div class="control-group">
+                <label class="control-label">合分策略</label>
+                <div class="controls">
+                    <select name="scorePolicy">
+                        <c:forEach items="${scorePolicyList}" var="item">
+                            <option value="${item.value}">${item.name}</option>
+                        </c:forEach>
+                    </select>
+                </div>
+            </div>
+            <div class="control-group">
+                <label class="control-label">三评规则</label>
+                <div class="controls">
+                    <select name="thirdPolicy">
+                        <c:forEach items="${thirdPolicyList}" var="item">
+                            <option value="${item.value}">${item.name}</option>
+                        </c:forEach>
+                    </select>
+                </div>
+            </div>
         </div>
-        </c:if>
-        <div class="control-group">
-            <label class="control-label">启用全零分</label>
-            <div class="controls">
-                <input name="enableAllZero" type="checkbox" value="1" <c:if test="${group.enableAllZero}">checked</c:if>/>
+        <c:if test="${exam.type!='MULTI_MEDIA'}">
+            <c:if test="${exam.sheetView}">
+                <div class="control-group">
+                    <label class="control-label">原卷显示</label>
+                    <div class="controls">
+                        <input name="sheetView" type="checkbox" <c:if test="${group.sheetView}">checked</c:if>/>
+                    </div>
+                </div>
+            </c:if>
+            <div class="control-group">
+                <label class="control-label">启用全零分</label>
+                <div class="controls">
+                    <input name="enableAllZero" type="checkbox" value="1"
+                           <c:if test="${group.enableAllZero}">checked</c:if>/>
+                </div>
             </div>
+        </c:if>
+        <div class="form-actions">
+            <a id="btnPre" class="btn">上一步</a>&nbsp;
+            <a id="btnSubmit" href="##" class="btn btn-primary">保 存</a>
         </div>
-    </c:if>    
-    <div class="form-actions">
-        <a id="btnPre" class="btn">上一步</a>&nbsp;
-        <a id="btnSubmit" href="##" class="btn btn-primary">保 存</a>
     </div>
-</div>
 </form:form>
 <script type="text/javascript">
-
     $('#btnSubmit').click(function () {
-    	if($("#arbitrateThreshold").val()<0){
-    		alert("仲裁阈值不能小于0");
-    		return;
-    	}
-    	var check_list = []
-    	$("input[name='questionIds']:checked").each(function(){
-        	if($(this).val()!=""){
-        		check_list.push($(this).val())
-    		}
-    	})
-        if(check_list.length==0) {
+        if ($("#arbitrateThreshold").val() < 0) {
+            alert("仲裁阈值不能小于0");
+            return;
+        }
+        var check_list = []
+        $("input[name='questionIds']:checked").each(function () {
+            if ($(this).val() != "") {
+                check_list.push($(this).val())
+            }
+        })
+        if (check_list.length == 0) {
             alert('请选择题目');
             return false;
         }
-       $('#inputForm').submit();
+        var arbitrateThresholdArray = [];
+        var fill = true;
+        $('.arbitrateThreshold-input').each(function () {
+            if (!$(this).is(":hidden")) {
+                var score = $(this).val();
+                var reg = /^-?\d+\.?\d{0,2}$/;
+                if (score == '' || !reg.test(score) || score <= 0) {
+                    fill = false;
+                } else {
+                    arbitrateThresholdArray.push(score);
+                }
+            }
+        });
+        if (fill) {
+            $('#arbitrateThresholdList').val(arbitrateThresholdArray.join(','));
+            $('#inputForm').submit();
+        } else {
+            alert('按小题仲裁阈值不能为空,必须大于等于0分且只支持两位小数');
+        }
     });
 </script>
 </body>

+ 93 - 7
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/groupEditFull.jsp

@@ -132,6 +132,9 @@
                 $("#thirdPolicy").attr("value", "");
                 $("#arbitrateThreshold").attr("value", "");
                 $(".doubleDiv").hide();
+                $('.arbitrateThreshold-input').each(function () {
+                    $(this).attr("value", "");
+                });
             }
 
             $("#openDouble").change(function () {
@@ -142,9 +145,43 @@
                     $("#thirdPolicy").attr("value", "");
                     $("#arbitrateThreshold").attr("value", "");
                     $(".doubleDiv").hide();
+                    $('.arbitrateThreshold-input').each(function () {
+                        $(this).attr("value", "");
+                    });
+                }
+            });
+            var arbitrateType = "${group.arbitrateType}";
+            if(arbitrateType=='GROUP'){
+                $(".arbitrateTypeQuestion").hide();
+                $(".arbitrateTypeGroup").show();
+            }else{
+                $(".arbitrateTypeQuestion").show();
+                $(".arbitrateTypeGroup").hide();
+            }
+            $("#arbitrateType").change(function () {
+                if ($("#arbitrateType").val() == 0) {
+                    $(".arbitrateTypeQuestion").hide();
+                    $(".arbitrateTypeGroup").show();
+                } else {
+                    $(".arbitrateTypeQuestion").show();
+                    $(".arbitrateTypeGroup").hide();
+
+                    var check_list = []
+                    $("input[name='questionIds']:checked").each(function () {
+                        if ($(this).val() != "") {
+                            check_list.push($(this).val())
+                        }
+                    })
+                    $("div[name='arbitrateThreshold-div']").each(function () {
+                        var questionId = $(this).children().eq(0).val();
+                        if (check_list.includes(questionId)) {
+                            $(this).show()
+                        } else {
+                            $(this).hide();
+                        }
+                    })
                 }
             });
-            
             $("#btnNext").click(function () {
             	var check_list = []
             	$("input[name='questionIds']:checked").each(function(){
@@ -160,7 +197,14 @@
             	$("#nextLi").attr("class","active");
             	$("#preDiv").hide();
             	$("#preLi").attr("class","");
-            	
+                $("div[name='arbitrateThreshold-div']").each(function () {
+                    var questionId = $(this).children().eq(0).val();
+                    if (check_list.includes(questionId)) {
+                        $(this).show()
+                    } else {
+                        $(this).hide();
+                    }
+                })
             });
 			$("#btnPre").click(function () {
             	$("#nextDiv").hide();
@@ -264,6 +308,16 @@
         </div>
     </div>
     <div class="doubleDiv">
+        <div class="control-group">
+            <label class="control-label">仲裁方式</label>
+            <div class="controls">
+                <select name="arbitrateType" id="arbitrateType">
+                    <c:forEach items="${arbitrateTypeList}" var="item">
+                        <option value="${item.value}"  <c:if test="${item.value==group.arbitrateType.value}">selected</c:if>>按${item.name}仲裁</option>
+                    </c:forEach>
+                </select>
+            </div>
+        </div>
         <div class="control-group">
             <label class="control-label">双评比例</label>
             <div class="controls">
@@ -271,13 +325,27 @@
                             id="doubleRate"/>*比例范围为0-1
             </div>
         </div>
-        <div class="control-group">
+        <div class="control-group arbitrateTypeGroup">
             <label class="control-label">仲裁阀值</label>
             <div class="controls">
-                <form:input path="arbitrateThreshold" htmlEscape="false" maxlength="100" class="required" type="number"
-                            id="arbitrateThreshold"/>*阈值为分数且大于等于0
+                <form:input path="arbitrateThreshold" id="arbitrateThreshold" htmlEscape="false" maxlength="100"
+                            class="required" type="number"/>*阈值为分数且大于等于0
             </div>
         </div>
+        <div class=" arbitrateTypeQuestion">
+            <input type="hidden" id="arbitrateThresholdList" name="arbitrateThresholdList" value=""/>
+            <c:forEach items="${questionList}" var="question">
+                <div class="control-group" name="arbitrateThreshold-div">
+                    <input type="hidden" value="${question.id}">
+                    <label class="control-label">${question.mainNumber}-${question.subNumber}仲裁阀值</label>
+                    <div class="controls">
+                        <input type="number" class="required arbitrateThreshold-input" htmlEscape="false"
+                               maxlength="10"
+                               value="${question.arbitrateThreshold}"/>*阈值为分数且大于等于0
+                    </div>
+                </div>
+            </c:forEach>
+        </div>
         <div class="control-group">
             <label class="control-label">合分策略</label>
             <div class="controls">
@@ -398,8 +466,26 @@
     	var deleteCheck = '${deleteCheck}';
     	if(deleteCheck=='false'){
     		deleteDivHide();
-    		$("#inputForm").attr("action","${ctx}/admin/exam/group/update");
-    		$("#inputForm").submit();
+            var arbitrateThresholdArray = [];
+            var fill = true;
+            $('.arbitrateThreshold-input').each(function () {
+                if (!$(this).is(":hidden")) {
+                    var score = $(this).val();
+                    var reg = /^-?\d+\.?\d{0,2}$/;
+                    if (score == '' || !reg.test(score) || score <= 0) {
+                        fill = false;
+                    } else {
+                        arbitrateThresholdArray.push(score);
+                    }
+                }
+            });
+            if (fill) {
+                $('#arbitrateThresholdList').val(arbitrateThresholdArray.join(','));
+                $("#inputForm").attr("action","${ctx}/admin/exam/group/update");
+                $('#inputForm').submit();
+            } else {
+                alert('按小题仲裁阈值不能为空,必须大于等于0分且只支持两位小数');
+            }
     		return;
     	}
     	var subjectCode = '${group.subjectCode}';

+ 86 - 57
stmms-web/src/main/webapp/WEB-INF/views/modules/exam/groupEditSimple.jsp

@@ -65,8 +65,8 @@
     <form:hidden path="doubleRate"/>
     <input type="hidden" id="rest" name="reset" value="false"/>
     <input type="hidden" id="intervalScoreList" name="intervalScoreList" value=""/>
-    
-	<div class="control-group">
+    <input type="hidden" id="arbitrateThresholdList" name="arbitrateThresholdList" value=""/>
+    <div class="control-group">
         <label class="control-label">分组序号</label>
         <div class="controls">
             <form:input path="number" htmlEscape="false" class="required" readonly="true"/>
@@ -78,27 +78,27 @@
             <form:input path="title" htmlEscape="false" class="required" readonly="true"/>
         </div>
     </div>
-   <%--  <c:if test="${group.status.value==1}">
+    <%--  <c:if test="${group.status.value==1}">
+         <div class="control-group">
+             <label class="control-label">试评数量</label>
+             <div class="controls">
+                 <form:input path="trialCount" htmlEscape="false" min="1" class="required digits" type="number"/>
+             </div>
+         </div>
+     </c:if> --%>
+    <c:if test="${exam.type!='MULTI_MEDIA' && exam.markMode!='TRACK'}">
         <div class="control-group">
-            <label class="control-label">试评数量</label>
+            <label class="control-label">评卷模式</label>
             <div class="controls">
-                <form:input path="trialCount" htmlEscape="false" min="1" class="required digits" type="number"/>
+                <select name="markMode">
+                    <option value="">不限</option>
+                    <c:forEach items="${markModeList}" var="item">
+                        <option value="${item}"
+                                <c:if test="${group.markMode!=null && group.markMode==item}">selected</c:if>>${item.name}</option>
+                    </c:forEach>
+                </select>
             </div>
         </div>
-    </c:if> --%>
-    <c:if test="${exam.type!='MULTI_MEDIA' && exam.markMode!='TRACK'}">
-    <div class="control-group">
-        <label class="control-label">评卷模式</label>
-        <div class="controls">
-            <select name="markMode">
-                <option value="">不限</option>
-                <c:forEach items="${markModeList}" var="item">
-                    <option value="${item}"
-                            <c:if test="${group.markMode!=null && group.markMode==item}">selected</c:if>>${item.name}</option>
-                </c:forEach>
-            </select>
-        </div>
-    </div>
     </c:if>
     <c:if test="${exam.type!='MULTI_MEDIA'}">
         <div class="control-group">
@@ -119,47 +119,65 @@
             </div>
         </div>
     </c:forEach>
-<%-- 	<div class="control-group">
-		<label class="control-label">双评</label>
-		<div class="controls"> 
-		<input type="checkbox" id="openDouble">开启
-		</div> 
-	</div> 
-	<div class="doubleDiv">
-	<div class="control-group" >
-		<label class="control-label">双评比例</label>
-		<div class="controls"> 
-			<form:input path="doubleRate" htmlEscape="false" maxlength="100" class="required" type="number" id="doubleRate"/>*比例范围为0-1
-		</div> 
-	</div> --%>
-	<c:if test="${group.doubleRate>0}">
-    <div class="control-group">
-    	<label class="control-label">仲裁阀值</label>
-    	<div class="controls"> 
-			<form:input path="arbitrateThreshold" htmlEscape="false" maxlength="100" class="required" type="number" id="arbitrateThreshold"/>*阈值为分数 
-		</div>
-	</div> 
-	</c:if>
-<!-- 	</div>  -->
-    <c:if test="${exam.type!='MULTI_MEDIA'}">
-   		<c:if test="${exam.sheetView}">
-        <div class="control-group">
-	        <label class="control-label">原卷显示</label>
-	        <div class="controls">
-	        <input name="sheetView" type="checkbox" value="1" <c:if test="${group.sheetView}">checked</c:if>/>
-	        </div>
+    <%-- 	<div class="control-group">
+            <label class="control-label">双评</label>
+            <div class="controls">
+            <input type="checkbox" id="openDouble">开启
+            </div>
         </div>
+        <div class="doubleDiv">
+        <div class="control-group" >
+            <label class="control-label">双评比例</label>
+            <div class="controls">
+                <form:input path="doubleRate" htmlEscape="false" maxlength="100" class="required" type="number" id="doubleRate"/>*比例范围为0-1
+            </div>
+        </div> --%>
+    <c:if test="${group.doubleRate>0}">
+        <c:if test="${group.arbitrateType=='GROUP'}">
+            <div class="control-group">
+                <label class="control-label">仲裁阀值</label>
+                <div class="controls">
+                    <form:input path="arbitrateThreshold" htmlEscape="false" maxlength="100" class="required"
+                                type="number"
+                                id="arbitrateThreshold"/>*阈值为分数
+                </div>
+            </div>
+        </c:if>
+        <c:if test="${group.arbitrateType=='QUESTION'}">
+            <c:forEach items="${questions}" var="question">
+                <div class="control-group" name="arbitrateThreshold-div">
+                    <input type="hidden" value="${question.id}">
+                    <label class="control-label">${question.mainNumber}-${question.subNumber}仲裁阀值</label>
+                    <div class="controls">
+                        <input type="number" class="required arbitrateThreshold-input" htmlEscape="false"
+                               maxlength="10"
+                               value="${question.arbitrateThreshold}"/>*阈值为分数且大于等于0
+                    </div>
+                </div>
+            </c:forEach>
         </c:if>
     </c:if>
-        <div class="control-group">
-            <label class="control-label">启用全零分</label>
-            <div class="controls">
-                <input name="enableAllZero" type="checkbox" value="1" <c:if test="${group.enableAllZero}">checked</c:if>/>
+    <!-- </div> -->
+    <c:if test="${exam.type!='MULTI_MEDIA'}">
+        <c:if test="${exam.sheetView}">
+            <div class="control-group">
+                <label class="control-label">原卷显示</label>
+                <div class="controls">
+                    <input name="sheetView" type="checkbox" value="1" <c:if test="${group.sheetView}">checked</c:if>/>
+                </div>
             </div>
+        </c:if>
+    </c:if>
+    <div class="control-group">
+        <label class="control-label">启用全零分</label>
+        <div class="controls">
+            <input name="enableAllZero" type="checkbox" value="1" <c:if test="${group.enableAllZero}">checked</c:if>/>
         </div>
+    </div>
     <div class="form-actions">
-    	<c:if test="${fnx:hasPrivilegeCode(role_privilege_codes, 'exam_mark-group-reset_edit')}">
-    	<a class="btn" href="${ctx}/admin/exam/group/edit-full?subjectCode=${group.subjectCode}&number=${group.number}">重置修改</a>&nbsp;
+        <c:if test="${fnx:hasPrivilegeCode(role_privilege_codes, 'exam_mark-group-reset_edit')}">
+            <a class="btn"
+               href="${ctx}/admin/exam/group/edit-full?subjectCode=${group.subjectCode}&number=${group.number}">重置修改</a>&nbsp;
         </c:if>
         <a id="btnSubmit" href="##" class="btn btn-primary">保 存</a>
     </div>
@@ -167,21 +185,32 @@
 <script type="text/javascript">
     $('#btnSubmit').click(function () {
         var array = [];
+        var arbitrateThresholdArray = [];
         var fill = true;
         $('.interval-score-input').each(function () {
             var score = $(this).val();
-            var reg= /^-?\d+\.?\d{0,2}$/; 
-            if (score == '' || !reg.test(score) ||score<=0) {
+            var reg = /^-?\d+\.?\d{0,2}$/;
+            if (score == '' || !reg.test(score) || score <= 0) {
                 fill = false;
             } else {
                 array.push(score);
             }
         });
+        $('.arbitrateThreshold-input').each(function () {
+            var score = $(this).val();
+            var reg = /^-?\d+\.?\d{0,2}$/;
+            if (score == '' || !reg.test(score) || score <= 0) {
+                fill = false;
+            } else {
+                arbitrateThresholdArray.push(score);
+            }
+        });
         if (fill) {
             $('#intervalScoreList').val(array.join(','));
+            $('#arbitrateThresholdList').val(arbitrateThresholdArray.join(','));
             $('#inputForm').submit();
         } else {
-        	alert('间隔分不能为空,必须大于等于0分且只支持两位小数');
+            alert('间隔分、仲裁阈值不能为空,必须大于等于0分且只支持两位小数');
         }
     });
 </script>