commit
ffe9f1c9bd
@ -0,0 +1,23 @@
|
|||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="exam" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/backend/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8 (2)" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/spring-boot-online-exam-master.iml" filepath="$PROJECT_DIR$/.idea/spring-boot-online-exam-master.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/web" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DdlMappings">
|
||||||
|
<mapping uuid="3f2269d9-40c7-4022-bc5b-913dfbbc6cdc" name="@localhost Mapping">
|
||||||
|
<data-sources db="52ce0e2c-1ca8-4087-a535-1632d84f6e81" ddl="7ee42c98-c0b3-46e7-9153-4802360edee6" />
|
||||||
|
</mapping>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,7 @@
|
|||||||
|
# build docker for project
|
||||||
|
FROM waterknife/centos-nginx-jdk8-mysql
|
||||||
|
WORKDIR /lsg/
|
||||||
|
COPY backend/target/*.jar ./app.jar
|
||||||
|
COPY entrypoint.sh ./
|
||||||
|
RUN chmod 777 entrypoint.sh
|
||||||
|
EXPOSE 9527
|
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019 Liang Shan Guang
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -0,0 +1,6 @@
|
|||||||
|
.idea/
|
||||||
|
*.iml
|
||||||
|
src/main/resources/public
|
||||||
|
src/main/resources/static
|
||||||
|
target/
|
||||||
|
dist/
|
After Width: | Height: | Size: 246 KiB |
After Width: | Height: | Size: 156 KiB |
@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.1.4.RELEASE</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.huawei.l00379880</groupId>
|
||||||
|
<artifactId>exam</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>exam</name>
|
||||||
|
<description>基于SpringBoot的在线考试系统</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger2</artifactId>
|
||||||
|
<version>2.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.springfox</groupId>
|
||||||
|
<artifactId>springfox-swagger-ui</artifactId>
|
||||||
|
<version>2.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 常用Java工具类 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>4.5.10</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FastDFS文件服务器的客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tobato</groupId>
|
||||||
|
<artifactId>fastdfs-client</artifactId>
|
||||||
|
<version>1.26.5</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- FastDFS文件传输需要 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- JWT相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt</artifactId>
|
||||||
|
<version>0.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
<version>2.8.4</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,12 @@
|
|||||||
|
package lsgwr.exam;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ExamApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ExamApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 允许跨域访问
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-17 00:11
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@Slf4j
|
||||||
|
public class CORSConf {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public WebMvcConfigurer corsConfigurer() {
|
||||||
|
return new WebMvcConfigurer() {
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
log.info("初始化 CORSConfiguration 配置");
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedHeaders("*")
|
||||||
|
.allowedMethods("*")
|
||||||
|
.allowedOrigins("*");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 拦截器配置
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-22 08:21
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.config;
|
||||||
|
|
||||||
|
import lsgwr.exam.interceptor.LoginInterceptor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class IntercepterConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoginInterceptor loginInterceptor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
|
// 拦截user下的api
|
||||||
|
registry.addInterceptor(loginInterceptor).addPathPatterns("/api/**");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package lsgwr.exam.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.web.server.ConfigurableWebServerFactory;
|
||||||
|
import org.springframework.boot.web.server.ErrorPage;
|
||||||
|
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class ServletConfig {
|
||||||
|
@Bean
|
||||||
|
public WebServerFactoryCustomizer<ConfigurableWebServerFactory> webServerFactoryCustomizer() {
|
||||||
|
return factory -> {
|
||||||
|
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/");
|
||||||
|
factory.addErrorPages(error404Page);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-14 08:20
|
||||||
|
* Description : 项目自定义配置
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.config;
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-14 08:20
|
||||||
|
* Description : 对外REST接口
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.controller;
|
@ -0,0 +1,21 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 注册接口参数
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-16 23:40
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RegisterDTO {
|
||||||
|
private String email;
|
||||||
|
private String password;
|
||||||
|
private String password2;
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 验证码
|
||||||
|
*/
|
||||||
|
private String captcha;
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-16 23:38
|
||||||
|
* Description : 用于接口数据传输
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.dto;
|
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 前端的操作
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 12:31
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
public class Action {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Integer actionId;
|
||||||
|
|
||||||
|
private String actionName;
|
||||||
|
|
||||||
|
private String actionDescription;
|
||||||
|
|
||||||
|
private Boolean defaultCheck;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 考试得分级别
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019/5/14 07:44
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
public class ExamRecordLevel {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Integer examRecordLevelId;
|
||||||
|
private String examRecordLevelName;
|
||||||
|
private String examRecordLevelDescription;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 前端页面实体类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 12:30
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
public class Page {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Integer pageId;
|
||||||
|
|
||||||
|
private String pageName;
|
||||||
|
|
||||||
|
private String pageDescription;
|
||||||
|
|
||||||
|
private String actionIds;
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 用户角色表
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019/5/14 07:49
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.entity;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
public class Role {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
private Integer roleId;
|
||||||
|
private String roleName;
|
||||||
|
private String roleDescription;
|
||||||
|
private String roleDetail;
|
||||||
|
/**
|
||||||
|
* 角色所能访问的页面的主键集合(用-连接起来字符串)
|
||||||
|
*/
|
||||||
|
private String rolePageIds;
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-14 00:34
|
||||||
|
* Description : 数据库实体类
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.entity;
|
@ -0,0 +1,29 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 问题类型的的枚举
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-18 12:00
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum QuestionEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题类型
|
||||||
|
*/
|
||||||
|
RADIO(1, "单选题"),
|
||||||
|
CHECK(2, "多选题"),
|
||||||
|
JUDGE(3, "判断题");
|
||||||
|
|
||||||
|
|
||||||
|
QuestionEnum(Integer id, String role) {
|
||||||
|
this.id = id;
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
private String role;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package lsgwr.exam.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum ResultEnum {
|
||||||
|
// 下面是本项目用到的所有错误码
|
||||||
|
REGISTER_SUCCESS(0, "注册成功"),
|
||||||
|
REGISTER_FAILED(-2, "注册失败"),
|
||||||
|
LOGIN_SUCCESS(0, "登录成功"),
|
||||||
|
LOGIN_FAILED(-1, "用户名或者密码错误"),
|
||||||
|
GET_INFO_SUCCESS(0, "获取用户信息成功"),
|
||||||
|
PARAM_ERR(1, "参数不正确"),
|
||||||
|
PRODUCT_NOT_EXIST(10, "用户不存在"),
|
||||||
|
PRODUCT_STOCK_ERR(11, "考试信息异常"),
|
||||||
|
ORDER_STATUS_ERR(14, "考试状态异常"),
|
||||||
|
ORDER_UPDATE_ERR(15, "考试更新异常"),
|
||||||
|
ORDER_DETAIL_EMPTY(16, "用户详情为空");
|
||||||
|
|
||||||
|
ResultEnum(Integer code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-17 07:50
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.exception;
|
||||||
|
|
||||||
|
import lsgwr.exam.enums.ResultEnum;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class ExamException extends RuntimeException {
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
public ExamException(ResultEnum resultEnum) {
|
||||||
|
super(resultEnum.getMessage());
|
||||||
|
this.code = resultEnum.getCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExamException( Integer code, String message) {
|
||||||
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-17 07:51
|
||||||
|
* Description : 自定义异常
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.exception;
|
@ -0,0 +1,17 @@
|
|||||||
|
package lsgwr.exam.qo;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* @note : 要下载的文件的路径
|
||||||
|
* @author : 梁山广
|
||||||
|
* @version : V1.0 at 2019/5/19 20:10
|
||||||
|
***********************************************************/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DownloadQo {
|
||||||
|
String path;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package lsgwr.exam.qo;
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* @Description : 文件传输的实体类
|
||||||
|
* @author : 梁山广
|
||||||
|
* @date : 2017/8/19 15:51
|
||||||
|
* @version : V1.0
|
||||||
|
***********************************************************/
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class UploadModel {
|
||||||
|
/**
|
||||||
|
* 要保存的文件
|
||||||
|
*/
|
||||||
|
private MultipartFile[] files;
|
||||||
|
/**
|
||||||
|
* 文件要存储的文件夹
|
||||||
|
*/
|
||||||
|
private String dir;
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @note : 用于请求参数的实体类(Query Object)
|
||||||
|
* @author : 梁山广
|
||||||
|
* @version : V1.0 at 2018/7/18 17:32
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.qo;
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : Action的数据库操作类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 12:39
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Action;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface ActionRepository extends JpaRepository<Action, Integer> {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:24
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.ExamRecordLevel;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface ExamRecordLevelRepository extends JpaRepository<ExamRecordLevel, Integer> {
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:23
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.ExamRecord;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExamRecordRepository extends JpaRepository<ExamRecord, String> {
|
||||||
|
/**
|
||||||
|
* 获取指定用户参加过的所有考试
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return 用户参加过的所有考试
|
||||||
|
*/
|
||||||
|
List<ExamRecord> findByExamJoinerIdOrderByExamJoinDateDesc(String userId);
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:22
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Exam;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ExamRepository extends JpaRepository<Exam, String> {
|
||||||
|
@Query("select e from Exam e order by e.updateTime desc")
|
||||||
|
List<Exam> findAll();
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 页面的数据库操作类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 12:41
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Page;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface PageRepository extends JpaRepository<Page, Integer> {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:25
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.QuestionCategory;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface QuestionCategoryRepository extends JpaRepository<QuestionCategory, Integer> {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:26
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.QuestionLevel;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface QuestionLevelRepository extends JpaRepository<QuestionLevel, Integer> {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:27
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.QuestionOption;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface QuestionOptionRepository extends JpaRepository<QuestionOption, String> {
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:25
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Question;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface QuestionRepository extends JpaRepository<Question, String> {
|
||||||
|
List<Question> findByQuestionTypeId(Integer id);
|
||||||
|
@Query("select q from Question q order by q.updateTime desc")
|
||||||
|
List<Question> findAll();
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description :
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:28
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.QuestionType;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface QuestionTypeRepository extends JpaRepository<QuestionType, Integer> {
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 角色的数据库操作类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-14 08:29
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.repository;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Role;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface RoleRepository extends JpaRepository<Role, Integer> {
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-14 08:20
|
||||||
|
* Description : 数据库操作接口
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.repository;
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-14 08:20
|
||||||
|
* Description : 服务接口与实现
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.service;
|
@ -0,0 +1,126 @@
|
|||||||
|
package lsgwr.exam.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.core.io.FileSystemResource;
|
||||||
|
import org.springframework.core.io.InputStreamResource;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/***********************************************************
|
||||||
|
* @note : 文件传输工具类
|
||||||
|
* @author : 梁山广
|
||||||
|
* @version : V1.0 at 2019/5/19 16:15
|
||||||
|
***********************************************************/
|
||||||
|
@Slf4j
|
||||||
|
public class FileTransUtil {
|
||||||
|
/**
|
||||||
|
* 上传单个文件
|
||||||
|
*
|
||||||
|
* @param uploadfile 上传的文件
|
||||||
|
* @param dir 文件要保存的文件夹
|
||||||
|
* @return 成功或者失败消息
|
||||||
|
*/
|
||||||
|
public static String uploadFile(MultipartFile uploadfile, String dir) {
|
||||||
|
log.info("Single file upload!");
|
||||||
|
if (uploadfile.isEmpty()) {
|
||||||
|
return "文件名不能为空";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
saveUploadedFiles(Arrays.asList(uploadfile), dir);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return "后台服务异常";
|
||||||
|
}
|
||||||
|
log.info("file upload successfully! " + dir);
|
||||||
|
return "文件上传成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多文件上传
|
||||||
|
*
|
||||||
|
* @param uploadfiles 要上传的多个文件
|
||||||
|
* @param dir 要保存的目录
|
||||||
|
* @return 成功或者失败消息
|
||||||
|
*/
|
||||||
|
public static String uploadFiles(MultipartFile[] uploadfiles, String dir) {
|
||||||
|
log.debug("Multiple file upload!");
|
||||||
|
String uploadedFileName = Arrays.stream(uploadfiles).map(x -> x.getOriginalFilename()).filter(x -> !StringUtils.isEmpty(x)).collect(Collectors.joining(" , "));
|
||||||
|
if (StringUtils.isEmpty(uploadedFileName)) {
|
||||||
|
return "文件名不能为空";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileTransUtil.saveUploadedFiles(Arrays.asList(uploadfiles), dir);
|
||||||
|
} catch (IOException e) {
|
||||||
|
return "后台服务异常";
|
||||||
|
}
|
||||||
|
log.info("file upload successfully! " + uploadedFileName);
|
||||||
|
return "文件上传成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件到指定路径
|
||||||
|
*
|
||||||
|
* @param files 上传的文件
|
||||||
|
* @throws IOException 文件保存异常
|
||||||
|
*/
|
||||||
|
public static void saveUploadedFiles(List<MultipartFile> files, String dir) throws IOException {
|
||||||
|
for (MultipartFile file : files) {
|
||||||
|
if (file.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!FileUtil.exist(dir)) {
|
||||||
|
// 文件夹不存在就创建
|
||||||
|
FileUtil.mkdir(dir);
|
||||||
|
}
|
||||||
|
byte[] bytes = file.getBytes();
|
||||||
|
String fileName = file.getOriginalFilename().replace("\\", "/");
|
||||||
|
if (fileName.lastIndexOf('/')>0){
|
||||||
|
// 上传文件夹的时候会有这种情况
|
||||||
|
String fileDir = dir + "/" + fileName.substring(0, fileName.lastIndexOf('/'));
|
||||||
|
if (!FileUtil.exist(fileDir)) {
|
||||||
|
// 文件夹不存在就创建,创建文件夹的时候会用到
|
||||||
|
FileUtil.mkdir(fileDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Path path = Paths.get(dir + "/" + fileName);
|
||||||
|
Files.write(path, bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件路径下载文件
|
||||||
|
*
|
||||||
|
* @param filePath 要现在的文件的路径
|
||||||
|
* @return 文件流
|
||||||
|
* @throws IOException 文件流读取异常
|
||||||
|
*/
|
||||||
|
public static ResponseEntity<InputStreamResource> downloadFile(String filePath) throws IOException {
|
||||||
|
log.info("downloading file : " + filePath);
|
||||||
|
FileSystemResource file = new FileSystemResource(filePath);
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||||
|
headers.add("Content-Disposition", String.format("attachment; filename=\"%s\"", new String(file.getFilename().getBytes("gbk"), "iso-8859-1")));
|
||||||
|
headers.add("Pragma", "no-cache");
|
||||||
|
headers.add("Expires", "0");
|
||||||
|
System.out.println(file.getFilename());
|
||||||
|
return ResponseEntity
|
||||||
|
.ok()
|
||||||
|
.headers(headers)
|
||||||
|
.contentLength(file.contentLength())
|
||||||
|
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||||
|
.body(new InputStreamResource(file.getInputStream()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 成功或失败时的消息返回
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-17 07:43
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.utils;
|
||||||
|
|
||||||
|
import lsgwr.exam.vo.ResultVO;
|
||||||
|
|
||||||
|
public class ResultVOUtil {
|
||||||
|
|
||||||
|
public static ResultVO success(Integer code, String msg, Object object) {
|
||||||
|
return new ResultVO(code, msg, object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultVO success(Object object) {
|
||||||
|
return new ResultVO(0, "成功", object);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResultVO success() {
|
||||||
|
return new ResultVO(0, "成功", null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static ResultVO error(Integer code, String msg) {
|
||||||
|
return new ResultVO(code, msg, null);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
/*
|
||||||
|
* Created By Liang Shan Guang at 2019-05-14 08:19
|
||||||
|
* Description : 工具类, 大部分工具都可以在Hutool中找到
|
||||||
|
*/
|
||||||
|
package lsgwr.exam.utils;
|
@ -0,0 +1,22 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : Action的前端展示类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 13:50
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ActionVo {
|
||||||
|
@JsonProperty("action")
|
||||||
|
private String actionName;
|
||||||
|
|
||||||
|
@JsonProperty("describe")
|
||||||
|
private String actionDescription;
|
||||||
|
|
||||||
|
@JsonProperty("defaultCheck")
|
||||||
|
private Boolean defaultCheck;
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 考试详情的实体类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-06-24 08:14
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Exam;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExamDetailVo {
|
||||||
|
/**
|
||||||
|
* 考试的基本信息对象
|
||||||
|
*/
|
||||||
|
private Exam exam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单选题的id数组
|
||||||
|
*/
|
||||||
|
private String[] radioIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多选题的id数组
|
||||||
|
*/
|
||||||
|
private String[] checkIds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断题的id数组
|
||||||
|
*/
|
||||||
|
private String[] judgeIds;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 按照单选、多选和判断题返回对应的问题列表
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-06-23 11:00
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExamQuestionTypeVo {
|
||||||
|
@JsonProperty("radios")
|
||||||
|
private List<ExamQuestionSelectVo> examQuestionSelectVoRadioList;
|
||||||
|
|
||||||
|
@JsonProperty("checks")
|
||||||
|
private List<ExamQuestionSelectVo> examQuestionSelectVoCheckList;
|
||||||
|
|
||||||
|
@JsonProperty("judges")
|
||||||
|
private List<ExamQuestionSelectVo> examQuestionSelectVoJudgeList;
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 考试记录VO
|
||||||
|
* @author : 梁山广(Liang Shan Guang)
|
||||||
|
* @date : 2019/10/25 7:42
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.Exam;
|
||||||
|
import lsgwr.exam.entity.ExamRecord;
|
||||||
|
import lsgwr.exam.entity.User;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExamRecordVo {
|
||||||
|
/**
|
||||||
|
* 当前考试记录对应的考试
|
||||||
|
*/
|
||||||
|
private Exam exam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前考试对应的内容
|
||||||
|
*/
|
||||||
|
private ExamRecord examRecord;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 参加考试的用户信息
|
||||||
|
*/
|
||||||
|
private User user;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : Action的前端展示类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 13:46
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PageVo {
|
||||||
|
@JsonProperty("actionEntitySet")
|
||||||
|
private List<ActionVo> actionVoList;
|
||||||
|
|
||||||
|
@JsonProperty("permissionId")
|
||||||
|
private String pageName;
|
||||||
|
|
||||||
|
@JsonProperty("permissionName")
|
||||||
|
private String pageDescription;
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 问题详情的实体类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-10-20 09:51
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import lsgwr.exam.entity.QuestionOption;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QuestionDetailVo {
|
||||||
|
/**
|
||||||
|
* 问题的id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试题目
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 问题的类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 问题的选项
|
||||||
|
*/
|
||||||
|
private List<QuestionOption> options;
|
||||||
|
/**
|
||||||
|
* 问题的答案,选项的id组成的数组
|
||||||
|
*/
|
||||||
|
private List<String> answers = new ArrayList<>();
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 问题选项的外层对象
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-06-02 20:23
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QuestionOptionCreateVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 问题的内容
|
||||||
|
*/
|
||||||
|
@JsonProperty("content")
|
||||||
|
private String questionOptionContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前的选项是否是问题大答案
|
||||||
|
*/
|
||||||
|
@JsonProperty("answer")
|
||||||
|
private Boolean answer = false;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 问题选项的自定义实体类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-06-01 09:45
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QuestionOptionVo {
|
||||||
|
@JsonProperty("id")
|
||||||
|
private String questionOptionId;
|
||||||
|
|
||||||
|
@JsonProperty("content")
|
||||||
|
private String questionOptionContent;
|
||||||
|
|
||||||
|
@JsonProperty("answer")
|
||||||
|
private Boolean answer = false;
|
||||||
|
|
||||||
|
@JsonProperty("description")
|
||||||
|
private String questionOptionDescription;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 前端创建问题时的下拉列表选择
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-06-03 07:35
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lsgwr.exam.entity.QuestionCategory;
|
||||||
|
import lsgwr.exam.entity.QuestionLevel;
|
||||||
|
import lsgwr.exam.entity.QuestionType;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class QuestionSelectionVo {
|
||||||
|
@JsonProperty("types")
|
||||||
|
private List<QuestionType> questionTypeList;
|
||||||
|
|
||||||
|
@JsonProperty("categories")
|
||||||
|
private List<QuestionCategory> questionCategoryList;
|
||||||
|
|
||||||
|
@JsonProperty("levels")
|
||||||
|
private List<QuestionLevel> questionLevelList;
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 响应结果的通用类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-17 07:42
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL) // 避免返回NULL的字段
|
||||||
|
public class ResultVO<T> {
|
||||||
|
|
||||||
|
|
||||||
|
public ResultVO(Integer code, String msg, T data) {
|
||||||
|
this.code = code;
|
||||||
|
this.msg = msg;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultVO() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误码
|
||||||
|
*/
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提示信息
|
||||||
|
*/
|
||||||
|
private String msg = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 具体内容
|
||||||
|
*/
|
||||||
|
private T data;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
/***********************************************************
|
||||||
|
* @Description : 角色的实体类
|
||||||
|
* @author : 梁山广(Laing Shan Guang)
|
||||||
|
* @date : 2019-05-26 13:27
|
||||||
|
* @email : liangshanguang2@gmail.com
|
||||||
|
***********************************************************/
|
||||||
|
package lsgwr.exam.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoleVo {
|
||||||
|
@JsonProperty("id")
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String roleDescription;
|
||||||
|
|
||||||
|
@JsonProperty("describe")
|
||||||
|
private String roleDetail;
|
||||||
|
|
||||||
|
@JsonProperty("permissions")
|
||||||
|
private List<PageVo> pageVoList;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue