基于javaweb的SpringBoot博客论坛管理系统(java+springboot+jsp+layui+maven+mysql)(含设计报告)

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

480023172402

490023172402

500023172402

510023172402

520023172402

530023172402

基于javaweb的SpringBoot博客论坛管理系统(java+springboot+jsp+layui+maven+mysql)(含设计报告)

项目介绍

本系统分为管理员、游客两种角色; 管理员角色包含以下功能: 登录,用户增删改查,文章增删改查,链接增删改查,日志查看,查看近期数据,类别管理等功能。 游客角色包含以下功能:

首页,查看文章,注册账号,登录,管理自己写的文章,管理自己的文章,评论文章等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 5.7版本;

技术栈

  1. 后端:SpringBoot

  2. 前端:JSP+CSS+JavaScript+LayUI

使用说明
运行项目,在浏览器中输入http://localhost:8090/ 登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

private Log log;
private Object handler;
private Exception ex;

public SaveLogThread(Log log, Object handler, Exception ex) {
super(SaveLogThread.class.getSimpleName());
this.log = log;
this.handler = handler;
this.ex = ex;
}

@Override
public void run() {
// 获取日志标题
if (StringUtils.isBlank(log.getTitle())) {
String permission = "";
if (handler instanceof HandlerMethod) {
Method m = ((HandlerMethod) handler).getMethod();
RequiresPermissions rp = m.getAnnotation(RequiresPermissions.class);
permission = (rp != null ? StringUtils.join(rp.value(), ",") : "");
}
log.setTitle(getMenuinfoNamePath(log.getRequestUrl(), permission));
}
// 如果有异常,设置异常信息
if (ex == null) {
log.setException("");
} else {
StringWriter stringWriter = new StringWriter();
ex.printStackTrace(new PrintWriter(stringWriter));
log.setException(stringWriter.toString());
}
// 如果无标题并无异常日志,则不保存信息
if (StringUtils.isBlank(log.getTitle()) && StringUtils.isBlank(log.getException())) {
return;
}
// 保存日志信息
log.preInsert();
logDao.insert(log);
}
}

/**
* 获取菜单名称路径(如:系统设置-机构用户-用户管理-编辑)
*/
public static String getMenuinfoNamePath(String requestUrl, String permission) {
String title=(String) CacheUtils.get(CacheNames.MENU_CACHE,requestUrl+permission);
if (title==null){
Menu menu=new Menu();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
   public static String toString(byte[] bytes){
try {
return new String(bytes, CHARSET_NAME);
} catch (UnsupportedEncodingException e) {
return EMPTY;
}
}

/**
* 是否包含字符串
* @param str 验证字符串
* @param strs 字符串组
* @return 包含返回true
*/
public static boolean inString(String str, String... strs){
if (str != null){
for (String s : strs){
if (str.equals(trim(s))){
return true;
}
}
}
return false;
}

/**
* 替换掉HTML标签方法
*/
public static String replaceHtml(String html) {
if (isBlank(html)){
return "";
}
String regEx = "<.+?>";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(html);
String s = m.replaceAll("");
return s;
}

/**
* 替换为手机识别的HTML,去掉样式及属性,保留回车。
* @param html
* @return
*/
public static String replaceMobileHtml(String html){
if (html == null){
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
				
}

return state.toJSONString();

}

public int getStartIndex () {

String start = this.request.getParameter( "start" );

try {
return Integer.parseInt( start );
} catch ( Exception e ) {
return 0;
}

}

/**
* callback参数验证
*/
public boolean validCallbackName ( String name ) {

if ( name.matches( "^[a-zA-Z_]+[\\w0-9_]*$" ) ) {
return true;
}

return false;

}

}
package com.ruixin.controller;

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	public static String replaceMobileHtml(String html){
if (html == null){
return "";
}
return html.replaceAll("<([a-z]+?)\\s+?.*?>", "<$1>");
}

/**
* 替换为手机识别的HTML,去掉样式及属性,保留回车。
* @param txt
* @return
*/
/* public static String toHtml(String txt){
if (txt == null){
return "";
}
return replace(replace(Encodes.escapeHtml(txt), "\n", "<br/>"), "\t", "&nbsp; &nbsp; ");
}*/

/**
* 缩略字符串(不区分中英文字符)
* @param str 目标字符串
* @param length 截取长度
* @return
*/
public static String abbr(String str, int length) {
if (str == null) {
return "";
}
try {
StringBuilder sb = new StringBuilder();
int currentLength = 0;
for (char c : replaceHtml(StringEscapeUtils.unescapeHtml4(str)).toCharArray()) {
currentLength += String.valueOf(c).getBytes("GBK").length;
if (currentLength <= length - 3) {
sb.append(c);
} else {
sb.append("...");
break;
}
}
return sb.toString();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

/**
* 微博登录 第三方
*/
@Controller
public class WeiBoLoginController {

private final static String APP_ID = "882681036";

private final static String APP_KEY = "5f8022f3b0456d240e088601e41d5b31";

private final static String GET_CODE_URL = "https://api.weibo.com/oauth2/authorize";

private final static String loginCallback = "http://www.xulian.net.cn:8088/authLoginCallback";


private final static String reduceCallback = "http://www.xulian.net.cn:8088/authReduceCallback";

/**
* 微博 授权
* @return
*/
@RequestMapping("/weiboLogin")

public String index(){
try {
StringBuffer authUrl = new StringBuffer(GET_CODE_URL);
authUrl.append("?client_id=" + APP_ID);
authUrl.append("&redirect_uri=" + URLEncoder.encode(loginCallback, "utf-8"));
authUrl.append("&response_type=code");
authUrl.append("&state="+"Test");
return ("redirect:" + authUrl);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return "";
}

/**
* 微博 授权
* @return
*/
@RequestMapping("/authLoginCallback")

public String authLoginCallback(HttpServletRequest request){
try {
String state = request.getParameter("state");
String code = request.getParameter("code");
String api = "https://api.weibo.com/oauth2/access_token";
Map<String, String> data = new HashMap<String, String>();
data.put("client_id", APP_ID);
data.put("client_secret", APP_KEY);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
	    

}
package com.ruixin.controller.thirdLogin;




/**
* 第三方qq授权登录
*/
@Controller
public class QQLoginController {


private final static String APP_ID = "101392599";

private final static String APP_KEY = "47af19b47870932e2ba4d1008a705961";

private final static String GET_CODE_URL = "https://graph.qq.com/oauth2.0/authorize";

private final static String loginCallback = "http://www.xulian.net.cn:8088/afterlogin";

static final String[] EMPTY_STRING_ARRAY = new String[0];

@RequestMapping("/qqTest")
public String qqTest(){


项目链接:
https://javayms.github.io?id=051422312105200hn
https://javayms.pages.dev?id=051422312105200hn