基于ssm影视论坛系统源码和论文

摘要

随着现代信息技术的发展,人们的业余生活越来越丰富。越来越多的在线视

频网站的兴起,使得人们不再局限于在电视机上观看影视作品,而是可以随时随

地地在线观看自己喜欢的作品。这些在线视频网站给观众提供了一种交互式的观

影体验,观影者可以在观看视频的同时发表和交流自己的感受。在这些影视评论

当中隐含着许多有价值的情感信息,如何有效地挖掘和分析这些情感信息有着重

要的研究意义。其不仅能够为观影者提供信息参考,同时也可以为网站经营者和

影视行业从业者提供决策帮助,从而制作出更加符合大众品味的作品。

对于刚进入互联网世界的网络小白来说,论坛就是一个所有人畅所欲言,围绕着一个问题进行分享、探究、解决的一个平台,发表一个主题,大家一块来解决,可以上传资源供大家一起分享等。我们设计和开发的关键是运用Java编程语言,延续SSM(Spring+SpringMVC+MyBatis)框架,在多模式下选择B/S(Browser/Server)模式,以MySQL为数据库[3]为基础来小型影视论坛管理系统。

关键词:Java编程;SSM框架;B\S模式;MySQL数据库;影视论坛

Abstract

With the development of modern information technology, people's spare time life is becoming richer and richer. More and more online videoWith the rise of frequency websites, people are no longer limited to watching film and television works on TV, but can follow at any timeWatch your favorite works online. These online video websites provide viewers with an interactive viewMovie experience, viewers can express and exchange their feelings while watching the video. In these film and television Reviews。

There are many valuable emotional information hidden in it. How to effectively mine and analyze these emotional information is of great significanceThe significance of research should be. It can not only provide information reference for viewers, but also for website operators and usersFilm and television industry practitioners provide decision-making help, so as to produce works more in line with public taste.

Key words: Java programming; SSM framework; B/S mode; MySQL database; Forum management

package com.module.controller.pc;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.module.controller.base.BaseController;
import com.module.mapper.*;
import com.module.pojo.*;
import com.module.util.ResultUtil;
import com.module.util.TreeList;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 前端控制器
 */
@Controller
public class FrontController extends BaseController {

    @Autowired
    InformMapper informMapper;
    @Autowired
    UserinfoMapper userinfoMapper;
    @Autowired
    WenjuanMapper wenjuanMapper;
    @Autowired
    WenjuanjieguoMapper wenjuanjieguoMapper;
    @Autowired
    SorttypeMapper sorttypeMapper;
    @Autowired
    ArticleMapper articleMapper;
    @Autowired
    LinkurlMapper linkurlMapper;
    @Autowired
    LiuyanMapper liuyanMapper;
    @Autowired
    FastLiuyanMapper fastLiuyanMapper;
    /**
     * 评论显示页面
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/liuyan")
    public String liuyan(Model model) {
        Page<Object> pageInfo = PageHelper.startPage(1, 100, true);
        pageInfo.setOrderBy(" id desc ");
        List<Liuyan> liuyanList = liuyanMapper.selectAll(null);
        TreeList tree = new TreeList(liuyanList);
        List<Liuyan> listTree = tree.buildTree();
        model.addAttribute("liuyanList", listTree);
        return "pc/liuyan";
    }

    /**
     * 评论提交页面
     *
     * @param liuyan
     * @return
     */
    @RequestMapping("pc/liuyanSubmit")
    public String liuyanSubmit(Liuyan liuyan) {
        liuyan.setCreatetime(new Date());
        liuyanMapper.insertLiuyan(liuyan);
        if (null == liuyan.getIntro()) {
            return "redirect:liuyan";
        } else {
            return "redirect:articleDetail?id=" + liuyan.getIntro();
        }
    }

