From f288ed575764a898bb8df1eb06c9b3cba55f3e17 Mon Sep 17 00:00:00 2001
From: zhongrj <123456>
Date: Thu, 18 Aug 2022 15:45:14 +0800
Subject: [PATCH] 文件上传配置提取,派遣记录查询修改
---
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java | 63 +++++++++++++++----------------
1 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java b/src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
index efe64d1..180c1b7 100644
--- a/src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
+++ b/src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
@@ -194,10 +194,10 @@
@PostMapping("/put-file-user-avatar")
public R putFileUserAvatar(@RequestParam MultipartFile file) {
//填写你文件上传的地址以及相应信息
- String url = "http://61.131.136.25:2081";
- String access = "zhbaadmin";
- String secret = "zhbapassword";
- String bucket = "zhba";
+ String url = FileConfig.url;
+ String access = FileConfig.access;
+ String secret = FileConfig.secret;
+ String bucket = FileConfig.bucket;
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -228,7 +228,7 @@
InputStream inputStream = file.getInputStream();
FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
in.close();
- String urls = "http://61.131.136.25:2081/zhba/" + newName;
+ String urls = FileConfig.url + "/"+ FileConfig.bucket + "/" + newName;
//数据封装
Map<String, Object> map = new HashMap<>(2);
map.put("name", newName);
@@ -246,10 +246,10 @@
@PostMapping("put-file-app")
public R putFileApp(@RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
//填写你文件上传的地址以及相应信息
- String url = "http://61.131.136.25:2081";
- String access = "zhbaadmin";
- String secret = "zhbapassword";
- String bucket = "zhba";
+ String url = FileConfig.url;
+ String access = FileConfig.access;
+ String secret = FileConfig.secret;
+ String bucket = FileConfig.bucket;
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -280,7 +280,7 @@
InputStream inputStream = file.getInputStream();
FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
in.close();
- String urls = "http://61.131.136.25:2081/zhba/" + newName;
+ String urls = FileConfig.url + "/"+ FileConfig.bucket + "/" + newName;
return R.data(urls);
}
@@ -293,10 +293,10 @@
@PostMapping("put-files")
public R putFiles(@RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
//填写你文件上传的地址以及相应信息
- String url = "http://61.131.136.25:2081";
- String access = "zhbaadmin";
- String secret = "zhbapassword";
- String bucket = "zhba";
+ String url = FileConfig.url;
+ String access = FileConfig.access;
+ String secret = FileConfig.secret;
+ String bucket = FileConfig.bucket;
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -327,7 +327,7 @@
InputStream inputStream = file.getInputStream();
FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
in.close();
- String urls = "http://61.131.136.25:2081/zhba/" + newName;
+ String urls = FileConfig.url + "/"+ FileConfig.bucket + "/" + newName;
//数据封装
Map<String, Object> map = new HashMap<>(2);
map.put("name", newName);
@@ -346,10 +346,10 @@
public R putFileZip(@RequestParam MultipartFile file) throws Exception {
Map<String, Object> map = new HashMap<>(1);
//填写你文件上传的地址以及相应信息
- String url = "http://61.131.136.25:2081";
- String access = "zhbaadmin";
- String secret = "zhbapassword";
- String bucket = "zhba";
+ String url = FileConfig.url;
+ String access = FileConfig.access;
+ String secret = FileConfig.secret;
+ String bucket = FileConfig.bucket;
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -367,8 +367,6 @@
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase(Locale.US);
//判断文件是不是zip类型
if(!fileType.equals("zip")){
-// map.put("data","上传文件类型不符!");
-// return R.data(map);
throw new ServiceException("上传文件类型不符!必须是 zip 压缩文件格式!");
}
//FileConfig.localtion是配置文件和config类生产的,测试demo可以直接把FileConfig.localtion替换成D:/test
@@ -402,7 +400,6 @@
String idCardNo = compile.matcher(pictrueName).replaceAll("");
//加入集合
errorList.add(idCardNo);
-
}
if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) {
String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf("."));
@@ -419,7 +416,7 @@
.headers(headers)
.build());
- String urls = "http://61.131.136.25:2081/zhba/" + newName;
+ String urls = FileConfig.url + "/"+ FileConfig.bucket + "/" + newName;
//内网
String inUrl = FtpConfig.ip + "/zhba/" + newName;
//取出身份证号,查询用户信息,更新用户信息
@@ -471,10 +468,10 @@
public R putFileExamPaymentZip(@RequestParam MultipartFile file) throws Exception {
Map<String, Object> map = new HashMap<>(1);
//填写你文件上传的地址以及相应信息
- String url = "http://61.131.136.25:2081";
- String access = "zhbaadmin";
- String secret = "zhbapassword";
- String bucket = "zhba";
+ String url = FileConfig.url;
+ String access = FileConfig.access;
+ String secret = FileConfig.secret;
+ String bucket = FileConfig.bucket;
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -525,7 +522,7 @@
.headers(headers)
.build());
- String urls = "http://61.131.136.25:2081/zhba/" + newName;
+ String urls = FileConfig.url + "/"+ FileConfig.bucket + "/" + newName;
//内网
String inUrl = FtpConfig.ip +"/zhba/"+ newName;
//取出身份证号,查询用户信息,更新用户信息
@@ -589,10 +586,10 @@
@PostMapping("put-files-talk")
public R putFilestak(@RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
//填写你文件上传的地址以及相应信息
- String url = "http://61.131.136.25:2081";
- String access = "zhbaadmin";
- String secret = "zhbapassword";
- String bucket = "zhba";
+ String url = FileConfig.url;
+ String access = FileConfig.access;
+ String secret = FileConfig.secret;
+ String bucket = FileConfig.bucket;
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -625,7 +622,7 @@
InputStream inputStream = file.getInputStream();
FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
in.close();
- String urls = "http://61.131.136.25:2081/zhba/" + newName;
+ String urls = FileConfig.url + "/"+ FileConfig.bucket + "/" + newName;
//数据封装
Map<String, Object> map = new HashMap<>(2);
map.put("name", newName);
--
Gitblit v1.9.3