基于java+springboot+vue的在线问卷调查系统

项目介绍

如今社会上各行各业,都在用属于自己专用的软件来进行工作,互联网发展到这个时候,人们已经发现离不开了互联网。互联网的发展,离不开一些新的技术,而新技术的产生往往是为了解决现有问题而产生的。针对于问卷调查信息管理方面的不规范,容错率低,管理人员处理数据费工费时,采用新开发的在线问卷调查系统可以从根源上规范整个数据处理流程的正规性和合法性。

在线问卷调查系统能够实现问卷管理,用户管理,题目管理,问卷调查管理,新闻资讯管理等功能。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。

在线问卷调查系统可以提高问卷调查信息管理问题的解决效率,优化问卷调查信息处理流程,并且能够保证存储数据的安全,它是一个非常可靠,非常安全的应用程序。

4.1 功能结构设计
图4.1即为设计的管理员功能结构,管理员权限操作的功能包括对注册用户信息的管理,对问卷,题目,问卷调查,新闻资讯等信息的管理。
在这里插入图片描述
图4.2即为设计的用户功能结构,用户权限操作的功能包括参与问卷调查,查看新闻,查看问卷调查记录。
在这里插入图片描述

开发环境

编程语言:Java
数据库 :Mysql
系统架构:B/S
后端框架:SpringBoot
编译工具:idea或者eclipse,jdk1.8,maven
支持定做:java/php/python/android/小程序vue/爬虫/c#/asp.net

系统实现

5.1 管理员功能实现
5.1.1 问卷管理
图5.1 即为编码实现的问卷管理界面,管理员在该界面中可以对已有问卷进行启用或禁用,可以新增问卷,编辑更改已有问卷的资料,包括问卷名称,结束语等信息,可以删除需要删除的问卷,可以根据问卷名称,问卷的状态来获取需要的问卷信息。
在这里插入图片描述

图5.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();
}

5.1.2 问卷调查管理
图5.2 即为编码实现的问卷调查管理界面,管理员在该界面中对用户提交的问卷调查信息进行查看,管理员可以直接查看每条问卷调查的调查详情信息,同时可以删除问卷调查信息。
在这里插入图片描述

图5.2 问卷调查管理界面
核心代码:
/**
* 批量上传
*/
@RequestMapping(“/batchInsert”)
public R save( String fileName){
logger.debug(“batchInsert方法:,Controller:{},fileName:{}”,this.getClass().getName(),fileName);
try {
List exampaperList = new ArrayList<>();//上传的东西
Map<String, List> 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> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List 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,"查不到数据");
        }
}

5.1.3 题目管理
图5.3 即为编码实现的题目管理界面,管理员在该界面中可以导出题目,可以新增题目,可以对指定的题目信息进行修改,删除,同时可以查看用户对各个题目选项的统计信息,该统计信息是以饼图进行展示。
在这里插入图片描述

图5.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,"表中有相同数据");
    }
}

5.1.4 用户管理
图5.4 即为编码实现的用户管理界面,管理员在该界面中为用户重置密码,修改用户基本信息,新增用户,删除需要删除的用户信息。
在这里插入图片描述

图5.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,"账户或者手机号或者身份证号已经被使用");
    }
}

5.1.5 新闻资讯管理
图5.5 即为编码实现的新闻资讯管理界面,管理员在该界面中负责发布新闻资讯,更改新闻资讯的部分信息,删除需要删除的新闻资讯信息。
在这里插入图片描述

图5.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);
}

5.2 用户功能实现
5.2.1 问卷列表
图5.6 即为编码实现的问卷列表界面,用户在该界面中选择问卷并参与问卷调查。
在这里插入图片描述

图5.6 问卷列表界面
核心代码:
/**
* 前端列表
*/
@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,"查不到数据");
        }
}

5.2.2 问卷调查
图5.7 即为编码实现的问卷调查界面,用户在该界面中主要根据问卷调查题目信息进行选项答题,答题结束可以选择界面顶端的结束问卷调查按钮离开问卷调查界面。
在这里插入图片描述

图5.7 问卷调查界面
核心代码:
/**
* 前端详情
*/
@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,"查不到数据");
        }
}

5.2.3 新闻资讯
图5.8 即为编码实现的新闻资讯界面,用户在该界面中浏览新闻资讯,在界面右上角的搜索框中编辑新闻标题可以获取匹配的新闻资讯信息。
在这里插入图片描述

图5.8 新闻资讯界面
核心代码:
/**
* 前端详情
*/
@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,"查不到数据");
        }
}

5.2.4 问卷调查记录
图5.9 即为编码实现的问卷调查记录界面,用户在该界面中可以对参与问卷调查的记录信息进行查看。
在这里插入图片描述

图5.9 问卷调查记录界面
核心代码:
@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();
}

核心代码

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("/exampaper")
public class ExampaperController {
    private static final Logger logger = LoggerFactory.getLogger(ExampaperController.class);

    @Autowired
    private ExampaperService exampaperService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    @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 = 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("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,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,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ExampaperEntity exampaper, HttpServletRequest request){
        logger.debug("save方法:,,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>()
            .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){
            exampaper.setCreateTime(new Date());
            exampaperService.insert(exampaper);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @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();
    }

    /**
     * 批量上传
     */
    @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,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ExampaperEntity exampaper, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,exampaper:{}",this.getClass().getName(),exampaper.toString());
        Wrapper<ExampaperEntity> queryWrapper = new EntityWrapper<ExampaperEntity>()
            .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){
            exampaper.setCreateTime(new Date());
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      exampaper.set
        //  }
        exampaperService.insert(exampaper);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }



}

论文参考

在这里插入图片描述

目 录
第1章 绪论 1
1.1 课题背景 1
1.2 课题意义 1
1.3 研究内容 2
第2章 开发环境与技术 3
2.1 Java语言 3
2.2 MYSQL数据库 3
2.3 IDEA开发工具 4
2.4 Spring Boot框架 4
第3章 系统分析 5
3.1 可行性分析 5
3.1.1 技术可行性 5
3.1.2 经济可行性 5
3.1.3 操作可行性 5
3.2 系统流程 5
3.2.1 操作流程 6
3.2.2 登录流程 6
3.2.3 删除信息流程 7
3.2.4 添加信息流程 7
3.3 性能需求 8
3.4 功能需求 9
第4章 系统设计 11
4.1 功能结构设计 11
4.2 数据库设计 12
4.2.1 数据库概念设计 12
4.2.2 数据库物理设计 15
第5章 系统实现 18
5.1 管理员功能实现 18
5.1.1 问卷管理 18
5.1.2 问卷调查管理 18
5.1.3 题目管理 19
5.1.4 用户管理 19
5.1.5 新闻资讯管理 20
5.2 用户功能实现 20
5.2.1 问卷列表 20
5.2.2 问卷调查 21
5.2.3 新闻资讯 21
5.2.4 问卷调查记录 22
第6章 系统测试 23
6.1 功能测试 23
6.1.1 登录功能测试 23
6.1.2 修改密码功能测试 24
6.2 系统测试结果 25
结 论 26
参考文献 28
致 谢 29

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

qq_3306428634

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

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

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

打赏作者

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

抵扣说明:

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

余额充值