From 065142057ba3983af899991085e37ac1ec502320 Mon Sep 17 00:00:00 2001
From: aijinhui <aijinhui>
Date: 星期二, 19 九月 2023 14:06:30 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java | 52 +++++++++++++++++++++++++++++-----------------------
1 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java b/ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java
index ce70fdf..5e16aca 100644
--- a/ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java
@@ -106,31 +106,37 @@
@Async
@Override
public void parseStorageMinioEvent(String message) {
- JsonsRootBean jsonsRootBean = JSONObject.parseObject(message, JsonsRootBean.class);
- if (jsonsRootBean != null) {
- Records records = jsonsRootBean.getRecords().get(0);
- StorageMinioEvent storageMinioEvent = new StorageMinioEvent();
- storageMinioEvent.setEventTime(records.getEventTime());
- storageMinioEvent.setEventType(records.getEventName());
- storageMinioEvent.setBucketName(records.getS3().getBucket().getName());
- String encode = null;
- try {
- encode = URLDecoder.decode(records.getS3().getMObject().getKey(), "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- storageMinioEvent.setObjectName(encode);
- storageMinioEvent.setObjectSize(records.getS3().getMObject().getSize());
- storageMinioEvent.setObjectType(records.getS3().getMObject().getContentType());
- storageMinioEvent.setHost(records.getSource().getHost());
- storageMinioEvent.setEndpoint(records.getResponseElements().getXMinioOriginEndpoint());
- storageMinioEvent.setUserName(records.getRequestParameters().getPrincipalid());
+ try {
+ JsonsRootBean jsonsRootBean = JSONObject.parseObject(message, JsonsRootBean.class);
+ if (jsonsRootBean != null) {
+ Records records = jsonsRootBean.getRecords().get(0);
+ StorageMinioEvent storageMinioEvent = new StorageMinioEvent();
+ storageMinioEvent.setEventTime(records.getEventTime());
+ String eventType = records.getEventName().substring(0, records.getEventName().indexOf(":", records.getEventName().indexOf(":") + 1));//涓嶅寘鍚湰韬綅缃�
+ storageMinioEvent.setEventType(eventType);
+ storageMinioEvent.setBucketName(records.getS3().getBucket().getName());
+ String encode = null;
+ try {
+ encode = URLDecoder.decode(records.getS3().getMObject().getKey(), "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ storageMinioEvent.setObjectName(encode);
+ storageMinioEvent.setObjectSize(records.getS3().getMObject().getSize());
+ storageMinioEvent.setObjectType(records.getS3().getMObject().getContentType());
+ storageMinioEvent.setHost(records.getSource().getHost());
+ storageMinioEvent.setEndpoint(records.getResponseElements().getXMinioOriginEndpoint());
+ storageMinioEvent.setUserName(records.getRequestParameters().getPrincipalid());
- int i = insertStorageMinioEvent(storageMinioEvent);
- if(i>0)
- {
- log.debug("minio鎿嶄綔鏃ュ織鍏ュ簱鎴愬姛!銆�"+storageMinioEvent.getEventType()+"銆�");
+ int i = insertStorageMinioEvent(storageMinioEvent);
+ if (i > 0) {
+ log.debug("minio鎿嶄綔鏃ュ織鍏ュ簱鎴愬姛!銆�" + storageMinioEvent.getEventType() + "銆�");
+ }
}
}
+ catch (Exception ex)
+ {
+ log.error("minio浜嬩欢鏍煎紡鍖栧紓甯�:"+ex.getMessage());
+ }
}
}
--
Gitblit v1.9.3