|
|
@@ -1,12 +1,12 @@
|
|
|
-package cn.reghao.autodop.dmaster.app.controller.crud;
|
|
|
+package cn.reghao.autodop.dmaster.app.controller.config;
|
|
|
|
|
|
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.AppConfig;
|
|
|
-import cn.reghao.autodop.dmaster.app.entity.config.ProjConfig;
|
|
|
-import cn.reghao.autodop.dmaster.app.service.crud.orchestarte.AppCrudService;
|
|
|
-import cn.reghao.autodop.dmaster.app.service.crud.orchestarte.ProjCrudService;
|
|
|
+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.vo.orchestration.AppVO;
|
|
|
import cn.reghao.autodop.dmaster.app.vo.orchestration.ProjVO;
|
|
|
import io.swagger.annotations.Api;
|
|
|
@@ -22,24 +22,24 @@ import java.util.stream.Collectors;
|
|
|
* @date 2019-11-27 11:29:43
|
|
|
*/
|
|
|
@Slf4j
|
|
|
-@Api(tags = "应用编排 CRUD 接口")
|
|
|
+@Api(tags = "应用配置 CRUD 接口")
|
|
|
@RestController
|
|
|
@RequestMapping("/api/config/orchestrate")
|
|
|
-public class OrchestrateCrudController {
|
|
|
+public class AppConfigController {
|
|
|
private AppCrudService appCrudService;
|
|
|
private ProjCrudService projCrudService;
|
|
|
|
|
|
- public OrchestrateCrudController(AppCrudService appCrudService, ProjCrudService projCrudService) {
|
|
|
+ public AppConfigController(AppCrudService appCrudService, ProjCrudService projCrudService) {
|
|
|
this.appCrudService = appCrudService;
|
|
|
this.projCrudService = projCrudService;
|
|
|
}
|
|
|
|
|
|
- /* 应用编排 */
|
|
|
+ /* 应用配置 */
|
|
|
@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);
|
|
|
- AppConfig app = AppVO.to(appVO);
|
|
|
+ AppOrchestration app = AppVO.to(appVO);
|
|
|
appCrudService.addOrUpdate(app);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
@@ -52,26 +52,11 @@ public class OrchestrateCrudController {
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "分页获取应用编排")
|
|
|
- @GetMapping("/app")
|
|
|
- public ResponseEntity<String> getAppOrchestrationByPage(@RequestParam("page") int page,
|
|
|
- @RequestParam("size") int size,
|
|
|
- @RequestParam("env") String env) {
|
|
|
- PageList<AppConfig> pageList = appCrudService.getByPage(page, size, env);
|
|
|
- PageList<AppVO> vos = new PageList<>();
|
|
|
- vos.setTotalPages(pageList.getTotalPages());
|
|
|
- vos.setTotalSize(pageList.getTotalSize());
|
|
|
- vos.setHasNext(pageList.isHasNext());
|
|
|
- vos.setPageSize(pageList.getPageSize());
|
|
|
- vos.setList(pageList.getList().stream().map(AppVO::from).collect(Collectors.toList()));
|
|
|
- return ResponseEntity.ok().body(WebResult.success(vos));
|
|
|
- }
|
|
|
-
|
|
|
@ApiOperation(value = "修改应用编排")
|
|
|
@PutMapping("/app")
|
|
|
public ResponseEntity<String> modifyAppOrchestration(@RequestBody String json) throws Exception {
|
|
|
AppVO appVO = (AppVO) JsonConverter.jsonToObject(json, AppVO.class);
|
|
|
- AppConfig app = AppVO.to(appVO);
|
|
|
+ AppOrchestration app = AppVO.to(appVO);
|
|
|
appCrudService.update(app);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
@@ -83,12 +68,27 @@ public class OrchestrateCrudController {
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "分页获取应用编排")
|
|
|
+ @GetMapping("/app")
|
|
|
+ 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<AppVO> vos = new PageList<>();
|
|
|
+ vos.setTotalPages(pageList.getTotalPages());
|
|
|
+ vos.setTotalSize(pageList.getTotalSize());
|
|
|
+ vos.setHasNext(pageList.isHasNext());
|
|
|
+ vos.setPageSize(pageList.getPageSize());
|
|
|
+ vos.setList(pageList.getList().stream().map(AppVO::from).collect(Collectors.toList()));
|
|
|
+ return ResponseEntity.ok().body(WebResult.success(vos));
|
|
|
+ }
|
|
|
+
|
|
|
/* 项目编排 */
|
|
|
@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);
|
|
|
- ProjConfig proj = ProjVO.to(projVO);
|
|
|
+ ProjOrchestration proj = ProjVO.to(projVO);
|
|
|
projCrudService.addOrUpdate(proj);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
@@ -101,26 +101,10 @@ public class OrchestrateCrudController {
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "分页获取项目编排")
|
|
|
- @GetMapping("/proj")
|
|
|
- public ResponseEntity<String> getProjOrchestrationByPage(@RequestParam("page") int page,
|
|
|
- @RequestParam("size") int size,
|
|
|
- @RequestParam("env") String env) {
|
|
|
- PageList<ProjConfig> pageList = projCrudService.getByPage(page, size, env);
|
|
|
- PageList<ProjVO> vos = new PageList<>();
|
|
|
- vos.setTotalPages(pageList.getTotalPages());
|
|
|
- vos.setTotalSize(pageList.getTotalSize());
|
|
|
- vos.setHasNext(pageList.isHasNext());
|
|
|
- vos.setPageSize(pageList.getPageSize());
|
|
|
- vos.setList(pageList.getList().stream().map(ProjVO::from).collect(Collectors.toList()));
|
|
|
-
|
|
|
- return ResponseEntity.ok().body(WebResult.success(vos));
|
|
|
- }
|
|
|
-
|
|
|
@ApiOperation(value = "修改项目编排")
|
|
|
@PutMapping("/proj")
|
|
|
public ResponseEntity<String> modifyProjOrchestration(@RequestBody String json) throws Exception {
|
|
|
- ProjConfig proj = (ProjConfig) JsonConverter.jsonToObject(json, ProjConfig.class);
|
|
|
+ ProjOrchestration proj = (ProjOrchestration) JsonConverter.jsonToObject(json, ProjOrchestration.class);
|
|
|
projCrudService.addOrUpdate(proj);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
@@ -131,4 +115,19 @@ public class OrchestrateCrudController {
|
|
|
projCrudService.delete(uniqueKey);
|
|
|
return ResponseEntity.ok().body(WebResult.success("ok"));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页获取项目编排")
|
|
|
+ @GetMapping("/proj")
|
|
|
+ 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<ProjVO> vos = new PageList<>();
|
|
|
+ vos.setTotalPages(pageList.getTotalPages());
|
|
|
+ vos.setTotalSize(pageList.getTotalSize());
|
|
|
+ vos.setHasNext(pageList.isHasNext());
|
|
|
+ vos.setPageSize(pageList.getPageSize());
|
|
|
+ vos.setList(pageList.getList().stream().map(ProjVO::from).collect(Collectors.toList()));
|
|
|
+ return ResponseEntity.ok().body(WebResult.success(vos));
|
|
|
+ }
|
|
|
}
|