feat:kyc uri
This commit is contained in:
@@ -15,6 +15,11 @@ public class SysFile
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件内部地址
|
||||||
|
*/
|
||||||
|
private String uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件内部地址
|
* 文件内部地址
|
||||||
*/
|
*/
|
||||||
@@ -35,6 +40,14 @@ public class SysFile
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLocalUrl() {
|
public String getLocalUrl() {
|
||||||
return localUrl;
|
return localUrl;
|
||||||
}
|
}
|
||||||
@@ -57,6 +70,7 @@ public class SysFile
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
.append("name", getName())
|
.append("name", getName())
|
||||||
|
.append("uri", getUri())
|
||||||
.append("localUrl", getLocalUrl())
|
.append("localUrl", getLocalUrl())
|
||||||
.append("url", getUrl())
|
.append("url", getUrl())
|
||||||
.toString();
|
.toString();
|
||||||
|
|||||||
@@ -33,8 +33,10 @@ public class SysFileController {
|
|||||||
// 上传并返回访问地址
|
// 上传并返回访问地址
|
||||||
FileUploadResult urlResult = sysFileService.uploadFile(file);
|
FileUploadResult urlResult = sysFileService.uploadFile(file);
|
||||||
SysFile sysFile = new SysFile();
|
SysFile sysFile = new SysFile();
|
||||||
|
sysFile.setName(FileUtils.getName(urlResult.getUri()));
|
||||||
sysFile.setName(FileUtils.getName(urlResult.getLocalUrl()));
|
sysFile.setName(FileUtils.getName(urlResult.getLocalUrl()));
|
||||||
sysFile.setName(FileUtils.getName(urlResult.getGatewayUrl()));
|
sysFile.setName(FileUtils.getName(urlResult.getGatewayUrl()));
|
||||||
|
sysFile.setUri(urlResult.getUri());
|
||||||
sysFile.setLocalUrl(urlResult.getLocalUrl());
|
sysFile.setLocalUrl(urlResult.getLocalUrl());
|
||||||
sysFile.setUrl(urlResult.getGatewayUrl());
|
sysFile.setUrl(urlResult.getGatewayUrl());
|
||||||
return R.ok(sysFile);
|
return R.ok(sysFile);
|
||||||
|
|||||||
@@ -42,6 +42,6 @@ public class FastDfsSysFileServiceImpl implements ISysFileService
|
|||||||
FileTypeUtils.getExtension(file), null);
|
FileTypeUtils.getExtension(file), null);
|
||||||
IoUtils.closeQuietly(inputStream);
|
IoUtils.closeQuietly(inputStream);
|
||||||
String fileUrl = domain + "/" + storePath.getFullPath();
|
String fileUrl = domain + "/" + storePath.getFullPath();
|
||||||
return new LocalSysFileServiceImpl.FileUploadResult(fileUrl, fileUrl);
|
return new LocalSysFileServiceImpl.FileUploadResult(fileUrl, fileUrl, fileUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,20 +49,27 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
|||||||
@Override
|
@Override
|
||||||
public FileUploadResult uploadFile(MultipartFile file) throws Exception {
|
public FileUploadResult uploadFile(MultipartFile file) throws Exception {
|
||||||
String name = FileUploadUtils.upload(localFilePath, file);
|
String name = FileUploadUtils.upload(localFilePath, file);
|
||||||
|
String uri = localFilePrefix + name;
|
||||||
String localUrl = domain + localFilePrefix + name;
|
String localUrl = domain + localFilePrefix + name;
|
||||||
String gatewayUrl = gateway + pathPrefix + localFilePrefix + name;
|
String gatewayUrl = gateway + pathPrefix + localFilePrefix + name;
|
||||||
return new FileUploadResult(localUrl, gatewayUrl);
|
return new FileUploadResult(uri, localUrl, gatewayUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class FileUploadResult {
|
public static class FileUploadResult {
|
||||||
|
private final String uri;
|
||||||
private final String localUrl;
|
private final String localUrl;
|
||||||
private final String gatewayUrl;
|
private final String gatewayUrl;
|
||||||
|
|
||||||
public FileUploadResult(String localUrl, String gatewayUrl) {
|
public FileUploadResult(String uri, String localUrl, String gatewayUrl) {
|
||||||
|
this.uri = uri;
|
||||||
this.localUrl = localUrl;
|
this.localUrl = localUrl;
|
||||||
this.gatewayUrl = gatewayUrl;
|
this.gatewayUrl = gatewayUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
public String getLocalUrl() {
|
public String getLocalUrl() {
|
||||||
return localUrl;
|
return localUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,6 @@ public class MinioSysFileServiceImpl implements ISysFileService
|
|||||||
client.putObject(args);
|
client.putObject(args);
|
||||||
IoUtils.closeQuietly(inputStream);
|
IoUtils.closeQuietly(inputStream);
|
||||||
String fileUrl = minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
|
String fileUrl = minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
|
||||||
return new LocalSysFileServiceImpl.FileUploadResult(fileUrl, fileUrl);
|
return new LocalSysFileServiceImpl.FileUploadResult(fileUrl, fileUrl, fileUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# 本地文件上传
|
# 本地文件上传
|
||||||
file:
|
file:
|
||||||
domain: wfc-file:${WFC_FILE_PORT:9201}
|
domain: ${GATEWAY_SERVER_IP}:{WFC_FILE_PORT:9201}
|
||||||
path: /opt/wfc/upload
|
path: /opt/wfc/upload
|
||||||
prefix: /kyc
|
prefix: /kyc
|
||||||
gateway: http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT} # 新增网关地址配置
|
gateway: http://${GATEWAY_SERVER_IP}:${GATEWAY_SERVER_PORT} # 新增网关地址配置
|
||||||
|
|||||||
Reference in New Issue
Block a user