From 74c08a504d55ae137004cb44e0145010f62f9585 Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期五, 25 八月 2023 14:47:35 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java
index e2cb0f7..69ea287 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java
@@ -6,6 +6,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
+import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
@@ -21,22 +22,24 @@
@Component("MinioTask")
@Slf4j(topic = "minio")
public class MinioTask {
+ @Resource
+ MinioUtils minioUtil;
public void delHistoryTask(Integer saveDays) {
log.debug("鎵ц鍘嗗彶鏁版嵁鍒犻櫎");
//閬嶅巻瀛樺偍
try {
- List<String> buckets=new ArrayList<>();
+ List<String> buckets = new ArrayList<>();
buckets.add("pic");
buckets.add("record");
- for (String name:buckets) {
- Iterable<Result<Item>> listObjectsPic = MinioUtils.getObjectsByBucket(name);
+ for (String name : buckets) {
+ Iterable<Result<Item>> listObjectsPic = minioUtil.getObjectsByBucket(name);
for (Result<Item> result : listObjectsPic) {
Item item = result.get();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Asia/Shanghai"));
String objectTime = item.lastModified().format(formatter);
- Date now= new Date();
+ Date now = new Date();
// 鎶婃棩鏈熷線鍓嶅鍔犱竴澶�,鏁存暟寰�鍚庢帹,璐熸暟寰�鍓嶇Щ鍔�
Calendar calendar = new GregorianCalendar();
calendar.setTime(now);
@@ -48,10 +51,9 @@
log.debug("objectTime : " + objectTime);
log.debug("expireTime : " + expireTime);
log.debug("objectTime 鏃堕棿鍦� expireTime 涔嬪墠,鎵ц鍒犻櫎");
- boolean b = MinioUtils.removeObject(name, item.objectName());
- if(b)
- {
- log.debug("鎴愬姛鍒犻櫎杩囨湡鏁版嵁锛�"+ item.objectName()+"---"+item.lastModified());
+ boolean b = minioUtil.removeObject(name, item.objectName());
+ if (b) {
+ log.debug("鎴愬姛鍒犻櫎杩囨湡鏁版嵁锛�" + item.objectName() + "---" + item.lastModified());
}
}
}
@@ -60,5 +62,4 @@
log.error("minio鍘嗗彶鏁版嵁鍒犻櫎寮傚父锛�" + ex.getMessage());
}
}
-
}
--
Gitblit v1.9.3