基于java springboot jsp在线问卷调查系统源码和论文

摘   要

伴随着时代的不断发展和发展,信息已经变成人们生活中不可缺少的一部分。问卷调查系统,对互联网客户开展调查问卷。完成对问卷调查信息的管理方法,提供更简洁便捷的操控服务平台,对有关信息开展在线调研。现阶段,大家已经可以将网络技术运用到日常生活和作业的各个方面,为当今社会的不断进步和各领域的持续发展提供了便捷。在各种企业中,她们也根据网络技术的运用,立即或间接的为企业的发展提供有利的服务支持。互联网数据毫无疑问变成了最有價值的网络资源。世界各国的企业都是在为冬天业务流程做准备。针对信息的搜集和剖析,大家更加注重数据统计分析,以期得到大量有价值的信息,为企业的长久发展提供发展战略具体指导。伴随着网络技术的迅速发展,必须研发一个可以快速的搜集信息分析数据的在线问卷调查系统。

本系统的目的性是构建一个有效的服务平台。本调查问卷系统是运用简易有效的JSP技术性和MYSQL数据库技术开发设计的。本系统关键完成了问卷调查信息管理方法、客户信息管理方法和系统管理等后台管理控制模块。与此同时融合了访问、信息查看、信息查询等前面控制模块。管理效益。通过科学合理全方位的检测,该系统具备使用方便、操作灵活性好、安全系数高、运作平稳等优势。

【519】基于java springboot jsp在线问卷调查系统

关键词:问卷调查;数据库;JAVA;管理

Abstract

With the continuous development of the times, information has become an indispensable part of people's life. Questionnaire survey system to carry out questionnaires for Internet customers. Complete the management method of questionnaire information, provide a more concise and convenient manipulation service platform, and carry out online research on relevant information. At this stage, we can apply network technology to all aspects of daily life and homework, which provides convenience for the continuous progress of today's society and the sustainable development of various fields. In various enterprises, they also provide favorable service support for the development of enterprises immediately or indirectly according to the application of network technology. Internet data has undoubtedly become the most valuable network resource. Enterprises all over the world are preparing for business processes in winter. For the collection and analysis of information, we pay more attention to data statistics and analysis, in order to get a lot of valuable information and provide specific guidance for the long-term development of the enterprise. With the rapid development of network technology, we must develop an online questionnaire system that can quickly collect information and analyze data.

The purpose of this system is to build an effective service platform. This questionnaire system is developed and designed by using simple and effective JSP technology and MySQL database technology. The key of this system is to complete the background management control modules such as questionnaire information management method, customer information management method and system management. At the same time, it integrates the front control modules such as access, information viewing and information query. Management benefits. Through scientific, reasonable and all-round detection, the system has the advantages of convenient use, good operation flexibility, high safety factor and stable operation.

Key words: questionnaire survey; database JAVA; Administration

package com.boot.controller;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;

import com.boot.entity.*;
import com.boot.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.boot.util.PageHelper;
import com.boot.util.VeDate;

import javax.servlet.http.HttpServletRequest;

//定义为控制器
@Controller
// 设置路径
@RequestMapping("/index")
public class IndexController extends BaseController {

	@Autowired
	private ClazzService clazzService;
	@Autowired
	private UsersService usersService;
	@Autowired
	private CourseService courseService;
	@Autowired
	private QuestionService questionService;
	@Autowired
	private PaperService paperService;
	@Autowired
	private ResultsService resultsService;
	@Autowired
	private ComplainsService complainsService;
	@Autowired
	private BbsService bbsService;
	@Autowired
	private RebbsService rebbsService;
	@Autowired
	private BannerService bannerService;
	@Autowired
	private ArticleService articleService;
	@Autowired
	private RedisTemplate redisTemplate;
	@Autowired
	private JavaMailSender javaMailSender;
	@Autowired
	private AdminService adminService;
	@Value("${spring.mail.username}")
	private String emailFrom;



	// 公共方法 提供公共查询数据
	private void front() {
		this.getRequest().setAttribute("title", "在线问卷管理系统");
		List<Banner> bannerList = this.bannerService.getAllBanner();
		this.getRequest().setAttribute("bannerList", bannerList);
	}

