‘liusuyi’
2023-08-07 479a23949c28ae93a15e3f2f5aba655662f6c0c8
ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java
@@ -106,12 +106,14 @@
    @Async
    @Override
    public void parseStorageMinioEvent(String message) {
        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());
            storageMinioEvent.setEventType(records.getEventName());
                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 {
@@ -127,10 +129,14 @@
            storageMinioEvent.setUserName(records.getRequestParameters().getPrincipalid());
            int i = insertStorageMinioEvent(storageMinioEvent);
            if(i>0)
            {
                if (i > 0) {
                log.debug("minio操作日志入库成功!【"+storageMinioEvent.getEventType()+"】");
            }
        }
    }
        catch (Exception ex)
        {
            log.error("minio事件格式化异常:"+ex.getMessage());
        }
    }
}