Selaa lähdekoodia

删除4dkankan-util-oss

lyhzzz 3 vuotta sitten
vanhempi
commit
eafb0e5c98

+ 0 - 45
4dkankan-utils-oss/pom.xml

@@ -1,45 +0,0 @@
-<?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>
-        <groupId>com.fdkankan</groupId>
-        <artifactId>4dkankan-utils</artifactId>
-        <version>2.0.0</version>
-    </parent>
-
-    <artifactId>4dkankan-utils-oss</artifactId>
-    <packaging>jar</packaging>
-    <modelVersion>4.0.0</modelVersion>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-beans</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.aliyun.oss</groupId>
-            <artifactId>aliyun-sdk-oss</artifactId>
-            <version>2.5.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-            <version>1.7.30</version>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-autoconfigure</artifactId>
-            <version>2.3.12.RELEASE</version>
-        </dependency>
-
-
-    </dependencies>
-
-
-</project>

+ 0 - 90
4dkankan-utils-oss/src/main/java/com/fdkankan/oss/UploadUtils.java

@@ -1,90 +0,0 @@
-package com.fdkankan.oss;
-
-import com.aliyun.oss.OSSClient;
-import com.aliyun.oss.model.ObjectMetadata;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-import java.util.Map;
-
-@Component
-@ComponentScan
-public class UploadUtils {
-    private static Logger log = LoggerFactory.getLogger(UploadUtils.class);
-
-    @Value("${oss.point}")
-    private String point;
-
-    @Value("${oss.key}")
-    private String key;
-
-    @Value("${oss.secrey}")
-    private String secrey;
-
-    @Value("${oss.bucket}")
-    private String bucket;
-
-    public void upload(String filePath, String key1) {
-        OSSClient ossClient = new OSSClient(point, key, secrey);
-        try {
-            File file = new File(filePath);
-            if (!file.exists()) {
-                log.error("要上传的文件不存在:" + filePath);
-            }
-
-            ObjectMetadata metadata = new ObjectMetadata();
-            if(filePath.contains(".jpg")){
-                metadata.setContentType("image/jpeg");
-            }
-            ossClient.putObject(bucket, key1, new File(filePath), metadata);
-
-        } catch (Exception e) {
-            log.error(e.toString() + filePath);
-        }
-    }
-
-    public void upload2(String filePath, String key1) {
-        OSSClient ossClient = new OSSClient(point, key, secrey);
-        try {
-            ObjectMetadata metadata = new ObjectMetadata();
-            if(filePath.contains(".jpg")){
-                metadata.setContentType("image/jpeg");
-            }
-            if(filePath.contains(".mp4")){
-                metadata.setContentType("video/mp4");
-            }
-            if(filePath.contains(".mp3")){
-                metadata.setContentType("audio/mp3");
-            }
-            ossClient.putObject(bucket, key1, new File(filePath), metadata);
-        } catch (Exception e) {
-            log.error(e.toString() + filePath);
-        }
-    }
-
-    //上传的数据是文件夹,参数是文件夹路径,key是上传后的文件名
-    public void uploadMulFiles(Map<String, String> filepaths) {
-        if (filepaths == null) {
-            return;
-        }
-        Long start = System.currentTimeMillis();
-        log.info("开始批量上传到阿里云:" + start);
-        if (filepaths.size() > 50) {
-            for (String filePath : filepaths.keySet()) {
-                // log.info("文件:"+key);
-                upload2(filePath, filepaths.get(filePath));
-            }
-        } else {
-            for (String filePath : filepaths.keySet()) {
-                log.info("文件:" + filePath + "到阿里云:" + filepaths.get(filePath));
-                upload(filePath, filepaths.get(filePath));
-            }
-        }
-        log.info("批量上传阿里云完毕:" + (System.currentTimeMillis() - start));
-    }
-
-}

+ 0 - 1
pom.xml

@@ -8,7 +8,6 @@
         <module>4dkankan-common-utils</module>
         <module>4dkankan-utils-db</module>
         <module>4dkankan-utils-redis</module>
-        <module>4dkankan-utils-oss</module>
         <module>4dkankan-utils-fyun</module>
     </modules>