文件白名单
This commit is contained in:
parent
e62e1172d7
commit
03141f7d69
|
|
@ -42,34 +42,34 @@ public class SysFileController {
|
||||||
private ResourceLoader resourceLoader;
|
private ResourceLoader resourceLoader;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/upload")
|
// @PostMapping("/upload")
|
||||||
@ApiOperation(value = "文件上传")
|
// @ApiOperation(value = "文件上传")
|
||||||
public AjaxResult upload(HttpServletRequest request) {
|
// public AjaxResult upload(HttpServletRequest request) {
|
||||||
String limitWords = request.getParameter("limitWords");
|
// String limitWords = request.getParameter("limitWords");
|
||||||
FileInfo file = new FileInfo();
|
// FileInfo file = new FileInfo();
|
||||||
try {
|
// try {
|
||||||
file = service.uploadFile(request);
|
// file = service.uploadFile(request);
|
||||||
// String suffix = file.getFileName().substring(file.getFileName().lastIndexOf(".") + 1);
|
// // String suffix = file.getFileName().substring(file.getFileName().lastIndexOf(".") + 1);
|
||||||
|
//
|
||||||
/* if (! ATTACHMENT_FILE_SUFFIX.contains(suffix) || ! COST_FILE_SUFFIX.contains(suffix)) {
|
// /* if (! ATTACHMENT_FILE_SUFFIX.contains(suffix) || ! COST_FILE_SUFFIX.contains(suffix)) {
|
||||||
return AjaxResult.error(ErrorCode.COMMISSION_BILL_ATTACHMENT_NOT_SUPPORT.getCode(),
|
// return AjaxResult.error(ErrorCode.COMMISSION_BILL_ATTACHMENT_NOT_SUPPORT.getCode(),
|
||||||
ErrorCode.COMMISSION_BILL_ATTACHMENT_NOT_SUPPORT.getMessage());
|
// ErrorCode.COMMISSION_BILL_ATTACHMENT_NOT_SUPPORT.getMessage());
|
||||||
}*/
|
// }*/
|
||||||
if (limitWords != null && file.getWords() > Integer.parseInt(limitWords)){
|
// if (limitWords != null && file.getWords() > Integer.parseInt(limitWords)){
|
||||||
return AjaxResult.error(ErrorCode.ATTACHMENT_UPLOAD_FAILED.getCode(),
|
// return AjaxResult.error(ErrorCode.ATTACHMENT_UPLOAD_FAILED.getCode(),
|
||||||
ErrorCode.ATTACHMENT_UPLOAD_FAILED.getMessage());
|
// ErrorCode.ATTACHMENT_UPLOAD_FAILED.getMessage());
|
||||||
}
|
// }
|
||||||
}catch (Exception e){
|
// }catch (Exception e){
|
||||||
log.error(e.getMessage());
|
// log.error(e.getMessage());
|
||||||
}
|
// }
|
||||||
if (file != null && file.getId() != 0){
|
// if (file != null && file.getId() != 0){
|
||||||
return AjaxResult.success(file);
|
// return AjaxResult.success(file);
|
||||||
}else {
|
// }else {
|
||||||
return AjaxResult.error(ErrorCode.FAILURE_TO_UPLOAD_FILE.getCode(),
|
// return AjaxResult.error(ErrorCode.FAILURE_TO_UPLOAD_FILE.getCode(),
|
||||||
ErrorCode.FAILURE_TO_UPLOAD_FILE.getMessage());
|
// ErrorCode.FAILURE_TO_UPLOAD_FILE.getMessage());
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
@ApiOperation(value = "模板", httpMethod = "GET")
|
@ApiOperation(value = "模板", httpMethod = "GET")
|
||||||
@GetMapping("download")
|
@GetMapping("download")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue