计算机课程设计-基于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 核心代码实现

 /**
     * 文件上传
     *
     * @param path    上传路径
     * @param request Servlet3.0方式上传文件,获取parts
     * @return result
     */
    @RequestMapping("upload")
    public ResponseMsg upload(@RequestParam String path, HttpServletRequest request) {
        try {
            // Servlet3.0方式上传文件
            Collection<Part> 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();
        }
    }

    /**
     * 空间占用展示
     *
     * @param request HttpServletRequest
     */
    @GetMapping(value = "/space")
    public ResponseMsg getSpaceSize(HttpServletRequest request) {
        // 普通用户限制80G,guest用户限制40G,
        String userName = WebUtil.getUserNameByRequest(request);
        Map<String, String> 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));
    }

    /**
     * 用户文件列表展示
     *
     * @param path    路径
     * @param request HttpServletRequest
     * @return List<FileMsg>
     */
    @RequestMapping(value = "/list", produces = "application/json; charset=utf-8")
    public List<FileMsg> list(String path, HttpServletRequest request) {
        String userName = WebUtil.getUserNameByRequest(request);
        String fullFilePath = root + userName + "/";
        if (path != null) {
            fullFilePath += path;
        }
        return fileService.list(fullFilePath, userName);
    }

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

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值