当前位置:   article > 正文

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

调查问卷系统源码

摘   要

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

本系统的目的性是构建一个有效的服务平台。本调查问卷系统是运用简易有效的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

  1. package com.boot.controller;
  2. import java.io.UnsupportedEncodingException;
  3. import java.util.ArrayList;
  4. import java.util.List;
  5. import java.util.Random;
  6. import java.util.concurrent.TimeUnit;
  7. import com.boot.entity.*;
  8. import com.boot.service.*;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.beans.factory.annotation.Value;
  11. import org.springframework.data.redis.core.RedisTemplate;
  12. import org.springframework.mail.SimpleMailMessage;
  13. import org.springframework.mail.javamail.JavaMailSender;
  14. import org.springframework.stereotype.Controller;
  15. import org.springframework.web.bind.annotation.RequestMapping;
  16. import com.boot.util.PageHelper;
  17. import com.boot.util.VeDate;
  18. import javax.servlet.http.HttpServletRequest;
  19. //定义为控制器
  20. @Controller
  21. // 设置路径
  22. @RequestMapping("/index")
  23. public class IndexController extends BaseController {
  24. @Autowired
  25. private ClazzService clazzService;
  26. @Autowired
  27. private UsersService usersService;
  28. @Autowired
  29. private CourseService courseService;
  30. @Autowired
  31. private QuestionService questionService;
  32. @Autowired
  33. private PaperService paperService;
  34. @Autowired
  35. private ResultsService resultsService;
  36. @Autowired
  37. private ComplainsService complainsService;
  38. @Autowired
  39. private BbsService bbsService;
  40. @Autowired
  41. private RebbsService rebbsService;
  42. @Autowired
  43. private BannerService bannerService;
  44. @Autowired
  45. private ArticleService articleService;
  46. @Autowired
  47. private RedisTemplate redisTemplate;
  48. @Autowired
  49. private JavaMailSender javaMailSender;
  50. @Autowired
  51. private AdminService adminService;
  52. @Value("${spring.mail.username}")
  53. private String emailFrom;
  54. // 公共方法 提供公共查询数据
  55. private void front() {
  56. this.getRequest().setAttribute("title", "在线问卷管理系统");
  57. List<Banner> bannerList = this.bannerService.getAllBanner();
  58. this.getRequest().setAttribute("bannerList", bannerList);
  59. }
  60. // 首页显示
  61. @RequestMapping("index.action")
  62. public String index() {
  63. this.front();
  64. List<Banner> bannerList = this.bannerService.getAllBanner();
  65. List<Banner> frontList = new ArrayList<Banner>();
  66. for (Banner banner : bannerList) {
  67. List<Article> articleList = this.articleService.getArticleByBanner(banner.getBannerid());
  68. banner.setArticleList(articleList);
  69. frontList.add(banner);
  70. }
  71. this.getRequest().setAttribute("frontList", frontList);
  72. List<Article> topList = this.articleService.getTopArticle();
  73. List<Article> favList = this.articleService.getFlvArticle();
  74. this.getRequest().setAttribute("topList", topList);
  75. this.getRequest().setAttribute("favList", favList);
  76. return "users/index";
  77. }
  78. // 新闻公告
  79. @RequestMapping("article.action")
  80. public String article(String id) {
  81. this.front();
  82. Article article = new Article();
  83. article.setBannerid(id);
  84. List<Article> articleList = this.articleService.getArticleByCond(article);
  85. this.getRequest().setAttribute("articleList", articleList);
  86. Banner banner = this.bannerService.getBannerById(id);
  87. this.getRequest().setAttribute("banner", banner);
  88. return "users/article";
  89. }
  90. // 阅读公告
  91. @RequestMapping("read.action")
  92. public String read(String id) {
  93. this.front();
  94. Article article = this.articleService.getArticleById(id);
  95. article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
  96. this.articleService.updateArticle(article);
  97. this.getRequest().setAttribute("article", article);
  98. return "users/read";
  99. }
  100. // 准备登录
  101. @RequestMapping("preLogin.action")
  102. public String prelogin() {
  103. this.front();
  104. return "users/login";
  105. }
  106. // 用户登录
  107. @RequestMapping("login.action")
  108. public String login() {
  109. this.front();
  110. String username = this.getRequest().getParameter("username");
  111. String password = this.getRequest().getParameter("password");
  112. Users u = new Users();
  113. u.setUsername(username);
  114. List<Users> usersList = this.usersService.getUsersByCond(u);
  115. if (usersList.size() == 0) {
  116. this.getSession().setAttribute("message", "用户名不存在");
  117. return "redirect:/index/preLogin.action";
  118. } else {
  119. Users users = usersList.get(0);
  120. if (password.equals(users.getPassword())) {
  121. this.getSession().setAttribute("userid", users.getUsersid());
  122. this.getSession().setAttribute("username", users.getUsername());
  123. this.getSession().setAttribute("users", users);
  124. this.getSession().setAttribute("clazzid", users.getClazzid());
  125. users.setRetime(VeDate.getStringDateShort());
  126. this.usersService.updateUsers(users);
  127. return "redirect:/index/index.action";
  128. } else {
  129. this.getSession().setAttribute("message", "密码错误");
  130. return "redirect:/index/preLogin.action";
  131. }
  132. }
  133. }
  134. // 准备注册
  135. @RequestMapping("preReg.action")
  136. public String preReg() {
  137. this.front();
  138. List<Clazz> clazzList = this.clazzService.getAllClazz();
  139. this.getRequest().setAttribute("clazzList", clazzList);
  140. return "users/register";
  141. }
  142. // 用户注册
  143. @RequestMapping("register.action")
  144. public String register(Users users) {
  145. this.front();
  146. Users u1 = new Users();
  147. Users u2 = new Users();
  148. u1.setUsername(users.getUsername());
  149. u2.setRealname(users.getRealname());
  150. List<Users> usersList = this.usersService.getUsersByCond(u1);
  151. List<Users> usersList1 = this.usersService.getUsersByCond(u2);
  152. if (usersList.size() != 0) {
  153. this.getSession().setAttribute("message", "用户名已存在");
  154. return "redirect:/index/preReg.action";
  155. } else if (usersList1.size() != 0) {
  156. this.getSession().setAttribute("message", users.getRealname()+"已注册");
  157. return "redirect:/index/preReg.action";
  158. } else {
  159. Admin ad=new Admin();
  160. ad.setSex(users.getSex());
  161. ad.setBirthday(users.getBirthday());
  162. ad.setContact(users.getContact());
  163. ad.setPassword(users.getPassword());
  164. ad.setRealname(users.getRealname());
  165. ad.setUsername(users.getUsername());
  166. ad.setRole("用戶");
  167. ad.setMemo("用户");
  168. ad.setAdminid(users.getUsersid());
  169. this.getSession().setAttribute("message", "注册成功");
  170. users.setRegdate(VeDate.getStringDateShort());
  171. ad.setAddtime(users.getRegdate());
  172. this.adminService.insertAdmin(ad);
  173. this.usersService.insertUsers(users);
  174. }
  175. // else if (!(redisTemplate.opsForValue().get(users.getEmail()).equals(users.getCode()))) {
  176. // this.getSession().setAttribute("message", "验证码无效或已过期");
  177. // return "redirect:/index/preReg.action";
  178. // }
  179. return "redirect:/index/preLogin.action";
  180. }
  181. //发送验证码
  182. @RequestMapping("email")
  183. public void email(String email) throws UnsupportedEncodingException {
  184. this.front();
  185. Users u2 = new Users();
  186. u2.setEmail(email);
  187. List<Users> usersList1 = this.usersService.getUsersByCond(u2);
  188. if (usersList1.size() != 0) {
  189. this.getSession().setAttribute("message", "邮箱已存在");
  190. } else {
  191. //String name=request.getParameter(email);
  192. //String str = new String(name.getBytes("iso-8859-1"),"gb2312");
  193. String code = String.valueOf((int) ((Math.random() * 9 + 1) * 100000));
  194. SimpleMailMessage msg = new SimpleMailMessage();
  195. msg.setFrom(emailFrom);
  196. msg.setTo("\n" +
  197. email);
  198. msg.setSubject("在线问卷调查系统验证码");
  199. msg.setText("在线问卷调查系统验证码:" + code + ",五分钟内有效。");
  200. javaMailSender.send(msg);
  201. redisTemplate.opsForValue().set(email, code, 60 * 5, TimeUnit.SECONDS);
  202. }
  203. }
  204. // 退出登录
  205. @RequestMapping("exit.action")
  206. public String exit() {
  207. this.front();
  208. this.getSession().removeAttribute("userid");
  209. this.getSession().removeAttribute("username");
  210. this.getSession().removeAttribute("users");
  211. return "redirect:/index/index.action";
  212. }
  213. // 准备修改密码
  214. @RequestMapping("prePwd.action")
  215. public String prePwd() {
  216. this.front();
  217. if (this.getSession().getAttribute("userid") == null) {
  218. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  219. return "redirect:/index/preLogin.action";
  220. }
  221. return "users/editpwd";
  222. }
  223. // 修改密码
  224. @RequestMapping("editpwd.action")
  225. public String editpwd() {
  226. this.front();
  227. if (this.getSession().getAttribute("userid") == null) {
  228. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  229. return "redirect:/index/preLogin.action";
  230. }
  231. String userid = (String) this.getSession().getAttribute("userid");
  232. String password = this.getRequest().getParameter("password");
  233. String repassword = this.getRequest().getParameter("repassword");
  234. Users users = this.usersService.getUsersById(userid);
  235. if (password.equals(users.getPassword())) {
  236. users.setPassword(repassword);
  237. this.usersService.updateUsers(users);
  238. } else {
  239. this.getSession().setAttribute("message", "旧密码错误");
  240. return "redirect:/index/prePwd.action";
  241. }
  242. return "redirect:/index/prePwd.action";
  243. }
  244. @RequestMapping("usercenter.action")
  245. public String usercenter() {
  246. this.front();
  247. if (this.getSession().getAttribute("userid") == null) {
  248. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  249. return "redirect:/index/preLogin.action";
  250. }
  251. return "users/usercenter";
  252. }
  253. @RequestMapping("userinfo.action")
  254. public String userinfo() {
  255. this.front();
  256. if (this.getSession().getAttribute("userid") == null) {
  257. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  258. return "redirect:/index/preLogin.action";
  259. }
  260. String userid = (String) this.getSession().getAttribute("userid");
  261. this.getSession().setAttribute("users", this.usersService.getUsersById(userid));
  262. List<Clazz> clazzList = this.clazzService.getAllClazz();
  263. this.getRequest().setAttribute("clazzList", clazzList);
  264. return "users/userinfo";
  265. }
  266. @RequestMapping("personal.action")
  267. public String personal(Users users) {
  268. this.front();
  269. if (this.getSession().getAttribute("userid") == null) {
  270. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  271. return "redirect:/index/preLogin.action";
  272. } else {
  273. this.usersService.updateUsers(users);
  274. }
  275. return "redirect:/index/userinfo.action";
  276. }
  277. // 留言板
  278. @RequestMapping("bbs.action")
  279. public String bbs() {
  280. this.front();
  281. List<Bbs> bbsList = this.bbsService.getAllBbs();
  282. this.getRequest().setAttribute("bbsList", bbsList);
  283. return "users/bbs";
  284. }
  285. // 发布留言
  286. @RequestMapping("addbbs.action")
  287. public String addbbs() {
  288. this.front();
  289. if (this.getSession().getAttribute("userid") == null) {
  290. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  291. return "redirect:/index/preLogin.action";
  292. }
  293. String userid = (String) this.getSession().getAttribute("userid");
  294. Bbs bbs = new Bbs();
  295. bbs.setAddtime(VeDate.getStringDate());
  296. bbs.setContents(getRequest().getParameter("contents"));
  297. bbs.setHits("0");
  298. bbs.setRepnum("0");
  299. bbs.setTitle(getRequest().getParameter("title"));
  300. bbs.setUsersid(userid);
  301. this.bbsService.insertBbs(bbs);
  302. return "redirect:/index/bbs.action";
  303. }
  304. // 查看留言
  305. @RequestMapping("readbbs.action")
  306. public String readbbs() {
  307. this.front();
  308. Bbs bbs = this.bbsService.getBbsById(getRequest().getParameter("id"));
  309. bbs.setHits("" + (Integer.parseInt(bbs.getHits()) + 1));
  310. this.bbsService.updateBbs(bbs);
  311. this.getRequest().setAttribute("bbs", bbs);
  312. Rebbs rebbs = new Rebbs();
  313. rebbs.setBbsid(bbs.getBbsid());
  314. List<Rebbs> rebbsList = this.rebbsService.getRebbsByCond(rebbs);
  315. this.getRequest().setAttribute("rebbsList", rebbsList);
  316. return "users/readbbs";
  317. }
  318. // 回复留言
  319. @RequestMapping("rebbs.action")
  320. public String rebbs() {
  321. this.front();
  322. if (this.getSession().getAttribute("userid") == null) {
  323. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  324. return "redirect:/index/preLogin.action";
  325. }
  326. String userid = (String) this.getSession().getAttribute("userid");
  327. Rebbs rebbs = new Rebbs();
  328. rebbs.setAddtime(VeDate.getStringDate());
  329. rebbs.setContents(getRequest().getParameter("contents"));
  330. rebbs.setBbsid(getRequest().getParameter("bbsid"));
  331. rebbs.setUsersid(userid);
  332. this.rebbsService.insertRebbs(rebbs);
  333. Bbs bbs = this.bbsService.getBbsById(rebbs.getBbsid());
  334. bbs.setRepnum("" + (Integer.parseInt(bbs.getRepnum()) + 1));
  335. this.bbsService.updateBbs(bbs);
  336. String path = "redirect:/index/readbbs.action?id=" + bbs.getBbsid();
  337. return path;
  338. }
  339. @RequestMapping("preComplains.action")
  340. public String preComplains() {
  341. this.front();
  342. if (this.getSession().getAttribute("userid") == null) {
  343. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  344. return "redirect:/index/preLogin.action";
  345. }
  346. return "users/addComplains";
  347. }
  348. @RequestMapping("addComplains.action")
  349. public String addComplains(Complains complains) {
  350. this.front();
  351. if (this.getSession().getAttribute("userid") == null) {
  352. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  353. return "redirect:/index/preLogin.action";
  354. }
  355. String userid = (String) this.getSession().getAttribute("userid");
  356. complains.setAddtime(VeDate.getStringDateShort());
  357. complains.setStatus("未回复");
  358. complains.setUsersid(userid);
  359. this.complainsService.insertComplains(complains);
  360. return "redirect:/index/preComplains.action";
  361. }
  362. @RequestMapping("myComplains.action")
  363. public String myComplains(String number) {
  364. this.front();
  365. if (this.getSession().getAttribute("userid") == null) {
  366. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  367. return "redirect:/index/preLogin.action";
  368. }
  369. String userid = (String) this.getSession().getAttribute("userid");
  370. Complains complains = new Complains();
  371. complains.setUsersid(userid);
  372. List<Complains> complainsList = this.complainsService.getComplainsByCond(complains);
  373. PageHelper.getIndexPage(complainsList, "complains", "myComplains", null, 10, number, this.getRequest());
  374. return "users/myComplains";
  375. }
  376. @RequestMapping("myCourse.action")
  377. public String myCourse(String number) {
  378. this.front();
  379. if (this.getSession().getAttribute("userid") == null) {
  380. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  381. return "redirect:/index/preLogin.action";
  382. }
  383. String clazzid = (String) this.getSession().getAttribute("clazzid");
  384. Course course = new Course();
  385. course.setClazzid(clazzid);
  386. List<Course> courseList = this.courseService.getAllCourse();
  387. PageHelper.getIndexPage(courseList, "course", "myCourse", null, 10, number, this.getRequest());
  388. return "users/myCourse";
  389. }
  390. @RequestMapping("prePaper.action")
  391. public String prePaper(String number, String id) {
  392. this.front();
  393. if (this.getSession().getAttribute("userid") == null) {
  394. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  395. return "redirect:/index/preLogin.action";
  396. }
  397. Paper paper = new Paper();
  398. paper.setCourseid(id);
  399. List<Paper> paperList = this.paperService.getPaperByCond(paper);
  400. PageHelper.getIndexPage(paperList, "paper", "prePaper", id, 10, number, this.getRequest());
  401. return "users/myPaper";
  402. }
  403. @RequestMapping("preTest.action")
  404. public String preTest(String id) {
  405. this.front();
  406. if (this.getSession().getAttribute("userid") == null) {
  407. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  408. return "redirect:/index/preLogin.action";
  409. }
  410. String userid = (String) this.getSession().getAttribute("userid");
  411. Results results = new Results();
  412. results.setPaperid(id);
  413. results.setUsersid(userid);
  414. List<Results> list = this.resultsService.getResultsByCond(results);
  415. Paper paper = this.paperService.getPaperById(id);
  416. if (paper.getStatus().equals("待审核")) {
  417. this.getSession().setAttribute("message", "请等待管理员审核通过后再作答,谢谢");
  418. return "redirect:/index/prePaper.action?id=" + paper.getCourseid();
  419. } else if (list.size() == 0) {
  420. String[] ids = paper.getQuestionx().split(",");
  421. List<Question> questionList = new ArrayList<Question>();
  422. for (String str : ids) {
  423. Question question = this.questionService.getQuestionById(str);
  424. questionList.add(question);
  425. }
  426. this.getRequest().setAttribute("paper", paper);
  427. this.getRequest().setAttribute("questionList", questionList);
  428. } else {
  429. this.getSession().setAttribute("message", "您已经参与过此问卷,谢谢");
  430. return "redirect:/index/prePaper.action?id=" + paper.getCourseid();
  431. }
  432. return "users/test";
  433. }
  434. @RequestMapping("test.action")
  435. public String test(String id) {
  436. this.front();
  437. if (this.getSession().getAttribute("userid") == null) {
  438. this.getSession().setAttribute("message", "登录信息过期,请重新登录");
  439. return "redirect:/index/preLogin.action";
  440. }
  441. String userid = (String) this.getSession().getAttribute("userid");
  442. Paper paper = this.paperService.getPaperById(id);
  443. String[] ids = paper.getQuestionx().split(",");
  444. int total = 0;
  445. int per = (int) 100 / ids.length;
  446. for (String str : ids) {
  447. String answer = this.getRequest().getParameter("q" + str);
  448. if ("是".equals(answer)) {
  449. total += per;
  450. }
  451. }
  452. Results results = new Results();
  453. results.setPaperid(id);
  454. results.setUsersid(userid);
  455. results.setNum("" + total);
  456. results.setAddtime(VeDate.getStringDate());
  457. this.resultsService.insertResults(results);
  458. return "redirect:/index/myCourse.action";
  459. }
  460. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/540818
推荐阅读
相关标签
  

闽ICP备14008679号