All Projects → BlueDriver → questionnaire_online

BlueDriver / questionnaire_online

Licence: other
springboot+mybatis在线问卷系统

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to questionnaire online

angular6-httpclient-example
Angular 6 HttpClient: Consume RESTful API Example
Stars: ✭ 38 (-74.15%)
Mutual labels:  restful-api
wgrest
WireGuard REST API
Stars: ✭ 92 (-37.41%)
Mutual labels:  restful-api
node-crudapi-ts
CRUD boilerplate for create Node Restful API's with Express Framework and Sequelize ORM written in Typescript.
Stars: ✭ 41 (-72.11%)
Mutual labels:  restful-api
project-tracking-system-backend-app
Enterprise project tracker, tracks commits done by employees after getting assigned to a couple of projects by their managers
Stars: ✭ 62 (-57.82%)
Mutual labels:  restful-api
kite-server
“上应小风筝”小程序 API 代码和文档, 基于 Rust 语言的 poem 框架编写.
Stars: ✭ 19 (-87.07%)
Mutual labels:  restful-api
FullStack-Angular-SpringBoot
Customer Relationship Managment [Full-stack Web Development using Angular & SpringBoot (RestFull API)]
Stars: ✭ 48 (-67.35%)
Mutual labels:  restful-api
metalarchives-api
RESTful API for metal-archives.com
Stars: ✭ 26 (-82.31%)
Mutual labels:  restful-api
rocket-rest-api-with-jwt
A Rusty Rocket fuelled with Diesel and secured by JWT
Stars: ✭ 62 (-57.82%)
Mutual labels:  restful-api
Library
Online Library Management. User can search, check in, checkout book. System adds fines automatically if the book is not checked in by due date
Stars: ✭ 27 (-81.63%)
Mutual labels:  restful-api
SimpleGlip
A simple Glip client with RESTful API
Stars: ✭ 20 (-86.39%)
Mutual labels:  restful-api
spotifyApiSpring
Spring-boot MVC application consuming Spotify's REST API
Stars: ✭ 28 (-80.95%)
Mutual labels:  restful-api
owlos
DIY Open Source OS for building IoT ecosystems
Stars: ✭ 43 (-70.75%)
Mutual labels:  restful-api
babyfoot
Simple CQRS/ES Node+Express+TypeScript REST API
Stars: ✭ 14 (-90.48%)
Mutual labels:  restful-api
portal
A lightweight framework for golang object (struct) serialization (mapping). Inspired heavily by marshmallow (a Python library).
Stars: ✭ 24 (-83.67%)
Mutual labels:  restful-api
akaash-rest-api
Akaash: A restful API template built with PHP driven by flight micro-framework
Stars: ✭ 17 (-88.44%)
Mutual labels:  restful-api
api
DotKernel's PSR-7 REST style API built around the Mezzio API skeleton.
Stars: ✭ 16 (-89.12%)
Mutual labels:  restful-api
SugarRestSharp
SugarRestSharp is a .NET C# SugarCRM/SuiteCRM Rest API Client. It is .NET C# Wrapper for the SugarCRM/SuiteCRM REST API Client.
Stars: ✭ 29 (-80.27%)
Mutual labels:  restful-api
spring-interview-questions
500+ Spring-Boot Interview Questions
Stars: ✭ 269 (+82.99%)
Mutual labels:  restful-api
shadowsocks-restful-api
Secure, reliable, standard restful api for managing shadowsocks-libev
Stars: ✭ 72 (-51.02%)
Mutual labels:  restful-api
CourseCake
By serving course 📚 data that is more "edible" 🍰 for developers, we hope CourseCake offers a smooth approach to build useful tools for students.
Stars: ✭ 21 (-85.71%)
Mutual labels:  restful-api

在线问卷系统

这是个前后端分离的、支持跨域访问的REST风格的Vue.js+Spring Boot项目,开发工具为IDEA,数据库为MySQL。由于当时时间匆忙及能力有限,部分功能实现有待进一步优化,可移步参考我最近整理的SpringBoot 2.x+Maven多模块项目示例进行修改。

前端地址

体验地址

数据库名称:questionnaire

字符集:UTF-8

user表

字段 类型 长度 Null 默认 主键 唯一 说明
id varchar 64 not Y 用户ID
username varchar 64 not 用户昵称
password varchar 64 not md5加密后的密码
email varchar 64 not Y 邮箱
create_time datetime not 用户创建时间
last_login_time datetime null null 用户最后登录时间
status int not 0 用户账号状态
0:未激活
1:已激活
random_code varchar 64 not Y 随机码(用户激活邮箱)

