diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/util/CosUtil.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/util/CosUtil.java index 122241a..06d19f1 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/util/CosUtil.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/util/CosUtil.java @@ -1,6 +1,5 @@ package com.newfiber.termite.util; -import cn.hutool.core.date.DateUtil; import com.qcloud.cos.COSClient; import com.qcloud.cos.ClientConfig; import com.qcloud.cos.auth.BasicCOSCredentials; @@ -15,8 +14,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.Date; -import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; public class CosUtil { @@ -39,9 +36,7 @@ public static String putFile(MultipartFile file){ try { - Date date = new Date(); - String fileName = file.getOriginalFilename(); - fileName = DateUtil.year(date) + "/" + (DateUtil.month(date) + 1) + "/" + DateUtil.dayOfMonth(date) + "/" + fileName; + String fileName = FileUploadUtils.extractFilename(file); InputStream inputStream = file.getInputStream(); ObjectMetadata objectMetadata = new ObjectMetadata();