|
@@ -49,9 +49,11 @@ public class FaultController {
|
|
|
public Result<Object> importFile(HttpServletRequest request, @RequestParam("file") MultipartFile file){
|
|
|
Date date = new Date();
|
|
|
String sourcePath1;
|
|
|
-
|
|
|
sourcePath1 = "d:\\sourcefm";
|
|
|
- String filePath = FileTool.fileUp(file, sourcePath1, date.getTime() + file.getOriginalFilename());
|
|
|
+ String extName = ""; // 扩展名格式:
|
|
|
+ extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
|
|
+ String filePath = FileTool.fileUp(file, sourcePath1, new Date().getTime() + extName);
|
|
|
+// String filePath = FileTool.fileUp(file, sourcePath1, date.getTime() + file.getOriginalFilename());
|
|
|
|
|
|
FileTypeUtil.Type fileType = FileTypeUtil.getFileType(file.getOriginalFilename());
|
|
|
if (fileType == FileTypeUtil.Type.DOC || fileType == FileTypeUtil.Type.DOCX || fileType == FileTypeUtil.Type.RTF ) {
|
|
@@ -60,26 +62,26 @@ public class FaultController {
|
|
|
if (fileType == FileTypeUtil.Type.PPT || fileType == FileTypeUtil.Type.PPTX) {
|
|
|
Ppt2ToPdf.convertPpt2Pdf(filePath, sourcePath1);
|
|
|
}
|
|
|
- if (fileType == FileTypeUtil.Type.DOC) {
|
|
|
- deleteDir(new File(filePath));
|
|
|
- filePath = filePath.replaceAll( "doc","pdf");
|
|
|
- }
|
|
|
- if (fileType == FileTypeUtil.Type.DOCX) {
|
|
|
- deleteDir(new File(filePath));
|
|
|
- filePath = filePath.replaceAll( "docx","pdf");
|
|
|
- }
|
|
|
- if (fileType == FileTypeUtil.Type.RTF) {
|
|
|
- deleteDir(new File(filePath));
|
|
|
- filePath = filePath.replaceAll( "rtf","pdf");
|
|
|
- }
|
|
|
- if (fileType == FileTypeUtil.Type.PPT) {
|
|
|
- deleteDir(new File(filePath));
|
|
|
- filePath = filePath.replaceAll( "ppt","pdf");
|
|
|
- }
|
|
|
- if (fileType == FileTypeUtil.Type.PPTX) {
|
|
|
- deleteDir(new File(filePath));
|
|
|
- filePath = filePath.replaceAll( "pptx","pdf");
|
|
|
- }
|
|
|
+// if (fileType == FileTypeUtil.Type.DOC) {
|
|
|
+//// deleteDir(new File(filePath));
|
|
|
+// filePath = filePath.replaceAll( "doc","pdf");
|
|
|
+// }
|
|
|
+// if (fileType == FileTypeUtil.Type.DOCX) {
|
|
|
+//// deleteDir(new File(filePath));
|
|
|
+// filePath = filePath.replaceAll( "docx","pdf");
|
|
|
+// }
|
|
|
+// if (fileType == FileTypeUtil.Type.RTF) {
|
|
|
+//// deleteDir(new File(filePath));
|
|
|
+// filePath = filePath.replaceAll( "rtf","pdf");
|
|
|
+// }
|
|
|
+// if (fileType == FileTypeUtil.Type.PPT) {
|
|
|
+//// deleteDir(new File(filePath));
|
|
|
+// filePath = filePath.replaceAll( "ppt","pdf");
|
|
|
+// }
|
|
|
+// if (fileType == FileTypeUtil.Type.PPTX) {
|
|
|
+//// deleteDir(new File(filePath));
|
|
|
+// filePath = filePath.replaceAll( "pptx","pdf");
|
|
|
+// }
|
|
|
filePath = filePath.replaceAll( "d:","");
|
|
|
return Result.success(filePath);
|
|
|
}
|
|
@@ -90,6 +92,15 @@ public class FaultController {
|
|
|
file.delete();
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("浏览资料")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 0, message = "成功")
|
|
|
+ })
|
|
|
+ @GetMapping("browse")
|
|
|
+ public Result<String> browse(@RequestParam String filepath){
|
|
|
+ return faultService.browse(filepath);
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation("列出所有")
|
|
|
@ApiResponses({
|
|
|
@ApiResponse(code = 0, message = "成功")
|