|
|
@@ -1,12 +1,12 @@
|
|
|
-package cn.reghao.autodop.dmaster.app.controller.config;
|
|
|
+package cn.reghao.autodop.dmaster.app.controller.crud;
|
|
|
|
|
|
import cn.reghao.autodop.common.result.WebResult;
|
|
|
import cn.reghao.autodop.dmaster.common.db.PageList;
|
|
|
import cn.reghao.autodop.common.utils.serializer.JsonConverter;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.config.AppOrchestration;
|
|
|
import cn.reghao.autodop.dmaster.app.entity.config.ProjOrchestration;
|
|
|
-import cn.reghao.autodop.dmaster.app.service.config.app.AppCrudService;
|
|
|
-import cn.reghao.autodop.dmaster.app.service.config.app.ProjCrudService;
|
|
|
+import cn.reghao.autodop.dmaster.app.service.crud.AppOrchestrationService;
|
|
|
+import cn.reghao.autodop.dmaster.app.service.crud.ProjOrchestrationService;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.orchestration.AppVO;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.orchestration.ProjVO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -26,21 +26,21 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
|
@RequestMapping("/api/config/orchestrate")
|
|
|
public class AppConfigController {
|
|
|
- private AppCrudService appCrudService;
|
|
|
- private ProjCrudService projCrudService;
|
|
|
+ private AppOrchestrationService appOrchestrationService;
|
|
|
+ private ProjOrchestrationService projOrchestrationService;
|
|
|
|
|
|
- public AppConfigController(AppCrudService appCrudService, ProjCrudService projCrudService) {
|
|
|
- this.appCrudService = appCrudService;
|
|
|
- this.projCrudService = projCrudService;
|
|
|
+ public AppConfigController(AppOrchestrationService appOrchestrationService, ProjOrchestrationService projOrchestrationService) {
|
|
|
+ this.appOrchestrationService = appOrchestrationService;
|
|
|
+ this.projOrchestrationService = projOrchestrationService;
|
|
|
}
|
|
|
|
|
|
/* 应用配置 */
|
|
|
@ApiOperation(value = "添加应用编排")
|
|
|
@PostMapping(value = "/app", consumes = "application/json")
|
|
|
public ResponseEntity<String> addAppOrchestration(@RequestBody String json) throws Exception {
|
|
|
- AppVO appVO = (AppVO) JsonConverter.jsonToObject(json, AppVO.class);
|
|
|
+ AppVO appVO = JsonConverter.jsonToObject(json, AppVO.class);
|
|
|
AppOrchestration app = AppVO.to(appVO);
|
|
|
- appCrudService.addOrUpdate(app);
|
|
|
+ appOrchestrationService.insert(app);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@@ -48,23 +48,23 @@ public class AppConfigController {
|
|
|
@PostMapping(value = "/app/copy")
|
|
|
public ResponseEntity<String> copyAppOrchestration(@RequestParam("from") String from,
|
|
|
@RequestParam("to") String to) throws Exception {
|
|
|
- appCrudService.copy(from, to);
|
|
|
+ appOrchestrationService.copy(from, to);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改应用编排")
|
|
|
@PutMapping("/app")
|
|
|
public ResponseEntity<String> modifyAppOrchestration(@RequestBody String json) throws Exception {
|
|
|
- AppVO appVO = (AppVO) JsonConverter.jsonToObject(json, AppVO.class);
|
|
|
+ AppVO appVO = JsonConverter.jsonToObject(json, AppVO.class);
|
|
|
AppOrchestration app = AppVO.to(appVO);
|
|
|
- appCrudService.update(app);
|
|
|
+ appOrchestrationService.update(app);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "删除应用编排")
|
|
|
@DeleteMapping("/app/{uniqueKey}")
|
|
|
public ResponseEntity<String> deleteAppOrchestration(@PathVariable("uniqueKey") String uniqueKey) throws Exception {
|
|
|
- appCrudService.delete(uniqueKey);
|
|
|
+ appOrchestrationService.delete(uniqueKey);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@@ -73,7 +73,7 @@ public class AppConfigController {
|
|
|
public ResponseEntity<String> getAppOrchestrationByPage(@RequestParam("page") int page,
|
|
|
@RequestParam("size") int size,
|
|
|
@RequestParam("env") String env) {
|
|
|
- PageList<AppOrchestration> pageList = appCrudService.getByPage(page, size, env);
|
|
|
+ PageList<AppOrchestration> pageList = appOrchestrationService.getByPage(page, size, env);
|
|
|
PageList<AppVO> vos = new PageList<>();
|
|
|
vos.setTotalPages(pageList.getTotalPages());
|
|
|
vos.setTotalSize(pageList.getTotalSize());
|
|
|
@@ -87,9 +87,9 @@ public class AppConfigController {
|
|
|
@ApiOperation(value = "添加项目编排")
|
|
|
@PostMapping(value = "/proj", consumes = "application/json")
|
|
|
public ResponseEntity<String> addProjOrchestration(@RequestBody String json) throws Exception {
|
|
|
- ProjVO projVO = (ProjVO) JsonConverter.jsonToObject(json, ProjVO.class);
|
|
|
+ ProjVO projVO = JsonConverter.jsonToObject(json, ProjVO.class);
|
|
|
ProjOrchestration proj = ProjVO.to(projVO);
|
|
|
- projCrudService.addOrUpdate(proj);
|
|
|
+ projOrchestrationService.insert(proj);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@@ -97,22 +97,22 @@ public class AppConfigController {
|
|
|
@PostMapping(value = "/proj/copy")
|
|
|
public ResponseEntity<String> copyProjOrchestration(@RequestParam("from") String from,
|
|
|
@RequestParam("to") String to) throws Exception {
|
|
|
- projCrudService.copy(from, to);
|
|
|
+ projOrchestrationService.copy(from, to);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改项目编排")
|
|
|
@PutMapping("/proj")
|
|
|
public ResponseEntity<String> modifyProjOrchestration(@RequestBody String json) throws Exception {
|
|
|
- ProjOrchestration proj = (ProjOrchestration) JsonConverter.jsonToObject(json, ProjOrchestration.class);
|
|
|
- projCrudService.addOrUpdate(proj);
|
|
|
+ ProjOrchestration proj = JsonConverter.jsonToObject(json, ProjOrchestration.class);
|
|
|
+ projOrchestrationService.insert(proj);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "删除项目编排")
|
|
|
@DeleteMapping("/proj/{uniqueKey}")
|
|
|
public ResponseEntity<String> deleteProjOrchestration(@PathVariable("uniqueKey") String uniqueKey) throws Exception {
|
|
|
- projCrudService.delete(uniqueKey);
|
|
|
+ projOrchestrationService.delete(uniqueKey);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
@@ -121,7 +121,7 @@ public class AppConfigController {
|
|
|
public ResponseEntity<String> getProjOrchestrationByPage(@RequestParam("page") int page,
|
|
|
@RequestParam("size") int size,
|
|
|
@RequestParam("env") String env) {
|
|
|
- PageList<ProjOrchestration> pageList = projCrudService.getByPage(page, size, env);
|
|
|
+ PageList<ProjOrchestration> pageList = projOrchestrationService.getByPage(page, size, env);
|
|
|
PageList<ProjVO> vos = new PageList<>();
|
|
|
vos.setTotalPages(pageList.getTotalPages());
|
|
|
vos.setTotalSize(pageList.getTotalSize());
|