paper表

字段 类型 长度 Null 默认 主键 唯一 说明
id varchar 64 not Y 问卷ID
user_id varchar 64 not 用户ID,外键
title varchar 64 not 问卷标题
create_time datetime not 问卷创建时间
status int not 0 问卷状态
0:未发布
1:已发布
2:已结束
3:已删除
start_time datetime null null 开始时间
end_time datetime null null 截止时间

question表

字段 类型 长度 Null 默认 主键 唯一 说明
id varchar 64 not Y 问题ID
paper_id varchar 64 not 问卷ID,外键
create_time datetime not 问题创建时间
question_type int not 问题类型
1:单选
2:多选
3:简答
question_title varchar 128 not 问题标题
question_option varchar 512 not 问题选项
1:选择题,数组字符串
[option1,option2,option3...]
2:简答题,空数组字符串
[]

answer表

字段 类型 长度 Null 默认 主键 唯一 说明
id varchar 64 not Y 答案ID
paper_id varchar 64 not 问卷ID,外键
question_id varchar 64 not 问题ID,外键
question_type int not 问题类型
1:单选
2:多选
3:简答
create_time datetime not 答题时间
answer_option varchar 512 not 答题选项
1:选择题,来自question表的问题选项,单选题只有一个option,多选至少一个
[option1,option2,option3...]
2:简答题,至多一个元素的数组字符串
["只能有一个元素"]
若未达,则无元素
[]

API

编码方式均为UTF-8

1.管理员相关

1.1 注册

接口地址

domain/api/v1/register

请求方式

HTTP POST

请求示例

{
  "username": "Alice",
  "password": "123456",
  "email": "[email protected]"
}

请求参数

参数 类型 是否必须 取值范围 说明
username String Y 2-64个字符 用户名(昵称)
password String Y 6-64个字符 登录密码
email String Y 5-64个字符且格式正确 邮箱

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": 0
}

参数说明

参数 类型 是否必须 取值范围 说明
code int Y - 请求状态码
msg String Y - 消息提示
data int N - 结果数据

code说明

状态值 说明
-1 token失效或未登录(用于需要登录后才能进行的操作)
0 请求成功(全文适用,下文不再赘述)
1 系统异常(全文适用,下文不再赘述)
2 参数不正确(全文适用,下文不再赘述)

code的补充

  • code非0时,无data参数,可通过msg判断问题原因
  • code取0时,若data中有值,则data参数存在,否则无data参数

data说明

状态值 说明
0 注册成功,等待邮件激活
1 邮箱已被注册过且被激活
2 邮箱被注册过,但未激活,重新发送激活邮件

1.2 激活

接口地址

domain/api/v1/activate

请求方式

HTTP GET 请求示例

domain/api/v1/activate/code

请求参数

参数 类型 是否必须 取值范围 说明
code String Y - 激活码(即随机码)

返回参数

说明

  1. 若激活成功,跳转success页面
  2. 若激活码已失效,跳转invalid页面

1.3 登录

接口地址

domain/api/v1/login

请求方式

HTTP POST

请求示例

{  
  "email": "[email protected]",
  "password": "123456"  
}

请求参数

参数 类型 是否必须 取值范围 说明
email String Y 5-64个字符 邮箱
password String Y 6-64个字符 登录密码

返回参数

返回示例

//登录成功
{
  "code": 0,
  "msg": "ok",
  "data": {
    "result": 0,
    "token": "abcdefghijkl12345",
    "username": "Alice",
    "email": "[email protected]
  }
}
//登录失败
{
  "code": 0,
  "msg": "password error",
  "data": {
    "result": 1
  }
}

参数说明

参数 类型 是否必须 取值范围 说明
code int Y - 请求状态码
msg String Y - 消息提示
data Object N - 结果

data说明

参数 类型 是否必须 取值范围 说明
result int Y - 结果
token String N - 登陆成功后用于身份识别,凡请求的URL中含admin都需要将token放入请求header
username String N - 昵称
email String N - 邮箱

result说明

取值 说明
0 登录成功
1 密码错误
2 用户不存在
3 账号未激活

header使用token示例

    ...
    headers: {'token': token }
    ...

1.4 退出登录

接口地址

domain/api/v1/admin/logout

请求方式

HTTP GET

请求示例

请求参数

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": 0
}

参数说明

参数 类型 是否必须 取值范围 说明
code int Y - 请求状态码
msg String Y - 消息提示
data int N - 结果:0.退出成功,1.失败(未登录或登录已超时)

2.问卷相关

2.1 管理员获取问卷列表

接口地址

domain/api/v1/admin/paper-lists

请求方式

HTTP GET

请求示例

请求参数

返回参数

返回示例

//成功
{
  "code": 0,
  "msg": "ok",
  "data": [
    {"id": "12345678910","title": "问卷", "status": 0, "createTime": 1536887397173, "startTime": "2018-09-20", "endTime": "2018-10-01"},
    {"id": "22345678910","title": "问卷标题", "status": 1, "createTime": 1536887397666, "startTime": "2018-09-10", "endTime": "2018-10-01"},
    {"id": "32345678910","title": "问题", "status": 2, "createTime": 1536887397888, "startTime": "2018-09-10", "endTime": "2018-09-12"},
    {"id": "42345678910","title": "标题", "status": 0, "createTime": 1536887397173, "startTime": "", "endTime": ""}
  ]
}
//失败
{ 
  "code": 1,
  "msg": "server exception"
}
//token过期或未登录,下同
{ 
  "code": -1,
  "msg": "token expired or not login",
}

参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问卷ID
title String Y - 问卷标题
status int Y - 问卷状态:0.未发布,1.已发布,2.已结束
createTime long Y - 问卷创建时的时间戳
startTime String Y - 问卷开达日期,若未设置则是空字符串
endTime String Y - 问卷结束日期,若未设置则是空字符串

2.2 查看问卷

接口地址

domain/api/v1/admin/view-paper

请求方式

HTTP POST

请求示例

{
  "id": "4askfj1093jfi9348oueir932"
}

请求参数

参数 类型 是否必须 取值范围 说明
id String Y - 问卷id

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": {
   "id": "4askfj1093jfi9348oueir932",
   "title": "你幸福吗的调查",
   "status": 0,
   "createTime": 1536887397173,
   "startTime": "2018-09-12",
   "endTime": "2018-10-01",   
   "questions": [
      {"id": "1234", "questionType":1, "questionTitle": "你的收入是多少?", "questionOption": ["2000以下", "2000-5000", "5000+"]},
      {"id": "2234", "questionType":2, "questionTitle": "你家里有哪些家电?", "questionOption": ["冰箱", "洗衣机", "空调", "麻将机"]},
      {"id": "3234", "questionType":3, "questionTitle": "说一说你觉得最幸福的事", "questionOption": []}
    ]
   }
}

data参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问卷ID
title String Y - 问卷标题
status int Y - 问卷状态:0.未发布,1.已发布,2.已结束
createTime long Y - 问卷创建时的时间戳
startTime String Y - 问卷开达日期,若未设置则是空字符串
endTime String Y - 问卷结束日期,若未设置则是空字符串
questions Array Y - 问题列表

questions参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问题ID
questionType int Y - 问题类型:1.单选题,2.多选题,3.简答题
questionTitle String Y - 问题标题
questionOption Array Y - 问题选项:简答题为空的Array

2.3 新增问卷

接口地址

//与更新问卷共用接口
domain/api/v1/admin/update-paper

请求方式

HTTP POST

请求示例

{
  "title": "你幸福吗的调查",
  "startTime": "2018-09-12",
  "endTime": "2018-10-01",
  "status": 0,
  "questions": [
      {"questionType":1, "questionTitle": "你的收入是多少?", "questionOption": ["2000以下", "2000-5000", "5000+"]},
      {"questionType":2, "questionTitle": "你家里有哪些家电?", "questionOption": ["冰箱", "洗衣机", "空调", "麻将机"]},
      {"questionType":3, "questionTitle": "说一说你觉得最幸福的事", "questionOption": []}
  ]
}

请求参数

参数 类型 是否必须 取值范围 说明
title String Y 2-64个字符 问卷名称
startTime String Y 10个字符 开始日期,若未设置则是空字符串
endTime String Y 10个字符 结束日期,若未设置则是空字符串
status int Y 0或1 问卷状态,0:不发布仅保存;1:发布(此时start_time和end_time必须有合法取值);

questions参数说明

参数 类型 是否必须 取值范围 说明
questionType int Y - 问题类型:1.单选题,2.多选题,3.简答题
questionTitle String Y 1-128字符 问题标题
questionOption Array Y - 问题选项, 是选择题则至少有两个元素,简答题无元素

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": 0
}

参数说明

参数 类型 是否必须 取值范围 说明
code int Y - -1.token失效或未登录,0.请求成功,1.系统异常
msg String Y - 提示消息
data int N - 0.成功

2.4 修改问卷

接口地址

//与新增问卷共用接口,仅多一个参数id
domain/api/v1/admin/update-paper

请求方式

HTTP POST

请求示例

//页面中的数据来自view-paper接口,若管理员选择更新,则删除原id的paper的问题,再为该id的paper插入questions的新题目
{
   "id": "4askfj1093jfi9348oueir932",   //在add-paper中无此参数
   "title": "你幸福吗的调查",
   "status": 0,
   "startTime": "2018-09-12",
   "endTime": "2018-10-01",   
   "questions": [
      {"questionType":1, "questionTitle": "你的收入是多少?", "questionOption": ["2000以下", "2000-5000", "5000+"]},
      {"questionType":2, "questionTitle": "你家里有哪些家电?", "questionOption": ["冰箱", "洗衣机", "空调", "麻将机"]},
      {"questionType":3, "questionTitle": "说一说你觉得最幸福的事", "questionOption": []}
    ]
   }
}

请求参数

参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问卷ID
title String Y - 问卷标题
status int Y - 问卷状态:0.未发布,1.发布
startTime String Y - 问卷开达日期,若未设置则是空字符串
endTime String Y - 问卷结束日期,若未设置则是空字符串
questions Array Y - 问题列表

questions参数说明

参数 类型 是否必须 取值范围 说明
questionType int Y - 问题类型:1.单选题,2.多选题,3.简答题
questionTitle String Y - 问题标题
questionOption Array Y - 问题选项, 是选择题则至少有两个元素,简答题无元素

返回参数

返回示例

{
    "code": 0,
    "msg": "ok",
    "data": 0
}

data参数说明

参数 类型 是否必须 取值范围 说明
data int Y - 0.操作成功,1.操作失败,2.paper的id非法(无此问卷)

2.5 删除问卷

接口地址

domain/api/v1/admin/delete-paper

请求方式

HTTP POST

请求示例

{
  "idList": ["4askfj1093jfi9348oueir932", "sfs6f465vfsdf65sf654s6sf"]
}

请求参数

参数 类型 是否必须 取值范围 说明
idList Array Y - 问卷id列表,至少一个元素

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": 0
}

data参数说明

参数 类型 是否必须 取值范围 说明
data int Y - 0.操作成功,1.操作失败,2.paper的id非法(无此问卷)

2.6 用户查看问卷(答卷页面)

接口地址

domain/api/v1/user/view-paper?id=4askfj1093jfi9348oueir932

请求方式

HTTP GET

请求示例

请求参数

参数 类型 是否必须 取值范围 说明
id String Y - 问卷id

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": {
   "status": 0,     //只有status为1时才可作答
   "id": "4askfj1093jfi9348oueir932",
   "title": "你幸福吗的调查",   
   "createTime": 1536887397173,
   "startTime": "2018-09-12",
   "endTime": "2018-10-01",
   "questions": [
      {"id": "1234", "questionType":1, "questionTitle": "你的收入是多少?", "questionOption": ["2000以下", "2000-5000", "5000+"]},
      {"id": "2234", "questionType":2, "questionTitle": "你家里有哪些家电?", "questionOption": ["冰箱", "洗衣机", "空调", "麻将机"]},
      {"id": "3234", "questionType":3, "questionTitle": "说一说你觉得最幸福的事", "questionOption": []}
    ]
   }
}

data参数说明

参数 类型 是否必须 取值范围 说明
status int Y - 问卷状态:0.未发布,1.发布中(可作答),2.已结束,3.无此问卷,4.已发布但未到开始时间
id String N - 问卷ID
title String N - 问卷标题
createTime long N - 问卷创建时的时间戳
startTime String N - 问卷开达日期,若未设置则是空字符串
endTime String N - 问卷结束日期,若未设置则是空字符串
questions Array N - 问题列表

questions参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问题ID
questionType int Y - 问题类型:1.单选题,2.多选题,3.简答题
questionTitle String Y - 问题标题
questionOption Array Y - 问题选项, 是选择题则至少有两个元素,简答题无元素

补充说明

  1. status为必须参数
  2. 若status为0或3,则data中除status外无其他参数
  3. 若status为1,data中包含全部参数,用户可正常作答
  4. 若status为2或4,data中只包含title、startTime、endTime,用于提示用户

