毕业设计之 --- 基于Java web的动漫论坛设计与实现


0 前言

今天向大家展示学长帮助同学完成的一个毕业设计:基于Java web的动漫论坛设计与实现。


1 课题背景

动漫产业作为文化产业的一部分,对我国青少年有着深远的影响。作为拥有完整产业链的动漫强国日本,仅动画与漫画占GDP的0.4%,其衍生了电视、电影、音像出版、传统出版、游戏软件开发、游戏机硬件制造、服装、小商品、餐饮等等行业。现如今,我国动漫产业发展迅速,由《秦时明月》《镇魂街》等优质动画为首掀起了国漫热潮,2015的《大圣归来》、2016的《大鱼海棠》收益颇丰。十二五的时候,国家明确扶持和壮大国有动漫企业,使其在产业发展和市场繁荣中发挥主导作用。同时支持各类动漫企业健康发展。 动漫论坛作为动漫爱好者最早开始交流的平台之一,由于该产业的独特性,线上交流是爱好者们进行交互的主要方式。现在国内外著名的ACG论坛,如天使动漫论坛、精灵动漫论坛等注册人数均已过万。

在这里插入图片描述

2 实现功能

2.1 系统流程

在这里插入图片描述

2.2 功能模块

2.2.1 会员模块

  • 1、会员注册
    访问到论坛主页时,所有用户都默认为游客,只能执行浏览、搜索帖子的功能,希望进行下一步操作需要进行会员登陆。
    如果用户为非会员用户,通过注册,经审核通过之后成为会员,获得一个登陆身份;登陆之后可以进行发帖,评论等功能。
  • 2、会员登录
    如果用户为会员,可以直接登陆。登陆之后才能进行发帖、评论等功能。
  • 3、浏览帖子
    访问到论坛时,页面会显示版块、分区和发表的帖子,用户可以直接浏览帖子的内容,也可以选择感兴趣的版块或者分区,从里面浏览该分区内的帖子的内容。该模块没有权限设置,无论是会员还是管理员都可以进行操作。
  • 4、发表帖子
    用户登陆后可以发表一些帖子来与他人共享最新资讯。
  • 5、回复帖子
    用户登陆后可以在自己或别人发表的帖子下发表评论或者回复,发表自己的想法。

2.2.2 管理员模块

管理员模块

  • 1、 管理员登录
    对于已经登录的用户,若权限为管理员,可以进行管理员的登录,登陆之后才能有权限进行下一步操作。
  • 2、帖子管理
    管理员可以对发表的帖子进行查询、删除等操作。
  • 3、分区管理
    论坛中的分区,管理员可对其进行添加、修改、删除等操作。
  • 4、版块管理(子版块管理)
    论坛中的分区下有不同的版块,可以对指定分区下的版块进行添加、修改、删除等操作。
    子版块位于版块之内,可以对指定版块进行添加子版块,编辑和删除子版块的操作。
  • 5、用户管理
    用户注册成功后,管理员可以对用户进行删除操作。

3 运行效果

在这里插入图片描述

在这里插入图片描述

留言在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

4 部分实现代码

package com.action;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Session;

