fix: kyc return relative directory
This commit is contained in:
@@ -16,9 +16,9 @@ public class SysFile
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件内部地址
|
||||
* 文件相对地址
|
||||
*/
|
||||
private String uri;
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 文件内部地址
|
||||
@@ -26,9 +26,9 @@ public class SysFile
|
||||
private String localUrl;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
* 文件gateway地址
|
||||
*/
|
||||
private String url;
|
||||
private String gatewayUrl;
|
||||
|
||||
public String getName()
|
||||
{
|
||||
@@ -40,12 +40,12 @@ public class SysFile
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUri(String uri) {
|
||||
this.uri = uri;
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getLocalUrl() {
|
||||
@@ -56,23 +56,21 @@ public class SysFile
|
||||
this.localUrl = localUrl;
|
||||
}
|
||||
|
||||
public String getUrl()
|
||||
{
|
||||
return url;
|
||||
public String getGatewayUrl() {
|
||||
return gatewayUrl;
|
||||
}
|
||||
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
public void setGatewayUrl(String gatewayUrl) {
|
||||
this.gatewayUrl = gatewayUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("name", getName())
|
||||
.append("uri", getUri())
|
||||
.append("localUrl", getLocalUrl())
|
||||
.append("url", getUrl())
|
||||
.append("localUrl", getLocalUrl())
|
||||
.append("gatewayUrl", getGatewayUrl())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +33,12 @@ public class SysFileController {
|
||||
// 上传并返回访问地址
|
||||
FileUploadResult urlResult = sysFileService.uploadFile(file);
|
||||
SysFile sysFile = new SysFile();
|
||||
sysFile.setName(FileUtils.getName(urlResult.getUri()));
|
||||
sysFile.setName(FileUtils.getName(urlResult.getUrl()));
|
||||
sysFile.setName(FileUtils.getName(urlResult.getLocalUrl()));
|
||||
sysFile.setName(FileUtils.getName(urlResult.getGatewayUrl()));
|
||||
sysFile.setUri(urlResult.getUri());
|
||||
sysFile.setUrl(urlResult.getUrl());
|
||||
sysFile.setLocalUrl(urlResult.getLocalUrl());
|
||||
sysFile.setUrl(urlResult.getGatewayUrl());
|
||||
sysFile.setGatewayUrl(urlResult.getGatewayUrl());
|
||||
return R.ok(sysFile);
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件失败", e);
|
||||
|
||||
@@ -49,25 +49,25 @@ public class LocalSysFileServiceImpl implements ISysFileService
|
||||
@Override
|
||||
public FileUploadResult uploadFile(MultipartFile file) throws Exception {
|
||||
String name = FileUploadUtils.upload(localFilePath, file);
|
||||
String uri = localFilePrefix + name;
|
||||
String url = localFilePrefix + name;
|
||||
String localUrl = domain + localFilePrefix + name;
|
||||
String gatewayUrl = gateway + pathPrefix + localFilePrefix + name;
|
||||
return new FileUploadResult(uri, localUrl, gatewayUrl);
|
||||
return new FileUploadResult(url, localUrl, gatewayUrl);
|
||||
}
|
||||
|
||||
public static class FileUploadResult {
|
||||
private final String uri;
|
||||
private final String url;
|
||||
private final String localUrl;
|
||||
private final String gatewayUrl;
|
||||
|
||||
public FileUploadResult(String uri, String localUrl, String gatewayUrl) {
|
||||
this.uri = uri;
|
||||
public FileUploadResult(String url, String localUrl, String gatewayUrl) {
|
||||
this.url = url;
|
||||
this.localUrl = localUrl;
|
||||
this.gatewayUrl = gatewayUrl;
|
||||
}
|
||||
|
||||
public String getUri() {
|
||||
return uri;
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getLocalUrl() {
|
||||
|
||||
Reference in New Issue
Block a user