fix:oss组件封装

This commit is contained in:
zhongzb
2023-10-04 21:49:10 +08:00
parent 282134fd88
commit 5f15e1f5aa
18 changed files with 53 additions and 22 deletions

View File

@@ -20,6 +20,10 @@
<groupId>com.abin.mallchat</groupId> <groupId>com.abin.mallchat</groupId>
<artifactId>mallchat-transaction</artifactId> <artifactId>mallchat-transaction</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.abin.mallchat</groupId>
<artifactId>mallchat-oss-starter</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.knuddels</groupId> <groupId>com.knuddels</groupId>
<artifactId>jtokkit</artifactId> <artifactId>jtokkit</artifactId>

View File

@@ -2,9 +2,9 @@ package com.abin.mallchat.common.user.controller;
import com.abin.mallchat.common.common.domain.vo.response.ApiResult; import com.abin.mallchat.common.common.domain.vo.response.ApiResult;
import com.abin.mallchat.common.common.utils.RequestHolder; import com.abin.mallchat.common.common.utils.RequestHolder;
import com.abin.mallchat.common.common.utils.oss.domain.OssResp;
import com.abin.mallchat.common.user.domain.vo.request.oss.UploadUrlReq; import com.abin.mallchat.common.user.domain.vo.request.oss.UploadUrlReq;
import com.abin.mallchat.common.user.service.OssService; import com.abin.mallchat.common.user.service.OssService;
import com.abin.mallchat.oss.domain.OssResp;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -1,7 +1,7 @@
package com.abin.mallchat.common.user.service; package com.abin.mallchat.common.user.service;
import com.abin.mallchat.common.common.utils.oss.domain.OssResp;
import com.abin.mallchat.common.user.domain.vo.request.oss.UploadUrlReq; import com.abin.mallchat.common.user.domain.vo.request.oss.UploadUrlReq;
import com.abin.mallchat.oss.domain.OssResp;
/** /**
* <p> * <p>

View File

@@ -1,12 +1,12 @@
package com.abin.mallchat.common.user.service.impl; package com.abin.mallchat.common.user.service.impl;
import com.abin.mallchat.common.common.utils.AssertUtil; import com.abin.mallchat.common.common.utils.AssertUtil;
import com.abin.mallchat.common.common.utils.oss.MinIOTemplate;
import com.abin.mallchat.common.common.utils.oss.domain.OssReq;
import com.abin.mallchat.common.common.utils.oss.domain.OssResp;
import com.abin.mallchat.common.user.domain.enums.OssSceneEnum; import com.abin.mallchat.common.user.domain.enums.OssSceneEnum;
import com.abin.mallchat.common.user.domain.vo.request.oss.UploadUrlReq; import com.abin.mallchat.common.user.domain.vo.request.oss.UploadUrlReq;
import com.abin.mallchat.common.user.service.OssService; import com.abin.mallchat.common.user.service.OssService;
import com.abin.mallchat.oss.MinIOTemplate;
import com.abin.mallchat.oss.domain.OssReq;
import com.abin.mallchat.oss.domain.OssResp;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -11,7 +11,7 @@ mybatis-plus:
spring: spring:
profiles: profiles:
#运行的环境 #运行的环境
active: my-test active: my-prod
application: application:
name: mallchat name: mallchat
datasource: datasource:

View File

@@ -104,10 +104,6 @@
<groupId>org.redisson</groupId> <groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId> <artifactId>redisson-spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
</dependency>
<!-- Used for unit testing --> <!-- Used for unit testing -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mallchat-tools</artifactId>
<groupId>com.abin.mallchat</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mallchat-oss-starter</artifactId>
<dependencies>
<dependency>
<groupId>com.abin.mallchat</groupId>
<artifactId>mallchat-common-starter</artifactId>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,7 +1,5 @@
package com.abin.mallchat.common.common.config; package com.abin.mallchat.oss;
import com.abin.mallchat.common.common.utils.oss.MinIOTemplate;
import com.abin.mallchat.common.common.utils.oss.OssProperties;
import io.minio.MinioClient; import io.minio.MinioClient;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.springframework.boot.autoconfigure.condition.*; import org.springframework.boot.autoconfigure.condition.*;

View File

@@ -1,11 +1,11 @@
package com.abin.mallchat.common.common.utils.oss; package com.abin.mallchat.oss;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.file.FileNameUtil; import cn.hutool.core.io.file.FileNameUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.abin.mallchat.common.common.utils.oss.domain.OssReq; import com.abin.mallchat.oss.domain.OssReq;
import com.abin.mallchat.common.common.utils.oss.domain.OssResp; import com.abin.mallchat.oss.domain.OssResp;
import io.minio.*; import io.minio.*;
import io.minio.http.Method; import io.minio.http.Method;
import io.minio.messages.Bucket; import io.minio.messages.Bucket;

View File

@@ -1,4 +1,4 @@
package com.abin.mallchat.common.common.utils.oss; package com.abin.mallchat.oss;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.abin.mallchat.common.common.utils.oss; package com.abin.mallchat.oss;
import lombok.Data; import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -1,4 +1,4 @@
package com.abin.mallchat.common.common.utils.oss; package com.abin.mallchat.oss;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

View File

@@ -1,4 +1,4 @@
package com.abin.mallchat.common.common.utils.oss.domain; package com.abin.mallchat.oss.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View File

@@ -1,4 +1,4 @@
package com.abin.mallchat.common.common.utils.oss.domain; package com.abin.mallchat.oss.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

View File

@@ -0,0 +1,3 @@
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.abin.mallchat.oss.MinIOConfiguration

View File

@@ -11,11 +11,11 @@ import com.fasterxml.jackson.databind.JsonNode;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.transaction.support.TransactionSynchronizationManager;
import javax.validation.constraints.NotNull;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;

View File

@@ -16,6 +16,7 @@
<module>mallchat-transaction</module> <module>mallchat-transaction</module>
<module>mallchat-common-starter</module> <module>mallchat-common-starter</module>
<module>mallchat-frequency-control</module> <module>mallchat-frequency-control</module>
<module>mallchat-oss-starter</module>
</modules> </modules>

View File

@@ -54,6 +54,11 @@
<artifactId>mallchat-common-starter</artifactId> <artifactId>mallchat-common-starter</artifactId>
<version>${version}</version> <version>${version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.abin.mallchat</groupId>
<artifactId>mallchat-oss-starter</artifactId>
<version>${version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.abin.mallchat</groupId> <groupId>com.abin.mallchat</groupId>
<artifactId>mallchat-transaction</artifactId> <artifactId>mallchat-transaction</artifactId>