diff --git a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesInfoDao.java b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesInfoDao.java index 4a6d6e88..7835c7d2 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/ResourcesInfoDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/ResourcesInfoDao.java @@ -20,6 +20,13 @@ import java.util.List; @SqlResource("jlw.resourcesInfo") public interface ResourcesInfoDao extends BaseMapper{ PageQuery queryByCondition(PageQuery query); + + /** + * 获取课程资源管理列表 + * @param query + * @return + */ + PageQuery getCurriculumResourceManagementList(PageQuery query); @Update void deleteResourcesInfoByIds(String ids); List getValuesByQuery (ResourcesInfoQuery resourcesInfoQuery); diff --git a/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java index a5f03e98..6c570491 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/CourseInfo.java @@ -103,6 +103,11 @@ public class CourseInfo extends BaseEntity{ private BigDecimal orderIndex; + /** + * 课程类型 1 院校开课 2 系统搜授权 + */ + private Integer sourceType; + @UpdateIgnore @InsertIgnore // @FetchSql("select * from resources_info t where t.course_info_id = #courseInfoId# order by order_index asc") @@ -363,4 +368,12 @@ public class CourseInfo extends BaseEntity{ public void setCourseLabelType(String courseLabelType) { this.set("courseLabelType", courseLabelType); } + + public Integer getSourceType() { + return sourceType; + } + + public void setSourceType(Integer sourceType) { + this.sourceType = sourceType; + } } diff --git a/web/src/main/java/com/ibeetl/jlw/entity/ResourcesInfo.java b/web/src/main/java/com/ibeetl/jlw/entity/ResourcesInfo.java index 2e95b81e..dc4c455e 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/ResourcesInfo.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/ResourcesInfo.java @@ -68,6 +68,21 @@ public class ResourcesInfo extends BaseEntity { //新增时间 @InsertIgnore private Date addTime; + + private Long courseInfoParentId; + private String courseInfoParentName; + private Long courseInfoParentParentId; + private String courseInfoParentParentName; + + /** + * 来源类型 1.开课 2.授权课 + */ + private Integer sourceType; + + /** + * 来源类型 + */ + private String addTypeText; public ResourcesInfo(){ } @@ -189,4 +204,52 @@ public class ResourcesInfo extends BaseEntity { public void setAddTime(Date addTime) { this.addTime = addTime; } + + public Long getCourseInfoParentId() { + return courseInfoParentId; + } + + public void setCourseInfoParentId(Long courseInfoParentId) { + this.courseInfoParentId = courseInfoParentId; + } + + public String getCourseInfoParentName() { + return courseInfoParentName; + } + + public void setCourseInfoParentName(String courseInfoParentName) { + this.courseInfoParentName = courseInfoParentName; + } + + public Long getCourseInfoParentParentId() { + return courseInfoParentParentId; + } + + public void setCourseInfoParentParentId(Long courseInfoParentParentId) { + this.courseInfoParentParentId = courseInfoParentParentId; + } + + public String getCourseInfoParentParentName() { + return courseInfoParentParentName; + } + + public void setCourseInfoParentParentName(String courseInfoParentParentName) { + this.courseInfoParentParentName = courseInfoParentParentName; + } + + public Integer getSourceType() { + return sourceType; + } + + public void setSourceType(Integer sourceType) { + this.sourceType = sourceType; + } + + public String getAddTypeText() { + return addTypeText; + } + + public void setAddTypeText(String addTypeText) { + this.addTypeText = addTypeText; + } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java b/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java index eb0a5192..5306b751 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/CourseInfoService.java @@ -19,6 +19,7 @@ import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.dao.CourseInfoDao; import com.ibeetl.jlw.dao.ResourcesApplicationCourseDao; import com.ibeetl.jlw.dao.ResourcesInfoDao; +import com.ibeetl.jlw.dao.TeacherOpenCourseMergeCourseInfoDao; import com.ibeetl.jlw.entity.*; import com.ibeetl.jlw.enums.MoveEnum; import com.ibeetl.jlw.web.query.CourseInfoQuery; @@ -67,20 +68,28 @@ import static java.util.stream.Collectors.joining; @Service @Slf4j @Transactional -public class CourseInfoService extends CoreBaseService{ +public class CourseInfoService extends CoreBaseService { - @Autowired private CourseInfoDao courseInfoDao; + @Autowired + private CourseInfoDao courseInfoDao; - @Autowired private ResourcesInfoService resourcesInfoService; - @Autowired private ResourcesInfoDao resourcesInfoDao; + @Autowired + private ResourcesInfoService resourcesInfoService; + @Autowired + private ResourcesInfoDao resourcesInfoDao; - @Autowired private CorePlatformService platformService; + @Autowired + private CorePlatformService platformService; - @Autowired private ResourcesApplicationCourseService resourcesApplicationCourseService; + @Autowired + private ResourcesApplicationCourseService resourcesApplicationCourseService; - @Autowired private ResourcesApplicationCourseDao resourcesApplicationCourseDao; - @Autowired private CoreUserService coreUserService; - @Autowired private CourseLabelService courseLabelService; + @Autowired + private ResourcesApplicationCourseDao resourcesApplicationCourseDao; + @Autowired + private CoreUserService coreUserService; + @Autowired + private CourseLabelService courseLabelService; private final List> results = new ArrayList<>(); @@ -88,7 +97,7 @@ public class CourseInfoService extends CoreBaseService{ private final ExecutorService pool = Executors.newCachedThreadPool(); //树结构缓存 - private final Map TreeCache = new ConcurrentHashMap<>(); + private final Map TreeCache = new ConcurrentHashMap<>(); @Autowired @Lazy private StudentService studentService; @@ -96,39 +105,43 @@ public class CourseInfoService extends CoreBaseService{ @Lazy private TeacherService teacherService; - public void flushCache(Long cId){ + @Autowired + private TeacherOpenCourseMergeCourseInfoDao teacherOpenCourseMergeCourseInfoDao; + + public void flushCache(Long cId) { Long courseInfoId = null; CourseInfo c = queryById(cId); - if(null != c){ - if(!((Integer)1).equals(c.getCourseInfoType())){ + if (null != c) { + if (!((Integer) 1).equals(c.getCourseInfoType())) { courseInfoId = c.getCourseInfoParentId(); - for(int j=0;j<25;j++){ + for (int j = 0; j < 25; j++) { CourseInfo courseInfoParent = queryById(courseInfoId); - if(((Integer)1).equals(courseInfoParent.getCourseInfoType())){ + if (((Integer) 1).equals(courseInfoParent.getCourseInfoType())) { courseInfoId = courseInfoParent.getCourseInfoId(); break; - }else { + } else { courseInfoId = courseInfoParent.getCourseInfoParentId(); } } } } - if(null != cId){ + if (null != cId) { TreeCache.remove(cId); } - if(null != courseInfoId){ + if (null != courseInfoId) { TreeCache.remove(courseInfoId); } } - public PageQuery queryByCondition(PageQuery query){ - PageQuery ret = courseInfoDao.queryByCondition(query); + public PageQuery queryByCondition(PageQuery query) { + PageQuery ret = courseInfoDao.queryByCondition(query); queryListAfter(ret.getList()); return ret; } - public PageQuery queryByConditionQuery(PageQuery query){ - PageQuery ret = courseInfoDao.queryByConditionQuery(query); + + public PageQuery queryByConditionQuery(PageQuery query) { + PageQuery ret = courseInfoDao.queryByConditionQuery(query); queryListAfter(ret.getList()); return ret; } @@ -193,7 +206,7 @@ public class CourseInfoService extends CoreBaseService{ } - public CourseInfo add(CourseInfoQuery courseInfoQuery){ + public CourseInfo add(CourseInfoQuery courseInfoQuery) { CourseInfo courseInfo = courseInfoQuery.pojo(); @@ -212,15 +225,15 @@ public class CourseInfoService extends CoreBaseService{ List resourcesApplicationCourseList = new ArrayList<>(); - if(StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())){ + if (StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())) { String[] resourcesApplicationIds = courseInfoQuery.getResourcesApplicationIds().split(","); - for(int i=0;i0){ + if (resourcesApplicationCourseList.size() > 0) { resourcesApplicationCourseService.insertBatch(resourcesApplicationCourseList); } } @@ -244,7 +257,7 @@ public class CourseInfoService extends CoreBaseService{ } - public boolean edit(CourseInfoQuery courseInfoQuery){ + public boolean edit(CourseInfoQuery courseInfoQuery) { updateTemplate(courseInfoQuery.pojo()); @@ -253,20 +266,20 @@ public class CourseInfoService extends CoreBaseService{ // 不管有没有绑定应用,都先删除 deleteByCourseInfoId(courseInfo.getCourseInfoId()); - if(StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())){ + if (StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())) { CourseLabel courseLabel = courseLabelService.queryById(courseInfo.getCourseLabelId()); Assert.isTrue(courseLabel != null && "应用课程类".equals(courseLabel.getCourseLabelType()), "只有应用课程类的课程,才能绑定应用!"); List resourcesApplicationCourseList = new ArrayList<>(); String[] resourcesApplicationIds = courseInfoQuery.getResourcesApplicationIds().split(","); - for(int i=0;i0){ + if (resourcesApplicationCourseList.size() > 0) { resourcesApplicationCourseService.insertBatch(resourcesApplicationCourseList); } } @@ -275,16 +288,16 @@ public class CourseInfoService extends CoreBaseService{ } - public boolean courseBind(CourseInfoQuery courseInfoQuery){ - if (CERTIFICATE.getType().equals(courseInfoQuery.getCourseLabelType())|| APPLICATION.getType().equals(courseInfoQuery.getCourseLabelType())){ + public boolean courseBind(CourseInfoQuery courseInfoQuery) { + if (CERTIFICATE.getType().equals(courseInfoQuery.getCourseLabelType()) || APPLICATION.getType().equals(courseInfoQuery.getCourseLabelType())) { CourseLabel param = new CourseLabel(); param.setCourseLabelType(courseInfoQuery.getCourseLabelType()); CourseLabel courseLabel = courseLabelService.getOnce(param); - if (courseLabel==null){ + if (courseLabel == null) { throw new PlatformException("课程模块数据异常"); } courseInfoQuery.setCourseLabelId(courseLabel.getCourseLabelId()); - } else if (THEORY.getType().equals(courseInfoQuery.getCourseLabelType())&&courseInfoQuery.getCourseLabelId()==null) { + } else if (THEORY.getType().equals(courseInfoQuery.getCourseLabelType()) && courseInfoQuery.getCourseLabelId() == null) { return true; } @@ -296,27 +309,28 @@ public class CourseInfoService extends CoreBaseService{ // 不管有没有绑定应用,都先删除 deleteByCourseInfoId(courseInfo.getCourseInfoId()); - if(StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())){ + if (StringUtils.isNotBlank(courseInfoQuery.getResourcesApplicationIds())) { CourseLabel courseLabel = courseLabelService.queryById(courseInfo.getCourseLabelId()); Assert.isTrue(courseLabel != null && "应用课程类".equals(courseLabel.getCourseLabelType()), "只有应用课程类的课程,才能绑定应用!"); List resourcesApplicationCourseList = new ArrayList<>(); String[] resourcesApplicationIds = courseInfoQuery.getResourcesApplicationIds().split(","); - for(int i=0;i0){ + if (resourcesApplicationCourseList.size() > 0) { resourcesApplicationCourseService.insertBatch(resourcesApplicationCourseList); } } return true; } - public void deleteCourseInfo(String ids){ + + public void deleteCourseInfo(String ids) { try { //遍历下级 TODO 有问题 // String id[] = ids.split(","); @@ -325,7 +339,7 @@ public class CourseInfoService extends CoreBaseService{ // } courseInfoDao.deleteCourseInfoByIds(ids); - for(int i=0;StringUtils.isNotBlank(ids) && i{ } } - public List getCourseInfoValues (CourseInfoQuery courseInfoQuery){ + public List getCourseInfoValues(CourseInfoQuery courseInfoQuery) { return courseInfoDao.getCourseInfoValues(courseInfoQuery); } @Cacheable(value = "courseInfoService.getById", key = "#courseInfoId", unless = "#result == null") - public CourseInfo getById(Long courseInfoId){ + public CourseInfo getById(Long courseInfoId) { CourseInfo courseInfo = courseInfoDao.getById(courseInfoId); - String courseVideoContent = null != courseInfo.get("courseVideoContent")?courseInfo.get("courseVideoContent").toString():null; + String courseVideoContent = null != courseInfo.get("courseVideoContent") ? courseInfo.get("courseVideoContent").toString() : null; - if(StringUtils.isNotBlank(courseVideoContent)){ - String path = courseVideoContent.replace("\\","/"); + if (StringUtils.isNotBlank(courseVideoContent)) { + String path = courseVideoContent.replace("\\", "/"); String fileName = path.substring(path.lastIndexOf("/") + 1); String formatSpot = fileName.substring(fileName.lastIndexOf(".")); @@ -359,30 +373,82 @@ public class CourseInfoService extends CoreBaseService{ if (null == flag) { flag = false; } - if(flag){ - courseInfo.set("courseVideoContent",path); + if (flag) { + courseInfo.set("courseVideoContent", path); } } return courseInfo; } - public List getValues (Object paras){ - return sqlManager.select(SqlId.of("jlw.courseInfo.getValues"),CourseInfo.class,paras); + public List getValues(Object paras) { + return sqlManager.select(SqlId.of("jlw.courseInfo.getValues"), CourseInfo.class, paras); } - public List getValues (CourseInfoQuery courseInfoQuery){ + public List getValues(CourseInfoQuery courseInfoQuery) { return courseInfoDao.getValuesQuery(courseInfoQuery); } + /** + * 根据课程获取章节和姐 + * @param courseInfoQuery + * @return + */ + public List getChapterSystemOAndUniversities(CourseInfoQuery courseInfoQuery) { + if (!Objects.equals(courseInfoQuery.getCourseInfoType(),2) && !Objects.equals(courseInfoQuery.getCourseInfoType(),3)){ + return new ArrayList<>(); + } + + List courseInfoList; + + if (Objects.equals(courseInfoQuery.getSourceType(), 1)) { + //院校开课 + courseInfoList = new ArrayList<>(); + LambdaQuery courseInfoLambdaQuery = teacherOpenCourseMergeCourseInfoDao.getSQLManager().lambdaQuery(TeacherOpenCourseMergeCourseInfo.class); + if (Objects.equals(courseInfoQuery.getCourseInfoType(),2)){ + courseInfoLambdaQuery.andEq(TeacherOpenCourseMergeCourseInfo::getTeacherOpenCourseId, courseInfoQuery.getCourseInfoParentId()); + }else { + courseInfoLambdaQuery.andEq(TeacherOpenCourseMergeCourseInfo::getCourseInfoParentId,courseInfoQuery.getCourseInfoParentId()); + } + courseInfoLambdaQuery.andEq(TeacherOpenCourseMergeCourseInfo::getCourseInfoType,courseInfoQuery.getCourseInfoType()); + courseInfoLambdaQuery.andEq(TeacherOpenCourseMergeCourseInfo::getCourseInfoStatus, 1); + List select = courseInfoLambdaQuery.select(); + select.forEach(item -> { + CourseInfo course = new CourseInfo(); + course.setAddTime(item.getAddTime()); + course.setCourseInfoId(item.getTeacherOpenCourseMergeCourseInfoId()); + course.setCourseInfoName(item.getCourseInfoName()); + course.setCourseInfoParentId(item.getCourseInfoParentId()); + course.setCourseInfoType(item.getCourseInfoType()); + course.setSourceType(1); + courseInfoList.add(course); + }); + + } else { + //系统授权课 + courseInfoList = new ArrayList<>(); + courseInfoDao.getValuesQuery(courseInfoQuery).forEach(item -> { + CourseInfo course = new CourseInfo(); + course.setAddTime(item.getAddTime()); + course.setCourseInfoId(item.getCourseInfoId()); + course.setCourseInfoName(item.getCourseInfoName()); + course.setCourseInfoParentId(item.getCourseInfoParentId()); + course.setCourseInfoType(item.getCourseInfoType()); + course.setSourceType(2); + courseInfoList.add(course); + }); + } + return courseInfoList; + } + public List getListByCourseLabelTypes(String courseLabelTypes) { Long resourcesApplicationId = null; - UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); - if(null != uSystem && ((Integer)1).equals(uSystem.getType())){ + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem) platformService.getOther(); + if (null != uSystem && ((Integer) 1).equals(uSystem.getType())) { resourcesApplicationId = uSystem.getTypeId(); } - ListcourseInfoList = courseInfoDao.getByCourseLabelTypes(courseLabelTypes,resourcesApplicationId);//只查 正常的 分类下 正常的 课程 + List courseInfoList = courseInfoDao.getByCourseLabelTypes(courseLabelTypes, resourcesApplicationId);//只查 正常的 分类下 正常的 课程 return courseInfoList; } @@ -391,23 +457,23 @@ public class CourseInfoService extends CoreBaseService{ * 通过ID获取带有深层级的课程信息 * 不包含他自己 * - * @param courseInfoId 课程ID + * @param courseInfoId 课程ID * @return */ - public List getChapterList (Long courseInfoId){ + public List getChapterList(Long courseInfoId) { List courseInfoList = new ArrayList<>(); CourseInfo c = queryById(courseInfoId); - if(null != c){ - if(!((Integer)1).equals(c.getCourseInfoType())){ + if (null != c) { + if (!((Integer) 1).equals(c.getCourseInfoType())) { courseInfoId = c.getCourseInfoParentId(); - for(int i=0;i<25;i++){ + for (int i = 0; i < 25; i++) { CourseInfo courseInfoParent = queryById(courseInfoId); - if(((Integer)1).equals(courseInfoParent.getCourseInfoType())){ + if (((Integer) 1).equals(courseInfoParent.getCourseInfoType())) { courseInfoId = courseInfoParent.getCourseInfoId(); break; - }else { + } else { courseInfoId = courseInfoParent.getCourseInfoParentId(); } } @@ -416,7 +482,7 @@ public class CourseInfoService extends CoreBaseService{ CourseInfo courseInfo = getTreeById(courseInfoId); List childrenList = courseInfo.takeChildren(); - for(int i=0;null != childrenList && i{ } //获取上一章、当前章、下一章的数据 - public CourseInfo[] getSurroundChapterInfo (Long courseInfoId){ + public CourseInfo[] getSurroundChapterInfo(Long courseInfoId) { - CourseInfo[] courseInfos = new CourseInfo[]{new CourseInfo(),new CourseInfo(),new CourseInfo()}; + CourseInfo[] courseInfos = new CourseInfo[]{new CourseInfo(), new CourseInfo(), new CourseInfo()}; List courseInfoList = new ArrayList<>(); CourseInfo c = queryById(courseInfoId); - if(null != c){ - if(!((Integer)1).equals(c.getCourseInfoType())){ + if (null != c) { + if (!((Integer) 1).equals(c.getCourseInfoType())) { courseInfoId = c.getCourseInfoParentId(); - for(int i=0;i<25;i++){ + for (int i = 0; i < 25; i++) { CourseInfo courseInfoParent = queryById(courseInfoId); - if(((Integer)1).equals(courseInfoParent.getCourseInfoType())){ + if (((Integer) 1).equals(courseInfoParent.getCourseInfoType())) { courseInfoId = courseInfoParent.getCourseInfoId(); break; - }else { + } else { courseInfoId = courseInfoParent.getCourseInfoParentId(); } } @@ -452,17 +518,17 @@ public class CourseInfoService extends CoreBaseService{ CourseInfo courseInfo = getTreeById(courseInfoId); List childrenList = courseInfo.takeChildren(); - for(int i=0;null != childrenList && i0?courseInfoList.get(key-1):new CourseInfo(); + if (null != key) { + courseInfos[0] = key.intValue() > 0 ? courseInfoList.get(key - 1) : new CourseInfo(); courseInfos[1] = courseInfoList.get(key); - courseInfos[2] = key.intValue()+1{ //获取上一节、当前节、下一节的数据 - public CourseInfo[] getSurroundNodeInfo (Long courseInfoId){ + public CourseInfo[] getSurroundNodeInfo(Long courseInfoId) { - CourseInfo[] courseInfos = new CourseInfo[]{new CourseInfo(),new CourseInfo(),new CourseInfo()}; + CourseInfo[] courseInfos = new CourseInfo[]{new CourseInfo(), new CourseInfo(), new CourseInfo()}; List courseInfoList = new ArrayList<>(); CourseInfo c = queryById(courseInfoId); - if(null != c){ - if(!((Integer)1).equals(c.getCourseInfoType())){ + if (null != c) { + if (!((Integer) 1).equals(c.getCourseInfoType())) { courseInfoId = c.getCourseInfoParentId(); - for(int i=0;i<25;i++){ + for (int i = 0; i < 25; i++) { CourseInfo courseInfoParent = queryById(courseInfoId); - if(((Integer)1).equals(courseInfoParent.getCourseInfoType())){ + if (((Integer) 1).equals(courseInfoParent.getCourseInfoType())) { courseInfoId = courseInfoParent.getCourseInfoId(); break; - }else { + } else { courseInfoId = courseInfoParent.getCourseInfoParentId(); } } @@ -496,30 +562,30 @@ public class CourseInfoService extends CoreBaseService{ CourseInfo courseInfo = getTreeById(courseInfoId); List childrenList = courseInfo.takeChildren(); - for(int i=0,count=0;null != childrenList && i childrenChildrenList = childrenList.get(i).takeChildren(); - for(int j=0;j childrenChildrenChildrenList = childrenChildrenList.get(j).takeChildren(); - for(int k=0;k childrenChildrenChildrenChildrenList = childrenChildrenChildrenList.get(k).takeChildren(); - for(int l=0;l{ childrenList.get(i).putChildren(new ArrayList<>()); } - if(null != key){ - courseInfos[0] = key.intValue()>0?courseInfoList.get(key-1):new CourseInfo(); + if (null != key) { + courseInfos[0] = key.intValue() > 0 ? courseInfoList.get(key - 1) : new CourseInfo(); courseInfos[1] = courseInfoList.get(key); - courseInfos[2] = key.intValue()+1{ * 通过传入的题目列表, * 通过章节分组 * - * @param courseInfos 系统课程章节列表 + * @param courseInfos 系统课程章节列表 * @return */ public Map> getCourseChapterInfoIdsWithChildren(Collection courseInfos) { @@ -570,23 +636,23 @@ public class CourseInfoService extends CoreBaseService{ * @param courseInfoId * @return */ - public List getCourseResources (Long courseInfoId){ + public List getCourseResources(Long courseInfoId) { List courseInfoList = new ArrayList<>(); CourseInfo courseInfo = getTreeById(courseInfoId); List childrenList = courseInfo.takeChildren(); - for(int i=0;null != childrenList && i childrenChildrenList = childrenList.get(i).takeChildren(); - for(int j=0;j childrenChildrenChildrenList = childrenChildrenList.get(j).takeChildren(); - for(int k=0;k childrenChildrenChildrenChildrenList = childrenChildrenChildrenList.get(k).takeChildren(); - for(int l=0;l{ /** * 资源列表查询,并放在关联的课程中 + * * @param list */ public void buildCourseInfoResources(List list) { if (CollectionUtil.isEmpty(list)) { return; } - + String ids = list.stream().map(CourseInfo::getCourseInfoId).map(Object::toString).collect(joining(",")); ResourcesInfoQuery resourcesInfoQuery = new ResourcesInfoQuery(); @@ -632,57 +699,57 @@ public class CourseInfoService extends CoreBaseService{ } } - public List getTreeByCourseLabelTypes(String courseLabelTypes,Integer rankLimit) {//由于他们设计的问题,导致小节里还有小节,rankLimit用来管控节 + public List getTreeByCourseLabelTypes(String courseLabelTypes, Integer rankLimit) {//由于他们设计的问题,导致小节里还有小节,rankLimit用来管控节 // CourseInfo courseInfo = new CourseInfo();//造一个父节点 Long resourcesApplicationId = null; - UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem)platformService.getOther(); - if(null != uSystem && ((Integer)1).equals(uSystem.getType())){ + UniversitiesCollegesJurisdictionExperimentalSystem uSystem = (UniversitiesCollegesJurisdictionExperimentalSystem) platformService.getOther(); + if (null != uSystem && ((Integer) 1).equals(uSystem.getType())) { resourcesApplicationId = uSystem.getTypeId(); } - ListcourseInfoListTemp = courseInfoDao.getByCourseLabelTypes(courseLabelTypes,resourcesApplicationId);//只查 正常的 分类下 正常的 课程 + List courseInfoListTemp = courseInfoDao.getByCourseLabelTypes(courseLabelTypes, resourcesApplicationId);//只查 正常的 分类下 正常的 课程 - ListcourseInfoList = new ArrayList<>(); - if(null != courseInfoListTemp && courseInfoListTemp.size()>0){ - for(int i=0;i courseInfoList = new ArrayList<>(); + if (null != courseInfoListTemp && courseInfoListTemp.size() > 0) { + for (int i = 0; i < courseInfoListTemp.size(); i++) { CourseInfo courseInfo = courseInfoListTemp.get(i); - if(null != TreeCache.get(courseInfo.getCourseInfoId())){ + if (null != TreeCache.get(courseInfo.getCourseInfoId())) { courseInfo = ToolUtils.deepCopy(TreeCache.get(courseInfo.getCourseInfoId())); } else { courseInfo = courseInfoDao.getById(courseInfo.getCourseInfoId()); - if(null != courseInfo){ - courseInfo.set("id",courseInfo.getCourseInfoId()); - courseInfo.set("title",courseInfo.getCourseInfoName()); - courseInfo.set("value",courseInfo.getCourseInfoId()); - courseInfo.set("name",courseInfo.getCourseInfoName()); - courseInfo.set("spread","true"); - if(null == courseInfo.getCourseInfoType()){ + if (null != courseInfo) { + courseInfo.set("id", courseInfo.getCourseInfoId()); + courseInfo.set("title", courseInfo.getCourseInfoName()); + courseInfo.set("value", courseInfo.getCourseInfoId()); + courseInfo.set("name", courseInfo.getCourseInfoName()); + courseInfo.set("spread", "true"); + if (null == courseInfo.getCourseInfoType()) { courseInfo.setCourseInfoType(1); } - getByParentCourseInfoId(courseInfo, courseInfo.getCourseInfoId(),1); + getByParentCourseInfoId(courseInfo, courseInfo.getCourseInfoId(), 1); } - TreeCache.put(courseInfo.getCourseInfoId(),ToolUtils.deepCopy(courseInfo)); + TreeCache.put(courseInfo.getCourseInfoId(), ToolUtils.deepCopy(courseInfo)); } courseInfoList.add(courseInfo); } } - if(((Integer)3).equals(rankLimit)){//课程 章 小节 + if (((Integer) 3).equals(rankLimit)) {//课程 章 小节 - for(int h=0;null != courseInfoList && h childrenList = courseInfoList.get(h).takeChildren(); - for(int i=0;null != childrenList && i childrenChildrenList = childrenList.get(i).takeChildren(); - for(int j=0;j childrenChildrenChildrenList = childrenChildrenList.get(j).takeChildren(); - if(null != childrenChildrenChildrenList && childrenChildrenChildrenList.size()>0){ - for(int k=0;k 0) { + for (int k = 0; k < childrenChildrenChildrenList.size(); k++) { + childrenChildrenChildrenList.get(k).setCourseInfoName("      " + childrenChildrenChildrenList.get(k).getCourseInfoName()); childrenChildrenChildrenList.get(k).setCourseInfoParentId(childrenChildrenList.get(j).getCourseInfoParentId()); } - childrenChildrenList.addAll(j+1,childrenChildrenChildrenList); - j = j+childrenChildrenChildrenList.size(); + childrenChildrenList.addAll(j + 1, childrenChildrenChildrenList); + j = j + childrenChildrenChildrenList.size(); } } } @@ -693,12 +760,12 @@ public class CourseInfoService extends CoreBaseService{ } - public String getTreeIdsById(Long courseInfoId){ + public String getTreeIdsById(Long courseInfoId) { String courseInfoIds = ""; List ids = new ArrayList<>(); - getIdsByParentCourseInfoId(courseInfoId,ids); + getIdsByParentCourseInfoId(courseInfoId, ids); - for(int i=0;i{ } - public void getIdsByParentCourseInfoId(Long courseInfoId,List ids){ + public void getIdsByParentCourseInfoId(Long courseInfoId, List ids) { CourseInfo c = new CourseInfo(); c.setCourseInfoParentId(courseInfoId); c.setCourseInfoStatus(1); List courseInfoList = getValues(c); - if(null != courseInfoList && courseInfoList.size()>0) { + if (null != courseInfoList && courseInfoList.size() > 0) { for (int i = 0; i < courseInfoList.size(); i++) { ids.add(courseInfoList.get(i).getCourseInfoId()); - getIdsByParentCourseInfoId(courseInfoList.get(i).getCourseInfoId(),ids); + getIdsByParentCourseInfoId(courseInfoList.get(i).getCourseInfoId(), ids); } } } - public CourseInfo getTreeById(Long courseInfoId){ + public CourseInfo getTreeById(Long courseInfoId) { CourseInfo courseInfo = null; - if(null != TreeCache.get(courseInfoId)){ + if (null != TreeCache.get(courseInfoId)) { courseInfo = ToolUtils.deepCopy(TreeCache.get(courseInfoId)); } else { courseInfo = courseInfoDao.getById(courseInfoId); - if(null != courseInfo){ - courseInfo.set("id",courseInfo.getCourseInfoId()); - courseInfo.set("title",courseInfo.getCourseInfoName()); - courseInfo.set("spread","true"); - if(null == courseInfo.getCourseInfoType()){ + if (null != courseInfo) { + courseInfo.set("id", courseInfo.getCourseInfoId()); + courseInfo.set("title", courseInfo.getCourseInfoName()); + courseInfo.set("spread", "true"); + if (null == courseInfo.getCourseInfoType()) { courseInfo.setCourseInfoType(1); } - getByParentCourseInfoId(courseInfo, courseInfo.getCourseInfoId(),1); + getByParentCourseInfoId(courseInfo, courseInfo.getCourseInfoId(), 1); } - TreeCache.put(courseInfo.getCourseInfoId(),ToolUtils.deepCopy(courseInfo)); + TreeCache.put(courseInfo.getCourseInfoId(), ToolUtils.deepCopy(courseInfo)); } return courseInfo; } - public void getByParentCourseInfoId(CourseInfo courseInfo,Long courseInfoId,Integer n){ + public void getByParentCourseInfoId(CourseInfo courseInfo, Long courseInfoId, Integer n) { CourseInfo c = new CourseInfo(); c.setCourseInfoParentId(courseInfoId); c.setCourseInfoStatus(1); List courseInfoList = getValues(c); - if(null != courseInfoList && courseInfoList.size()>0) { + if (null != courseInfoList && courseInfoList.size() > 0) { courseInfo.putChildren(courseInfoList); - if(n < 3){// 节后面还是节,所以只有3 + if (n < 3) {// 节后面还是节,所以只有3 n++; } for (int i = 0; i < courseInfoList.size(); i++) { - if(null == courseInfoList.get(i).getCourseInfoType()){ + if (null == courseInfoList.get(i).getCourseInfoType()) { courseInfoList.get(i).setCourseInfoType(n); } - getByParentCourseInfoId(courseInfoList.get(i), courseInfoList.get(i).getCourseInfoId(),n); + getByParentCourseInfoId(courseInfoList.get(i), courseInfoList.get(i).getCourseInfoId(), n); } - }else { + } else { courseInfo.putChildren(new ArrayList()); } } - public JsonResult importWord(FileEntity fileEntity,Long courseInfoId){ + public JsonResult importWord(FileEntity fileEntity, Long courseInfoId) { File file = new File(fileEntity.getAbsoluteUrl()); @@ -772,16 +839,16 @@ public class CourseInfoService extends CoreBaseService{ fis = new FileInputStream(file); xdoc = new XWPFDocument(fis); - if(null != fis){ + if (null != fis) { fis.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } CourseInfo c = this.queryById(courseInfoId); - if(null != fis && null != xdoc && null != c){ + if (null != fis && null != xdoc && null != c) { List paragraphs = xdoc.getParagraphs(); List bodyElements = xdoc.getBodyElements(); @@ -791,14 +858,14 @@ public class CourseInfoService extends CoreBaseService{ List nodeList = new ArrayList<>();//全部小节 - List paragraphPosition =new ArrayList<>(); + List paragraphPosition = new ArrayList<>(); - int bodyElementsSize = bodyElements.size() -1; - int paragraphsSize = paragraphs.size() -1; + int bodyElementsSize = bodyElements.size() - 1; + int paragraphsSize = paragraphs.size() - 1; - int n=0; - int m=0; - int l=0; + int n = 0; + int m = 0; + int l = 0; int l1 = 0; for (XWPFParagraph paragraph : paragraphs) { @@ -810,72 +877,74 @@ public class CourseInfoService extends CoreBaseService{ try { level = Integer.valueOf(titleLvl); - }catch (Exception e){ - System.out.println("error: "+titleLvl); + } catch (Exception e) { + System.out.println("error: " + titleLvl); } - if(null != level && level.intValue()<5){ + if (null != level && level.intValue() < 5) { CourseInfo courseInfo = new CourseInfo(); courseInfo.setCourseInfoName(serialNumberFormat(text));//格式化序号 courseInfo.setCourseLabelId(c.getCourseLabelId()); courseInfo.setCourseInfoStatus(1); - if(level.intValue() == 0){ + if (level.intValue() == 0) { n++; courseInfo.setCourseInfoParentId(c.getCourseInfoId()); courseInfo.setCourseInfoType(2); - courseInfo.set("n",n); + courseInfo.set("n", n); courseInfo1List.add(courseInfo); - m=0; - }else if(level.intValue() == 1){ + m = 0; + } else if (level.intValue() == 1) { m++; courseInfo.setCourseInfoType(3); - courseInfo.set("n",n); - courseInfo.set("nm",n+"_"+m); + courseInfo.set("n", n); + courseInfo.set("nm", n + "_" + m); int flag = -1; nodeList.add(courseInfo); - for(int i=0;i= 1){ + } else if (level.intValue() >= 1) { courseInfo.setCourseInfoType(3); - courseInfo.set("nm",n+"_"+m); + courseInfo.set("nm", n + "_" + m); int flag = -1; nodeList.add(courseInfo); - for(int i=0;i{ l1++; } - if(null != courseInfo1List && courseInfo1List.size()>0){ + if (null != courseInfo1List && courseInfo1List.size() > 0) { insertBatch(courseInfo1List); Map> groupByn = null; - try{ + try { groupByn = courseInfo1List.stream().collect(Collectors.groupingBy(e -> e.get("n").toString())); - }catch (Exception e){} + } catch (Exception e) { + } - for(int i=0;null != courseInfo2List && i0){ + if (null != courseInfo2List && courseInfo2List.size() > 0) { insertBatch(courseInfo2List); Map> groupBynm = null; - try{ + try { groupBynm = courseInfo2List.stream().collect(Collectors.groupingBy(e -> e.get("nm").toString())); - }catch (Exception e){} + } catch (Exception e) { + } - for(int i=0;null != courseInfo3List && i0){ + if (null != courseInfo3List && courseInfo3List.size() > 0) { insertBatch(courseInfo3List); } } } List courseInfoList = new ArrayList<>(); - if(null != courseInfo2List && courseInfo2List.size()>0){ + if (null != courseInfo2List && courseInfo2List.size() > 0) { courseInfoList.addAll(courseInfo2List); } - if(null != courseInfo3List && courseInfo3List.size()>0){ + if (null != courseInfo3List && courseInfo3List.size() > 0) { courseInfoList.addAll(courseInfo3List); } Map> groupByFlag = null; - try{ - groupByFlag = courseInfoList.stream().collect(Collectors.groupingBy(e -> null != e.get("flag") && StringUtils.isNotBlank(e.get("flag").toString())?e.get("flag").toString():"-1")); - }catch (Exception e){} + try { + groupByFlag = courseInfoList.stream().collect(Collectors.groupingBy(e -> null != e.get("flag") && StringUtils.isNotBlank(e.get("flag").toString()) ? e.get("flag").toString() : "-1")); + } catch (Exception e) { + } - if(null != groupByFlag && groupByFlag.size()>0){ + if (null != groupByFlag && groupByFlag.size() > 0) { //线程处理 - results.add(pool.submit(new TaskCallable2Split(file,paragraphPosition,bodyElementsSize,paragraphsSize,nodeList,groupByFlag))); + results.add(pool.submit(new TaskCallable2Split(file, paragraphPosition, bodyElementsSize, paragraphsSize, nodeList, groupByFlag))); } } try { - if(null != xdoc){ + if (null != xdoc) { xdoc.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } @@ -1066,7 +1138,7 @@ public class CourseInfoService extends CoreBaseService{ List nodeList; Map> groupByFlag; - public TaskCallable2Split(File file,List paragraphPosition,int bodyElementsSize,int paragraphsSize,List nodeList,Map> groupByFlag) { + public TaskCallable2Split(File file, List paragraphPosition, int bodyElementsSize, int paragraphsSize, List nodeList, Map> groupByFlag) { this.file = file; this.paragraphPosition = paragraphPosition; this.bodyElementsSize = bodyElementsSize; @@ -1078,25 +1150,25 @@ public class CourseInfoService extends CoreBaseService{ @Override public Boolean call() { try { - paragraphPosition.add(new Integer[]{bodyElementsSize,paragraphsSize}); + paragraphPosition.add(new Integer[]{bodyElementsSize, paragraphsSize}); //文件夹路径 - String saveUrl = File.separator + "filesystem" + File.separator + "courseInfo" + File.separator + System.currentTimeMillis() + File.separator ; + String saveUrl = File.separator + "filesystem" + File.separator + "courseInfo" + File.separator + System.currentTimeMillis() + File.separator; String path = GetFile.p + saveUrl; File m = new File(path); - if(!m.exists()){ + if (!m.exists()) { m.mkdirs(); } - for (int k=0; paragraphPosition.size()>1 && k 1 && k < paragraphPosition.size() - 1; k++) { int temp = paragraphPosition.get(k)[0]; - int tempCount = paragraphPosition.get(k+1)[0]; + int tempCount = paragraphPosition.get(k + 1)[0]; - ListcourseInfoList = groupByFlag.get(temp+""); + List courseInfoList = groupByFlag.get(temp + ""); - if(null != courseInfoList && courseInfoList.size()>0){ + if (null != courseInfoList && courseInfoList.size() > 0) { String p = saveUrl + System.currentTimeMillis() + ".docx"; String url = GetFile.p + p; @@ -1105,21 +1177,21 @@ public class CourseInfoService extends CoreBaseService{ XWPFDocument doc = new XWPFDocument(fis); try { - if(null != fis){ + if (null != fis) { fis.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } List paragraphs = doc.getParagraphs(); int l1 = 0; - for (XWPFParagraph paragraph : paragraphs){ - if(l1 < paragraphPosition.get(k)[1] || l1 > paragraphPosition.get(k+1)[1]){ - for (XWPFRun run : paragraph.getRuns()){ + for (XWPFParagraph paragraph : paragraphs) { + if (l1 < paragraphPosition.get(k)[1] || l1 > paragraphPosition.get(k + 1)[1]) { + for (XWPFRun run : paragraph.getRuns()) { for (XWPFPicture runPicture : run.getEmbeddedPictures()) { - if(runPicture.getPictureData().getPictureType() != 3){//不等于公式 + if (runPicture.getPictureData().getPictureType() != 3) {//不等于公式 PackagePartName partName = runPicture.getPictureData().getPackagePart().getPartName(); if (null != partName) { PackagePart part = doc.getPackage().getPart(partName); @@ -1141,31 +1213,31 @@ public class CourseInfoService extends CoreBaseService{ doc.removeBodyElement(u); } - for (int v = temp -1; v >=0; v--) { + for (int v = temp - 1; v >= 0; v--) { doc.removeBodyElement(v); } OutputStream out = new FileOutputStream(url); try { doc.write(out); - }catch (IOException e) { + } catch (IOException e) { e.printStackTrace(); } try { - if(null != doc){ + if (null != doc) { doc.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } try { - if(null != out){ + if (null != out) { out.flush(); out.close(); } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } @@ -1184,7 +1256,7 @@ public class CourseInfoService extends CoreBaseService{ } } return true; - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); return false; } @@ -1193,42 +1265,42 @@ public class CourseInfoService extends CoreBaseService{ } //序号格式化 - public static String serialNumberFormat(String serialNumber){ + public static String serialNumberFormat(String serialNumber) { - if(StringUtils.isNotBlank(serialNumber)){ - serialNumber = serialNumber.replace(" ",""); + if (StringUtils.isNotBlank(serialNumber)) { + serialNumber = serialNumber.replace(" ", ""); String s = ""; - for(int j=0;j1 && s.lastIndexOf(".") == s.length()-1?s.substring(0,s.length()-1):s; + s = s.length() > 1 && s.lastIndexOf(".") == s.length() - 1 ? s.substring(0, s.length() - 1) : s; serialNumber = s + " " + serialNumber; } @@ -1246,7 +1318,7 @@ public class CourseInfoService extends CoreBaseService{ Long userId = getUserId(); ExtendSchoolInfo extendSchoolInfo = null; // 如果用户ID不为空,则查询这个用户所在的院校ID - if(ObjectUtil.isNotEmpty(userId)) { + if (ObjectUtil.isNotEmpty(userId)) { CoreUser userInfo = coreUserService.getUserById(userId); if (userInfo.isStudent()) { @@ -1256,7 +1328,7 @@ public class CourseInfoService extends CoreBaseService{ extendSchoolInfo = teacherService.getTeacherExtendSchoolInfoByUserIds(userInfo.getId().toString()); } - if(null != extendSchoolInfo) { + if (null != extendSchoolInfo) { pageQuery.setPara("universitiesCollegesId", extendSchoolInfo.getUniversitiesCollegesId()); } } @@ -1267,6 +1339,7 @@ public class CourseInfoService extends CoreBaseService{ /** * 位置移动 * 小于0的数字,是代表置顶。大于0代表非置顶 + * * @param id * @param moveType */ @@ -1304,7 +1377,8 @@ public class CourseInfoService extends CoreBaseService{ BigDecimal minLinkOrder = minOrderClientLink.getOrderIndex(); // 置顶就现有的最小值减1。但是需要确保结果小于0 calcedOrder = NumberUtil.sub(min(minLinkOrder.floatValue(), 0), 1); - } break; + } + break; case MOVE_LEFT: { @@ -1334,7 +1408,8 @@ public class CourseInfoService extends CoreBaseService{ // 左移位后的值 calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP); - } break; + } + break; case MOVE_RIGHT: { @@ -1364,7 +1439,8 @@ public class CourseInfoService extends CoreBaseService{ // 右移位后的值 calcedOrder = RandomUtil.randomDouble(min.doubleValue(), max.doubleValue(), 6, RoundingMode.HALF_UP); - } break; + } + break; default: log.error("不支持的移动类型!"); break; @@ -1387,15 +1463,14 @@ public class CourseInfoService extends CoreBaseService{ * 只传右元素ID,表示:拖动元素 在 右元素的右侧; * 左右元素ID都传,则拖动元素放置在两个元素的中间。 * - * @param id 拖动元素的ID - * @param leftId 左元素ID 偏小数值对应的元素ID - * @param rightId 右元素ID 偏大数值对应的元素ID - * - * 左侧(上) ==> 右侧(下) - * 小数值 ==> 大数值 - * - * 数值越小,越靠前 - * + * @param id 拖动元素的ID + * @param leftId 左元素ID 偏小数值对应的元素ID + * @param rightId 右元素ID 偏大数值对应的元素ID + *

+ * 左侧(上) ==> 右侧(下) + * 小数值 ==> 大数值 + *

+ * 数值越小,越靠前 * @Author: 87966 * @Date: 2023/1/9 16:44 */ @@ -1506,8 +1581,7 @@ public class CourseInfoService extends CoreBaseService{ if (!updatePOList.isEmpty()) { updateBatchTemplate(updatePOList); log.info("修复课程全路径成功,成功修复数量:{}!", allFullIdIsNullList.size()); - } - else { + } else { log.info("暂无待修复的数据!"); } @@ -1516,6 +1590,7 @@ public class CourseInfoService extends CoreBaseService{ /** * 只获取考证类的课程,如果配置试卷题目的话,就查询出来。 + * * @return */ public PageQuery examCourseQuestionDO(PageQuery pageQuery) { @@ -1525,6 +1600,7 @@ public class CourseInfoService extends CoreBaseService{ /** * 只获取考证类的课程,如果配置试卷题目的话,就查询出来。 + * * @return */ public List getByIds(String courseInfoIds) { @@ -1538,7 +1614,7 @@ public class CourseInfoService extends CoreBaseService{ } - public PageQuery queryChapterExerciseInfoList(PageQuery pageQuery){ + public PageQuery queryChapterExerciseInfoList(PageQuery pageQuery) { return courseInfoDao.queryChapterExerciseInfoList(pageQuery); } diff --git a/web/src/main/java/com/ibeetl/jlw/service/ResourcesInfoService.java b/web/src/main/java/com/ibeetl/jlw/service/ResourcesInfoService.java index 36365e24..2f9dcb62 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/ResourcesInfoService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/ResourcesInfoService.java @@ -96,6 +96,15 @@ public class ResourcesInfoService extends CoreBaseService { return ret; } + /** + * 获取课程资源管理列表 + * @param query + * @return + */ + public PageQuery getCurriculumResourceManagementList(PageQuery query) { + return resourcesInfoDao.getCurriculumResourceManagementList(query); + } + public ResourcesInfo getById(Long resourcesInfoId) { ResourcesInfo resourcesInfo = queryById(resourcesInfoId); if (null != resourcesInfo) { @@ -128,24 +137,26 @@ public class ResourcesInfoService extends CoreBaseService { public void deleteResourcesInfo(String ids) { for (int i = 0; i < ids.split(",").length; i++) { ResourcesInfo oldResourcesInfo = queryById(Long.parseLong(ids.split(",")[i])); - CourseInfo oldCourseInfo = courseInfoDao.single(oldResourcesInfo.getCourseInfoId()); - if (null != oldCourseInfo) { - //资源类型(1视频 2课件 3附件) - if (((Integer) 1).equals(oldResourcesInfo.getResourcesInfoType())) { - CourseInfo c = new CourseInfo(); - c.setCourseInfoId(oldCourseInfo.getCourseInfoId()); - c.setCourseVideoId(null != oldCourseInfo.getCourseVideoId() && oldCourseInfo.getCourseVideoId().equals(oldResourcesInfo.getResourcesInfoId()) ? null : oldCourseInfo.getCourseVideoId()); - courseInfoDao.updateVideoIdById(c); - } else if (((Integer) 2).equals(oldResourcesInfo.getResourcesInfoType())) { - CourseInfo c = new CourseInfo(); - c.setCourseInfoId(oldCourseInfo.getCourseInfoId()); - c.setCourseCoursewareId(null != oldCourseInfo.getCourseCoursewareId() && oldCourseInfo.getCourseCoursewareId().equals(oldResourcesInfo.getResourcesInfoId()) ? null : oldCourseInfo.getCourseCoursewareId()); - courseInfoDao.updateCoursewareIdById(c); - } else if (((Integer) 3).equals(oldResourcesInfo.getResourcesInfoType())) { - CourseInfo c = new CourseInfo(); - c.setCourseInfoId(oldCourseInfo.getCourseInfoId()); - c.setCourseEnclosureIds(StringUtils.isNotBlank(oldCourseInfo.getCourseEnclosureIds()) ? (oldCourseInfo.getCourseEnclosureIds().replace(oldResourcesInfo.getResourcesInfoId().toString(), "").replace(",,", ",")) : oldCourseInfo.getCourseEnclosureIds()); - courseInfoDao.updateEnclosureIdsById(c); + if (ObjectUtil.isNotEmpty(oldResourcesInfo)){ + CourseInfo oldCourseInfo = courseInfoDao.single(oldResourcesInfo.getCourseInfoId()); + if (null != oldCourseInfo) { + //资源类型(1视频 2课件 3附件) + if (((Integer) 1).equals(oldResourcesInfo.getResourcesInfoType())) { + CourseInfo c = new CourseInfo(); + c.setCourseInfoId(oldCourseInfo.getCourseInfoId()); + c.setCourseVideoId(null != oldCourseInfo.getCourseVideoId() && oldCourseInfo.getCourseVideoId().equals(oldResourcesInfo.getResourcesInfoId()) ? null : oldCourseInfo.getCourseVideoId()); + courseInfoDao.updateVideoIdById(c); + } else if (((Integer) 2).equals(oldResourcesInfo.getResourcesInfoType())) { + CourseInfo c = new CourseInfo(); + c.setCourseInfoId(oldCourseInfo.getCourseInfoId()); + c.setCourseCoursewareId(null != oldCourseInfo.getCourseCoursewareId() && oldCourseInfo.getCourseCoursewareId().equals(oldResourcesInfo.getResourcesInfoId()) ? null : oldCourseInfo.getCourseCoursewareId()); + courseInfoDao.updateCoursewareIdById(c); + } else if (((Integer) 3).equals(oldResourcesInfo.getResourcesInfoType())) { + CourseInfo c = new CourseInfo(); + c.setCourseInfoId(oldCourseInfo.getCourseInfoId()); + c.setCourseEnclosureIds(StringUtils.isNotBlank(oldCourseInfo.getCourseEnclosureIds()) ? (oldCourseInfo.getCourseEnclosureIds().replace(oldResourcesInfo.getResourcesInfoId().toString(), "").replace(",,", ",")) : oldCourseInfo.getCourseEnclosureIds()); + courseInfoDao.updateEnclosureIdsById(c); + } } } } diff --git a/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionCurriculumResourcesService.java b/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionCurriculumResourcesService.java index 83c02a51..665d04cd 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionCurriculumResourcesService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/UniversitiesCollegesJurisdictionCurriculumResourcesService.java @@ -247,7 +247,7 @@ public class UniversitiesCollegesJurisdictionCurriculumResourcesService extends * 获取系统课程和院校课程 */ public List getCourseSystemOAndUniversities(Long orgId){ - return courseInfoDao.getCourseSystemOAndUniversities(ObjectUtil.equal(orgId,1) ? null : orgId); + return courseInfoDao.getCourseSystemOAndUniversities(Objects.equals(orgId,1L) ? null : orgId); } /** diff --git a/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java b/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java index ad935ca1..a8d26786 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/CourseInfoController.java @@ -322,6 +322,13 @@ public class CourseInfoController { return JsonResult.success(list); } + @GetMapping(MODEL + "/getChapterSystemOAndUniversities.json") + @ResponseBody + public JsonResult> getChapterSystemOAndUniversities(CourseInfoQuery param) { + List list = courseInfoService.getChapterSystemOAndUniversities(param); + return JsonResult.success(list); + } + @PostMapping(MODEL + "/delete.json") @Function("courseInfo.delete") @ResponseBody diff --git a/web/src/main/java/com/ibeetl/jlw/web/ResourcesInfoController.java b/web/src/main/java/com/ibeetl/jlw/web/ResourcesInfoController.java index 76a377c7..09ebd248 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/ResourcesInfoController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/ResourcesInfoController.java @@ -1,5 +1,6 @@ package com.ibeetl.jlw.web; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; import cn.jlw.Interceptor.SCoreUser; @@ -169,6 +170,29 @@ public class ResourcesInfoController{ return JsonResult.success(page); } + @PostMapping(MODEL + "/getCurriculumResourceManagementList.json") + @ResponseBody + public JsonResult getCurriculumResourceManagementList(ResourcesInfoQuery condition, @SCoreUser CoreUser coreUser){ + PageQuery page = condition.getPageQuery(); + + if (coreUser.isUniAdmin()) { + condition.setOrgIdPlural(join(Arrays.asList(coreUser.getOrgId(), 1L).toArray(), ",")); + // 查询已经授权的课程ID。 + // 理论课程:授权表universities_colleges_jurisdiction_curriculum_resources,查询理论课程授权给院校的数据 + Serializable courseInfoIds = defaultIfNull(condition.getCourseInfoId(), condition.getCourseInfoIds()); + ResourcesCourseInfoAuthDetailsVO resourcesCourseInfoAuthDetails = + universitiesCollegesJurisdictionCurriculumResourcesService.getResourcesCourseInfoAuthDetails(coreUser.getOrgId()); + Serializable ifNullCourseInfoIds = defaultIfNull(courseInfoIds, listJoin(resourcesCourseInfoAuthDetails.getTheoryCourseList(), CourseInfo::getCourseInfoId)); + + String ids = Arrays.stream(ifNullCourseInfoIds.toString().split(",")).map(item -> "_" + item + "_").collect(Collectors.joining("|")); + + // 如果为空字符串,那么代表这个学校,还没有授权的课程,所以是不会显示任何东西的。 + condition.setCourseInfoIds(StrUtil.blankToDefault(ids, "未授权应用")); + } + resourcesInfoService.getCurriculumResourceManagementList(page); + return JsonResult.success(page); + } + //批量保存 @PostMapping(MODEL + "/addAll.json") @Function("resourcesInfo.add") @@ -327,8 +351,11 @@ public class ResourcesInfoController{ @ResponseBody public JsonResult delete(String ids) { for(int i=0;i