he2802 1 år sedan
förälder
incheckning
37bf03df90

+ 29 - 18
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -412,30 +412,41 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                         List<CourseMenuVo> courseMenuVoList = iCourseMenuService.selectList(bo1);
                         if (courseMenuVoList != null && courseMenuVoList.size() > 0) {
                             courseMenuVoList.forEach(courseMenuVo -> {
-                                log.info("模块"+courseMenuVo.getClassHours());
                                 classHours.updateAndGet(v -> v + Math.round(courseMenuVo.getClassHours()));
-                                //获取章信息
-                                List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
-                                AtomicReference<Double> chapterHours = new AtomicReference<>(0.0);
-                                if (courseModuleChapterVoList != null && courseModuleChapterVoList.size() > 0) {
-                                    courseModuleChapterVoList.forEach(courseModuleChapterVo -> {
-                                        //获取节信息
-                                        List<CourseChapterSectionVo> courseChapterSectionVoList = iCourseChapterSectionService.getListById(courseModuleChapterVo.getChapterId());
-                                        if (courseChapterSectionVoList != null && courseChapterSectionVoList.size() > 0) {
-                                            courseChapterSectionVoList.forEach(courseChapterSectionVo -> {
-                                                chapterHours.updateAndGet(v -> v + courseChapterSectionVo.getClassHours());
-                                                log.info("章节"+courseChapterSectionVo.getClassHours());
-                                            });
-                                        }
-                                    });
+                                if(courseMenuVo.getType()==1){
+                                    //获取章信息
+                                    List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
+                                    AtomicReference<Double> chapterHours = new AtomicReference<>(0.0);
+                                    if (courseModuleChapterVoList != null && courseModuleChapterVoList.size() > 0) {
+                                        courseModuleChapterVoList.forEach(courseModuleChapterVo -> {
+                                            //获取节信息
+                                            List<CourseChapterSectionVo> courseChapterSectionVoList = iCourseChapterSectionService.getListById(courseModuleChapterVo.getChapterId());
+                                            if (courseChapterSectionVoList != null && courseChapterSectionVoList.size() > 0) {
+                                                courseChapterSectionVoList.forEach(courseChapterSectionVo -> {
+                                                    chapterHours.updateAndGet(v -> v + courseChapterSectionVo.getClassHours());
+                                                });
+                                            }
+                                        });
+                                    }
+                                    classHours.updateAndGet(v -> v + Math.round(chapterHours.get()));
+                                }
+                                else if(courseMenuVo.getType()==2){
+                                    AtomicReference<Double> chapterHours = new AtomicReference<>(0.0);
+                                    //获取节信息
+                                    List<CourseChapterSectionVo> courseChapterSectionVoList = iCourseChapterSectionService.getListById(courseMenuVo.getMenuId());
+                                    if (courseChapterSectionVoList != null && courseChapterSectionVoList.size() > 0) {
+                                        courseChapterSectionVoList.forEach(courseChapterSectionVo -> {
+                                            chapterHours.updateAndGet(v -> v + courseChapterSectionVo.getClassHours());
+                                            log.info("章节"+courseChapterSectionVo.getClassHours());
+                                        });
+                                    }
+                                    classHours.updateAndGet(v -> v + Math.round(chapterHours.get()));
                                 }
-                                classHours.updateAndGet(v -> v + Math.round(chapterHours.get()));
-                                log.info("模块节"+chapterHours.get());
+
                             });
                         }
                     });
                 }
-                log.info("总学时"+classHours.get());
                 goodsVo.setClassHours((new BigDecimal(String.valueOf(classHours))).setScale(0, HALF_UP));
             });
         }