|
@@ -8,15 +8,19 @@ import com.zhongzheng.modules.bank.bo.QuestionSimulateAddBo;
|
|
|
import com.zhongzheng.modules.bank.bo.QuestionSimulateEditBo;
|
|
import com.zhongzheng.modules.bank.bo.QuestionSimulateEditBo;
|
|
|
import com.zhongzheng.modules.bank.bo.QuestionSimulateQueryBo;
|
|
import com.zhongzheng.modules.bank.bo.QuestionSimulateQueryBo;
|
|
|
import com.zhongzheng.modules.bank.domain.Question;
|
|
import com.zhongzheng.modules.bank.domain.Question;
|
|
|
|
|
+import com.zhongzheng.modules.bank.domain.QuestionBank;
|
|
|
import com.zhongzheng.modules.bank.domain.QuestionSimulate;
|
|
import com.zhongzheng.modules.bank.domain.QuestionSimulate;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionBankExamMapper;
|
|
import com.zhongzheng.modules.bank.mapper.QuestionBankExamMapper;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionBankSectionMapper;
|
|
import com.zhongzheng.modules.bank.mapper.QuestionBankSectionMapper;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionSimulateMapper;
|
|
import com.zhongzheng.modules.bank.mapper.QuestionSimulateMapper;
|
|
|
|
|
+import com.zhongzheng.modules.bank.service.IQuestionBankService;
|
|
|
import com.zhongzheng.modules.bank.service.IQuestionSimulateService;
|
|
import com.zhongzheng.modules.bank.service.IQuestionSimulateService;
|
|
|
import com.zhongzheng.modules.bank.vo.QuestionBankSectionVo;
|
|
import com.zhongzheng.modules.bank.vo.QuestionBankSectionVo;
|
|
|
|
|
+import com.zhongzheng.modules.bank.vo.QuestionBankVo;
|
|
|
import com.zhongzheng.modules.bank.vo.QuestionSimulateVo;
|
|
import com.zhongzheng.modules.bank.vo.QuestionSimulateVo;
|
|
|
import com.zhongzheng.modules.bank.vo.QuestionVo;
|
|
import com.zhongzheng.modules.bank.vo.QuestionVo;
|
|
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamConfig;
|
|
|
import com.zhongzheng.modules.exam.mapper.ExamConfigMapper;
|
|
import com.zhongzheng.modules.exam.mapper.ExamConfigMapper;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamConfigVo;
|
|
import com.zhongzheng.modules.exam.vo.ExamConfigVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -44,6 +48,9 @@ public class QuestionSimulateServiceImpl extends ServiceImpl<QuestionSimulateMap
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private QuestionMapper questionMapper;
|
|
private QuestionMapper questionMapper;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IQuestionBankService iQuestionBankService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public QuestionSimulateVo queryById(Long simulateId){
|
|
public QuestionSimulateVo queryById(Long simulateId){
|
|
|
QuestionSimulate db = this.baseMapper.selectById(simulateId);
|
|
QuestionSimulate db = this.baseMapper.selectById(simulateId);
|
|
@@ -51,72 +58,74 @@ public class QuestionSimulateServiceImpl extends ServiceImpl<QuestionSimulateMap
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Map<String,Object> queryByBankId(Long bandId,Long userId) {
|
|
|
|
|
|
|
+ public Map<String,Object> queryByBankId(Long bankId,Long userId) {
|
|
|
Map<String,Object> param = new HashMap<>();
|
|
Map<String,Object> param = new HashMap<>();
|
|
|
- param.put("bandId",bandId);
|
|
|
|
|
- ExamConfigVo vo = examConfigMapper.selectBankExamConfig(param);
|
|
|
|
|
|
|
+ param.put("bankId",bankId);
|
|
|
|
|
+ System.out.println(bankId);
|
|
|
|
|
+ ExamConfig vo = examConfigMapper.selectBankExamConfig(param);
|
|
|
|
|
+ System.out.println(vo);
|
|
|
if(vo==null){
|
|
if(vo==null){
|
|
|
throw new CustomException("该题库暂不支持模拟考试");
|
|
throw new CustomException("该题库暂不支持模拟考试");
|
|
|
}
|
|
}
|
|
|
//抽选单选题
|
|
//抽选单选题
|
|
|
Map<String,Object> param1 = new HashMap<>();
|
|
Map<String,Object> param1 = new HashMap<>();
|
|
|
- param1.put("bankId",bandId);
|
|
|
|
|
|
|
+ param1.put("bankId",bankId);
|
|
|
param1.put("type",1);
|
|
param1.put("type",1);
|
|
|
param1.put("num",vo.getSingleChoiceNum());
|
|
param1.put("num",vo.getSingleChoiceNum());
|
|
|
- List<QuestionVo> listToatl = new ArrayList<>();
|
|
|
|
|
- List<QuestionVo> list1 = questionMapper.selectQuestionSimulateList(param1);
|
|
|
|
|
|
|
+ List<Question> listToatl = new ArrayList<>();
|
|
|
|
|
+ List<Question> list1 = questionMapper.selectQuestionSimulateList(param1);
|
|
|
String type1_ids ="";
|
|
String type1_ids ="";
|
|
|
if(list1.size()<vo.getSingleChoiceNum()){
|
|
if(list1.size()<vo.getSingleChoiceNum()){
|
|
|
throw new CustomException("题库单选题数不足");
|
|
throw new CustomException("题库单选题数不足");
|
|
|
}
|
|
}
|
|
|
- for (QuestionVo s : list1) {
|
|
|
|
|
|
|
+ for (Question s : list1) {
|
|
|
type1_ids += s.getQuestionId()+",";
|
|
type1_ids += s.getQuestionId()+",";
|
|
|
listToatl.add(s);
|
|
listToatl.add(s);
|
|
|
}
|
|
}
|
|
|
//抽选多选题
|
|
//抽选多选题
|
|
|
Map<String,Object> param2 = new HashMap<>();
|
|
Map<String,Object> param2 = new HashMap<>();
|
|
|
- param2.put("bankId",bandId);
|
|
|
|
|
|
|
+ param2.put("bankId",bankId);
|
|
|
param2.put("type",2);
|
|
param2.put("type",2);
|
|
|
param2.put("num",vo.getMultipleChoiceNum());
|
|
param2.put("num",vo.getMultipleChoiceNum());
|
|
|
- List<QuestionVo> list2 = questionMapper.selectQuestionSimulateList(param2);
|
|
|
|
|
|
|
+ List<Question> list2 = questionMapper.selectQuestionSimulateList(param2);
|
|
|
String type2_ids ="";
|
|
String type2_ids ="";
|
|
|
if(list2.size()<vo.getMultipleChoiceNum()){
|
|
if(list2.size()<vo.getMultipleChoiceNum()){
|
|
|
throw new CustomException("题库多选题数不足");
|
|
throw new CustomException("题库多选题数不足");
|
|
|
}
|
|
}
|
|
|
- for (QuestionVo s : list2) {
|
|
|
|
|
|
|
+ for (Question s : list2) {
|
|
|
type2_ids += s.getQuestionId()+",";
|
|
type2_ids += s.getQuestionId()+",";
|
|
|
listToatl.add(s);
|
|
listToatl.add(s);
|
|
|
}
|
|
}
|
|
|
//抽选判断题
|
|
//抽选判断题
|
|
|
Map<String,Object> param3 = new HashMap<>();
|
|
Map<String,Object> param3 = new HashMap<>();
|
|
|
- param3.put("bankId",bandId);
|
|
|
|
|
|
|
+ param3.put("bankId",bankId);
|
|
|
param3.put("type",3);
|
|
param3.put("type",3);
|
|
|
param3.put("num",vo.getJudgmentNum());
|
|
param3.put("num",vo.getJudgmentNum());
|
|
|
- List<QuestionVo> list3 = questionMapper.selectQuestionSimulateList(param3);
|
|
|
|
|
|
|
+ List<Question> list3 = questionMapper.selectQuestionSimulateList(param3);
|
|
|
String type3_ids ="";
|
|
String type3_ids ="";
|
|
|
if(list3.size()<vo.getJudgmentNum()){
|
|
if(list3.size()<vo.getJudgmentNum()){
|
|
|
throw new CustomException("题库判断题数不足");
|
|
throw new CustomException("题库判断题数不足");
|
|
|
}
|
|
}
|
|
|
- for (QuestionVo s : list3) {
|
|
|
|
|
|
|
+ for (Question s : list3) {
|
|
|
type3_ids += s.getQuestionId()+",";
|
|
type3_ids += s.getQuestionId()+",";
|
|
|
listToatl.add(s);
|
|
listToatl.add(s);
|
|
|
}
|
|
}
|
|
|
//抽选案例题
|
|
//抽选案例题
|
|
|
Map<String,Object> param4 = new HashMap<>();
|
|
Map<String,Object> param4 = new HashMap<>();
|
|
|
- param4.put("bankId",bandId);
|
|
|
|
|
|
|
+ param4.put("bankId",bankId);
|
|
|
param4.put("type",4);
|
|
param4.put("type",4);
|
|
|
param4.put("num",vo.getCaseNum());
|
|
param4.put("num",vo.getCaseNum());
|
|
|
- List<QuestionVo> list4 = questionMapper.selectQuestionSimulateList(param4);
|
|
|
|
|
|
|
+ List<Question> list4 = questionMapper.selectQuestionSimulateList(param4);
|
|
|
String type4_ids ="";
|
|
String type4_ids ="";
|
|
|
if(list4.size()<vo.getCaseNum()){
|
|
if(list4.size()<vo.getCaseNum()){
|
|
|
throw new CustomException("题库案例题数不足");
|
|
throw new CustomException("题库案例题数不足");
|
|
|
}
|
|
}
|
|
|
- for (QuestionVo s : list4) {
|
|
|
|
|
|
|
+ for (Question s : list4) {
|
|
|
type4_ids += s.getQuestionId()+",";
|
|
type4_ids += s.getQuestionId()+",";
|
|
|
listToatl.add(s);
|
|
listToatl.add(s);
|
|
|
}
|
|
}
|
|
|
QuestionSimulateAddBo bo = new QuestionSimulateAddBo();
|
|
QuestionSimulateAddBo bo = new QuestionSimulateAddBo();
|
|
|
- bo.setBankId(bandId);
|
|
|
|
|
|
|
+ bo.setBankId(bankId);
|
|
|
bo.setType1Ids(type1_ids);
|
|
bo.setType1Ids(type1_ids);
|
|
|
bo.setType2Ids(type2_ids);
|
|
bo.setType2Ids(type2_ids);
|
|
|
bo.setType3Ids(type3_ids);
|
|
bo.setType3Ids(type3_ids);
|