mirror of
https://gitee.com/wangkang/udf.git
synced 2026-10-25 17:13:40 +00:00
将被下载的文件,上传阿里云OSS的时候进行压缩,节省空间和流量
This commit is contained in:
+2
-9
@@ -10,7 +10,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.itkk.udf.cache.redis.CacheRedisProperties;
|
||||
import org.itkk.udf.core.ApplicationConfig;
|
||||
import org.itkk.udf.core.exception.SystemRuntimeException;
|
||||
import org.itkk.udf.core.utils.ZipUtil;
|
||||
@@ -40,7 +39,7 @@ public class DownLoadProcessAspect {
|
||||
/**
|
||||
* DOWNLOAD_CACHE_PREFIX
|
||||
*/
|
||||
public static final String DOWNLOAD_CACHE_PREFIX = ":DOWNLOAD_CACHE:";
|
||||
public static final String DOWNLOAD_CACHE_PREFIX = "DOWNLOAD_CACHE:";
|
||||
|
||||
/**
|
||||
* DOWNLOAD_WAITING_CACHE_EXPIRATION(待执行,执行中,缓存过期时间为1天)
|
||||
@@ -58,12 +57,6 @@ public class DownLoadProcessAspect {
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
/**
|
||||
* cacheRedisProperties
|
||||
*/
|
||||
@Autowired
|
||||
private CacheRedisProperties cacheRedisProperties;
|
||||
|
||||
/**
|
||||
* ossWarpper
|
||||
*/
|
||||
@@ -93,7 +86,7 @@ public class DownLoadProcessAspect {
|
||||
//获得参数
|
||||
DownLoadParam<?> param = (DownLoadParam<?>) proceedingJoinPoint.getArgs()[0];
|
||||
//获得key
|
||||
String key = cacheRedisProperties.getPrefix() + DOWNLOAD_CACHE_PREFIX + param.getId();
|
||||
String key = DOWNLOAD_CACHE_PREFIX + param.getId();
|
||||
//构造对象
|
||||
DownloadInfo info = new DownloadInfo();
|
||||
info.setId(param.getId());
|
||||
|
||||
+2
-9
@@ -1,6 +1,5 @@
|
||||
package org.itkk.udf.file.aliyun.oss.api.download;
|
||||
|
||||
import org.itkk.udf.cache.redis.CacheRedisProperties;
|
||||
import org.itkk.udf.core.exception.ParameterValidException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@@ -22,12 +21,6 @@ public class DownLoadProcessService {
|
||||
@Autowired
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
/**
|
||||
* cacheRedisProperties
|
||||
*/
|
||||
@Autowired
|
||||
private CacheRedisProperties cacheRedisProperties;
|
||||
|
||||
/**
|
||||
* generateDownLoadId
|
||||
*
|
||||
@@ -42,7 +35,7 @@ public class DownLoadProcessService {
|
||||
//生成ID
|
||||
String id = UUID.randomUUID().toString();
|
||||
//获得key
|
||||
String key = cacheRedisProperties.getPrefix() + DownLoadProcessAspect.DOWNLOAD_CACHE_PREFIX + id;
|
||||
String key = DownLoadProcessAspect.DOWNLOAD_CACHE_PREFIX + id;
|
||||
//构造对象
|
||||
DownloadInfo info = new DownloadInfo();
|
||||
info.setId(id);
|
||||
@@ -62,7 +55,7 @@ public class DownLoadProcessService {
|
||||
*/
|
||||
public DownloadInfo getDownloadInfo(String id) {
|
||||
//获得key
|
||||
String key = cacheRedisProperties.getPrefix() + DownLoadProcessAspect.DOWNLOAD_CACHE_PREFIX + id;
|
||||
String key = DownLoadProcessAspect.DOWNLOAD_CACHE_PREFIX + id;
|
||||
//获得缓存值
|
||||
Object cacheValue = redisTemplate.opsForValue().get(key);
|
||||
//返回
|
||||
|
||||
Reference in New Issue
Block a user