|
@@ -1,49 +1,41 @@
|
|
|
-package cn.reghao.autodop.dmaster.app3;
|
|
|
|
|
|
|
+package cn.reghao.autodop.dmaster.app3.controller;
|
|
|
|
|
|
|
|
import cn.reghao.autodop.common.result.WebResult;
|
|
import cn.reghao.autodop.common.result.WebResult;
|
|
|
import cn.reghao.autodop.common.utils.JsonUtil;
|
|
import cn.reghao.autodop.common.utils.JsonUtil;
|
|
|
-import cn.reghao.autodop.common.utils.text.TextFile;
|
|
|
|
|
import cn.reghao.autodop.dmaster.app3.backup.BackupService;
|
|
import cn.reghao.autodop.dmaster.app3.backup.BackupService;
|
|
|
import cn.reghao.autodop.dmaster.app3.entity.App3BakLog;
|
|
import cn.reghao.autodop.dmaster.app3.entity.App3BakLog;
|
|
|
-import cn.reghao.autodop.dmaster.app3.entity.App3Bak;
|
|
|
|
|
import cn.reghao.autodop.dmaster.common.mongo.MongoManager;
|
|
import cn.reghao.autodop.dmaster.common.mongo.MongoManager;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import java.io.File;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author reghao
|
|
* @author reghao
|
|
|
* @date 2019-11-15 08:44:50
|
|
* @date 2019-11-15 08:44:50
|
|
|
*/
|
|
*/
|
|
|
-@Api(tags = "第三方应用接口")
|
|
|
|
|
|
|
+@Api(tags = "第三方应用操作接口")
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/api/app3")
|
|
@RequestMapping("/api/app3")
|
|
|
-public class App3Controller {
|
|
|
|
|
|
|
+public class App3OpsController {
|
|
|
private BackupService backupService;
|
|
private BackupService backupService;
|
|
|
private MongoManager mongoManager;
|
|
private MongoManager mongoManager;
|
|
|
|
|
|
|
|
- public App3Controller(BackupService backupService, MongoManager mongoManager) {
|
|
|
|
|
|
|
+ public App3OpsController(BackupService backupService, MongoManager mongoManager) {
|
|
|
this.backupService = backupService;
|
|
this.backupService = backupService;
|
|
|
this.mongoManager = mongoManager;
|
|
this.mongoManager = mongoManager;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostMapping("/")
|
|
|
|
|
- public String addService(App3Bak app3Bak) throws Exception {
|
|
|
|
|
- String scriptPath = "/tmp/test.sh";
|
|
|
|
|
|
|
+ @PostMapping("/bak")
|
|
|
|
|
+ public String backup(String jsonData) throws Exception {
|
|
|
|
|
+ /*String scriptPath = "/tmp/test.sh";
|
|
|
TextFile.write(new File(scriptPath), app3Bak.getBakScript());
|
|
TextFile.write(new File(scriptPath), app3Bak.getBakScript());
|
|
|
app3Bak.setBakScriptPath(scriptPath);
|
|
app3Bak.setBakScriptPath(scriptPath);
|
|
|
- backupService.backup(app3Bak);
|
|
|
|
|
|
|
+ backupService.backup(app3Bak);*/
|
|
|
|
|
|
|
|
return WebResult.success("ok");
|
|
return WebResult.success("ok");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @GetMapping("/")
|
|
|
|
|
- public String serviceList() {
|
|
|
|
|
- return WebResult.success("ok");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
@PostMapping("/restore/{serviceName}")
|
|
@PostMapping("/restore/{serviceName}")
|
|
|
public String restore(@PathVariable("serviceName") String serviceName) throws Exception {
|
|
public String restore(@PathVariable("serviceName") String serviceName) throws Exception {
|
|
|
return WebResult.success("ok");
|
|
return WebResult.success("ok");
|