    /**
     * 跳转到问卷管理页面
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/wenjuan")
    public String wenjuan(Model model) {
        List<Wenjuan> wenjuanList = wenjuanMapper.selectAll(null);
        model.addAttribute("wenjuanList", wenjuanList);
        return "pc/wenjuan";
    }


    /**
     * 关于我们
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/about")
    public String about(Model model) {
        return "pc/about";
    }


    @RequestMapping("pc/")
    public String index(Model model) {
        return "pc/index";
    }



    @RequestMapping("/")
    public String index1(Model model) {
        return "pc/index";
    }






    @RequestMapping("pc/articleList")
    public String indexType(Model model, Integer p, Integer limit, String keyword, String name, String orderStr, String type, HttpSession session) {
        limit = 6;
        if (null == p) { //默认第一页
            p = 1;
        }
        if (null == limit) { //默认每页10条
            limit = 9;
        }
        Map map = new HashMap();
        if (StringUtils.isNotEmpty(type)) {
            map.put("type", type);
            model.addAttribute("type", type);
        }
        if (StringUtils.isNotEmpty(keyword)) {
            map.put("keyword", keyword);
            map.put("type", null);
            model.addAttribute("keyword", keyword);
        }
        Page<Object> pageInfo = PageHelper.startPage(p, limit, true);
        pageInfo.setOrderBy(" id desc ");
        List<Article> beanDataList = articleMapper.selectAll(map);
        model.addAttribute("beanDataList", beanDataList);
        setPageParams(model, "pc/articleList", pageInfo); //绑定分页参数
        return "pc/articleList";
    }

    /**
     * 系统首页
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/index")
    public String index(Model model, Integer p, Integer limit, String keyword, String title, String author, String orderStr, String type, HttpSession session) {

        limit = 6;
        if (null == p) { //默认第一页
            p = 1;
        }
        if (null == limit) { //默认每页10条
            limit = 9;
        }
        Map map = new HashMap();
        if (StringUtils.isNotEmpty(keyword)) {
            map.put("keyword", keyword);
            model.addAttribute("keyword", keyword);
        }
        if (StringUtils.isNotEmpty(title)) {
            map.put("title", title);
            model.addAttribute("title", title);
        }
        if (StringUtils.isNotEmpty(author)) {
            map.put("author", author);
            model.addAttribute("author", author);
        }
        if (StringUtils.isNotEmpty(type)) {
            map.put("type", type);
            model.addAttribute("type", type);
        }
        Page<Object> pageInfo = PageHelper.startPage(p, limit, true);
        if (StringUtils.isNotEmpty(orderStr)) {
            pageInfo.setOrderBy(orderStr);
        } else {
            pageInfo.setOrderBy(" id desc ");
        }
        List<Article> beanDataList = articleMapper.selectAll(map);
        model.addAttribute("beanDataList", beanDataList);
        setPageParams(model, "pc/index", pageInfo); //绑定分页参数
        List<Sorttype> sorttypeList = sorttypeMapper.selectAll(null);
        model.addAttribute("sorttypeList", sorttypeList);
        setLinkurlContent(session); //查询友情链接
        return "pc/index";
    }


    /**
     * 系统首页
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/main")
    public String main(Model model, Integer p, Integer limit, String keyword, String title, String author, String orderStr, String type, HttpSession session) {

        limit = 6;
        if (null == p) { //默认第一页
            p = 1;
        }
        if (null == limit) { //默认每页10条
            limit = 9;
        }
        Map map = new HashMap();
        if (StringUtils.isNotEmpty(keyword)) {
            map.put("keyword", keyword);
            model.addAttribute("keyword", keyword);
        }
        if (StringUtils.isNotEmpty(title)) {
            map.put("title", title);
            model.addAttribute("title", title);
        }
        if (StringUtils.isNotEmpty(author)) {
            map.put("author", author);
            model.addAttribute("author", author);
        }
        if (StringUtils.isNotEmpty(type)) {
            map.put("type", type);
            model.addAttribute("type", type);
        }
        Page<Object> pageInfo = PageHelper.startPage(p, limit, true);
        if (StringUtils.isNotEmpty(orderStr)) {
            pageInfo.setOrderBy(orderStr);
        } else {
            pageInfo.setOrderBy(" id desc ");
        }
        List<Article> beanDataList = articleMapper.selectAll(map);
        model.addAttribute("beanDataList", beanDataList);
        setPageParams(model, "pc/main", pageInfo); //绑定分页参数
        List<Sorttype> sorttypeList = sorttypeMapper.selectAll(null);
        model.addAttribute("sorttypeList", sorttypeList);
        setLinkurlContent(session); //查询友情链接
        return "pc/main";
    }



    @RequestMapping("pc/articleIndex")
    public String articleIndex(Model model, Integer p, Integer limit, String keyword, String title, String author, String orderStr, String type, HttpSession session) {
        limit = 6;
        if (null == p) { //默认第一页
            p = 1;
        }
        if (null == limit) { //默认每页10条
            limit = 9;
        }
        Map map = new HashMap();
        if (StringUtils.isNotEmpty(keyword)) {
            map.put("keyword", keyword);
            model.addAttribute("keyword", keyword);
        }
        if (StringUtils.isNotEmpty(title)) {
            map.put("title", title);
            model.addAttribute("title", title);
        }
        if (StringUtils.isNotEmpty(author)) {
            map.put("author", author);
            model.addAttribute("author", author);
        }
        if (StringUtils.isNotEmpty(type)) {
            map.put("type", type);
            model.addAttribute("type", type);
        }
        Page<Object> pageInfo = PageHelper.startPage(p, limit, true);
        if (StringUtils.isNotEmpty(orderStr)) {
            pageInfo.setOrderBy(orderStr);
        } else {
            pageInfo.setOrderBy(" id desc ");
        }
        List<Article> beanDataList = articleMapper.selectAll(map);
        model.addAttribute("beanDataList", beanDataList);

        setPageParams(model, "pc/index", pageInfo); //绑定分页参数
        List<Sorttype> sorttypeList = sorttypeMapper.selectAll(null);
        model.addAttribute("sorttypeList", sorttypeList);
        setLinkurlContent(session); //查询友情链接
        return "pc/articleIndex";
    }

    /**
     * 将友情链接放入session中
     *
     * @param session
     */
    public void setLinkurlContent(HttpSession session) {
        List<Linkurl> linkurlList = linkurlMapper.selectAll(null);
        session.setAttribute("linkurlList", linkurlList);
    }

