|
@@ -229,7 +229,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
groupDao.delete(group);
|
|
|
// 科目总分
|
|
|
subjectService.updateScore(group.getExamId(), group.getSubjectCode(), false,
|
|
|
- sumTotalScore(group.getExamId(), group.getSubjectCode()));
|
|
|
+ sumTotalScore(group.getExamId(), group.getSubjectCode()));
|
|
|
} catch (Exception e) {
|
|
|
throw e;
|
|
|
} finally {
|
|
@@ -650,9 +650,9 @@ public class MarkServiceImpl implements MarkService {
|
|
|
double totalScore = 0.0;
|
|
|
// 循环所有大题
|
|
|
for (MarkGroup group : groups) {
|
|
|
- if(group.getStatus().equals(MarkStatus.TRIAL)){
|
|
|
- return ;
|
|
|
- }
|
|
|
+ if (group.getStatus().equals(MarkStatus.TRIAL)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (calculateGroup(group, studentId)) {
|
|
|
totalScore += group.getMarkScore();
|
|
|
scoreList.addAll(group.getMarkScoreDetail());
|
|
@@ -672,8 +672,8 @@ public class MarkServiceImpl implements MarkService {
|
|
|
// 未设置算分策略的情况下,默认取平均分
|
|
|
ScorePolicy policy = group.getScorePolicy() != null ? group.getScorePolicy() : ScorePolicy.AVG;
|
|
|
List<MarkLibrary> list = libraryDao.findByStudentIdAndGroupNumber(studentId, group.getNumber());
|
|
|
- if(list.isEmpty()){
|
|
|
- return false;
|
|
|
+ if (list.isEmpty()) {
|
|
|
+ return false;
|
|
|
}
|
|
|
for (MarkLibrary library : list) {
|
|
|
if (library.getStatus() != LibraryStatus.MARKED && library.getStatus() != LibraryStatus.ARBITRATED) {
|
|
@@ -761,14 +761,14 @@ public class MarkServiceImpl implements MarkService {
|
|
|
public void updateLibraryCount(MarkGroup group) {
|
|
|
if (group.getStatus() == MarkStatus.FORMAL) {
|
|
|
groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
- (int) libraryDao.countByExamIdAndSubjectCodeAndGroupNumberAndStatus(group.getExamId(),
|
|
|
+ (int) libraryDao.countByExamIdAndSubjectCodeAndGroupNumberAndStatus(group.getExamId(),
|
|
|
group.getSubjectCode(), group.getNumber(), LibraryStatus.MARKED, LibraryStatus.ARBITRATED));
|
|
|
} else if (group.getStatus() == MarkStatus.TRIAL) {
|
|
|
groupDao.updateMarkedCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
- (int) trialLibraryDao.countMarked(group.getExamId(), group.getSubjectCode(), group.getNumber()));
|
|
|
+ (int) trialLibraryDao.countMarked(group.getExamId(), group.getSubjectCode(), group.getNumber()));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 更新某个大题评卷任务数量
|
|
|
*
|
|
@@ -778,13 +778,16 @@ public class MarkServiceImpl implements MarkService {
|
|
|
@Transactional
|
|
|
public void updateTotalCount(MarkGroup group) {
|
|
|
if (group.getStatus() == MarkStatus.FORMAL) {
|
|
|
- groupDao.updateLibraryCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
- (int) libraryDao.countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(),
|
|
|
- group.getSubjectCode(), group.getNumber()));
|
|
|
+ group.setLibraryCount((int) libraryDao.countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(),
|
|
|
+ group.getSubjectCode(), group.getNumber()));
|
|
|
} else if (group.getStatus() == MarkStatus.TRIAL) {
|
|
|
+ group.setLibraryCount((int) trialLibraryDao.countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(),
|
|
|
+ group.getSubjectCode(), group.getNumber()));
|
|
|
+ }
|
|
|
+ if (group.getStatus() == MarkStatus.TRIAL || group.getStatus() == MarkStatus.FORMAL) {
|
|
|
+ group.setLeftCount(group.getLibraryCount() - group.getMarkedCount());
|
|
|
groupDao.updateLibraryCount(group.getExamId(), group.getSubjectCode(), group.getNumber(),
|
|
|
- (int) trialLibraryDao.countByExamIdAndSubjectCodeAndGroupNumber(group.getExamId(),
|
|
|
- group.getSubjectCode(), group.getNumber()));
|
|
|
+ group.getLibraryCount());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -831,23 +834,36 @@ public class MarkServiceImpl implements MarkService {
|
|
|
library.setTaskNumber(1);
|
|
|
library.setStatus(LibraryStatus.WAITING);
|
|
|
libraryDao.save(library);
|
|
|
- // 开启双评,且随机数超过双评比例,生成第二份评卷任务
|
|
|
- if (group.getDoubleRate() != null && group.getDoubleRate() > Math.random()) {
|
|
|
- library = new MarkLibrary();
|
|
|
- library.setExamId(student.getExamId());
|
|
|
- library.setSubjectCode(student.getSubjectCode());
|
|
|
- library.setGroupNumber(group.getNumber());
|
|
|
- library.setCampusId(campus.getId());
|
|
|
- library.setStudentId(student.getId());
|
|
|
- library.setExamNumber(student.getExamNumber());
|
|
|
- library.setTaskNumber(2);
|
|
|
- library.setStatus(LibraryStatus.WAITING);
|
|
|
- libraryDao.save(library);
|
|
|
+ // 开启双评时需要判断是否生成第二份评卷任务
|
|
|
+ if (group.getDoubleRate() != null && group.getDoubleRate() > 0) {
|
|
|
+ boolean needDouble = false;
|
|
|
+ if (group.getDoubleRate() == 1) {
|
|
|
+ needDouble = true;
|
|
|
+ } else {
|
|
|
+ double studentCount = studentService.countUploadedByExamIdAndSubjectCode(group.getExamId(),
|
|
|
+ group.getSubjectCode());
|
|
|
+ double doubleCount = libraryDao.countByExamIdAndSubjectCodeAndGroupNumberAndTaskNumber(
|
|
|
+ group.getExamId(), group.getSubjectCode(), group.getNumber(), 2);
|
|
|
+ // 随机数判断加入当前已经生成双评任务的比例加权
|
|
|
+ needDouble = Math.random() < (group.getDoubleRate() - doubleCount / studentCount);
|
|
|
+ }
|
|
|
+ if (needDouble) {
|
|
|
+ library = new MarkLibrary();
|
|
|
+ library.setExamId(student.getExamId());
|
|
|
+ library.setSubjectCode(student.getSubjectCode());
|
|
|
+ library.setGroupNumber(group.getNumber());
|
|
|
+ library.setCampusId(campus.getId());
|
|
|
+ library.setStudentId(student.getId());
|
|
|
+ library.setExamNumber(student.getExamNumber());
|
|
|
+ library.setTaskNumber(2);
|
|
|
+ library.setStatus(LibraryStatus.WAITING);
|
|
|
+ libraryDao.save(library);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
group.setBuildTime(student.getUploadTime());
|
|
|
groupDao.updateBuildTime(group.getExamId(), group.getSubjectCode(), group.getNumber(), student.getUploadTime());
|
|
|
- updateTotalCount(group);
|
|
|
+ // updateTotalCount(group);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -874,7 +890,7 @@ public class MarkServiceImpl implements MarkService {
|
|
|
library.setStudentId(student.getId());
|
|
|
library.setExamNumber(student.getExamNumber());
|
|
|
trialLibraryDao.save(library);
|
|
|
- updateTotalCount(group);
|
|
|
+ // updateTotalCount(group);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -953,14 +969,15 @@ public class MarkServiceImpl implements MarkService {
|
|
|
|
|
|
sumScore += score;
|
|
|
sumSpent += spent;
|
|
|
- if(finishCount>0){
|
|
|
- avgScore = sumScore / finishCount;
|
|
|
- avgSpent = sumSpent / finishCount;
|
|
|
- // 递归法计算标准差
|
|
|
- if(finishCount-1!=0){
|
|
|
- tempScore = tempScore + 1.0 * (finishCount - 1) / finishCount * (score - avgScore) * (score - avgScore);
|
|
|
- stdevScore = Math.sqrt(tempScore / (finishCount - 1));
|
|
|
- }
|
|
|
+ if (finishCount > 0) {
|
|
|
+ avgScore = sumScore / finishCount;
|
|
|
+ avgSpent = sumSpent / finishCount;
|
|
|
+ // 递归法计算标准差
|
|
|
+ if (finishCount - 1 != 0) {
|
|
|
+ tempScore = tempScore
|
|
|
+ + 1.0 * (finishCount - 1) / finishCount * (score - avgScore) * (score - avgScore);
|
|
|
+ stdevScore = Math.sqrt(tempScore / (finishCount - 1));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
markerDao.updateQualityById(marker.getId(), finishCount, validCount, avgSpent / 1000, avgScore, stdevScore);
|