	// 首页显示
	@RequestMapping("index.action")
	public String index() {
		this.front();
		List<Banner> bannerList = this.bannerService.getAllBanner();
		List<Banner> frontList = new ArrayList<Banner>();
		for (Banner banner : bannerList) {
			List<Article> articleList = this.articleService.getArticleByBanner(banner.getBannerid());
			banner.setArticleList(articleList);
			frontList.add(banner);
		}
		this.getRequest().setAttribute("frontList", frontList);
		List<Article> topList = this.articleService.getTopArticle();
		List<Article> favList = this.articleService.getFlvArticle();
		this.getRequest().setAttribute("topList", topList);
		this.getRequest().setAttribute("favList", favList);
		return "users/index";
	}

	// 新闻
	@RequestMapping("article.action")
	public String article(String id) {
		this.front();
		Article article = new Article();
		article.setBannerid(id);
		List<Article> articleList = this.articleService.getArticleByCond(article);
		this.getRequest().setAttribute("articleList", articleList);
		Banner banner = this.bannerService.getBannerById(id);
		this.getRequest().setAttribute("banner", banner);
		return "users/article";
	}

	// 阅读公告
	@RequestMapping("read.action")
	public String read(String id) {
		this.front();
		Article article = this.articleService.getArticleById(id);
		article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
		this.articleService.updateArticle(article);
		this.getRequest().setAttribute("article", article);
		return "users/read";
	}

	// 准备登录
	@RequestMapping("preLogin.action")
	public String prelogin() {
		this.front();
		return "users/login";
	}

	// 用户登录
	@RequestMapping("login.action")
	public String login() {
		this.front();
		String username = this.getRequest().getParameter("username");
		String password = this.getRequest().getParameter("password");
		Users u = new Users();
		u.setUsername(username);
		List<Users> usersList = this.usersService.getUsersByCond(u);
		if (usersList.size() == 0) {
			this.getSession().setAttribute("message", "用户名不存在");
			return "redirect:/index/preLogin.action";
		} else {
			Users users = usersList.get(0);
			if (password.equals(users.getPassword())) {
				this.getSession().setAttribute("userid", users.getUsersid());
				this.getSession().setAttribute("username", users.getUsername());
				this.getSession().setAttribute("users", users);
				this.getSession().setAttribute("clazzid", users.getClazzid());
				users.setRetime(VeDate.getStringDateShort());
				this.usersService.updateUsers(users);
				return "redirect:/index/index.action";
			} else {
				this.getSession().setAttribute("message", "密码错误");
				return "redirect:/index/preLogin.action";
			}
		}
	}

	// 准备注册
	@RequestMapping("preReg.action")
	public String preReg() {
		this.front();
		List<Clazz> clazzList = this.clazzService.getAllClazz();
		this.getRequest().setAttribute("clazzList", clazzList);
		return "users/register";
	}

	// 用户注册
	@RequestMapping("register.action")
	public String register(Users users) {
		this.front();
		Users u1 = new Users();
		Users u2 = new Users();
		u1.setUsername(users.getUsername());
		u2.setRealname(users.getRealname());
		List<Users> usersList = this.usersService.getUsersByCond(u1);
		List<Users> usersList1 = this.usersService.getUsersByCond(u2);
		if (usersList.size() != 0) {
			this.getSession().setAttribute("message", "用户名已存在");
			return "redirect:/index/preReg.action";
		} else if (usersList1.size() != 0) {
			this.getSession().setAttribute("message", users.getRealname()+"已注册");
			return "redirect:/index/preReg.action";
		}  else  {
			Admin ad=new Admin();
			ad.setSex(users.getSex());
			ad.setBirthday(users.getBirthday());
			ad.setContact(users.getContact());
			ad.setPassword(users.getPassword());
			ad.setRealname(users.getRealname());
			ad.setUsername(users.getUsername());
			ad.setRole("用戶");
			ad.setMemo("用户");
			ad.setAdminid(users.getUsersid());
			this.getSession().setAttribute("message", "注册成功");
			users.setRegdate(VeDate.getStringDateShort());
			ad.setAddtime(users.getRegdate());
			this.adminService.insertAdmin(ad);
			this.usersService.insertUsers(users);
		}

		return "redirect:/index/preLogin.action";
	}



	// 退出登录
	@RequestMapping("exit.action")
	public String exit() {
		this.front();
		this.getSession().removeAttribute("userid");
		this.getSession().removeAttribute("username");
		this.getSession().removeAttribute("users");
		return "redirect:/index/index.action";
	}

