|
@@ -151,7 +151,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
themeSchedulerService.createNewThemeScheduler(themeDetail);
|
|
themeSchedulerService.createNewThemeScheduler(themeDetail);
|
|
themeDetailVO.setId(themeDetail.getId());
|
|
themeDetailVO.setId(themeDetail.getId());
|
|
theme2GroupService.create(themeDetailVO.getGroupId(), themeDetailVO.getId());
|
|
theme2GroupService.create(themeDetailVO.getGroupId(), themeDetailVO.getId());
|
|
- user2ThemeService.createOperationRelation(userId,themeDetail.getId(),"*");
|
|
|
|
|
|
+ user2ThemeService.createOperationRelation(userId,themeDetail.getId(),User2Theme.AUTH_ALL);
|
|
ThemeDetailVO themeDetailVOResult = themeVOWrapper.wrapperThemeDetail(themeDetail);
|
|
ThemeDetailVO themeDetailVOResult = themeVOWrapper.wrapperThemeDetail(themeDetail);
|
|
themeDetailVOResult.setCanEdit(true);
|
|
themeDetailVOResult.setCanEdit(true);
|
|
courseVO.setThemeDetailVO(themeDetailVOResult);
|
|
courseVO.setThemeDetailVO(themeDetailVOResult);
|
|
@@ -181,7 +181,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
themeDetail = themeService.createThemeDetail(themeDetail);
|
|
themeDetail = themeService.createThemeDetail(themeDetail);
|
|
themeSchedulerService.createNewThemeScheduler(themeDetail);
|
|
themeSchedulerService.createNewThemeScheduler(themeDetail);
|
|
theme2GroupService.create(forkThemeDetailVO.getGroupId(), themeDetail.getId());
|
|
theme2GroupService.create(forkThemeDetailVO.getGroupId(), themeDetail.getId());
|
|
- user2ThemeService.createOperationRelation(userId, themeDetail.getId(),"*");
|
|
|
|
|
|
+ user2ThemeService.createOperationRelation(userId, themeDetail.getId(),User2Theme.AUTH_ALL);
|
|
courseVO.setThemeDetailVO(themeVOWrapper.wrapperThemeDetail(themeDetail));
|
|
courseVO.setThemeDetailVO(themeVOWrapper.wrapperThemeDetail(themeDetail));
|
|
// fork course resource
|
|
// fork course resource
|
|
List<EntityVO> entityVOS = new ArrayList<>();
|
|
List<EntityVO> entityVOS = new ArrayList<>();
|
|
@@ -292,8 +292,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
}
|
|
}
|
|
themeDetailVO.setCanEdit(false);
|
|
themeDetailVO.setCanEdit(false);
|
|
for (User2Theme user2Theme : user2ThemeList){
|
|
for (User2Theme user2Theme : user2ThemeList){
|
|
- System.out.println(user2Theme.getOperation());
|
|
|
|
- if(user2Theme.getOperation().equals("*")){
|
|
|
|
|
|
+ if(user2Theme.getOperation().equals(User2Theme.AUTH_ALL)){
|
|
themeDetailVO.setCanEdit(true);
|
|
themeDetailVO.setCanEdit(true);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -364,7 +363,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.getAuthorizedCourseList(pageable, userId, null, "view", extraCondition, keyword);
|
|
|
|
|
|
+ Page<OperationCourse> operationCourseList = themeService.getAuthorizedCourseList(pageable, userId, null, User2Theme.AUTH_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);
|
|
@@ -378,7 +377,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
ThemeDetail themeDetail = themeService.getThemeDetailById(themeId);
|
|
ThemeDetail themeDetail = themeService.getThemeDetailById(themeId);
|
|
|
|
|
|
// 获取所有已授权的课程(除了当前课程)
|
|
// 获取所有已授权的课程(除了当前课程)
|
|
- List<OperationCourse> operationCourseList = themeService.getOperationCourseList(userId, "view").stream()
|
|
|
|
|
|
+ List<OperationCourse> operationCourseList = themeService.getOperationCourseList(userId, User2Theme.AUTH_VIEW).stream()
|
|
.filter(operationCourse -> !operationCourse.getId().equals(themeDetail.getId())).collect(Collectors.toList());
|
|
.filter(operationCourse -> !operationCourse.getId().equals(themeDetail.getId())).collect(Collectors.toList());
|
|
|
|
|
|
if(themeDetail.getPublicStatus() == ThemeDetail.IS_PUBLIC){
|
|
if(themeDetail.getPublicStatus() == ThemeDetail.IS_PUBLIC){
|
|
@@ -405,7 +404,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.getCustomizeCourseList(pageable, userId, userId, "*", null, keyword);
|
|
|
|
|
|
+ Page<OperationCourse> operationCourseList = themeService.getCustomizeCourseList(pageable, userId, userId, User2Theme.AUTH_ALL, 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);
|
|
@@ -541,8 +540,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
// 判断是否有权限编辑课程
|
|
// 判断是否有权限编辑课程
|
|
courseVO.getThemeDetailVO().setCanEdit(false);
|
|
courseVO.getThemeDetailVO().setCanEdit(false);
|
|
for (User2Theme user2Theme : user2ThemeList){
|
|
for (User2Theme user2Theme : user2ThemeList){
|
|
- System.out.println(user2Theme.getOperation());
|
|
|
|
- if(user2Theme.getOperation().equals("*")){
|
|
|
|
|
|
+ if(user2Theme.getOperation().equals(User2Theme.AUTH_ALL)){
|
|
courseVO.getThemeDetailVO().setCanEdit(true);
|
|
courseVO.getThemeDetailVO().setCanEdit(true);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -812,7 +810,7 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
if (groupService.isUserInGroup(userId, theme2Group.getGroupId()))
|
|
if (groupService.isUserInGroup(userId, theme2Group.getGroupId()))
|
|
throw new HttpBadRequestException("请勿重复加入");
|
|
throw new HttpBadRequestException("请勿重复加入");
|
|
groupService.addUserIntoGroup(userId, theme2Group.getGroupId());
|
|
groupService.addUserIntoGroup(userId, theme2Group.getGroupId());
|
|
- user2ThemeService.createOperationRelation(userId, courseId, "view");
|
|
|
|
|
|
+ user2ThemeService.createOperationRelation(userId, courseId, User2Theme.AUTH_VIEW);
|
|
return this.getCourse(courseId);
|
|
return this.getCourse(courseId);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1098,8 +1096,8 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<ThemeDetailVO> getTeacherAuthorisedCourses(Long teacherId){
|
|
public List<ThemeDetailVO> getTeacherAuthorisedCourses(Long teacherId){
|
|
- List<OperationCourse> operationCourseList = themeService.getTeacherAuthorizedCourseList(teacherId, "view");
|
|
|
|
- return operationCourseList.stream().map(operationCourse -> {
|
|
|
|
|
|
+ List<OperationCourse> operationCourseList = themeService.getTeacherAuthorizedCourseListByUse(teacherId, User2Theme.AUTH_USE);
|
|
|
|
+ return operationCourseList.stream().filter(operationCourse -> operationCourse.getPublicStatus() == ThemeDetail.IS_PUBLIC).map(operationCourse -> {
|
|
ThemeDetail convert = Converter.convert(ThemeDetail.class, operationCourse);
|
|
ThemeDetail convert = Converter.convert(ThemeDetail.class, operationCourse);
|
|
return themeVOWrapper.wrapperThemeDetail(convert);
|
|
return themeVOWrapper.wrapperThemeDetail(convert);
|
|
}).collect(Collectors.toList());
|
|
}).collect(Collectors.toList());
|
|
@@ -1122,7 +1120,6 @@ public class ThemeLogicImpl implements ThemeLogic {
|
|
if(user2ThemeList.size() > 0){
|
|
if(user2ThemeList.size() > 0){
|
|
ThemeDetail themeDetail = themeService.getThemeDetailById(courseId);
|
|
ThemeDetail themeDetail = themeService.getThemeDetailById(courseId);
|
|
user2ThemeList.stream().peek(user2Theme -> {
|
|
user2ThemeList.stream().peek(user2Theme -> {
|
|
- System.out.println(user2Theme.getOperation());
|
|
|
|
if(user2Theme.getOperation().equals(User2Theme.AUTH_USE)){
|
|
if(user2Theme.getOperation().equals(User2Theme.AUTH_USE)){
|
|
throw new HttpBadRequestException("该教师已有\""+themeDetail.getTitle()+"\"课程的使用权限!");
|
|
throw new HttpBadRequestException("该教师已有\""+themeDetail.getTitle()+"\"课程的使用权限!");
|
|
}else if(user2Theme.getOperation().equals(User2Theme.AUTH_ALL)){
|
|
}else if(user2Theme.getOperation().equals(User2Theme.AUTH_ALL)){
|