feat(特色专区-资源支持上传至Nexus): 优化Nexus文件下载逻辑
通过重定向到Nexus下载文件时,也需要更新文件下载次数
This commit is contained in:
parent
a8bfda01e4
commit
54b897bf05
|
|
@ -321,6 +321,14 @@ public class SysFileInfoServiceImpl implements ISysFileInfoService {
|
|||
}
|
||||
|
||||
private void fileDownloadNexus(SysFileInfo sysFileInfo, HttpServletResponse response) {
|
||||
// 更新下载次数
|
||||
int downloadCount = 1;
|
||||
if (sysFileInfo.getDownloadCount() != null) {
|
||||
downloadCount = sysFileInfo.getDownloadCount() + 1;
|
||||
}
|
||||
sysFileInfo.setDownloadCount(downloadCount);
|
||||
updateSysFileInfo(sysFileInfo);
|
||||
// 重定向Nexus下载地址
|
||||
response.setStatus(302);
|
||||
String nexusUrl=NexusRequestUrl.GET_NEXUS_FILE_URL(nexusRequestHelper.nexusUrl, fileUploadNexusRepo, ServletUtils.urlEncodeExcludeSlashesApplyDuplicate(sysFileInfo.getFilePath()));
|
||||
response.setHeader("Location", nexusUrl);
|
||||
|
|
|
|||
Loading…
Reference in New Issue