Commit 30ac1fbb by 翁国栋

区分出云盘文件

parent 15f51552
...@@ -68,6 +68,9 @@ public class DiskFilesController { ...@@ -68,6 +68,9 @@ public class DiskFilesController {
@ApiOperation(value = "上传普通文件", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "上传普通文件", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> upload(@CurrentUser UserBean userBean, @RequestParam(required = true) MultipartFile[] file, public Result<Object> upload(@CurrentUser UserBean userBean, @RequestParam(required = true) MultipartFile[] file,
@ApiParam("文件文件夹或共享空间ID") @RequestParam(required = true) Integer catalogueId) { @ApiParam("文件文件夹或共享空间ID") @RequestParam(required = true) Integer catalogueId) {
if(catalogueId<=0){
return ResultUtil.error("上传失败,请选择文件夹");
}
if (file == null || file.length == 0) { if (file == null || file.length == 0) {
return ResultUtil.error("上传失败,请选择上传文件"); return ResultUtil.error("上传失败,请选择上传文件");
} }
...@@ -108,7 +111,7 @@ public class DiskFilesController { ...@@ -108,7 +111,7 @@ public class DiskFilesController {
diskFilesLog.insert(); diskFilesLog.insert();
} }
return ResultUtil.data(imageUrls); return ResultUtil.data(diskFiles);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -9,10 +9,12 @@ import com.google.common.base.Strings; ...@@ -9,10 +9,12 @@ import com.google.common.base.Strings;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.bouncycastle.util.encoders.UrlBase64Encoder; import org.bouncycastle.util.encoders.UrlBase64Encoder;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.UrlEncoded; import org.eclipse.jetty.util.UrlEncoded;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
...@@ -64,6 +66,8 @@ public class HtzzController { ...@@ -64,6 +66,8 @@ public class HtzzController {
private String project_package; private String project_package;
@Value("${zip.path}") @Value("${zip.path}")
private String zipPath; private String zipPath;
@Value("${config-8timer.Aliyun.endpoint}")
private String endpoint;
/** /**
...@@ -305,12 +309,21 @@ public class HtzzController { ...@@ -305,12 +309,21 @@ public class HtzzController {
return ResultUtil.error("操作失败"); return ResultUtil.error("操作失败");
} }
Map<String, String> url = Maps.newHashMap(); Map<String, String> url = Maps.newHashMap();
Map<String,String> ftp=Maps.newHashMap();
ids.forEach(i -> { ids.forEach(i -> {
HtzzAdminZzda htzzAdminZzda = HtzzAdminZzda.builder().id(i).build().selectById(); HtzzAdminZzda htzzAdminZzda = HtzzAdminZzda.builder().id(i).build().selectById();
/*格式化获取文字*/ if(StringUtil.isNotBlank(htzzAdminZzda.getZjfj())){
String urla =UrlEncoded.decodeString(htzzAdminZzda.getZjfj()); /*格式化获取文字*/
int index = urla.indexOf(project_package); String urla =UrlEncoded.decodeString(htzzAdminZzda.getZjfj());
url.put(htzzAdminZzda.getId() +"_"+ htzzAdminZzda.getZjmc(), urla.substring(index)); /*判断是保存在oss还是ftp*/
if(urla.contains(endpoint.replace("http://","."))) {
int index = urla.indexOf(project_package);
url.put(htzzAdminZzda.getId() + "_" + htzzAdminZzda.getZjmc(), urla.substring(index));
}else {
//TODO 区分出云盘文件暂时不下载
ftp.put(htzzAdminZzda.getId()+"_"+htzzAdminZzda.getZjmc(),urla);
}
}
}); });
String zipUrl = null; String zipUrl = null;
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment