|
@@ -2,23 +2,31 @@ package com.zhongzheng.modules.bank.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.bank.bo.QuestionSimulateAddBo;
|
|
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.QuestionSimulate;
|
|
import com.zhongzheng.modules.bank.domain.QuestionSimulate;
|
|
|
|
|
+import com.zhongzheng.modules.bank.mapper.QuestionBankExamMapper;
|
|
|
|
|
+import com.zhongzheng.modules.bank.mapper.QuestionBankSectionMapper;
|
|
|
|
|
+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.IQuestionSimulateService;
|
|
import com.zhongzheng.modules.bank.service.IQuestionSimulateService;
|
|
|
|
|
+import com.zhongzheng.modules.bank.vo.QuestionBankSectionVo;
|
|
|
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.exam.mapper.ExamConfigMapper;
|
|
|
|
|
+import com.zhongzheng.modules.exam.vo.ExamConfigVo;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
|
|
|
|
|
|
-import java.util.Collection;
|
|
|
|
|
-import java.util.Collections;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -30,8 +38,66 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
@Service
|
|
|
public class QuestionSimulateServiceImpl extends ServiceImpl<QuestionSimulateMapper, QuestionSimulate> implements IQuestionSimulateService {
|
|
public class QuestionSimulateServiceImpl extends ServiceImpl<QuestionSimulateMapper, QuestionSimulate> implements IQuestionSimulateService {
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ExamConfigMapper examConfigMapper;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private QuestionMapper questionMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public QuestionSimulateVo queryById(Long simulateId){
|
|
public QuestionSimulateVo queryById(Long simulateId){
|
|
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
|
|
+ Long bandId = 2L;
|
|
|
|
|
+ param.put("bandId",bandId);
|
|
|
|
|
+ ExamConfigVo vo = examConfigMapper.selectBankExamConfig(param);
|
|
|
|
|
+ if(vo==null){
|
|
|
|
|
+ throw new CustomException("该题库暂不支持模拟考试");
|
|
|
|
|
+ }
|
|
|
|
|
+ Long bank_section_id = 9L;
|
|
|
|
|
+ //抽选单选题
|
|
|
|
|
+ Map<String,Object> param1 = new HashMap<>();
|
|
|
|
|
+ param1.put("bankSectionId",bank_section_id);
|
|
|
|
|
+ param1.put("type",1);
|
|
|
|
|
+ param1.put("num",vo.getSingleChoiceNum());
|
|
|
|
|
+ List<QuestionVo> list1 = questionMapper.selectQuestionSimulateList(param1);
|
|
|
|
|
+ String type1_ids ="";
|
|
|
|
|
+ for (QuestionVo s : list1) {
|
|
|
|
|
+ type1_ids += s.getQuestionId()+",";
|
|
|
|
|
+ }
|
|
|
|
|
+ //抽选多选题
|
|
|
|
|
+ Map<String,Object> param2 = new HashMap<>();
|
|
|
|
|
+ param2.put("bankSectionId",bank_section_id);
|
|
|
|
|
+ param2.put("type",2);
|
|
|
|
|
+ param2.put("num",vo.getSingleChoiceNum());
|
|
|
|
|
+ List<QuestionVo> list2 = questionMapper.selectQuestionSimulateList(param2);
|
|
|
|
|
+ String type2_ids ="";
|
|
|
|
|
+ for (QuestionVo s : list2) {
|
|
|
|
|
+ type2_ids += s.getQuestionId()+",";
|
|
|
|
|
+ }
|
|
|
|
|
+ //抽选判断题
|
|
|
|
|
+ Map<String,Object> param3 = new HashMap<>();
|
|
|
|
|
+ param3.put("bankSectionId",bank_section_id);
|
|
|
|
|
+ param3.put("type",3);
|
|
|
|
|
+ param3.put("num",vo.getSingleChoiceNum());
|
|
|
|
|
+ List<QuestionVo> list3 = questionMapper.selectQuestionSimulateList(param3);
|
|
|
|
|
+ String type3_ids ="";
|
|
|
|
|
+ for (QuestionVo s : list3) {
|
|
|
|
|
+ type3_ids += s.getQuestionId()+",";
|
|
|
|
|
+ }
|
|
|
|
|
+ //抽选案例题
|
|
|
|
|
+ Map<String,Object> param4 = new HashMap<>();
|
|
|
|
|
+ param4.put("bankSectionId",bank_section_id);
|
|
|
|
|
+ param4.put("type",4);
|
|
|
|
|
+ param4.put("num",vo.getSingleChoiceNum());
|
|
|
|
|
+ List<QuestionVo> list4 = questionMapper.selectQuestionSimulateList(param4);
|
|
|
|
|
+ String type4_ids ="";
|
|
|
|
|
+ for (QuestionVo s : list4) {
|
|
|
|
|
+ type4_ids += s.getQuestionId()+",";
|
|
|
|
|
+ }
|
|
|
|
|
+ QuestionSimulateAddBo bo = new QuestionSimulateAddBo();
|
|
|
|
|
+ bo.setBankId(bandId);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
QuestionSimulate db = this.baseMapper.selectById(simulateId);
|
|
QuestionSimulate db = this.baseMapper.selectById(simulateId);
|
|
|
return BeanUtil.toBean(db, QuestionSimulateVo.class);
|
|
return BeanUtil.toBean(db, QuestionSimulateVo.class);
|
|
|
}
|
|
}
|