|
@@ -1,6 +1,9 @@
|
|
|
package cn.iselab.mooctest.site.service.updownload.impl;
|
|
|
|
|
|
import cn.iselab.mooctest.site.service.updownload.DownloadService;
|
|
|
+import cn.iselab.mooctest.site.web.logic.OSSLogic;
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -20,6 +23,9 @@ public class DownloadServicePCImpl implements DownloadService{
|
|
|
@Value("${host}")
|
|
|
private String host;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OSSLogic ossLogic;
|
|
|
+
|
|
|
private String LOCAL_PATH = "/var/www/download/";
|
|
|
|
|
|
private String DOWNLOAD_PATH = "/download/";
|
|
@@ -42,7 +48,9 @@ public class DownloadServicePCImpl implements DownloadService{
|
|
|
|
|
|
@Override
|
|
|
public String download(String url)throws Exception{
|
|
|
- return null;
|
|
|
+ String name = url.split("/")[url.split("/").length - 1];
|
|
|
+ ossLogic.downloadByUrl(url, FileUtils.getUserDirectory()+"", name);
|
|
|
+ return FileUtils.getUserDirectory() + "/"+name;
|
|
|
}
|
|
|
|
|
|
private long checkoutTimestamp(String zipFullName,String caseName,long latestTimestamp){
|