Merge branch 'master' of https://gitee.com/xiaochen991015/xizang
| | |
| | | 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; |
| | |
| | | //发送邮件 |
| | | Transport.send(message); |
| | | } catch (MessagingException | UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | log.error("发送邮件发生异常",e); |
| | | throw new ServiceException("发送邮件失败,请检查"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | log.error("发送邮件发生异常",e); |
| | | } |
| | | |
| | | } |
| | | |
| | | // public static void main(String[] args) { |
| | | // TencentMailUtil tencentMailUtil = new TencentMailUtil(); |
| | | // MailProperties properties = new MailProperties(); |
| | | // tencentMailUtil.properties = properties; |
| | | // tencentMailUtil.send("214491528@qq.com","大学城揽院24栋"); |
| | | // |
| | | // } |
| | | public static void main(String[] args) { |
| | | TencentMailUtil tencentMailUtil = new TencentMailUtil(); |
| | | MailProperties properties = new MailProperties(); |
| | | tencentMailUtil.properties = properties; |
| | | tencentMailUtil.send("214491528@qq.com","大学城揽院24栋"); |
| | | |
| | | } |
| | | |
| | | |
| | | |