change: 修改API接口名称.
This commit is contained in:
parent
c55cbfcf80
commit
5d48d09be1
4
pom.xml
4
pom.xml
|
@ -11,8 +11,8 @@
|
||||||
<groupId>com.yame</groupId>
|
<groupId>com.yame</groupId>
|
||||||
<artifactId>uml</artifactId>
|
<artifactId>uml</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>demo</name>
|
<name>umlserver</name>
|
||||||
<description>Demo project for Spring Boot</description>
|
<description>Demo umlserver project for Spring Boot</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.yame.uml;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.context.annotation.ComponentScans;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
|
@ -1,39 +1,23 @@
|
||||||
package com.yame.uml.control;
|
package com.yame.uml.control;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import com.yame.uml.model.Result;
|
import com.yame.uml.model.Result;
|
||||||
import com.yame.uml.model.ResultType;
|
import com.yame.uml.model.ResultType;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.BlockUml;
|
|
||||||
import net.sourceforge.plantuml.FileFormat;
|
|
||||||
import net.sourceforge.plantuml.FileFormatOption;
|
|
||||||
import net.sourceforge.plantuml.LineLocation;
|
|
||||||
import net.sourceforge.plantuml.SourceStringReader;
|
|
||||||
import net.sourceforge.plantuml.api.PlantumlUtils;
|
|
||||||
import net.sourceforge.plantuml.code.Transcoder;
|
|
||||||
import net.sourceforge.plantuml.code.TranscoderUtil;
|
|
||||||
import net.sourceforge.plantuml.core.*;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestHeader;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.BlockUml;
|
||||||
|
import net.sourceforge.plantuml.FileFormat;
|
||||||
|
import net.sourceforge.plantuml.FileFormatOption;
|
||||||
|
import net.sourceforge.plantuml.SourceStringReader;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api")
|
@RequestMapping("/api")
|
||||||
public class api {
|
public class api {
|
||||||
|
@ -57,7 +41,28 @@ public class api {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/v1/megreflow")
|
@PostMapping("/v1/megreflow")
|
||||||
public Result megreSVG(@RequestParam("data") String data) throws IOException {
|
public Result megreSVG(@RequestParam("src") String src, @RequestParam("dst") String dst) throws IOException {
|
||||||
|
String source = getUmlSource(src);
|
||||||
|
List<BlockUml> srcblocks = new SourceStringReader(source).getBlocks();
|
||||||
|
|
||||||
|
String destination = getUmlSource(dst);
|
||||||
|
List<BlockUml> dstblocks = new SourceStringReader(destination).getBlocks();
|
||||||
|
|
||||||
|
Result result = new Result();
|
||||||
|
|
||||||
|
if(srcblocks.size() != 0 && dstblocks.size() != 0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
result.setType(ResultType.ErrorMegreUML2SVG);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/v1/uml2svg")
|
||||||
|
public Result uml2SVG(@RequestParam("data") String data) throws IOException {
|
||||||
String source = getUmlSource(data);
|
String source = getUmlSource(data);
|
||||||
List<BlockUml> blocks = new SourceStringReader(source).getBlocks();
|
List<BlockUml> blocks = new SourceStringReader(source).getBlocks();
|
||||||
// FileOutputStream os = new FileOutputStream(new File("./t.svg"));
|
// FileOutputStream os = new FileOutputStream(new File("./t.svg"));
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.yame.uml.model;
|
package com.yame.uml.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -13,7 +11,6 @@ public class Result {
|
||||||
public ResultType type;
|
public ResultType type;
|
||||||
public List<String> content;
|
public List<String> content;
|
||||||
|
|
||||||
|
|
||||||
public Result() {
|
public Result() {
|
||||||
content = new ArrayList<String>();
|
content = new ArrayList<String>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,13 @@ public enum ResultType {
|
||||||
Success("Success", 1),
|
Success("Success", 1),
|
||||||
Source2PNG("Source2PNG", 101),
|
Source2PNG("Source2PNG", 101),
|
||||||
Source2SVG("Source2SVG", 102),
|
Source2SVG("Source2SVG", 102),
|
||||||
|
|
||||||
|
MegreUML2SVG("megreUML2SVG", 202),
|
||||||
|
|
||||||
Error("Error", 0),
|
Error("Error", 0),
|
||||||
ErrorSource2PNG("Error Source2PNG: source format is erorr", -101),
|
ErrorSource2PNG("Error Source2PNG: source format is erorr", -101),
|
||||||
ErrorSource2SVG("Error Source2SVG: source format is erorr", -102),
|
ErrorSource2SVG("Error Source2SVG: source format is erorr", -102),
|
||||||
|
ErrorMegreUML2SVG("Error MegreUML2SVG: source format is erorr or not support format", -202),
|
||||||
;
|
;
|
||||||
|
|
||||||
private String status;
|
private String status;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user