    /**
     * 帖子详情
     *
     * @param id
     * @param model
     * @return
     */
    @RequestMapping("pc/articleDetail")
    public String articleDetail(Integer id, Model model,Integer type) {
        Article beanData = articleMapper.selectArticleById(id);
        model.addAttribute("beanData", beanData);
        List<Wenjuan> wenjuanList = wenjuanMapper.selectAll(null);
        model.addAttribute("wenjuanList", wenjuanList);

        Page<Object> pageInfo = PageHelper.startPage(1, 1000, true);
        pageInfo.setOrderBy(" id desc ");
        Map map = new HashMap();
        map.put("artid", id);
        List<FastLiuyan> liuyanList = fastLiuyanMapper.selectAll(map);
        model.addAttribute("liuyanList", liuyanList);

        Map map1 = new HashMap();
        map1.put("iddd",beanData.getId());
        List<Article> beanDataList = articleMapper.selectAllRAND(map1);

        model.addAttribute("beanDataList", beanDataList);

        //评价回复都算上

        int liuyansize = 0;
        if(liuyanList.size()>0){
            liuyansize+=liuyanList.size();
            for (FastLiuyan fastLiuyan:liuyanList) {
                Map map2 = new HashMap();
                map2.put("artid", fastLiuyan.getId());
                List<Liuyan> liuyans = liuyanMapper.selectAll(map2);
                if(liuyans.size()>0){
                    liuyansize+=liuyans.size();
                    fastLiuyan.setHuifunum(liuyans.size());
                }else{
                    fastLiuyan.setHuifunum(0);
                }

            }
        }

        model.addAttribute("liuyansize", liuyansize);


        if(type!=null){
          if(type==1){
              beanData.setCai(beanData.getCai()+1);
          } else{
              beanData.setZan(beanData.getZan()+1);
          }
        }


         beanData.setHits(beanData.getHits()+1);
        articleMapper.updateArticle(beanData);

        return "pc/articleDetail";
    }

    @RequestMapping("pc/submitWenjuan")
    public String submitWenjuan(Integer id, String username, Model model, HttpServletRequest request) {
        Wenjuanjieguo j = new Wenjuanjieguo();
        j.setA1(request.getParameter("xx1"));
        j.setA2(request.getParameter("xx2"));
        j.setA3(request.getParameter("xx3"));
        j.setA4(request.getParameter("xx4"));
        j.setA5(request.getParameter("xx5"));
        j.setA6(request.getParameter("xx6"));
        j.setA7(request.getParameter("xx7"));
        j.setA8(request.getParameter("xx8"));
        j.setA9(request.getParameter("xx9"));
        j.setA10(request.getParameter("xx10"));
        j.setUsername(username);
        j.setCreatetime(new Date());
        System.out.println("j = " + j);
        List<Wenjuan> wenjuanList = wenjuanMapper.selectAll(null);
        wenjuanjieguoMapper.insertWenjuanjieguo(j);
        return "pc/submitSuccess";
    }


    @RequestMapping("pc/informIndex")
    public String informIndex(Model model, Integer p, Integer limit, String keyword) {
        limit = 10;
        if (null == p) { //默认第一页
            p = 1;
        }
        if (null == limit) { //默认每页10条
            limit = 10;
        }
        Map map = new HashMap();
        if (StringUtils.isNotEmpty(keyword)) {
            map.put("keyword", keyword);
        }
        Page<Object> pageInfo = PageHelper.startPage(p, limit, true);
        List<Inform> beanDataList = informMapper.selectAll(map);
        model.addAttribute("beanDataList", beanDataList);
        setPageParams(model, "pc/informIndex", pageInfo); //绑定分页参数
        return "pc/informIndex";
    }


