| | |
| | | import java.nio.file.StandardCopyOption; |
| | | import java.util.Set; |
| | | import java.util.UUID; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class LocalImageUploadService { |
| | | |
| | | private static final long IMAGE_MAX_SIZE = 10L * 1024 * 1024; |
| | |
| | | } catch (IOException ex) { |
| | | throw new BizException(BizErrorCode.AUTH_FORBIDDEN, "图片上传失败"); |
| | | } |
| | | return buildPictureUrl(fileName); |
| | | String url = buildPictureUrl(fileName); |
| | | log.info("local image uploaded. path={} url={}", target, url); |
| | | return url; |
| | | } |
| | | |
| | | private String buildPictureUrl(String fileName) { |