|
@@ -150,11 +150,12 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
|
|
|
if (Objects.nonNull(attachmentInfoDto)) {
|
|
|
String fileName = SystemConstant.getNanoId();
|
|
|
StringJoiner stringJoiner = SystemConstant.getDirName(type, true).add(fileName).add(attachmentInfoDto.getFormat());
|
|
|
+ String path = stringJoiner.toString().replaceAll("\\\\", SystemConstant.ORG_SPLIT);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put(SystemConstant.TYPE, fileStoreUtil.uploadFileEnumIsOss(type) ? SystemConstant.OSS : SystemConstant.LOCAL);
|
|
|
- fileStoreUtil.ossUpload(stringJoiner.toString(), new FileInputStream(file), attachmentInfoDto.getMd5(), type.getFssType());
|
|
|
+ fileStoreUtil.ossUpload(path, new FileInputStream(file), attachmentInfoDto.getMd5(), type.getFssType());
|
|
|
jsonObject.put(SystemConstant.UPLOAD_TYPE, type);
|
|
|
- jsonObject.put(SystemConstant.PATH, stringJoiner.toString());
|
|
|
+ jsonObject.put(SystemConstant.PATH, path);
|
|
|
attachmentInfoDto.setFileName(fileName);
|
|
|
basicAttachment = new BasicAttachment(jsonObject.toJSONString(), attachmentInfoDto, null);
|
|
|
this.save(basicAttachment);
|
|
@@ -178,12 +179,13 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
|
|
|
AttachmentInfoDto attachmentInfoDto = this.validateAttachment(file);
|
|
|
if (Objects.nonNull(attachmentInfoDto)) {
|
|
|
StringJoiner stringJoiner = SystemConstant.getDirName(type, true).add(SystemConstant.getNanoId()).add(attachmentInfoDto.getFormat());
|
|
|
+ String path = stringJoiner.toString().replaceAll("\\\\", SystemConstant.ORG_SPLIT);
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put(SystemConstant.TYPE, fileStoreUtil.uploadFileEnumIsOss(type) ? SystemConstant.OSS : SystemConstant.LOCAL);
|
|
|
- fileStoreUtil.ossUpload(stringJoiner.toString(), file.getInputStream(), attachmentInfoDto.getMd5(), type.getFssType());
|
|
|
+ fileStoreUtil.ossUpload(path, file.getInputStream(), attachmentInfoDto.getMd5(), type.getFssType());
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
jsonObject.put(SystemConstant.UPLOAD_TYPE, type);
|
|
|
- jsonObject.put(SystemConstant.PATH, stringJoiner.toString());
|
|
|
+ jsonObject.put(SystemConstant.PATH, path);
|
|
|
basicAttachment = new BasicAttachment(jsonObject.toJSONString(), attachmentInfoDto, sysUser.getId());
|
|
|
this.save(basicAttachment);
|
|
|
}
|
|
@@ -253,4 +255,9 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
|
|
|
public String filePreview(BasicAttachment basicAttachment) throws Exception {
|
|
|
return this.filePreview(basicAttachment.getPath());
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String filePreviewPath(String filePath) {
|
|
|
+ return fileStoreUtil.getDictionaryConfig().fssPublicDomain().getServer() + SystemConstant.ORG_SPLIT + filePath;
|
|
|
+ }
|
|
|
}
|