| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 资源管理控制器 |
| | | * 资源管理控制器 |
| | | * |
| | | * @author chenjunliang |
| | | */ |
| | | @Api(tags = "资源管理接口") |
| | | @Api(tags = "资源管理接口") |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping(value = "/teach/res") |
| | | public class ResController { |
| | |
| | | IResService resService; |
| | | |
| | | /** |
| | | * 资源库层级管理Tree |
| | | * 资源库层级管理Tree |
| | | */ |
| | | @GetMapping(value = "categoryLevel") |
| | | public Result categoryLevel(String parentId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源库根节点 |
| | | * 资源库根节点 |
| | | * |
| | | * @param type 资源库类型 |
| | | * user,个人资源库 |
| | | * class,班级资源库 |
| | | * @param ownerId 资源库所属主体id,个人资源库传userId,班级资源库传classId |
| | | * @param type 资源库类型 |
| | | * user,个人资源库 |
| | | * class,班级资源库 |
| | | * @param ownerId 资源库所属主体id,个人资源库传userId,班级资源库传classId |
| | | */ |
| | | @GetMapping(value = "rootDir") |
| | | public Result getRoot(String type, String ownerId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源管理获取 资源列表 |
| | | * 资源管理获取 资源列表 |
| | | * |
| | | * @param dirId Ŀ¼id |
| | | * @param keyword 搜索关键字 |
| | | * @param limit 每页显示几条 |
| | | * @param pageNum 页码 |
| | | * @param type 类型(0,视频。1,音频。2,文档。3,练习。) |
| | | * @return 资源列表数据 |
| | | * @param dirId 目录id |
| | | * @param keyword 搜索关键字 |
| | | * @param limit 每页显示几条 |
| | | * @param pageNum 页码 |
| | | * @param type 类型(0,视频。1,音频。2,文档。3,练习。) |
| | | * @return 资源列表数据 |
| | | */ |
| | | @GetMapping(value = "lstRes") |
| | | public Result lstRes(String dirId, String keyword, Integer limit, Integer pageNum, String type) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源管理删除 资源 |
| | | * 资源管理删除 资源 |
| | | * |
| | | * @param id 资源id,英文逗号区分,可传多个 |
| | | * @param id 资源id,英文逗号区分,可传多个 |
| | | */ |
| | | @GetMapping(value = "deleteFile") |
| | | public Result deleteRes(String fileId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源管理 复制资源 |
| | | * 资源管理 复制资源 |
| | | * |
| | | * @param resId 资源id |
| | | * @param dirId Ŀ¼id |
| | | * @param type 类型 |
| | | * @param resId 资源id |
| | | * @param dirId 目录id |
| | | * @param type 类型 |
| | | */ |
| | | @GetMapping(value = "copyRes") |
| | | public Result copyRes(String resId, String dirId, String type) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源管理 资源的移动 |
| | | * 资源管理 资源的移动 |
| | | * |
| | | * @param resId 要移动的资源 |
| | | * @param type 目录类型 |
| | | * @param dirId Ŀ¼id |
| | | * @param resId 要移动的资源 |
| | | * @param type 目录类型 |
| | | * @param dirId 目录id |
| | | */ |
| | | @GetMapping(value = "moveRes") |
| | | public Result moveRes(String resId, String type, String dirId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源管理新增or编辑目录 |
| | | * 资源管理新增or编辑目录 |
| | | * |
| | | * @param dirId Ŀ¼id |
| | | * @param name 目录名 |
| | | * @param type (add新增 and edit修改) |
| | | * @param childFlag 是否操作下级 |
| | | * @param dirId 目录id |
| | | * @param name 目录名 |
| | | * @param type (add新增 and edit修改) |
| | | * @param childFlag 是否操作下级 |
| | | */ |
| | | @GetMapping(value = "addOrUpdateDir") |
| | | public Result addOrUpdateDir(String type, String name, String dirId, boolean childFlag) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 资源管理 删除目录 |
| | | * 资源管理 删除目录 |
| | | * |
| | | * @param dirId Ŀ¼id |
| | | * @param dirId 目录id |
| | | */ |
| | | @GetMapping(value = "deleteDir") |
| | | public Result deleteDir(String dirId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 添加/更新(视频,讲义,音频) |
| | | * 添加/更新(视频,讲义,音频) |
| | | * |
| | | * @param dirId 资源夹id |
| | | * @param name 名称 |
| | | * @param coverUrl 封面Url |
| | | * @param dirId 资源夹id |
| | | * @param name 名称 |
| | | * @param coverUrl 封面Url |
| | | * @param remark: <p> |
| | | * 视频啊啊啊 |
| | | * 视频啊啊啊 |
| | | * </p> |
| | | * 介绍 |
| | | * @param fileId 资源id |
| | | * @param id 资源id |
| | | * 介绍 |
| | | * @param fileId 资源id |
| | | * @param id 资源id |
| | | * @param type |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | * @return 状态说明(0, 视频 。 1, 音频 。 2, 文档 。 3, 练习 。) |
| | | */ |
| | | @PostMapping(value = "addOrUpdateRes") |
| | | public Result addOrUpdateRes(String dirId, String id, String remark, String name, String coverUrl, String type, |
| | |
| | | } |
| | | |
| | | /** |
| | | * 批量添加资源 |
| | | * 批量添加资源 |
| | | * |
| | | * @param dirId 节点id |
| | | * @param fileId 文件id |
| | | * @param fileName 文件名称 |
| | | * @param fileType 资源类型 |
| | | * @param dirId 节点id |
| | | * @param fileId 文件id |
| | | * @param fileName 文件名称 |
| | | * @param fileType 资源类型 |
| | | */ |
| | | @PostMapping(value = "addOfBatch") |
| | | public Result addOfBatch(String dirId, String type, @RequestParam(value = "datas") String datas) { |
| | | // 转换json到对象 |
| | | // 转换json到对象 |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | ResDatas resDatas = mapper.readValue(datas, ResDatas.class); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 编辑 获取内容 |
| | | * 编辑 获取内容 |
| | | * |
| | | * @param id 资源id |
| | | * @param id 资源id |
| | | */ |
| | | @GetMapping(value = "getResDetail") |
| | | public Result getResDetail(String id) { |
| | | |
| | | public Result getResDetail(String id,HttpServletResponse response) { |
| | | Res res = resService.read(id); |
| | | Result pathResult = resService.readAccessPath(id, null); |
| | | |
| | | return new Result(true, "success", CollectionUtils.newObjectMap("type", res.getType(), "name", res.getName(), |
| | | "coverUrl", res.getCoverPageUrl(), "remark", res.getRemark(), "fullPath", pathResult.getDataT("path"))); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |