|
@@ -1,10 +1,14 @@
|
|
package com.caimei.service.data.impl;
|
|
package com.caimei.service.data.impl;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.aliyuncs.DefaultAcsClient;
|
|
import com.aliyuncs.DefaultAcsClient;
|
|
import com.aliyuncs.IAcsClient;
|
|
import com.aliyuncs.IAcsClient;
|
|
import com.aliyuncs.profile.DefaultProfile;
|
|
import com.aliyuncs.profile.DefaultProfile;
|
|
|
|
+import com.aliyuncs.utils.StringUtils;
|
|
|
|
+import com.caimei.annotation.CurrentUser;
|
|
import com.caimei.mapper.cmMapper.FileMapper;
|
|
import com.caimei.mapper.cmMapper.FileMapper;
|
|
import com.caimei.model.ResponseJson;
|
|
import com.caimei.model.ResponseJson;
|
|
|
|
+import com.caimei.model.po.SysUser;
|
|
import com.caimei.model.vo.FileTreeVo;
|
|
import com.caimei.model.vo.FileTreeVo;
|
|
import com.caimei.service.async.AsyncService;
|
|
import com.caimei.service.async.AsyncService;
|
|
import com.caimei.service.data.DatabaseService;
|
|
import com.caimei.service.data.DatabaseService;
|
|
@@ -15,6 +19,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.Assert;
|
|
import org.springframework.util.Assert;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -418,4 +423,41 @@ public class DatabaseServiceImpl implements DatabaseService {
|
|
}
|
|
}
|
|
return filenames;
|
|
return filenames;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseJson uploadPackage(Integer authUserId,String fileName, String ossName, String ossUrl, String fileSize,Integer parentId,String mime,String filePath){
|
|
|
|
+ //如果文件夹没有文件则直接返回
|
|
|
|
+ if(StringUtils.isNotEmpty(filePath)){
|
|
|
|
+ if(!filePath.contains(".")){
|
|
|
|
+ ResponseJson.error("-1","文件夹为空");
|
|
|
|
+ }
|
|
|
|
+ String[] filePathArr = filePath.split("/");
|
|
|
|
+ for (int i=0 ;i<filePathArr.length;i++){
|
|
|
|
+ if(filePathArr[i].contains(".")){
|
|
|
|
+ //新增文件
|
|
|
|
+ getOssUploadResult(authUserId,fileName,ossName,ossUrl,fileSize,parentId,mime);
|
|
|
|
+ System.out.println("文件---------"+filePathArr[i]);
|
|
|
|
+ }else{
|
|
|
|
+ //创建文件夹
|
|
|
|
+ //判断文件夹是否存在(不存在则新建,存在则跳过)
|
|
|
|
+ List<Integer> dictionaryById = fileMapper.findDictionaryById(parentId);
|
|
|
|
+ if(null!=dictionaryById&&dictionaryById.size()>0){
|
|
|
|
+ continue;
|
|
|
|
+ }else{
|
|
|
|
+ //不存在创建文件夹
|
|
|
|
+ fileMapper.creatPackage(authUserId, parentId, filePathArr[i]);
|
|
|
|
+ //查询最新文件夹id作为下一次的父id
|
|
|
|
+ List<Integer> newestInfoById = fileMapper.getNewestInfoById();
|
|
|
|
+ if(null!=newestInfoById&&newestInfoById.size()>0){
|
|
|
|
+ parentId = newestInfoById.get(0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ System.out.println("文件夹---------"+filePathArr[i]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ ResponseJson.error("-1","文件夹为空");
|
|
|
|
+ }
|
|
|
|
+ return ResponseJson.success();
|
|
|
|
+ }
|
|
}
|
|
}
|