|
@@ -4,6 +4,7 @@ import com.github.tobato.fastdfs.domain.StorePath;
|
|
import com.github.tobato.fastdfs.proto.storage.DownloadByteArray;
|
|
import com.github.tobato.fastdfs.proto.storage.DownloadByteArray;
|
|
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|
import com.github.tobato.fastdfs.service.FastFileStorageClient;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FilenameUtils;
|
|
import org.apache.commons.io.FilenameUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -16,6 +17,7 @@ import java.io.*;
|
|
* @date 2021/5/14
|
|
* @date 2021/5/14
|
|
*/
|
|
*/
|
|
@Component
|
|
@Component
|
|
|
|
+@Slf4j
|
|
public class FastDfsClient {
|
|
public class FastDfsClient {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -49,7 +51,11 @@ public class FastDfsClient {
|
|
}
|
|
}
|
|
|
|
|
|
public void deleteFile(String storagePath) {
|
|
public void deleteFile(String storagePath) {
|
|
- String filepath = storagePath.substring(storagePath.lastIndexOf("group1/") + 7);
|
|
|
|
- storageClient.deleteFile("group1", filepath);
|
|
|
|
|
|
+ try {
|
|
|
|
+ String filepath = storagePath.substring(storagePath.lastIndexOf("group1/") + 7);
|
|
|
|
+ storageClient.deleteFile("group1", filepath);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("删除失败!-------------》" + e);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|