2.7 提交问卷答案

接口地址

domain/api/v1/user/commit-paper

请求方式

HTTP POST

请求示例

//页面中的数据来自view-paper接口
{
   "id": "4askfj1093jfi9348oueir932",
   "answers": [
      {"id": "1234", "questionType":1,  "answerContent": ["2000-5000"]},  //单选题,Array中仅一个元素
      {"id": "2234", "questionType":2,  "answerContent": ["空调", "麻将机"]},  //多选,Array中至少一个元素
      {"id": "3234", "questionType":3,  "answerContent": ["上了王者"]}  //简答
    ]
   }
}

请求参数

参数 类型 是否必须 取值范围 说明
id String Y - 问卷ID
answers Array Y - 答案列表

answers参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问题id
questionType int Y - 问题类型:1.单选,2.多选,3.简答
answerContent - Y 0-512字符 答题选项, 是选择题则至少有一个元素,简答题最多一个元素(不答则为无元素)

返回参数

返回示例

{
    "code": 0,
    "msg": "ok"
}

data参数说明

参数 类型 是否必须 取值范围 说明
code int Y - 0.操作成功,1.操作失败,2.问卷id无效

2.8 查看问卷数据

接口地址

domain/api/v1/admin/paper-data

请求方式

HTTP POST

请求示例

{
  "id": "4askfj1093jfi9348oueir932"
}

请求参数

参数 类型 是否必须 取值范围 说明
id String Y - 问卷id

返回参数

返回示例

{
  "code": 0,
  "msg": "ok",
  "data": {
   "id": "4askfj1093jfi9348oueir932",
   "title": "你幸福吗的调查",
   "status": 0,
   "createTime": 1536887397173,
   "startTime": "2018-09-12",
   "endTime": "2018-10-01",   
   "totalCount": 140,
   "questions": [
      {
           "id": "1234", "questionType":1, 
           "questionTitle": "你的收入是多少?", 
           "questionOption": ["2000以下", "2000-5000", "5000+"],
           "answerContent": [10, 30, 100]
      },
      {    
           "id": "2234", "questionType":2, 
           "questionTitle": "你家里有哪些家电?", 
           "questionOption": ["冰箱", "洗衣机", "空调", "麻将机"],
           "answerContent": [30, 40, 80, 20]
      },
      {   
           "id": "3234", "questionType":3, 
           "questionTitle": "说一说你觉得最幸福的事", 
           "questionOption": [],
           "answerContent": [
               "从青铜",
               "到黄金",
               "到王者"              
           ]
      },
      {   
          "id": "4234", "questionType":3, 
          "questionTitle": "说一说你觉得最难过的事", 
          "questionOption": [],
          "answerContent": [
              "从王者",               
              "到青铜" 
          ]
      }
    ]
   }
}

data参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问卷ID
title String Y - 问卷标题
status int Y - 问卷状态:0.未发布,1.已发布,2.已结束
createTime long Y - 问卷创建时的时间戳
startTime String Y - 问卷开达日期,若未设置则是空字符串
endTime String Y - 问卷结束日期,若未设置则是空字符串
totalCount int Y - 问卷被达总次数(人次)
questions Array Y - 问题列表

questions参数说明

参数 类型 是否必须 取值范围 说明
id String Y - 问题ID
questionType int Y - 问题类型:1.单选题,2.多选题,3.简答题
questionTitle String Y - 问题标题
questionOption Array Y - 问题选项,选择题是Array,简答题为空字符串
answerContent Array Y - 答案内容,选择题中的元素为int,简答题为String

2.9 下载问卷模板文件

文件地址

domain/template.xls

使用方式

<a href="url">下载模板</a>

2.10 上传问卷模板文件生成问卷

接口地址

domain/api/v1/admin/upload

请求方式

HTTP POST

请求示例

{
   "file": FILE    //文件
}

请求参数

参数 类型 是否必须 取值范围 说明
file FILE Y - 文件模板文件(Excel)

返回参数

返回示例

{
    "code": 0,
    "msg": "ok"
}

data参数说明

参数 类型 是否必须 取值范围 说明
code int Y - 0.操作成功,1.系统异常,2.文件不合法

常见返回值情形

code msg
-1 账号未登录或登录已经失效
0 ok
1 异常的具体信息
2 未选择文件!
2 文件类型不支持!
2 文件大小限制在100KB以内!
2 文件转换失败,请注意格式要求!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].