diff --git a/src/main/java/com/yipin/liuwanr/controller/AliyunOssController.java b/src/main/java/com/yipin/liuwanr/controller/AliyunOssController.java index 4595c11..a71fadc 100644 --- a/src/main/java/com/yipin/liuwanr/controller/AliyunOssController.java +++ b/src/main/java/com/yipin/liuwanr/controller/AliyunOssController.java @@ -24,7 +24,6 @@ public class AliyunOssController { /** * 上传文件 - * * @param file * @return */ @@ -42,29 +41,27 @@ public class AliyunOssController { } return resp; - } + } + + /** + * 下载文件 + * @param objectName:在阿里云的文件路径 + * @return + */ + @GetMapping("/downloadFiles") + Response downloadFiles(HttpServletResponse response,@RequestParam String objectName) { + Response resp = new Response(); + try { + ossService.downloadFiles(response,objectName); + resp.setStatus(200); + resp.setMessage("下载成功!"); + } catch (Exception e) { + resp.setStatus(300); + resp.setErrmessage("下载失败"); + } + return null; - /** - * 下载文件 - * - * @param objectName:在阿里云的文件路径 - * @param fileurl:本地路径 - * @return - */ - @GetMapping("/downloadFiles") - Response downloadFiles(HttpServletResponse response, @RequestParam String objectName) { - Response resp = new Response(); - try { - ossService.downloadFiles(response, objectName); - resp.setStatus(200); - resp.setMessage("下载成功!"); - } catch (Exception e) { - resp.setStatus(300); - resp.setErrmessage("下载失败"); - } - return null; - - - } + } + } diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java index 4ebd58f..58a9c41 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java @@ -128,4 +128,19 @@ public class ProjectAndCourseController { } return resp; } + + @GetMapping("/getCoursevideo") + Response getCoursevideo(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId,@RequestParam Integer studentId) { + Response resp = new Response(); + HashMap ret = service.getCoursevideo(courseId,experimentalClassId,studentId); + int status = (int) ret.get("retcode"); + if (status == 200) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/entity/Project_Management.java b/src/main/java/com/yipin/liuwanr/entity/Project_Management.java index 49dff99..ca491bc 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Project_Management.java +++ b/src/main/java/com/yipin/liuwanr/entity/Project_Management.java @@ -1,5 +1,7 @@ package com.yipin.liuwanr.entity; +import java.util.List; + /** * 项目管理 * @@ -28,7 +30,15 @@ public class Project_Management { private Integer isAttendance; private Integer signin;//是否签到 - + private List courseLinks; + + public List getCourseLinks() { + return courseLinks; + } + + public void setCourseLinks(List courseLinks) { + this.courseLinks = courseLinks; + } public Integer getSignin() { return signin; diff --git a/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java b/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java index b64d3a8..914fb02 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java @@ -2,12 +2,10 @@ package com.yipin.liuwanr.mapper; import java.util.List; +import com.yipin.liuwanr.entity.CourseLink; import com.yipin.liuwanr.entity.CourseSchedule; import com.yipin.liuwanr.vo.CourseAndProjectVo; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; +import org.apache.ibatis.annotations.*; import com.yipin.liuwanr.entity.Project_Management; @@ -29,7 +27,7 @@ public interface TeacherProjectAndCourseMapper { // ""}) @Select("select DISTINCT hpm.projectId,projectName,isOpenProject,isAttendance from hr_project_management hpm left join teacher_project tp on hpm.projectId=tp.projectId " + - " where hpm.isdel=0 and tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId}") + " where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId}") List getBySystemId(@Param("courseId") Integer courseId,@Param("experimentalClassId")Integer experimentalClassId); @@ -63,4 +61,17 @@ public interface TeacherProjectAndCourseMapper { //添加课程进度 @Insert("insert into hr_course_schedule (courseId,experimentalClassId,projectId) VALUES (#{courseId},#{experimentalClassId},#{projectId})") void addCourseSchedule(CourseSchedule courseSchedule); + + @Select("select DISTINCT hpm.projectId,projectName from hr_project_management hpm left join teacher_project tp on hpm.projectId=tp.projectId " + + " where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId}") + @Results({ + @Result(id = true,column = "projectId",property = "projectId"), + @Result(column = "projectName",property = "projectName"), + @Result(column = "projectId",property = "courseLinks",many = @Many(select = "com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper.queryCourseLink")) + }) + List queryProjects(@Param("courseId") Integer courseId,@Param("experimentalClassId")Integer experimentalClassId); + + + @Select("select linkName,fileLink from hr_course_link where projectId=#{projectId} and isdel=0 GROUP BY linkId") + List queryCourseLink(Integer projectId); } diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java b/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java index 8a643a7..2a60e96 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java @@ -145,4 +145,28 @@ public class ProjectAndCourseService { return resp; } + + //课程视频 + public HashMap getCoursevideo(Integer courseId,Integer experimentalClassId,Integer studentId){ + HashMap resp = new HashMap(); + try { + if(!StringUtils.isEmpty(courseId)){ + if(StringUtils.isEmpty(experimentalClassId)){ + if(!StringUtils.isEmpty(studentId)){ + experimentalClassId=experimentallearningMapper.queryExperimentalClassId(courseId,studentId); + } + } + List project=mapper.queryProjects(courseId,experimentalClassId); + resp.put("retvalue", project); + resp.put("retcode", 200); + } + }catch (Exception e){ + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "视频失败"); + return resp; + } + return resp; + } + }