加上通过url上传文件-重新构建http链接
This commit is contained in:
parent
d5c56fd885
commit
dbfb8c8c99
@ -122,17 +122,38 @@ public class FileByUrlServiceImpl implements FileByUrlService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LogPlatClient logPlatClient;
|
private LogPlatClient logPlatClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileService fileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过url上传
|
* 通过url上传
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ServerFileUploadResponse uploadByUrl(String appCode, String bizScene, String fileName, String url, Integer channelType, ContextInfo.LiteSaasContext liteSaasContext) {
|
public ServerFileUploadResponse uploadByUrl(String appCode, String bizScene, String fileName, String url, Integer channelType, ContextInfo.LiteSaasContext liteSaasContext) {
|
||||||
|
//重新构建链接
|
||||||
|
url = this.rebuildUrl(url);
|
||||||
File ossFile = uploadFileAndGetFile(appCode, bizScene, fileName, url, channelType);
|
File ossFile = uploadFileAndGetFile(appCode, bizScene, fileName, url, channelType);
|
||||||
//操作日志记录
|
//操作日志记录
|
||||||
operateLog(this.buildUploadParams(appCode, bizScene, fileName, url, channelType), "", FILE_UPLOAD_CODE, FILE_UPLOAD_NAME, liteSaasContext);
|
operateLog(this.buildUploadParams(appCode, bizScene, fileName, url, channelType), "", FILE_UPLOAD_CODE, FILE_UPLOAD_NAME, liteSaasContext);
|
||||||
return buildResponse(ossFile);
|
return buildResponse(ossFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* url:https://xxx,则直接返回
|
||||||
|
* url:fileKey,则返回https://链接
|
||||||
|
*/
|
||||||
|
private String rebuildUrl(String url) {
|
||||||
|
if (StringUtils.isNotBlank(url)) {
|
||||||
|
FindFileUrlDto findFileUrlDto = FindFileUrlDto.builder().fileKey(Lists.newArrayList(url)).build();
|
||||||
|
|
||||||
|
List<FindFileUrlResponse> responseList = fileService.findFileUrl(findFileUrlDto);
|
||||||
|
if (CollectionUtil.isNotEmpty(responseList)) {
|
||||||
|
return responseList.get(0).getUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作日志记录
|
* 操作日志记录
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user