|
@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.http.HttpStatus;
|
|
import cn.hutool.http.HttpStatus;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
@@ -17,21 +18,17 @@ import com.github.pagehelper.PageInfo;
|
|
import com.zhongzheng.common.core.page.TableDataInfo;
|
|
import com.zhongzheng.common.core.page.TableDataInfo;
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
import com.zhongzheng.common.core.redis.RedisCache;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
|
+import com.zhongzheng.common.type.EncryptHandler;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
import com.zhongzheng.common.utils.ToolsUtils;
|
|
|
|
+import com.zhongzheng.common.utils.http.HttpUtils;
|
|
import com.zhongzheng.modules.alioss.service.OssService;
|
|
import com.zhongzheng.modules.alioss.service.OssService;
|
|
import com.zhongzheng.modules.bank.bo.*;
|
|
import com.zhongzheng.modules.bank.bo.*;
|
|
-import com.zhongzheng.modules.bank.domain.Exam;
|
|
|
|
-import com.zhongzheng.modules.bank.domain.ExamQuestion;
|
|
|
|
-import com.zhongzheng.modules.bank.domain.Question;
|
|
|
|
-import com.zhongzheng.modules.bank.domain.QuestionBusiness;
|
|
|
|
|
|
+import com.zhongzheng.modules.bank.domain.*;
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
-import com.zhongzheng.modules.bank.service.IExamQuestionService;
|
|
|
|
-import com.zhongzheng.modules.bank.service.IExamService;
|
|
|
|
-import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
|
|
|
|
-import com.zhongzheng.modules.bank.service.IQuestionService;
|
|
|
|
|
|
+import com.zhongzheng.modules.bank.service.*;
|
|
import com.zhongzheng.modules.bank.vo.*;
|
|
import com.zhongzheng.modules.bank.vo.*;
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
import com.zhongzheng.modules.course.domain.CourseEducationType;
|
|
import com.zhongzheng.modules.course.domain.CourseEducationType;
|
|
@@ -47,7 +44,9 @@ import com.zhongzheng.modules.exam.domain.ExamKnowledge;
|
|
import com.zhongzheng.modules.exam.service.IExamKnowledgeService;
|
|
import com.zhongzheng.modules.exam.service.IExamKnowledgeService;
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
|
+import com.zhongzheng.modules.goods.domain.GoodsAttached;
|
|
import com.zhongzheng.modules.goods.domain.GoodsExamTime;
|
|
import com.zhongzheng.modules.goods.domain.GoodsExamTime;
|
|
|
|
+import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
|
|
import com.zhongzheng.modules.goods.service.IGoodsExamTimeService;
|
|
import com.zhongzheng.modules.goods.service.IGoodsExamTimeService;
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
import com.zhongzheng.modules.goods.vo.BankGoodsExamVo;
|
|
import com.zhongzheng.modules.goods.vo.BankGoodsExamVo;
|
|
@@ -77,6 +76,7 @@ import org.w3c.dom.NodeList;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.text.NumberFormat;
|
|
import java.text.NumberFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -127,6 +127,21 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
@Autowired
|
|
@Autowired
|
|
private IUserExamSubscriptionService iUserExamSubscriptionService;
|
|
private IUserExamSubscriptionService iUserExamSubscriptionService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQuestionModuleService iQuestionModuleService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQuestionChapterService iQuestionChapterService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQuestionChapterExamService iQuestionChapterExamService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IQuestionModuleChapterService iQuestionModuleChapterService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IGoodsAttachedService iGoodsAttachedService;
|
|
|
|
+
|
|
@Autowired
|
|
@Autowired
|
|
private IUserService iUserService;
|
|
private IUserService iUserService;
|
|
|
|
|
|
@@ -145,6 +160,12 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
@Value("${aliyun.oss.endpoint}")
|
|
@Value("${aliyun.oss.endpoint}")
|
|
private String ossHost;
|
|
private String ossHost;
|
|
|
|
|
|
|
|
+ @Value("${oldSys.question}")
|
|
|
|
+ private String QUESTION;
|
|
|
|
+
|
|
|
|
+ @Value("${oldSys.questionDetail}")
|
|
|
|
+ private String QUESTION_DETAIL;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public QuestionVo queryById(Long questionId) {
|
|
public QuestionVo queryById(Long questionId) {
|
|
@@ -3090,8 +3111,397 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void questionImport(String param) {
|
|
|
|
|
|
+ public void questionImport() {
|
|
|
|
+ String respone = HttpUtils.sendGet(QUESTION, "");
|
|
|
|
+ List<ExternalQuestionVo> questionVos = JSONArray.parseArray(respone, ExternalQuestionVo.class);
|
|
|
|
+ //考前培训
|
|
|
|
+ CourseEducationType educationType = iCourseEducationTypeService
|
|
|
|
+ .getOne(new LambdaQueryWrapper<CourseEducationType>()
|
|
|
|
+ .eq(CourseEducationType::getEducationName, "考前培训")
|
|
|
|
+ .eq(CourseEducationType::getStatus, 1)
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+
|
|
|
|
+ //施工现场人员
|
|
|
|
+ CourseProjectType projectType = iCourseProjectTypeService
|
|
|
|
+ .getOne(new LambdaQueryWrapper<CourseProjectType>()
|
|
|
|
+ .eq(CourseProjectType::getProjectName, "施工现场专业人员")
|
|
|
|
+ .eq(CourseProjectType::getEducationId, educationType.getId())
|
|
|
|
+ .eq(CourseProjectType::getStatus, 1)
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+
|
|
|
|
+ //七大员
|
|
|
|
+ CourseBusiness business = iCourseBusinessService
|
|
|
|
+ .getOne(new LambdaQueryWrapper<CourseBusiness>()
|
|
|
|
+ .eq(CourseBusiness::getBusinessName, "七大员")
|
|
|
|
+ .eq(CourseBusiness::getProjectId, projectType.getId())
|
|
|
|
+ .eq(CourseBusiness::getStatus, 1)
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //七大员新考题库商品
|
|
|
|
+ List<ExternalQuestionVo> collect = questionVos.stream().filter(x -> x.getParentId() == 1).collect(Collectors.toList());
|
|
|
|
+ for (ExternalQuestionVo item : collect) {
|
|
|
|
+ //创建商品
|
|
|
|
+ Goods goods = new Goods();
|
|
|
|
+ goods.setGoodsName(item.getName());
|
|
|
|
+ goods.setYear(2023L);
|
|
|
|
+ goods.setSupplyId(2L);
|
|
|
|
+ goods.setCode(ServletUtils.getEncoded("SP"));
|
|
|
|
+ goods.setGoodsType(2);
|
|
|
|
+ goods.setEducationTypeId(educationType.getId());
|
|
|
|
+ goods.setBusinessId(business.getId());
|
|
|
|
+ goods.setProjectId(projectType.getId().intValue());
|
|
|
|
+ goods.setStandPrice(new BigDecimal("150.00"));
|
|
|
|
+ goods.setLowestPrice(new BigDecimal("150.00"));
|
|
|
|
+ goods.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ goods.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ goods.setStatus(1);
|
|
|
|
+ goods.setGoodsStatus(0);
|
|
|
|
+ iGoodsService.save(goods);
|
|
|
|
+
|
|
|
|
+ //题库
|
|
|
|
+ List<ExternalQuestionVo> questionVos1 = questionVos.stream()
|
|
|
|
+ .filter(x -> x.getParentId().equals(item.getMeasureModelId())).sorted(Comparator.comparing(ExternalQuestionVo::getSortNumber)).collect(Collectors.toList());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(questionVos1)){
|
|
|
|
+ for (ExternalQuestionVo item1 : questionVos1) {
|
|
|
|
+ //模块卷
|
|
|
|
+ QuestionModule module = new QuestionModule();
|
|
|
|
+ module.setCode(ServletUtils.getEncoded("MJ"));
|
|
|
|
+ module.setModuleName(item1.getName());
|
|
|
|
+ module.setPublishStatus(1L);
|
|
|
|
+ module.setStatus(1);
|
|
|
|
+ module.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ module.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ iQuestionModuleService.save(module);
|
|
|
|
+ //模块卷业务层
|
|
|
|
+ QuestionBusiness questionBusiness = new QuestionBusiness();
|
|
|
|
+ questionBusiness.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness.setMajorId(module.getModuleExamId());
|
|
|
|
+ questionBusiness.setType(4);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness);
|
|
|
|
+ //题库模块关联
|
|
|
|
+ GoodsAttached goodsAttached = new GoodsAttached();
|
|
|
|
+ goodsAttached.setGoodsId(goods.getGoodsId());
|
|
|
|
+ goodsAttached.setMajorId(module.getModuleExamId());
|
|
|
|
+ goodsAttached.setType(1);
|
|
|
|
+ goodsAttached.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ goodsAttached.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ iGoodsAttachedService.save(goodsAttached);
|
|
|
|
+
|
|
|
|
+ //章卷
|
|
|
|
+ List<ExternalQuestionVo> questionVos2 = questionVos.stream()
|
|
|
|
+ .filter(x -> x.getParentId().equals(item1.getMeasureModelId()))
|
|
|
|
+ .sorted(Comparator.comparing(ExternalQuestionVo::getSortNumber)).collect(Collectors.toList());
|
|
|
|
+ for (ExternalQuestionVo item2 : questionVos2) {
|
|
|
|
+ QuestionChapter questionChapter = new QuestionChapter();
|
|
|
|
+ questionChapter.setName(item2.getName());
|
|
|
|
+ questionChapter.setStatus(1);
|
|
|
|
+ questionChapter.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ questionChapter.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ questionChapter.setPublishStatus(1L);
|
|
|
|
+ questionChapter.setCode(ServletUtils.getEncoded("ZJ"));
|
|
|
|
+ iQuestionChapterService.save(questionChapter);
|
|
|
|
+
|
|
|
|
+ //章卷业务
|
|
|
|
+ QuestionBusiness questionBusiness1 = new QuestionBusiness();
|
|
|
|
+ questionBusiness1.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness1.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness1.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness1.setMajorId(questionChapter.getChapterExamId());
|
|
|
|
+ questionBusiness1.setType(3);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness1);
|
|
|
|
+
|
|
|
|
+ //模块章卷关联
|
|
|
|
+ QuestionModuleChapter moduleChapter = new QuestionModuleChapter();
|
|
|
|
+ moduleChapter.setModuleExamId(module.getModuleExamId());
|
|
|
|
+ moduleChapter.setChapterExamId(questionChapter.getChapterExamId());
|
|
|
|
+ moduleChapter.setSort(item2.getSortNumber().longValue());
|
|
|
|
+ iQuestionModuleChapterService.save(moduleChapter);
|
|
|
|
+
|
|
|
|
+ if (ObjectUtils.isNotNull(item2.getIsTopic()) && item2.getIsTopic()){
|
|
|
|
+ //获取题目内容
|
|
|
|
+ String topParam = String.format("MeasureModelId=%s",item2.getMeasureModelId());
|
|
|
|
+ String topRespone = HttpUtils.sendGet(QUESTION_DETAIL, topParam);
|
|
|
|
+ List<ExternalQuestionDetailVo> questionDetailVos = JSONArray.parseArray(topRespone, ExternalQuestionDetailVo.class);
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isNotEmpty(questionDetailVos)){
|
|
|
|
+ //创建试卷
|
|
|
|
+ Exam exam = new Exam();
|
|
|
|
+ exam.setCode(ServletUtils.getEncoded("SJ"));
|
|
|
|
+ exam.setStatus(1);
|
|
|
|
+ exam.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ exam.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ exam.setExamName(item2.getName() + "测试卷");
|
|
|
|
+ exam.setPublishStatus(1L);
|
|
|
|
+ exam.setDoType(1);
|
|
|
|
+ iExamService.save(exam);
|
|
|
|
+ //试卷业务
|
|
|
|
+ QuestionBusiness questionBusiness2 = new QuestionBusiness();
|
|
|
|
+ questionBusiness2.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness2.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness2.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness2.setMajorId(exam.getExamId());
|
|
|
|
+ questionBusiness2.setType(2);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness2);
|
|
|
|
+
|
|
|
|
+ //章卷关联
|
|
|
|
+ QuestionChapterExam chapterExam = new QuestionChapterExam();
|
|
|
|
+ chapterExam.setChapterExamId(questionChapter.getChapterExamId());
|
|
|
|
+ chapterExam.setExamId(exam.getExamId());
|
|
|
|
+ chapterExam.setSort(item2.getSortNumber().longValue());
|
|
|
|
+ iQuestionChapterExamService.save(chapterExam);
|
|
|
|
+ for (ExternalQuestionDetailVo detailVo : questionDetailVos) {
|
|
|
|
+ switch (detailVo.getTopicType()){
|
|
|
|
+ case 1://单选题
|
|
|
|
+ Question question = new Question();
|
|
|
|
+ question.setContent(detailVo.getTitle());
|
|
|
|
+ question.setType(1);
|
|
|
|
+ question.setStatus(1);
|
|
|
|
+ question.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ question.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ question.setAnalysisContent(detailVo.getDescription());
|
|
|
|
+ question.setPublishStatus(1);
|
|
|
|
+ question.setCode(ServletUtils.getEncoded("TM"));
|
|
|
|
+ question.setCreateBy("(系统)外部题库导入");
|
|
|
|
+ if (CollectionUtils.isNotEmpty(detailVo.getChildList())){
|
|
|
|
+ List<QuestionDetailVo> detail = new ArrayList<>();
|
|
|
|
+ Integer index = 0;
|
|
|
|
+ for (int i = 0; i < detailVo.getChildList().size(); i++) {
|
|
|
|
+ ExternalQuestionChildVo childVo = detailVo.getChildList().get(i);
|
|
|
|
+ QuestionDetailVo questionDetailVo = new QuestionDetailVo();
|
|
|
|
+ questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
|
+ questionDetailVo.setOptionsId(i);
|
|
|
|
+ if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
+ index = i;
|
|
|
|
+ }
|
|
|
|
+ detail.add(questionDetailVo);
|
|
|
|
+ }
|
|
|
|
+ String s = JSONArray.toJSONString(detail);
|
|
|
|
+ question.setAnswerQuestion(index.toString());
|
|
|
|
+ question.setJsonStr(s);
|
|
|
|
+ }
|
|
|
|
+ save(question);
|
|
|
|
+ //题目业务
|
|
|
|
+ QuestionBusiness questionBusiness3 = new QuestionBusiness();
|
|
|
|
+ questionBusiness3.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness3.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness3.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness3.setMajorId(question.getQuestionId());
|
|
|
|
+ questionBusiness3.setType(1);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness3);
|
|
|
|
+
|
|
|
|
+ //试卷题目关联
|
|
|
|
+ ExamQuestion examQuestion = new ExamQuestion();
|
|
|
|
+ examQuestion.setExamId(exam.getExamId());
|
|
|
|
+ examQuestion.setQuestionId(question.getQuestionId());
|
|
|
|
+ examQuestion.setSort(detailVo.getSortNumber());
|
|
|
|
+ examQuestion.setScore(BigDecimal.ZERO);
|
|
|
|
+ examQuestion.setPartScore(BigDecimal.ZERO);
|
|
|
|
+ iExamQuestionService.save(examQuestion);
|
|
|
|
+ break;
|
|
|
|
+ case 2://多选题
|
|
|
|
+ Question question1 = new Question();
|
|
|
|
+ question1.setContent(detailVo.getTitle());
|
|
|
|
+ question1.setType(2);
|
|
|
|
+ question1.setStatus(1);
|
|
|
|
+ question1.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ question1.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ question1.setAnalysisContent(detailVo.getDescription());
|
|
|
|
+ question1.setPublishStatus(1);
|
|
|
|
+ question1.setCode(ServletUtils.getEncoded("TM"));
|
|
|
|
+ question1.setCreateBy("(系统)外部题库导入");
|
|
|
|
+ if (CollectionUtils.isNotEmpty(detailVo.getChildList())){
|
|
|
|
+ List<QuestionDetailVo> detail = new ArrayList<>();
|
|
|
|
+ List<String> index = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < detailVo.getChildList().size(); i++) {
|
|
|
|
+ ExternalQuestionChildVo childVo = detailVo.getChildList().get(i);
|
|
|
|
+ QuestionDetailVo questionDetailVo = new QuestionDetailVo();
|
|
|
|
+ questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
|
+ questionDetailVo.setOptionsId(i);
|
|
|
|
+ if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
+ index.add(i+"");
|
|
|
|
+ }
|
|
|
|
+ detail.add(questionDetailVo);
|
|
|
|
+ }
|
|
|
|
+ String s = JSONArray.toJSONString(detail);
|
|
|
|
+ question1.setAnswerQuestion(index.stream().collect(Collectors.joining(",")));
|
|
|
|
+ question1.setJsonStr(s);
|
|
|
|
+ }
|
|
|
|
+ save(question1);
|
|
|
|
+ //题目业务
|
|
|
|
+ QuestionBusiness questionBusiness4 = new QuestionBusiness();
|
|
|
|
+ questionBusiness4.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness4.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness4.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness4.setMajorId(question1.getQuestionId());
|
|
|
|
+ questionBusiness4.setType(1);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness4);
|
|
|
|
+
|
|
|
|
+ //试卷题目关联
|
|
|
|
+ ExamQuestion examQuestion1 = new ExamQuestion();
|
|
|
|
+ examQuestion1.setExamId(exam.getExamId());
|
|
|
|
+ examQuestion1.setQuestionId(question1.getQuestionId());
|
|
|
|
+ examQuestion1.setSort(detailVo.getSortNumber());
|
|
|
|
+ examQuestion1.setScore(BigDecimal.ZERO);
|
|
|
|
+ examQuestion1.setPartScore(BigDecimal.ZERO);
|
|
|
|
+ iExamQuestionService.save(examQuestion1);
|
|
|
|
+ break;
|
|
|
|
+ case 4://判断题
|
|
|
|
+ Question question2 = new Question();
|
|
|
|
+ question2.setContent(detailVo.getTitle());
|
|
|
|
+ question2.setType(3);
|
|
|
|
+ question2.setStatus(1);
|
|
|
|
+ question2.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ question2.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ question2.setAnalysisContent(detailVo.getDescription());
|
|
|
|
+ question2.setPublishStatus(1);
|
|
|
|
+ question2.setCode(ServletUtils.getEncoded("TM"));
|
|
|
|
+ question2.setCreateBy("(系统)外部题库导入");
|
|
|
|
+ if (CollectionUtils.isNotEmpty(detailVo.getChildList())){
|
|
|
|
+ ExternalQuestionChildVo childVo = detailVo.getChildList().stream().filter(x -> ObjectUtils.isNotNull(x.getIsAnswer()) && x.getIsAnswer()).findFirst().orElse(null);
|
|
|
|
+ if (ObjectUtils.isNotNull(childVo)){
|
|
|
|
+ if ("正确".equals(childVo.getOptionTitle())){
|
|
|
|
+ question2.setAnswerQuestion("1");
|
|
|
|
+ }else {
|
|
|
|
+ question2.setAnswerQuestion("0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ save(question2);
|
|
|
|
+ //题目业务
|
|
|
|
+ QuestionBusiness questionBusiness5 = new QuestionBusiness();
|
|
|
|
+ questionBusiness5.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness5.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness5.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness5.setMajorId(question2.getQuestionId());
|
|
|
|
+ questionBusiness5.setType(1);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness5);
|
|
|
|
+
|
|
|
|
+ //试卷题目关联
|
|
|
|
+ ExamQuestion examQuestion2 = new ExamQuestion();
|
|
|
|
+ examQuestion2.setExamId(exam.getExamId());
|
|
|
|
+ examQuestion2.setQuestionId(question2.getQuestionId());
|
|
|
|
+ examQuestion2.setSort(detailVo.getSortNumber());
|
|
|
|
+ examQuestion2.setScore(BigDecimal.ZERO);
|
|
|
|
+ examQuestion2.setPartScore(BigDecimal.ZERO);
|
|
|
|
+ iExamQuestionService.save(examQuestion2);
|
|
|
|
+ break;
|
|
|
|
+ case 5://案例题
|
|
|
|
+ Question question3 = new Question();
|
|
|
|
+ question3.setContent(detailVo.getTitle());
|
|
|
|
+ question3.setType(4);
|
|
|
|
+ question3.setStatus(1);
|
|
|
|
+ question3.setCreateTime(DateUtils.getNowTime());
|
|
|
|
+ question3.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
+ question3.setPublishStatus(1);
|
|
|
|
+ question3.setCode(ServletUtils.getEncoded("TM"));
|
|
|
|
+ question3.setCreateBy("(系统)外部题库导入");
|
|
|
|
+ if (CollectionUtils.isNotEmpty(detailVo.getChildTopicLict())){
|
|
|
|
+ List<QuestionInfoVo> infoVoList = new ArrayList<>();
|
|
|
|
+ for (ExternalQuestionChildTopicVo topicVo : detailVo.getChildTopicLict()) {
|
|
|
|
+ switch (topicVo.getTopicType()){
|
|
|
|
+ case 1://单选
|
|
|
|
+ QuestionInfoVo infoVo = new QuestionInfoVo();
|
|
|
|
+ infoVo.setContent(topicVo.getTitle());
|
|
|
|
+ infoVo.setAnalysisContent(topicVo.getDescription());
|
|
|
|
+ infoVo.setType(1);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(topicVo.getChildList())){
|
|
|
|
+ List<QuestionDetailVo> voList = new ArrayList<>();
|
|
|
|
+ Integer index = 0;
|
|
|
|
+ for (int i = 0; i < topicVo.getChildList().size(); i++) {
|
|
|
|
+ ExternalQuestionChildVo childVo = topicVo.getChildList().get(i);
|
|
|
|
+ QuestionDetailVo detailVo1 = new QuestionDetailVo();
|
|
|
|
+ detailVo1.setOptionsId(i);
|
|
|
|
+ detailVo1.setContent(childVo.getOptionTitle());
|
|
|
|
+ if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
+ index = i;
|
|
|
|
+ }
|
|
|
|
+ voList.add(detailVo1);
|
|
|
|
+ }
|
|
|
|
+ infoVo.setAnswerQuestion(index.toString());
|
|
|
|
+ infoVo.setOptionsList(voList);
|
|
|
|
+ }
|
|
|
|
+ infoVoList.add(infoVo);
|
|
|
|
+ break;
|
|
|
|
+ case 2://多选
|
|
|
|
+ QuestionInfoVo infoVo1 = new QuestionInfoVo();
|
|
|
|
+ infoVo1.setContent(topicVo.getTitle());
|
|
|
|
+ infoVo1.setAnalysisContent(topicVo.getDescription());
|
|
|
|
+ infoVo1.setType(2);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(topicVo.getChildList())){
|
|
|
|
+ List<QuestionDetailVo> voList = new ArrayList<>();
|
|
|
|
+ List<String> indexList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < topicVo.getChildList().size(); i++) {
|
|
|
|
+ ExternalQuestionChildVo childVo = topicVo.getChildList().get(i);
|
|
|
|
+ QuestionDetailVo detailVo1 = new QuestionDetailVo();
|
|
|
|
+ detailVo1.setOptionsId(i);
|
|
|
|
+ detailVo1.setContent(childVo.getOptionTitle());
|
|
|
|
+ if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
+ indexList.add(i+"");
|
|
|
|
+ }
|
|
|
|
+ voList.add(detailVo1);
|
|
|
|
+ }
|
|
|
|
+ infoVo1.setAnswerQuestion(indexList.stream().collect(Collectors.joining(",")));
|
|
|
|
+ infoVo1.setOptionsList(voList);
|
|
|
|
+ }
|
|
|
|
+ infoVoList.add(infoVo1);
|
|
|
|
+ break;
|
|
|
|
+ case 4://判断题
|
|
|
|
+ QuestionInfoVo infoVo2 = new QuestionInfoVo();
|
|
|
|
+ infoVo2.setContent(topicVo.getTitle());
|
|
|
|
+ infoVo2.setAnalysisContent(topicVo.getDescription());
|
|
|
|
+ infoVo2.setType(3);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(topicVo.getChildList())){
|
|
|
|
+ ExternalQuestionChildVo childVo = topicVo.getChildList().stream().filter(x -> ObjectUtils.isNotNull(x.getIsAnswer()) && x.getIsAnswer()).findFirst().orElse(null);
|
|
|
|
+ if (ObjectUtils.isNotNull(childVo)){
|
|
|
|
+ if ("正确".equals(childVo.getOptionTitle())){
|
|
|
|
+ infoVo2.setAnswerQuestion("1");
|
|
|
|
+ }else {
|
|
|
|
+ infoVo2.setAnswerQuestion("0");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ infoVoList.add(infoVo2);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ question3.setJsonStr(JSONArray.toJSONString(infoVoList));
|
|
|
|
+ }
|
|
|
|
+ save(question3);
|
|
|
|
+ //题目业务
|
|
|
|
+ QuestionBusiness questionBusiness6 = new QuestionBusiness();
|
|
|
|
+ questionBusiness6.setEducationTypeId(educationType.getId());
|
|
|
|
+ questionBusiness6.setBusinessId(business.getId());
|
|
|
|
+ questionBusiness6.setProjectId(projectType.getId());
|
|
|
|
+ questionBusiness6.setMajorId(question3.getQuestionId());
|
|
|
|
+ questionBusiness6.setType(1);
|
|
|
|
+ iQuestionBusinessService.save(questionBusiness6);
|
|
|
|
+
|
|
|
|
+ //试卷题目关联
|
|
|
|
+ ExamQuestion examQuestion3 = new ExamQuestion();
|
|
|
|
+ examQuestion3.setExamId(exam.getExamId());
|
|
|
|
+ examQuestion3.setQuestionId(question3.getQuestionId());
|
|
|
|
+ examQuestion3.setSort(detailVo.getSortNumber());
|
|
|
|
+ examQuestion3.setScore(BigDecimal.ZERO);
|
|
|
|
+ examQuestion3.setPartScore(BigDecimal.ZERO);
|
|
|
|
+ iExamQuestionService.save(examQuestion3);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ String encrypt = EncryptHandler.encrypt("440506198204281419");
|
|
|
|
+ System.out.println("encrypt = " + encrypt);
|
|
}
|
|
}
|
|
|
|
|
|
private boolean checkNameUnique(Question entity) {
|
|
private boolean checkNameUnique(Question entity) {
|