提交文件校验
This commit is contained in:
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.FileUtil;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.process.pojo.param.SupvAlarmParam;
|
||||
import com.njcn.process.pojo.param.SupvFileParam;
|
||||
@@ -31,7 +32,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
@@ -47,40 +48,45 @@ public class SupvFileController extends BaseController {
|
||||
|
||||
|
||||
@PostMapping("planUpload")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPLOAD)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPLOAD)
|
||||
@ApiOperation("监督计划问题附件上传")
|
||||
public HttpResult<Object> planUpload(@ApiParam(value = "文件", required = true) @RequestPart("files") MultipartFile file,
|
||||
@RequestParam("planId") String planId,
|
||||
@RequestParam("type") Integer type,
|
||||
@RequestParam("uploaderId") String uploaderId,
|
||||
@RequestParam("uploaderName") String uploaderName,
|
||||
@RequestParam("attachmentType")String attachmentType,
|
||||
@RequestParam("uploadTime")String uploadTime
|
||||
){
|
||||
@RequestParam("attachmentType") String attachmentType,
|
||||
@RequestParam("uploadTime") String uploadTime
|
||||
) {
|
||||
String methodDescribe = getMethodDescribe("planUpload");
|
||||
if(!StrUtil.isAllNotBlank(planId,uploaderId,uploaderName,attachmentType,uploadTime)||type==null){
|
||||
throw new BusinessException("必填字段不能为空");
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
if (FileUtil.judgeFileIsWord(originalFilename) && FileUtil.judgeFileIsPdf(originalFilename) && FileUtil.judgeFileIsExcel(originalFilename)) {
|
||||
if (!StrUtil.isAllNotBlank(planId, uploaderId, uploaderName, attachmentType, uploadTime) || type == null) {
|
||||
throw new BusinessException("必填字段不能为空");
|
||||
}
|
||||
iSupvFileService.planUpload(file, planId, type, uploaderId, uploaderName, attachmentType, uploadTime);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
iSupvFileService.planUpload(file,planId,type,uploaderId,uploaderName,attachmentType,uploadTime);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FILE_NAME_ERROR, null, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("list")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("查询附件信息集合")
|
||||
@ApiImplicitParam(name = "param",value = "请求体",required = true)
|
||||
public HttpResult<List<SupvFile>> pageAlarm(@RequestBody SupvFileParam param){
|
||||
@ApiImplicitParam(name = "param", value = "请求体", required = true)
|
||||
public HttpResult<List<SupvFile>> pageAlarm(@RequestBody SupvFileParam param) {
|
||||
String methodDescribe = getMethodDescribe("pageAlarm");
|
||||
List<SupvFile> supvFiles = iSupvFileService.listFile(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, supvFiles, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("detail")
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DOWNLOAD)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@ApiOperation("监督计划问题附件下载")
|
||||
public HttpResult<Object> detail(HttpServletResponse response, @RequestParam("busId") String busId, @RequestParam("type") Integer type,@RequestParam("attachmentType") String attachmentType){
|
||||
public HttpResult<Object> detail(HttpServletResponse response, @RequestParam("busId") String busId, @RequestParam("type") Integer type, @RequestParam("attachmentType") String attachmentType) {
|
||||
String methodDescribe = getMethodDescribe("detail");
|
||||
iSupvFileService.detail(response,busId,type,attachmentType);
|
||||
iSupvFileService.detail(response, busId, type, attachmentType);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user