|
@@ -341,7 +341,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
@Override
|
|
@Override
|
|
public Page<ThemeDetailVO> getAuthorisedCourses(Pageable pageable, Map<String, String> extraCondition, String keyword) {
|
|
public Page<ThemeDetailVO> getAuthorisedCourses(Pageable pageable, Map<String, String> extraCondition, String keyword) {
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
- Page<OperationCourse> operationCourseList = themeService.getOperationCourseList(pageable, userId, null, "*", extraCondition, keyword);
|
|
|
|
|
|
+ Page<OperationCourse> operationCourseList = themeService.getAuthorizedCourseList(pageable, userId, null, "view", extraCondition, keyword);
|
|
return operationCourseList.map(operationCourse -> {
|
|
return operationCourseList.map(operationCourse -> {
|
|
ThemeDetail convert = Converter.convert(ThemeDetail.class, operationCourse);
|
|
ThemeDetail convert = Converter.convert(ThemeDetail.class, operationCourse);
|
|
return themeVOWrapper.wrapperThemeDetail(convert);
|
|
return themeVOWrapper.wrapperThemeDetail(convert);
|
|
@@ -353,7 +353,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
public Long[] getAuthorisedResourceList(String keyword) {
|
|
public Long[] getAuthorisedResourceList(String keyword) {
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
// 获取所有已授权的课程
|
|
// 获取所有已授权的课程
|
|
- List<OperationCourse> operationCourseList = themeService.getOperationCourseList(userId, "*");
|
|
|
|
|
|
+ List<OperationCourse> operationCourseList = themeService.getOperationCourseList(userId, "view");
|
|
// 获取包含关键字的课程章节对应的已授权课程
|
|
// 获取包含关键字的课程章节对应的已授权课程
|
|
List<List<ThemeEntityRelations>> relationsLists = operationCourseList.stream().map(operationCourse -> themeService.getThemeEntityRelations(operationCourse.getId())).collect(Collectors.toList());
|
|
List<List<ThemeEntityRelations>> relationsLists = operationCourseList.stream().map(operationCourse -> themeService.getThemeEntityRelations(operationCourse.getId())).collect(Collectors.toList());
|
|
Set<Long> themeIdSet = new HashSet<>();
|
|
Set<Long> themeIdSet = new HashSet<>();
|
|
@@ -385,7 +385,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
@Override
|
|
@Override
|
|
public Page<ThemeDetailVO> getCustomizeCourses(Pageable pageable, String keyword) {
|
|
public Page<ThemeDetailVO> getCustomizeCourses(Pageable pageable, String keyword) {
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
Long userId = (Long) SecurityUtils.getSubject().getSession().getAttribute("userId");
|
|
- Page<OperationCourse> operationCourseList = themeService.getOperationCourseList(pageable, userId, userId, "*", null, keyword);
|
|
|
|
|
|
+ Page<OperationCourse> operationCourseList = themeService.getCustomizeCourseList(pageable, userId, userId, "*", null, keyword);
|
|
return operationCourseList.map(operationCourse -> {
|
|
return operationCourseList.map(operationCourse -> {
|
|
ThemeDetail convert = Converter.convert(ThemeDetail.class, operationCourse);
|
|
ThemeDetail convert = Converter.convert(ThemeDetail.class, operationCourse);
|
|
return themeVOWrapper.wrapperThemeDetail(convert);
|
|
return themeVOWrapper.wrapperThemeDetail(convert);
|
|
@@ -494,6 +494,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
throw new HttpForbiddenException(String.format("User Cannot Access This Course, UserId: %s", userId));
|
|
throw new HttpForbiddenException(String.format("User Cannot Access This Course, UserId: %s", userId));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
//根据id查询,然后过滤存map
|
|
//根据id查询,然后过滤存map
|
|
List<ThemeEntityRelations> themeEntityRelations = themeService.getThemeEntityRelations(id);
|
|
List<ThemeEntityRelations> themeEntityRelations = themeService.getThemeEntityRelations(id);
|
|
Theme theme = new Theme();
|
|
Theme theme = new Theme();
|
|
@@ -511,6 +512,13 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
CourseVO courseVO = themeVOWrapper.wrapTheme2CourseVO(theme, themeEntityRelations);
|
|
CourseVO courseVO = themeVOWrapper.wrapTheme2CourseVO(theme, themeEntityRelations);
|
|
|
|
+ User2Theme user2Theme = user2ThemeService.findByUserIdAndThemeId(userId, id);
|
|
|
|
+ // 判断是否有权限编辑课程
|
|
|
|
+ if(!user2Theme.getOperation().equals("*")){
|
|
|
|
+ courseVO.getThemeDetailVO().setCanEdit(false);
|
|
|
|
+ }else{
|
|
|
|
+ courseVO.getThemeDetailVO().setCanEdit(true);
|
|
|
|
+ }
|
|
|
|
|
|
// 获取课程中的实体数量
|
|
// 获取课程中的实体数量
|
|
List<ThemeEntityRelations> entityRelationsList = themeService.getThemeEntityRelations(id);
|
|
List<ThemeEntityRelations> entityRelationsList = themeService.getThemeEntityRelations(id);
|