fix:材料校验提交

dev
wangxy 12 months ago
parent 58567b69e0
commit 7291e1bf54

@ -12,6 +12,7 @@ import com.hyp.web.controller.manager.FileRelationManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -51,7 +52,7 @@ public class FileRelationController extends BaseController {
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file,
@RequestParam String applyId,
@RequestParam String filename,
@RequestParam(required = false) String filename,
@RequestParam String fileCode) {
try {
// 上传文件路径
@ -59,6 +60,9 @@ public class FileRelationController extends BaseController {
// 上传并返回新文件名称
String fileNames = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileNames;
if(StringUtils.isBlank(filename)){
filename = fileNames;
}
String originalFilename = FileUtils.getNameNotSuffix(file.getOriginalFilename()) ;
return AjaxResult.success(fileRelationManager.save(applyId,filename,fileCode,url,originalFilename));
} catch (Exception e) {

Loading…
Cancel
Save