|
|
|
@ -12,11 +12,16 @@ import com.ibeetl.admin.core.annotation.Function;
|
|
|
|
|
import com.ibeetl.admin.core.entity.CoreUser;
|
|
|
|
|
import com.ibeetl.admin.core.file.FileService;
|
|
|
|
|
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.CourseInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.ResourcesInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeCourseInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseMergeResourcesInfo;
|
|
|
|
|
import com.ibeetl.jlw.entity.vo.ResourcesCourseInfoAuthDetailsVO;
|
|
|
|
|
import com.ibeetl.jlw.enums.AddTypeEnum;
|
|
|
|
|
import com.ibeetl.jlw.enums.GlobalUpStatusEnum;
|
|
|
|
|
import com.ibeetl.jlw.enums.MoveEnum;
|
|
|
|
|
import com.ibeetl.jlw.service.CourseInfoService;
|
|
|
|
@ -25,10 +30,12 @@ import com.ibeetl.jlw.service.TeacherOpenCourseMergeResourcesInfoService;
|
|
|
|
|
import com.ibeetl.jlw.service.UniversitiesCollegesJurisdictionCurriculumResourcesService;
|
|
|
|
|
import com.ibeetl.jlw.web.query.ResourcesInfoQuery;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseMergeResourcesInfoQuery;
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
import org.beetl.sql.core.engine.PageQuery;
|
|
|
|
|
import org.beetl.sql.core.query.LambdaQuery;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
|
@ -46,6 +53,7 @@ import java.math.RoundingMode;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static cn.hutool.core.util.ArrayUtil.join;
|
|
|
|
@ -61,16 +69,24 @@ import static com.ibeetl.jlw.enums.AddTypeEnum.FACULTY_ADD;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
@Validated
|
|
|
|
|
public class ResourcesInfoController{
|
|
|
|
|
public class ResourcesInfoController {
|
|
|
|
|
|
|
|
|
|
private final Log log = LogFactory.getLog(this.getClass());
|
|
|
|
|
private static final String MODEL = "/jlw/resourcesInfo";
|
|
|
|
|
private static final String API = "/api/resourcesInfo";
|
|
|
|
|
|
|
|
|
|
@Autowired private ResourcesInfoService resourcesInfoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesInfoService resourcesInfoService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private ResourcesInfoDao resourcesInfoDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private CourseInfoService courseInfoService;
|
|
|
|
|
|
|
|
|
|
@Autowired private CourseInfoService courseInfoService;
|
|
|
|
|
@Autowired private UniversitiesCollegesJurisdictionCurriculumResourcesService universitiesCollegesJurisdictionCurriculumResourcesService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private CourseInfoDao courseInfoDao;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UniversitiesCollegesJurisdictionCurriculumResourcesService universitiesCollegesJurisdictionCurriculumResourcesService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
FileService fileService;
|
|
|
|
@ -78,6 +94,9 @@ public class ResourcesInfoController{
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeResourcesInfoDao teacherOpenCourseMergeResourcesInfoDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TeacherOpenCourseMergeCourseInfoDao teacherOpenCourseMergeCourseInfoDao;
|
|
|
|
|
|
|
|
|
|
/* 前端接口 */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -88,7 +107,7 @@ public class ResourcesInfoController{
|
|
|
|
|
@Function("resourcesInfo.query")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ModelAndView index() {
|
|
|
|
|
ModelAndView view = new ModelAndView("/jlw/resourcesInfo/index.html") ;
|
|
|
|
|
ModelAndView view = new ModelAndView("/jlw/resourcesInfo/index.html");
|
|
|
|
|
view.addObject("search", ResourcesInfoQuery.class.getName());
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
@ -108,25 +127,140 @@ public class ResourcesInfoController{
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ModelAndView add(Long resourcesInfoId) {
|
|
|
|
|
ModelAndView view = new ModelAndView("/jlw/resourcesInfo/add.html");
|
|
|
|
|
if(null != resourcesInfoId){
|
|
|
|
|
ResourcesInfo resourcesInfo = resourcesInfoService.queryById(resourcesInfoId);
|
|
|
|
|
// if(null != resourcesInfoId){
|
|
|
|
|
// ResourcesInfo resourcesInfo = resourcesInfoService.queryById(resourcesInfoId);
|
|
|
|
|
// view.addObject("resourcesInfo", resourcesInfo);
|
|
|
|
|
// CourseInfo courseInfo = courseInfoService.queryById(resourcesInfo.getCourseInfoId());
|
|
|
|
|
// if(courseInfo != null && courseInfo.getCourseInfoParentId() != null){ //父节点不为空时 说明当前节点可能是二级节点也可能是三级节点
|
|
|
|
|
// CourseInfo courseInfoNew = new CourseInfo();
|
|
|
|
|
// courseInfoNew.setCourseInfoParentId(courseInfo.getCourseInfoId());//当前ID作为父ID去查询数据 如果存在则表示还有下级节点 否则没有则表示是三级节点
|
|
|
|
|
// List<CourseInfo> courseInfoList = courseInfoService.getValues(courseInfoNew);
|
|
|
|
|
// if(courseInfoList.size() > 0){ //二级节点
|
|
|
|
|
// view.addObject("courseInfoId", courseInfo.getCourseInfoParentId());
|
|
|
|
|
// view.addObject("twoChildNode", courseInfo.getCourseInfoId());
|
|
|
|
|
// view.addObject("threeChildNode", null);
|
|
|
|
|
// }else { //三级节点
|
|
|
|
|
// view.addObject("courseInfoId", courseInfoService.queryById(courseInfo.getCourseInfoParentId()).getCourseInfoParentId());
|
|
|
|
|
// view.addObject("twoChildNode", courseInfo.getCourseInfoParentId());
|
|
|
|
|
// view.addObject("threeChildNode", courseInfo.getCourseInfoId());
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// view.addObject("courseInfoId", courseInfo != null?courseInfo.getCourseInfoId():null);
|
|
|
|
|
// view.addObject("twoChildNode", null);
|
|
|
|
|
// view.addObject("threeChildNode", null);
|
|
|
|
|
// }
|
|
|
|
|
// }else {
|
|
|
|
|
// view.addObject("resourcesInfo", new ResourcesInfo());
|
|
|
|
|
// view.addObject("courseInfoId", null);
|
|
|
|
|
// view.addObject("twoChildNode", null);
|
|
|
|
|
// view.addObject("threeChildNode", null);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotNull(resourcesInfoId)){
|
|
|
|
|
boolean b = false;
|
|
|
|
|
//判断是否系统授权资源
|
|
|
|
|
ResourcesInfo resourcesInfo = resourcesInfoDao.getSQLManager()
|
|
|
|
|
.lambdaQuery(ResourcesInfo.class)
|
|
|
|
|
.andEq(ResourcesInfo::getResourcesInfoId, resourcesInfoId)
|
|
|
|
|
.single();
|
|
|
|
|
view.addObject("resourcesInfo", resourcesInfo);
|
|
|
|
|
CourseInfo courseInfo = courseInfoService.queryById(resourcesInfo.getCourseInfoId());
|
|
|
|
|
if(courseInfo != null && courseInfo.getCourseInfoParentId() != null){ //父节点不为空时 说明当前节点可能是二级节点也可能是三级节点
|
|
|
|
|
CourseInfo courseInfoNew = new CourseInfo();
|
|
|
|
|
courseInfoNew.setCourseInfoParentId(courseInfo.getCourseInfoId());//当前ID作为父ID去查询数据 如果存在则表示还有下级节点 否则没有则表示是三级节点
|
|
|
|
|
List<CourseInfo> courseInfoList = courseInfoService.getValues(courseInfoNew);
|
|
|
|
|
if(courseInfoList.size() > 0){ //二级节点
|
|
|
|
|
view.addObject("courseInfoId", courseInfo.getCourseInfoParentId());
|
|
|
|
|
view.addObject("twoChildNode", courseInfo.getCourseInfoId());
|
|
|
|
|
view.addObject("threeChildNode", null);
|
|
|
|
|
}else { //三级节点
|
|
|
|
|
view.addObject("courseInfoId", courseInfoService.queryById(courseInfo.getCourseInfoParentId()).getCourseInfoParentId());
|
|
|
|
|
view.addObject("twoChildNode", courseInfo.getCourseInfoParentId());
|
|
|
|
|
view.addObject("threeChildNode", courseInfo.getCourseInfoId());
|
|
|
|
|
if (ObjectUtil.isNotNull(resourcesInfo)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取小节
|
|
|
|
|
CourseInfo sectionInfo = courseInfoDao.getById(resourcesInfo.getCourseInfoId());
|
|
|
|
|
|
|
|
|
|
//判断是否系统授权课程
|
|
|
|
|
if (ObjectUtil.isNull(sectionInfo)) {
|
|
|
|
|
TeacherOpenCourseMergeCourseInfo sectionCourseInfos = teacherOpenCourseMergeCourseInfoDao.getById(resourcesInfo.getCourseInfoId());
|
|
|
|
|
if (ObjectUtil.isNotNull(sectionCourseInfos)) {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeCourseInfo chapterCourseInfos = teacherOpenCourseMergeCourseInfoDao.getById(sectionCourseInfos.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(chapterCourseInfos)) {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeCourseInfo courseInfos = teacherOpenCourseMergeCourseInfoDao.getById(chapterCourseInfos.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(courseInfos)) {
|
|
|
|
|
b = true;
|
|
|
|
|
view.addObject("courseInfoId", courseInfos.getTeacherOpenCourseId());
|
|
|
|
|
view.addObject("twoChildNode", chapterCourseInfos.getTeacherOpenCourseMergeCourseInfoId());
|
|
|
|
|
view.addObject("threeChildNode", sectionCourseInfos.getTeacherOpenCourseMergeCourseInfoId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
CourseInfo chapterInfo = courseInfoDao.getById(sectionInfo.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(chapterInfo)) {
|
|
|
|
|
CourseInfo courseInfo = courseInfoDao.getById(chapterInfo.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(courseInfo)) {
|
|
|
|
|
view.addObject("courseInfoId", courseInfo.getCourseInfoId());
|
|
|
|
|
view.addObject("twoChildNode", chapterInfo.getCourseInfoId());
|
|
|
|
|
view.addObject("threeChildNode", sectionInfo.getCourseInfoId());
|
|
|
|
|
b = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
view.addObject("courseInfoId", courseInfo != null?courseInfo.getCourseInfoId():null);
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeResourcesInfo mergeResourcesInfo = teacherOpenCourseMergeResourcesInfoDao.getSQLManager()
|
|
|
|
|
.lambdaQuery(TeacherOpenCourseMergeResourcesInfo.class)
|
|
|
|
|
.andEq(TeacherOpenCourseMergeResourcesInfo::getTeacherOpenCourseMergeResourcesInfoId, resourcesInfoId)
|
|
|
|
|
.single();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResourcesInfo resources = new ResourcesInfo();
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotNull(mergeResourcesInfo)) {
|
|
|
|
|
|
|
|
|
|
resources.setResourcesInfoId(mergeResourcesInfo.getTeacherOpenCourseMergeResourcesInfoId());
|
|
|
|
|
resources.setCourseInfoId(mergeResourcesInfo.getTeacherOpenCourseId());
|
|
|
|
|
resources.setResourcesInfoName(mergeResourcesInfo.getResourcesInfoName());
|
|
|
|
|
resources.setResourcesInfoType(mergeResourcesInfo.getResourcesInfoType());
|
|
|
|
|
resources.setResourcesInfoContent(mergeResourcesInfo.getResourcesInfoContent());
|
|
|
|
|
resources.setOrgId(mergeResourcesInfo.getOrgId());
|
|
|
|
|
resources.setUserId(mergeResourcesInfo.getUserId());
|
|
|
|
|
resources.setOrderIndex(mergeResourcesInfo.getOrderIndex());
|
|
|
|
|
resources.setAddType(FACULTY_ADD);
|
|
|
|
|
resources.setAddTime(mergeResourcesInfo.getAddTime());
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeCourseInfo sectionCourseInfos = teacherOpenCourseMergeCourseInfoDao.getById(mergeResourcesInfo.getTeacherOpenCourseMergeCourseInfoId());
|
|
|
|
|
|
|
|
|
|
//判断是否系统授权课程
|
|
|
|
|
if (ObjectUtil.isNull(sectionCourseInfos)) {
|
|
|
|
|
//获取小节
|
|
|
|
|
CourseInfo sectionInfo = courseInfoDao.getById(mergeResourcesInfo.getTeacherOpenCourseMergeCourseInfoId());
|
|
|
|
|
if (ObjectUtil.isNotNull(sectionInfo)) {
|
|
|
|
|
//获取章节
|
|
|
|
|
CourseInfo chapterInfo = courseInfoDao.getById(sectionInfo.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(chapterInfo)) {
|
|
|
|
|
CourseInfo courseInfo = courseInfoDao.getById(chapterInfo.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(courseInfo)) {
|
|
|
|
|
view.addObject("courseInfoId", courseInfo.getCourseInfoId());
|
|
|
|
|
view.addObject("twoChildNode", chapterInfo.getCourseInfoId());
|
|
|
|
|
view.addObject("threeChildNode", sectionInfo.getCourseInfoId());
|
|
|
|
|
b = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
TeacherOpenCourseMergeCourseInfo chapterCourseInfos = teacherOpenCourseMergeCourseInfoDao.getById(sectionCourseInfos.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(chapterCourseInfos)) {
|
|
|
|
|
TeacherOpenCourseMergeCourseInfo courseInfos = teacherOpenCourseMergeCourseInfoDao.getById(chapterCourseInfos.getCourseInfoParentId());
|
|
|
|
|
if (ObjectUtil.isNotNull(courseInfos)) {
|
|
|
|
|
view.addObject("courseInfoId", courseInfos.getTeacherOpenCourseId());
|
|
|
|
|
view.addObject("twoChildNode", chapterCourseInfos.getTeacherOpenCourseMergeCourseInfoId());
|
|
|
|
|
view.addObject("threeChildNode", sectionCourseInfos.getTeacherOpenCourseMergeCourseInfoId());
|
|
|
|
|
b = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
view.addObject("resourcesInfo", resources);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!b) {
|
|
|
|
|
view.addObject("courseInfoId", null);
|
|
|
|
|
view.addObject("twoChildNode", null);
|
|
|
|
|
view.addObject("threeChildNode", null);
|
|
|
|
|
}
|
|
|
|
@ -136,6 +270,9 @@ public class ResourcesInfoController{
|
|
|
|
|
view.addObject("twoChildNode", null);
|
|
|
|
|
view.addObject("threeChildNode", null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -147,7 +284,7 @@ public class ResourcesInfoController{
|
|
|
|
|
ModelAndView view = new ModelAndView("/jlw/previewPage/previewData.html");
|
|
|
|
|
ResourcesInfo resourcesInfo = resourcesInfoService.getById(resourcesInfoId);
|
|
|
|
|
view.addObject("resourcesInfo", resourcesInfo);
|
|
|
|
|
view.addObject("resourcesInfoContent", resourcesInfo.getResourcesInfoContent().replaceAll("\\\\","/"));
|
|
|
|
|
view.addObject("resourcesInfoContent", resourcesInfo.getResourcesInfoContent().replaceAll("\\\\", "/"));
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -156,7 +293,7 @@ public class ResourcesInfoController{
|
|
|
|
|
@PostMapping(MODEL + "/list.json")
|
|
|
|
|
@Function("resourcesInfo.query")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult<PageQuery> list(ResourcesInfoQuery condition, @SCoreUser CoreUser coreUser){
|
|
|
|
|
public JsonResult<PageQuery> list(ResourcesInfoQuery condition, @SCoreUser CoreUser coreUser) {
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
|
|
|
|
|
|
|
if (coreUser.isUniAdmin()) {
|
|
|
|
@ -180,23 +317,9 @@ public class ResourcesInfoController{
|
|
|
|
|
|
|
|
|
|
@PostMapping(MODEL + "/getCurriculumResourceManagementList.json")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult<PageQuery> getCurriculumResourceManagementList(ResourcesInfoQuery condition, @SCoreUser CoreUser coreUser){
|
|
|
|
|
public JsonResult<PageQuery> getCurriculumResourceManagementList(ResourcesInfoQuery condition, @SCoreUser CoreUser coreUser) {
|
|
|
|
|
PageQuery page = condition.getPageQuery();
|
|
|
|
|
|
|
|
|
|
if (coreUser.isUniAdmin()) {
|
|
|
|
|
condition.setOrgIdPlural(join(Arrays.asList(coreUser.getOrgId(), 1L).toArray(), ","));
|
|
|
|
|
// 查询已经授权的课程ID。
|
|
|
|
|
// 理论课程:授权表universities_colleges_jurisdiction_curriculum_resources,查询理论课程授权给院校的数据
|
|
|
|
|
Serializable courseInfoIds = defaultIfNull(condition.getCourseInfoId(), condition.getCourseInfoIds());
|
|
|
|
|
ResourcesCourseInfoAuthDetailsVO resourcesCourseInfoAuthDetails =
|
|
|
|
|
universitiesCollegesJurisdictionCurriculumResourcesService.getResourcesCourseInfoAuthDetails(coreUser.getOrgId());
|
|
|
|
|
Serializable ifNullCourseInfoIds = defaultIfNull(courseInfoIds, listJoin(resourcesCourseInfoAuthDetails.getTheoryCourseList(), CourseInfo::getCourseInfoId));
|
|
|
|
|
|
|
|
|
|
String ids = Arrays.stream(ifNullCourseInfoIds.toString().split(",")).map(item -> "_" + item + "_").collect(Collectors.joining("|"));
|
|
|
|
|
|
|
|
|
|
// 如果为空字符串,那么代表这个学校,还没有授权的课程,所以是不会显示任何东西的。
|
|
|
|
|
condition.setCourseInfoIds(StrUtil.blankToDefault(ids, "未授权应用"));
|
|
|
|
|
}
|
|
|
|
|
condition.setOrgId(coreUser.isAdmin() ? null : coreUser.getOrgId());
|
|
|
|
|
resourcesInfoService.getCurriculumResourceManagementList(page);
|
|
|
|
|
return JsonResult.success(page);
|
|
|
|
|
}
|
|
|
|
@ -205,33 +328,34 @@ public class ResourcesInfoController{
|
|
|
|
|
@PostMapping(MODEL + "/addAll.json")
|
|
|
|
|
@Function("resourcesInfo.add")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult addAll(String resourcesInfoJson,Long courseId,Long chapterId, @SCoreUser CoreUser coreUser){// courseId课程ID chapterId章ID
|
|
|
|
|
if(StringUtils.isNotBlank(resourcesInfoJson)){
|
|
|
|
|
public JsonResult addAll(String resourcesInfoJson, Long courseId, Long chapterId, @SCoreUser CoreUser coreUser) {// courseId课程ID chapterId章ID
|
|
|
|
|
if (StringUtils.isNotBlank(resourcesInfoJson)) {
|
|
|
|
|
List<ResourcesInfo> resourcesInfoList = null;
|
|
|
|
|
try {
|
|
|
|
|
resourcesInfoList = JSON.parseArray(resourcesInfoJson, ResourcesInfo.class);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
try {
|
|
|
|
|
resourcesInfoList.add(JSONObject.parseObject(resourcesInfoJson, ResourcesInfo.class));
|
|
|
|
|
} catch (Exception e1) {}
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ToolUtils.deleteNullList(resourcesInfoList);
|
|
|
|
|
if(null != resourcesInfoList && resourcesInfoList.size()>0){
|
|
|
|
|
if (null != resourcesInfoList && resourcesInfoList.size() > 0) {
|
|
|
|
|
|
|
|
|
|
List<CourseInfo> courseInfoList = null;
|
|
|
|
|
if(null != chapterId){
|
|
|
|
|
if (null != chapterId) {
|
|
|
|
|
courseInfoList = courseInfoService.getCourseResources(chapterId);
|
|
|
|
|
}else if(null != courseId){
|
|
|
|
|
} else if (null != courseId) {
|
|
|
|
|
courseInfoList = courseInfoService.getCourseResources(courseId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果未指定章节则根据文件名进行整理
|
|
|
|
|
for(int i=0;null != courseInfoList && courseInfoList.size()>0 && i<resourcesInfoList.size();i++){
|
|
|
|
|
if(null == resourcesInfoList.get(i).getCourseInfoId()){
|
|
|
|
|
if(StringUtils.isNotBlank(resourcesInfoList.get(i).getResourcesInfoName())){
|
|
|
|
|
for (int i = 0; null != courseInfoList && courseInfoList.size() > 0 && i < resourcesInfoList.size(); i++) {
|
|
|
|
|
if (null == resourcesInfoList.get(i).getCourseInfoId()) {
|
|
|
|
|
if (StringUtils.isNotBlank(resourcesInfoList.get(i).getResourcesInfoName())) {
|
|
|
|
|
String resourcesInfoName = CourseInfoService.serialNumberFormat(resourcesInfoList.get(i).getResourcesInfoName());
|
|
|
|
|
for(int j=0;j<courseInfoList.size();j++){
|
|
|
|
|
if(courseInfoList.get(j).getCourseInfoName().contains(resourcesInfoName.split(" ")[0])){
|
|
|
|
|
for (int j = 0; j < courseInfoList.size(); j++) {
|
|
|
|
|
if (courseInfoList.get(j).getCourseInfoName().contains(resourcesInfoName.split(" ")[0])) {
|
|
|
|
|
resourcesInfoList.get(i).setCourseInfoId(courseInfoList.get(j).getCourseInfoId());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -248,16 +372,16 @@ public class ResourcesInfoController{
|
|
|
|
|
});
|
|
|
|
|
resourcesInfoService.addAll(resourcesInfoList);
|
|
|
|
|
|
|
|
|
|
for(int i=0;i<resourcesInfoList.size();i++){
|
|
|
|
|
for (int i = 0; i < resourcesInfoList.size(); i++) {
|
|
|
|
|
//移除缓存
|
|
|
|
|
courseInfoService.flushCache(resourcesInfoList.get(i).getCourseInfoId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
return JsonResult.failMessage("保存失败,文件为空");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
return JsonResult.failMessage("保存失败,文件为空");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -273,7 +397,7 @@ public class ResourcesInfoController{
|
|
|
|
|
@PostMapping(MODEL + "/copy.json")
|
|
|
|
|
@Function("resourcesInfo.add")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult copy(@NotBlank(message = "资源IDs不能为空!") String resourcesInfoIds, @NotNull(message = "课程ID不能为空!") Long courseId){// courseId课程ID
|
|
|
|
|
public JsonResult copy(@NotBlank(message = "资源IDs不能为空!") String resourcesInfoIds, @NotNull(message = "课程ID不能为空!") Long courseId) {// courseId课程ID
|
|
|
|
|
resourcesInfoService.copy(resourcesInfoIds, courseId);
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
}
|
|
|
|
@ -282,20 +406,20 @@ public class ResourcesInfoController{
|
|
|
|
|
@PostMapping(MODEL + "/setCourseInfoId.json")
|
|
|
|
|
@Function("resourcesInfo.edit")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult setCourseInfoId(Long courseInfoId,String resourcesInfoIds){
|
|
|
|
|
if(!ToolUtils.isNotSplitBlank(resourcesInfoIds,",",0)){
|
|
|
|
|
public JsonResult setCourseInfoId(Long courseInfoId, String resourcesInfoIds) {
|
|
|
|
|
if (!ToolUtils.isNotSplitBlank(resourcesInfoIds, ",", 0)) {
|
|
|
|
|
return JsonResult.failMessage("请选择所需要设置的资源");
|
|
|
|
|
}else if(null == courseInfoId){
|
|
|
|
|
} else if (null == courseInfoId) {
|
|
|
|
|
return JsonResult.failMessage("请选择相应的小节");
|
|
|
|
|
}
|
|
|
|
|
List<ResourcesInfo>resourcesInfoList = new ArrayList<>();
|
|
|
|
|
for(int i=0;i<resourcesInfoIds.split(",").length;i++){
|
|
|
|
|
List<ResourcesInfo> resourcesInfoList = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < resourcesInfoIds.split(",").length; i++) {
|
|
|
|
|
ResourcesInfo resourcesInfo = new ResourcesInfo();
|
|
|
|
|
resourcesInfo.setResourcesInfoId(Long.parseLong(resourcesInfoIds.split(",")[i]));
|
|
|
|
|
resourcesInfo.setCourseInfoId(courseInfoId);
|
|
|
|
|
resourcesInfoList.add(resourcesInfo);
|
|
|
|
|
}
|
|
|
|
|
if(resourcesInfoList.size()>0){
|
|
|
|
|
if (resourcesInfoList.size() > 0) {
|
|
|
|
|
resourcesInfoService.updateBatchTemplate(resourcesInfoList);
|
|
|
|
|
}
|
|
|
|
|
return JsonResult.success();
|
|
|
|
@ -304,10 +428,10 @@ public class ResourcesInfoController{
|
|
|
|
|
@PostMapping(MODEL + "/add.json")
|
|
|
|
|
@Function("resourcesInfo.add")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult add(@Validated(ValidateConfig.ADD.class)ResourcesInfo resourcesInfo, BindingResult result){
|
|
|
|
|
if(result.hasErrors()){
|
|
|
|
|
public JsonResult add(@Validated(ValidateConfig.ADD.class) ResourcesInfo resourcesInfo, BindingResult result) {
|
|
|
|
|
if (result.hasErrors()) {
|
|
|
|
|
return JsonResult.failMessage(result);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
resourcesInfoService.add(resourcesInfo);
|
|
|
|
|
|
|
|
|
|
//移除缓存
|
|
|
|
@ -320,21 +444,21 @@ public class ResourcesInfoController{
|
|
|
|
|
@PostMapping(MODEL + "/edit.json")
|
|
|
|
|
@Function("resourcesInfo.edit")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) ResourcesInfo resourcesInfo, BindingResult result) {
|
|
|
|
|
if(result.hasErrors()){
|
|
|
|
|
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) ResourcesInfo resourcesInfo, BindingResult result) {
|
|
|
|
|
if (result.hasErrors()) {
|
|
|
|
|
return JsonResult.failMessage(result);
|
|
|
|
|
}else {
|
|
|
|
|
if (ObjectUtil.equal(resourcesInfo.getSourceType(),1)){
|
|
|
|
|
} else {
|
|
|
|
|
if (ObjectUtil.equal(resourcesInfo.getSourceType(), 1)) {
|
|
|
|
|
TeacherOpenCourseMergeResourcesInfo single = teacherOpenCourseMergeResourcesInfoDao.getSQLManager().lambdaQuery(TeacherOpenCourseMergeResourcesInfo.class)
|
|
|
|
|
.andEq(TeacherOpenCourseMergeResourcesInfo::getTeacherOpenCourseMergeResourcesInfoId, resourcesInfo.getResourcesInfoId())
|
|
|
|
|
.single();
|
|
|
|
|
Integer success = null;
|
|
|
|
|
if (ObjectUtil.isNotNull(single)){
|
|
|
|
|
if (ObjectUtil.isNotNull(single)) {
|
|
|
|
|
single.setTeacherOpenCourseMergeCourseInfoId(resourcesInfo.getCourseInfoId());
|
|
|
|
|
success = teacherOpenCourseMergeResourcesInfoDao.updateTemplateById(single);
|
|
|
|
|
success = teacherOpenCourseMergeResourcesInfoDao.updateTemplateById(single);
|
|
|
|
|
}
|
|
|
|
|
return ObjectUtil.equals(success,1) ? JsonResult.success() : JsonResult.failMessage("更新失败");
|
|
|
|
|
}else {
|
|
|
|
|
return ObjectUtil.equals(success, 1) ? JsonResult.success() : JsonResult.failMessage("更新失败");
|
|
|
|
|
} else {
|
|
|
|
|
boolean success = resourcesInfoService.edit(resourcesInfo);
|
|
|
|
|
if (success) {
|
|
|
|
|
resourcesInfo = resourcesInfoService.queryById(resourcesInfo.getResourcesInfoId());
|
|
|
|
@ -353,28 +477,27 @@ public class ResourcesInfoController{
|
|
|
|
|
@GetMapping(MODEL + "/view.json")
|
|
|
|
|
@Function("resourcesInfo.query")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult<ResourcesInfo>queryInfo(Long resourcesInfoId) {
|
|
|
|
|
ResourcesInfo resourcesInfo = resourcesInfoService.queryById( resourcesInfoId);
|
|
|
|
|
return JsonResult.success(resourcesInfo);
|
|
|
|
|
public JsonResult<ResourcesInfo> queryInfo(Long resourcesInfoId) {
|
|
|
|
|
ResourcesInfo resourcesInfo = resourcesInfoService.queryById(resourcesInfoId);
|
|
|
|
|
return JsonResult.success(resourcesInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping(MODEL + "/getValues.json")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult<List<ResourcesInfo>>getValues(ResourcesInfoQuery param) {
|
|
|
|
|
List<ResourcesInfo>list = resourcesInfoService.getValues(param);
|
|
|
|
|
return JsonResult.success(list);
|
|
|
|
|
public JsonResult<List<ResourcesInfo>> getValues(ResourcesInfoQuery param) {
|
|
|
|
|
List<ResourcesInfo> list = resourcesInfoService.getValues(param);
|
|
|
|
|
return JsonResult.success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(MODEL + "/delete.json")
|
|
|
|
|
@Function("resourcesInfo.delete")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult delete(String ids) {
|
|
|
|
|
for(int i=0;i<ids.split(",").length;i++){
|
|
|
|
|
for (int i = 0; i < ids.split(",").length; i++) {
|
|
|
|
|
ResourcesInfo byId = resourcesInfoService.getById(Long.parseLong(ids.split(",")[i]));
|
|
|
|
|
//移除缓存
|
|
|
|
|
if (!ObjectUtil.isNull(byId)){
|
|
|
|
|
if (!ObjectUtil.isNull(byId)) {
|
|
|
|
|
courseInfoService.flushCache(byId.getCourseInfoId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -385,8 +508,8 @@ public class ResourcesInfoController{
|
|
|
|
|
|
|
|
|
|
@PostMapping(MODEL + "/deleteCourseSystemOAndUniversities.json")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public JsonResult deleteCourseSystemOAndUniversities(String ids,@SCoreUser CoreUser coreUser) {
|
|
|
|
|
resourcesInfoService.deleteCourseSystemOAndUniversities(ids,coreUser);
|
|
|
|
|
public JsonResult deleteCourseSystemOAndUniversities(String ids, @SCoreUser CoreUser coreUser) {
|
|
|
|
|
resourcesInfoService.deleteCourseSystemOAndUniversities(ids, coreUser);
|
|
|
|
|
return JsonResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -394,8 +517,8 @@ public class ResourcesInfoController{
|
|
|
|
|
* 功能描述: <br>
|
|
|
|
|
* 排序 移动
|
|
|
|
|
*
|
|
|
|
|
* @param id ID
|
|
|
|
|
* @param moveType 移动类型
|
|
|
|
|
* @param id ID
|
|
|
|
|
* @param moveType 移动类型
|
|
|
|
|
* @return {@link JsonResult}
|
|
|
|
|
* @Author: 87966
|
|
|
|
|
* @Date: 2023/1/9 16:17
|
|
|
|
@ -413,15 +536,15 @@ public class ResourcesInfoController{
|
|
|
|
|
* 只传左元素,表示:拖动元素 在 左元素的左侧;
|
|
|
|
|
* 只传右元素,表示:拖动元素 在 右元素的右侧;
|
|
|
|
|
* 左右元素都传,则拖动元素放置在两个元素的中间。
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 左侧(上) ==> 右侧(下)
|
|
|
|
|
* 小数值 ==> 大数值
|
|
|
|
|
*
|
|
|
|
|
* <p>
|
|
|
|
|
* 数值越小,越靠前
|
|
|
|
|
*
|
|
|
|
|
* @param id 拖动元素的ID
|
|
|
|
|
* @param leftId 左元素ID 偏小数值对应的元素ID
|
|
|
|
|
* @param rightId 右元素ID 偏大数值对应的元素ID
|
|
|
|
|
* @param id 拖动元素的ID
|
|
|
|
|
* @param leftId 左元素ID 偏小数值对应的元素ID
|
|
|
|
|
* @param rightId 右元素ID 偏大数值对应的元素ID
|
|
|
|
|
* @return {@link JsonResult}
|
|
|
|
|
* @Author: 87966
|
|
|
|
|
* @Date: 2023/1/9 16:44
|
|
|
|
|