编程语言
首页 > 编程语言> > 【资讯类系统开发经验分享】——SpringBoot+Vue.js汽车资讯论坛系统 汽车资讯分享平台系统 汽车资讯发布平台系统(可视化+在线点播+JavaMail)

【资讯类系统开发经验分享】——SpringBoot+Vue.js汽车资讯论坛系统 汽车资讯分享平台系统 汽车资讯发布平台系统(可视化+在线点播+JavaMail)

作者:互联网

## 讲两句
我也是头一次开发资讯类系统,资讯类系统涉及到很多知识点,比如怎么存放图片视频、并发问题。

## 解决方案
软件开发讲究整体的解决方案,所以我给出如下解决方案:
①图片、视频分布式存储,可以考虑集成阿里云平台的OSS,还可以做点播,同时数据比较安全
②开发框架,可以选择现在比较流行的springboot

## 开发技术
前端:Vue + element UI + axios

后端:Spring Boot + MyBatis Plus + Druid

数据库:MySQL


## 如何开发特色的论坛资讯类系统
①JavaMail找回密码

②阿里云OSS对象存储(视频、图片、在线点播)

③前后端分离springboot+vue.js联合开发

④数据可视化统计图表


## 如何设计数据库

```sql
SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for agree
-- ----------------------------
DROP TABLE IF EXISTS `agree`;
CREATE TABLE `agree` (
`essay_id` bigint(20) unsigned NOT NULL COMMENT '动态id',
`user_id` bigint(20) unsigned NOT NULL COMMENT '点赞用户id',
`create_time` varchar(255) NOT NULL COMMENT '点赞时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for agree_pl
-- ----------------------------
DROP TABLE IF EXISTS `agree_pl`;
CREATE TABLE `agree_pl` (
`comment_id` int(11) NOT NULL COMMENT '评论id',
`user_id` bigint(20) NOT NULL COMMENT '点赞用户id',
`create_time` varchar(255) NOT NULL COMMENT '创建时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- ----------------------------
-- Table structure for attention
-- ----------------------------
DROP TABLE IF EXISTS `attention`;
CREATE TABLE `attention` (
`that_id` bigint(20) unsigned NOT NULL COMMENT '关注id',
`this_id` bigint(20) unsigned NOT NULL COMMENT '用户id',
`create_time` varchar(255) NOT NULL COMMENT '关注时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
```

大家记住设计数据库一定要用navicat设计注释这样比较方便 如下:
![数据库表设计](https://www.icode9.com/i/ll/?i=9c46a87ac6f648e5ba2214fe0c7a5517.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM0Mzc4Nzc2,size_16,color_FFFFFF,t_70)
![数据库表](https://www.icode9.com/i/ll/?i=0f700025aa3347a7b443a45cad37b308.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM0Mzc4Nzc2,size_16,color_FFFFFF,t_70)

## 代码设计

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

实现代码如下:

```java
package com.superb.util;

import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.File;
import java.util.UUID;

/**
* 发送邮件工具类
* @author Superb
* @date 2020/11/12 - 16:45
* @E_mail superb12580@163.com
*/
@Component
public class SendMail {
@Autowired
private JavaMailSender mailSender;

private static final String subject = "来自汽车之家";
private static final String url = "http://localhost:8080/car";
private static final String imgUrl = "C:\\Users\\HP\\Desktop\\汽车之家\\ProjectCode\\SpringBootCar\\src\\main\\resources\\img\\Logo2.png";
private static final String fromUrl = "superb12580@163.com";

/**
* 不带附件
* @param toUrl
* @return
* @throws MessagingException
*/
public String sendMail(String toUrl) throws MessagingException {
MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage,true);
mimeMessageHelper.setSubject(subject);
//生成随机验证码
String code = IdUtil.simpleUUID().substring(0, 6).toUpperCase();

mimeMessageHelper.setText("【汽车之家】欢迎注册<a href=\""+url+"\">汽车之家</a>,您本次的验证码为<b style=\"color:red\">"+code+"</b>,五分钟内有效,感谢使用。",true);
mimeMessageHelper.setTo(toUrl);
mimeMessageHelper.setFrom(fromUrl);
mailSender.send(mimeMessage);
return code;
}

/**
* 带附件
* @param toUrl
* @return
* @throws MessagingException
*/
public String sendMailHelper(String toUrl) throws MessagingException {

MimeMessage mimeMessage = mailSender.createMimeMessage();
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage,true);
mimeMessageHelper.setSubject(subject);

//上传文件
mimeMessageHelper.addAttachment("汽车之家",new File(imgUrl));

//生成随机验证码
String code = UUID.randomUUID().toString().substring(0,6).toUpperCase();
mimeMessageHelper.setText("【汽车之家】欢迎注册<a href=\""+url+"\">汽车之家</a>,您本次的验证码为<b style=\"color:red\">"+code+"</b>,五分钟内有效,感谢使用。",true);
mimeMessageHelper.setTo(toUrl);
mimeMessageHelper.setFrom(fromUrl);


mailSender.send(mimeMessage);

return code;
}
}

```

![SpringBoot+Vue.js汽车资讯论坛系统](https://www.icode9.com/i/ll/?i=83683f716db64191ba4d852e409b2ea2.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM0Mzc4Nzc2,size_16,color_FFFFFF,t_70#pic_center)
![SpringBoot+Vue.js汽车资讯论坛系统](https://www.icode9.com/i/ll/?i=2f68b463747549a395510063b38c9cf4.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM0Mzc4Nzc2,size_16,color_FFFFFF,t_70#pic_center)
![SpringBoot+Vue.js汽车资讯论坛系统](https://www.icode9.com/i/ll/?i=e62367a894dd4103ab3860d4a85af808.png?,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM0Mzc4Nzc2,size_16,color_FFFFFF,t_70#pic_center)
实现代码如下:

```java
package com.superb;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableScheduling
@SpringBootApplication
public class CarApplication {

public static void main(String[] args) {
SpringApplication.run(CarApplication.class, args);
}

}

```

## 总体展望
开发论坛类系统 1要考虑好技术选型——springboot 2处理好图片的容灾备份

 

标签:mimeMessageHelper,COMMENT,NULL,String,系统,汽车资讯,import,分享,id
来源: https://www.cnblogs.com/bysj2022/p/15116705.html