Ver código fonte

更新 store-api 中的 ObjectService 接口

reghao 2 anos atrás
pai
commit
67ba6a3912

+ 17 - 10
oss-console/src/main/java/cn/reghao/oss/console/app/controller/ObjectController.java

@@ -3,7 +3,6 @@ package cn.reghao.oss.console.app.controller;
 import cn.reghao.jutil.jdk.result.WebResult;
 import cn.reghao.oss.console.app.model.dto.ObjectsScopeDto;
 import cn.reghao.oss.console.app.rpc.OssObjectService;
-import cn.reghao.oss.store.api.dto.DownloadUrl;
 import cn.reghao.oss.store.api.dto.ObjectInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -33,19 +32,27 @@ public class ObjectController {
         return WebResult.success();
     }
 
-    @ApiOperation(value = "根据 object_name 删除对象")
-    @PostMapping(value = "/delete/name", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String deleteByObjectNames(@RequestParam("channelId") Integer channelId,
-                                      @RequestParam("objectNames") List<String> objectNames) throws Exception {
-        ossObjectService.deleteByObjectNames(channelId, objectNames);
+    @ApiOperation(value = "根据 object_id 删除对象")
+    @PostMapping(value = "/delete/ids", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String deleteByObjects(@RequestParam("channelId") Integer channelId,
+                                  @RequestParam("objectIds") List<String> objectIds) throws Exception {
+        ossObjectService.deleteByObjectIds(channelId, objectIds);
         return WebResult.success();
     }
 
-    @ApiOperation(value = "获取对象 url")
+    @ApiOperation(value = "根据 object_url 删除对象")
+    @PostMapping(value = "/delete/url", produces = MediaType.APPLICATION_JSON_VALUE)
+    public String deleteByObjectUrl(@RequestParam("objectUrl") String objectUrl) throws Exception {
+        ossObjectService.deleteByObjectUrl(objectUrl);
+        return WebResult.success();
+    }
+
+    @ApiOperation(value = "获取对象签名 url")
     @GetMapping(value = "/url", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getObjectUrl(@RequestParam("channelId") Integer channelId, @RequestParam("objectId") String objectId) throws Exception {
-        DownloadUrl downloadUrl = ossObjectService.getDownloadUrl(channelId, objectId);
-        return WebResult.success(downloadUrl);
+    public String getObjectUrl(@RequestParam("channelId") Integer channelId,
+                               @RequestParam("objectId") String objectId) throws Exception {
+        String signedUrl = ossObjectService.getSignedUrl(channelId, objectId);
+        return WebResult.success(signedUrl);
     }
 
     @ApiOperation(value = "获取对象信息")

+ 11 - 5
oss-console/src/main/java/cn/reghao/oss/console/app/rpc/OssObjectService.java

@@ -4,7 +4,6 @@ import cn.reghao.oss.console.app.model.dto.ObjectsScopeDto;
 import cn.reghao.oss.console.app.model.po.StoreNode;
 import cn.reghao.oss.console.app.service.UploadChannelService;
 import cn.reghao.oss.console.util.AuthKeyContext;
-import cn.reghao.oss.store.api.dto.DownloadUrl;
 import cn.reghao.oss.store.api.dto.ObjectInfo;
 import cn.reghao.oss.store.api.iface.ObjectService;
 import org.springframework.stereotype.Service;
@@ -31,16 +30,23 @@ public class OssObjectService {
         objectService.setObjectsScope(scope, objectIds);
     }
 
-    public void deleteByObjectNames(int channelId, List<String> objectNames) throws Exception {
+    public void deleteByObjectIds(int channelId, List<String> objectIds) throws Exception {
         ObjectService objectService = getObjectService(channelId);
-        objectService.deleteByObjectNames(objectNames);
+        objectService.deleteByObjectIds(objectIds);
     }
 
-    public DownloadUrl getDownloadUrl(int channelId, String objectId) throws Exception {
+    public void deleteByObjectUrl(String objectUrl) throws Exception {
+        String objectName = objectUrl.replace("//", "");
+        int channelId = 1;
+        ObjectService objectService = getObjectService(channelId);
+        objectService.deleteByObjectName(objectName);
+    }
+
+    public String getSignedUrl(int channelId, String objectId) throws Exception {
         ObjectService objectService = getObjectService(channelId);
         int loginUser = AuthKeyContext.getUser();
         int expireSecond = 3600;
-        return objectService.getDownloadUrl(loginUser, objectId, expireSecond);
+        return objectService.getSignedUrl(loginUser, objectId, expireSecond);
     }
 
     public ObjectInfo getObjectInfo(int channelId, String objectId) throws Exception {

+ 29 - 149
oss-sdk/src/main/java/cn/reghao/oss/sdk/OssConsoleClient.java

@@ -199,40 +199,6 @@ public class OssConsoleClient {
     // ****************************************************************************************************************
     // Object 相关接口
     // ****************************************************************************************************************
-    public void setObjectScope(int channelId, String objectId, int scope) throws Exception {
-        /*MultiPartBodyPublisher publisher = new MultiPartBodyPublisher();
-        publisher.addPart("scope", scope+"");
-        publisher.addPart("objectId", objectId);
-        publisher.addPart("contentType", contentType+"");*/
-
-        Map<String, String> formData = new HashMap<>();
-        formData.put("channelId", channelId+"");
-        formData.put("objectId", objectId);
-        formData.put("scope", scope+"");
-
-        String api = String.format("%s/api/oss/object/scope/object", endpoint);
-        HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
-                .header("authorization", "Bearer " + token)
-                .headers("content-type", "application/x-www-form-urlencoded")
-                .version(HttpClient.Version.HTTP_1_1)
-                .POST(HttpRequest.BodyPublishers.ofString(getFormDataAsString(formData)))
-                .build();
-        HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
-        int statusCode = httpResponse.statusCode();
-        String body = httpResponse.body();
-        if (statusCode != 200) {
-            String errMsg = String.format("%s -> %s", statusCode, body);
-            throw new Exception(errMsg);
-        }
-
-        Type type = new TypeToken<WebResult<String>>(){}.getType();
-        WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
-        if (webResult.getCode() != 0) {
-            String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
-            throw new Exception(errMsg);
-        }
-    }
-
     public void setObjectsScope(int channelId, List<String> objectIds, int scope) throws Exception {
         String objectIdsStr = objectIds.toString().replace("[", "").replace("]", "");
         Map<String, String> formData = new HashMap<>();
@@ -276,93 +242,13 @@ public class OssConsoleClient {
         return formBodyBuilder.toString();
     }
 
-    public void deleteByObjectNames(List<String> objectNames) throws Exception {
-        String api = String.format("%s/api/oss/object/delete/name", endpoint);
-        HttpRequest.Builder builder = HttpRequest.newBuilder(new URI(api)).version(HttpClient.Version.HTTP_1_1);
-
-        String objectNamesStr = objectNames.toString().replace("[", "").replace("]", "");
-        MultiPartBodyPublisher publisher = new MultiPartBodyPublisher();
-        publisher.addPart("objectNames", objectNamesStr);
-
-        HttpRequest httpRequest = builder.POST(publisher.build()).build();
-        HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
-        int statusCode = httpResponse.statusCode();
-        String body = httpResponse.body();
-        if (statusCode != 200) {
-            String errMsg = String.format("%s -> %s", statusCode, body);
-            throw new Exception(errMsg);
-        }
-
-        Type type = new TypeToken<WebResult<String>>(){}.getType();
-        WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
-        if (webResult.getCode() != 0) {
-            String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
-            throw new Exception(errMsg);
-        }
-    }
-
-    public DownloadUrl getDownloadUrl(String objectId) throws Exception {
-        String api = String.format("%s/api/oss/object/url?objectId=%s", endpoint, objectId);
-        HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
-                .header("authorization", "Bearer " + token)
-                .version(HttpClient.Version.HTTP_1_1)
-                .GET()
-                .build();
-        HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
-        int statusCode = httpResponse.statusCode();
-        String body = httpResponse.body();
-        if (statusCode != 200) {
-            String errMsg = String.format("%s -> %s", statusCode, body);
-            throw new Exception(errMsg);
-        }
-
-        Type type = new TypeToken<WebResult<DownloadUrl>>(){}.getType();
-        WebResult<DownloadUrl> webResult = JsonConverter.jsonToObject(body, type);
-        if (webResult.getCode() != 0) {
-            String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
-            throw new Exception(errMsg);
-        }
-
-        return webResult.getData();
-    }
-
-    public ObjectInfo getObjectInfo(int channelId, String objectId) throws Exception {
-        String api = String.format("%s/api/oss/object/info?channelId=%s&objectId=%s", endpoint, channelId, objectId);
-        HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
-                .header("authorization", "Bearer " + token)
-                .version(HttpClient.Version.HTTP_1_1)
-                .GET()
-                .build();
-        HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
-        int statusCode = httpResponse.statusCode();
-        String body = httpResponse.body();
-        if (statusCode != 200) {
-            String errMsg = String.format("%s -> %s", statusCode, body);
-            throw new Exception(errMsg);
-        }
-
-        Type type = new TypeToken<WebResult<ObjectInfo>>(){}.getType();
-        WebResult<ObjectInfo> webResult = JsonConverter.jsonToObject(body, type);
-        if (webResult.getCode() != 0) {
-            String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
-            throw new Exception(errMsg);
-        }
-
-        return webResult.getData();
-    }
-
-    // ****************************************************************************************************************
-    // 媒体文件相关接口
-    // ****************************************************************************************************************
-    public void setMediaScope(int channelId, int contentType, List<String> mediaIds, int scope) throws Exception {
-        String mediaIdsStr = mediaIds.toString().replace("[", "").replace("]", "");
+    public void deleteByObjectIds(int channelId, List<String> objectIds) throws Exception {
+        String objectIdsStr = objectIds.toString().replace("[", "").replace("]", "");
         Map<String, String> formData = new HashMap<>();
         formData.put("channelId", channelId+"");
-        formData.put("contentType", contentType+"");
-        formData.put("mediaIds", mediaIdsStr);
-        formData.put("scope", scope+"");
+        formData.put("objectIds", objectIdsStr);
 
-        String api = String.format("%s/api/oss/media/scope", endpoint);
+        String api = String.format("%s/api/oss/object/delete/ids", endpoint);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
                 .headers("content-type", "application/x-www-form-urlencoded")
@@ -385,14 +271,11 @@ public class OssConsoleClient {
         }
     }
 
-    public void deleteMediaFile(int channelId, int contentType, List<String> mediaIds) throws Exception {
-        String mediaIdsStr = mediaIds.toString().replace("[", "").replace("]", "");
+    public void deleteByObjectUrl(String objectUrl) throws Exception {
         Map<String, String> formData = new HashMap<>();
-        formData.put("channelId", channelId+"");
-        formData.put("contentType", contentType+"");
-        formData.put("mediaIds", mediaIdsStr);
+        formData.put("objectUrl", objectUrl);
 
-        String api = String.format("%s/api/oss/media/delete", endpoint);
+        String api = String.format("%s/api/oss/object/delete/url", endpoint);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
                 .headers("content-type", "application/x-www-form-urlencoded")
@@ -415,8 +298,8 @@ public class OssConsoleClient {
         }
     }
 
-    public List<VideoUrlDto> getVideoUrls(int channelId, String videoFileId) throws Exception {
-        String api = String.format("%s/api/oss/media/video/url?channelId=%s&videoFileId=%s", endpoint, channelId, videoFileId);
+    public String getSignedUrl(int channelId, String objectId) throws Exception {
+        String api = String.format("%s/api/oss/object/url?channelId=%s&objectId=%s", endpoint, channelId, objectId);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
                 .version(HttpClient.Version.HTTP_1_1)
@@ -430,8 +313,8 @@ public class OssConsoleClient {
             throw new Exception(errMsg);
         }
 
-        Type type = new TypeToken<WebResult<List<VideoUrlDto>>>(){}.getType();
-        WebResult<List<VideoUrlDto>> webResult = JsonConverter.jsonToObject(body, type);
+        Type type = new TypeToken<WebResult<String>>(){}.getType();
+        WebResult<String> webResult = JsonConverter.jsonToObject(body, type);
         if (webResult.getCode() != 0) {
             String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
             throw new Exception(errMsg);
@@ -440,8 +323,8 @@ public class OssConsoleClient {
         return webResult.getData();
     }
 
-    public VideoInfo getVideoInfo(int channelId, String videoFileId) throws Exception {
-        String api = String.format("%s/api/oss/media/video/info?channelId=%s&videoFileId=%s", endpoint, channelId, videoFileId);
+    public ObjectInfo getObjectInfo(int channelId, String objectId) throws Exception {
+        String api = String.format("%s/api/oss/object/info?channelId=%s&objectId=%s", endpoint, channelId, objectId);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
                 .version(HttpClient.Version.HTTP_1_1)
@@ -455,8 +338,8 @@ public class OssConsoleClient {
             throw new Exception(errMsg);
         }
 
-        Type type = new TypeToken<WebResult<VideoInfo>>(){}.getType();
-        WebResult<VideoInfo> webResult = JsonConverter.jsonToObject(body, type);
+        Type type = new TypeToken<WebResult<ObjectInfo>>(){}.getType();
+        WebResult<ObjectInfo> webResult = JsonConverter.jsonToObject(body, type);
         if (webResult.getCode() != 0) {
             String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
             throw new Exception(errMsg);
@@ -465,18 +348,15 @@ public class OssConsoleClient {
         return webResult.getData();
     }
 
-    public List<ImageUrlDto> getImageUrls(int channelId, Set<String> imageFileIds) throws Exception {
-        String imageFileIdsStr = imageFileIds.toString().replace("[", "").replace("]", "");
-        Map<String, String> formData = new HashMap<>();
-        formData.put("channelId", channelId+"");
-        formData.put("imageFileIds", imageFileIdsStr);
-
-        String api = String.format("%s/api/oss/media/image/urls", endpoint);
+    // ****************************************************************************************************************
+    // 媒体文件相关接口
+    // ****************************************************************************************************************
+    public VideoInfo getVideoInfo(int channelId, String videoFileId) throws Exception {
+        String api = String.format("%s/api/oss/media/video/info?channelId=%s&videoFileId=%s", endpoint, channelId, videoFileId);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
-                .headers("content-type", "application/x-www-form-urlencoded")
                 .version(HttpClient.Version.HTTP_1_1)
-                .POST(HttpRequest.BodyPublishers.ofString(getFormDataAsString(formData)))
+                .GET()
                 .build();
         HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
         int statusCode = httpResponse.statusCode();
@@ -486,8 +366,8 @@ public class OssConsoleClient {
             throw new Exception(errMsg);
         }
 
-        Type type = new TypeToken<WebResult<List<ImageUrlDto>>>(){}.getType();
-        WebResult<List<ImageUrlDto>> webResult = JsonConverter.jsonToObject(body, type);
+        Type type = new TypeToken<WebResult<VideoInfo>>(){}.getType();
+        WebResult<VideoInfo> webResult = JsonConverter.jsonToObject(body, type);
         if (webResult.getCode() != 0) {
             String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
             throw new Exception(errMsg);
@@ -496,8 +376,8 @@ public class OssConsoleClient {
         return webResult.getData();
     }
 
-    public List<AudioUrl> getAudioUrls(String audioFileId, int loginUser) throws Exception {
-        String api = String.format("%s/api/oss/media/audio/url?audioFileId=%s&userId=%s", endpoint, audioFileId, loginUser);
+    public ImageInfo getImageInfo(int channelId, String imageFileId) throws Exception {
+        String api = String.format("%s/api/oss/media/image/info?channelId=%s&videoFileId=%s", endpoint, channelId, imageFileId);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
                 .version(HttpClient.Version.HTTP_1_1)
@@ -511,8 +391,8 @@ public class OssConsoleClient {
             throw new Exception(errMsg);
         }
 
-        Type type = new TypeToken<WebResult<List<AudioUrl>>>(){}.getType();
-        WebResult<List<AudioUrl>> webResult = JsonConverter.jsonToObject(body, type);
+        Type type = new TypeToken<WebResult<ImageInfo>>(){}.getType();
+        WebResult<ImageInfo> webResult = JsonConverter.jsonToObject(body, type);
         if (webResult.getCode() != 0) {
             String errMsg = String.format("%s - %s", webResult.getCode(), webResult.getMsg());
             throw new Exception(errMsg);
@@ -521,8 +401,8 @@ public class OssConsoleClient {
         return webResult.getData();
     }
 
-    public AudioInfo getAudioInfo(String audioFileId) throws Exception {
-        String api = String.format("%s/api/oss/media/audio/info/%s", endpoint, audioFileId);
+    public AudioInfo getAudioInfo(int channelId, String audioFileId) throws Exception {
+        String api = String.format("%s/api/oss/media/audio/info/?channelId=%s&audioFileId=%s", endpoint, channelId, audioFileId);
         HttpRequest httpRequest = HttpRequest.newBuilder(new URI(api))
                 .header("authorization", "Bearer " + token)
                 .version(HttpClient.Version.HTTP_1_1)

+ 1 - 1
oss-store/src/main/java/cn/reghao/oss/store/controller/ObjectGetController.java

@@ -57,7 +57,7 @@ public class ObjectGetController {
                           @RequestParam(value = "sign", required = false) String sign,
                           @RequestParam(value = "client", required = false) String client) throws IOException {
         String objectName = ObjectUtil.getObjectName();
-        ObjectMeta objectMeta = objectRepository.getObjectMeta(objectName);
+        ObjectMeta objectMeta = objectRepository.getObjectMetaByName(objectName);
         if (objectMeta == null) {
             getObjectService.writeResponse(HttpServletResponse.SC_NOT_FOUND);
             return;

+ 1 - 19
oss-store/src/main/java/cn/reghao/oss/store/db/repository/ObjectRepository.java

@@ -67,28 +67,10 @@ public class ObjectRepository {
         dataBlockMapper.delete(dataBlock);
     }
 
-    private void deleteByObjectId(String objectId) {
-        FileMeta fileMeta = fileMetaMapper.findByObjectId(objectId);
-        deleteObject(fileMeta);
-    }
-
-    public void deleteByObjectNames(List<String> objectNames) {
-        fileMetaMapper.findByObjectNames(objectNames).forEach(this::deleteObject);
-    }
-
-    //@CacheEvict
-    public void deleteByObjectIds(List<String> objectIds) {
-        objectIds.forEach(this::deleteByObjectId);
-    }
-
     public FileMeta getByObjectName(String objectName) {
         return fileMetaMapper.findByObjectName(objectName);
     }
 
-    public List<FileMeta> getByObjectNames(List<String> objectNames) {
-        return fileMetaMapper.findByObjectNames(objectNames);
-    }
-
     public FileMeta getByObjectId(String objectId) {
         return fileMetaMapper.findByObjectId(objectId);
     }
@@ -98,7 +80,7 @@ public class ObjectRepository {
     }
 
     @Cacheable(cacheNames = "oss:store:objectMeta", key = "#objectName", unless = "#result == null")
-    public ObjectMeta getObjectMeta(String objectName) {
+    public ObjectMeta getObjectMetaByName(String objectName) {
         log.info("cache miss {}", objectName);
         ObjectMeta objectMeta = fileMetaMapper.findObjectMeta(objectName);
         return objectMeta;

+ 13 - 4
oss-store/src/main/java/cn/reghao/oss/store/rpc/ObjectServiceImpl.java

@@ -49,17 +49,26 @@ public class ObjectServiceImpl implements ObjectService {
     }
 
     @Override
-    public void deleteByObjectNames(List<String> objectNames) {
-        objectRepository.deleteByObjectNames(objectNames);
+    public void deleteByObjectIds(List<String> objectIds) {
+        objectIds.forEach(objectId -> {
+            FileMeta fileMeta = objectRepository.getByObjectId(objectId);
+            objectRepository.deleteObject(fileMeta);
+        });
+    }
+
+    @Override
+    public void deleteByObjectName(String objectName) {
+        FileMeta fileMeta = objectRepository.getByObjectName(objectName);
+        objectRepository.deleteObject(fileMeta);
     }
 
     @Override
-    public DownloadUrl getDownloadUrl(int loginUser, String objectId, int expireSecond) {
+    public String getSignedUrl(int loginUser, String objectId, int expireSecond) {
         FileMeta fileMeta = objectRepository.getByObjectId(objectId);
         String objectName = fileMeta.getObjectName();
         String url = objectNameService.getObjectUrl(objectName);
         String signedUrl = signService.getSignedUrl(loginUser, url, expireSecond);
-        return new DownloadUrl(signedUrl, "");
+        return signedUrl;
     }
 
     @Override

+ 3 - 2
oss-store/src/main/java/cn/reghao/oss/store/service/PutObjectService.java

@@ -63,7 +63,7 @@ public class PutObjectService {
 
     public ObjectResult copyObject(ObjectProp objectProp, String filename, FileMeta fileMeta) {
         String dupObjectId = fileMeta.getObjectId();
-        ObjectMeta objectMeta = objectRepository.getObjectMeta(fileMeta.getObjectName());
+        ObjectMeta objectMeta = objectRepository.getObjectMetaByName(fileMeta.getObjectName());
 
         int fileType = fileMeta.getFileType();
         String savedPath = objectMeta.getAbsolutePath();
@@ -107,6 +107,7 @@ public class PutObjectService {
     }
 
     public void deleteObject(String objectId) {
-        objectRepository.deleteByObjectIds(List.of(objectId));
+        FileMeta fileMeta = objectRepository.getByObjectId(objectId);
+        objectRepository.deleteObject(fileMeta);
     }
 }

+ 1 - 1
oss-store/src/main/java/cn/reghao/oss/store/service/SignService.java

@@ -17,7 +17,7 @@ import java.util.UUID;
 @Service
 public class SignService {
     private final StoreLocalCache storeLocalCache;
-    private StoreChannelService storeChannelService;
+    private final StoreChannelService storeChannelService;
 
     public SignService(StoreLocalCache storeLocalCache, StoreChannelService storeChannelService) {
         this.storeLocalCache = storeLocalCache;

+ 2 - 1
oss-store/src/main/java/cn/reghao/oss/store/service/StoreChannelService.java

@@ -48,7 +48,8 @@ public class StoreChannelService {
     public ObjectChannel getChannelByUrl(int loginUser, String url) {
         String domain = storeLocalCache.getDomain();
         String objectName = url.replace("//" + domain + "/", "");
-        for (String prefix : prefixMap.keySet()) {
+        for (String key : prefixMap.keySet()) {
+            String prefix = key.split("-")[1];
             if (objectName.startsWith(prefix)) {
                 return prefixMap.get(loginUser + "-" + prefix);
             }

+ 1 - 1
oss-store/src/main/java/cn/reghao/oss/store/task/FileTask.java

@@ -30,7 +30,7 @@ public class FileTask {
         );
 
         for (String objectName : objectNames) {
-            ObjectMeta objectMeta = objectRepository.getObjectMeta(objectName);
+            ObjectMeta objectMeta = objectRepository.getObjectMetaByName(objectName);
             String objectId = objectMeta.getObjectId();
             int fileType = 1003;
             String absolutePath = objectMeta.getAbsolutePath();

+ 3 - 2
store-api/src/main/java/cn/reghao/oss/store/api/iface/ObjectService.java

@@ -10,7 +10,8 @@ import java.util.List;
  */
 public interface ObjectService {
     void setObjectsScope(int scope, List<String> objectIds);
-    void deleteByObjectNames(List<String> objectNames);
-    DownloadUrl getDownloadUrl(int loginUser, String objectId, int expireSecond);
+    void deleteByObjectIds(List<String> objectIds);
+    void deleteByObjectName(String objectName);
+    String getSignedUrl(int loginUser, String objectId, int expireSecond);
     ObjectInfo getObjectInfo(int loginUser, String objectId, int expireSecond);
 }