diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java index 5a90614..f11f4f8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/FileController.java @@ -48,6 +48,57 @@ public class FileController { // return Result.success(fileStorageService.of(file) // .setPlatform("minio-1") //使用指定的存储平台 // .upload()); +// } +// +// /** +// * 上传BASE64文件 +// */ +// @OperLog(operModul = "文件管理", operType = "BASE64文件上传", operDesc = "BASE64文件上传") +// @ApiOperation(value = "BASE64文件上传", notes = "BASE64文件上传", httpMethod="POST") +// @ApiImplicitParam(name = "base64", value = "BASE64字符串", required = true, dataType = "String") +// @PostMapping("/uploadBase64") +// public Result uploadBase64(@ApiIgnore @RequestBody Map map) { +// String base64 = MapUtils.getString(map, "base64"); +// MultipartFile multipartFile = FileUtil.base64toMultipart(base64, "text.jpg"); +// return Result.success(fileStorageService.of(multipartFile) +// .setPlatform("minio-1") //使用指定的存储平台 +// .upload()); +// } +// +// /** +// * 下载文件 +// */ +// @OperLog(operModul = "文件管理", operType = "文件下载", operDesc = "文件下载") +// @ApiOperation(value = "文件下载", notes = "文件下载", httpMethod="POST") +// @ApiImplicitParam(name = "fileUrl", value = "文件路径", paramType = "body", dataType = "String") +// @PostMapping("/download") +// public void download(@ApiIgnore @RequestBody Map map, HttpServletResponse response) throws Exception { +// // 获取文件信息 +// String fileUrl = MapUtils.getString(map, "fileUrl"); +// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl); +// if (null == fileInfo) { +// throw new Exception("缩略图文件下载失败,文件不存在!fileInfo:" + fileInfo); +// } +// response.setHeader("Content-disposition", "attachment; filename=" + fileUrl.substring(fileUrl.lastIndexOf("/") + 1)); +// response.setContentType("application/octet-stream");// 定义输出类型 +// fileStorageService.download(fileInfo).outputStream(response.getOutputStream()); +// } +// +// /** +// * 获取预览文件流 +// */ +// @OperLog(operModul = "文件管理", operType = "获取预览文件流", operDesc = "获取预览文件流") +// @ApiOperation(value = "获取预览文件流", notes = "获取预览文件流", httpMethod="POST") +// @GetMapping("/preview") +// public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception { +// // 获取文件信息 +// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl); +// if (null == fileInfo) { +// throw new Exception("缩略图文件预览失败,文件不存在!fileInfo:" + fileInfo); +// } +// response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileInfo.getOriginalFilename(), "UTF-8")); +// response.setContentType("application/octet-stream");// 定义输出类型 +// fileStorageService.download(fileInfo).outputStream(response.getOutputStream()); // } /** @@ -78,21 +129,6 @@ public class FileController { return Result.success(fileDetailService.upload(file)); } - /** - * 上传BASE64文件 - */ -// @OperLog(operModul = "文件管理", operType = "BASE64文件上传", operDesc = "BASE64文件上传") -// @ApiOperation(value = "BASE64文件上传", notes = "BASE64文件上传", httpMethod="POST") -// @ApiImplicitParam(name = "base64", value = "BASE64字符串", required = true, dataType = "String") -// @PostMapping("/uploadBase64") -// public Result uploadBase64(@ApiIgnore @RequestBody Map map) { -// String base64 = MapUtils.getString(map, "base64"); -// MultipartFile multipartFile = FileUtil.base64toMultipart(base64, "text.jpg"); -// return Result.success(fileStorageService.of(multipartFile) -// .setPlatform("minio-1") //使用指定的存储平台 -// .upload()); -// } - /** * 上传BASE64文件 */ @@ -106,26 +142,6 @@ public class FileController { return Result.success(fileDetailService.upload(multipartFile)); } - - /** - * 下载文件 - */ -// @OperLog(operModul = "文件管理", operType = "文件下载", operDesc = "文件下载") -// @ApiOperation(value = "文件下载", notes = "文件下载", httpMethod="POST") -// @ApiImplicitParam(name = "fileUrl", value = "文件路径", paramType = "body", dataType = "String") -// @PostMapping("/download") -// public void download(@ApiIgnore @RequestBody Map map, HttpServletResponse response) throws Exception { -// // 获取文件信息 -// String fileUrl = MapUtils.getString(map, "fileUrl"); -// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl); -// if (null == fileInfo) { -// throw new Exception("缩略图文件下载失败,文件不存在!fileInfo:" + fileInfo); -// } -// response.setHeader("Content-disposition", "attachment; filename=" + fileUrl.substring(fileUrl.lastIndexOf("/") + 1)); -// response.setContentType("application/octet-stream");// 定义输出类型 -// fileStorageService.download(fileInfo).outputStream(response.getOutputStream()); -// } - /** * 下载文件 */ @@ -139,23 +155,6 @@ public class FileController { fileDetailService.download(fileUrl, response); } - /** - * 获取预览文件流 - */ -// @OperLog(operModul = "文件管理", operType = "获取预览文件流", operDesc = "获取预览文件流") -// @ApiOperation(value = "获取预览文件流", notes = "获取预览文件流", httpMethod="POST") -// @GetMapping("/preview") -// public void download(@RequestParam(value = "fileUrl", required = true) String fileUrl, HttpServletResponse response) throws Exception { -// // 获取文件信息 -// FileInfo fileInfo = fileStorageService.getFileInfoByUrl(fileUrl); -// if (null == fileInfo) { -// throw new Exception("缩略图文件预览失败,文件不存在!fileInfo:" + fileInfo); -// } -// response.setHeader("Content-disposition", "attachment; filename=" + URLEncoder.encode(fileInfo.getOriginalFilename(), "UTF-8")); -// response.setContentType("application/octet-stream");// 定义输出类型 -// fileStorageService.download(fileInfo).outputStream(response.getOutputStream()); -// } - /** * 获取预览文件流 */ diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index ffa4e9a..a61cda2 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -3,13 +3,13 @@ http.port=6023 server.port=6688 # 数据库配置 #182.90.224.147 -spring.datasource.url=jdbc:mysql://139.9.66.234:3306/wisdomsitezw_hzxmgl?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false +spring.datasource.url=jdbc:mysql://localhost:3306/wisdomsitezw_hzxmgl?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false # 数据库加密配置 #spring.datasource.username=ENC(XR4C/hvTYCUqudS49Wh/jA==) #spring.datasource.password=ENC(hHkiHEc6vSWjqfOtg2/2Uiihs0vX3l7V) spring.datasource.username=root -spring.datasource.password=JXJ@admin -#spring.datasource.password=root +#spring.datasource.password=JXJ@admin +spring.datasource.password=root # 文件存储路径 basePath=D:/itbgpImage/ # 文件访问路径