|
|
@@ -7,10 +7,11 @@ import cn.reghao.devops.manager.app.model.po.config.AppConfig;
|
|
|
import cn.reghao.devops.common.build.model.LocalBuildDir;
|
|
|
import cn.reghao.devops.manager.app.model.po.log.BuildLog;
|
|
|
import cn.reghao.devops.manager.app.service.bd.GetApp;
|
|
|
-import cn.reghao.devops.manager.spring.HttpUtil;
|
|
|
+import cn.reghao.devops.manager.util.ServletUtil;
|
|
|
import cn.reghao.devops.manager.util.UploadDownload;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.BufferedInputStream;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
|
|
|
@@ -69,10 +70,14 @@ public class GetAppImpl implements GetApp {
|
|
|
|
|
|
String appId = arr[0];
|
|
|
String commitId = arr[1];
|
|
|
- String localPath = String.format("%s%s%s%s%s",
|
|
|
- LocalBuildDir.packDir, File.separator, appId, File.separator, filename);
|
|
|
- FileInputStream fileInputStream = new FileInputStream(localPath);
|
|
|
- //BufferedInputStream bis = new BufferedInputStream(fileInputStream);
|
|
|
- uploadDownload.download(filename, fileInputStream, HttpUtil.getResponse());
|
|
|
+ String filePath = LocalBuildDir.packDir + File.separator + appId + File.separator + filename;
|
|
|
+ File file = new File(filePath);
|
|
|
+ if (!file.exists()) {
|
|
|
+ throw new Exception("文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(file);
|
|
|
+ BufferedInputStream bis = new BufferedInputStream(fileInputStream);
|
|
|
+ uploadDownload.download(filename, bis, ServletUtil.getResponse());
|
|
|
}
|
|
|
}
|