|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.github.pagehelper.Page;
|
|
@@ -30,18 +31,15 @@ import com.zhongzheng.modules.bank.domain.*;
|
|
|
import com.zhongzheng.modules.bank.mapper.QuestionMapper;
|
|
|
import com.zhongzheng.modules.bank.service.*;
|
|
|
import com.zhongzheng.modules.bank.vo.*;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseBusiness;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseEducationType;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseProjectType;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseSubject;
|
|
|
-import com.zhongzheng.modules.course.service.ICourseBusinessService;
|
|
|
-import com.zhongzheng.modules.course.service.ICourseEducationTypeService;
|
|
|
-import com.zhongzheng.modules.course.service.ICourseProjectTypeService;
|
|
|
-import com.zhongzheng.modules.course.service.ICourseSubjectService;
|
|
|
+import com.zhongzheng.modules.course.domain.*;
|
|
|
+import com.zhongzheng.modules.course.service.*;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamKnowledgeAddBo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamKnowledgeBusinessAddBo;
|
|
|
import com.zhongzheng.modules.exam.domain.ExamKnowledge;
|
|
|
+import com.zhongzheng.modules.exam.domain.ExamPaper;
|
|
|
+import com.zhongzheng.modules.exam.service.IExamApplyService;
|
|
|
import com.zhongzheng.modules.exam.service.IExamKnowledgeService;
|
|
|
+import com.zhongzheng.modules.exam.service.IExamPaperService;
|
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsAttached;
|
|
@@ -109,6 +107,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
@Autowired
|
|
|
private ICourseSubjectService iCourseSubjectService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseSubjectProjectService iCourseSubjectProjectService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IExamKnowledgeService iExamKnowledgeService;
|
|
|
|
|
@@ -148,6 +149,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
@Autowired
|
|
|
private IExamService iExamService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IExamPaperService iExamPaperService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private IGoodsService iGoodsService;
|
|
|
|
|
@@ -157,6 +161,12 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
@Autowired
|
|
|
private OssService ossService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IMajorService iMajorService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMajorProjectService iMajorProjectService;
|
|
|
+
|
|
|
@Value("${aliyun.oss.endpoint}")
|
|
|
private String ossHost;
|
|
|
|
|
@@ -166,6 +176,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
@Value("${oldSys.questionDetail}")
|
|
|
private String QUESTION_DETAIL;
|
|
|
|
|
|
+ @Value("${aliyun.oss.endpoint}")
|
|
|
+ private String OSS_PREFIX;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public QuestionVo queryById(Long questionId) {
|
|
@@ -3111,6 +3124,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void questionImport() {
|
|
|
String respone = HttpUtils.sendGet(QUESTION, "");
|
|
|
List<ExternalQuestionVo> questionVos = JSONArray.parseArray(respone, ExternalQuestionVo.class);
|
|
@@ -3137,10 +3151,52 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
.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).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());
|
|
@@ -3157,6 +3213,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
goods.setUpdateTime(DateUtils.getNowTime());
|
|
|
goods.setStatus(1);
|
|
|
goods.setGoodsStatus(0);
|
|
|
+ goods.setMajorId(majorId);
|
|
|
+ goods.setSubjectIds(subjectId.toString());
|
|
|
iGoodsService.save(goods);
|
|
|
|
|
|
//题库
|
|
@@ -3180,6 +3238,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness.setProjectId(projectType.getId());
|
|
|
questionBusiness.setMajorId(module.getModuleExamId());
|
|
|
questionBusiness.setType(4);
|
|
|
+ questionBusiness.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness);
|
|
|
//题库模块关联
|
|
|
GoodsAttached goodsAttached = new GoodsAttached();
|
|
@@ -3211,6 +3270,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness1.setProjectId(projectType.getId());
|
|
|
questionBusiness1.setMajorId(questionChapter.getChapterExamId());
|
|
|
questionBusiness1.setType(3);
|
|
|
+ questionBusiness1.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness1);
|
|
|
|
|
|
//模块章卷关联
|
|
@@ -3227,6 +3287,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
List<ExternalQuestionDetailVo> questionDetailVos = JSONArray.parseArray(topRespone, ExternalQuestionDetailVo.class);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(questionDetailVos)){
|
|
|
+ //处理图片
|
|
|
+ handlePhoto(questionDetailVos);
|
|
|
//创建试卷
|
|
|
Exam exam = new Exam();
|
|
|
exam.setCode(ServletUtils.getEncoded("SJ"));
|
|
@@ -3236,6 +3298,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
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();
|
|
@@ -3244,6 +3314,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness2.setProjectId(projectType.getId());
|
|
|
questionBusiness2.setMajorId(exam.getExamId());
|
|
|
questionBusiness2.setType(2);
|
|
|
+ questionBusiness2.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness2);
|
|
|
|
|
|
//章卷关联
|
|
@@ -3272,9 +3343,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
ExternalQuestionChildVo childVo = detailVo.getChildList().get(i);
|
|
|
QuestionDetailVo questionDetailVo = new QuestionDetailVo();
|
|
|
questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
- questionDetailVo.setOptionsId(i);
|
|
|
+ questionDetailVo.setOptionsId(i +1);
|
|
|
if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
- index = i;
|
|
|
+ index = i + 1;
|
|
|
}
|
|
|
detail.add(questionDetailVo);
|
|
|
}
|
|
@@ -3290,6 +3361,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness3.setProjectId(projectType.getId());
|
|
|
questionBusiness3.setMajorId(question.getQuestionId());
|
|
|
questionBusiness3.setType(1);
|
|
|
+ questionBusiness3.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness3);
|
|
|
|
|
|
//试卷题目关联
|
|
@@ -3319,9 +3391,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
ExternalQuestionChildVo childVo = detailVo.getChildList().get(i);
|
|
|
QuestionDetailVo questionDetailVo = new QuestionDetailVo();
|
|
|
questionDetailVo.setContent(childVo.getOptionTitle());
|
|
|
- questionDetailVo.setOptionsId(i);
|
|
|
+ questionDetailVo.setOptionsId(i + 1);
|
|
|
if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
- index.add(i+"");
|
|
|
+ Integer x = i + 1;
|
|
|
+ index.add(x +"");
|
|
|
}
|
|
|
detail.add(questionDetailVo);
|
|
|
}
|
|
@@ -3337,6 +3410,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness4.setProjectId(projectType.getId());
|
|
|
questionBusiness4.setMajorId(question1.getQuestionId());
|
|
|
questionBusiness4.setType(1);
|
|
|
+ questionBusiness4.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness4);
|
|
|
|
|
|
//试卷题目关联
|
|
@@ -3377,6 +3451,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness5.setProjectId(projectType.getId());
|
|
|
questionBusiness5.setMajorId(question2.getQuestionId());
|
|
|
questionBusiness5.setType(1);
|
|
|
+ questionBusiness5.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness5);
|
|
|
|
|
|
//试卷题目关联
|
|
@@ -3413,10 +3488,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
for (int i = 0; i < topicVo.getChildList().size(); i++) {
|
|
|
ExternalQuestionChildVo childVo = topicVo.getChildList().get(i);
|
|
|
QuestionDetailVo detailVo1 = new QuestionDetailVo();
|
|
|
- detailVo1.setOptionsId(i);
|
|
|
+ detailVo1.setOptionsId(i + 1);
|
|
|
detailVo1.setContent(childVo.getOptionTitle());
|
|
|
if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
- index = i;
|
|
|
+ index = i + 1;
|
|
|
}
|
|
|
voList.add(detailVo1);
|
|
|
}
|
|
@@ -3436,10 +3511,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
for (int i = 0; i < topicVo.getChildList().size(); i++) {
|
|
|
ExternalQuestionChildVo childVo = topicVo.getChildList().get(i);
|
|
|
QuestionDetailVo detailVo1 = new QuestionDetailVo();
|
|
|
- detailVo1.setOptionsId(i);
|
|
|
+ detailVo1.setOptionsId(i + 1);
|
|
|
detailVo1.setContent(childVo.getOptionTitle());
|
|
|
if (ObjectUtils.isNotNull(childVo.getIsAnswer()) && childVo.getIsAnswer()){
|
|
|
- indexList.add(i+"");
|
|
|
+ Integer x = i + 1 ;
|
|
|
+ indexList.add(x+"");
|
|
|
}
|
|
|
voList.add(detailVo1);
|
|
|
}
|
|
@@ -3478,6 +3554,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
questionBusiness6.setProjectId(projectType.getId());
|
|
|
questionBusiness6.setMajorId(question3.getQuestionId());
|
|
|
questionBusiness6.setType(1);
|
|
|
+ questionBusiness6.setSubjectId(subjectId);
|
|
|
iQuestionBusinessService.save(questionBusiness6);
|
|
|
|
|
|
//试卷题目关联
|
|
@@ -3499,6 +3576,64 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void handlePhoto(List<ExternalQuestionDetailVo> questionDetailVos) {
|
|
|
+ String prefix = "\\Uploads\\qdytopic\\";
|
|
|
+ String upStr = OSS_PREFIX + "/web/Uploads/qdytopic/";
|
|
|
+ for (ExternalQuestionDetailVo detailVo : questionDetailVos) {
|
|
|
+ if (StringUtils.isNotBlank(detailVo.getTitle()) && detailVo.getTitle().contains(prefix)){
|
|
|
+ String title = detailVo.getTitle();
|
|
|
+ String replace = title.replace(prefix, upStr);
|
|
|
+ detailVo.setTitle(replace);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(detailVo.getDescription()) && detailVo.getDescription().contains(prefix)){
|
|
|
+ String description = detailVo.getDescription();
|
|
|
+ String replace = description.replace(prefix, upStr);
|
|
|
+ detailVo.setDescription(replace);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(detailVo.getChildList())){
|
|
|
+ List<ExternalQuestionChildVo> childList = detailVo.getChildList();
|
|
|
+ for (ExternalQuestionChildVo childVo : childList) {
|
|
|
+ if (StringUtils.isNotBlank(childVo.getOptionTitle()) && childVo.getOptionTitle().contains(prefix)){
|
|
|
+ String optionTitle = childVo.getOptionTitle();
|
|
|
+ String replace = optionTitle.replace(prefix, upStr);
|
|
|
+ childVo.setOptionTitle(replace);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(detailVo.getChildTopicLict())){
|
|
|
+ List<ExternalQuestionChildTopicVo> childTopicLict = detailVo.getChildTopicLict();
|
|
|
+ for (ExternalQuestionChildTopicVo childTopicVo : childTopicLict) {
|
|
|
+ if (StringUtils.isNotBlank(childTopicVo.getTitle()) && childTopicVo.getTitle().contains(prefix)){
|
|
|
+ String optionTitle = childTopicVo.getTitle();
|
|
|
+ String replace = optionTitle.replace(prefix, upStr);
|
|
|
+ childTopicVo.setTitle(replace);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(childTopicVo.getDescription()) && childTopicVo.getDescription().contains(prefix)){
|
|
|
+ String description = childTopicVo.getDescription();
|
|
|
+ String replace = description.replace(prefix, upStr);
|
|
|
+ childTopicVo.setDescription(replace);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(childTopicVo.getChildList())){
|
|
|
+ List<ExternalQuestionChildVo> childList = childTopicVo.getChildList();
|
|
|
+ for (ExternalQuestionChildVo childVo : childList) {
|
|
|
+ if (StringUtils.isNotBlank(childVo.getOptionTitle()) && childVo.getOptionTitle().contains(prefix)){
|
|
|
+ String optionTitle = childVo.getOptionTitle();
|
|
|
+ String replace = optionTitle.replace(prefix, upStr);
|
|
|
+ childVo.setOptionTitle(replace);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private boolean checkNameUnique(Question entity) {
|
|
|
Question info = getOne(new LambdaQueryWrapper<Question>()
|
|
|
.eq(Question::getPrefixName, entity.getPrefixName()).eq(Question::getContent, entity.getContent()).ne(Question::getStatus, -1).last("limit 1"));
|