Commit 71395dd1 authored by 竹天卫's avatar 竹天卫

检测报告需要转pdf 其他上传暂时不用转成pdf

parent 410bc852
...@@ -79,6 +79,47 @@ public class EntityEnclosureController { ...@@ -79,6 +79,47 @@ public class EntityEnclosureController {
@ApiOperation(value = "单个文件上传") @ApiOperation(value = "单个文件上传")
@PostMapping("/fileUpLoad") @PostMapping("/fileUpLoad")
public BaseResponse fileUpLoad(MultipartFile file) { public BaseResponse fileUpLoad(MultipartFile file) {
Map<String, Object> map = new HashMap<>();
String filePath = null;
String fileName = null;
String extName = null;
try {
boolean ref = checkFileSize( file.getSize(),30,"M");
if(!ref){
return BaseResponse.errorMsg("文件不能大于30M");
}
LoginUser loginUser = userService.getLoginUser();
if (loginUser != null) {
filePath = FastDFSUtils.uploadPic(file.getBytes(), file.getOriginalFilename(), file.getSize());
fileName = file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf("."));
extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
} else {
return BaseResponse.noLogin("登录信息失效");
}
/* if (extName.contains(FileExt.EXCL.getName()) || extName.contains(FileExt.EXCLX.getName())) {
String pdfPath = FastDFSUtils.conventAndUploadExcel(file.getInputStream(), fileName);
map.put("pdfPath", pdfPath);
} else if (extName.contains(FileExt.DOC.getName()) || extName.contains(FileExt.DOCX.getName())) {
String pdfPath = FastDFSUtils.conventAndUploadWord(file.getInputStream(), fileName);
map.put("pdfPath", pdfPath);
} else {
map.put("pdfPath", filePath);
}*/
String picUrl = filePath;
map.put("fileUrl", picUrl);
map.put("fileName", fileName);
map.put("extName", extName);
return BaseResponse.okData(map);
} catch (Exception e) {
logger.error(e.toString());
}
return BaseResponse.errorMsg("失败");
}
@ApiOperation(value = "检测报告上传")
@PostMapping("/reportUpLoad")
public BaseResponse reportUpLoad(MultipartFile file) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
String filePath = null; String filePath = null;
String fileName = null; String fileName = null;
...@@ -117,6 +158,7 @@ public class EntityEnclosureController { ...@@ -117,6 +158,7 @@ public class EntityEnclosureController {
return BaseResponse.errorMsg("失败"); return BaseResponse.errorMsg("失败");
} }
@ApiOperation(value = "单个图片上传") @ApiOperation(value = "单个图片上传")
@PostMapping("/imgUpLoad") @PostMapping("/imgUpLoad")
public BaseResponse imgUpLoad(MultipartFile file) { public BaseResponse imgUpLoad(MultipartFile file) {
......
...@@ -204,7 +204,7 @@ public class FastDFSUtils { ...@@ -204,7 +204,7 @@ public class FastDFSUtils {
public static String conventAndUploadExcel(InputStream inputStream, String filename) { public static String conventAndUploadExcel(InputStream inputStream, String filename) {
// 验证License // 验证License
getLicense(); //getLicense();
File outputFile = new File(filename + ".pdf"); File outputFile = new File(filename + ".pdf");
String filePath = ""; String filePath = "";
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment