Browse Source

离线包状态

lyhzzz 5 months ago
parent
commit
4557b176a3

+ 1 - 1
src/main/java/com/fdkankan/manage_jp/common/ResultCode.java

@@ -55,7 +55,7 @@ public enum ResultCode  {
     UPLOAD_ERROR(5033, "上传失败。"),
     UPLOAD_ERROR2(5034, "上传失败。文件格式不对"),
 
-
+    UPLOAD_ERROR3(5035, "文件不存在!"),
     ;
 
     private Integer code;

+ 9 - 0
src/main/java/com/fdkankan/manage_jp/controller/UploadController.java

@@ -11,6 +11,7 @@ import com.fdkankan.manage_jp.exception.BusinessException;
 import com.fdkankan.manage_jp.httpClient.client.FdKKClient;
 import com.fdkankan.manage_jp.httpClient.param.UploadEditSceneParam;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -109,6 +110,14 @@ public class UploadController extends BaseController{
                                 @RequestParam(value = "title",required = false)String title,
                                 @RequestParam(value = "newFileName",required = false)String newFileName ){
 
+        if(StringUtils.isBlank(newFileName)){
+            throw new BusinessException(ResultCode.PARAM_ERROR);
+        }
+        String ossPath = "manage/e57/"+newFileName;
+        if(!fYunFileServiceInterface.fileExist(ossPath)){
+            throw new BusinessException(ResultCode.UPLOAD_ERROR3);
+        }
+
         UploadEditSceneParam editSceneParam = new UploadEditSceneParam();
         editSceneParam.setTitle(title);
         editSceneParam.setUserId(getUser().getId());