|
@@ -36,7 +36,6 @@ import cn.com.qmth.stmms.biz.exam.service.SelectiveGroupService;
|
|
|
import cn.com.qmth.stmms.common.annotation.Logging;
|
|
|
import cn.com.qmth.stmms.common.enums.LogType;
|
|
|
import cn.com.qmth.stmms.common.enums.ScorePolicy;
|
|
|
-import cn.com.qmth.stmms.common.utils.BigDecimalUtils;
|
|
|
|
|
|
@Controller("selectiveGroupController")
|
|
|
@RequestMapping("/admin/exam/selectiveGroup")
|
|
@@ -176,7 +175,8 @@ public class SelectiveGroupController extends BaseExamController {
|
|
|
}
|
|
|
selectiveGroupService.save(list);
|
|
|
}
|
|
|
- calculate(examId, subjectCode);
|
|
|
+ subjectService.updateScore(examId, subjectCode, false,
|
|
|
+ questionService.sumTotalScore(examId, subjectCode, false));
|
|
|
return "redirect:/admin/exam/selectiveGroup?subjectCode=" + subjectCode;
|
|
|
}
|
|
|
|
|
@@ -209,39 +209,9 @@ public class SelectiveGroupController extends BaseExamController {
|
|
|
return "redirect:/admin/exam/selectiveGroup?subjectCode=" + subjectCode;
|
|
|
}
|
|
|
selectiveGroupService.deleteByExamIdAndSubjectCodeAndSelectiveIndex(examId, subjectCode, selectiveIndex);
|
|
|
- calculate(examId, subjectCode);
|
|
|
+ subjectService.updateScore(examId, subjectCode, false,
|
|
|
+ questionService.sumTotalScore(examId, subjectCode, false));
|
|
|
return "redirect:/admin/exam/selectiveGroup?subjectCode=" + subjectCode;
|
|
|
}
|
|
|
|
|
|
- private void calculate(int examId, String subjectCode) {
|
|
|
- List<SelectiveGroup> selectiveGroups = selectiveGroupService.findByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
- if (!selectiveGroups.isEmpty()) {
|
|
|
- double totalScore = 0;
|
|
|
- Map<Integer, SelectiveGroup> map = new HashMap<Integer, SelectiveGroup>();
|
|
|
- for (SelectiveGroup selectiveGroup : selectiveGroups) {
|
|
|
- map.put(selectiveGroup.getMainNumber(), selectiveGroup);
|
|
|
- }
|
|
|
- List<ExamQuestion> questions = questionService.findByExamAndSubjectAndObjective(examId, subjectCode, false);
|
|
|
- for (ExamQuestion examQuestion : questions) {
|
|
|
- if (map.containsKey(examQuestion.getMainNumber())) {
|
|
|
- examQuestion.setSelective(true);
|
|
|
- examQuestion.setSelectiveIndex(map.get(examQuestion.getMainNumber()).getSelectiveIndex());
|
|
|
- } else {
|
|
|
-
|
|
|
- totalScore = BigDecimalUtils.add(totalScore, examQuestion.getTotalScore());
|
|
|
- }
|
|
|
- }
|
|
|
- List<SelectiveGroup> indexGroup = selectiveGroupService
|
|
|
- .findIndexByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
- for (SelectiveGroup selectiveGroup : indexGroup) {
|
|
|
-
|
|
|
- totalScore = BigDecimalUtils.add(totalScore,
|
|
|
- selectiveGroup.getPartScore() * selectiveGroup.getSelectiveCount());
|
|
|
- }
|
|
|
- subjectService.updateScore(examId, subjectCode, false, totalScore);
|
|
|
- } else {
|
|
|
- subjectService.updateScore(examId, subjectCode, false,
|
|
|
- questionService.sumTotalScore(examId, subjectCode, false));
|
|
|
- }
|
|
|
- }
|
|
|
}
|