|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package com.ibeetl.jlw.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -10,6 +11,7 @@ import com.ibeetl.admin.core.util.PlatformException;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseMergeCourseInfoDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.Student;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourse;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseQuery;
|
|
|
|
@ -24,6 +26,8 @@ import javax.validation.constraints.NotNull;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.function.BiConsumer;
|
|
|
|
|
|
|
|
|
|
import static com.ibeetl.admin.core.util.user.CacheUserUtil.getUser;
|
|
|
|
|
|
|
|
|
@ -42,6 +46,8 @@ public class TeacherOpenCourseService extends CoreBaseService<TeacherOpenCourse>
|
|
|
|
|
private TeacherOpenCourseMergeTeacherService teacherOpenCourseMergeTeacherService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeCourseInfoService teacherOpenCourseMergeCourseInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired private TeacherOpenCourseMergeCourseInfoDao teacherOpenCourseMergeCourseInfoDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherService teacherService;
|
|
|
|
|
|
|
|
|
@ -73,9 +79,25 @@ public class TeacherOpenCourseService extends CoreBaseService<TeacherOpenCourse>
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除教师开课,附带删除所有有关开课相关联的东西
|
|
|
|
|
* @param ids
|
|
|
|
|
*/
|
|
|
|
|
public void deleteTeacherOpenCourse(String ids){
|
|
|
|
|
try {
|
|
|
|
|
teacherOpenCourseDao.deleteTeacherOpenCourseByIds(ids);
|
|
|
|
|
|
|
|
|
|
// 获取接口的具体实现类
|
|
|
|
|
Map<String, DeleteResourcesBy> beansOfType = SpringUtil.getBeansOfType(DeleteResourcesBy.class);
|
|
|
|
|
// 根据开课ID,循环重置开课课程。包含题目,资源等信息。
|
|
|
|
|
for (String teacherOpenCourseId : ids.split(",")) {
|
|
|
|
|
// 调用子类实现
|
|
|
|
|
BiConsumer<String, DeleteResourcesBy> stringDeleteResourcesByBiConsumer =
|
|
|
|
|
(beanName, bean) -> bean.deleteTeacherOpenCourseAllRelatedByTeacherOpenCourseId(Long.valueOf(teacherOpenCourseId));
|
|
|
|
|
beansOfType.forEach(stringDeleteResourcesByBiConsumer);
|
|
|
|
|
}
|
|
|
|
|
// 清理缓存
|
|
|
|
|
teacherOpenCourseMergeCourseInfoService.invalidateAllCleanUpCourseInfoTreeLocalCache();
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new PlatformException("批量删除TeacherOpenCourse失败", e);
|
|
|
|
|
}
|
|
|
|
|