import com.dao.TForumsDAO;
import com.dao.TThreadsDAO;
import com.dao.TTopicDAO;
import com.model.TForums;
import com.model.TThreads;
import com.model.TTopic;
import com.model.TUser;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class threadAction extends ActionSupport{
    
    
	private TForumsDAO forumsDAO;
	private TTopicDAO topicDAO;
	private TThreadsDAO threadsDAO;
	
	private int pid;
	private int fid;
	private String subject;
	private String content;
	
	private String message;
	private String path;
	public String toAddThread(){
    
    
		TForums forums = forumsDAO.findById(fid);
		
		Map request=(Map)ServletActionContext.getContext().get("request");
		request.put("forums", forums);
		return ActionSupport.SUCCESS;
	}
	
	public String threadAdd()
	{
    
    
		Map session= ActionContext.getContext().getSession();
		TUser user = (TUser)session.get("user");
		
		Date date = new Date();
		
		TTopic topic = new TTopic();
		topic.setFid(fid);
		topic.setAuthor(user.getUserName());
		topic.setAuthorid(user.getId());
		topic.setSubject(subject);
		topic.setView(0);
		topic.setReplies(0);
		topic.setAddtime(date);
		topicDAO.save(topic);
		
		int pid = topic.getPid();
		TThreads threads = new TThreads();
		threads.setPid(pid);
		threads.setFid(fid);
		threads.setFtype(0);
		threads.setAuthor(user.getUserName());
		threads.setAuthorid(user.getId());
		threads.setSubject(subject);
		threads.setContent(content);
		threads.setAddtime(date);		
		threadsDAO.save(threads);
		
		this.setMessage("主题发布成功");
		this.setPath("threadview.action?pid="+pid);
		return "succeed";
	}
	
	public String threadview()
	{
    
    
		String sql="update TTopic set view=view+1 where pid="+pid;
		topicDAO.getHibernateTemplate().bulkUpdate(sql);
		
		TTopic topic = topicDAO.findById(pid);
		
		TForums forums = forumsDAO.findById(topic.getFid());
		
		Session session = threadsDAO.getSessionFactory().openSession();
		String getMain = "select tid,author,subject,content,addtime from t_threads where pid="+pid+" order by addtime limit 1";
		Object[] objThreadsMain = (Object[])session.createSQLQuery(getMain).list().get(0); 
		
		TThreads threadsMain = new TThreads();
		threadsMain.setTid((Integer)objThreadsMain[0]);
		threadsMain.setAuthor((String)objThreadsMain[1]);
		threadsMain.setSubject((String)objThreadsMain[2]);
		threadsMain.setContent((String)objThreadsMain[3]);
		threadsMain.setAddtime((Date)objThreadsMain[4]);
		
		List threads = threadsDAO.getHibernateTemplate().find("from TThreads where pid="+pid+" and ftype=1 order by addtime");
		
		Map request=(Map)ServletActionContext.getContext().get("request");
		
		request.put("topic", topic);
		request.put("forums", forums);
		request.put("threadsMain", threadsMain);
		request.put("threadsList", threads);
		
		session.close();
		return SUCCESS;
	}
	
	public String replace()
	{
    
    
		Map session= ActionContext.getContext().getSession();
		TUser user = (TUser)session.get("user");
		
		String sql="update TTopic set replies=replies+1 where pid="+pid;
		topicDAO.getHibernateTemplate().bulkUpdate(sql);
		
		TThreads threads = new TThreads();
		threads.setPid(pid);
		threads.setFid(fid);
		threads.setFtype(1);
		threads.setAuthor(user.getUserName());
		threads.setAuthorid(user.getId());
		threads.setSubject(subject);
		threads.setContent(content);
		threads.setAddtime(new Date());		
		threadsDAO.save(threads);
		
		this.setMessage("主题回复成功");
		this.setPath("threadview.action?pid="+pid);
		return "succeed";
	}
	
	public TTopicDAO getTopicDAO() {
    
    
		return topicDAO;
	}
	public void setTopicDAO(TTopicDAO topicDAO) {
    
    
		this.topicDAO = topicDAO;
	}
	public TThreadsDAO getThreadsDAO() {
    
    
		return threadsDAO;
	}
	public void setThreadsDAO(TThreadsDAO threadsDAO) {
    
    
		this.threadsDAO = threadsDAO;
	}

	public TForumsDAO getForumsDAO() {
    
    
		return forumsDAO;
	}

	public void setForumsDAO(TForumsDAO forumsDAO) {
    
    
		this.forumsDAO = forumsDAO;
	}

	public int getPid() {
    
    
		return pid;
	}

	public void setPid(int pid) {
    
    
		this.pid = pid;
	}

	public int getFid() {
    
    
		return fid;
	}

	public void setFid(int fid) {
    
    
		this.fid = fid;
	}

	public String getSubject() {
    
    
		return subject;
	}

	public void setSubject(String subject) {
    
    
		this.subject = subject;
	}

	public String getContent() {
    
    
		return content;
	}

	public void setContent(String content) {
    
    
		this.content = content;
	}

	public String getMessage() {
    
    
		return message;
	}

	public void setMessage(String message) {
    
    
		this.message = message;
	}

	public String getPath() {
    
    
		return path;
	}

	public void setPath(String path) {
    
    
		this.path = path;
	}
}

最后

学长亲自接毕业设计,有需要的同同学:
(q扣)
746876041
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/HUXINY/article/details/113099037