Commit e26c653261e928f27fecbd18db7e26faac4cdbb6
Committed by
xp.Huang
1 parent
113ee214
fix:解决由于文件上传只返回非半路径而导致的3d-compent读取不到文件问题
(cherry picked from commit accfa3ec650917caa3698cefe80b1fdc060a7f01)
Showing
2 changed files
with
11 additions
and
14 deletions
@@ -86,16 +86,14 @@ public class LocalFileStorageService implements FileStorageService { | @@ -86,16 +86,14 @@ public class LocalFileStorageService implements FileStorageService { | ||
86 | @Override | 86 | @Override |
87 | public FileUploadResponse upload(MultipartFile file) { | 87 | public FileUploadResponse upload(MultipartFile file) { |
88 | String fileName = this.storeFile(file); | 88 | String fileName = this.storeFile(file); |
89 | - String fileDownloadPath = | ||
90 | - ServletUriComponentsBuilder.fromCurrentRequestUri() | ||
91 | - .path(fileStorageProperties.getDownloadPath()) | ||
92 | - .path(fileName) | ||
93 | - .toUriString(); | 89 | +// String fileDownloadPath = ServletUriComponentsBuilder.fromCurrentRequestUri() .path(fileStorageProperties.getDownloadPath()) .path(fileName) .toUriString(); |
90 | + String fileDownloadPath = fileStorageProperties.getDownloadPath()+"/"+fileName; | ||
94 | String realDownloadPath = fileDownloadPath.replace(fileStorageProperties.getUploadPath(), ""); | 91 | String realDownloadPath = fileDownloadPath.replace(fileStorageProperties.getUploadPath(), ""); |
95 | -// String ossStaticPath = ServletUriComponentsBuilder.fromCurrentContextPath().toUriString() + ossFileUrl; | ||
96 | - ossFileUrl = ossFileUrl.replace("**", fileName); | 92 | + |
93 | + String ossStaticPath = ServletUriComponentsBuilder.fromCurrentContextPath().toUriString() + ossFileUrl; | ||
94 | + ossStaticPath = ossStaticPath.replace("**", fileName); | ||
97 | return new FileUploadResponse( | 95 | return new FileUploadResponse( |
98 | - fileName, realDownloadPath, file.getContentType(), file.getSize(), ossFileUrl); | 96 | + fileName, ossStaticPath, file.getContentType(), file.getSize(), realDownloadPath); |
99 | } | 97 | } |
100 | 98 | ||
101 | @Override | 99 | @Override |
@@ -130,12 +128,12 @@ public class LocalFileStorageService implements FileStorageService { | @@ -130,12 +128,12 @@ public class LocalFileStorageService implements FileStorageService { | ||
130 | } | 128 | } |
131 | 129 | ||
132 | @Override | 130 | @Override |
133 | - public String uploadFile(String fileName, String contentType, InputStream inputStream ) | 131 | + public String uploadFile(String name, String contentType, InputStream inputStream ) |
134 | throws IOException { | 132 | throws IOException { |
135 | - String name = storeFileByInputStream(fileName, inputStream); | ||
136 | - String ossStaticPath = ossFileUrl; | ||
137 | - ossStaticPath = ossStaticPath.replace("**", name); | ||
138 | - return ossStaticPath; | 133 | + String fileName = storeFileByInputStream(name, inputStream); |
134 | + String fileDownloadPath = fileStorageProperties.getDownloadPath()+"/"+fileName; | ||
135 | + String realDownloadPath = fileDownloadPath.replace(fileStorageProperties.getUploadPath(), ""); | ||
136 | + return realDownloadPath; | ||
139 | } | 137 | } |
140 | 138 | ||
141 | @Override | 139 | @Override |
@@ -86,7 +86,6 @@ public class Tk3dComponentServiceImpl extends AbstractBaseService<Tk3dComponentM | @@ -86,7 +86,6 @@ public class Tk3dComponentServiceImpl extends AbstractBaseService<Tk3dComponentM | ||
86 | 86 | ||
87 | private boolean save(Tk3dComponentEntity entity) { | 87 | private boolean save(Tk3dComponentEntity entity) { |
88 | if (baseMapper.exists(new LambdaQueryWrapper<Tk3dComponentEntity>() | 88 | if (baseMapper.exists(new LambdaQueryWrapper<Tk3dComponentEntity>() |
89 | - .eq(Tk3dComponentEntity::getTenantId, entity.getTenantId()) | ||
90 | .eq(Tk3dComponentEntity::getId, entity.getId()))) { | 89 | .eq(Tk3dComponentEntity::getId, entity.getId()))) { |
91 | return baseMapper.updateById(entity)>0; | 90 | return baseMapper.updateById(entity)>0; |
92 | } else { | 91 | } else { |