he2802 3 роки тому
батько
коміт
f58616575a

+ 17 - 4
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterServiceImpl.java

@@ -6,15 +6,15 @@ import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
+import com.zhongzheng.modules.bank.domain.QuestionModuleChapter;
+import com.zhongzheng.modules.bank.service.IQuestionModuleChapterService;
 import com.zhongzheng.modules.course.bo.*;
 import com.zhongzheng.modules.course.domain.*;
 import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
 import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
-import com.zhongzheng.modules.course.service.ICourseChapterBusinessService;
-import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
-import com.zhongzheng.modules.course.service.ICourseChapterService;
-import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
+import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.course.vo.CourseChapterVo;
+import com.zhongzheng.modules.goods.domain.GoodsAttached;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -47,7 +47,11 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
     @Autowired
     private ICourseChapterSectionService iCourseChapterSectionService;
 
+    @Autowired
+    private ICourseMenuService iCourseMenuService;
 
+    @Autowired
+    private ICourseModuleChapterService iCourseModuleChapterService;
 
     @Override
     public CourseChapterVo queryById(Long chapterId){
@@ -169,6 +173,15 @@ public class CourseChapterServiceImpl extends ServiceImpl<CourseChapterMapper, C
         if(checkNameUnique(entity)){
             throw new CustomException("名称重复");
         }
+        if(entity.getChapterId()!=null&&entity.getPublishStatus()!=null&&entity.getPublishStatus()==0){
+            CourseMenu one = iCourseMenuService.getOne(new LambdaQueryWrapper<CourseMenu>().eq(CourseMenu::getMenuId, entity.getChapterId()).eq(CourseMenu::getType,2).last("limit 1"));
+            if(one!=null){
+                throw new CustomException("该章已被绑定,不允许修改发布状态为未发布");
+            }
+            if(iCourseModuleChapterService.getOne(new LambdaQueryWrapper<CourseModuleChapter>().eq(CourseModuleChapter::getChapterId,entity.getChapterId()).last("limit 1"))!=null){
+                throw new CustomException("该章已被绑定,不允许修改发布状态为未发布");
+            }
+        }
     }
 
     @Override

+ 10 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseModuleServiceImpl.java

@@ -11,6 +11,7 @@ import com.zhongzheng.modules.course.domain.*;
 import com.zhongzheng.modules.course.mapper.CourseModuleMapper;
 import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.course.vo.CourseModuleVo;
+import com.zhongzheng.modules.goods.domain.GoodsAttached;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -43,6 +44,9 @@ public class CourseModuleServiceImpl extends ServiceImpl<CourseModuleMapper, Cou
     @Autowired
     private CourseModuleMapper courseModuleMapper;
 
+    @Autowired
+    private ICourseMenuService iCourseMenuService;
+
     @Override
     public CourseModuleVo queryById(Long moduleId){
         CourseModule db = this.baseMapper.selectById(moduleId);
@@ -157,6 +161,12 @@ public class CourseModuleServiceImpl extends ServiceImpl<CourseModuleMapper, Cou
         if(checkNameUnique(entity)){
             throw new CustomException("名称重复");
         }
+        if(entity.getModuleId()!=null&&entity.getPublishStatus()!=null&&entity.getPublishStatus()==0){
+            CourseMenu one = iCourseMenuService.getOne(new LambdaQueryWrapper<CourseMenu>().eq(CourseMenu::getMenuId, entity.getModuleId()).eq(CourseMenu::getType,1).last("limit 1"));
+            if(one!=null){
+                throw new CustomException("该模块已被绑定,不允许修改发布状态为未发布");
+            }
+        }
     }
 
     @Override

+ 17 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseSectionServiceImpl.java

@@ -10,13 +10,9 @@ import com.zhongzheng.modules.course.bo.CourseSectionAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionBusinessAddBo;
 import com.zhongzheng.modules.course.bo.CourseSectionEditBo;
 import com.zhongzheng.modules.course.bo.CourseSectionQueryBo;
-import com.zhongzheng.modules.course.domain.Course;
-import com.zhongzheng.modules.course.domain.CourseSection;
-import com.zhongzheng.modules.course.domain.CourseSectionBusiness;
+import com.zhongzheng.modules.course.domain.*;
 import com.zhongzheng.modules.course.mapper.CourseSectionMapper;
-import com.zhongzheng.modules.course.service.ICourseSectionBusinessService;
-import com.zhongzheng.modules.course.service.ICourseSectionService;
-import com.zhongzheng.modules.course.service.IMajorProjectService;
+import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.system.domain.SysRoleMenu;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +42,12 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
     @Autowired
     private CourseSectionMapper courseSectionMapper;
 
+    @Autowired
+    private ICourseMenuService iCourseMenuService;
+
+    @Autowired
+    private ICourseChapterSectionService iCourseChapterSectionService;
+
     @Override
     public CourseSectionVo queryById(Long sectionId){
         CourseSection db = this.baseMapper.selectById(sectionId);
@@ -139,6 +141,15 @@ public class CourseSectionServiceImpl extends ServiceImpl<CourseSectionMapper, C
        /* if(checkNameUnique(entity)){
             throw new CustomException("名称重复");
         }*/
+        if(entity.getSectionId()!=null&&entity.getPublishStatus()!=null&&entity.getPublishStatus()==0){
+            CourseMenu one = iCourseMenuService.getOne(new LambdaQueryWrapper<CourseMenu>().eq(CourseMenu::getMenuId, entity.getSectionId()).eq(CourseMenu::getType,3).last("limit 1"));
+            if(one!=null){
+                throw new CustomException("该节已被绑定,不允许修改发布状态为未发布");
+            }
+            if(iCourseChapterSectionService.getOne(new LambdaQueryWrapper<CourseChapterSection>().eq(CourseChapterSection::getSectionId,entity.getSectionId()).last("limit 1"))!=null){
+                throw new CustomException("该节已被绑定,不允许修改发布状态为未发布");
+            }
+        }
     }
 
     @Override