|
|
|
@ -6,15 +6,21 @@ 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.jlw.dao.CourseInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.ResourcesInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeResourcesInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.CourseInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.ResourcesInfo;
|
|
|
|
|
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 lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.beetl.sql.core.SqlId;
|
|
|
|
@ -26,10 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.math.RoundingMode;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static cn.hutool.core.util.ObjectUtil.defaultIfNull;
|
|
|
|
@ -55,6 +58,10 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
@Autowired
|
|
|
|
|
private CourseInfoDao courseInfoDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeResourcesInfoDao teacherOpenCourseMergeResourcesInfoDao;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageQuery<ResourcesInfo> queryByCondition(PageQuery query) {
|
|
|
|
|
PageQuery ret = resourcesInfoDao.queryByCondition(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
@ -98,6 +105,7 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取课程资源管理列表
|
|
|
|
|
*
|
|
|
|
|
* @param query
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
@ -137,7 +145,7 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
public void deleteResourcesInfo(String ids) {
|
|
|
|
|
for (int i = 0; i < ids.split(",").length; i++) {
|
|
|
|
|
ResourcesInfo oldResourcesInfo = queryById(Long.parseLong(ids.split(",")[i]));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(oldResourcesInfo)){
|
|
|
|
|
if (ObjectUtil.isNotEmpty(oldResourcesInfo)) {
|
|
|
|
|
CourseInfo oldCourseInfo = courseInfoDao.single(oldResourcesInfo.getCourseInfoId());
|
|
|
|
|
if (null != oldCourseInfo) {
|
|
|
|
|
//资源类型(1视频 2课件 3附件)
|
|
|
|
@ -164,6 +172,59 @@ public class ResourcesInfoService extends CoreBaseService<ResourcesInfo> {
|
|
|
|
|
resourcesInfoDao.deleteResourcesInfoByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 课程资源删除
|
|
|
|
|
* @param ids
|
|
|
|
|
* @param coreUser
|
|
|
|
|
*/
|
|
|
|
|
public void deleteCourseSystemOAndUniversities(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) {
|
|
|
|
|
//资源类型(1视频 2课件 3附件)
|
|
|
|
|
if (((Integer) 1).equals(resourcesInfo.getResourcesInfoType())) {
|
|
|
|
|
CourseInfo c = new CourseInfo();
|
|
|
|
|
c.setCourseInfoId(oldCourseInfo.getCourseInfoId());
|
|
|
|
|
c.setCourseVideoId(null != oldCourseInfo.getCourseVideoId() && oldCourseInfo.getCourseVideoId().equals(resourcesInfo.getResourcesInfoId()) ? null : oldCourseInfo.getCourseVideoId());
|
|
|
|
|
courseInfoDao.updateVideoIdById(c);
|
|
|
|
|
} else if (((Integer) 2).equals(resourcesInfo.getResourcesInfoType())) {
|
|
|
|
|
CourseInfo c = new CourseInfo();
|
|
|
|
|
c.setCourseInfoId(oldCourseInfo.getCourseInfoId());
|
|
|
|
|
c.setCourseCoursewareId(null != oldCourseInfo.getCourseCoursewareId() && oldCourseInfo.getCourseCoursewareId().equals(resourcesInfo.getResourcesInfoId()) ? null : oldCourseInfo.getCourseCoursewareId());
|
|
|
|
|
courseInfoDao.updateCoursewareIdById(c);
|
|
|
|
|
} else if (((Integer) 3).equals(resourcesInfo.getResourcesInfoType())) {
|
|
|
|
|
CourseInfo c = new CourseInfo();
|
|
|
|
|
c.setCourseInfoId(oldCourseInfo.getCourseInfoId());
|
|
|
|
|
c.setCourseEnclosureIds(StringUtils.isNotBlank(oldCourseInfo.getCourseEnclosureIds()) ? (oldCourseInfo.getCourseEnclosureIds().replace(resourcesInfo.getResourcesInfoId().toString(), "").replace(",,", ",")) : oldCourseInfo.getCourseEnclosureIds());
|
|
|
|
|
courseInfoDao.updateEnclosureIdsById(c);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
resourcesInfoDao.deleteResourcesInfoByIds(s);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeResourcesInfo teacherOpenCourseMergeResourcesInfo = teacherOpenCourseMergeResourcesInfoDao.getSQLManager()
|
|
|
|
|
.lambdaQuery(TeacherOpenCourseMergeResourcesInfo.class)
|
|
|
|
|
.andEq(TeacherOpenCourseMergeResourcesInfo::getTeacherOpenCourseMergeResourcesInfoId,s)
|
|
|
|
|
.single();
|
|
|
|
|
|
|
|
|
|
if (!Objects.isNull(teacherOpenCourseMergeResourcesInfo)) {
|
|
|
|
|
TeacherOpenCourseMergeResourcesInfo updateQuery = new TeacherOpenCourseMergeResourcesInfo();
|
|
|
|
|
updateQuery.setResourcesInfoStatus(GlobalUpStatusEnum.DEL);
|
|
|
|
|
updateQuery.setTeacherOpenCourseMergeResourcesInfoId(teacherOpenCourseMergeResourcesInfo.getTeacherOpenCourseMergeResourcesInfoId());
|
|
|
|
|
teacherOpenCourseMergeResourcesInfoDao.upsertByTemplate(updateQuery);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public boolean addAll(List<ResourcesInfo> resourcesInfoList) {
|
|
|
|
|
resourcesInfoList.forEach(item -> {
|
|
|
|
|