|
@@ -2,7 +2,6 @@ package com.miaxis.question.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.miaxis.common.exception.CustomException;
|
|
|
-import com.miaxis.common.exception.user.UserException;
|
|
|
import com.miaxis.question.domain.QuestionInfo;
|
|
|
import com.miaxis.question.domain.TAppExamRule;
|
|
|
import com.miaxis.question.dto.*;
|
|
@@ -10,7 +9,6 @@ import com.miaxis.question.mapper.QuestionInfoMapper;
|
|
|
import com.miaxis.question.service.IQuestionInfoService;
|
|
|
import com.miaxis.question.service.ITAppExamRuleService;
|
|
|
import com.miaxis.question.vo.*;
|
|
|
-import org.apache.ibatis.executor.ExecutorException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -198,10 +196,24 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
|
|
|
int easyMultiple = er.getMultipleChoiceCount();
|
|
|
int chapterId = er.getChapterId();
|
|
|
|
|
|
+ int total2 = easyJudge + easyChoice + easyMultiple;
|
|
|
+
|
|
|
QuestionInfoTestDTO questionInfoTestDTO = new QuestionInfoTestDTO();
|
|
|
questionInfoTestDTO.setChapterId(chapterId);
|
|
|
questionInfoTestDTO.setDiffDegree(diffDegree);
|
|
|
questionInfoTestDTO.setQuestionType(1);
|
|
|
+
|
|
|
+ if ("mtc".equals(qt.getGs())) {
|
|
|
+ questionInfoTestDTO.setLiceMoto("1");
|
|
|
+ } else if ("xc".equals(qt.getGs())) {
|
|
|
+ questionInfoTestDTO.setLiceCar("1");
|
|
|
+ } else if ("hc".equals(qt.getGs())) {
|
|
|
+ questionInfoTestDTO.setLiceTruck("1");
|
|
|
+ } else if ("kc".equals(qt.getGs())) {
|
|
|
+ questionInfoTestDTO.setLiceBus("1");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
int judgeTotal = questionInfoMapper.selectQuestionInfoCount(questionInfoTestDTO); //章节判断难题总数
|
|
|
questionInfoTestDTO.setQuestionType(2);
|
|
|
int choiceTotal = questionInfoMapper.selectQuestionInfoCount(questionInfoTestDTO); //章节选择难题总数
|
|
@@ -241,13 +253,16 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// System.out.println("简单判断:" + easyJudge);
|
|
|
-// System.out.println("简单选择:" + easyChoice);
|
|
|
-// System.out.println("简单多选:" + easyMultiple);
|
|
|
-// System.out.println("难题判断:" + p);
|
|
|
-// System.out.println("难题选择:" + d);
|
|
|
-// System.out.println("难题多择:" + m);
|
|
|
-// System.out.println("---------------------------------------------");
|
|
|
+
|
|
|
+ System.out.println("简单判断:" + easyJudge);
|
|
|
+ System.out.println("简单选择:" + easyChoice);
|
|
|
+ System.out.println("简单多选:" + easyMultiple);
|
|
|
+ System.out.println("难题判断:" + p);
|
|
|
+ System.out.println("难题选择:" + d);
|
|
|
+ System.out.println("难题多择:" + m);
|
|
|
+ System.out.println("总题数:" + total2);
|
|
|
+
|
|
|
+ System.out.println("---------------------------------------------");
|
|
|
|
|
|
//判断简单
|
|
|
qt.setChapterId(er.getChapterId()); //章节ID
|
|
@@ -255,19 +270,37 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
|
|
|
qt.setQuestionType(1); //判断题
|
|
|
qt.setNum(easyJudge); //题数
|
|
|
List<QuestionInfo> easyJudgeList = this.selectTestQuestionInfoList(qt);
|
|
|
+ if (easyJudge != easyJudgeList.size()) { //简单题不够的情况下,加到难题上
|
|
|
+ System.out.println("easyJudge != easyJudgeList.size()");
|
|
|
+ int easyJudgeQ = easyJudge - easyJudgeList.size();
|
|
|
+ d = d + easyJudgeQ;
|
|
|
+ qt.setNum(easyJudgeList.size());
|
|
|
+ }
|
|
|
//单选简单
|
|
|
qt.setChapterId(er.getChapterId()); //章节ID
|
|
|
qt.setDiffDegree(easyDegree); //简单难度
|
|
|
qt.setQuestionType(2); //判断题
|
|
|
qt.setNum(easyChoice); //题数
|
|
|
List<QuestionInfo> easyChoiceList = this.selectTestQuestionInfoList(qt);
|
|
|
+ if (easyChoice != easyChoiceList.size()) { //简单题不够的情况下,加到难题上
|
|
|
+ System.out.println("easyChoice != easyChoiceList.size()");
|
|
|
+ int easyChoiceQ = easyChoice - easyChoiceList.size();
|
|
|
+ d = d + easyChoiceQ;
|
|
|
+ qt.setNum(easyChoiceList.size());
|
|
|
+ }
|
|
|
+
|
|
|
//多选简单
|
|
|
qt.setChapterId(er.getChapterId()); //章节ID
|
|
|
qt.setDiffDegree(easyDegree); //简单难度
|
|
|
qt.setQuestionType(3); //判断题
|
|
|
qt.setNum(easyMultiple); //题数
|
|
|
List<QuestionInfo> easyMultipleList = this.selectTestQuestionInfoList(qt);
|
|
|
-
|
|
|
+ if (easyMultiple != easyMultipleList.size()) { //简单题不够的情况下,加到难题上
|
|
|
+ System.out.println("easyMultiple != easyMultipleList.size()");
|
|
|
+ int easyMultipleQ = easyMultiple - easyMultipleList.size();
|
|
|
+ m = m + easyMultipleQ;
|
|
|
+ qt.setNum(easyMultipleList.size());
|
|
|
+ }
|
|
|
//判断难题
|
|
|
qt.setChapterId(er.getChapterId()); //章节ID
|
|
|
qt.setDiffDegree(diffDegree); //高难度
|
|
@@ -306,12 +339,15 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
|
|
|
choiceList.addAll(diffChoiceList);
|
|
|
multipleList.addAll(easyMultipleList);
|
|
|
multipleList.addAll(diffMultipleList);
|
|
|
+ System.out.println("easyMultipleList = " + easyMultipleList.size());
|
|
|
+ System.out.println("diffMultipleList = " + diffMultipleList.size());
|
|
|
}
|
|
|
allList.addAll(judgeList);
|
|
|
allList.addAll(choiceList);
|
|
|
allList.addAll(multipleList);
|
|
|
-// System.out.println("error:" + error);
|
|
|
-// System.out.println("allList:" + allList.size());
|
|
|
+ System.out.println("judgeList = "+judgeList.size());
|
|
|
+ System.out.println("choiceList = " + choiceList.size());
|
|
|
+ System.out.println("multipleList = " + multipleList.size());
|
|
|
return allList;
|
|
|
}
|
|
|
|