From 21af5de4dcab413fd9e13b66263b5e43dc868e7a Mon Sep 17 00:00:00 2001 From: zhangmei <645025773@qq.com> Date: 星期一, 10 三月 2025 13:59:18 +0800 Subject: [PATCH] Merge branch 'xizang-changyun' of https://gitee.com/xiaochen991015/xizang into xizang-changyun --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java | 8 ++++++++ ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java | 4 ++++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java index 3834733..3133f3a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java @@ -138,6 +138,14 @@ objectMetadata.setContentType(fileType); //上传文件 PutObjectResult putResult = cosClient.putObject(cosConfig.getBucketName(), filePath, inputStream, objectMetadata); + TFile tFile = new TFile(); + tFile.setFileName(filePath); + tFile.setRealName(originalFilename); + tFile.setFileType(fileType); + tFile.setUrl(cosConfig.getRootSrc()+filePath); + tFile.setContentType(file.getContentType()); + tFile.setFileSize(file.getSize()); + sysFileService.save(tFile); // 创建文件的网络访问路径 String url = cosConfig.getRootSrc() + filePath; return url; diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java index e418db1..59147d2 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java @@ -96,8 +96,12 @@ //发送邮件 Transport.send(message); } catch (MessagingException | UnsupportedEncodingException e) { + e.printStackTrace(); log.error("发送邮件发生异常",e); throw new ServiceException("发送邮件失败,请检查"); + }catch (Exception e){ + e.printStackTrace(); + log.error("发送邮件发生异常",e); } } -- Gitblit v1.7.1