From 156e136377680ac2dd5ad89735b7273db6f6d1d5 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期六, 24 二月 2024 20:27:02 +0800
Subject: [PATCH] 远程部署功能完善

---
 Source/UBCS/ubcs-service/ubcs-deploy/src/main/java/com/vci/ubcs/deploy/controller/DeployAppsController.java |   80 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-deploy/src/main/java/com/vci/ubcs/deploy/controller/DeployAppsController.java b/Source/UBCS/ubcs-service/ubcs-deploy/src/main/java/com/vci/ubcs/deploy/controller/DeployAppsController.java
index 738ed1b..133fd58 100644
--- a/Source/UBCS/ubcs-service/ubcs-deploy/src/main/java/com/vci/ubcs/deploy/controller/DeployAppsController.java
+++ b/Source/UBCS/ubcs-service/ubcs-deploy/src/main/java/com/vci/ubcs/deploy/controller/DeployAppsController.java
@@ -4,17 +4,24 @@
 import com.vci.ubcs.deploy.entity.DeployApps;
 import com.vci.ubcs.deploy.service.IDeployAppsService;
 import com.vci.ubcs.deploy.vo.DeployAppsVO;
+import com.vci.ubcs.starter.util.LocalFileUtil;
+import com.vci.ubcs.starter.web.util.ControllerUtil;
+import com.vci.ubcs.starter.web.util.LangBaseUtil;
 import io.swagger.annotations.Api;
 import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.http.auth.AuthenticationException;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 import springfox.documentation.annotations.ApiIgnore;
 
 import javax.servlet.ServletRequest;
+import java.io.File;
 import java.util.List;
 
 /**
@@ -24,17 +31,82 @@
  */
 @NonDS
 @RestController
-@AllArgsConstructor
+@RequiredArgsConstructor
 @RequestMapping("/deploy")
 @ApiIgnore
 @Api(value = "搴旂敤绠$悊", tags = "鎺ュ彛")
+@Slf4j
 public class DeployAppsController {
 
 	private final IDeployAppsService deployAppsService;
 
+	/**
+	 * 鑾峰彇鏈嶅姟杩愯鍒楄〃
+	 * @param servletRequest
+	 * @return
+	 * @throws ServiceException
+	 */
 	@GetMapping("/applications")
 	public R<List<DeployAppsVO>> getApplications(ServletRequest servletRequest) throws ServiceException {
 		return R.data(deployAppsService.getApplications(servletRequest));
 	}
 
+	/**
+	 * 鑾峰彇鏈嶅姟閰嶇疆淇℃伅
+	 * @param deployAppsVO
+	 * @return
+	 * @throws ServiceException
+	 */
+	@PostMapping("/saveOrGetServiceConfInfo")
+	public R<DeployApps> saveOrGetServiceConfInfo(@RequestBody DeployAppsVO deployAppsVO) throws ServiceException {
+		return R.data(deployAppsService.saveOrGetServiceConfInfo(deployAppsVO));
+	}
+
+	/**
+	 * 鏂板鎴栬幏鍙栨湇鍔¢粯璁ら厤缃俊鎭�
+	 * @param deployAppsVO
+	 * @return
+	 * @throws ServiceException
+	 */
+	@PostMapping("/saveOrUpdateServiceInfo")
+	public R saveOrUpdateDefault(@RequestBody DeployAppsVO deployAppsVO) throws ServiceException {
+		return R.status(deployAppsService.saveOrUpdateServiceInfo(deployAppsVO));
+	}
+
+	/**
+	 * 娣诲姞鏈嶅姟淇℃伅
+	 * @param deployApps
+	 * @return
+	 * @throws ServiceException
+	 */
+	@PostMapping("/addSave")
+	public R addSave(@RequestBody DeployApps deployApps) throws ServiceException {
+		return R.status(deployAppsService.addSave(deployApps));
+	}
+
+	/**
+	 * 鏈嶅姟鏇存柊鍖�
+	 * @param files 鏇存柊鐨刯ar鎴栨枃浠跺す
+	 * @param serverName 鏈嶅姟鍚嶇О
+	 * @return
+	 * @throws ServiceException
+	 */
+	@PostMapping("/importUpdateServiceJar")
+	public R importClassify(@RequestParam("files") MultipartFile[] files,@RequestParam String serverName) throws ServiceException {
+		if(Func.isBlank(serverName)){
+			return R.fail("Mandatory parameter service name not found!");
+		}
+		return deployAppsService.importClassify(files,serverName);
+	}
+
+	/**
+	 * 鎵ц鍛戒护
+	 * @param deployAppsVO
+	 * @return
+	 */
+	@PostMapping("/cmdExecute")
+	public R cmdExecute(@RequestBody DeployAppsVO deployAppsVO) throws ServiceException {
+		return deployAppsService.cmdExecute(deployAppsVO);
+	}
+
 }

--
Gitblit v1.9.3