|
@@ -181,11 +181,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
@Value("${oldSys.questionDetail}")
|
|
@Value("${oldSys.questionDetail}")
|
|
|
private String QUESTION_DETAIL;
|
|
private String QUESTION_DETAIL;
|
|
|
|
|
|
|
|
- @Value("${exam.question}")
|
|
|
|
|
- private String EXAM_QUESTION;
|
|
|
|
|
-
|
|
|
|
|
- @Value("${exam.questionDetail}")
|
|
|
|
|
- private String EXAM_QUESTION_DETAIL;
|
|
|
|
|
|
|
+// @Value("${exam.question}")
|
|
|
|
|
+// private String EXAM_QUESTION;
|
|
|
|
|
+//
|
|
|
|
|
+// @Value("${exam.questionDetail}")
|
|
|
|
|
+// private String EXAM_QUESTION_DETAIL;
|
|
|
|
|
|
|
|
@Value("${aliyun.oss.endpoint}")
|
|
@Value("${aliyun.oss.endpoint}")
|
|
|
private String OSS_PREFIX;
|
|
private String OSS_PREFIX;
|
|
@@ -3766,482 +3766,482 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public void questionImport() {
|
|
public void questionImport() {
|
|
|
- String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
|
|
- HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
- map.put("TenantId", tenantId);
|
|
|
|
|
- String respone = HttpUtils.sendPostJsonHeader(EXAM_QUESTION, "",map);
|
|
|
|
|
- JSONObject jsonObject1 = JSONObject.parseObject(respone);
|
|
|
|
|
- List<ExternalQuestionVo> questionVos = JSONArray.parseArray(jsonObject1.get("data").toString(), 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<MajorProject> list = iMajorProjectService
|
|
|
|
|
- .list(new LambdaQueryWrapper<MajorProject>()
|
|
|
|
|
- .eq(MajorProject::getProjectId, projectType.getId()));
|
|
|
|
|
- List<Major> majorList = iMajorService.listByIds(list.stream().map(MajorProject::getMajorId).collect(Collectors.toList()));
|
|
|
|
|
-
|
|
|
|
|
- //科目
|
|
|
|
|
- List<CourseSubjectProject> list1 = iCourseSubjectProjectService
|
|
|
|
|
- .list(new LambdaQueryWrapper<CourseSubjectProject>()
|
|
|
|
|
- .eq(CourseSubjectProject::getProjectId, projectType.getId()));
|
|
|
|
|
- List<CourseSubject> subjectList = iCourseSubjectService.listByIds(list1.stream().map(CourseSubjectProject::getSubjectId).collect(Collectors.toList()));
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- //七大员新考题库商品
|
|
|
|
|
- List<ExternalQuestionVo> collect = questionVos.stream().filter(x -> x.getParentId() == 1)
|
|
|
|
|
- .sorted(Comparator.comparing(ExternalQuestionVo::getSortNumber))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- for (ExternalQuestionVo item : collect) {
|
|
|
|
|
- //专业顺序
|
|
|
|
|
-
|
|
|
|
|
- //劳务员考核评价大纲及习题集
|
|
|
|
|
- //施工员考核评价大纲及习题集(土建方向)
|
|
|
|
|
- //施工员考核评价大纲及习题集(市政方向)
|
|
|
|
|
- //施工员考核评价大纲及习题集(装饰方向)
|
|
|
|
|
- //施工员考核评价大纲及习题集(设备方向)
|
|
|
|
|
- //机械员考核评价大纲及习题集
|
|
|
|
|
- //材料员考核评价大纲及习题集
|
|
|
|
|
- //标准员考核评价大纲及习题集
|
|
|
|
|
- //质量员考核评价大纲及习题集(土建方向)
|
|
|
|
|
- //质量员考核评价大纲及习题集(市政方向)
|
|
|
|
|
- //质量员考核评价大纲及习题集(装饰方向)
|
|
|
|
|
- //质量员考核评价大纲及习题集(设备方向)
|
|
|
|
|
- //资料员考核评价大纲及习题集
|
|
|
|
|
- Major major = majorList.stream().filter(x -> x.getCategoryName().equals(item.getTopicNoteTypeNum())).findFirst().orElse(null);
|
|
|
|
|
- Long majorId = 0L;
|
|
|
|
|
- if (ObjectUtils.isNotNull(major)){
|
|
|
|
|
- majorId = major.getId();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //科目
|
|
|
|
|
- CourseSubject courseSubject = subjectList.stream().filter(x -> x.getSubjectName().equals(item.getTopicNoteTypeNum())).findFirst().orElse(null);
|
|
|
|
|
- Long subjectId = 0L;
|
|
|
|
|
- if (ObjectUtils.isNotNull(courseSubject)){
|
|
|
|
|
- subjectId = courseSubject.getId();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- //创建商品
|
|
|
|
|
- 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);
|
|
|
|
|
- goods.setMajorId(majorId);
|
|
|
|
|
- goods.setSubjectIds(subjectId.toString());
|
|
|
|
|
- iGoodsService.save(goods);
|
|
|
|
|
-
|
|
|
|
|
- String upStr1 = "web/Uploads/qdytopic/";
|
|
|
|
|
- //题库
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness.setSubjectId(subjectId);
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness1.setSubjectId(subjectId);
|
|
|
|
|
- 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());
|
|
|
|
|
- log.error(topParam);
|
|
|
|
|
- String respone2 = HttpUtils.sendPostJsonHeader(EXAM_QUESTION_DETAIL, topParam,map);
|
|
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(respone2);
|
|
|
|
|
- log.error(respone2);
|
|
|
|
|
- List<ExternalQuestionDetailVo> questionDetailVos = JSONArray.parseArray(jsonObject.get("data").toString(), ExternalQuestionDetailVo.class);
|
|
|
|
|
-
|
|
|
|
|
- if (CollectionUtils.isNotEmpty(questionDetailVos)){
|
|
|
|
|
- //处理图片
|
|
|
|
|
- handlePhoto(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);
|
|
|
|
|
- //试卷类型
|
|
|
|
|
- ExamPaper paper = iExamPaperService.getOne(new LambdaQueryWrapper<ExamPaper>()
|
|
|
|
|
- .eq(ExamPaper::getPaperName, "普通练习")
|
|
|
|
|
- .eq(ExamPaper::getStatus, 1)
|
|
|
|
|
- .last("limit 1"));
|
|
|
|
|
- if (ObjectUtils.isNotNull(paper)){
|
|
|
|
|
- exam.setExamPaperId(paper.getPaperId());
|
|
|
|
|
- }
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness2.setSubjectId(subjectId);
|
|
|
|
|
- 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();
|
|
|
|
|
- if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
- questionDetailVo.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
- questionDetailVo.setContent("如图所示");
|
|
|
|
|
- }else {
|
|
|
|
|
- questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
|
|
- }
|
|
|
|
|
- questionDetailVo.setOptionsId(i +1);
|
|
|
|
|
- if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
- index = i + 1;
|
|
|
|
|
- }
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness3.setSubjectId(subjectId);
|
|
|
|
|
- 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();
|
|
|
|
|
- if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
- questionDetailVo.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
- questionDetailVo.setContent("如图所示");
|
|
|
|
|
- }else {
|
|
|
|
|
- questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
|
|
- }
|
|
|
|
|
- questionDetailVo.setOptionsId(i + 1);
|
|
|
|
|
- if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
- Integer x = i + 1;
|
|
|
|
|
- index.add(x +"");
|
|
|
|
|
- }
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness4.setSubjectId(subjectId);
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness5.setSubjectId(subjectId);
|
|
|
|
|
- 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 + 1);
|
|
|
|
|
- if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
- detailVo1.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
- detailVo1.setContent("如图所示");
|
|
|
|
|
- }else {
|
|
|
|
|
- detailVo1.setContent(childVo.getOptionTitle());
|
|
|
|
|
- }
|
|
|
|
|
- if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
- index = i + 1;
|
|
|
|
|
- }
|
|
|
|
|
- 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 + 1);
|
|
|
|
|
- if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
- detailVo1.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
- detailVo1.setContent("如图所示");
|
|
|
|
|
- }else {
|
|
|
|
|
- detailVo1.setContent(childVo.getOptionTitle());
|
|
|
|
|
- }
|
|
|
|
|
- if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
- Integer x = i + 1 ;
|
|
|
|
|
- indexList.add(x+"");
|
|
|
|
|
- }
|
|
|
|
|
- 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);
|
|
|
|
|
- questionBusiness6.setSubjectId(subjectId);
|
|
|
|
|
- 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;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
|
|
+// HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
+// map.put("TenantId", tenantId);
|
|
|
|
|
+// String respone = HttpUtils.sendPostJsonHeader(EXAM_QUESTION, "",map);
|
|
|
|
|
+// JSONObject jsonObject1 = JSONObject.parseObject(respone);
|
|
|
|
|
+// List<ExternalQuestionVo> questionVos = JSONArray.parseArray(jsonObject1.get("data").toString(), 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<MajorProject> list = iMajorProjectService
|
|
|
|
|
+// .list(new LambdaQueryWrapper<MajorProject>()
|
|
|
|
|
+// .eq(MajorProject::getProjectId, projectType.getId()));
|
|
|
|
|
+// List<Major> majorList = iMajorService.listByIds(list.stream().map(MajorProject::getMajorId).collect(Collectors.toList()));
|
|
|
|
|
+//
|
|
|
|
|
+// //科目
|
|
|
|
|
+// List<CourseSubjectProject> list1 = iCourseSubjectProjectService
|
|
|
|
|
+// .list(new LambdaQueryWrapper<CourseSubjectProject>()
|
|
|
|
|
+// .eq(CourseSubjectProject::getProjectId, projectType.getId()));
|
|
|
|
|
+// List<CourseSubject> subjectList = iCourseSubjectService.listByIds(list1.stream().map(CourseSubjectProject::getSubjectId).collect(Collectors.toList()));
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// //七大员新考题库商品
|
|
|
|
|
+// List<ExternalQuestionVo> collect = questionVos.stream().filter(x -> x.getParentId() == 1)
|
|
|
|
|
+// .sorted(Comparator.comparing(ExternalQuestionVo::getSortNumber))
|
|
|
|
|
+// .collect(Collectors.toList());
|
|
|
|
|
+// for (ExternalQuestionVo item : collect) {
|
|
|
|
|
+// //专业顺序
|
|
|
|
|
+//
|
|
|
|
|
+// //劳务员考核评价大纲及习题集
|
|
|
|
|
+// //施工员考核评价大纲及习题集(土建方向)
|
|
|
|
|
+// //施工员考核评价大纲及习题集(市政方向)
|
|
|
|
|
+// //施工员考核评价大纲及习题集(装饰方向)
|
|
|
|
|
+// //施工员考核评价大纲及习题集(设备方向)
|
|
|
|
|
+// //机械员考核评价大纲及习题集
|
|
|
|
|
+// //材料员考核评价大纲及习题集
|
|
|
|
|
+// //标准员考核评价大纲及习题集
|
|
|
|
|
+// //质量员考核评价大纲及习题集(土建方向)
|
|
|
|
|
+// //质量员考核评价大纲及习题集(市政方向)
|
|
|
|
|
+// //质量员考核评价大纲及习题集(装饰方向)
|
|
|
|
|
+// //质量员考核评价大纲及习题集(设备方向)
|
|
|
|
|
+// //资料员考核评价大纲及习题集
|
|
|
|
|
+// Major major = majorList.stream().filter(x -> x.getCategoryName().equals(item.getTopicNoteTypeNum())).findFirst().orElse(null);
|
|
|
|
|
+// Long majorId = 0L;
|
|
|
|
|
+// if (ObjectUtils.isNotNull(major)){
|
|
|
|
|
+// majorId = major.getId();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// //科目
|
|
|
|
|
+// CourseSubject courseSubject = subjectList.stream().filter(x -> x.getSubjectName().equals(item.getTopicNoteTypeNum())).findFirst().orElse(null);
|
|
|
|
|
+// Long subjectId = 0L;
|
|
|
|
|
+// if (ObjectUtils.isNotNull(courseSubject)){
|
|
|
|
|
+// subjectId = courseSubject.getId();
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// //创建商品
|
|
|
|
|
+// 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);
|
|
|
|
|
+// goods.setMajorId(majorId);
|
|
|
|
|
+// goods.setSubjectIds(subjectId.toString());
|
|
|
|
|
+// iGoodsService.save(goods);
|
|
|
|
|
+//
|
|
|
|
|
+// String upStr1 = "web/Uploads/qdytopic/";
|
|
|
|
|
+// //题库
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness.setSubjectId(subjectId);
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness1.setSubjectId(subjectId);
|
|
|
|
|
+// 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());
|
|
|
|
|
+// log.error(topParam);
|
|
|
|
|
+// String respone2 = HttpUtils.sendPostJsonHeader(EXAM_QUESTION_DETAIL, topParam,map);
|
|
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(respone2);
|
|
|
|
|
+// log.error(respone2);
|
|
|
|
|
+// List<ExternalQuestionDetailVo> questionDetailVos = JSONArray.parseArray(jsonObject.get("data").toString(), ExternalQuestionDetailVo.class);
|
|
|
|
|
+//
|
|
|
|
|
+// if (CollectionUtils.isNotEmpty(questionDetailVos)){
|
|
|
|
|
+// //处理图片
|
|
|
|
|
+// handlePhoto(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);
|
|
|
|
|
+// //试卷类型
|
|
|
|
|
+// ExamPaper paper = iExamPaperService.getOne(new LambdaQueryWrapper<ExamPaper>()
|
|
|
|
|
+// .eq(ExamPaper::getPaperName, "普通练习")
|
|
|
|
|
+// .eq(ExamPaper::getStatus, 1)
|
|
|
|
|
+// .last("limit 1"));
|
|
|
|
|
+// if (ObjectUtils.isNotNull(paper)){
|
|
|
|
|
+// exam.setExamPaperId(paper.getPaperId());
|
|
|
|
|
+// }
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness2.setSubjectId(subjectId);
|
|
|
|
|
+// 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();
|
|
|
|
|
+// if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
+// questionDetailVo.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
+// questionDetailVo.setContent("如图所示");
|
|
|
|
|
+// }else {
|
|
|
|
|
+// questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
|
|
+// }
|
|
|
|
|
+// questionDetailVo.setOptionsId(i +1);
|
|
|
|
|
+// if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
+// index = i + 1;
|
|
|
|
|
+// }
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness3.setSubjectId(subjectId);
|
|
|
|
|
+// 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();
|
|
|
|
|
+// if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
+// questionDetailVo.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
+// questionDetailVo.setContent("如图所示");
|
|
|
|
|
+// }else {
|
|
|
|
|
+// questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
|
|
+// }
|
|
|
|
|
+// questionDetailVo.setOptionsId(i + 1);
|
|
|
|
|
+// if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
+// Integer x = i + 1;
|
|
|
|
|
+// index.add(x +"");
|
|
|
|
|
+// }
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness4.setSubjectId(subjectId);
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness5.setSubjectId(subjectId);
|
|
|
|
|
+// 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 + 1);
|
|
|
|
|
+// if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
+// detailVo1.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
+// detailVo1.setContent("如图所示");
|
|
|
|
|
+// }else {
|
|
|
|
|
+// detailVo1.setContent(childVo.getOptionTitle());
|
|
|
|
|
+// }
|
|
|
|
|
+// if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
+// index = i + 1;
|
|
|
|
|
+// }
|
|
|
|
|
+// 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 + 1);
|
|
|
|
|
+// if (childVo.getOptionTitle().contains(upStr1)){
|
|
|
|
|
+// detailVo1.setImgUrl(getImgUrl(childVo.getOptionTitle()));
|
|
|
|
|
+// detailVo1.setContent("如图所示");
|
|
|
|
|
+// }else {
|
|
|
|
|
+// detailVo1.setContent(childVo.getOptionTitle());
|
|
|
|
|
+// }
|
|
|
|
|
+// if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
|
|
+// Integer x = i + 1 ;
|
|
|
|
|
+// indexList.add(x+"");
|
|
|
|
|
+// }
|
|
|
|
|
+// 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);
|
|
|
|
|
+// questionBusiness6.setSubjectId(subjectId);
|
|
|
|
|
+// 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;
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|