|
@@ -1,9 +1,12 @@
|
|
package com.boman.file.controller;
|
|
package com.boman.file.controller;
|
|
|
|
|
|
|
|
+import com.boman.common.core.web.domain.AjaxResult;
|
|
|
|
+import com.boman.file.utils.FileUploadUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import com.boman.common.core.domain.R;
|
|
import com.boman.common.core.domain.R;
|
|
@@ -45,4 +48,22 @@ public class SysFileController
|
|
return R.fail(e.getMessage());
|
|
return R.fail(e.getMessage());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 通用上传请求
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/upload/base64")
|
|
|
|
+ public AjaxResult uploadFileBase64(@RequestBody String base64) {
|
|
|
|
+ try {
|
|
|
|
+ String url = sysFileService.uploadFileBase64(base64);
|
|
|
|
+ AjaxResult ajax = AjaxResult.success();
|
|
|
|
+ ajax.put("fileName", FileUtils.getName(url));
|
|
|
|
+ ajax.put("url", url);
|
|
|
|
+ return ajax;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ return AjaxResult.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|