	// 准备修改密码
	@RequestMapping("prePwd.action")
	public String prePwd() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		return "users/editpwd";
	}

	// 修改密码
	@RequestMapping("editpwd.action")
	public String editpwd() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		String password = this.getRequest().getParameter("password");
		String repassword = this.getRequest().getParameter("repassword");
		Users users = this.usersService.getUsersById(userid);
		if (password.equals(users.getPassword())) {
			users.setPassword(repassword);
			this.usersService.updateUsers(users);
		} else {
			this.getSession().setAttribute("message", "旧密码错误");
			return "redirect:/index/prePwd.action";
		}
		return "redirect:/index/prePwd.action";
	}

	@RequestMapping("usercenter.action")
	public String usercenter() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		return "users/usercenter";
	}

	@RequestMapping("userinfo.action")
	public String userinfo() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		this.getSession().setAttribute("users", this.usersService.getUsersById(userid));
		List<Clazz> clazzList = this.clazzService.getAllClazz();
		this.getRequest().setAttribute("clazzList", clazzList);
		return "users/userinfo";
	}

	@RequestMapping("personal.action")
	public String personal(Users users) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		} else if (redisTemplate.opsForValue().get(users.getEmail()).equals(users.getCode())) {
			this.usersService.updateUsers(users);
		} else  {
			this.getSession().setAttribute("message", "无效或已过期");
        return "redirect:/index/userinfo.action";
    }
		return "redirect:/index/userinfo.action";
	}

	// 留言板
	@RequestMapping("bbs.action")
	public String bbs() {
		this.front();
		List<Bbs> bbsList = this.bbsService.getAllBbs();
		this.getRequest().setAttribute("bbsList", bbsList);
		return "users/bbs";
	}

	// 发布留言
	@RequestMapping("addbbs.action")
	public String addbbs() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Bbs bbs = new Bbs();
		bbs.setAddtime(VeDate.getStringDate());
		bbs.setContents(getRequest().getParameter("contents"));
		bbs.setHits("0");
		bbs.setRepnum("0");
		bbs.setTitle(getRequest().getParameter("title"));
		bbs.setUsersid(userid);
		this.bbsService.insertBbs(bbs);
		return "redirect:/index/bbs.action";
	}

	// 查看留言
	@RequestMapping("readbbs.action")
	public String readbbs() {
		this.front();
		Bbs bbs = this.bbsService.getBbsById(getRequest().getParameter("id"));
		bbs.setHits("" + (Integer.parseInt(bbs.getHits()) + 1));
		this.bbsService.updateBbs(bbs);
		this.getRequest().setAttribute("bbs", bbs);
		Rebbs rebbs = new Rebbs();
		rebbs.setBbsid(bbs.getBbsid());
		List<Rebbs> rebbsList = this.rebbsService.getRebbsByCond(rebbs);
		this.getRequest().setAttribute("rebbsList", rebbsList);
		return "users/readbbs";
	}

	// 回复留言
	@RequestMapping("rebbs.action")
	public String rebbs() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Rebbs rebbs = new Rebbs();
		rebbs.setAddtime(VeDate.getStringDate());
		rebbs.setContents(getRequest().getParameter("contents"));
		rebbs.setBbsid(getRequest().getParameter("bbsid"));
		rebbs.setUsersid(userid);
		this.rebbsService.insertRebbs(rebbs);
		Bbs bbs = this.bbsService.getBbsById(rebbs.getBbsid());
		bbs.setRepnum("" + (Integer.parseInt(bbs.getRepnum()) + 1));
		this.bbsService.updateBbs(bbs);
		String path = "redirect:/index/readbbs.action?id=" + bbs.getBbsid();
		return path;
	}

	@RequestMapping("preComplains.action")
	public String preComplains() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		return "users/addComplains";
	}

	@RequestMapping("addComplains.action")
	public String addComplains(Complains complains) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		complains.setAddtime(VeDate.getStringDateShort());
		complains.setStatus("未回复");
		complains.setUsersid(userid);
		this.complainsService.insertComplains(complains);
		return "redirect:/index/preComplains.action";
	}

	@RequestMapping("myComplains.action")
	public String myComplains(String number) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Complains complains = new Complains();
		complains.setUsersid(userid);
		List<Complains> complainsList = this.complainsService.getComplainsByCond(complains);
		PageHelper.getIndexPage(complainsList, "complains", "myComplains", null, 10, number, this.getRequest());
		return "users/myComplains";
	}

	@RequestMapping("myCourse.action")
	public String myCourse(String number) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String clazzid = (String) this.getSession().getAttribute("clazzid");
		Course course = new Course();
		course.setClazzid(clazzid);
		List<Course> courseList = this.courseService.getAllCourse();
		PageHelper.getIndexPage(courseList, "course", "myCourse", null, 10, number, this.getRequest());
		return "users/myCourse";
	}

	@RequestMapping("prePaper.action")
	public String prePaper(String number, String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		Paper paper = new Paper();
		paper.setCourseid(id);
		List<Paper> paperList = this.paperService.getPaperByCond(paper);
		PageHelper.getIndexPage(paperList, "paper", "prePaper", id, 10, number, this.getRequest());
		return "users/myPaper";
	}

	@RequestMapping("preTest.action")
	public String preTest(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Results results = new Results();
		results.setPaperid(id);
		results.setUsersid(userid);
		List<Results> list = this.resultsService.getResultsByCond(results);
		Paper paper = this.paperService.getPaperById(id);
		if (paper.getStatus().equals("待审核")) {
			this.getSession().setAttribute("message", "请等待管理员审核通过后再作答,谢谢");
			return "redirect:/index/prePaper.action?id=" + paper.getCourseid();
		} else if (list.size() == 0) {
			String[] ids = paper.getQuestionx().split(",");
			List<Question> questionList = new ArrayList<Question>();
			for (String str : ids) {
				Question question = this.questionService.getQuestionById(str);
				questionList.add(question);
			}
			this.getRequest().setAttribute("paper", paper);
			this.getRequest().setAttribute("questionList", questionList);
		} else {
			this.getSession().setAttribute("message", "您已经参与过此问卷,谢谢");
			return "redirect:/index/prePaper.action?id=" + paper.getCourseid();
		}
		return "users/test";
	}

	@RequestMapping("test.action")
	public String test(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			this.getSession().setAttribute("message", "登录信息过期,请重新登录");
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");

		Paper paper = this.paperService.getPaperById(id);
		String[] ids = paper.getQuestionx().split(",");
		int total = 0;
		int per = (int) 100 / ids.length;
		for (String str : ids) {
			String answer = this.getRequest().getParameter("q" + str);
			if ("是".equals(answer)) {
				total += per;
			}
		}
		Results results = new Results();
		results.setPaperid(id);
		results.setUsersid(userid);
		results.setNum("" + total);
		results.setAddtime(VeDate.getStringDate());
		this.resultsService.insertResults(results);
		return "redirect:/index/myCourse.action";
	}

}

  • 24
    点赞
  • 18
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
基于Java在线学习系统代码主要包括数据库设计、用户界面设计、后端代码和前端代码等部分。下面以一个简单的学生在线学习系统为例进行介绍。 数据库设计方面,可以使用MySQL或者Oracle等关系型数据库。创建学生表、课程表、作业表等多个表,每个表包括相应的字段和索引。例如,学生表包括学生ID、姓名、年级等字段。 用户界面设计方面,可以使用Swing或者JavaFX等库进行开发。设计学生登录页面、课程列表页面、作业页面等不同功能模块的界面。例如,登录页面包括用户名和密码输入框、登录按钮等。 后端代码部分,可以使用Java Servlet和JSP等技术进行开发。根据用户的请求,对应响应相应的Servlet进行处理。例如,登录请求会调用登录Servlet验证用户身份,并返回登录结果。 前端代码部分,可以使用HTML、CSS和JavaScript等技术进行开发。通过Ajax技术实现与后端的异步通信。例如,点击课程列表中的某个课程,前端通过Ajax请求获取课程详情,并在界面上展示。 此外,系统还需要实现业务逻辑,例如学生选课、查看作业、提交作业等功能。在数据库的基础上,编写相应的Java代码处理这些逻辑。例如,选课功能会在选课表中插入选课记录。 综上所述,基于Java在线学习系统代码包含数据库设计、用户界面设计、后端代码和前端代码等多个方面。通过合理的架构和设计,可以实现一个功能完善的在线学习系统

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

程序猿毕业分享网

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

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

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

打赏作者

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

抵扣说明:

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

余额充值