    /**
     * 获取验证码
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/code")
    public String code(Model model) {
        return "pc/code";
    }

    /**
     * 跳转登陆页
     *
     * @param model
     * @return
     */
    @RequestMapping("pc/login")
    public String login(Model model) {
        return "pc/login";
    }

    /**
     * 退出登录
     *
     * @param request
     * @param id
     * @param model
     * @return
     */
    @RequestMapping("pc/loginOut")
    public String loginOut(HttpServletRequest request, Integer id, Model model) {
        HttpSession session = request.getSession();
        session.removeAttribute("loginUserinfo");
        return "pc/login";
    }

    /**
     * 登录提交
     *
     * @param username
     * @param password
     * @param vercode
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("pc/loginSubmit")
    public ResultUtil loginSubmit(String username, String password, String vercode, HttpServletRequest request) {
        HttpSession session = request.getSession();
        if (StringUtils.isBlank(vercode)) {
            return ResultUtil.error("验证码不能为空");
        }
        String randCode = session.getAttribute("randCode").toString();
        if (!randCode.equals(vercode)) {
            return ResultUtil.error("验证码不正确");
        }
        if (StringUtils.isBlank(username)) {
            return ResultUtil.error("用户名不能为空");
        }
        if (StringUtils.isBlank(password)) {
            return ResultUtil.error("登录密码不能为空");
        }
        Map map = new HashMap();
        map.put("name", username);
        List<Userinfo> beanList = userinfoMapper.selectAll(map);
        if (beanList.size() > 0) {
            Userinfo userinfo = beanList.get(0);
            if (userinfo.getPassword().equals(password)) {
                session.setAttribute("loginUserinfo", userinfo);
                session.setAttribute("loginUserinfoID", userinfo.getId());
                return ResultUtil.ok("登录成功");
            } else {
                return ResultUtil.error("用户名或者密码错误");
            }
        } else {
            return ResultUtil.error("用户名或者密码错误");
        }

    }

    @RequestMapping("pc/register")
    public String reg() {
        return "pc/register";
    }

    @ResponseBody
    @RequestMapping("pc/registerSubmit")
    public ResultUtil regSubmit(HttpServletRequest request, Userinfo userinfo, String vercode) {
        HttpSession session = request.getSession();
        if (StringUtils.isBlank(vercode)) {
            return ResultUtil.error("验证码不能为空");
        }
        String randCode = session.getAttribute("randCode").toString();
        if (!randCode.equals(vercode)) {
            return ResultUtil.error("验证码不正确");
        }
        if (StringUtils.isBlank(userinfo.getName())) {
            return ResultUtil.error("姓名不能为空");
        }
        if (StringUtils.isBlank(userinfo.getPassword())) {
            return ResultUtil.error("登录密码不能为空");
        }
        userinfo.setCreatetime(new Date());
        userinfoMapper.insertUserinfo(userinfo);
        return ResultUtil.ok("注册成功");
    }

    /**
     * 用户个人中心
     *
     * @param model
     * @param session
     * @return
     */
    @RequestMapping("pc/userinfoCenter")
    public String userinfoCenter(Model model, HttpSession session) {
        int userInfoID = getLoginUserInfoID(session);
        Userinfo userinfo = userinfoMapper.selectUserinfoById(userInfoID);
        model.addAttribute("userinfo", userinfo);
        return "pc/userinfoCenter";
    }

    /**
     * 更新个人信息
     */
    @RequestMapping("pc/updateUserinfo")
    @ResponseBody
    public ResultUtil updateUserinfo(Userinfo userinfo, HttpSession session) {
        Date nowTime = new Date();
        userinfo.setCreatetime(nowTime);
        try {
            userinfoMapper.updateUserinfo(userinfo);
            userinfo = getLoginUserInfo(session);
            session.setAttribute("loginUserinfo", userinfo);
            return ResultUtil.ok("修改用户信息成功");
        } catch (Exception e) {
            return ResultUtil.error("修改用户信息出错,稍后再试!");
        }
    }

    /**
     * 获取前端登录用户ID
     *
     * @param session
     * @return
     */
    public int getLoginUserInfoID(HttpSession session) {
        int userID = (int) session.getAttribute("loginUserinfoID");
        return userID;
    }

    public Userinfo getLoginUserInfo(HttpSession session) {
        int userID = (int) session.getAttribute("loginUserinfoID");
        Userinfo userinfo = userinfoMapper.selectUserinfoById(userID);
        return userinfo;
    }
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值