文章目录
Java毕业设计-基于springboot开发的java在线问卷调查系统设计与实现-毕业论文(附毕设源代码)
如需其他项目或毕设源码,可进主页看下往期的毕设资源分享哦,希望对您有帮助!
逃逸的卡路里
–
前言
随着信息技术的飞速发展,Java语言作为一种成熟、稳定且功能强大的编程语言,已经广泛应用于企业级应用、移动开发、大数据处理等多个领域。作为本科大学生,我们在学习Java编程语言的过程中,不仅掌握了其语法规则和编程技巧,更重要的是学会了如何利用Java解决实际问题,实现软件系统的设计与开发。
本次毕业设计旨在通过实际项目的开发,将我们在大学期间所学的Java编程语言知识与实践相结合,进一步加深对Java语言的理解和应用。毕业设计的宗旨在于培养我们的独立思考能力、团队协作精神和创新能力,提升我们解决实际问题的能力,为未来的职业发展打下坚实的基础。
在毕业设计中,我们将综合运用Java编程语言、数据库技术、前端开发技术等,设计并实现一个具有实际应用价值的软件系统。通过需求分析、系统设计、编码实现、测试维护等阶段的实践,我们将全面提升自己的软件开发能力,为未来的学习和工作积累宝贵的经验。
在线问卷调查系统能够实现问卷管理,用户管理,题目管理,问卷调查管理,新闻资讯管理等功能。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。
在线问卷调查系统可以提高问卷调查信息管理问题的解决效率,优化问卷调查信息处理流程,并且能够保证存储数据的安全,它是一个非常可靠,非常安全的应用程序。
关键词:在线问卷调查系统;Mysql数据库;Java语言
一、毕设成果演示(源代码在文末)
二、毕设摘要展示
1、开发说明
开发语言:Java
框架:springboot
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7(一定要5.7版本)
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
2、需求分析
在线问卷调查系统根据使用权限的角度进行功能分析,并运用用例图来展示各个权限需要操作的功能。
管理员用例图,管理员权限操作的功能包括对注册用户信息的管理,对问卷,题目,问卷调查,新闻资讯等信息的管理。
用户用例图,用户权限操作的功能包括参与问卷调查,查看新闻,查看问卷调查记录。
3、系统功能结构
三、系统实现展示
1、管理员功能实现
1.1 问卷管理
编码实现的问卷管理界面,管理员在该界面中可以对已有问卷进行启用或禁用,可以新增问卷,编辑更改已有问卷的资料,包括问卷名称,结束语等信息,可以删除需要删除的问卷,可以根据问卷名称,问卷的状态来获取需要的问卷信息。
核心代码:
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody ExampaperEntity exampaper, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,exampaper:{}",this.getClass().getName(),exampaper.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
//根据字段查询是否有相同数据
Wrapper<ExampaperEntity> queryWrapper = new EntityWrapper<ExampaperEntity>()
.notIn("id",exampaper.getId())
.andNew()
.eq("exampaper_name", exampaper.getExampaperName())
.eq("exampaper_date", exampaper.getExampaperDate())
.eq("exampaper_types", exampaper.getExampaperTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ExampaperEntity exampaperEntity = exampaperService.selectOne(queryWrapper);
if(exampaperEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// exampaper.set
// }
exampaperService.updateById(exampaper);//根据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());
exampaperService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
1.2 问卷调查管理
编码实现的问卷调查管理界面,管理员在该界面中对用户提交的问卷调查信息进行查看,管理员可以直接查看每条问卷调查的调查详情信息,同时可以删除问卷调查信息。
核心代码:
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<ExampaperEntity> exampaperList = 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){
//循环
ExampaperEntity exampaperEntity = new ExampaperEntity();
// exampaperEntity.setExampaperName(data.get(0)); //问卷名称 要改的
// exampaperEntity.setExampaperDate(Integer.valueOf(data.get(0))); //时长(分钟) 要改的
// exampaperEntity.setExampaperTypes(Integer.valueOf(data.get(0))); //问卷状态 要改的
// exampaperEntity.setCreateTime(date);//时间
exampaperList.add(exampaperEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
exampaperService.insertBatch(exampaperList);
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 = exampaperService.queryPage(params);
//字典表数据转换
List<ExampaperView> list =(List<ExampaperView>)page.getList();
for(ExampaperView 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);
ExampaperEntity exampaper = exampaperService.selectById(id);
if(exampaper !=null){
//entity转view
ExampaperView view = new ExampaperView();
BeanUtils.copyProperties( exampaper , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
1.3 题目管理
编码实现的题目管理界面,管理员在该界面中可以导出题目,可以新增题目,可以对指定的题目信息进行修改,删除,同时可以查看用户对各个题目选项的统计信息,该统计信息是以饼图进行展示。
核心代码:
/**
* 后端详情
*/
@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,"表中有相同数据");
}
}
1.4 用户管理
编码实现的用户管理界面,管理员在该界面中为用户重置密码,修改用户基本信息,新增用户,删除需要删除的用户信息。
核心代码:
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role))
return R.error(511,"权限为空");
//根据字段查询是否有相同数据
Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>()
.notIn("id",yonghu.getId())
.andNew()
.eq("username", yonghu.getUsername())
.or()
.eq("yonghu_id_number", yonghu.getYonghuIdNumber())
.or()
.eq("yonghu_phone", yonghu.getYonghuPhone())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);
if("".equals(yonghu.getYonghuPhoto()) || "null".equals(yonghu.getYonghuPhoto())){
yonghu.setYonghuPhoto(null);
}
if(yonghuEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role"));
// if("".equals(role)){
// yonghu.set
// }
yonghuService.updateById(yonghu);//根据id更新
return R.ok();
}else {
return R.error(511,"账户或者手机号或者身份证号已经被使用");
}
}
1.5 新闻资讯管理
编码实现的新闻资讯管理界面,管理员在该界面中负责发布新闻资讯,更改新闻资讯的部分信息,删除需要删除的新闻资讯信息。
核心代码:
/**
* 后端列表
*/
@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 = newsService.queryPage(params);
//字典表数据转换
List<NewsView> list =(List<NewsView>)page.getList();
for(NewsView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
2、用户功能实现
2.1 问卷列表
编码实现的问卷列表界面,用户在该界面中选择问卷并参与问卷调查。
核心代码:
/**
* 前端列表
*/
@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 = examrecordService.queryPage(params);
//字典表数据转换
List<ExamrecordView> list =(List<ExamrecordView>)page.getList();
for(ExamrecordView 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);
ExamrecordEntity examrecord = examrecordService.selectById(id);
if(examrecord !=null){
//entity转view
ExamrecordView view = new ExamrecordView();
BeanUtils.copyProperties( examrecord , view );//把实体数据重构到view中
//级联表
ExampaperEntity exampaper = exampaperService.selectById(examrecord.getExampaperId());
if(exampaper != null){
BeanUtils.copyProperties( exampaper , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setExampaperId(exampaper.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(examrecord.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
2.2 问卷调查
编码实现的问卷调查界面,用户在该界面中主要根据问卷调查题目信息进行选项答题,答题结束可以选择界面顶端的结束问卷调查按钮离开问卷调查界面。
核心代码:
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
ExamredetailsEntity examredetails = examredetailsService.selectById(id);
if(examredetails !=null){
//entity转view
ExamredetailsView view = new ExamredetailsView();
BeanUtils.copyProperties( examredetails , view );//把实体数据重构到view中
//级联表
ExamquestionEntity examquestion = examquestionService.selectById(examredetails.getExamquestionId());
if(examquestion != null){
BeanUtils.copyProperties( examquestion , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setExamquestionId(examquestion.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(examredetails.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
2.3 新闻资讯
编码实现的新闻资讯界面,用户在该界面中浏览新闻资讯,在界面右上角的搜索框中编辑新闻标题可以获取匹配的新闻资讯信息。
核心代码:
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
NewsEntity news = newsService.selectById(id);
if(news !=null){
//entity转view
NewsView view = new NewsView();
BeanUtils.copyProperties( news , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
2.4 问卷调查记录
编码实现的问卷调查记录界面,用户在该界面中可以对参与问卷调查的记录信息进行查看。
核心代码:
@RequestMapping("/saveExamredetails")
public R saveExamredetails(@RequestBody ExamredetailsEntity examredetails,Integer examrecordId, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,examredetails:{}",this.getClass().getName(),examredetails.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(StringUtil.isEmpty(role)){
return R.error(511,"权限为空");
}else if(role.contains("用户id")){
examredetails.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
}
examredetails.setCreateTime(new Date());
boolean insert = examredetailsService.insert(examredetails);
if(!insert){
return R.error();
}
return R.ok();
}
四、毕设内容和源代码获取
Java毕业设计-基于springboot开发的java在线问卷调查系统设计与实现-毕业论文(附毕设源代码):https://download.csdn.net/download/u014740628/88917997
如需其他项目或毕设源码,可进主页看下往期的毕设资源分享哦,希望对您有帮助!
逃逸的卡路里
总结
通过本次毕业设计,我们不仅巩固了所学的Java编程语言知识,还学会了如何将理论知识应用于实际项目中。我们设计的软件系统具有一定的实际应用价值,这让我们对自己的能力充满了信心,也为未来的职业发展打下了坚实的基础。