赞
踩
伴随着时代的不断发展和发展,信息已经变成人们生活中不可缺少的一部分。问卷调查系统,对互联网客户开展调查问卷。完成对问卷调查信息的管理方法,提供更简洁便捷的操控服务平台,对有关信息开展在线调研。现阶段,大家已经可以将网络技术运用到日常生活和作业的各个方面,为当今社会的不断进步和各领域的持续发展提供了便捷。在各种企业中,她们也根据网络技术的运用,立即或间接的为企业的发展提供有利的服务支持。互联网数据毫无疑问变成了最有價值的网络资源。世界各国的企业都是在为冬天业务流程做准备。针对信息的搜集和剖析,大家更加注重数据统计分析,以期得到大量有价值的信息,为企业的长久发展提供发展战略具体指导。伴随着网络技术的迅速发展,必须研发一个可以快速的搜集信息分析数据的在线问卷调查系统。
本系统的目的性是构建一个有效的服务平台。本调查问卷系统是运用简易有效的JSP技术性和MYSQL数据库技术开发设计的。本系统关键完成了问卷调查信息管理方法、客户信息管理方法和系统管理等后台管理控制模块。与此同时融合了访问、信息查看、信息查询等前面控制模块。管理效益。通过科学合理全方位的检测,该系统具备使用方便、操作灵活性好、安全系数高、运作平稳等优势。
【529】基于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);
- }
- // else if (!(redisTemplate.opsForValue().get(users.getEmail()).equals(users.getCode()))) {
- // this.getSession().setAttribute("message", "验证码无效或已过期");
- // return "redirect:/index/preReg.action";
- // }
-
- return "redirect:/index/preLogin.action";
- }
-
- //发送验证码
- @RequestMapping("email")
- public void email(String email) throws UnsupportedEncodingException {
- this.front();
- Users u2 = new Users();
- u2.setEmail(email);
- List<Users> usersList1 = this.usersService.getUsersByCond(u2);
- if (usersList1.size() != 0) {
- this.getSession().setAttribute("message", "邮箱已存在");
- } else {
- //String name=request.getParameter(email);
- //String str = new String(name.getBytes("iso-8859-1"),"gb2312");
- String code = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
- SimpleMailMessage msg = new SimpleMailMessage();
- msg.setFrom(emailFrom);
- msg.setTo("\n" +
- email);
- msg.setSubject("在线问卷调查系统验证码");
- msg.setText("在线问卷调查系统验证码:" + code + ",五分钟内有效。");
- javaMailSender.send(msg);
- redisTemplate.opsForValue().set(email, code, 60 * 5, TimeUnit.SECONDS);
- }
-
- }
-
- // 退出登录
- @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 {
- this.usersService.updateUsers(users);
- }
- 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";
- }
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。