开发语言:Java架构:B/S后台:SpringBoot数据库:MySQL编译工具:Idea、Eclipse、MyEclipse (选其一)其他:jdk1.8、maven
2 部分运行界面eclipse 下载
mysql 5.7 下载
jdk 1.8 下载
tomcat 8.0 下载
maven 3.5 下载
idea 下载
SpringBoot民宿酒店管理系统
企业招聘管理系统ssm
ssm饮用水配送管理系统
@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);
}
注意:该项目只展示部分功能,如需了解,评论区咨询即可。
希望和大家多多交流!!
源码项目、定制开发、代码讲解、答辩辅导



