|
@@ -10,7 +10,13 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
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.RequestBody;
|
|
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.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+
|
|
|
|
+import java.io.BufferedReader;
|
|
|
|
+import java.io.InputStream;
|
|
|
|
+import java.io.InputStreamReader;
|
|
|
|
|
|
@Api(value = "后结构化接口", tags = { "后结构化接口" })
|
|
@Api(value = "后结构化接口", tags = { "后结构化接口" })
|
|
@RestController
|
|
@RestController
|
|
@@ -26,4 +32,43 @@ public class StructureController {
|
|
return RespDTO.onSuc(structureFacade.analysis(analysisVO));
|
|
return RespDTO.onSuc(structureFacade.analysis(analysisVO));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "解析")
|
|
|
|
+ @PostMapping("analysisTest")
|
|
|
|
+ public RespDTO<AnalysisDTO> analysisTest(@RequestParam("file") MultipartFile file, String type) {
|
|
|
|
+ AnalysisVO analysisVO = new AnalysisVO();
|
|
|
|
+ analysisVO.setType(type);
|
|
|
|
+ StringBuffer sbf = new StringBuffer();
|
|
|
|
+ InputStream is = null;
|
|
|
|
+ InputStreamReader ir = null;
|
|
|
|
+ BufferedReader br = null;
|
|
|
|
+ try {
|
|
|
|
+ is = file.getInputStream();
|
|
|
|
+ ir = new InputStreamReader(is);
|
|
|
|
+ br = new BufferedReader(ir);
|
|
|
|
+ String line = null;
|
|
|
|
+ while ((line = br.readLine()) != null) {
|
|
|
|
+ sbf.append(line);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if (br != null) {
|
|
|
|
+ br.close();
|
|
|
|
+ }
|
|
|
|
+ if (ir != null) {
|
|
|
|
+ ir.close();
|
|
|
|
+ }
|
|
|
|
+ if (is != null) {
|
|
|
|
+ is.close();
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ analysisVO.setText(sbf.toString());
|
|
|
|
+ return RespDTO.onSuc(structureFacade.analysis(analysisVO));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|