mirror of
https://gitee.com/wangkang/udf.git
synced 2026-11-01 15:53:43 +00:00
修改文件下载的逻辑
This commit is contained in:
+7
-2
@@ -39,7 +39,12 @@ public class DownLoadProcessAspect {
|
||||
public static final String DOWNLOAD_CACHE_PREFIX = ":DOWNLOAD_CACHE:";
|
||||
|
||||
/**
|
||||
* DOWNLOAD_CACHE_EXPIRATION
|
||||
* DOWNLOAD_WAITING_CACHE_EXPIRATION(待执行,执行中,缓存过期时间为1天)
|
||||
*/
|
||||
public static final long DOWNLOAD_WAITING_CACHE_EXPIRATION = 60 * 24;
|
||||
|
||||
/**
|
||||
* DOWNLOAD_CACHE_EXPIRATION(执行完成,执行错误,缓存过期时间为10分钟)
|
||||
*/
|
||||
public static final long DOWNLOAD_CACHE_EXPIRATION = 10;
|
||||
|
||||
@@ -85,7 +90,7 @@ public class DownLoadProcessAspect {
|
||||
try {
|
||||
//更新缓存
|
||||
info.setStatus(DownConstant.DOWNLOAD_PROCESS_STATUS.STATUS_2.value());
|
||||
redisTemplate.opsForValue().set(key, info, DOWNLOAD_CACHE_EXPIRATION, TimeUnit.MINUTES);
|
||||
redisTemplate.opsForValue().set(key, info, DOWNLOAD_WAITING_CACHE_EXPIRATION, TimeUnit.MINUTES);
|
||||
//执行
|
||||
result = proceedingJoinPoint.proceed();
|
||||
//获得本地文件
|
||||
|
||||
+2
-5
@@ -1,9 +1,6 @@
|
||||
package org.itkk.udf.file.aliyun.oss.service;
|
||||
package org.itkk.udf.file.aliyun.oss.api.download;
|
||||
|
||||
import org.itkk.udf.cache.redis.CacheRedisProperties;
|
||||
import org.itkk.udf.file.aliyun.oss.api.download.DownConstant;
|
||||
import org.itkk.udf.file.aliyun.oss.api.download.DownLoadProcessAspect;
|
||||
import org.itkk.udf.file.aliyun.oss.api.download.DownloadInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -44,7 +41,7 @@ public class DownLoadProcessService {
|
||||
info.setId(id);
|
||||
info.setStatus(DownConstant.DOWNLOAD_PROCESS_STATUS.STATUS_1.value());
|
||||
//更新缓存
|
||||
redisTemplate.opsForValue().set(key, info, DownLoadProcessAspect.DOWNLOAD_CACHE_EXPIRATION, TimeUnit.MINUTES);
|
||||
redisTemplate.opsForValue().set(key, info, DownLoadProcessAspect.DOWNLOAD_WAITING_CACHE_EXPIRATION, TimeUnit.MINUTES);
|
||||
//返回ID
|
||||
return id;
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.itkk.udf.core.domain.aliyun.oss.OssParam;
|
||||
import org.itkk.udf.file.aliyun.oss.api.OssWarpper;
|
||||
import org.itkk.udf.file.aliyun.oss.api.domain.PolicyResult;
|
||||
import org.itkk.udf.file.aliyun.oss.api.download.DownloadInfo;
|
||||
import org.itkk.udf.file.aliyun.oss.service.DownLoadProcessService;
|
||||
import org.itkk.udf.file.aliyun.oss.api.download.DownLoadProcessService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
Reference in New Issue
Block a user