|
@@ -4,10 +4,28 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.SecurityUtils;
|
|
|
+import com.zhongzheng.modules.bank.bo.QuestionChapterExamQueryBo;
|
|
|
+import com.zhongzheng.modules.bank.bo.QuestionModuleChapterQueryBo;
|
|
|
+import com.zhongzheng.modules.bank.mapper.QuestionChapterExamMapper;
|
|
|
+import com.zhongzheng.modules.bank.mapper.QuestionModuleChapterMapper;
|
|
|
+import com.zhongzheng.modules.bank.vo.ExamVo;
|
|
|
+import com.zhongzheng.modules.bank.vo.QuestionChapterVo;
|
|
|
+import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
|
+import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
|
|
|
+import com.zhongzheng.modules.course.mapper.CourseModuleChapterMapper;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
+import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
|
|
|
+import com.zhongzheng.modules.goods.bo.GoodsAttachedQueryBo;
|
|
|
+import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
|
|
|
+import com.zhongzheng.modules.goods.mapper.GoodsAttachedMapper;
|
|
|
+import com.zhongzheng.modules.goods.vo.GoodsAttachedVo;
|
|
|
import com.zhongzheng.modules.inform.bo.*;
|
|
|
import com.zhongzheng.modules.inform.service.IInformCourseService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformExamService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
+import com.zhongzheng.modules.inform.vo.CourseInformVo;
|
|
|
+import com.zhongzheng.modules.inform.vo.GoodsInformAttachedVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -43,6 +61,26 @@ public class InformServiceImpl extends ServiceImpl<InformMapper, Inform> impleme
|
|
|
@Autowired
|
|
|
private IInformUserService iInformUserService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseMenuService iCourseMenuService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CourseChapterSectionMapper courseChapterSectionMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CourseModuleChapterMapper courseModuleChapterMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GoodsAttachedMapper goodsAttachedMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private QuestionModuleChapterMapper questionModuleChapterMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private QuestionChapterExamMapper questionChapterExamMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public InformVo queryById(Long informId){
|
|
|
Inform db = this.baseMapper.selectById(informId);
|
|
@@ -177,6 +215,70 @@ public class InformServiceImpl extends ServiceImpl<InformMapper, Inform> impleme
|
|
|
return number;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<CourseInformVo> listGoodsCourse(GoodsQueryBo bo) {
|
|
|
+ List<CourseInformVo> courseInformVos = baseMapper.listGoodsCourse(bo);
|
|
|
+ for (CourseInformVo courseInformVo : courseInformVos) {
|
|
|
+ CourseMenuQueryBo courseMenuQueryBo = new CourseMenuQueryBo();
|
|
|
+ courseMenuQueryBo.setCourseId(courseInformVo.getCourseId());
|
|
|
+ List<CourseMenuVo> list = iCourseMenuService.selectList(courseMenuQueryBo);
|
|
|
+ for (CourseMenuVo courseMenuVo : list) {
|
|
|
+ if (courseMenuVo.getType().equals(1)){
|
|
|
+ List<CourseModuleChapterVo> listById = courseModuleChapterMapper.getListById(courseMenuVo.getMenuId());
|
|
|
+ for (CourseModuleChapterVo courseModuleChapterVo : listById) {
|
|
|
+ courseModuleChapterVo.setCourseChapterSectionList(courseChapterSectionMapper.getListById(courseModuleChapterVo.getChapterId()));
|
|
|
+ }
|
|
|
+ courseMenuVo.setCourseModuleChapterVos(listById);
|
|
|
+ }
|
|
|
+ if (courseMenuVo.getType().equals(2)){
|
|
|
+ courseMenuVo.setCourseChapterSectionList(courseChapterSectionMapper.getListById(courseMenuVo.getMenuId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ courseInformVo.setCourseMenuList(list);
|
|
|
+ }
|
|
|
+ return courseInformVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<GoodsInformAttachedVo> bankList(GoodsAttachedQueryBo bo) {
|
|
|
+ List<GoodsInformAttachedVo> goodsInformAttachedVos = entity2BankVo(goodsAttachedMapper.selectList(bo));
|
|
|
+ for (GoodsInformAttachedVo goodsInformAttachedVo : goodsInformAttachedVos) {
|
|
|
+ if (goodsInformAttachedVo.getType().equals(1)){
|
|
|
+ QuestionModuleChapterQueryBo questionModuleChapterQueryBo = new QuestionModuleChapterQueryBo();
|
|
|
+ questionModuleChapterQueryBo.setModuleExamId(goodsInformAttachedVo.getMajorId());
|
|
|
+ List<QuestionChapterVo> list = questionModuleChapterMapper.getList(questionModuleChapterQueryBo);
|
|
|
+ for (QuestionChapterVo questionChapterVo : list) {
|
|
|
+ QuestionChapterExamQueryBo questionChapterExamQueryBo = new QuestionChapterExamQueryBo();
|
|
|
+ questionChapterExamQueryBo.setChapterExamId(questionChapterVo.getChapterExamId());
|
|
|
+ List<ExamVo> list1 = questionChapterExamMapper.getList(questionChapterExamQueryBo);
|
|
|
+ questionChapterVo.setExamVos(list1);
|
|
|
+ }
|
|
|
+ goodsInformAttachedVo.setQuestionChapterVos(list);
|
|
|
+ }
|
|
|
+ if (goodsInformAttachedVo.getType().equals(2)){
|
|
|
+ QuestionChapterExamQueryBo questionChapterExamQueryBo = new QuestionChapterExamQueryBo();
|
|
|
+ questionChapterExamQueryBo.setChapterExamId(goodsInformAttachedVo.getMajorId());
|
|
|
+ List<ExamVo> list1 = questionChapterExamMapper.getList(questionChapterExamQueryBo);
|
|
|
+ goodsInformAttachedVo.setExamVos(list1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return goodsInformAttachedVos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 实体类转化成视图对象
|
|
|
+ *
|
|
|
+ * @param collection 实体类集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<GoodsInformAttachedVo> entity2BankVo(Collection<GoodsAttachedVo> collection) {
|
|
|
+ List<GoodsInformAttachedVo> voList = collection.stream()
|
|
|
+ .map(any -> BeanUtil.toBean(any, GoodsInformAttachedVo.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ return voList;
|
|
|
+ }
|
|
|
public Integer selectNumList(Long userId, List<InformExamAddBo> informExamAddBos,List<InformCourseAddBo> informCourseAddBos) {
|
|
|
Integer number = 0;
|
|
|
for (InformExamAddBo informExamAddBo : informExamAddBos) {
|