xiangpei
2024-05-31 16d10cef208de048f8b325facd143c54b7be9963
src/main/java/com/ycl/jxkg/controller/student/UploadController.java
@@ -2,7 +2,7 @@
import com.ycl.jxkg.base.BaseApiController;
import com.ycl.jxkg.base.RestResponse;
import com.ycl.jxkg.base.Result;
import com.ycl.jxkg.service.FileUpload;
import com.ycl.jxkg.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,7 +33,7 @@
    @RequestMapping("/image")
    @ResponseBody
    public RestResponse questionUploadAndReadExcel(HttpServletRequest request) {
    public Result questionUploadAndReadExcel(HttpServletRequest request) {
        MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest) request;
        MultipartFile multipartFile = multipartHttpServletRequest.getFile("file");
        long attachSize = multipartFile.getSize();
@@ -41,9 +41,9 @@
        try (InputStream inputStream = multipartFile.getInputStream()) {
            String filePath = fileUpload.uploadFile(inputStream, attachSize, imgName);
            userService.changePicture(getCurrentUser(), filePath);
            return RestResponse.ok(filePath);
            return Result.ok(filePath);
        } catch (IOException e) {
            return RestResponse.fail(2, e.getMessage());
            return Result.fail(2, e.getMessage());
        }
    }