|
@@ -20,6 +20,7 @@ import cn.com.qmth.stmms.biz.exam.service.ExamQuestionService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.SelectiveGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.SelectiveGroupService;
|
|
import cn.com.qmth.stmms.common.enums.ScorePolicy;
|
|
import cn.com.qmth.stmms.common.enums.ScorePolicy;
|
|
|
|
+import cn.com.qmth.stmms.common.utils.BigDecimalUtils;
|
|
|
|
|
|
@Service("selectiveGroupService")
|
|
@Service("selectiveGroupService")
|
|
public class SelectiveGroupServiceImpl extends BaseQueryService<SelectiveGroup> implements SelectiveGroupService {
|
|
public class SelectiveGroupServiceImpl extends BaseQueryService<SelectiveGroup> implements SelectiveGroupService {
|
|
@@ -143,4 +144,26 @@ public class SelectiveGroupServiceImpl extends BaseQueryService<SelectiveGroup>
|
|
public void updateScorePolicy(int examId, String subjectCode, Integer selectiveIndex, ScorePolicy scorePolicy) {
|
|
public void updateScorePolicy(int examId, String subjectCode, Integer selectiveIndex, ScorePolicy scorePolicy) {
|
|
selectiveGroupDao.updateScorePolicy(examId, subjectCode, selectiveIndex, scorePolicy);
|
|
selectiveGroupDao.updateScorePolicy(examId, subjectCode, selectiveIndex, scorePolicy);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public double sumScoreByExamIdAndSubjectCode(int examId, String subjectCode) {
|
|
|
|
+ List<SelectiveGroup> list = selectiveGroupDao.findByExamIdAndSubjectCode(examId, subjectCode);
|
|
|
|
+ Map<Integer, SelectiveGroup> map = new HashMap<>();
|
|
|
|
+ for (SelectiveGroup selectiveGroup : list) {
|
|
|
|
+ map.put(selectiveGroup.getSelectiveIndex(), selectiveGroup);
|
|
|
|
+ }
|
|
|
|
+ List<ExamQuestion> questionList = questionService.findMainByExamAndSubjectAndObjective(examId, subjectCode,
|
|
|
|
+ false);
|
|
|
|
+ Map<Integer, Double> mainScoreMap = new HashMap<Integer, Double>();
|
|
|
|
+ for (ExamQuestion question : questionList) {
|
|
|
|
+ mainScoreMap.put(question.getMainNumber(), question.getTotalScore());
|
|
|
|
+ }
|
|
|
|
+ double totalScore = 0d;
|
|
|
|
+ for (SelectiveGroup selectiveGroup : map.values()) {
|
|
|
|
+ Double mainScore = mainScoreMap.get(selectiveGroup.getMainNumber());
|
|
|
|
+ totalScore = BigDecimalUtils.add(totalScore,
|
|
|
|
+ BigDecimalUtils.mul(mainScore, selectiveGroup.getSelectiveCount()));
|
|
|
|
+ }
|
|
|
|
+ return totalScore;
|
|
|
|
+ }
|
|
}
|
|
}
|