|
@@ -14,6 +14,7 @@ package vip.xiaonuo.disk.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollStreamUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|
@@ -28,20 +29,24 @@ import vip.xiaonuo.common.annotation.CommonLog;
|
|
|
import vip.xiaonuo.common.pojo.CommonResult;
|
|
import vip.xiaonuo.common.pojo.CommonResult;
|
|
|
import vip.xiaonuo.common.pojo.CommonValidList;
|
|
import vip.xiaonuo.common.pojo.CommonValidList;
|
|
|
import vip.xiaonuo.disk.domain.ClassHour;
|
|
import vip.xiaonuo.disk.domain.ClassHour;
|
|
|
|
|
+import vip.xiaonuo.disk.domain.College;
|
|
|
|
|
+import vip.xiaonuo.disk.domain.CourseRelate;
|
|
|
import vip.xiaonuo.disk.param.ClassHourAddParam;
|
|
import vip.xiaonuo.disk.param.ClassHourAddParam;
|
|
|
import vip.xiaonuo.disk.param.ClassHourEditParam;
|
|
import vip.xiaonuo.disk.param.ClassHourEditParam;
|
|
|
import vip.xiaonuo.disk.param.ClassHourIdParam;
|
|
import vip.xiaonuo.disk.param.ClassHourIdParam;
|
|
|
import vip.xiaonuo.disk.param.ClassHourPageParam;
|
|
import vip.xiaonuo.disk.param.ClassHourPageParam;
|
|
|
import vip.xiaonuo.disk.service.ClassHourService;
|
|
import vip.xiaonuo.disk.service.ClassHourService;
|
|
|
-import vip.xiaonuo.disk.service.CourseClasshourFileRelateService;
|
|
|
|
|
-import vip.xiaonuo.disk.vo.classhour.ClassHourVo;
|
|
|
|
|
|
|
+import vip.xiaonuo.disk.service.CourseRelateService;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import javax.validation.constraints.NotEmpty;
|
|
import javax.validation.constraints.NotEmpty;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 课时表控制器
|
|
* 课时表控制器
|
|
@@ -58,7 +63,7 @@ public class CourseClassHourController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private ClassHourService classHourService;
|
|
private ClassHourService classHourService;
|
|
|
@Resource
|
|
@Resource
|
|
|
- private CourseClasshourFileRelateService courseClasshourFileRelateService;
|
|
|
|
|
|
|
+ private CourseRelateService courseRelateService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取课时表分页
|
|
* 获取课时表分页
|
|
@@ -89,7 +94,12 @@ public class CourseClassHourController {
|
|
|
public CommonResult<String> add(@RequestBody @Valid ClassHourAddParam classHourAddParam) {
|
|
public CommonResult<String> add(@RequestBody @Valid ClassHourAddParam classHourAddParam) {
|
|
|
ClassHour classHour = BeanUtil.toBean(classHourAddParam, ClassHour.class);
|
|
ClassHour classHour = BeanUtil.toBean(classHourAddParam, ClassHour.class);
|
|
|
classHourService.addOne(classHour);
|
|
classHourService.addOne(classHour);
|
|
|
-
|
|
|
|
|
|
|
+ //添加文件,测验等关联信息
|
|
|
|
|
+ List<CourseRelate> courseRelates = classHourAddParam.getCourseRelates();
|
|
|
|
|
+ courseRelates = courseRelates.stream()
|
|
|
|
|
+ .peek(oneCourseRelate -> oneCourseRelate.setMainId(classHour.getId())) // 修改属性
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ courseRelateService.addBatch(courseRelates);
|
|
|
return CommonResult.ok();
|
|
return CommonResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -107,6 +117,19 @@ public class CourseClassHourController {
|
|
|
ClassHour classHour = classHourService.queryEntity(classHourEditParam.getId());
|
|
ClassHour classHour = classHourService.queryEntity(classHourEditParam.getId());
|
|
|
BeanUtil.copyProperties(classHourEditParam, classHour);
|
|
BeanUtil.copyProperties(classHourEditParam, classHour);
|
|
|
classHourService.editOne(classHour);
|
|
classHourService.editOne(classHour);
|
|
|
|
|
+ //先删除过往关联内容
|
|
|
|
|
+ Map relateParam =new HashMap();
|
|
|
|
|
+ relateParam.put("mainId", classHour.getId());
|
|
|
|
|
+ relateParam.put("chapterhourType","0");
|
|
|
|
|
+ List<CourseRelate> delCourseRelateList=courseRelateService.wrapperList(relateParam);
|
|
|
|
|
+ List<String> delCourseRelateIdList=CollStreamUtil.toList(delCourseRelateList, CourseRelate::getId);
|
|
|
|
|
+ courseRelateService.deleteByIds(delCourseRelateIdList);
|
|
|
|
|
+ //重新添加关联内容
|
|
|
|
|
+ List<CourseRelate> courseRelates = classHourEditParam.getCourseRelates();
|
|
|
|
|
+ courseRelates = courseRelates.stream()
|
|
|
|
|
+ .peek(oneCourseRelate -> oneCourseRelate.setMainId(classHour.getId())) // 修改属性
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ courseRelateService.addBatch(courseRelates);
|
|
|
|
|
|
|
|
return CommonResult.ok();
|
|
return CommonResult.ok();
|
|
|
}
|
|
}
|
|
@@ -140,6 +163,25 @@ public class CourseClassHourController {
|
|
|
Map param =new HashMap();
|
|
Map param =new HashMap();
|
|
|
param.put("id", req.getParameter("id"));
|
|
param.put("id", req.getParameter("id"));
|
|
|
Map<String,Object> result=classHourService.queryInfo(param);
|
|
Map<String,Object> result=classHourService.queryInfo(param);
|
|
|
|
|
+ //查回课程关联信息
|
|
|
|
|
+ List<Map<String,Object>> courseRelatesList=new ArrayList<>();
|
|
|
|
|
+ Map funcTypeParam =new HashMap();
|
|
|
|
|
+ funcTypeParam.put("mainId", classHourIdParam.getId());
|
|
|
|
|
+ funcTypeParam.put("chapterhourType","0");
|
|
|
|
|
+ List<CourseRelate> relateList=courseRelateService.wrapperList(funcTypeParam);
|
|
|
|
|
+ List<String>funcTypeList=CollStreamUtil.toList(relateList, CourseRelate::getFuncType);
|
|
|
|
|
+ Map relateParam =new HashMap();
|
|
|
|
|
+ relateParam.put("mainId", req.getParameter("id"));
|
|
|
|
|
+ relateParam.put("chapterhourType", "0");
|
|
|
|
|
+ //分别查回视频,讲义,字幕,作业,测验等
|
|
|
|
|
+ for(String oneFunctype:funcTypeList)
|
|
|
|
|
+ {
|
|
|
|
|
+ relateParam.put("funcType", oneFunctype);
|
|
|
|
|
+ List<Map<String,Object>> videoList=courseRelateService.queryMapList(relateParam);
|
|
|
|
|
+ courseRelatesList.addAll(videoList);
|
|
|
|
|
+ }
|
|
|
|
|
+ result.put("courseRelates", courseRelatesList);
|
|
|
|
|
+
|
|
|
return CommonResult.data(result);
|
|
return CommonResult.data(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -156,6 +198,25 @@ public class CourseClassHourController {
|
|
|
Map param =new HashMap();
|
|
Map param =new HashMap();
|
|
|
param.put("id", req.getParameter("id"));
|
|
param.put("id", req.getParameter("id"));
|
|
|
Map<String,Object> result=classHourService.queryInfo(param);
|
|
Map<String,Object> result=classHourService.queryInfo(param);
|
|
|
|
|
+
|
|
|
|
|
+ //查回课程关联信息
|
|
|
|
|
+ List<Map<String,Object>> courseRelatesList=new ArrayList<>();
|
|
|
|
|
+ Map funcTypeParam =new HashMap();
|
|
|
|
|
+ funcTypeParam.put("mainId", classHourIdParam.getId());
|
|
|
|
|
+ funcTypeParam.put("chapterhourType","0");
|
|
|
|
|
+ List<CourseRelate> relateList=courseRelateService.wrapperList(funcTypeParam);
|
|
|
|
|
+ List<String>funcTypeList=CollStreamUtil.toList(relateList, CourseRelate::getFuncType);
|
|
|
|
|
+ Map relateParam =new HashMap();
|
|
|
|
|
+ relateParam.put("mainId", req.getParameter("id"));
|
|
|
|
|
+ relateParam.put("chapterhourType", "0");
|
|
|
|
|
+ //分别查回视频,讲义,字幕,作业,测验等
|
|
|
|
|
+ for(String oneFunctype:funcTypeList)
|
|
|
|
|
+ {
|
|
|
|
|
+ relateParam.put("funcType", oneFunctype);
|
|
|
|
|
+ List<Map<String,Object>> videoList=courseRelateService.queryMapList(relateParam);
|
|
|
|
|
+ courseRelatesList.addAll(videoList);
|
|
|
|
|
+ }
|
|
|
|
|
+ result.put("courseRelates", courseRelatesList);
|
|
|
return CommonResult.data(result);
|
|
return CommonResult.data(result);
|
|
|
}
|
|
}
|
|
|
|
|
|