前言
在线问卷调查系统致力于实现高效的数据采集与分析,基于 SpringBoot + Vue 搭建,提供问卷创建、发布、答题统计等功能,为企业与研究机构提供了一站式服务平台。
💗博主介绍
✌ 3Dex(全栈开发工程师),专注于4smile等项目的建设与优化,在软件开发与技术实现方面积累了丰富的经验。专注于Java、小程序、前端、python等技术领域毕业项目实战,以及程序定制化开发✌擅长从源码编写到论文撰写、答辩PPT制作及讲解,提供全方位支持,帮助学生顺利完成学业目标。。
🌟文末获取源码+论文+部署讲解+PPT🌟
喜欢的小伙伴可以点赞、收藏并关注!如有疑问,欢迎留言交流。



详细视频演示
完整的系统演示视频展示了所有功能模块的使用流程,包括普通用户端、农民端和管理员端的具体操作。
获取方式:文末扫码联系博主获取!
具体实现截图









核心技术介绍
后端框架SpringBoot
SpringBoot 是一种基于Spring框架的快速开发框架,旨在简化Spring应用的开发流程。
主要特点:
- 内置Tomcat支持:开发者无需手动配置服务器环境,系统即可快速运行。
- 约定优于配置:减少了大量繁琐的配置文件。
- 快速集成组件:支持与Spring Security、MyBatis等主流框架的无缝整合。
前端框架Vue
Vue.js 是一个轻量级的JavaScript框架,专为单页面应用开发设计。
主要优势:
- 虚拟DOM:提升页面更新性能。
- 响应式数据绑定:实时更新UI界面。
- 组件化开发:提高代码复用性,便于维护和扩展。
持久层框架MyBatis
MyBatis 是一个优秀的持久层框架,简化了数据访问层的开发工作。
主要特点:
- 简化数据库操作:通过XML或注解方式实现SQL映射。
- 动态SQL支持:根据条件动态生成SQL语句。
- 一级/二级缓存:提升查询性能。
- 插件机制:可扩展性强,满足复杂业务需求。
代码参考
以下是项目中关键功能的代码片段示例:
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 题目表
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/examquestion")
public class ExamquestionController {
private static final Logger logger = LoggerFactory.getLogger(ExamquestionController.class);
@Autowired
private ExamquestionService examquestionService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private ExampaperService exampaperService;
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = examquestionService.queryPage(params);
//字典表数据转换
List<ExamquestionView> list =(List<ExamquestionView>)page.getList();
for(ExamquestionView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ExamquestionEntity examquestion = examquestionService.selectById(id);
if(examquestion !=null){
//entity转view
ExamquestionView view = new ExamquestionView();
BeanUtils.copyProperties( examquestion , view );//把实体数据重构到view中
//级联表
ExampaperEntity exampaper = exampaperService.selectById(examquestion.getExampaperId());
if(exampaper != null){
BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setExampaperId(exampaper.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ExamquestionEntity examquestion, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,examquestion:{}",this.getClass().getName(),examquestion.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
Wrapper<ExamquestionEntity> queryWrapper = new EntityWrapper<ExamquestionEntity>()
.eq("exampaper_id", examquestion.getExampaperId())
.eq("examquestion_name", examquestion.getExamquestionName())
.eq("examquestion_options", examquestion.getExamquestionOptions())
.eq("examquestion_types", examquestion.getExamquestionTypes())
.eq("examquestion_sequence", examquestion.getExamquestionSequence())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ExamquestionEntity examquestionEntity = examquestionService.selectOne(queryWrapper);
if(examquestionEntity==null){
examquestion.setCreateTime(new Date());
examquestionService.insert(examquestion);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ExamquestionEntity examquestion, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,examquestion:{}",this.getClass().getName(),examquestion.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
//根据字段查询是否有相同数据
Wrapper<ExamquestionEntity> queryWrapper = new EntityWrapper<ExamquestionEntity>()
.notIn("id",examquestion.getId())
.andNew()
.eq("exampaper_id", examquestion.getExampaperId())
.eq("examquestion_name", examquestion.getExamquestionName())
.eq("examquestion_options", examquestion.getExamquestionOptions())
.eq("examquestion_types", examquestion.getExamquestionTypes())
.eq("examquestion_sequence", examquestion.getExamquestionSequence())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ExamquestionEntity examquestionEntity = examquestionService.selectOne(queryWrapper);
if(examquestionEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// examquestion.set
// }
examquestionService.updateById(examquestion);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
examquestionService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<ExamquestionEntity> examquestionList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
ExamquestionEntity examquestionEntity = new ExamquestionEntity();
// examquestionEntity.setExampaperId(Integer.valueOf(data.get(0))); //所属问卷id(外键) 要改的
// examquestionEntity.setExamquestionName(data.get(0)); //题目名称 要改的
// examquestionEntity.setExamquestionOptions(data.get(0)); //选项 要改的
// examquestionEntity.setExamquestionTypes(Integer.valueOf(data.get(0))); //题目类型 要改的
// examquestionEntity.setExamquestionSequence(Integer.valueOf(data.get(0))); //题目排序,值越大排越前面 要改的
// examquestionEntity.setCreateTime(date);//时间
examquestionList.add(examquestionEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
examquestionService.insertBatch(examquestionList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = examquestionService.queryPage(params);
//字典表数据转换
List<ExamquestionView> list =(List<ExamquestionView>)page.getList();
for(ExamquestionView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ExamquestionEntity examquestion = examquestionService.selectById(id);
if(examquestion !=null){
//entity转view
ExamquestionView view = new ExamquestionView();
BeanUtils.copyProperties( examquestion , view );//把实体数据重构到view中
//级联表
ExampaperEntity exampaper = exampaperService.selectById(examquestion.getExampaperId());
if(exampaper != null){
BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setExampaperId(exampaper.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ExamquestionEntity examquestion, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,examquestion:{}",this.getClass().getName(),examquestion.toString());
Wrapper<ExamquestionEntity> queryWrapper = new EntityWrapper<ExamquestionEntity>()
.eq("exampaper_id", examquestion.getExampaperId())
.eq("examquestion_name", examquestion.getExamquestionName())
.eq("examquestion_options", examquestion.getExamquestionOptions())
.eq("examquestion_types", examquestion.getExamquestionTypes())
.eq("examquestion_sequence", examquestion.getExamquestionSequence())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ExamquestionEntity examquestionEntity = examquestionService.selectOne(queryWrapper);
if(examquestionEntity==null){
examquestion.setCreateTime(new Date());
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// examquestion.set
// }
examquestionService.insert(examquestion);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}
数据库参考
/*Table structure for table `examquestion` */
DROP TABLE IF EXISTS `examquestion`;
CREATE TABLE `examquestion` (
`id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`exampaper_id` int(20) NOT NULL COMMENT '所属问卷id(外键)',
`examquestion_name` varchar(200) NOT NULL COMMENT '试题名称 Search111',
`examquestion_options` longtext COMMENT '选项',
`examquestion_types` int(20) DEFAULT '0' COMMENT '试题类型',
`examquestion_sequence` int(20) DEFAULT '100' COMMENT '试题排序,值越大排越前面',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COMMENT='试题表';
/*Data for the table `examquestion` */
insert into `examquestion`(`id`,`exampaper_id`,`examquestion_name`,`examquestion_options`,`examquestion_types`,`examquestion_sequence`,`create_time`) values (20,2,'您对于《永劫无间》这款游戏的体验程度是?','[{\"text\":\"玩过\",\"code\":\"A\"},{\"text\":\"没玩过但看过直播/录播\",\"code\":\"B\"},{\"text\":\"其他\",\"code\":\"C\"}]',1,1,'2022-02-08 09:41:07'),(21,2,'您比较喜欢下列哪些种类的游戏?','[{\"text\":\"卡牌类(炉石传说、明日方舟,皇室战争)\",\"code\":\"A\"},{\"text\":\"养成类(宝可梦,奇迹暖暖,阴阳师)\",\"code\":\"B\"},{\"text\":\"竞速类(qq飞车,跑跑卡丁车等)\",\"code\":\"C\"},{\"text\":\"moba类(王者荣耀,lol,虚荣)\",\"code\":\"D\"}]',2,2,'2022-02-08 09:42:18'),(22,2,'您的年龄段是?','[{\"text\":\"16-18岁\",\"code\":\"A\"},{\"text\":\"19-24岁\",\"code\":\"B\"},{\"text\":\"25-30岁\",\"code\":\"C\"},{\"text\":\"30岁以上\",\"code\":\"D\"}]',1,3,'2022-02-08 09:43:26'),(23,2,'您的性别是?','[{\"text\":\"男\",\"code\":\"A\"},{\"text\":\"女\",\"code\":\"B\"},{\"text\":\"其他\",\"code\":\"C\"}]',1,4,'2022-02-08 09:44:00'),(24,2,'您的职业或身份是?','[{\"text\":\"学生\",\"code\":\"A\"},{\"text\":\"公职人员(教师,医生,公务员等)\",\"code\":\"B\"},{\"text\":\"公司员工(主要是指定期上班的员工等)\",\"code\":\"C\"},{\"text\":\"个体经营者(比如个体经营户,自由插画师等等)\",\"code\":\"D\"}]',1,5,'2022-02-08 09:44:42'),(25,2,'test','[{\"text\":\"测试\",\"code\":\"A\"},{\"text\":\"测试2\",\"code\":\"B\"},{\"text\":\"测试3\",\"code\":\"C\"}]',2,1111,'2022-02-08 14:50:00'),(26,2,'1111111','[{\"text\":\"123\",\"code\":\"A\"},{\"text\":\"321\",\"code\":\"B\"},{\"text\":\"312\",\"code\":\"C\"},{\"text\":\"231\",\"code\":\"D\"}]',2,1111,'2022-02-08 17:54:11');
/*Table structure for table `examrecord` */
DROP TABLE IF EXISTS `examrecord`;
CREATE TABLE `examrecord` (
`id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`examrecord_uuid_number` varchar(200) DEFAULT NULL COMMENT '问卷调查编号',
`yonghu_id` int(20) NOT NULL COMMENT '问卷调查用户',
`exampaper_id` int(20) NOT NULL COMMENT '所属问卷id(外键)',
`insert_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '问卷调查时间',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8 COMMENT='问卷调查记录表';
/*Data for the table `examrecord` */
insert into `examrecord`(`id`,`examrecord_uuid_number`,`yonghu_id`,`exampaper_id`,`insert_time`,`create_time`) values (21,'1638238591293',2,2,'2022-02-08 10:16:31','2022-02-08 10:16:31'),(22,'1638239123796',2,2,'2022-02-08 10:25:24','2022-02-08 10:25:24'),(23,'1638241520089',2,2,'2022-02-08 11:05:20','2022-02-08 11:05:20'),(28,'1638253662630',3,2,'2022-02-08 14:27:43','2022-02-08 14:27:43'),(29,'1638255075263',2,2,'2022-02-08 14:51:15','2022-02-08 14:51:15'),(30,'1638841594276',2,2,'2022-02-08 09:46:34','2022-02-08 09:46:34'),(31,'1638842379989',2,2,'2022-02-08 09:59:40','2022-02-08 09:59:40'),(32,'1638842537045',2,2,'2022-02-08 10:02:17','2022-02-08 10:02:17'),(33,'1644313967343',2,2,'2022-02-08 17:52:47','2022-02-08 17:52:47'),(34,'1644314075973',2,2,'2022-02-08 17:54:36','2022-02-08 17:54:36');
测试用例参考
| 测试场景 | 输入数据 | 预期结果 | 实际结果 | 结果分析 |
|---|---|---|---|---|
| 登录成功 | 用户名:admin,密码:123456 | 登录成功,跳转至问卷管理页面 | 登录成功,跳转至问卷管理页面 | 符合预期 |
| 新增问卷信息 | 问卷标题:市场调研问卷,描述:问卷内容 | 问卷添加成功,问卷列表更新 | 问卷添加成功,问卷列表更新 | 符合预期 |
| 发布问卷 | 问卷ID:101,状态:已发布 | 发布成功,问卷状态更新 | 发布成功,问卷状态更新 | 符合预期 |
| 填写问卷 | 问卷ID:101,答案:选项A、选项C | 答题提交成功,答题记录增加 | 答题提交成功,答题记录增加 | 符合预期 |
| 查看问卷统计结果 | 问卷ID:201 | 显示问卷统计结果 | 显示问卷统计结果 | 符合预期 |
源码获取
如果你对本系统感兴趣,可以通过以下方式获取完整源码及相关资源:
- 完整源码:包括前后端代码,便于二次开发。
- 数据库文件:完整的MySQL表结构和数据。
- 部署文档:SpringBoot和Vue项目部署教程。
- 答辩PPT:助力毕设答辩成功。
文章下方名片可联系我获取完整源码及数据库。
点赞、收藏、关注、评论支持一下吧👇🏻获取联系方式👇🏻
精彩专栏订阅
更多精彩内容推荐:
- 基于Springboot+Vue社区养老服务管理系统(源码+lw+讲解部署+PPT)
- 基于Springboot+Vue的全功能网上服装商城系统(附源码+论文+部署教程
- 基于Springboot+Vue员工绩效考核管理系统(源码+lw+讲解部署+PPT)
- 基于Springboot+Vue动漫推荐平台管理系统(源码+lw+讲解部署+PPT)
- 基于Springboot+Vue图书个性化推荐系统(源码+lw+讲解部署+PPT)
- 基于Springboot+Vue口腔管家平台管理系统(源码+lw+讲解部署+PPT)
- 基于Springboot+Vue酒店管理系统(源码+lw+部署调试+PPT)
- 基于Springboot+Vue医院急诊系统(源码+PPT+LW+调试部署)
- 基于Python + Django + Bootstrap的学生信息管理系统(源码+lw+讲解部署+PPT)
- Uniapp家校通微信小程序管理系统
6921

被折叠的 条评论
为什么被折叠?



