|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.ArrayUtil;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.jlw.util.EnumUtil;
|
|
|
|
@ -40,6 +41,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.io.*;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
|
|
|
|
@ -768,4 +770,56 @@ public class GeneralQuestionSettingService extends CoreBaseService<GeneralQuesti
|
|
|
|
|
questionSetting.setQuestionSettingOptions(questionSettingDTOList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 设置题目的分数和完成时间
|
|
|
|
|
* @param list
|
|
|
|
|
* @param student
|
|
|
|
|
*/
|
|
|
|
|
public void setMyQuestionLogScoreInfo(List<GeneralQuestionSetting> list, Student student) {
|
|
|
|
|
Optional.ofNullable(list).orElse(Collections.emptyList()).forEach(item -> {
|
|
|
|
|
Long questionSettingId = item.getGeneralQuestionSettingId();
|
|
|
|
|
if (ObjectUtil.isNotEmpty(student)) {
|
|
|
|
|
Long studentId = student.getStudentId();
|
|
|
|
|
|
|
|
|
|
QuestionLogSummaryQuery logSummaryQuery = new QuestionLogSummaryQuery();
|
|
|
|
|
logSummaryQuery.setPersonId(studentId);
|
|
|
|
|
logSummaryQuery.setQuestionLogSummaryStatus(1);
|
|
|
|
|
logSummaryQuery.setQuestionSettingId(questionSettingId);
|
|
|
|
|
List<QuestionLogSummary> myLogSummaryList = questionLogSummaryDao.getValuesByQueryNotWithPermission(logSummaryQuery);
|
|
|
|
|
|
|
|
|
|
// 我的得分,完成时间
|
|
|
|
|
if (ObjectUtil.isNotEmpty(myLogSummaryList)) {
|
|
|
|
|
QuestionLogSummary myScoreInfo = myLogSummaryList.get(0);
|
|
|
|
|
item.set("finishTime", myScoreInfo.getFinishTime());
|
|
|
|
|
item.set("finishSecondTime", myScoreInfo.getFinishSecondTime());
|
|
|
|
|
item.set("myScore", myScoreInfo.getQuestionLogSummaryStudentTotalScore());
|
|
|
|
|
item.set("mySuccessRate", myScoreInfo.getQuestionLogSummarySuccessRate());
|
|
|
|
|
item.set("mySuccessCount", myScoreInfo.getQuestionLogSummarySuccessCount());
|
|
|
|
|
item.set("myErrorCount", myScoreInfo.getQuestionLogSummaryErrorCount());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QuestionLogSummaryQuery logSummaryQuery2 = new QuestionLogSummaryQuery();
|
|
|
|
|
logSummaryQuery2.setQuestionLogSummaryStatus(1);
|
|
|
|
|
logSummaryQuery2.setQuestionSettingId(questionSettingId);
|
|
|
|
|
List<QuestionLogSummary> logSummaryList2 = questionLogSummaryDao.getValuesByQueryNotWithPermission(logSummaryQuery2);
|
|
|
|
|
|
|
|
|
|
// 平均及格率,平均得分等等
|
|
|
|
|
if (ObjectUtil.isNotEmpty(logSummaryList2)) {
|
|
|
|
|
BigDecimal studentTotalScore = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryStudentTotalScore).reduce(BigDecimal::add).get();
|
|
|
|
|
int passTotalCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryIsPass).reduce(Integer::sum).get();
|
|
|
|
|
int totalSuccessCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummarySuccessCount).reduce(Integer::sum).get();
|
|
|
|
|
int totalErrorCount = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummaryErrorCount).reduce(Integer::sum).get();
|
|
|
|
|
BigDecimal totalSuccessRate = logSummaryList2.stream().map(QuestionLogSummary::getQuestionLogSummarySuccessRate).reduce(BigDecimal::add).get();
|
|
|
|
|
int logSummarySize = logSummaryList2.size();
|
|
|
|
|
|
|
|
|
|
item.set("avgScore", NumberUtil.div(studentTotalScore, logSummarySize, 1));
|
|
|
|
|
item.set("avgPassRate", NumberUtil.div(passTotalCount, logSummarySize, 1));
|
|
|
|
|
item.set("avgSuccessCount", NumberUtil.div(totalSuccessCount, logSummarySize, 1));
|
|
|
|
|
item.set("avgErrorCount", NumberUtil.div(totalErrorCount, logSummarySize, 1));
|
|
|
|
|
item.set("avgSuccessRate", NumberUtil.div(totalSuccessRate, logSummarySize, 1));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|