|
@@ -1,6 +1,8 @@
|
|
|
package cn.com.qmth.stmms.biz.mark.service.Impl;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
+import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -45,6 +47,7 @@ import cn.com.qmth.stmms.common.enums.HistoryStatus;
|
|
|
import cn.com.qmth.stmms.common.enums.LibraryStatus;
|
|
|
import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
|
import cn.com.qmth.stmms.common.enums.ScorePolicy;
|
|
|
+import cn.com.qmth.stmms.common.enums.ThirdPolicy;
|
|
|
|
|
|
/**
|
|
|
* 与评卷相关的所有修改操作(非传播性的新增操作除外),全部汇总到这里进行集中控制
|
|
@@ -235,7 +238,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public void updateGroup(MarkGroup group, List<ExamQuestion> questionList, ScorePolicy policy) {
|
|
|
+ public void updateGroup(MarkGroup group, List<ExamQuestion> questionList, ScorePolicy policy, ThirdPolicy third) {
|
|
|
questionDao.deleteByExamIdAndSubjectCodeAndObjectiveAndGroupNumber(group.getExamId(), group.getSubjectCode(),
|
|
|
false, group.getNumber());
|
|
|
double totalScore = 0d;
|
|
@@ -246,6 +249,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
}
|
|
|
groupDao.updateTotalScore(group.getExamId(), group.getSubjectCode(), group.getNumber(), totalScore);
|
|
|
groupDao.updateScorePolicy(group.getExamId(), group.getSubjectCode(), group.getNumber(), policy);
|
|
|
+ groupDao.updateThirdPolicy(group.getExamId(), group.getSubjectCode(), group.getNumber(), third);
|
|
|
subjectService.updateScore(group.getExamId(), group.getSubjectCode(), false,
|
|
|
sumTotalScore(group.getExamId(), group.getSubjectCode()));
|
|
|
resetGroup(group);
|
|
@@ -507,17 +511,22 @@ public class MarkServiceImpl implements MarkService {
|
|
|
// 本评卷任务或组长已打分,则跳过该任务
|
|
|
continue;
|
|
|
}
|
|
|
+ //分差超过阀值,
|
|
|
if (Math.abs(other.getMarkerScore() - result.getTotalScore()) > group.getArbitrateThreshold()) {
|
|
|
- // 分差超过阀值,触发仲裁
|
|
|
- history = new ArbitrateHistory();
|
|
|
- history.setExamId(library.getExamId());
|
|
|
- history.setSubjectCode(library.getSubjectCode());
|
|
|
- history.setGroupNumber(library.getGroupNumber());
|
|
|
- history.setStudentId(library.getStudentId());
|
|
|
- history.setExamNumber(library.getExamNumber());
|
|
|
- history.setStatus(HistoryStatus.WAITING);
|
|
|
- history.setCreateTime(now);
|
|
|
- break;
|
|
|
+ //开启三评
|
|
|
+ if(group.getThirdPolicy().equals(ThirdPolicy.LOW_DIFF_HIGH_AVG)){
|
|
|
+ if(libraryDao.countByStudentIdAndGroupNumber(library.getStudentId(),
|
|
|
+ library.getGroupNumber())==2){
|
|
|
+ buildThirdLibrary(library,group);
|
|
|
+ }else{
|
|
|
+ //两两比较,触发仲裁
|
|
|
+ history = getArbitrate(list,group.getArbitrateThreshold(), now);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //未开启三评,触发仲裁
|
|
|
+ history = getArbitrate(library, now);
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -531,6 +540,50 @@ public class MarkServiceImpl implements MarkService {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ private ArbitrateHistory getArbitrate(List<MarkLibrary> list,Double arbitrateThreshold, Date now) {
|
|
|
+ int count = 0;
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ int next = i +1;
|
|
|
+ if(next == list.size()){
|
|
|
+ next = 0;
|
|
|
+ }
|
|
|
+ if (Math.abs(list.get(i).getMarkerScore() - list.get(next).getMarkerScore()) > arbitrateThreshold) {
|
|
|
+ count ++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(count == list.size()){
|
|
|
+ return getArbitrate(list.get(0),now);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ArbitrateHistory getArbitrate(MarkLibrary library, Date now) {
|
|
|
+ ArbitrateHistory history;
|
|
|
+ history = new ArbitrateHistory();
|
|
|
+ history.setExamId(library.getExamId());
|
|
|
+ history.setSubjectCode(library.getSubjectCode());
|
|
|
+ history.setGroupNumber(library.getGroupNumber());
|
|
|
+ history.setStudentId(library.getStudentId());
|
|
|
+ history.setExamNumber(library.getExamNumber());
|
|
|
+ history.setStatus(HistoryStatus.WAITING);
|
|
|
+ history.setCreateTime(now);
|
|
|
+ return history;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void buildThirdLibrary(MarkLibrary markLibrary, MarkGroup group) {
|
|
|
+ MarkLibrary library = new MarkLibrary();
|
|
|
+ library.setExamId(markLibrary.getExamId());
|
|
|
+ library.setSubjectCode(markLibrary.getSubjectCode());
|
|
|
+ library.setGroupNumber(group.getNumber());
|
|
|
+ library.setCampusId(markLibrary.getCampusId());
|
|
|
+ library.setStudentId(markLibrary.getStudentId());
|
|
|
+ library.setExamNumber(markLibrary.getExamNumber());
|
|
|
+ library.setTaskNumber(3);
|
|
|
+ library.setStatus(LibraryStatus.WAITING);
|
|
|
+ libraryDao.save(library);
|
|
|
+ updateLibraryCount(group);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 管理员/组长打回某个评卷任务<br>
|
|
|
* 暂时不用到BACKED状态,直接等同于重置该评卷任务
|
|
@@ -636,6 +689,30 @@ public class MarkServiceImpl implements MarkService {
|
|
|
// 有非完成状态的评卷任务,直接返回
|
|
|
return false;
|
|
|
}
|
|
|
+ }
|
|
|
+ // 开启三评
|
|
|
+ if(ThirdPolicy.LOW_DIFF_HIGH_AVG.equals(group.getThirdPolicy()) && list.size()==3){
|
|
|
+// Collections.sort(list, Comparator.comparing(MarkLibrary::getMarkerScore));
|
|
|
+ Collections.sort(list, new Comparator<MarkLibrary>() {
|
|
|
+ @Override
|
|
|
+ public int compare(MarkLibrary o1, MarkLibrary o2) {
|
|
|
+ if (o1.getMarkerScore()-o2.getMarkerScore() > 0) {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ if((score3-score2)>=(score2-score1)){
|
|
|
+ list.remove(0);
|
|
|
+ }else{
|
|
|
+ list.remove(2);
|
|
|
+ }
|
|
|
+ policy = ScorePolicy.AVG;
|
|
|
+ }
|
|
|
+ for (MarkLibrary library : list) {
|
|
|
count++;
|
|
|
Double current = (library.getHeaderScore() != null ? library.getHeaderScore() : library.getMarkerScore());
|
|
|
List<ScoreItem> scores = library.getScoreList();
|