|
|
@@ -1,6 +1,8 @@
|
|
|
package cn.reghao.autodop.dmaster.app.controller;
|
|
|
|
|
|
+import cn.reghao.autodop.dmaster.app.model.po.config.build.LocalBuildDir;
|
|
|
import cn.reghao.autodop.dmaster.app.service.BuildDeployService;
|
|
|
+import cn.reghao.autodop.dmaster.util.UploadDownload;
|
|
|
import cn.reghao.jdkutil.result.WebBody;
|
|
|
import cn.reghao.autodop.dmaster.app.service.BuildDeployDispatcher;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -11,6 +13,12 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.BufferedInputStream;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
/**
|
|
|
* @author reghao
|
|
|
* @date 2019-08-30 18:49:15
|
|
|
@@ -20,12 +28,13 @@ import org.springframework.web.bind.annotation.*;
|
|
|
@RestController
|
|
|
@RequestMapping("/api/app/bd")
|
|
|
public class BuildDeployController {
|
|
|
- private final BuildDeployService buildDeployService;
|
|
|
+ private BuildDeployService buildDeployService;
|
|
|
private final BuildDeployDispatcher buildDeployDispatcher;
|
|
|
+ private final UploadDownload uploadDownload;
|
|
|
|
|
|
- public BuildDeployController(BuildDeployService buildDeployService, BuildDeployDispatcher buildDeployDispatcher) {
|
|
|
- this.buildDeployService = buildDeployService;
|
|
|
+ public BuildDeployController(BuildDeployDispatcher buildDeployDispatcher, UploadDownload uploadDownload) {
|
|
|
this.buildDeployDispatcher = buildDeployDispatcher;
|
|
|
+ this.uploadDownload = uploadDownload;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "构建部署应用")
|
|
|
@@ -77,4 +86,13 @@ public class BuildDeployController {
|
|
|
buildDeployDispatcher.clear();
|
|
|
return WebBody.success();
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "构建包下载接口")
|
|
|
+ @GetMapping("/dl/{filename}")
|
|
|
+ public void dlPackage(@PathVariable("filename") String filename, HttpServletResponse response) throws IOException {
|
|
|
+ String filePath = LocalBuildDir.packDir + File.separator + filename;
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(filePath);
|
|
|
+ BufferedInputStream bis = new BufferedInputStream(fileInputStream);
|
|
|
+ uploadDownload.download(filename, bis, response);
|
|
|
+ }
|
|
|
}
|