|
|
|
@ -6,22 +6,20 @@ import cn.hutool.core.lang.Assert;
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
|
import cn.jlw.Interceptor.SCoreUser;
|
|
|
|
|
import cn.jlw.aliPay.utils.StringUtils;
|
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
|
|
|
|
import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.jlw.dao.CourseInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.ResourcesInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeCourseInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.*;
|
|
|
|
|
import com.ibeetl.jlw.entity.CourseInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.ResourcesInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourse;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesInfo;
|
|
|
|
|
import com.ibeetl.jlw.enums.GlobalUpStatusEnum;
|
|
|
|
|
import com.ibeetl.jlw.enums.MoveEnum;
|
|
|
|
|
import com.ibeetl.jlw.web.query.ResourcesInfoQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesInfoQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesQuestionQuery;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
@ -179,17 +177,18 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 课程资源删除
|
|
|
|
|
* 课程资源删除-系统管理端
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @param coreUser
|
|
|
|
|
*/
|
|
|
|
|
public void deleteCourseSystemOAndUniversities(String ids, CoreUser coreUser) {
|
|
|
|
|
public void deleteCourseSystem(String ids, CoreUser coreUser) {
|
|
|
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
|
|
|
String[] split = ids.split(",");
|
|
|
|
|
for (String s : split) {
|
|
|
|
|
ResourcesInfo resourcesInfo = getById(Long.parseLong(s));
|
|
|
|
|
if (!ObjectUtil.isNull(resourcesInfo)) {
|
|
|
|
|
if (coreUser.isAdmin()){
|
|
|
|
|
|
|
|
|
|
courseInfoService.flushCache(resourcesInfo.getCourseInfoId());
|
|
|
|
|
CourseInfo oldCourseInfo = courseInfoDao.single(resourcesInfo.getCourseInfoId());
|
|
|
|
|
if (null != oldCourseInfo) {
|
|
|
|
@ -214,14 +213,28 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
ResourcesInfo info = new ResourcesInfo();
|
|
|
|
|
info.setResourcesInfoStatus(0);
|
|
|
|
|
resourcesInfoDao.getSQLManager().lambdaQuery(ResourcesInfo.class)
|
|
|
|
|
.andEq(ResourcesInfo::getResourcesInfoId,s).updateSelective(info);
|
|
|
|
|
.andEq(ResourcesInfo::getResourcesInfoId, s).updateSelective(info);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 课程资源删除-院校管理端
|
|
|
|
|
*
|
|
|
|
|
* @param ids
|
|
|
|
|
* @param coreUser
|
|
|
|
|
*/
|
|
|
|
|
public void deleteCourseUniversities(String ids, CoreUser coreUser) {
|
|
|
|
|
if (StringUtils.isNotEmpty(ids)) {
|
|
|
|
|
String[] split = ids.split(",");
|
|
|
|
|
for (String s : split) {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeResourcesInfo teacherOpenCourseMergeResourcesInfo = teacherOpenCourseMergeResourcesInfoDao.getSQLManager()
|
|
|
|
|
.lambdaQuery(TeacherOpenCourseMergeResourcesInfo.class)
|
|
|
|
|
.andEq(TeacherOpenCourseMergeResourcesInfo::getTeacherOpenCourseMergeResourcesInfoId,s)
|
|
|
|
|
.andEq(TeacherOpenCourseMergeResourcesInfo::getTeacherOpenCourseMergeResourcesInfoId, s)
|
|
|
|
|
.single();
|
|
|
|
|
if (!ObjectUtil.isEmpty(teacherOpenCourseMergeResourcesInfo)) {
|
|
|
|
|
|
|
|
|
@ -229,15 +242,16 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
teacherOpenCourse.setTeacherOpenCourseId(teacherOpenCourseMergeResourcesInfo.getTeacherOpenCourseId());
|
|
|
|
|
List<TeacherOpenCourse> teacherOpenCourses = teacherOpenCourseService.getValues(teacherOpenCourse);
|
|
|
|
|
|
|
|
|
|
if (CollectionUtil.isNotEmpty(teacherOpenCourses) && teacherOpenCourses.get(0).getEndTime().getTime() >= new Date().getTime()){
|
|
|
|
|
Assert.isTrue(false, "课程在使用中");
|
|
|
|
|
}
|
|
|
|
|
if (CollectionUtil.isNotEmpty(teacherOpenCourses) && teacherOpenCourses.get(0).getEndTime().getTime() <= new Date().getTime()) {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeResourcesInfo updateQuery = new TeacherOpenCourseMergeResourcesInfo();
|
|
|
|
|
updateQuery.setResourcesInfoStatus(GlobalUpStatusEnum.DEL);
|
|
|
|
|
updateQuery.setTeacherOpenCourseMergeResourcesInfoId(teacherOpenCourseMergeResourcesInfo.getTeacherOpenCourseMergeResourcesInfoId());
|
|
|
|
|
teacherOpenCourseMergeResourcesInfoDao.upsertByTemplate(updateQuery);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if (split.length == 1) {
|
|
|
|
|
Assert.isTrue(false, "课程在使用中");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|