From 9fe24f72304b4f40b3fa84a05400dcd1f4f27e84 Mon Sep 17 00:00:00 2001 From: xzb <223@qq.com> Date: Tue, 27 Sep 2022 15:27:03 +0800 Subject: [PATCH] paper --- .../{PagerQuestionDAO.java => PaperQuestionDAO.java} | 7 ++++--- .../rtss/services/paper/PaperUserService.java | 12 ++++++++++-- .../rtss/services/papger/PagerQuestionService.java | 5 ++--- 3 files changed, 16 insertions(+), 8 deletions(-) rename src/main/java/club/joylink/rtss/dao/paper/{PagerQuestionDAO.java => PaperQuestionDAO.java} (92%) diff --git a/src/main/java/club/joylink/rtss/dao/paper/PagerQuestionDAO.java b/src/main/java/club/joylink/rtss/dao/paper/PaperQuestionDAO.java similarity index 92% rename from src/main/java/club/joylink/rtss/dao/paper/PagerQuestionDAO.java rename to src/main/java/club/joylink/rtss/dao/paper/PaperQuestionDAO.java index 5b8094c60..9e4a61180 100644 --- a/src/main/java/club/joylink/rtss/dao/paper/PagerQuestionDAO.java +++ b/src/main/java/club/joylink/rtss/dao/paper/PaperQuestionDAO.java @@ -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("") - List findFromAndRaceLable(String projectCode,int isDelete, List lable,List types); + List findFromAndRaceLable(String projectCode, int isDelete, List lable, List types); long countByExample(PaperQuestionExample example); int deleteByExample(PaperQuestionExample example); diff --git a/src/main/java/club/joylink/rtss/services/paper/PaperUserService.java b/src/main/java/club/joylink/rtss/services/paper/PaperUserService.java index 101b17796..a186112f5 100644 --- a/src/main/java/club/joylink/rtss/services/paper/PaperUserService.java +++ b/src/main/java/club/joylink/rtss/services/paper/PaperUserService.java @@ -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 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 ruleMap) { + //PublishedTraining2 return 0; } diff --git a/src/main/java/club/joylink/rtss/services/papger/PagerQuestionService.java b/src/main/java/club/joylink/rtss/services/papger/PagerQuestionService.java index e2aa8b881..89ed556d3 100644 --- a/src/main/java/club/joylink/rtss/services/papger/PagerQuestionService.java +++ b/src/main/java/club/joylink/rtss/services/papger/PagerQuestionService.java @@ -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){