新增合同上传
This commit is contained in:
parent
6541eb6915
commit
719f489325
|
|
@ -33,6 +33,7 @@ public class FileController {
|
|||
|
||||
@Resource
|
||||
FileSourceService fileSourceService;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*/
|
||||
|
|
@ -48,6 +49,18 @@ public class FileController {
|
|||
return AjaxResult.success(fileSourceService.addFile(files, ocrType, sealFlag, formats, fileType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同上传
|
||||
*/
|
||||
@SysLog(value = "合同上传", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/uploadContract")
|
||||
@RequiresPermissions("system:file:ucontract")
|
||||
public AjaxResult uploadContract(@RequestParam(value = "file") MultipartFile file) throws Exception
|
||||
{
|
||||
return AjaxResult.success(fileSourceService.uploadContract(file));
|
||||
}
|
||||
|
||||
|
||||
@SysLog(value = "文件预览", businessType = BusinessType.OTHER)
|
||||
@GetMapping(value="/{fid}/preview")
|
||||
@RequiresPermissions("system:file:preview")
|
||||
|
|
|
|||
|
|
@ -231,4 +231,26 @@ public class FileSourceService
|
|||
save(fileSourceInfo);
|
||||
return upload;
|
||||
}
|
||||
|
||||
|
||||
public String uploadContract(MultipartFile file) throws Exception{
|
||||
String ip = IPUtils.clientIp(ServletUtils.getRequest());
|
||||
String fid = generateFid();
|
||||
String fName = file.getName();
|
||||
long length = file.getSize();
|
||||
String md5 = FileUtils.getMd5(file.getInputStream());
|
||||
// image/jpeg mimeType
|
||||
FileSourceInfo fileSourceInfo = new FileSourceInfo();
|
||||
fileSourceInfo.setUploadIp(ip);
|
||||
fileSourceInfo.setFid(fid);
|
||||
fileSourceInfo.setName(fName);
|
||||
fileSourceInfo.setSize(length);
|
||||
fileSourceInfo.setPath("qcCode/"+fName);
|
||||
fileSourceInfo.setMd5(md5);
|
||||
fileSourceInfo.setMimeType("image/jpeg");
|
||||
String upload = ossService.upload(file.getInputStream(), fileSourceInfo);
|
||||
fileSourceInfo.setRealPath(upload);
|
||||
save(fileSourceInfo);
|
||||
return upload;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue