Browse Source

GetAppController.java 合并到 BuildDeployController.java

reghao 6 months ago
parent
commit
bc6951b704

+ 24 - 1
mgr/src/main/java/cn/reghao/devops/mgr/app/controller/BuildDeployController.java

@@ -3,6 +3,7 @@ package cn.reghao.devops.mgr.app.controller;
 import cn.reghao.devops.mgr.app.service.AppBuildService;
 import cn.reghao.devops.mgr.app.service.bd.BuildApp;
 import cn.reghao.devops.mgr.app.service.bd.DeployApp;
+import cn.reghao.devops.mgr.app.service.bd.GetApp;
 import cn.reghao.devops.mgr.app.service.webhook.WebhookService;
 import cn.reghao.jutil.jdk.result.Result;
 import cn.reghao.jutil.jdk.result.WebResult;
@@ -25,12 +26,15 @@ public class BuildDeployController {
     private final DeployApp deployApp;
     private final AppBuildService appBuildService;
     private final WebhookService webhookService;
+    private final GetApp getApp;
 
-    public BuildDeployController(BuildApp buildApp, DeployApp deployApp, AppBuildService appBuildService, WebhookService webhookService) {
+    public BuildDeployController(BuildApp buildApp, DeployApp deployApp, AppBuildService appBuildService,
+                                 WebhookService webhookService, GetApp getApp) {
         this.buildApp = buildApp;
         this.deployApp = deployApp;
         this.appBuildService = appBuildService;
         this.webhookService = webhookService;
+        this.getApp = getApp;
     }
 
     @ApiOperation(value = "构建部署应用", notes = "N")
@@ -86,4 +90,23 @@ public class BuildDeployController {
         appBuildService.deleteBuildLog(buildLogId);
         return WebResult.success();
     }
+
+    @ApiOperation(value = "构建包下载接口", notes = "N")
+    @GetMapping(value = "/packageurl/{buildLogId}", produces = MediaType.APPLICATION_JSON_VALUE)
+    @ResponseBody
+    public String packageUrl(@PathVariable("buildLogId") String buildLogId) throws Exception {
+        String packageUrl = getApp.packageUrl(buildLogId);
+        return WebResult.successWithMsg(packageUrl);
+    }
+
+    @ApiOperation(value = "构建包下载接口", notes = "N")
+    @GetMapping("/dl/{filename}")
+    public String dlPackage(@PathVariable("filename") String filename) {
+        try {
+            getApp.dlPackage(filename);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+        return "redirect:/app/bd/build";
+    }
 }

+ 0 - 48
mgr/src/main/java/cn/reghao/devops/mgr/app/controller/GetAppController.java

@@ -1,48 +0,0 @@
-package cn.reghao.devops.mgr.app.controller;
-
-import cn.reghao.devops.mgr.app.service.bd.GetApp;
-import cn.reghao.jutil.jdk.result.WebResult;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-
-/**
- * @author reghao
- * @date 2023-04-21 23:57:00
- */
-@Api(tags = "构建包接口")
-@Slf4j
-@Controller
-@RequestMapping("/api/app/bd")
-public class GetAppController {
-    private final GetApp getApp;
-
-    public GetAppController(GetApp getApp) {
-        this.getApp = getApp;
-    }
-
-    @ApiOperation(value = "构建包下载接口", notes = "N")
-    @GetMapping(value = "/packageurl/{buildLogId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    @ResponseBody
-    public String packageUrl(@PathVariable("buildLogId") String buildLogId) throws Exception {
-        String packageUrl = getApp.packageUrl(buildLogId);
-        return WebResult.successWithMsg(packageUrl);
-    }
-
-    @ApiOperation(value = "构建包下载接口", notes = "N")
-    @GetMapping("/dl/{filename}")
-    public String dlPackage(@PathVariable("filename") String filename) {
-        try {
-            getApp.dlPackage(filename);
-        } catch (Exception e) {
-            log.error(e.getMessage());
-        }
-        return "redirect:/app/bd/build";
-    }
-}