派生自 projectDept/qhighschool

EricsHu
2023-05-09 3adefa44b77cae70f37b573560ed480c2e56768b
src/main/java/com/qxueyou/scc/school/service/impl/CoursewareService.java
@@ -38,7 +38,7 @@
import com.qxueyou.scc.teach.subject.model.SubjectChapter;
/**
 * 课件管理
 * 课件管理
 * 
 * @author lihanqi
 *
@@ -66,7 +66,7 @@
   IOrgTextService orgTextService;
   
   /**
    * 新增章节
    * 新增章节
    * 
    * @param name
    * @param parentChapterId
@@ -74,7 +74,7 @@
    */
   public Result addOrUpdateChapter(String chapterId, String subjectId, String name, String parentChapterId){
      if(StringUtils.isEmpty(subjectId) || StringUtils.isEmpty(name)){
         return new Result(false, "参数错误");
         return new Result(false, "参数错误");
      }
      SubjectChapter objSchChapter = null;
      if(StringUtils.isEmpty(chapterId)){
@@ -99,17 +99,17 @@
   }
   
   /**
    * 删除章节
    * 删除章节
    * 
    * @param chapterId
    * @return
    */
   public Result deleteChapter(String[] chapterIds){
      if(chapterIds.length == 0){
         return new Result(false, "参数错误");
         return new Result(false, "参数错误");
      }
      int iCount = 0;
      for(String chapterId : chapterIds){//级联删除课件
      for(String chapterId : chapterIds){//级联删除课件
         SubjectChapter chapter = this.read(SubjectChapter.class, chapterId);
         if(chapter != null && StringUtils.isEmpty(chapter.getParentChapterId())){
            iCount += this.findCount("from SchCourseware where chapterId = ? and cType = ?", CollectionUtils.newList(chapterId, 6));
@@ -121,13 +121,13 @@
   }
   
   /**
    * 拷贝课件
    * 拷贝课件
    * 
    * @param type 课件类型
    * @param id 主键
    * @param subjectId 课程
    * @param collegeCourseId 科目
    * @param chapterId 章节
    * @param type 课件类型
    * @param id 主键
    * @param subjectId 课程
    * @param collegeCourseId 科目
    * @param chapterId 章节
    * @return
    */
   public Result doCopyCourseware(String type, String id, String subjectId, String collegeCourseId, String chapterId){
@@ -176,13 +176,13 @@
   }
   
   /**
    * 移动课件
    * 移动课件
    * 
    * @param type 课件类型
    * @param id 主键
    * @param subjectId 课程
    * @param collegeCourseId 科目
    * @param chapterId 章节
    * @param type 课件类型
    * @param id 主键
    * @param subjectId 课程
    * @param collegeCourseId 科目
    * @param chapterId 章节
    * @return
    */
   public Result doMoveCourseware(String type, String id, String subjectId, String collegeCourseId, String chapterId){
@@ -251,7 +251,7 @@
   }
   
   /**
    * 删除课件
    * 删除课件
    * 
    * @param types
    * @param ids
@@ -290,7 +290,7 @@
   }
   
   /**
    * 下发课件
    * 下发课件
    * 
    * @param types
    * @param ids
@@ -310,7 +310,7 @@
   }
   
   /**
    * 下发课件到子机构
    * 下发课件到子机构
    * 
    * @param id
    * @param sourceOrgId
@@ -323,7 +323,7 @@
            CollectionUtils.newList(id, sourceOrgId), SchCourseware.class);
      
      if(courseware == null){
         return new Result(false, "原课件不存在");
         return new Result(false, "原课件不存在");
      }
      SchCourseware newCourseware = new SchCourseware();
      try {
@@ -335,14 +335,14 @@
         
         this.save(newCourseware);
      } catch (Exception e) {
         log.error("机构下发课件报错:课件id:"+id+",子机构id:"+targetOrgId, e);
         log.error("机构下发课件报错:课件id:"+id+",子机构id:"+targetOrgId, e);
      }
      
      return new Result(true);
   }
   
   /**
    * 撤回
    * 撤回
    * 
    * @param id
    * @param orgId
@@ -361,7 +361,7 @@
   }
   
   /**
    * 查询已下发的班级
    * 查询已下发的班级
    * 
    * @param types
    * @param ids
@@ -409,7 +409,7 @@
   }
   
   /**
    * 课件分类
    * 课件分类
    * 
    * @param types
    * @param ids
@@ -442,27 +442,27 @@
   }
   
   /**
    * 课件树排序
    * 课件树排序
    * 
    * @param ids[] 排序的id
    * @param type 排序类型
    * @param parentId 父节点id
    * @param ids[] 排序的id
    * @param type 排序类型
    * @param parentId 父节点id
    * @return
    */
   public Result doOrder(String[] ids, String type, String parentId){
      for(int i=0;i<ids.length;i++){
         int index = ids.length - i;
         if("courseCategory".equals(type)){//科目类别
         if("courseCategory".equals(type)){//科目类别
            this.bulkUpdate("update OrgCategoryLevel set orderNum = ? where categoryLevelId = ?", new Object[]{index, ids[i]});
         }else if("course".equals(type)){//科目
         }else if("course".equals(type)){//科目
            this.bulkUpdate("update OrgCollegeCourse set orderNum = ? where collegeCourseId = ? and courseCategoryId = ?", new Object[]{index, ids[i], parentId});
         }else if("subject".equals(type)){//课程
         }else if("subject".equals(type)){//课程
            this.bulkUpdate("update SchSubject set orderNum = ? where subjectId = ? ", new Object[]{index, ids[i]});
         }else if("chapter".equals(type)){//章
         }else if("chapter".equals(type)){//章
            this.bulkUpdate("update SchChapter set orderNum = ? where chapterId = ? and subjectId = ?", new Object[]{index, ids[i], parentId});
         }else if("section".equals(type)){//节
         }else if("section".equals(type)){//节
            this.bulkUpdate("update SchChapter set orderNum = ? where chapterId = ? and parentChapterId = ?", new Object[]{index, ids[i], parentId});
         }else if("classSubject".equals(type)){//班级课程
         }else if("classSubject".equals(type)){//班级课程
            this.bulkUpdate("update SchClassSubject set orderNum = ? where classSubjectId = ? ", new Object[]{index, ids[i]});
         }
      }
@@ -470,10 +470,10 @@
      return new Result(true);
   }
   
   /*****************************************************班主任课件管理**************************************************************************************************/
   /*****************************************************班主任课件管理**************************************************************************************************/
   
   /**
    * 删除课件
    * 删除课件
    * 
    * @param types
    * @param ids
@@ -495,13 +495,13 @@
   }
   
   /**
    * 拷贝课件
    * 拷贝课件
    * 
    * @param type 课件类型
    * @param id 主键
    * @param subjectId 课程
    * @param collegeCourseId 科目
    * @param chapterId 章节
    * @param type 课件类型
    * @param id 主键
    * @param subjectId 课程
    * @param collegeCourseId 科目
    * @param chapterId 章节
    * @return
    */
   public Result doCopyClassCourseware(String type, String id, String subjectId, String chapterId){
@@ -547,7 +547,7 @@
   }
   
   /**
    * 发布和停用
    * 发布和停用
    * 
    * @param types
    * @param ids
@@ -592,11 +592,11 @@
   }
   
   /**
    * 删除课程和章节级联删除课件
    * 删除课程和章节级联删除课件
    *  
    * @param subjectId 机构课程id
    * @param chapterId 章节id
    * @param classSubjectId 班级课程id
    * @param subjectId 机构课程id
    * @param chapterId 章节id
    * @param classSubjectId 班级课程id
    * @return
    */
   public Result deleteCourseWare(String subjectId, String chapterId){
@@ -606,7 +606,7 @@
         if(StringUtils.isNotEmpty(chapter.getParentChapterId())){
            newChapterId = chapter.getParentChapterId();
         }else{
            //删除章节练习
            //删除章节练习
            this.bulkUpdate("update ExerciseGroup set deleteFlag = ? where chapterId = ? and type = ?", new Object[]{true, chapterId, ExerciseGroup.TYPE_CHAPTER_ITEM});
            this.bulkUpdate("update SchCourseware set deleteFlag = ? where chapterId = ? and cType = ?", new Object[]{true, chapterId, 6});
         }
@@ -626,7 +626,7 @@
         
         this.bulkUpdate("update SchCourseware set subjectId = null where subjectId = ?", new Object[]{subjectId});
         
         //删除章节练习
         //删除章节练习
         this.bulkUpdate("update ExerciseGroup set deleteFlag = ? where subjectId = ? and type = ?", new Object[]{true, subjectId, ExerciseGroup.TYPE_CHAPTER_ITEM});
         this.bulkUpdate("update SchCourseware set deleteFlag = ? where subjectId = ? and cType = ?", new Object[]{true, subjectId, 6});
      }
@@ -634,7 +634,7 @@
   }
   
   /**
    * 同步更新课件课程名称
    * 同步更新课件课程名称
    * 
    * @param subjectId
    * @param subjectName
@@ -650,7 +650,7 @@
   }
   /**
    * 设置学分
    * 设置学分
    */
   public Result updateCoursewareScore(String id, int score) {
      if(StringUtils.isNotEmpty(id)){
@@ -661,16 +661,16 @@
   /**
    * 查询课件
    * 查询课件
    */
   public List<Map<String, Object>> queryCourseware(String id, String type) {
       if(type.equals("category")) {
             
          List<Map<String, Object>> items=new ArrayList<Map<String, Object>>();
          //查询项目列表
          //查询项目列表
            String hql1="select collegeCourseId as id from OrgCollegeCourse where courseCategoryId=? and deleteFlag is false ";
            List<String> courseList =find(hql1, CollectionUtils.newList(id),String.class);
             //查询机构课程
             //查询机构课程
            for (String courseId : courseList) {
               List<Map<String, Object>> result = queryCoursewareByCourseId(courseId);
               items.addAll(result);
@@ -688,7 +688,7 @@
   
   
   /**
    * 根据项目id查询所有机构课程的课件
    * 根据项目id查询所有机构课程的课件
    * @param id
    * @return
    */
@@ -706,7 +706,7 @@
   }
   
   /**
    * 根据项目id查询课件
    * 根据项目id查询课件
    * @param courseId
    * @return
    */
@@ -757,7 +757,7 @@
   
   /**
    * 获取排序
    * 获取排序
    * 
    * @param isOrg
    * @param subjectId
@@ -767,7 +767,7 @@
   @Override
   public Map<String, Integer> getOrder(boolean isOrg, String subjectId, String chapterId){
      Map<String, Integer> result = new HashMap<>();
      //同步排序
      //同步排序
      int subjectOrder = 0;
      int chapterOrder = 0;
      int partOrder = 0;