Commit 3a5cbb0437f7665d16f6602aa0807bb3394b3170
1 parent
9d11e9bc
add让:添加日志
Showing
1 changed file
with
5 additions
and
1 deletions
src/main/java/com/order/erp/service/impl/LocalStorageServiceImpl.java
... | ... | @@ -80,19 +80,23 @@ public class LocalStorageServiceImpl extends ServiceImpl<LocalStorageMapper, Loc |
80 | 80 | try { |
81 | 81 | File tempFile = new File(path + "images" + File.separator + tempFileName); |
82 | 82 | if (AliOssUtil.upload(AliOssConfig.ALIYUN_BUCKET, fileName, file.getBytes())) { |
83 | + log.info("--------uploadByAliOss success----------"); | |
83 | 84 | String originImageUrl = AliOssUtil.createUrl(AliOssConfig.ALIYUN_BUCKET, fileName, new DateTime().plusYears(Constant.ENABLE_TEN).toDate()); |
84 | 85 | imageRespVO.setPicUrl(originImageUrl); |
85 | 86 | // 生成缩略图 |
86 | 87 | Thumbnails.of(file.getInputStream()).size(100, 100).toFile(tempFile); |
87 | 88 | if (AliOssUtil.upload(AliOssConfig.ALIYUN_BUCKET, tempFileName, FileUtil.readBytes(tempFile))) { |
89 | + log.info("--------uploadByAliOss 缩略图 success----------"); | |
88 | 90 | String thumbnailImageUrl = AliOssUtil.createUrl(AliOssConfig.ALIYUN_BUCKET, tempFileName, new DateTime().plusYears(Constant.ENABLE_TEN).toDate()); |
89 | 91 | imageRespVO.setSmallPicUrl(thumbnailImageUrl); |
90 | 92 | } |
93 | + log.info("--------uploadByAliOss end ----------"); | |
91 | 94 | FileUtil.del(tempFile); |
95 | + log.info("--------uploadByAliOss del success ----------"); | |
92 | 96 | } |
93 | 97 | return ServerResult.success(imageRespVO); |
94 | 98 | } catch (Exception e) { |
95 | - log.error("上传图片异常:{}", e.getMessage()); | |
99 | + log.error("上传图片异常:{}", e.getMessage()); | |
96 | 100 | throw new BusinessException(ServerResultCode.UPLOAD_IMAGES_ERROR); |
97 | 101 | } |
98 | 102 | } | ... | ... |