栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

计算机课程设计-基于springboot的网盘管理系统-java云盘管理系统

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

计算机课程设计-基于springboot的网盘管理系统-java云盘管理系统

计算机课程设计-基于springboot的网盘管理系统-java云盘管理系统 1.开发环境及工具下载

开发语言:Java架构:B/S后台:SpringBoot数据库:MySQL编译工具:Idea、Eclipse、MyEclipse (选其一)其他:jdk1.8、maven

eclipse 下载
mysql 5.7 下载
jdk 1.8 下载
tomcat 8.0 下载
maven 3.5 下载
idea 下载

2 部分运行界面






3 更多推荐

SpringBoot民宿酒店管理系统
企业招聘管理系统ssm
ssm饮用水配送管理系统

4 核心代码实现
 
    @RequestMapping("upload")
    public ResponseMsg upload(@RequestParam String path, HttpServletRequest request) {
        try {
            // Servlet3.0方式上传文件
            Collection parts = request.getParts();
            for (Part part : parts) {
                // 忽略路径字段,只处理文件类型
                if (part.getContentType() != null) {
                    String fullPath = root + "sandeepin/" + path;
                    System.out.println("fullPath:" + fullPath);
                    File f = new File(fullPath, FileUtil.getFileNameByContentDisposition(part.getHeader("content-disposition")));
                    if (!FileUtil.writeInputStreamToFile(part.getInputStream(), f)) {
                        throw new Exception("文件上传失败");
                    }
                }
            }
            return new ResponseMsg("upload successful!");
        } catch (Exception e) {
            return new ResponseMsg();
        }
    }

    
    @GetMapping(value = "/space")
    public ResponseMsg getSpaceSize(HttpServletRequest request) {
        // 普通用户限制80G,guest用户限制40G,
        String userName = WebUtil.getUserNameByRequest(request);
        Map spaceMap = new HashMap<>(2);
        spaceMap.put("totalSpace", "80");
        double totalSpace = 80;
        if ("guest".equals(userName)) {
            spaceMap.put("totalSpace", "40");
            totalSpace = 40;
        }
        long dirlength = SystemUtil.getDirSpaceSize(root + userName);
        double dirlengthDouble = dirlength / 1024.0 / 1024 / 1024;
        String usedeSpace = String.format("%.2f", dirlengthDouble);
        String freeSpace = String.format("%.2f", totalSpace - Double.parseDouble(usedeSpace));
        spaceMap.put("freeSpace", freeSpace);
        return new ResponseMsg(JSONObject.toJSONString(spaceMap));
    }

    
    @RequestMapping(value = "/list", produces = "application/json; charset=utf-8")
    public List list(String path, HttpServletRequest request) {
        String userName = WebUtil.getUserNameByRequest(request);
        String fullFilePath = root + userName + "/";
        if (path != null) {
            fullFilePath += path;
        }
        return fileService.list(fullFilePath, userName);
    }

注意:该项目只展示部分功能,如需了解,评论区咨询即可。
希望和大家多多交流!!
源码项目、定制开发、代码讲解、答辩辅导

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/715683.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号