| | |
| | | import com.qxueyou.scc.teach.subject.model.SubjectChapter; |
| | | |
| | | /** |
| | | * 课件管理 |
| | | * 课件管理 |
| | | * |
| | | * @author lihanqi |
| | | * |
| | |
| | | IOrgTextService orgTextService; |
| | | |
| | | /** |
| | | * 新增章节 |
| | | * 新增章节 |
| | | * |
| | | * @param name |
| | | * @param parentChapterId |
| | |
| | | */ |
| | | 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)){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除章节 |
| | | * 删除章节 |
| | | * |
| | | * @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)); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 拷贝课件 |
| | | * 拷贝课件 |
| | | * |
| | | * @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){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 移动课件 |
| | | * 移动课件 |
| | | * |
| | | * @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){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除课件 |
| | | * 删除课件 |
| | | * |
| | | * @param types |
| | | * @param ids |
| | |
| | | } |
| | | |
| | | /** |
| | | * 下发课件 |
| | | * 下发课件 |
| | | * |
| | | * @param types |
| | | * @param ids |
| | |
| | | } |
| | | |
| | | /** |
| | | * 下发课件到子机构 |
| | | * 下发课件到子机构 |
| | | * |
| | | * @param id |
| | | * @param sourceOrgId |
| | |
| | | CollectionUtils.newList(id, sourceOrgId), SchCourseware.class); |
| | | |
| | | if(courseware == null){ |
| | | return new Result(false, "原课件不存在"); |
| | | return new Result(false, "原课件不存在"); |
| | | } |
| | | SchCourseware newCourseware = new SchCourseware(); |
| | | try { |
| | |
| | | |
| | | 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 |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询已下发的班级 |
| | | * 查询已下发的班级 |
| | | * |
| | | * @param types |
| | | * @param ids |
| | |
| | | } |
| | | |
| | | /** |
| | | * 课件分类 |
| | | * 课件分类 |
| | | * |
| | | * @param types |
| | | * @param ids |
| | |
| | | } |
| | | |
| | | /** |
| | | * 课件树排序 |
| | | * 课件树排序 |
| | | * |
| | | * @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]}); |
| | | } |
| | | } |
| | |
| | | return new Result(true); |
| | | } |
| | | |
| | | /*****************************************************班主任课件管理**************************************************************************************************/ |
| | | /*****************************************************班主任课件管理**************************************************************************************************/ |
| | | |
| | | /** |
| | | * 删除课件 |
| | | * 删除课件 |
| | | * |
| | | * @param types |
| | | * @param ids |
| | |
| | | } |
| | | |
| | | /** |
| | | * 拷贝课件 |
| | | * 拷贝课件 |
| | | * |
| | | * @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){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 发布和停用 |
| | | * 发布和停用 |
| | | * |
| | | * @param types |
| | | * @param ids |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除课程和章节级联删除课件 |
| | | * 删除课程和章节级联删除课件 |
| | | * |
| | | * @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){ |
| | |
| | | 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}); |
| | | } |
| | |
| | | |
| | | 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}); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 同步更新课件课程名称 |
| | | * 同步更新课件课程名称 |
| | | * |
| | | * @param subjectId |
| | | * @param subjectName |
| | |
| | | } |
| | | |
| | | /** |
| | | * 设置学分 |
| | | * 设置学分 |
| | | */ |
| | | public Result updateCoursewareScore(String id, int score) { |
| | | if(StringUtils.isNotEmpty(id)){ |
| | |
| | | |
| | | |
| | | /** |
| | | * 查询课件 |
| | | * 查询课件 |
| | | */ |
| | | 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); |
| | |
| | | |
| | | |
| | | /** |
| | | * 根据项目id查询所有机构课程的课件 |
| | | * 根据项目id查询所有机构课程的课件 |
| | | * @param id |
| | | * @return |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据项目id查询课件 |
| | | * 根据项目id查询课件 |
| | | * @param courseId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | |
| | | /** |
| | | * 获取排序 |
| | | * 获取排序 |
| | | * |
| | | * @param isOrg |
| | | * @param subjectId |
| | |
| | | @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; |