This commit is contained in:
xzb 2022-09-27 15:27:03 +08:00
parent 7ae3346ad7
commit 9fe24f7230
3 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,7 @@
package club.joylink.rtss.dao.paper;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.paper.PaperQuestion;
import club.joylink.rtss.entity.paper.PaperQuestionExample;
import club.joylink.rtss.entity.paper.PaperQuestionWithBLOBs;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
@ -14,7 +15,7 @@ import java.util.List;
@Mapper
@Repository
public interface PagerQuestionDAO{
public interface PaperQuestionDAO {
@Select("<script>" +
"select * from paper_question where 1 = 1 " +
"<choose>" +

View File

@ -1,5 +1,6 @@
package club.joylink.rtss.services.paper;
import club.joylink.rtss.dao.PublishedTraining2DAO;
import club.joylink.rtss.dao.paper.*;
import club.joylink.rtss.entity.paper.*;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
@ -37,7 +38,11 @@ public class PaperUserService {
@Autowired
private PaperCompositionService compositionService;
@Autowired
private PagerQuestionDAO pagerQuestionDAO;
private PaperQuestionDAO pagerQuestionDAO;
@Autowired
private PublishedTraining2DAO trainingDAO;
/**
* 根据试卷蓝图生成用户的试卷
@ -181,7 +186,9 @@ public class PaperUserService {
* 获取题的最终得分
*/
private int calculateCommonScore(PaperUserQuestion puq, Map<PaperQType.SubType, PaperRule> ruleMap) {
PaperQuestion question = pagerQuestionDAO.selectByPrimaryKey(puq.getQuestionId());
PaperQuestionExample example = new PaperQuestionExample();
example.createCriteria().andIdEqualTo(puq.getQuestionId());
PaperQuestion question = pagerQuestionDAO.selectByExample(example).get(0);
if (PaperQuestionState.Right.equals(PaperQuestionState.getItem(puq.getState()))) {//题答对时
PaperRule rule = ruleMap.get(this.getPaperQuestionType(question));
return rule.getScore();
@ -195,6 +202,7 @@ public class PaperUserService {
* 获取题的最终得分
*/
private int calculateTrainingScore(PaperUserQuestion puq, Map<PaperQType.SubType, PaperRule> ruleMap) {
//PublishedTraining2
return 0;
}

View File

@ -2,7 +2,7 @@ package club.joylink.rtss.services.papger;
import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.paper.PagerQuestionDAO;
import club.joylink.rtss.dao.paper.PaperQuestionDAO;
import club.joylink.rtss.entity.paper.question.PaperQuestion;
import club.joylink.rtss.entity.paper.question.PaperQuestionExample;
import club.joylink.rtss.entity.project.Project;
@ -17,7 +17,6 @@ import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -36,7 +35,7 @@ import java.util.stream.Collectors;
@Slf4j
public class PagerQuestionService {
@Resource
private PagerQuestionDAO questionDAO;
private PaperQuestionDAO questionDAO;
private Object queryQuestions(QuestionQueryVO queryVO,boolean isPaging){
if(isPaging){