增加AI出题

main
lj7788 2025-08-26 17:04:42 +08:00
parent 5257bcc5c8
commit 3b8419583f
526 changed files with 2314 additions and 53987 deletions

View File

@ -9,6 +9,7 @@
- 考试管理
- 题库管理
- 成绩统计
- AI题目生成
## 微信扫码登录配置
@ -39,6 +40,42 @@ wechat:
4. 在微信中确认登录
5. 系统将自动跳转到主页
## AI题目生成功能
系统集成了AI题目生成功能可以通过调用AI大模型API来自动生成各种类型的题目。
### 配置步骤
1. 在`exam-online-api/ruoyi-admin/src/main/resources/application.yml`中配置AI API参数
```yaml
ai:
# DeepSeek API配置
api-url: https://api.deepseek.com/v1/chat/completions
model-name: deepseek-chat
api-key: your_deepseek_api_key
connect-timeout: 30
read-timeout: 60
write-timeout: 30
# OpenRouter API配置
openrouter:
api-url: https://openrouter.ai/api/v1/chat/completions
model-name: deepseek/deepseek-v3-0324-free
api-key: your_openrouter_api_key
enabled: false
```
2. 执行数据库脚本`doc/ai_question_permissions.sql`添加相关权限
### 使用说明
1. 进入"题库管理"模块
2. 选择一个题库或创建新题库
3. 点击"AI生成题目"按钮
4. 配置生成参数并生成题目
5. 点击"保存到题库"将题目保存到当前题库中
## 技术栈
- 后端Spring Boot + MyBatis + Spring Security

View File

@ -0,0 +1,219 @@
# AI题目生成功能使用指南
## 功能概述
AI题目生成功能是yzexam在线考试系统的一个扩展功能通过调用AI大模型API如DeepSeek、OpenRouter等来自动生成各种类型的题目包括选择题、简答题和论述题等以提高教师出题效率丰富题库内容。
## 功能特性
- 支持生成多种题型:单选题、多选题、简答题、论述题
- 支持"全部题型"选项,一次性生成多种类型的题目
- 支持设置题目数量1-20题
- 支持设置题目难度等级:简单、中等、困难
- 支持指定知识点范围生成题目
- 支持指定关键词生成题目(多个关键词用逗号分隔)
- 支持指定题目方向生成题目(理解、应用、分析、综合、评价)
- 支持指定适合学段生成题目(初中、高中、大学、研究生)
- 生成的题目可直接保存到题库中
## 技术架构
### 后端技术栈
- Java + Spring Boot
- OkHttp用于调用AI API
- FastJSON用于JSON处理
- MyBatis用于数据库操作
### 前端技术栈
- Vue.js 2.x
- Element UI
- Axios
## 部署配置
### 1. 配置AI API密钥
在[application.yml](file:///Volumes/macData/code/yzexam/examapi/ruoyi-admin/src/main/resources/application.yml)中配置AI API相关信息
```yaml
# AI题目生成配置
ai:
# DeepSeek API配置
api-url: https://api.deepseek.com/v1/chat/completions
model-name: deepseek-chat
api-key: ${AI_API_KEY:}
connect-timeout: 30
read-timeout: 60
write-timeout: 30
# OpenRouter API配置
openrouter:
api-url: https://openrouter.ai/api/v1/chat/completions
model-name: deepseek/deepseek-v3-0324-free
api-key: ${OPENROUTER_API_KEY:}
enabled: false
```
### 2. 设置环境变量
可以选择使用DeepSeek API或OpenRouter API
使用DeepSeek API
```bash
export AI_API_KEY="your_deepseek_api_key_here"
```
使用OpenRouter API
```bash
export OPENROUTER_API_KEY="your_openrouter_api_key_here"
```
### 3. 数据库权限配置
运行[ai_question_permissions.sql](file:///Volumes/macData/code/yzexam/doc/ai_question_permissions.sql)脚本为系统添加AI题目生成功能所需的菜单和权限。
## 使用说明
### 1. 访问AI题目生成功能
1. 登录系统后,进入"题库管理"模块
2. 选择一个题库或创建新题库
3. 点击"AI生成题目"按钮
4. 系统将跳转到AI题目生成页面
### 2. 配置生成参数
在AI题目生成页面中配置以下参数
- **题目类型**:选择要生成的题目类型(单选题、多选题、简答题、论述题或全部题型)
- **题目数量**输入要生成的题目数量1-20题
- **知识点范围**:输入题目涉及的知识点范围
- **关键词**:输入与题目相关的关键词(多个关键词用逗号分隔)
- **难易程度**:选择题目的难度等级(简单、中等、困难)
- **题目方向**:选择题目的考查方向(理解、应用、分析、综合、评价)
- **适合学段**:选择题目适合的学段(初中、高中、大学、研究生)
### 3. 生成题目
点击"生成题目"按钮系统将调用AI API生成指定类型的题目并在页面中显示生成结果。
### 4. 保存题目
生成题目后,可以点击"保存到题库"按钮将题目保存到当前题库中。
## API接口说明
### 1. 生成选择题
```
POST /ai/questions/choice
Content-Type: application/json
{
"knowledgePoint": "马克思主义基本原理",
"keywords": "唯物主义,辩证法,实践",
"difficulty": "medium",
"direction": "comprehension",
"gradeLevel": "college",
"multiple": false
}
```
### 2. 生成简答题
```
POST /ai/questions/short-answer
Content-Type: application/json
{
"knowledgePoint": "社会主义核心价值观",
"keywords": "爱国,敬业,诚信,友善",
"difficulty": "medium",
"direction": "application",
"gradeLevel": "college"
}
```
### 3. 生成论述题
```
POST /ai/questions/essay
Content-Type: application/json
{
"knowledgePoint": "新时代党的建设",
"keywords": "全面从严治党,反腐倡康,制度建设",
"difficulty": "hard",
"direction": "evaluation",
"gradeLevel": "postgraduate"
}
```
### 4. 批量生成题目
```
POST /ai/questions/batch
Content-Type: application/json
{
"questionType": "choice",
"count": 5,
"knowledgePoint": "马克思主义基本原理",
"keywords": "唯物主义,辩证法,实践",
"difficulty": "medium",
"direction": "comprehension",
"gradeLevel": "college",
"multiple": false
}
```
### 5. 保存AI生成的题目
```
POST /ai/questions/save
Content-Type: application/json
{
"questions": [...], // AI生成的题目列表
"bankCode": "题库代码"
}
```
## 安全注意事项
1. API密钥应妥善保管不要硬编码在代码中
2. 建议通过环境变量或配置中心管理API密钥
3. 实际部署时应添加身份验证和权限控制
4. 添加API调用频率限制防止滥用
## 常见问题
### 1. 生成题目失败
可能原因:
- API密钥配置错误
- 网络连接问题
- AI API服务不可用
解决方案:
- 检查API密钥是否正确配置
- 检查网络连接是否正常
- 确认AI API服务是否可用
### 2. 保存题目失败
可能原因:
- 题库代码不正确
- 数据库连接问题
- 权限不足
解决方案:
- 检查题库代码是否正确
- 检查数据库连接是否正常
- 确认用户是否有保存题目的权限
## 扩展建议
1. 添加题目质量评估功能
2. 实现题目去重机制
3. 添加题目版本管理
4. 支持批量生成题目
5. 添加题目审核流程
6. 实现题目分类管理
7. 添加题目搜索功能
8. 支持题目导出为不同格式

View File

@ -0,0 +1,19 @@
-- 添加AI题目生成功能的权限
-- 菜单权限
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES ('AI题目生成', 2000, 1, 'ai/generator', 'questions/ai/AIQuestionGenerator', 1, 0, 'C', '0', '0', 'ai:questions:generate', 'magic', 'admin', sysdate(), '', null, 'AI题目生成菜单');
-- 按钮权限
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES ('生成题目', 2001, 1, '#', '', 1, 0, 'F', '0', '0', 'ai:questions:generate', '#', 'admin', sysdate(), '', null, '');
INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`)
VALUES ('保存题目', 2001, 2, '#', '', 1, 0, 'F', '0', '0', 'ai:questions:save', '#', 'admin', sysdate(), '', null, '');
-- 获取新插入菜单的ID
SET @menu_id = LAST_INSERT_ID();
-- 角色权限关联(给管理员角色分配权限)
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (1, 2001);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (1, 2002);
INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) VALUES (1, 2003);

View File

@ -1,44 +0,0 @@
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2018 RuoYi
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.

View File

@ -1,85 +0,0 @@
## 平台简介
若依是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
* 前端采用Vue、Element UI。
* 后端采用Spring Boot、Spring Security、Redis & Jwt。
* 权限认证使用Jwt支持多终端认证系统。
* 支持加载动态权限菜单,多方式轻松权限控制。
* 高效率开发,使用代码生成器可以一键生成前后端代码。
* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast)Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。
* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud)
* 特别鸣谢:[element](https://github.com/ElemeFE/element)[vue-element-admin](https://github.com/PanJiaChen/vue-element-admin)[eladmin-web](https://github.com/elunez/eladmin-web)。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)  
* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)  
## 内置功能
1. 用户管理:用户是系统操作者,该功能主要完成系统用户配置。
2. 部门管理:配置系统组织机构(公司、部门、小组),树结构展现支持数据权限。
3. 岗位管理:配置系统用户所属担任职务。
4. 菜单管理:配置系统菜单,操作权限,按钮权限标识等。
5. 角色管理:角色菜单权限分配、设置角色按机构进行数据范围权限划分。
6. 字典管理:对系统中经常使用的一些较为固定的数据进行维护。
7. 参数管理:对系统动态配置常用参数。
8. 通知公告:系统通知公告信息发布维护。
9. 操作日志:系统正常操作日志记录和查询;系统异常信息日志记录和查询。
10. 登录日志:系统登录日志记录查询包含登录异常。
11. 在线用户:当前系统中活跃用户状态监控。
12. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志。
13. 代码生成前后端代码的生成java、html、xml、sql支持CRUD下载 。
14. 系统接口根据业务代码自动生成相关的api接口文档。
15. 服务监控监视当前系统CPU、内存、磁盘、堆栈等相关信息。
16. 缓存监控:对系统的缓存信息查询,命令统计等。
17. 在线构建器拖动表单元素生成相应的HTML代码。
18. 连接池监视监视当前系统数据库连接池状态可进行分析SQL找出系统性能瓶颈。
## 在线体验
- admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip
文档地址http://doc.ruoyi.vip
## 演示图
<table>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/cd1f90be5f2684f4560c9519c0f2a232ee8.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/1cbcf0e6f257c7d3a063c0e3f2ff989e4b3.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8074972883b5ba0622e13246738ebba237a.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-9f88719cdfca9af2e58b352a20e23d43b12.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-39bf2584ec3a529b0d5a3b70d15c9b37646.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-936ec82d1f4872e1bc980927654b6007307.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-b2d62ceb95d2dd9b3fbe157bb70d26001e9.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-d67451d308b7a79ad6819723396f7c3d77a.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/5e8c387724954459291aafd5eb52b456f53.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/644e78da53c2e92a95dfda4f76e6d117c4b.jpg"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-8370a0d02977eebf6dbf854c8450293c937.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-49003ed83f60f633e7153609a53a2b644f7.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/up-d4fe726319ece268d4746602c39cffc0621.png"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-c195234bbcd30be6927f037a6755e6ab69c.png"/></td>
</tr>
<tr>
<td><img src="https://oscimg.oschina.net/oscnet/b6115bc8c31de52951982e509930b20684a.jpg"/></td>
<td><img src="https://oscimg.oschina.net/oscnet/up-5e4daac0bb59612c5038448acbcef235e3a.png"/></td>
</tr>
</table>
## 若依前后端分离交流群
QQ群 [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) 点击按钮入群。

View File

@ -1 +0,0 @@
mvn clean

View File

@ -1,12 +0,0 @@
@echo off
echo.
echo [信息] 清理生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

View File

@ -1 +0,0 @@
mvn clean package -Dmaven.test.skip=true

View File

@ -1,12 +0,0 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

View File

@ -1 +0,0 @@
java -Dfile.encoding=utf-8 -Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m -jar ruoyi-admin/target/examapi.jar

View File

@ -1,14 +0,0 @@
@echo off
echo.
echo [信息] 运行Web工程。
echo.
cd %~dp0
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% ruoyi-admin.jar
cd bin
pause

View File

@ -1,198 +0,0 @@
<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>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.8.6</version>
</parent>
<!-- <groupId>com.hig</groupId> -->
<artifactId>hig-application</artifactId>
<name>hig-application</name>
<description>应用扩展包</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.83</fastjson.version>
<lombok.version>1.18.30</lombok.version>
<oracle.version>12.2.0.1.0</oracle.version>
<druid.version>1.2.20</druid.version>
<mybatis.version>2.3.2</mybatis.version>
<gson.version>2.10.1</gson.version>
<jasypt.version>3.0.5</jasypt.version>
<quartz.version>2.3.2</quartz.version>
<httpclient.version>4.5.14</httpclient.version>
<httpmime.version>4.5.14</httpmime.version>
<httpcore.version>4.4.16</httpcore.version>
<commons-codec.version>1.15</commons-codec.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-lang.version>3.12.0</commons-lang.version>
<weixin-java-cp.version>4.5.0</weixin-java-cp.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- 发war包的时侯排除tomcat -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.25</version>
</dependency>
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>${jasypt.version}</version>
</dependency>
<!-- 添加Scheduled坐标 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- Sprng tx 坐标 这个是控制事务的-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--oracle驱动-->
<!-- <dependency>-->
<!-- <groupId>com.oracle</groupId>-->
<!-- <artifactId>ojdbc8</artifactId>-->
<!-- <version>${oracle.version}</version>-->
<!-- </dependency> -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!-- Quartz坐标 -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${quartz.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>${httpmime.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>${httpcore.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-cp</artifactId>
<version>${weixin-java-cp.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-framework</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>hig-common</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,63 +0,0 @@
package com.hig.cms.utils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.web.multipart.MultipartFile;
public class FileUpload {
/**
*
*
* @param file
* @return
*/
public static String writeUploadFile(MultipartFile file,String path) {
String filename = file.getOriginalFilename();
System.out.println("原始文件名:" + filename);
File fileDir = new File(path);
if (!fileDir.exists())
fileDir.mkdirs();
String extname = FilenameUtils.getExtension(filename);
String allowImgFormat = "gif,jpg,jpeg,png";
if (!allowImgFormat.contains(extname.toLowerCase())) {
return "NOT_IMAGE";
}
filename = Math.abs(file.getOriginalFilename().hashCode()) + RandomUtils.createRandomString( 4 ) + "." + extname;
InputStream input = null;
FileOutputStream fos = null;
try {
input = file.getInputStream();
fos = new FileOutputStream(path + "/" + filename);
IOUtils.copy(input, fos);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
return filename;
}
}

View File

@ -1,35 +0,0 @@
package com.hig.cms.utils;
public class RandomUtils {
private static final String charlist = "0123456789";
public static String createRandomString(int len) {
String str = new String();
for (int i = 0; i < len; i++) {
str += charlist.charAt(getRandom(charlist.length()));
}
return str;
}
public static int getRandom(int mod) {
if (mod < 1) {
return 0;
}
int ret = getInt() % mod;
return ret;
}
private static int getInt() {
int ret = Math.abs(Long.valueOf(getRandomNumString()).intValue());
return ret;
}
private static String getRandomNumString() {
double d = Math.random();
String dStr = String.valueOf(d).replaceAll("[^\\d]", "");
if (dStr.length() > 1) {
dStr = dStr.substring(0, dStr.length() - 1);
}
return dStr;
}
}

View File

@ -1,50 +0,0 @@
package com.hig.exam.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hig.exam.domain.ExamTaskData;
import com.hig.exam.service.IExamTaskDataService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@RestController
@RequestMapping("/exam/examtask")
public class ExamTaskDataController extends BaseController{
@Autowired
private IExamTaskDataService examTaskDataService;
@PostMapping("/save")
public AjaxResult save(@RequestBody ExamTaskData examTaskData)
{
// 数据判断
if (examTaskData == null) {
return AjaxResult.error(-1, "传入数据为空!");
}
if (examTaskData.getExamTaskManager() == null) {
return AjaxResult.error(-1, "传入任务属性信息为空!");
}
if (examTaskData.getTaskQuestionsList() == null || examTaskData.getTaskQuestionsList().size() == 0) {
return AjaxResult.error(-1, "传入题库信息为空!");
}
if (examTaskData.getTaskGroupList() == null || examTaskData.getTaskGroupList().size() == 0) {
return AjaxResult.error(-1, "传入人员分组信息为空!");
}
try
{
examTaskDataService.saveData(examTaskData);
}
catch(Exception e) {
return AjaxResult.error(-1, e.getMessage());
}
return AjaxResult.success("保存成功");
}
}

View File

@ -1,106 +0,0 @@
package com.hig.exam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.exam.domain.ExamTaskGroup;
import com.hig.exam.service.IExamTaskGroupService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-02-10
*/
@RestController
@RequestMapping("/exam/taskgroup")
public class ExamTaskGroupController extends BaseController
{
@Autowired
private IExamTaskGroupService examTaskGroupService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(ExamTaskGroup examTaskGroup)
{
startPage();
List<ExamTaskGroup> list = examTaskGroupService.selectExamTaskGroupList(examTaskGroup);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/export")
public AjaxResult export(ExamTaskGroup examTaskGroup)
{
List<ExamTaskGroup> list = examTaskGroupService.selectExamTaskGroupList(examTaskGroup);
ExcelUtil<ExamTaskGroup> util = new ExcelUtil<ExamTaskGroup>(ExamTaskGroup.class);
return util.exportExcel(list, "任务分组数据");
}
/**
*
*/
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examTaskGroupService.selectExamTaskGroupById(examCode));
}
/**
*
*/
@PostMapping
public AjaxResult add(@RequestBody ExamTaskGroup examTaskGroup)
{
return toAjax(examTaskGroupService.insertExamTaskGroup(examTaskGroup));
}
/**
*
*/
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamTaskGroup examTaskGroup)
{
return toAjax(examTaskGroupService.updateExamTaskGroup(examTaskGroup));
}
@PostMapping("/batchupdate")
public AjaxResult batchUpdate(@RequestBody List<ExamTaskGroup> examTaskGroupList)
{
try
{
examTaskGroupService.batchUpdateExamTaskGroup(examTaskGroupList);
}
catch(Exception e) {
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success();
}
/**
*
*/
@GetMapping("/delete/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examTaskGroupService.deleteExamTaskGroupByIds(examCodes));
}
}

View File

@ -1,172 +0,0 @@
package com.hig.exam.controller;
import java.util.List;
import java.util.Map;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.hig.cms.utils.FileUpload;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.exam.domain.ExamTaskPicture;
import com.hig.exam.service.IExamTaskManagerService;
import com.hig.exam.service.IExamTaskPictureService;
import com.hig.questions.domain.ExamBankPicture;
import com.hig.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-01-06
*/
@RestController
@RequestMapping("/exam/examtask")
public class ExamTaskManagerController extends BaseController
{
@Value("${cms.exam.photo-path:/photo/exam}")
private String photopath;
@Autowired
private IExamTaskManagerService examTaskManagerService;
@Autowired
private TokenService tokenService;
@Autowired
private IExamTaskPictureService examTaskPictureService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:examtask:list')")
@GetMapping("/list")
public TableDataInfo list(ExamTaskManager examTaskManager)
{
if (examTaskManager.getStartTime() != null) {
examTaskManager.setStartDateText(DateUtils.toShortDateString(examTaskManager.getStartTime()));
}
if (examTaskManager.getEndTime() != null) {
examTaskManager.setEndDateText(DateUtils.toShortDateString(examTaskManager.getEndTime()));
}
startPage();
List<ExamTaskManager> list = examTaskManagerService.selectExamTaskManagerList(examTaskManager);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:examtask:export')")
@Log(title = "创建考试", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamTaskManager examTaskManager)
{
List<ExamTaskManager> list = examTaskManagerService.selectExamTaskManagerList(examTaskManager);
ExcelUtil<ExamTaskManager> util = new ExcelUtil<ExamTaskManager>(ExamTaskManager.class);
return util.exportExcel(list, "创建考试数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:examtask:query')")
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examTaskManagerService.selectExamTaskManagerById(examCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:examtask:add')")
@Log(title = "创建考试", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody ExamTaskManager examTaskManager)
{
return toAjax(examTaskManagerService.insertExamTaskManager(examTaskManager));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:examtask:edit')")
@Log(title = "创建考试", businessType = BusinessType.UPDATE)
// @PutMapping
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamTaskManager examTaskManager)
{
return toAjax(examTaskManagerService.updateExamTaskManager(examTaskManager));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:examtask:remove')")
@Log(title = "创建考试", businessType = BusinessType.DELETE)
@GetMapping("/delete/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examTaskManagerService.deleteExamTaskManagerByIds(examCodes));
}
/**
*
*/
@PostMapping("/uploadphoto/{examCodes}")
public AjaxResult uploadPhoto(@PathVariable String examCodes,
@RequestParam("file") MultipartFile file)
{
// 取得原始文件名
String originalfile = file.getOriginalFilename();
// 拼接路径
String path = RuoYiConfig.getProfile() + photopath;
String filename = FileUpload.writeUploadFile(file,path);
String fileurl = photopath + "/" + filename;
int count = 0;
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
ExamTaskPicture examTaskPicture = new ExamTaskPicture(examCodes,path,fileurl,filename,originalfile,loginUser.getUser().getUserName());
System.out.println("examTaskPicture:" + examTaskPicture.toString());
try
{
examTaskPictureService.deleteExamTaskPictureById(examCodes);
count = examTaskPictureService.insertExamTaskPicture(examTaskPicture);
}
catch(Exception e)
{
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(examTaskPicture);
}
}

View File

@ -1,111 +0,0 @@
package com.hig.exam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.exam.domain.ExamTaskPerson;
import com.hig.exam.service.IExamTaskPersonService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-01-06
*/
@RestController
@RequestMapping("/exam/taskperson")
public class ExamTaskPersonController extends BaseController
{
@Autowired
private IExamTaskPersonService examTaskPersonService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:taskperson:list')")
@GetMapping("/list")
public TableDataInfo list(ExamTaskPerson examTaskPerson)
{
startPage();
List<ExamTaskPerson> list = examTaskPersonService.selectExamTaskPersonList(examTaskPerson);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:taskperson:export')")
@Log(title = "考试人员", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamTaskPerson examTaskPerson)
{
List<ExamTaskPerson> list = examTaskPersonService.selectExamTaskPersonList(examTaskPerson);
ExcelUtil<ExamTaskPerson> util = new ExcelUtil<ExamTaskPerson>(ExamTaskPerson.class);
return util.exportExcel(list, "考试人员数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:taskperson:query')")
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examTaskPersonService.selectExamTaskPersonById(examCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:taskperson:add')")
@Log(title = "考试人员", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody ExamTaskPerson examTaskPerson)
{
return toAjax(examTaskPersonService.insertExamTaskPerson(examTaskPerson));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:taskperson:edit')")
@Log(title = "考试人员", businessType = BusinessType.UPDATE)
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamTaskPerson examTaskPerson)
{
return toAjax(examTaskPersonService.updateExamTaskPerson(examTaskPerson));
}
/**
*
*/
@PostMapping("/starttime")
public AjaxResult updateStartTime(@RequestBody ExamTaskPerson examTaskPerson)
{
return toAjax(examTaskPersonService.updateStartTime(examTaskPerson));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:taskperson:remove')")
@Log(title = "考试人员", businessType = BusinessType.DELETE)
@GetMapping("/delete/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examTaskPersonService.deleteExamTaskPersonByIds(examCodes));
}
}

View File

@ -1,103 +0,0 @@
package com.hig.exam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.exam.domain.ExamTaskPicture;
import com.hig.exam.service.IExamTaskPictureService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-01-18
*/
@RestController
@RequestMapping("/exam/exampicture")
public class ExamTaskPictureController extends BaseController
{
@Autowired
private IExamTaskPictureService examTaskPictureService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:exampicture:list')")
@GetMapping("/list")
public TableDataInfo list(ExamTaskPicture examTaskPicture)
{
startPage();
List<ExamTaskPicture> list = examTaskPictureService.selectExamTaskPictureList(examTaskPicture);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:exampicture:export')")
@Log(title = "考试任务图片管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamTaskPicture examTaskPicture)
{
List<ExamTaskPicture> list = examTaskPictureService.selectExamTaskPictureList(examTaskPicture);
ExcelUtil<ExamTaskPicture> util = new ExcelUtil<ExamTaskPicture>(ExamTaskPicture.class);
return util.exportExcel(list, "考试任务图片管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:exampicture:query')")
@GetMapping(value = "/{photoCode}")
public AjaxResult getInfo(@PathVariable("photoCode") String photoCode)
{
return AjaxResult.success(examTaskPictureService.selectExamTaskPictureById(photoCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:exampicture:add')")
@Log(title = "考试任务图片管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamTaskPicture examTaskPicture)
{
return toAjax(examTaskPictureService.insertExamTaskPicture(examTaskPicture));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:exampicture:edit')")
@Log(title = "考试任务图片管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamTaskPicture examTaskPicture)
{
return toAjax(examTaskPictureService.updateExamTaskPicture(examTaskPicture));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('exam:exampicture:remove')")
@Log(title = "考试任务图片管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{photoCodes}")
public AjaxResult remove(@PathVariable String[] photoCodes)
{
return toAjax(examTaskPictureService.deleteExamTaskPictureByIds(photoCodes));
}
}

View File

@ -1,100 +0,0 @@
package com.hig.exam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.exam.domain.ExamTaskQuestions;
import com.hig.exam.service.IExamTaskQuestionsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-02-10
*/
@RestController
@RequestMapping("/exam/taskquestions")
public class ExamTaskQuestionsController extends BaseController
{
@Autowired
private IExamTaskQuestionsService examTaskQuestionsService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(ExamTaskQuestions examTaskQuestions)
{
startPage();
List<ExamTaskQuestions> list = examTaskQuestionsService.selectExamTaskQuestionsList(examTaskQuestions);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/export")
public AjaxResult export(ExamTaskQuestions examTaskQuestions)
{
List<ExamTaskQuestions> list = examTaskQuestionsService.selectExamTaskQuestionsList(examTaskQuestions);
ExcelUtil<ExamTaskQuestions> util = new ExcelUtil<ExamTaskQuestions>(ExamTaskQuestions.class);
return util.exportExcel(list, "任务题目数据");
}
/**
*
*/
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examTaskQuestionsService.selectExamTaskQuestionsById(examCode));
}
@PostMapping("/batchupdate")
public AjaxResult batchUpdate(@RequestBody List<ExamTaskQuestions> examTaskQuestionsList)
{
int count = -1;
try
{
count = examTaskQuestionsService.batchUpdateExamTaskQuestions(examTaskQuestionsList);
}
catch(Exception e) {
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success("更新成功");
}
/**
*
*/
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamTaskQuestions examTaskQuestions)
{
return toAjax(examTaskQuestionsService.updateExamTaskQuestions(examTaskQuestions));
}
/**
*
*/
@GetMapping("/delete/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examTaskQuestionsService.deleteExamTaskQuestionsByIds(examCodes));
}
}

View File

@ -1,13 +0,0 @@
package com.hig.exam.domain;
import java.util.List;
import lombok.Data;
@Data
public class ExamTaskData {
private ExamTaskManager examTaskManager;
private List<ExamTaskGroup> taskGroupList;
private List<ExamTaskQuestions> taskQuestionsList;
}

View File

@ -1,66 +0,0 @@
package com.hig.exam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_task_group
*
* @author qnsdt
* @date 2023-02-10
*/
public class ExamTaskGroup extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试代码 */
@Excel(name = "考试代码")
private String examCode;
/** 分组代码 */
@Excel(name = "分组代码")
private String groupCode;
/** 排序编号 */
@Excel(name = "排序编号")
private Long orderId;
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setGroupCode(String groupCode)
{
this.groupCode = groupCode;
}
public String getGroupCode()
{
return groupCode;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;
}
public Long getOrderId()
{
return orderId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examCode", getExamCode())
.append("groupCode", getGroupCode())
.append("orderId", getOrderId())
.toString();
}
}

View File

@ -1,270 +0,0 @@
package com.hig.exam.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_task_manager
*
* @author qnsdt
* @date 2023-01-06
*/
public class ExamTaskManager extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试序号 */
@Excel(name = "考试序号")
private Long examId;
/** 考试代码 */
@Excel(name = "考试代码")
private String examCode;
/** 考试名称 */
@Excel(name = "考试名称")
private String examName;
/** 考试说明 */
@Excel(name = "考试说明")
private String examDescribe;
/** 组卷方式 */
@Excel(name = "组卷方式")
private String buildType;
/** 强制抽卷 */
@Excel(name = "强制抽卷")
private String forceDone;
/** 考试题库 */
@Excel(name = "考试题库")
private String examBank;
/** 考试题库文字 */
@Excel(name = "考试题库文字")
private String examBankText;
@Excel(name = "考试类型1 固定时间考试 2固定时间段考试")
private Integer examType;
public Integer getExamType() {
return examType;
}
public void setExamType(Integer examType) {
this.examType = examType;
}
public Integer getExamTimes() {
return examTimes;
}
public void setExamTimes(Integer examTimes) {
this.examTimes = examTimes;
}
@Excel(name = "考试次数")
private Integer examTimes;
/** 图片链接 */
@Excel(name = "图片链接")
private String pictureUrl;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 考试时长 */
@Excel(name = "考试时长")
private String examDuration;
/** 状态 */
@Excel(name = "状态")
private Long status;
private String startDateText;
public String getStartDateText() {
return startDateText;
}
public void setStartDateText(String startDateText) {
this.startDateText = startDateText;
}
private String endDateText;
public String getEndDateText() {
return endDateText;
}
public void setEndDateText(String endDateText) {
this.endDateText = endDateText;
}
/** 创建部门 */
private Long createDept;
public void setExamId(Long examId)
{
this.examId = examId;
}
public Long getExamId()
{
return examId;
}
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setExamName(String examName)
{
this.examName = examName;
}
public String getExamName()
{
return examName;
}
public void setExamDescribe(String examDescribe)
{
this.examDescribe = examDescribe;
}
public String getExamDescribe()
{
return examDescribe;
}
public void setBuildType(String buildType)
{
this.buildType = buildType;
}
public String getBuildType()
{
return buildType;
}
public void setForceDone(String forceDone)
{
this.forceDone = forceDone;
}
public String getForceDone()
{
return forceDone;
}
public void setExamBank(String examBank)
{
this.examBank = examBank;
}
public String getExamBank()
{
return examBank;
}
public void setPictureUrl(String pictureUrl)
{
this.pictureUrl = pictureUrl;
}
public void setExamBankText(String examBankText)
{
this.examBankText = examBankText;
}
public String getExamBankText()
{
return examBankText;
}
public String getPictureUrl()
{
return pictureUrl;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setExamDuration(String examDuration)
{
this.examDuration = examDuration;
}
public String getExamDuration()
{
return examDuration;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public void setCreateDept(Long createDept)
{
this.createDept = createDept;
}
public Long getCreateDept()
{
return createDept;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examId", getExamId())
.append("examCode", getExamCode())
.append("examName", getExamName())
.append("examDescribe", getExamDescribe())
.append("buildType", getBuildType())
.append("forceDone", getForceDone())
.append("examBank", getExamBank())
.append("examBankText", getExamBankText())
.append("pictureUrl", getPictureUrl())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("examDuration", getExamDuration())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createDept", getCreateDept())
.append("createTime", getCreateTime())
.toString();
}
}

View File

@ -1,111 +0,0 @@
package com.hig.exam.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_task_person
*
* @author qnsdt
* @date 2023-02-14
*/
public class ExamTaskPerson extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试代码 */
@Excel(name = "考试代码")
private String examCode;
/** 考试人员 */
@Excel(name = "考试人员")
private String userCode;
/** 个人任务码 */
private String taskCode;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 状态 */
@Excel(name = "状态")
private Long status;
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setuserCode(String userCode)
{
this.userCode = userCode;
}
public String getuserCode()
{
return userCode;
}
public void setTaskCode(String taskCode)
{
this.taskCode = taskCode;
}
public String getTaskCode()
{
return taskCode;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examCode", getExamCode())
.append("userCode", getuserCode())
.append("taskCode", getTaskCode())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("status", getStatus())
.toString();
}
}

View File

@ -1,145 +0,0 @@
package com.hig.exam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_task_picture
*
* @author qnsdt
* @date 2023-01-18
*/
public class ExamTaskPicture extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 图片序号 */
private Long photoId;
/** 图片代码 */
private String photoCode;
/** 文档代码 */
@Excel(name = "文档代码")
private String photoPath;
/** 图片链接 */
@Excel(name = "图片链接")
private String photoUrl;
/** 文件名称 */
@Excel(name = "文件名称")
private String fileName;
/** 原始名称 */
@Excel(name = "原始名称")
private String originalName;
private String createBy;
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
/** 状态 */
@Excel(name = "状态")
private Long status;
public void setPhotoId(Long photoId)
{
this.photoId = photoId;
}
public Long getPhotoId()
{
return photoId;
}
public void setPhotoCode(String photoCode)
{
this.photoCode = photoCode;
}
public String getPhotoCode()
{
return photoCode;
}
public void setPhotoPath(String photoPath)
{
this.photoPath = photoPath;
}
public String getPhotoPath()
{
return photoPath;
}
public void setPhotoUrl(String photoUrl)
{
this.photoUrl = photoUrl;
}
public String getPhotoUrl()
{
return photoUrl;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
public String getFileName()
{
return fileName;
}
public void setOriginalName(String originalName)
{
this.originalName = originalName;
}
public String getOriginalName()
{
return originalName;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public ExamTaskPicture(String photoCode, String photoPath, String photoUrl, String fileName, String originalName,
String createBy) {
super();
this.photoCode = photoCode;
this.photoPath = photoPath;
this.photoUrl = photoUrl;
this.fileName = fileName;
this.originalName = originalName;
this.createBy = createBy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("photoId", getPhotoId())
.append("photoCode", getPhotoCode())
.append("photoPath", getPhotoPath())
.append("photoUrl", getPhotoUrl())
.append("fileName", getFileName())
.append("originalName", getOriginalName())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("status", getStatus())
.toString();
}
}

View File

@ -1,66 +0,0 @@
package com.hig.exam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_task_questions
*
* @author qnsdt
* @date 2023-02-15
*/
public class ExamTaskQuestions extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试代码 */
@Excel(name = "考试代码")
private String examCode;
/** 题目代码 */
@Excel(name = "题目代码")
private String questionsCode;
/** 题号 */
@Excel(name = "题号")
private int questionsNumber;
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setQuestionsCode(String questionsCode)
{
this.questionsCode = questionsCode;
}
public String getQuestionsCode()
{
return questionsCode;
}
public void setQuestionsNumber(int questionsNumber)
{
this.questionsNumber = questionsNumber;
}
public int getQuestionsNumber()
{
return questionsNumber;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examCode", getExamCode())
.append("questionsCode", getQuestionsCode())
.append("questionsNumber", getQuestionsNumber())
.toString();
}
}

View File

@ -1,61 +0,0 @@
package com.hig.exam.mapper;
import java.util.List;
import com.hig.exam.domain.ExamTaskGroup;
/**
* Mapper
*
* @author qnsdt
* @date 2023-02-10
*/
public interface ExamTaskGroupMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskGroup selectExamTaskGroupById(String examCode);
/**
*
*
* @param examTaskGroup
* @return
*/
public List<ExamTaskGroup> selectExamTaskGroupList(ExamTaskGroup examTaskGroup);
/**
*
*
* @param examTaskGroup
* @return
*/
public int insertExamTaskGroup(ExamTaskGroup examTaskGroup);
/**
*
*
* @param examTaskGroup
* @return
*/
public int updateExamTaskGroup(ExamTaskGroup examTaskGroup);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskGroupById(String examCode);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskGroupByIds(String[] examCodes);
}

View File

@ -1,69 +0,0 @@
package com.hig.exam.mapper;
import java.util.List;
import com.hig.exam.domain.ExamTaskManager;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
*
* @author qnsdt
* @date 2023-01-06
*/
public interface ExamTaskManagerMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskManager selectExamTaskManagerById(String examCode);
/**
*
*
* @param examTaskManager
* @return
*/
public List<ExamTaskManager> selectExamTaskManagerList(ExamTaskManager examTaskManager);
/**
*
*
* @param examTaskManager
* @return
*/
public int insertExamTaskManager(ExamTaskManager examTaskManager);
/**
*
*
* @param examTaskManager
* @return
*/
public int updateExamTaskManager(ExamTaskManager examTaskManager);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskManagerById(String examCode);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskManagerByIds(String[] examCodes);
public List<ExamTaskManager> selectCurrentExam(@Param("userCode") String userCode);
public List<ExamTaskManager> countExamScore(@Param("examCodeList") List<String> examCodeList);
public List<ExamTaskManager> groupExamTypeCount(@Param("examCodeList") List<String> examCodeList);
}

View File

@ -1,93 +0,0 @@
package com.hig.exam.mapper;
import java.util.List;
import com.hig.exam.domain.ExamTaskPerson;
/**
* Mapper
*
* @author qnsdt
* @date 2023-01-06
*/
public interface ExamTaskPersonMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskPerson selectExamTaskPersonById(String examCode);
/**
*
*
* @param examTaskPerson
* @return
*/
public ExamTaskPerson selectExamTaskPerson(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public List<ExamTaskPerson> selectExamTaskPersonList(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int insertExamTaskPerson(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int batchInsertPerson(String examCode);
/**
*
*
* @param examTaskPerson
* @return
*/
public int updateExamTaskPerson(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int updateStartTime(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int updateDoneStatus(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskPersonById(String examCode);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskPersonByIds(String[] examCodes);
}

View File

@ -1,61 +0,0 @@
package com.hig.exam.mapper;
import java.util.List;
import com.hig.exam.domain.ExamTaskPicture;
/**
* Mapper
*
* @author qnsdt
* @date 2023-01-18
*/
public interface ExamTaskPictureMapper
{
/**
*
*
* @param photoCode ID
* @return
*/
public ExamTaskPicture selectExamTaskPictureById(String photoCode);
/**
*
*
* @param examTaskPicture
* @return
*/
public List<ExamTaskPicture> selectExamTaskPictureList(ExamTaskPicture examTaskPicture);
/**
*
*
* @param examTaskPicture
* @return
*/
public int insertExamTaskPicture(ExamTaskPicture examTaskPicture);
/**
*
*
* @param examTaskPicture
* @return
*/
public int updateExamTaskPicture(ExamTaskPicture examTaskPicture);
/**
*
*
* @param photoCode ID
* @return
*/
public int deleteExamTaskPictureById(String photoCode);
/**
*
*
* @param photoCodes ID
* @return
*/
public int deleteExamTaskPictureByIds(String[] photoCodes);
}

View File

@ -1,61 +0,0 @@
package com.hig.exam.mapper;
import java.util.List;
import com.hig.exam.domain.ExamTaskQuestions;
/**
* Mapper
*
* @author qnsdt
* @date 2023-02-10
*/
public interface ExamTaskQuestionsMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskQuestions selectExamTaskQuestionsById(String examCode);
/**
*
*
* @param examTaskQuestions
* @return
*/
public List<ExamTaskQuestions> selectExamTaskQuestionsList(ExamTaskQuestions examTaskQuestions);
/**
*
*
* @param examTaskQuestions
* @return
*/
public int insertExamTaskQuestions(ExamTaskQuestions examTaskQuestions);
/**
*
*
* @param examTaskQuestions
* @return
*/
public int updateExamTaskQuestions(ExamTaskQuestions examTaskQuestions);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskQuestionsById(String examCode);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskQuestionsByIds(String[] examCodes);
}

View File

@ -1,7 +0,0 @@
package com.hig.exam.service;
import com.hig.exam.domain.ExamTaskData;
public interface IExamTaskDataService {
public int saveData(ExamTaskData examTaskData) throws Exception;
}

View File

@ -1,70 +0,0 @@
package com.hig.exam.service;
import java.util.List;
import com.hig.exam.domain.ExamTaskGroup;
/**
* Service
*
* @author qnsdt
* @date 2023-02-10
*/
public interface IExamTaskGroupService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskGroup selectExamTaskGroupById(String examCode);
/**
*
*
* @param examTaskGroup
* @return
*/
public List<ExamTaskGroup> selectExamTaskGroupList(ExamTaskGroup examTaskGroup);
/**
*
*
* @param examTaskGroup
* @return
*/
public int insertExamTaskGroup(ExamTaskGroup examTaskGroup);
/**
*
*
* @param examTaskGroup
* @return
*/
public int updateExamTaskGroup(ExamTaskGroup examTaskGroup);
/**
*
*
* @param examTaskGroup
* @return
* @throws Exception
*/
public int batchUpdateExamTaskGroup(List<ExamTaskGroup> examTaskGroupList) throws Exception;
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskGroupByIds(String[] examCodes);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskGroupById(String examCode);
}

View File

@ -1,69 +0,0 @@
package com.hig.exam.service;
import java.util.List;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.onlineexam.domain.dto.ExamTitleData;
/**
* Service
*
* @author qnsdt
* @date 2023-01-06
*/
public interface IExamTaskManagerService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskManager selectExamTaskManagerById(String examCode);
/**
*
*
* @param examTaskManager
* @return
*/
public List<ExamTaskManager> selectExamTaskManagerList(ExamTaskManager examTaskManager);
/**
*
*
* @param examTaskManager
* @return
*/
public int insertExamTaskManager(ExamTaskManager examTaskManager);
/**
*
*
* @param examTaskManager
* @return
*/
public int updateExamTaskManager(ExamTaskManager examTaskManager);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskManagerByIds(String[] examCodes);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskManagerById(String examCode);
/**
*
* @param userCode
* @return
*/
public List<ExamTitleData> selectCurrentExam(String userCode);
}

View File

@ -1,97 +0,0 @@
package com.hig.exam.service;
import java.util.List;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.exam.domain.ExamTaskPerson;
/**
* Service
*
* @author qnsdt
* @date 2023-01-06
*/
public interface IExamTaskPersonService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskPerson selectExamTaskPersonById(String examCode);
/**
*
*
* @param examTaskPerson
* @return
*/
public ExamTaskPerson selectExamTaskPerson(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public List<ExamTaskPerson> selectExamTaskPersonList(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int insertExamTaskPerson(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int batchInsertPerson(String examCode);
/**
*
*
* @param examTaskPerson
* @return
*/
public int updateExamTaskPerson(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int updateStartTime(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examTaskPerson
* @return
*/
public int updateDoneStatus(ExamTaskPerson examTaskPerson);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskPersonByIds(String[] examCodes);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskPersonById(String examCode);
}

View File

@ -1,61 +0,0 @@
package com.hig.exam.service;
import java.util.List;
import com.hig.exam.domain.ExamTaskPicture;
/**
* Service
*
* @author qnsdt
* @date 2023-01-18
*/
public interface IExamTaskPictureService
{
/**
*
*
* @param photoCode ID
* @return
*/
public ExamTaskPicture selectExamTaskPictureById(String photoCode);
/**
*
*
* @param examTaskPicture
* @return
*/
public List<ExamTaskPicture> selectExamTaskPictureList(ExamTaskPicture examTaskPicture);
/**
*
*
* @param examTaskPicture
* @return
*/
public int insertExamTaskPicture(ExamTaskPicture examTaskPicture);
/**
*
*
* @param examTaskPicture
* @return
*/
public int updateExamTaskPicture(ExamTaskPicture examTaskPicture);
/**
*
*
* @param photoCodes ID
* @return
*/
public int deleteExamTaskPictureByIds(String[] photoCodes);
/**
*
*
* @param photoCode ID
* @return
*/
public int deleteExamTaskPictureById(String photoCode);
}

View File

@ -1,63 +0,0 @@
package com.hig.exam.service;
import java.util.List;
import com.hig.exam.domain.ExamTaskQuestions;
/**
* Service
*
* @author qnsdt
* @date 2023-02-10
*/
public interface IExamTaskQuestionsService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskQuestions selectExamTaskQuestionsById(String examCode);
/**
*
*
* @param examTaskQuestions
* @return
*/
public List<ExamTaskQuestions> selectExamTaskQuestionsList(ExamTaskQuestions examTaskQuestions);
/**
*
*
* @param examTaskQuestions
* @return
*/
public int insertExamTaskQuestions(ExamTaskQuestions examTaskQuestions);
public int batchUpdateExamTaskQuestions(List<ExamTaskQuestions> examTaskQuestionsList) throws Exception;
/**
*
*
* @param examTaskQuestions
* @return
*/
public int updateExamTaskQuestions(ExamTaskQuestions examTaskQuestions);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskQuestionsByIds(String[] examCodes);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskQuestionsById(String examCode);
}

View File

@ -1,95 +0,0 @@
package com.hig.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.exam.domain.ExamTaskData;
import com.hig.exam.domain.ExamTaskGroup;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.exam.domain.ExamTaskQuestions;
import com.hig.exam.service.IExamTaskDataService;
import com.hig.exam.service.IExamTaskGroupService;
import com.hig.exam.service.IExamTaskManagerService;
import com.hig.exam.service.IExamTaskPersonService;
import com.hig.exam.service.IExamTaskQuestionsService;
@Service
public class ExamTaskDataServiceImpl implements IExamTaskDataService {
@Autowired
private IExamTaskGroupService examTaskGroupService;
@Autowired
private IExamTaskManagerService examTaskManagerService;
@Autowired
private IExamTaskQuestionsService examTaskQuestionsService;
@Autowired
private IExamTaskPersonService examTaskPersonService;
@Override
public int saveData(ExamTaskData examTaskData) throws Exception {
// TODO Auto-generated method stub
ExamTaskManager examTaskManager = examTaskData.getExamTaskManager();
int count = 0;
try
{
// 安全删除
examTaskManagerService.deleteExamTaskManagerById(examTaskManager.getExamCode());
// 保存数据
count = examTaskManagerService.insertExamTaskManager(examTaskManager);
}
catch(Exception e) {
throw new Exception("保存属性出错,信息:" + e.getMessage());
}
List<ExamTaskQuestions> questionsList = examTaskData.getTaskQuestionsList();
// 安全删除
examTaskQuestionsService.deleteExamTaskQuestionsById(examTaskManager.getExamCode());
for(ExamTaskQuestions examTaskQuestions: questionsList) {
try
{
count = examTaskQuestionsService.insertExamTaskQuestions(examTaskQuestions);
}
catch(Exception e) {
throw new Exception("保存题目信息出错,信息:" + e.getMessage());
}
}
List<ExamTaskGroup> groupList = examTaskData.getTaskGroupList();
// 安全删除
examTaskGroupService.deleteExamTaskGroupById(examTaskManager.getExamCode());
for (ExamTaskGroup examTaskGroup: groupList) {
try
{
count = examTaskGroupService.insertExamTaskGroup(examTaskGroup);
}
catch(Exception e) {
throw new Exception("保存分组信息出错,信息:" + e.getMessage());
}
}
// 安全删除
examTaskPersonService.deleteExamTaskPersonById(examTaskManager.getExamCode());
try
{
count = examTaskPersonService.batchInsertPerson(examTaskManager.getExamCode());
}
catch(Exception e) {
throw new Exception("保存考试人员信息出错,信息:" + e.getMessage());
}
return 1;
}
}

View File

@ -1,127 +0,0 @@
package com.hig.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.exam.mapper.ExamTaskGroupMapper;
import com.hig.exam.domain.ExamTaskGroup;
import com.hig.exam.service.IExamTaskGroupService;
import com.hig.exam.service.IExamTaskPersonService;
/**
* Service
*
* @author qnsdt
* @date 2023-02-10
*/
@Service
public class ExamTaskGroupServiceImpl implements IExamTaskGroupService
{
@Autowired
private ExamTaskGroupMapper examTaskGroupMapper;
@Autowired
private IExamTaskPersonService examTaskPersonService;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamTaskGroup selectExamTaskGroupById(String examCode)
{
return examTaskGroupMapper.selectExamTaskGroupById(examCode);
}
/**
*
*
* @param examTaskGroup
* @return
*/
@Override
public List<ExamTaskGroup> selectExamTaskGroupList(ExamTaskGroup examTaskGroup)
{
return examTaskGroupMapper.selectExamTaskGroupList(examTaskGroup);
}
/**
*
*
* @param examTaskGroup
* @return
*/
@Override
public int insertExamTaskGroup(ExamTaskGroup examTaskGroup)
{
return examTaskGroupMapper.insertExamTaskGroup(examTaskGroup);
}
/**
*
*
* @param examTaskGroup
* @return
*/
@Override
public int updateExamTaskGroup(ExamTaskGroup examTaskGroup)
{
return examTaskGroupMapper.updateExamTaskGroup(examTaskGroup);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamTaskGroupByIds(String[] examCodes)
{
return examTaskGroupMapper.deleteExamTaskGroupByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamTaskGroupById(String examCode)
{
return examTaskGroupMapper.deleteExamTaskGroupById(examCode);
}
@Override
public int batchUpdateExamTaskGroup(List<ExamTaskGroup> examTaskGroupList) throws Exception {
// TODO Auto-generated method stub
// 安全删除
int count = 0;
String examCode = examTaskGroupList.get(0).getExamCode();
examTaskGroupMapper.deleteExamTaskGroupById(examCode);
for (ExamTaskGroup examTaskGroup: examTaskGroupList) {
try
{
count = examTaskGroupMapper.insertExamTaskGroup(examTaskGroup);
}
catch(Exception e) {
throw new Exception("保存分组信息出错,信息:" + e.getMessage());
}
}
// 安全删除
examTaskPersonService.deleteExamTaskPersonById(examCode);
try
{
count = examTaskPersonService.batchInsertPerson(examCode);
}
catch(Exception e) {
throw new Exception("保存考试人员信息出错,信息:" + e.getMessage());
}
return 1;
}
}

View File

@ -1,184 +0,0 @@
package com.hig.exam.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.bean.BeanUtil;
import com.hig.onlineexam.domain.dto.ExamTitleData;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.exam.mapper.ExamTaskManagerMapper;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.exam.service.IExamTaskGroupService;
import com.hig.exam.service.IExamTaskManagerService;
import com.hig.exam.service.IExamTaskPersonService;
import com.hig.exam.service.IExamTaskQuestionsService;
/**
* Service
*
* @author qnsdt
* @date 2023-01-06
*/
@Service
public class ExamTaskManagerServiceImpl implements IExamTaskManagerService
{
@Autowired
private ExamTaskManagerMapper examTaskManagerMapper;
@Autowired
private IExamTaskGroupService examTaskGroupService;
@Autowired
private IExamTaskQuestionsService examTaskQuestionsService;
@Autowired
private IExamTaskPersonService examTaskPersonService;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamTaskManager selectExamTaskManagerById(String examCode)
{
return examTaskManagerMapper.selectExamTaskManagerById(examCode);
}
/**
*
*
* @param examTaskManager
* @return
*/
@Override
public List<ExamTaskManager> selectExamTaskManagerList(ExamTaskManager examTaskManager)
{
return examTaskManagerMapper.selectExamTaskManagerList(examTaskManager);
}
/**
*
*
* @param examTaskManager
* @return
*/
@Override
public int insertExamTaskManager(ExamTaskManager examTaskManager)
{
examTaskManager.setCreateTime(DateUtils.getNowDate());
return examTaskManagerMapper.insertExamTaskManager(examTaskManager);
}
/**
*
*
* @param examTaskManager
* @return
*/
@Override
public int updateExamTaskManager(ExamTaskManager examTaskManager)
{
return examTaskManagerMapper.updateExamTaskManager(examTaskManager);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamTaskManagerByIds(String[] examCodes)
{
// 删除题目
examTaskQuestionsService.deleteExamTaskQuestionsByIds(examCodes);
// 删除人员分组
examTaskGroupService.deleteExamTaskGroupByIds(examCodes);
// 删除人员
examTaskPersonService.deleteExamTaskPersonByIds(examCodes);
return examTaskManagerMapper.deleteExamTaskManagerByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamTaskManagerById(String examCode)
{
return examTaskManagerMapper.deleteExamTaskManagerById(examCode);
}
/**
*
* @param userCode
* @return
*/
@Override
public List<ExamTitleData> selectCurrentExam(String userCode) {
//先根据当前时间和startDate和endDate过滤一下
List<ExamTaskManager> list=examTaskManagerMapper.selectCurrentExam(userCode);
List<ExamTitleData> retList=new ArrayList<>();
List<String> examCodeList=new ArrayList<>();
for(ExamTaskManager examTaskManager:list){
if(examTaskManager.getExamType()==1){
if(!checkCanRun(examTaskManager)){
continue;
}
}else{
}
ExamTitleData ed=new ExamTitleData();
examCodeList.add(examTaskManager.getExamCode());
// 使用 Hutool 的 BeanUtil.copyProperties 方法复制属性
BeanUtil.copyProperties(examTaskManager, ed);
retList.add(ed);
}
List<ExamTaskManager> listScore=examTaskManagerMapper.countExamScore(examCodeList);
List<ExamTaskManager> listTypeCount=examTaskManagerMapper.groupExamTypeCount(examCodeList);
for(ExamTitleData item :retList){
List<ExamTaskManager> tmp= listScore.stream().filter(d->d.getExamCode().equals(item.getExamCode())).collect(Collectors.toList());
if(tmp.size()>0){
item.setQuestionsScore(tmp.get(0).getExamType());
}
tmp=listTypeCount.stream().filter(d->d.getExamCode().equals(item.getExamCode()) && d.getExamId()==1).collect(Collectors.toList());
if(tmp.size()>0){
item.setJudgeNumber(tmp.get(0).getExamType());
}
tmp=listTypeCount.stream().filter(d->d.getExamCode().equals(item.getExamCode()) && d.getExamId()==2).collect(Collectors.toList());
if(tmp.size()>0){
item.setRadioNumber(tmp.get(0).getExamType());
}
tmp=listTypeCount.stream().filter(d->d.getExamCode().equals(item.getExamCode()) && d.getExamId()==3).collect(Collectors.toList());
if(tmp.size()>0){
item.setChoiceNumber(tmp.get(0).getExamType());
}
}
return retList;
}
private boolean checkCanRun(ExamTaskManager examTaskManager) {
//开始时间+考试时长 小于当前时间表示考试已发结束,大于表示还可能继续考试
DateTime dtStart=new DateTime( examTaskManager.getStartTime());
String sp=examTaskManager.getExamDuration();
String[] timeParts = sp.split(":");
int hours = Integer.parseInt(timeParts[0]);
int minutes = Integer.parseInt(timeParts[1]);
// 计算结束时间
DateTime endDateTime = dtStart.offset(DateField.HOUR_OF_DAY, hours)
.offset(DateField.MINUTE, minutes);
return endDateTime.isAfter(DateUtils.getNowDate());
}
}

View File

@ -1,125 +0,0 @@
package com.hig.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.exam.mapper.ExamTaskPersonMapper;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.exam.domain.ExamTaskPerson;
import com.hig.exam.service.IExamTaskPersonService;
/**
* Service
*
* @author qnsdt
* @date 2023-01-06
*/
@Service
public class ExamTaskPersonServiceImpl implements IExamTaskPersonService
{
@Autowired
private ExamTaskPersonMapper examTaskPersonMapper;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamTaskPerson selectExamTaskPersonById(String examCode)
{
return examTaskPersonMapper.selectExamTaskPersonById(examCode);
}
/**
*
*
* @param examTaskPerson
* @return
*/
@Override
public List<ExamTaskPerson> selectExamTaskPersonList(ExamTaskPerson examTaskPerson)
{
return examTaskPersonMapper.selectExamTaskPersonList(examTaskPerson);
}
/**
*
*
* @param examTaskPerson
* @return
*/
@Override
public int insertExamTaskPerson(ExamTaskPerson examTaskPerson)
{
return examTaskPersonMapper.insertExamTaskPerson(examTaskPerson);
}
/**
*
*
* @param examTaskPerson
* @return
*/
@Override
public int updateExamTaskPerson(ExamTaskPerson examTaskPerson)
{
return examTaskPersonMapper.updateExamTaskPerson(examTaskPerson);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamTaskPersonByIds(String[] examCodes)
{
return examTaskPersonMapper.deleteExamTaskPersonByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamTaskPersonById(String examCode)
{
return examTaskPersonMapper.deleteExamTaskPersonById(examCode);
}
@Override
public int batchInsertPerson(String examCode) {
// TODO Auto-generated method stub
return examTaskPersonMapper.batchInsertPerson(examCode);
}
@Override
public int updateStartTime(ExamTaskPerson examTaskPerson) {
// TODO Auto-generated method stub
ExamTaskPerson taskPerson = examTaskPersonMapper.selectExamTaskPerson(examTaskPerson);
if (taskPerson != null && taskPerson.getStartTime() == null) {
examTaskPersonMapper.updateStartTime(examTaskPerson);
}
return 1;
}
@Override
public ExamTaskPerson selectExamTaskPerson(ExamTaskPerson examTaskPerson) {
// TODO Auto-generated method stub
return examTaskPersonMapper.selectExamTaskPerson(examTaskPerson);
}
@Override
public int updateDoneStatus(ExamTaskPerson examTaskPerson) {
// TODO Auto-generated method stub
return examTaskPersonMapper.updateDoneStatus(examTaskPerson);
}
}

View File

@ -1,95 +0,0 @@
package com.hig.exam.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.exam.mapper.ExamTaskPictureMapper;
import com.hig.exam.domain.ExamTaskPicture;
import com.hig.exam.service.IExamTaskPictureService;
/**
* Service
*
* @author qnsdt
* @date 2023-01-18
*/
@Service
public class ExamTaskPictureServiceImpl implements IExamTaskPictureService
{
@Autowired
private ExamTaskPictureMapper examTaskPictureMapper;
/**
*
*
* @param photoCode ID
* @return
*/
@Override
public ExamTaskPicture selectExamTaskPictureById(String photoCode)
{
return examTaskPictureMapper.selectExamTaskPictureById(photoCode);
}
/**
*
*
* @param examTaskPicture
* @return
*/
@Override
public List<ExamTaskPicture> selectExamTaskPictureList(ExamTaskPicture examTaskPicture)
{
return examTaskPictureMapper.selectExamTaskPictureList(examTaskPicture);
}
/**
*
*
* @param examTaskPicture
* @return
*/
@Override
public int insertExamTaskPicture(ExamTaskPicture examTaskPicture)
{
examTaskPicture.setCreateTime(DateUtils.getNowDate());
return examTaskPictureMapper.insertExamTaskPicture(examTaskPicture);
}
/**
*
*
* @param examTaskPicture
* @return
*/
@Override
public int updateExamTaskPicture(ExamTaskPicture examTaskPicture)
{
return examTaskPictureMapper.updateExamTaskPicture(examTaskPicture);
}
/**
*
*
* @param photoCodes ID
* @return
*/
@Override
public int deleteExamTaskPictureByIds(String[] photoCodes)
{
return examTaskPictureMapper.deleteExamTaskPictureByIds(photoCodes);
}
/**
*
*
* @param photoCode ID
* @return
*/
@Override
public int deleteExamTaskPictureById(String photoCode)
{
return examTaskPictureMapper.deleteExamTaskPictureById(photoCode);
}
}

View File

@ -1,113 +0,0 @@
package com.hig.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.exam.mapper.ExamTaskQuestionsMapper;
import com.hig.exam.domain.ExamTaskQuestions;
import com.hig.exam.service.IExamTaskQuestionsService;
/**
* Service
*
* @author qnsdt
* @date 2023-02-10
*/
@Service
public class ExamTaskQuestionsServiceImpl implements IExamTaskQuestionsService
{
@Autowired
private ExamTaskQuestionsMapper examTaskQuestionsMapper;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamTaskQuestions selectExamTaskQuestionsById(String examCode)
{
return examTaskQuestionsMapper.selectExamTaskQuestionsById(examCode);
}
/**
*
*
* @param examTaskQuestions
* @return
*/
@Override
public List<ExamTaskQuestions> selectExamTaskQuestionsList(ExamTaskQuestions examTaskQuestions)
{
return examTaskQuestionsMapper.selectExamTaskQuestionsList(examTaskQuestions);
}
/**
*
*
* @param examTaskQuestions
* @return
*/
@Override
public int insertExamTaskQuestions(ExamTaskQuestions examTaskQuestions)
{
return examTaskQuestionsMapper.insertExamTaskQuestions(examTaskQuestions);
}
/**
*
*
* @param examTaskQuestions
* @return
*/
@Override
public int updateExamTaskQuestions(ExamTaskQuestions examTaskQuestions)
{
return examTaskQuestionsMapper.updateExamTaskQuestions(examTaskQuestions);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamTaskQuestionsByIds(String[] examCodes)
{
return examTaskQuestionsMapper.deleteExamTaskQuestionsByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamTaskQuestionsById(String examCode)
{
return examTaskQuestionsMapper.deleteExamTaskQuestionsById(examCode);
}
@Override
public int batchUpdateExamTaskQuestions(List<ExamTaskQuestions> examTaskQuestionsList) throws Exception {
// TODO Auto-generated method stub
// 安全删除
examTaskQuestionsMapper.deleteExamTaskQuestionsById(examTaskQuestionsList.get(0).getExamCode());
for(ExamTaskQuestions examTaskQuestions: examTaskQuestionsList) {
try
{
examTaskQuestionsMapper.insertExamTaskQuestions(examTaskQuestions);
}
catch(Exception e) {
throw new Exception("保存题目信息出错,信息:" + e.getMessage());
}
}
return 1;
}
}

View File

@ -1,7 +0,0 @@
package com.hig.fms.common;
public class NotSameFileExpection extends Exception {
public NotSameFileExpection() {
super("File MD5 Different");
}
}

View File

@ -1,196 +0,0 @@
package com.hig.fms.controller;
import java.io.File;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.cms.utils.FileUpload;
import com.hig.fms.common.NotSameFileExpection;
import com.hig.fms.domain.FmsFiles;
import com.hig.fms.domain.MultipartFileParam;
import com.hig.fms.domain.dto.StdOut;
import com.hig.fms.service.ChunkService;
import com.hig.fms.service.IFmsFilesService;
import com.hig.utils.DateUtils;
import com.hig.utils.UUIDGenerator;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2021-12-17
*/
@RestController
@RequestMapping("/fms/files")
public class FmsFilesController extends BaseController
{
@Autowired
private IFmsFilesService fmsFilesService;
@Autowired
ChunkService chunkService;
@Value("${cms.files.photo-path}")
private String filespath;
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:files:list')")
@GetMapping("/list")
public TableDataInfo list(FmsFiles fmsFiles)
{
startPage();
List<FmsFiles> list = fmsFilesService.selectFmsFilesList(fmsFiles);
// System.out.println("文件列表:" + list.toString());
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:files:export')")
@Log(title = "文件管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(FmsFiles fmsFiles)
{
List<FmsFiles> list = fmsFilesService.selectFmsFilesList(fmsFiles);
ExcelUtil<FmsFiles> util = new ExcelUtil<FmsFiles>(FmsFiles.class);
return util.exportExcel(list, "文件管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:files:query')")
@GetMapping(value = "/{fileId}")
public AjaxResult getInfo(@PathVariable("fileId") Long fileId)
{
return AjaxResult.success(fmsFilesService.selectFmsFilesById(fileId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:files:add')")
@Log(title = "文件管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody FmsFiles fmsFiles)
{
return toAjax(fmsFilesService.insertFmsFiles(fmsFiles));
}
@RequestMapping("/chunkupload/{guid}/{username}")
// @PostMapping(value = "/chunkupload")
public StdOut chunkUpload(@PathVariable String guid,@PathVariable String username,MultipartFileParam param, HttpServletRequest request, HttpServletResponse response) {
StdOut out = new StdOut();
// 在此更换路径
// File file = new File("D:\\chunk_test");//存储路径
// 拼接路径
String fileurl = filespath + "/" + DateUtils.toDateString() + "/" + guid ;
// System.out.println("拼接地址为:" + fileurl);
String filepath = RuoYiConfig.getProfile() + fileurl;
// System.out.println("拼接路径为:" + filepath);
File file = new File(filepath);//存储路径
String path = file.getAbsolutePath();
response.setContentType("text/html;charset=UTF-8");
try {
//判断前端Form表单格式是否支持文件上传
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if (!isMultipart) {
out.setCode(StdOut.PARAMETER_NULL);
out.setMessage("表单格式错误");
return out;
} else {
param.setTaskId(param.getIdentifier());
out.setModel(chunkService.chunkUploadByMappedByteBuffer(param, path));
// System.out.println("保存后:" + out.toString());
if (out.getModel() != null) {
// System.out.println("文件名:" + out.getModel().toString());
// 保存文件信息
// 取得文件名
String filename = out.getModel().toString();
// 取文件类型
String suffix = getSuffix(filename);
// 开始保存
// String fileTitle, String fileDescribe, String fileName, String filePath, String fileUrl,
// String fileSuffix, String originalName, String uploadName
FmsFiles fmsFiles = new FmsFiles(null, null, filename, filepath, fileurl, suffix, filename, username);
System.out.println(fmsFiles.toString());
int count = fmsFilesService.insertFmsFiles(fmsFiles);
}
return out;
}
} catch (NotSameFileExpection e) {
out.setCode(StdOut.FAIL);
out.setMessage("MD5校验失败");
return out;
} catch (Exception e) {
out.setCode(StdOut.FAIL);
out.setMessage("上传失败");
return out;
}
}
private String getSuffix(String filename) {
String suffix = null;
try
{
suffix = filename.substring(filename.lastIndexOf(".") + 1);
}
catch(Exception e) {
}
return suffix;
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:files:edit')")
@Log(title = "文件管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FmsFiles fmsFiles)
{
System.out.println("fmsFiles:" + fmsFiles.toString());
return toAjax(fmsFilesService.updateFmsFiles(fmsFiles));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:files:remove')")
@Log(title = "文件管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{fileIds}")
public AjaxResult remove(@PathVariable Long[] fileIds)
{
return toAjax(fmsFilesService.deleteFmsFilesByIds(fileIds));
}
}

View File

@ -1,179 +0,0 @@
package com.hig.fms.controller;
import java.util.Date;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.hig.cms.utils.FileUpload;
import com.hig.fms.domain.FmsPhoto;
import com.hig.fms.service.IFmsPhotoService;
import com.hig.utils.DateUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2021-12-14
*/
@RestController
@RequestMapping("/fms/photo")
public class FmsPhotoController extends BaseController
{
@Autowired
private IFmsPhotoService fmsPhotoService;
@Value("${cms.fms.photo-path}")
private String fmspath;
private TokenService tokenService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:photo:list')")
@GetMapping("/list")
public TableDataInfo list(FmsPhoto fmsPhoto)
{
startPage();
List<FmsPhoto> list = fmsPhotoService.selectFmsPhotoList(fmsPhoto);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:photo:export')")
@Log(title = "图片管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(FmsPhoto fmsPhoto)
{
List<FmsPhoto> list = fmsPhotoService.selectFmsPhotoList(fmsPhoto);
ExcelUtil<FmsPhoto> util = new ExcelUtil<FmsPhoto>(FmsPhoto.class);
return util.exportExcel(list, "图片管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:photo:query')")
@GetMapping(value = "/{photoId}")
public AjaxResult getInfo(@PathVariable("photoId") Long photoId)
{
return AjaxResult.success(fmsPhotoService.selectFmsPhotoById(photoId));
}
/**
*
*/
// @PreAuthorize("@ss.hasPermi('fms:photo:add')")
// @Log(title = "图片管理", businessType = BusinessType.INSERT)
@PostMapping(value = "/add/{username}")
public AjaxResult add(@PathVariable String username,@RequestParam("file") MultipartFile file)
{
if (username == null || username.trim().equals("")) {
return AjaxResult.error("用户名不能为空");
}
System.out.println("当前日期:" + DateUtils.toDateString());
// 取得原始文件名
String originalfile = file.getOriginalFilename();
// 拼接路径
String path = RuoYiConfig.getProfile() + fmspath + "/" + DateUtils.toDateString();
System.out.println("拼接路径为:" + path);
String filename = FileUpload.writeUploadFile(file,path);
String fileurl = fmspath + "/" + DateUtils.toDateString() + "/" + filename;
System.out.println(fileurl);
int count = 0;
// System.out.println("photoid:" + swipperid);
System.out.println("RuoYiConfig.getProfile()" + RuoYiConfig.getProfile());
/*LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
System.out.println("取得用户信息:" + user.toString());*/
// String fileName, String photoPath, String photoUrl, String originalName, String uploadName,String uploadDept, Long status
FmsPhoto fmsPhoto = new FmsPhoto(filename, path, fileurl, originalfile, username, "", (long) 0);
// System.out.println("fmsPhoto:" + fmsPhoto.toString());
try
{
return toAjax(fmsPhotoService.insertFmsPhoto(fmsPhoto));
}
catch(Exception e)
{
return AjaxResult.error(e.getMessage());
}
// select photo_id,file_name,photo_path,photo_url,original_name,upload_name,upload_dept,upload_time,status from fms_photo;
// 相应赋值
//int photoId, int swipperId, String photoPath, String photoUrl, String fileName,String originalName
/*SysSwipper sysSwipper = new SysSwipper(Integer.parseInt(swipperid), path, fileurl, filename, originalfile);
System.out.println("sysSwipper:" + sysSwipper.toString());
try
{
count = swipperService.insertSwipper(sysSwipper);
}
catch(Exception e)
{
return AjaxResult.error(e.getMessage());
}*/
// FmsPhoto fmsPhoto
// return AjaxResult.success(sysSwipper);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:photo:edit')")
@Log(title = "图片管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody FmsPhoto fmsPhoto)
{
return toAjax(fmsPhotoService.updateFmsPhoto(fmsPhoto));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('fms:photo:remove')")
@Log(title = "图片管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{photoIds}")
public AjaxResult remove(@PathVariable Long[] photoIds)
{
return toAjax(fmsPhotoService.deleteFmsPhotoByIds(photoIds));
}
}

View File

@ -1,93 +0,0 @@
package com.hig.fms.domain;
import java.util.Date;
import org.apache.commons.lang3.builder.ToStringBuilder;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
@Data
public class FmsFiles {
/** 文件序号 */
private int fileId;
/** 文件标题 */
@Excel(name = "文件标题")
private String fileTitle;
/** 文件描述 */
@Excel(name = "文件描述")
private String fileDescribe;
/** 文件名称 */
private String fileName;
/** 文件路径 */
private String filePath;
/** 文件链接 */
private String fileUrl;
/** 文件类型 */
private String fileSuffix;
/** 原始名称 */
private String originalName;
/** 上传者 */
@Excel(name = "上传者")
private String uploadName;
/** 上传部门 */
private String uploadDept;
/** 上传时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date uploadTime;
/** 状态 */
private int status;
public FmsFiles() {
super();
}
public FmsFiles(String fileTitle, String fileDescribe, String fileName, String filePath, String fileUrl,
String fileSuffix, String originalName, String uploadName) {
super();
this.fileTitle = fileTitle;
this.fileDescribe = fileDescribe;
this.fileName = fileName;
this.filePath = filePath;
this.fileUrl = fileUrl;
this.fileSuffix = fileSuffix;
this.originalName = originalName;
this.uploadName = uploadName;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("fileId", getFileId())
.append("fileTitle", getFileTitle())
.append("fileDescribe", getFileDescribe())
.append("fileName", getFileName())
.append("filePath", getFilePath())
.append("fileUrl", getFileUrl())
.append("fileSuffix", getFileSuffix())
.append("originalName", getOriginalName())
.append("uploadName", getUploadName())
.append("uploadDept", getUploadDept())
.append("uploadTime", getUploadTime())
.append("status", getStatus())
.toString();
}
}

View File

@ -1,166 +0,0 @@
package com.hig.fms.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* fms_photo
*
* @author qnsdt
* @date 2021-12-14
*/
public class FmsPhoto extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 图片序号 */
@Excel(name = "图片序号")
private Long photoId;
/** 文件名称 */
@Excel(name = "文件名称")
private String fileName;
/** 图片路径 */
@Excel(name = "图片路径")
private String photoPath;
/** 图片链接 */
@Excel(name = "图片链接")
private String photoUrl;
/** 原始名称 */
@Excel(name = "原始名称")
private String originalName;
/** 上传者 */
@Excel(name = "上传者")
private String uploadName;
/** 上传部门 */
@Excel(name = "上传部门")
private String uploadDept;
/** 上传时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date uploadTime;
/** 状态 */
@Excel(name = "状态")
private Long status;
public void setPhotoId(Long photoId)
{
this.photoId = photoId;
}
public Long getPhotoId()
{
return photoId;
}
public void setFileName(String fileName)
{
this.fileName = fileName;
}
public String getFileName()
{
return fileName;
}
public void setPhotoPath(String photoPath)
{
this.photoPath = photoPath;
}
public String getPhotoPath()
{
return photoPath;
}
public void setPhotoUrl(String photoUrl)
{
this.photoUrl = photoUrl;
}
public String getPhotoUrl()
{
return photoUrl;
}
public void setOriginalName(String originalName)
{
this.originalName = originalName;
}
public String getOriginalName()
{
return originalName;
}
public void setUploadName(String uploadName)
{
this.uploadName = uploadName;
}
public String getUploadName()
{
return uploadName;
}
public void setUploadDept(String uploadDept)
{
this.uploadDept = uploadDept;
}
public String getUploadDept()
{
return uploadDept;
}
public void setUploadTime(Date uploadTime)
{
this.uploadTime = uploadTime;
}
public Date getUploadTime()
{
return uploadTime;
}
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
{
return status;
}
public FmsPhoto(String fileName, String photoPath, String photoUrl, String originalName, String uploadName,
String uploadDept, Long status) {
super();
this.fileName = fileName;
this.photoPath = photoPath;
this.photoUrl = photoUrl;
this.originalName = originalName;
this.uploadName = uploadName;
this.uploadDept = uploadDept;
this.status = status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("photoId", getPhotoId())
.append("fileName", getFileName())
.append("photoPath", getPhotoPath())
.append("photoUrl", getPhotoUrl())
.append("originalName", getOriginalName())
.append("uploadName", getUploadName())
.append("uploadDept", getUploadDept())
.append("uploadTime", getUploadTime())
.append("status", getStatus())
.toString();
}
}

View File

@ -1,61 +0,0 @@
package com.hig.fms.domain;
import org.springframework.web.multipart.MultipartFile;
public class MultipartFileParam {
private String taskId;
private int chunkNumber;
private long chunkSize;
private int totalChunks;
private String identifier;
private MultipartFile file;
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public int getChunkNumber() {
return chunkNumber;
}
public void setChunkNumber(int chunkNumber) {
this.chunkNumber = chunkNumber;
}
public long getChunkSize() {
return chunkSize;
}
public void setChunkSize(long chunkSize) {
this.chunkSize = chunkSize;
}
public int getTotalChunks() {
return totalChunks;
}
public void setTotalChunks(int totalChunks) {
this.totalChunks = totalChunks;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public MultipartFile getFile() {
return file;
}
public void setFile(MultipartFile file) {
this.file = file;
}
}

View File

@ -1,66 +0,0 @@
package com.hig.fms.domain.dto;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
public class StdOut {
public static final int SUCCESS = 200;
public static final int FAIL = 400;
public static final int PARAMETER_NULL = 500;
public static final int NO_LOGIN = 600;
private int code = 200;
private Object model = null;
private String message = null;
public StdOut() {
this.setCode(200);
this.setModel((Object)null);
}
public StdOut(int code) {
this.setCode(code);
this.setModel((Object)null);
}
public StdOut(List<Map<String, Object>> model) {
this.setCode(200);
this.setModel(model);
}
public StdOut(int code, List<Map<String, Object>> model) {
this.setCode(code);
this.setModel(model);
}
public int getCode() {
return this.code;
}
public void setCode(int code) {
this.code = code;
}
public String toString() {
return JSON.toJSONString(this);
}
public Object getModel() {
return this.model;
}
public void setModel(Object model) {
this.model = model;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@ -1,61 +0,0 @@
package com.hig.fms.mapper;
import java.util.List;
import com.hig.fms.domain.FmsFiles;
/**
* Mapper
*
* @author qnsdt
* @date 2021-12-17
*/
public interface FmsFilesMapper
{
/**
*
*
* @param fileId ID
* @return
*/
public FmsFiles selectFmsFilesById(Long fileId);
/**
*
*
* @param fmsFiles
* @return
*/
public List<FmsFiles> selectFmsFilesList(FmsFiles fmsFiles);
/**
*
*
* @param fmsFiles
* @return
*/
public int insertFmsFiles(FmsFiles fmsFiles);
/**
*
*
* @param fmsFiles
* @return
*/
public int updateFmsFiles(FmsFiles fmsFiles);
/**
*
*
* @param fileId ID
* @return
*/
public int deleteFmsFilesById(Long fileId);
/**
*
*
* @param fileIds ID
* @return
*/
public int deleteFmsFilesByIds(Long[] fileIds);
}

View File

@ -1,61 +0,0 @@
package com.hig.fms.mapper;
import java.util.List;
import com.hig.fms.domain.FmsPhoto;
/**
* Mapper
*
* @author qnsdt
* @date 2021-12-14
*/
public interface FmsPhotoMapper
{
/**
*
*
* @param photoId ID
* @return
*/
public FmsPhoto selectFmsPhotoById(Long photoId);
/**
*
*
* @param fmsPhoto
* @return
*/
public List<FmsPhoto> selectFmsPhotoList(FmsPhoto fmsPhoto);
/**
*
*
* @param fmsPhoto
* @return
*/
public int insertFmsPhoto(FmsPhoto fmsPhoto);
/**
*
*
* @param fmsPhoto
* @return
*/
public int updateFmsPhoto(FmsPhoto fmsPhoto);
/**
*
*
* @param photoId ID
* @return
*/
public int deleteFmsPhotoById(Long photoId);
/**
*
*
* @param photoIds ID
* @return
*/
public int deleteFmsPhotoByIds(Long[] photoIds);
}

View File

@ -1,16 +0,0 @@
package com.hig.fms.service;
import java.io.File;
import java.io.IOException;
import com.hig.fms.common.NotSameFileExpection;
import com.hig.fms.domain.MultipartFileParam;
public interface ChunkService {
public String chunkUploadByMappedByteBuffer(MultipartFileParam param, String filePath) throws IOException, NotSameFileExpection;
public void renameFile(File toBeRenamed, String toFileNewName);
public boolean checkUploadStatus(MultipartFileParam param, String fileName, String filePath) throws IOException;
}

View File

@ -1,61 +0,0 @@
package com.hig.fms.service;
import java.util.List;
import com.hig.fms.domain.FmsFiles;
/**
* Service
*
* @author qnsdt
* @date 2021-12-17
*/
public interface IFmsFilesService
{
/**
*
*
* @param fileId ID
* @return
*/
public FmsFiles selectFmsFilesById(Long fileId);
/**
*
*
* @param fmsFiles
* @return
*/
public List<FmsFiles> selectFmsFilesList(FmsFiles fmsFiles);
/**
*
*
* @param fmsFiles
* @return
*/
public int insertFmsFiles(FmsFiles fmsFiles);
/**
*
*
* @param fmsFiles
* @return
*/
public int updateFmsFiles(FmsFiles fmsFiles);
/**
*
*
* @param fileIds ID
* @return
*/
public int deleteFmsFilesByIds(Long[] fileIds);
/**
*
*
* @param fileId ID
* @return
*/
public int deleteFmsFilesById(Long fileId);
}

View File

@ -1,61 +0,0 @@
package com.hig.fms.service;
import java.util.List;
import com.hig.fms.domain.FmsPhoto;
/**
* Service
*
* @author qnsdt
* @date 2021-12-14
*/
public interface IFmsPhotoService
{
/**
*
*
* @param photoId ID
* @return
*/
public FmsPhoto selectFmsPhotoById(Long photoId);
/**
*
*
* @param fmsPhoto
* @return
*/
public List<FmsPhoto> selectFmsPhotoList(FmsPhoto fmsPhoto);
/**
*
*
* @param fmsPhoto
* @return
*/
public int insertFmsPhoto(FmsPhoto fmsPhoto);
/**
*
*
* @param fmsPhoto
* @return
*/
public int updateFmsPhoto(FmsPhoto fmsPhoto);
/**
*
*
* @param photoIds ID
* @return
*/
public int deleteFmsPhotoByIds(Long[] photoIds);
/**
*
*
* @param photoId ID
* @return
*/
public int deleteFmsPhotoById(Long photoId);
}

View File

@ -1,104 +0,0 @@
package com.hig.fms.service.impl;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.hig.fms.common.NotSameFileExpection;
import com.hig.fms.domain.MultipartFileParam;
import com.hig.fms.service.ChunkService;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
@Service
public class ChunkServiceImpl implements ChunkService {
@Override
public String chunkUploadByMappedByteBuffer(MultipartFileParam param, String filePath) throws IOException, NotSameFileExpection {
// TODO Auto-generated method stub
if (param.getTaskId() == null || "".equals(param.getTaskId())) {
param.setTaskId(UUID.randomUUID().toString());
}
String fileName = param.getFile().getOriginalFilename();
String tempFileName = param.getTaskId() + fileName.substring(fileName.lastIndexOf(".")) + "_tmp";
File fileDir = new File(filePath);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
File tempFile = new File(filePath, tempFileName);
//第一步 打开将要写入的文件
RandomAccessFile raf = new RandomAccessFile(tempFile, "rw");
//第二步 打开通道
FileChannel fileChannel = raf.getChannel();
//第三步 计算偏移量
long position = (param.getChunkNumber() - 1) * param.getChunkSize();
//第四步 获取分片数据
byte[] fileData = param.getFile().getBytes();
//第五步 写入数据
fileChannel.position(position);
fileChannel.write(ByteBuffer.wrap(fileData));
fileChannel.force(true);
fileChannel.close();
raf.close();
//判断是否完成文件的传输并进行校验与重命名
boolean isComplete = checkUploadStatus(param, fileName, filePath);
if (isComplete) {
FileInputStream fileInputStream = new FileInputStream(tempFile.getPath());
String md5 = DigestUtils.md5Hex(fileInputStream);
fileInputStream.close();
if (StringUtils.isNotBlank(md5) && !md5.equals(param.getIdentifier())) {
throw new NotSameFileExpection();
}
renameFile(tempFile, fileName);
return fileName;
}
return null;
}
@Override
public void renameFile(File toBeRenamed, String toFileNewName) {
// TODO Auto-generated method stub
if (!toBeRenamed.exists() || toBeRenamed.isDirectory()) {
System.err.println("文件不存在");
return;
}
String p = toBeRenamed.getParent();
File newFile = new File(p + File.separatorChar + toFileNewName);
toBeRenamed.renameTo(newFile);
}
@Override
public boolean checkUploadStatus(MultipartFileParam param, String fileName, String filePath) throws IOException {
// TODO Auto-generated method stub
File confFile = new File(filePath, fileName + ".conf");
RandomAccessFile confAccessFile = new RandomAccessFile(confFile, "rw");
//设置文件长度
confAccessFile.setLength(param.getTotalChunks());
//设置起始偏移量
confAccessFile.seek(param.getChunkNumber() - 1);
//将指定的一个字节写入文件中 127
confAccessFile.write(Byte.MAX_VALUE);
byte[] completeStatusList = FileUtils.readFileToByteArray(confFile);
confAccessFile.close();//不关闭会造成无法占用
//创建conf文件文件长度为总分片数每上传一个分块即向conf文件中写入一个127那么没上传的位置就是默认的0,已上传的就是127
for (int i = 0; i < completeStatusList.length; i++) {
if (completeStatusList[i] != Byte.MAX_VALUE) {
return false;
}
}
confFile.delete();
return true;
}
}

View File

@ -1,93 +0,0 @@
package com.hig.fms.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.fms.mapper.FmsFilesMapper;
import com.hig.fms.domain.FmsFiles;
import com.hig.fms.service.IFmsFilesService;
/**
* Service
*
* @author qnsdt
* @date 2021-12-17
*/
@Service
public class FmsFilesServiceImpl implements IFmsFilesService
{
@Autowired
private FmsFilesMapper fmsFilesMapper;
/**
*
*
* @param fileId ID
* @return
*/
@Override
public FmsFiles selectFmsFilesById(Long fileId)
{
return fmsFilesMapper.selectFmsFilesById(fileId);
}
/**
*
*
* @param fmsFiles
* @return
*/
@Override
public List<FmsFiles> selectFmsFilesList(FmsFiles fmsFiles)
{
return fmsFilesMapper.selectFmsFilesList(fmsFiles);
}
/**
*
*
* @param fmsFiles
* @return
*/
@Override
public int insertFmsFiles(FmsFiles fmsFiles)
{
return fmsFilesMapper.insertFmsFiles(fmsFiles);
}
/**
*
*
* @param fmsFiles
* @return
*/
@Override
public int updateFmsFiles(FmsFiles fmsFiles)
{
return fmsFilesMapper.updateFmsFiles(fmsFiles);
}
/**
*
*
* @param fileIds ID
* @return
*/
@Override
public int deleteFmsFilesByIds(Long[] fileIds)
{
return fmsFilesMapper.deleteFmsFilesByIds(fileIds);
}
/**
*
*
* @param fileId ID
* @return
*/
@Override
public int deleteFmsFilesById(Long fileId)
{
return fmsFilesMapper.deleteFmsFilesById(fileId);
}
}

View File

@ -1,93 +0,0 @@
package com.hig.fms.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.fms.mapper.FmsPhotoMapper;
import com.hig.fms.domain.FmsPhoto;
import com.hig.fms.service.IFmsPhotoService;
/**
* Service
*
* @author qnsdt
* @date 2021-12-14
*/
@Service
public class FmsPhotoServiceImpl implements IFmsPhotoService
{
@Autowired
private FmsPhotoMapper fmsPhotoMapper;
/**
*
*
* @param photoId ID
* @return
*/
@Override
public FmsPhoto selectFmsPhotoById(Long photoId)
{
return fmsPhotoMapper.selectFmsPhotoById(photoId);
}
/**
*
*
* @param fmsPhoto
* @return
*/
@Override
public List<FmsPhoto> selectFmsPhotoList(FmsPhoto fmsPhoto)
{
return fmsPhotoMapper.selectFmsPhotoList(fmsPhoto);
}
/**
*
*
* @param fmsPhoto
* @return
*/
@Override
public int insertFmsPhoto(FmsPhoto fmsPhoto)
{
return fmsPhotoMapper.insertFmsPhoto(fmsPhoto);
}
/**
*
*
* @param fmsPhoto
* @return
*/
@Override
public int updateFmsPhoto(FmsPhoto fmsPhoto)
{
return fmsPhotoMapper.updateFmsPhoto(fmsPhoto);
}
/**
*
*
* @param photoIds ID
* @return
*/
@Override
public int deleteFmsPhotoByIds(Long[] photoIds)
{
return fmsPhotoMapper.deleteFmsPhotoByIds(photoIds);
}
/**
*
*
* @param photoId ID
* @return
*/
@Override
public int deleteFmsPhotoById(Long photoId)
{
return fmsPhotoMapper.deleteFmsPhotoById(photoId);
}
}

View File

@ -1,66 +0,0 @@
package com.hig.fms.utils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.web.multipart.MultipartFile;
public class FileUpload {
/**
*
*
* @param file
* @return
*/
public static String writeUploadFile(MultipartFile file,String path) {
String filename = file.getOriginalFilename();
System.out.println("原始文件名:" + filename);
// String realpath = "D:/image/photo/" + module +"/";
File fileDir = new File(path);
if (!fileDir.exists())
fileDir.mkdirs();
String extname = FilenameUtils.getExtension(filename);
String allowImgFormat = "gif,jpg,jpeg,png";
if (!allowImgFormat.contains(extname.toLowerCase())) {
return "NOT_IMAGE";
}
filename = Math.abs(file.getOriginalFilename().hashCode()) + RandomUtils.createRandomString( 4 ) + "." + extname;
InputStream input = null;
FileOutputStream fos = null;
try {
input = file.getInputStream();
fos = new FileOutputStream(path + "/" + filename);
IOUtils.copy(input, fos);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
/*IOUtils.closeQuietly(input);
IOUtils.closeQuietly(fos);*/
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
}
return filename;
}
}

View File

@ -1,35 +0,0 @@
package com.hig.fms.utils;
public class RandomUtils {
private static final String charlist = "0123456789";
public static String createRandomString(int len) {
String str = new String();
for (int i = 0; i < len; i++) {
str += charlist.charAt(getRandom(charlist.length()));
}
return str;
}
public static int getRandom(int mod) {
if (mod < 1) {
return 0;
}
int ret = getInt() % mod;
return ret;
}
private static int getInt() {
int ret = Math.abs(Long.valueOf(getRandomNumString()).intValue());
return ret;
}
private static String getRandomNumString() {
double d = Math.random();
String dStr = String.valueOf(d).replaceAll("[^\\d]", "");
if (dStr.length() > 1) {
dStr = dStr.substring(0, dStr.length() - 1);
}
return dStr;
}
}

View File

@ -1,113 +0,0 @@
package com.hig.onlineexam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.onlineexam.domain.ExamFinishAnswer;
import com.hig.onlineexam.service.IExamFinishAnswerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-02-24
*/
@RestController
@RequestMapping("/onlineexam/finishanswer")
public class ExamFinishAnswerController extends BaseController
{
@Autowired
private IExamFinishAnswerService examFinishAnswerService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:finishanswer:list')")
@GetMapping("/list")
public TableDataInfo list(ExamFinishAnswer examFinishAnswer)
{
startPage();
List<ExamFinishAnswer> list = examFinishAnswerService.selectExamFinishAnswerList(examFinishAnswer);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:finishanswer:export')")
@Log(title = "考试成绩", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamFinishAnswer examFinishAnswer)
{
List<ExamFinishAnswer> list = examFinishAnswerService.selectExamFinishAnswerList(examFinishAnswer);
ExcelUtil<ExamFinishAnswer> util = new ExcelUtil<ExamFinishAnswer>(ExamFinishAnswer.class);
return util.exportExcel(list, "考试成绩数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:finishanswer:query')")
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examFinishAnswerService.selectExamFinishAnswerById(examCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:finishanswer:add')")
@Log(title = "考试成绩", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamFinishAnswer examFinishAnswer)
{
return toAjax(examFinishAnswerService.insertExamFinishAnswer(examFinishAnswer));
}
/**
*
*/
@PostMapping("/save")
public AjaxResult save(@RequestBody ExamFinishAnswer examFinishAnswer)
{
System.out.println("examFinishAnswer:" + examFinishAnswer.toString());
return toAjax(examFinishAnswerService.intoExamFinishAnswer(examFinishAnswer));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:finishanswer:edit')")
@Log(title = "考试成绩", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamFinishAnswer examFinishAnswer)
{
return toAjax(examFinishAnswerService.updateExamFinishAnswer(examFinishAnswer));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:finishanswer:remove')")
@Log(title = "考试成绩", businessType = BusinessType.DELETE)
@DeleteMapping("/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examFinishAnswerService.deleteExamFinishAnswerByIds(examCodes));
}
}

View File

@ -1,52 +0,0 @@
package com.hig.onlineexam.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hig.onlineexam.domain.dto.ExamQuestionsContentData;
import com.hig.onlineexam.domain.dto.ExamQuestionsData;
import com.hig.onlineexam.service.IExamQuestionsContentDataService;
import com.hig.questions.domain.ExamQuestionsAnswer;
import com.hig.questions.service.IExamQuestionsAnswerService;
import com.hig.utils.DigitUtils;
import com.ruoyi.common.core.domain.AjaxResult;
@RestController
@RequestMapping("/onlineexam")
public class ExamQuestionsContentDataController {
@Autowired
private IExamQuestionsContentDataService examQuestionsContentDataService;
@Autowired
private IExamQuestionsAnswerService examQuestionsAnswerService;
@GetMapping("/content")
public AjaxResult option(@RequestBody ExamQuestionsContentData examQuestionsContentData)
{
ExamQuestionsContentData contentData = examQuestionsContentDataService.selectExamQuestionsContent(examQuestionsContentData);
return AjaxResult.success(contentData);
}
@PostMapping("/data")
public AjaxResult data(@RequestBody ExamQuestionsContentData examQuestionsContentData)
{
ExamQuestionsContentData contentData = examQuestionsContentDataService.selectExamQuestionsContent(examQuestionsContentData);
// 转换题号
String str = DigitUtils.toChinese(String.valueOf(contentData.getQuestionsNumber()));
contentData.setQuestionsNumberText("第" + str + "题");
List<ExamQuestionsAnswer> examQuestionsOptionList = examQuestionsAnswerService.selectExamQuestionsOptionList(examQuestionsContentData.getQuestionsCode());
ExamQuestionsData examQuestionsData = new ExamQuestionsData(contentData, examQuestionsOptionList);
return AjaxResult.success(examQuestionsData);
}
}

View File

@ -1,29 +0,0 @@
package com.hig.onlineexam.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hig.onlineexam.domain.dto.ExamQuestionsListData;
import com.hig.onlineexam.service.IExamQuestionsListDataService;
import com.ruoyi.common.core.domain.AjaxResult;
@RestController
@RequestMapping("/onlineexam/questionslist")
public class ExamQuestionsListDataController {
@Autowired
IExamQuestionsListDataService examQuestionsListDataService;
@GetMapping()
public AjaxResult getQuestionsList(ExamQuestionsListData examQuestionsListData)
{
List<ExamQuestionsListData> examQuestionsList = examQuestionsListDataService.selectQuestionsList(examQuestionsListData);
return AjaxResult.success(examQuestionsList);
}
}

View File

@ -1,103 +0,0 @@
package com.hig.onlineexam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.onlineexam.domain.ExamTaskAnswer;
import com.hig.onlineexam.service.IExamTaskAnswerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-02-24
*/
@RestController
@RequestMapping("/onlineexam/taskanswer")
public class ExamTaskAnswerController extends BaseController
{
@Autowired
private IExamTaskAnswerService examTaskAnswerService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(ExamTaskAnswer examTaskAnswer)
{
startPage();
List<ExamTaskAnswer> list = examTaskAnswerService.selectExamTaskAnswerList(examTaskAnswer);
return getDataTable(list);
}
/**
*
*/
@GetMapping("/export")
public AjaxResult export(ExamTaskAnswer examTaskAnswer)
{
List<ExamTaskAnswer> list = examTaskAnswerService.selectExamTaskAnswerList(examTaskAnswer);
ExcelUtil<ExamTaskAnswer> util = new ExcelUtil<ExamTaskAnswer>(ExamTaskAnswer.class);
return util.exportExcel(list, "考试实时数据数据");
}
/**
*
*/
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examTaskAnswerService.selectExamTaskAnswerById(examCode));
}
/**
*
*/
@PostMapping
public AjaxResult add(@RequestBody ExamTaskAnswer examTaskAnswer)
{
return toAjax(examTaskAnswerService.insertExamTaskAnswer(examTaskAnswer));
}
/**
*
*/
@PutMapping
public AjaxResult edit(@RequestBody ExamTaskAnswer examTaskAnswer)
{
return toAjax(examTaskAnswerService.updateExamTaskAnswer(examTaskAnswer));
}
/**
*
*/
@GetMapping("/remove/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examTaskAnswerService.deleteExamTaskAnswerByIds(examCodes));
}
/**
*
*/
@PostMapping("/delete")
public AjaxResult delete(ExamTaskAnswer examTaskAnswer)
{
return toAjax(examTaskAnswerService.deleteExamTaskAnswer(examTaskAnswer));
}
}

View File

@ -1,39 +0,0 @@
package com.hig.onlineexam.controller;
import java.util.List;
import com.hig.exam.domain.ExamTaskManager;
import com.hig.exam.service.IExamTaskManagerService;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hig.onlineexam.domain.dto.ExamTitleData;
import com.hig.onlineexam.service.IExamTitleDataService;
import com.ruoyi.common.core.domain.AjaxResult;
@RestController
@RequestMapping("/onlineexam/examtitle")
public class ExamTitleController {
@Autowired
IExamTitleDataService examTitleDataService;
@Autowired
IExamTaskManagerService examTaskManagerService;
@GetMapping(value = "/selectCurrentExam")
public AjaxResult selectCurrentExam()
{
LoginUser user=SecurityUtils.getLoginUser();
List<ExamTitleData> list= examTaskManagerService.selectCurrentExam(user.getUser().getUserCode());
//ExamTitleData examTitleData = examTitleDataService.selectCurrentExam(user.getUser().getUserCode());
//return AjaxResult.success(examTitleData);
return AjaxResult.success(list);
}
}

View File

@ -1,112 +0,0 @@
package com.hig.onlineexam.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.onlineexam.domain.ExamUserScore;
import com.hig.onlineexam.service.IExamUserScoreService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2023-03-03
*/
@RestController
@RequestMapping("/onlineexam/userscore")
public class ExamUserScoreController extends BaseController
{
@Autowired
private IExamUserScoreService examUserScoreService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:userscore:list')")
@GetMapping("/list")
public TableDataInfo list(ExamUserScore examUserScore)
{
startPage();
List<ExamUserScore> list = examUserScoreService.selectExamUserScoreList(examUserScore);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:userscore:export')")
@Log(title = "考试成绩", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamUserScore examUserScore)
{
List<ExamUserScore> list = examUserScoreService.selectExamUserScoreList(examUserScore);
ExcelUtil<ExamUserScore> util = new ExcelUtil<ExamUserScore>(ExamUserScore.class);
return util.exportExcel(list, "考试成绩数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:userscore:query')")
@GetMapping(value = "/{examCode}")
public AjaxResult getInfo(@PathVariable("examCode") String examCode)
{
return AjaxResult.success(examUserScoreService.selectExamUserScoreById(examCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:userscore:add')")
@Log(title = "考试成绩", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamUserScore examUserScore)
{
return toAjax(examUserScoreService.insertExamUserScore(examUserScore));
}
/**
*
*/
@PostMapping("/into")
public AjaxResult into(@RequestBody ExamUserScore examUserScore)
{
return toAjax(examUserScoreService.intoExamUserScore(examUserScore));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:userscore:edit')")
@Log(title = "考试成绩", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamUserScore examUserScore)
{
return toAjax(examUserScoreService.updateExamUserScore(examUserScore));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('onlineexam:userscore:remove')")
@Log(title = "考试成绩", businessType = BusinessType.DELETE)
@DeleteMapping("/{examCodes}")
public AjaxResult remove(@PathVariable String[] examCodes)
{
return toAjax(examUserScoreService.deleteExamUserScoreByIds(examCodes));
}
}

View File

@ -1,119 +0,0 @@
package com.hig.onlineexam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_finish_answer
*
* @author qnsdt
* @date 2023-03-02
*/
public class ExamFinishAnswer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试代码 */
private String examCode;
/** 考试用户 */
private String userCode;
/** 题目代码 */
private String questionsCode;
/** 正确答案 */
@Excel(name = "正确答案")
private String rightAnswer;
/** 分数 */
@Excel(name = "分数")
private Long examScore;
/** 题目回答 */
@Excel(name = "题目回答")
private String questionsAnswer;
/** 题目得分 */
@Excel(name = "题目得分")
private Long questionsScore;
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setUserCode(String userCode)
{
this.userCode = userCode;
}
public String getUserCode()
{
return userCode;
}
public void setQuestionsCode(String questionsCode)
{
this.questionsCode = questionsCode;
}
public String getQuestionsCode()
{
return questionsCode;
}
public void setRightAnswer(String rightAnswer)
{
this.rightAnswer = rightAnswer;
}
public String getRightAnswer()
{
return rightAnswer;
}
public void setExamScore(Long examScore)
{
this.examScore = examScore;
}
public Long getExamScore()
{
return examScore;
}
public void setQuestionsAnswer(String questionsAnswer)
{
this.questionsAnswer = questionsAnswer;
}
public String getQuestionsAnswer()
{
return questionsAnswer;
}
public void setQuestionsScore(Long questionsScore)
{
this.questionsScore = questionsScore;
}
public Long getQuestionsScore()
{
return questionsScore;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examCode", getExamCode())
.append("userCode", getUserCode())
.append("questionsCode", getQuestionsCode())
.append("rightAnswer", getRightAnswer())
.append("examScore", getExamScore())
.append("questionsAnswer", getQuestionsAnswer())
.append("questionsScore", getQuestionsScore())
.toString();
}
}

View File

@ -1,147 +0,0 @@
package com.hig.onlineexam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_task_answer
*
* @author qnsdt
* @date 2023-02-24
*/
public class ExamTaskAnswer extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试代码 */
@Excel(name = "考试代码")
private String examCode;
/** 考试用户 */
@Excel(name = "考试用户")
private String userCode;
/** 题目代码 */
@Excel(name = "题目代码")
private String questionsCode;
private String examTimes;
public String getExamTimes() {
return examTimes;
}
public void setExamTimes(String examTimes) {
this.examTimes = examTimes;
}
/** 题号 */
@Excel(name = "题号")
private Long questionsNumber;
/** 试题类型 */
@Excel(name = "试题类型")
private Long questionsType;
/** 题目回答 */
@Excel(name = "题目回答")
private String questionsAnswer;
/** 是否标记 */
@Excel(name = "是否标记")
private String isMark;
/** 是否当前 */
@Excel(name = "是否当前")
private String isCurrent;
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setUserCode(String userCode)
{
this.userCode = userCode;
}
public String getUserCode()
{
return userCode;
}
public void setQuestionsCode(String questionsCode)
{
this.questionsCode = questionsCode;
}
public String getQuestionsCode()
{
return questionsCode;
}
public void setQuestionsNumber(Long questionsNumber)
{
this.questionsNumber = questionsNumber;
}
public Long getQuestionsNumber()
{
return questionsNumber;
}
public void setQuestionsType(Long questionsType)
{
this.questionsType = questionsType;
}
public Long getQuestionsType()
{
return questionsType;
}
public void setQuestionsAnswer(String questionsAnswer)
{
this.questionsAnswer = questionsAnswer;
}
public String getQuestionsAnswer()
{
return questionsAnswer;
}
public void setIsMark(String isMark)
{
this.isMark = isMark;
}
public String getIsMark()
{
return isMark;
}
public void setIsCurrent(String isCurrent)
{
this.isCurrent = isCurrent;
}
public String getIsCurrent()
{
return isCurrent;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examCode", getExamCode())
.append("userCode", getUserCode())
.append("questionsCode", getQuestionsCode())
.append("questionsNumber", getQuestionsNumber())
.append("questionsType", getQuestionsType())
.append("questionsAnswer", getQuestionsAnswer())
.append("isMark", getIsMark())
.append("isCurrent", getIsCurrent())
.toString();
}
}

View File

@ -1,166 +0,0 @@
package com.hig.onlineexam.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* exam_user_score
*
* @author qnsdt
* @date 2023-03-03
*/
public class ExamUserScore extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 考试代码 */
private String examCode;
/** 考试人员 */
private String userCode;
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date startTime;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date endTime;
/** 分数 */
@Excel(name = "分数")
private Integer examScore;
/** 题目分数 */
@Excel(name = "题目分数")
private Integer questionsScore;
/** 题目数 */
@Excel(name = "题目数")
private Integer examNumber;
/** 答题数 */
@Excel(name = "答题数")
private Integer answeredNumber;
/** 未答题数 */
@Excel(name = "未答题数")
private Integer notAnswered;
/** 状态 */
@Excel(name = "状态")
private Integer status;
public void setExamCode(String examCode)
{
this.examCode = examCode;
}
public String getExamCode()
{
return examCode;
}
public void setUserCode(String userCode)
{
this.userCode = userCode;
}
public String getUserCode()
{
return userCode;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setExamScore(Integer examScore)
{
this.examScore = examScore;
}
public Integer getExamScore()
{
return examScore;
}
public void setQuestionsScore(Integer questionsScore)
{
this.questionsScore = questionsScore;
}
public Integer getQuestionsScore()
{
return questionsScore;
}
public void setExamNumber(Integer examNumber)
{
this.examNumber = examNumber;
}
public Integer getExamNumber()
{
return examNumber;
}
public void setAnsweredNumber(Integer answeredNumber)
{
this.answeredNumber = answeredNumber;
}
public Integer getAnsweredNumber()
{
return answeredNumber;
}
public void setNotAnswered(Integer notAnswered)
{
this.notAnswered = notAnswered;
}
public Integer getNotAnswered()
{
return notAnswered;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("examCode", getExamCode())
.append("userCode", getUserCode())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("examScore", getExamScore())
.append("questionsScore", getQuestionsScore())
.append("examNumber", getExamNumber())
.append("answeredNumber", getAnsweredNumber())
.append("notAnswered", getNotAnswered())
.append("status", getStatus())
.toString();
}
}

View File

@ -1,17 +0,0 @@
package com.hig.onlineexam.domain.dto;
import lombok.Data;
@Data
public class ExamQuestionsContentData {
private String bankCode;
private String examCode;
private int questionsId;
private int questionsNumber;
private String questionsNumberText;
private String questionsCode;
private String questionsContent;
private int questionsType;
private int questionsScore;
private int rateNumber;
}

View File

@ -1,24 +0,0 @@
package com.hig.onlineexam.domain.dto;
import java.util.List;
import com.hig.questions.domain.ExamQuestionsAnswer;
import lombok.Data;
@Data
public class ExamQuestionsData {
private ExamQuestionsContentData examQuestionsContentData;
private List<ExamQuestionsAnswer> examQuestionsOptionList;
public ExamQuestionsData(ExamQuestionsContentData examQuestionsContentData,
List<ExamQuestionsAnswer> examQuestionsOptionList) {
super();
this.examQuestionsContentData = examQuestionsContentData;
this.examQuestionsOptionList = examQuestionsOptionList;
}
}

View File

@ -1,16 +0,0 @@
package com.hig.onlineexam.domain.dto;
import lombok.Data;
@Data
public class ExamQuestionsListData {
private String examCode;
private String userCode;
private String questionsCode;
private int questionsNumber;
private int questionsType;
private int questionsScore;
private String questionsAnswer;
private int isMark;
private int isCurrent;
}

View File

@ -1,74 +0,0 @@
package com.hig.onlineexam.domain.dto;
import java.util.Date;
import lombok.Data;
@Data
public class ExamTitleData {
/** 考试序号 */
private Long examId;
/** 考试代码 */
private String examCode;
/** 考试名称 */
private String examName;
private Integer examType;
private Integer examTimes;
/** 考试说明 */
private String examDescribe;
/** 组卷方式 */
private String buildType;
/** 强制抽卷 */
private String forceDone;
/** 考试题库 */
private String examBank;
/** 考试题库文字 */
private String examBankText;
/** 图片链接 */
private String pictureUrl;
/** 开始时间 */
private Date startTime;
/** 结束时间 */
private Date endTime;
/** 当前日期 */
private Date currentDate;
/** 考试时长 */
private String examDuration;
private int diffTime;
/** 判断题数 */
private int judgeNumber;
/** 单选题数 */
private int radioNumber;
/** 多选题数 */
private int choiceNumber;
private int questionsScore;
/** 状态 */
private Long status;
/** 创建人 */
private String createBy;
/** 创建部门 */
private int createDept;
/** 创建时间 */
private Date createTime;
}

View File

@ -1,77 +0,0 @@
package com.hig.onlineexam.mapper;
import java.util.List;
import com.hig.onlineexam.domain.ExamFinishAnswer;
/**
* Mapper
*
* @author qnsdt
* @date 2023-02-24
*/
public interface ExamFinishAnswerMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamFinishAnswer selectExamFinishAnswerById(String examCode);
/**
*
*
* @param examFinishAnswer
* @return
*/
public List<ExamFinishAnswer> selectExamFinishAnswerList(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int insertExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int intoExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int updateExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamFinishAnswerById(String examCode);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int deleteExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamFinishAnswerByIds(String[] examCodes);
}

View File

@ -1,10 +0,0 @@
package com.hig.onlineexam.mapper;
import java.util.List;
import com.hig.onlineexam.domain.dto.ExamQuestionsContentData;
public interface ExamQuestionsContentDataMapper {
public ExamQuestionsContentData selectExamQuestionsContent(ExamQuestionsContentData questionsContentData);
}

View File

@ -1,9 +0,0 @@
package com.hig.onlineexam.mapper;
import java.util.List;
import com.hig.onlineexam.domain.dto.ExamQuestionsListData;
public interface ExamQuestionsListDataMapper {
public List<ExamQuestionsListData> selectQuestionsList(ExamQuestionsListData examQuestionsListData);
}

View File

@ -1,68 +0,0 @@
package com.hig.onlineexam.mapper;
import java.util.List;
import com.hig.onlineexam.domain.ExamTaskAnswer;
/**
* Mapper
*
* @author qnsdt
* @date 2023-02-24
*/
public interface ExamTaskAnswerMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskAnswer selectExamTaskAnswerById(String examCode);
/**
*
*
* @param examTaskAnswer
* @return
*/
public List<ExamTaskAnswer> selectExamTaskAnswerList(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examTaskAnswer
* @return
*/
public int insertExamTaskAnswer(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examTaskAnswer
* @return
*/
public int updateExamTaskAnswer(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskAnswer(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskAnswerById(String examCode);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskAnswerByIds(String[] examCodes);
}

View File

@ -1,7 +0,0 @@
package com.hig.onlineexam.mapper;
import com.hig.onlineexam.domain.dto.ExamTitleData;
public interface ExamTitleDataMapper {
public ExamTitleData selectCurrentExam(String userCode);
}

View File

@ -1,78 +0,0 @@
package com.hig.onlineexam.mapper;
import java.util.List;
import com.hig.onlineexam.domain.ExamUserScore;
/**
* Mapper
*
* @author qnsdt
* @date 2023-03-03
*/
public interface ExamUserScoreMapper
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamUserScore selectExamUserScoreById(String examCode);
/**
*
*
* @param examUserScore
* @return
*/
public List<ExamUserScore> selectExamUserScoreList(ExamUserScore examUserScore);
/**
*
*
* @param examUserScore
* @return
*/
public int insertExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examUserScore
* @return
*/
public int intoExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examUserScore
* @return
*/
public int updateExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamUserScoreById(String examCode);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamUserScoreByIds(String[] examCodes);
}

View File

@ -1,77 +0,0 @@
package com.hig.onlineexam.service;
import java.util.List;
import com.hig.onlineexam.domain.ExamFinishAnswer;
/**
* Service
*
* @author qnsdt
* @date 2023-02-24
*/
public interface IExamFinishAnswerService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamFinishAnswer selectExamFinishAnswerById(String examCode);
/**
*
*
* @param examFinishAnswer
* @return
*/
public List<ExamFinishAnswer> selectExamFinishAnswerList(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int insertExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int intoExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int updateExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamFinishAnswerByIds(String[] examCodes);
/**
*
*
* @param examFinishAnswer
* @return
*/
public int deleteExamFinishAnswer(ExamFinishAnswer examFinishAnswer);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamFinishAnswerById(String examCode);
}

View File

@ -1,10 +0,0 @@
package com.hig.onlineexam.service;
import java.util.List;
import com.hig.onlineexam.domain.dto.ExamQuestionsContentData;
public interface IExamQuestionsContentDataService {
public ExamQuestionsContentData selectExamQuestionsContent(ExamQuestionsContentData questionsContentData);
}

View File

@ -1,10 +0,0 @@
package com.hig.onlineexam.service;
import java.util.List;
import com.hig.onlineexam.domain.dto.ExamQuestionsListData;
public interface IExamQuestionsListDataService {
public List<ExamQuestionsListData> selectQuestionsList(ExamQuestionsListData examQuestionsListData);
}

View File

@ -1,69 +0,0 @@
package com.hig.onlineexam.service;
import java.util.List;
import com.hig.onlineexam.domain.ExamTaskAnswer;
/**
* Service
*
* @author qnsdt
* @date 2023-02-24
*/
public interface IExamTaskAnswerService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamTaskAnswer selectExamTaskAnswerById(String examCode);
/**
*
*
* @param examTaskAnswer
* @return
*/
public List<ExamTaskAnswer> selectExamTaskAnswerList(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examTaskAnswer
* @return
*/
public int insertExamTaskAnswer(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examTaskAnswer
* @return
*/
public int updateExamTaskAnswer(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskAnswer(ExamTaskAnswer examTaskAnswer);
/**
*
*
* @param examCodes ID
* @return
*/
public int deleteExamTaskAnswerByIds(String[] examCodes);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamTaskAnswerById(String examCode);
}

View File

@ -1,7 +0,0 @@
package com.hig.onlineexam.service;
import com.hig.onlineexam.domain.dto.ExamTitleData;
public interface IExamTitleDataService {
public ExamTitleData selectCurrentExam(String userCode);
}

View File

@ -1,78 +0,0 @@
package com.hig.onlineexam.service;
import java.util.List;
import com.hig.onlineexam.domain.ExamUserScore;
/**
* Service
*
* @author qnsdt
* @date 2023-03-03
*/
public interface IExamUserScoreService
{
/**
*
*
* @param examCode ID
* @return
*/
public ExamUserScore selectExamUserScoreById(String examCode);
/**
*
*
* @param examUserScore
* @return
*/
public List<ExamUserScore> selectExamUserScoreList(ExamUserScore examUserScore);
/**
*
*
* @param examUserScore
* @return
*/
public int insertExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examUserScore
* @return
*/
public int intoExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examUserScore
* @return
*/
public int updateExamUserScore(ExamUserScore examUserScore);
/**
*
*
* @param examCodes ID
* @return
*/
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamUserScore(ExamUserScore examUserScore);
public int deleteExamUserScoreByIds(String[] examCodes);
/**
*
*
* @param examCode ID
* @return
*/
public int deleteExamUserScoreById(String examCode);
}

View File

@ -1,132 +0,0 @@
package com.hig.onlineexam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.onlineexam.mapper.ExamFinishAnswerMapper;
import com.hig.exam.domain.ExamTaskPerson;
import com.hig.exam.service.IExamTaskPersonService;
import com.hig.onlineexam.domain.ExamFinishAnswer;
import com.hig.onlineexam.domain.ExamUserScore;
import com.hig.onlineexam.service.IExamFinishAnswerService;
import com.hig.onlineexam.service.IExamUserScoreService;
/**
* Service
*
* @author qnsdt
* @date 2023-02-24
*/
@Service
public class ExamFinishAnswerServiceImpl implements IExamFinishAnswerService
{
@Autowired
private ExamFinishAnswerMapper examFinishAnswerMapper;
@Autowired
private IExamUserScoreService examUserScoreService;
@Autowired
private IExamTaskPersonService examTaskPersonService;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamFinishAnswer selectExamFinishAnswerById(String examCode)
{
return examFinishAnswerMapper.selectExamFinishAnswerById(examCode);
}
/**
*
*
* @param examFinishAnswer
* @return
*/
@Override
public List<ExamFinishAnswer> selectExamFinishAnswerList(ExamFinishAnswer examFinishAnswer)
{
return examFinishAnswerMapper.selectExamFinishAnswerList(examFinishAnswer);
}
/**
*
*
* @param examFinishAnswer
* @return
*/
@Override
public int insertExamFinishAnswer(ExamFinishAnswer examFinishAnswer)
{
return examFinishAnswerMapper.insertExamFinishAnswer(examFinishAnswer);
}
/**
*
*
* @param examFinishAnswer
* @return
*/
@Override
public int updateExamFinishAnswer(ExamFinishAnswer examFinishAnswer)
{
return examFinishAnswerMapper.updateExamFinishAnswer(examFinishAnswer);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamFinishAnswerByIds(String[] examCodes)
{
return examFinishAnswerMapper.deleteExamFinishAnswerByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamFinishAnswerById(String examCode)
{
return examFinishAnswerMapper.deleteExamFinishAnswerById(examCode);
}
@Override
public int intoExamFinishAnswer(ExamFinishAnswer examFinishAnswer) {
// TODO Auto-generated method stub
examFinishAnswerMapper.deleteExamFinishAnswer(examFinishAnswer);
int result = examFinishAnswerMapper.intoExamFinishAnswer(examFinishAnswer);
// 维护成绩数据
ExamUserScore examUserScore = new ExamUserScore();
examUserScore.setExamCode(examFinishAnswer.getExamCode());
examUserScore.setUserCode(examFinishAnswer.getUserCode());
result = examUserScoreService.intoExamUserScore(examUserScore);
// 更新状态
ExamTaskPerson examTaskPerson = new ExamTaskPerson();
examTaskPerson.setExamCode(examFinishAnswer.getExamCode());
examTaskPerson.setuserCode(examFinishAnswer.getUserCode());
examTaskPersonService.updateDoneStatus(examTaskPerson);
return result;
}
@Override
public int deleteExamFinishAnswer(ExamFinishAnswer examFinishAnswer) {
// TODO Auto-generated method stub
return examFinishAnswerMapper.deleteExamFinishAnswer(examFinishAnswer);
}
}

View File

@ -1,24 +0,0 @@
package com.hig.onlineexam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.onlineexam.domain.dto.ExamQuestionsContentData;
import com.hig.onlineexam.mapper.ExamQuestionsContentDataMapper;
import com.hig.onlineexam.service.IExamQuestionsContentDataService;
@Service
public class ExamQuestionsContentDataServiceImpl implements IExamQuestionsContentDataService {
@Autowired
ExamQuestionsContentDataMapper examQuestionsContentDataMapper;
@Override
public ExamQuestionsContentData selectExamQuestionsContent(ExamQuestionsContentData questionsContentData) {
// TODO Auto-generated method stub
return examQuestionsContentDataMapper.selectExamQuestionsContent(questionsContentData);
}
}

View File

@ -1,23 +0,0 @@
package com.hig.onlineexam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.onlineexam.domain.dto.ExamQuestionsListData;
import com.hig.onlineexam.mapper.ExamQuestionsListDataMapper;
import com.hig.onlineexam.service.IExamQuestionsListDataService;
@Service
public class ExamQuestionsListDataServiceImpl implements IExamQuestionsListDataService {
@Autowired
ExamQuestionsListDataMapper examQuestionsListDataMapper;
@Override
public List<ExamQuestionsListData> selectQuestionsList(ExamQuestionsListData examQuestionsListData) {
// TODO Auto-generated method stub
return examQuestionsListDataMapper.selectQuestionsList(examQuestionsListData);
}
}

View File

@ -1,105 +0,0 @@
package com.hig.onlineexam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.onlineexam.mapper.ExamTaskAnswerMapper;
import com.hig.onlineexam.domain.ExamTaskAnswer;
import com.hig.onlineexam.domain.ExamUserScore;
import com.hig.onlineexam.service.IExamTaskAnswerService;
import com.hig.onlineexam.service.IExamUserScoreService;
/**
* Service
*
* @author qnsdt
* @date 2023-02-24
*/
@Service
public class ExamTaskAnswerServiceImpl implements IExamTaskAnswerService
{
@Autowired
private ExamTaskAnswerMapper examTaskAnswerMapper;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamTaskAnswer selectExamTaskAnswerById(String examCode)
{
return examTaskAnswerMapper.selectExamTaskAnswerById(examCode);
}
/**
*
*
* @param examTaskAnswer
* @return
*/
@Override
public List<ExamTaskAnswer> selectExamTaskAnswerList(ExamTaskAnswer examTaskAnswer)
{
return examTaskAnswerMapper.selectExamTaskAnswerList(examTaskAnswer);
}
/**
*
*
* @param examTaskAnswer
* @return
*/
@Override
public int insertExamTaskAnswer(ExamTaskAnswer examTaskAnswer)
{
// 安全删除
examTaskAnswerMapper.deleteExamTaskAnswer(examTaskAnswer);
return examTaskAnswerMapper.insertExamTaskAnswer(examTaskAnswer);
}
/**
*
*
* @param examTaskAnswer
* @return
*/
@Override
public int updateExamTaskAnswer(ExamTaskAnswer examTaskAnswer)
{
return examTaskAnswerMapper.updateExamTaskAnswer(examTaskAnswer);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamTaskAnswerByIds(String[] examCodes)
{
return examTaskAnswerMapper.deleteExamTaskAnswerByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamTaskAnswerById(String examCode)
{
return examTaskAnswerMapper.deleteExamTaskAnswerById(examCode);
}
@Override
public int deleteExamTaskAnswer(ExamTaskAnswer examTaskAnswer) {
// TODO Auto-generated method stub
return examTaskAnswerMapper.deleteExamTaskAnswer(examTaskAnswer);
}
}

View File

@ -1,21 +0,0 @@
package com.hig.onlineexam.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.onlineexam.domain.dto.ExamTitleData;
import com.hig.onlineexam.mapper.ExamTitleDataMapper;
import com.hig.onlineexam.service.IExamTitleDataService;
@Service
public class ExamTitleDataServiceImpl implements IExamTitleDataService {
@Autowired
ExamTitleDataMapper examTitleDataMapper;
@Override
public ExamTitleData selectCurrentExam(String userCode) {
// TODO Auto-generated method stub
return examTitleDataMapper.selectCurrentExam(userCode);
}
}

View File

@ -1,107 +0,0 @@
package com.hig.onlineexam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hig.onlineexam.mapper.ExamUserScoreMapper;
import com.hig.onlineexam.domain.ExamUserScore;
import com.hig.onlineexam.service.IExamUserScoreService;
/**
* Service
*
* @author qnsdt
* @date 2023-03-03
*/
@Service
public class ExamUserScoreServiceImpl implements IExamUserScoreService
{
@Autowired
private ExamUserScoreMapper examUserScoreMapper;
/**
*
*
* @param examCode ID
* @return
*/
@Override
public ExamUserScore selectExamUserScoreById(String examCode)
{
return examUserScoreMapper.selectExamUserScoreById(examCode);
}
/**
*
*
* @param examUserScore
* @return
*/
@Override
public List<ExamUserScore> selectExamUserScoreList(ExamUserScore examUserScore)
{
return examUserScoreMapper.selectExamUserScoreList(examUserScore);
}
/**
*
*
* @param examUserScore
* @return
*/
@Override
public int insertExamUserScore(ExamUserScore examUserScore)
{
return examUserScoreMapper.insertExamUserScore(examUserScore);
}
/**
*
*
* @param examUserScore
* @return
*/
@Override
public int updateExamUserScore(ExamUserScore examUserScore)
{
return examUserScoreMapper.updateExamUserScore(examUserScore);
}
/**
*
*
* @param examCodes ID
* @return
*/
@Override
public int deleteExamUserScoreByIds(String[] examCodes)
{
return examUserScoreMapper.deleteExamUserScoreByIds(examCodes);
}
/**
*
*
* @param examCode ID
* @return
*/
@Override
public int deleteExamUserScoreById(String examCode)
{
return examUserScoreMapper.deleteExamUserScoreById(examCode);
}
@Override
public int intoExamUserScore(ExamUserScore examUserScore) {
// TODO Auto-generated method stub
// 安全删除
examUserScoreMapper.deleteExamUserScore(examUserScore);
return examUserScoreMapper.intoExamUserScore(examUserScore);
}
@Override
public int deleteExamUserScore(ExamUserScore examUserScore) {
// TODO Auto-generated method stub
return examUserScoreMapper.deleteExamUserScore(examUserScore);
}
}

View File

@ -1,103 +0,0 @@
package com.hig.questions.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.questions.domain.ExamBankPicture;
import com.hig.questions.service.IExamBankPictureService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-22
*/
@RestController
@RequestMapping("/questions/bankpicture")
public class ExamBankPictureController extends BaseController
{
@Autowired
private IExamBankPictureService examBankPictureService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:bankpicture:list')")
@GetMapping("/list")
public TableDataInfo list(ExamBankPicture examBankPicture)
{
startPage();
List<ExamBankPicture> list = examBankPictureService.selectExamBankPictureList(examBankPicture);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:bankpicture:export')")
@Log(title = "题库图片", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamBankPicture examBankPicture)
{
List<ExamBankPicture> list = examBankPictureService.selectExamBankPictureList(examBankPicture);
ExcelUtil<ExamBankPicture> util = new ExcelUtil<ExamBankPicture>(ExamBankPicture.class);
return util.exportExcel(list, "题库图片数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:bankpicture:query')")
@GetMapping(value = "/{photoCode}")
public AjaxResult getInfo(@PathVariable("photoCode") String photoCode)
{
return AjaxResult.success(examBankPictureService.selectExamBankPictureById(photoCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:bankpicture:add')")
@Log(title = "题库图片", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamBankPicture examBankPicture)
{
return toAjax(examBankPictureService.insertExamBankPicture(examBankPicture));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:bankpicture:edit')")
@Log(title = "题库图片", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamBankPicture examBankPicture)
{
return toAjax(examBankPictureService.updateExamBankPicture(examBankPicture));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:bankpicture:remove')")
@Log(title = "题库图片", businessType = BusinessType.DELETE)
@DeleteMapping("/{photoCodes}")
public AjaxResult remove(@PathVariable String[] photoCodes)
{
return toAjax(examBankPictureService.deleteExamBankPictureByIds(photoCodes));
}
}

View File

@ -1,109 +0,0 @@
package com.hig.questions.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.questions.domain.ExamQuestionsAnswer;
import com.hig.questions.service.IExamQuestionsAnswerService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-29
*/
@RestController
@RequestMapping("/questions/answer")
public class ExamQuestionsAnswerController extends BaseController
{
@Autowired
private IExamQuestionsAnswerService examQuestionsAnswerService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(ExamQuestionsAnswer examQuestionsAnswer)
{
startPage();
List<ExamQuestionsAnswer> list = examQuestionsAnswerService.selectExamQuestionsAnswerList(examQuestionsAnswer);
return getDataTable(list);
}
@GetMapping("/optionlist/{questionsCode}")
public AjaxResult optionList(@PathVariable("questionsCode") String questionsCode)
{
List<ExamQuestionsAnswer> list = examQuestionsAnswerService.selectExamQuestionsOptionList(questionsCode);
return AjaxResult.success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:answer:export')")
@Log(title = "考试题目答案", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamQuestionsAnswer examQuestionsAnswer)
{
List<ExamQuestionsAnswer> list = examQuestionsAnswerService.selectExamQuestionsAnswerList(examQuestionsAnswer);
ExcelUtil<ExamQuestionsAnswer> util = new ExcelUtil<ExamQuestionsAnswer>(ExamQuestionsAnswer.class);
return util.exportExcel(list, "考试题目答案数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:answer:query')")
@GetMapping(value = "/{questionsCode}")
public AjaxResult getInfo(@PathVariable("questionsCode") String questionsCode)
{
return AjaxResult.success(examQuestionsAnswerService.selectExamQuestionsAnswerById(questionsCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:answer:add')")
@Log(title = "考试题目答案", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody ExamQuestionsAnswer examQuestionsAnswer)
{
return toAjax(examQuestionsAnswerService.insertExamQuestionsAnswer(examQuestionsAnswer));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:answer:edit')")
@Log(title = "考试题目答案", businessType = BusinessType.UPDATE)
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamQuestionsAnswer examQuestionsAnswer)
{
return toAjax(examQuestionsAnswerService.updateExamQuestionsAnswer(examQuestionsAnswer));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:answer:remove')")
@Log(title = "考试题目答案", businessType = BusinessType.DELETE)
@GetMapping("/delete/{questionsCodes}")
public AjaxResult remove(@PathVariable String[] questionsCodes)
{
return toAjax(examQuestionsAnswerService.deleteExamQuestionsAnswerByIds(questionsCodes));
}
}

View File

@ -1,210 +0,0 @@
package com.hig.questions.controller;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.hig.cms.utils.FileUpload;
import com.hig.questions.domain.ExamBankPicture;
import com.hig.questions.domain.ExamQuestionsBank;
import com.hig.questions.service.IExamBankPictureService;
import com.hig.questions.service.IExamQuestionsBankService;
import com.hig.utils.UUIDGenerator;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-19
*/
@RestController
@RequestMapping("/questions/questionsbank")
public class ExamQuestionsBankController extends BaseController
{
private static final Logger log = LoggerFactory.getLogger(ExamQuestionsBankController.class);
@Value("${cms.exam.photo-path:/photo/exam}")
private String photopath;
@Autowired
private IExamQuestionsBankService examQuestionsBankService;
@Autowired
private TokenService tokenService;
@Autowired
private IExamBankPictureService examBankPictureService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsbank:list')")
@GetMapping("/list")
public TableDataInfo list(ExamQuestionsBank examQuestionsBank)
{
startPage();
List<ExamQuestionsBank> list = examQuestionsBankService.selectExamQuestionsBankList(examQuestionsBank);
return getDataTable(list);
}
@GetMapping("/arraylist/{bankCodes}")
public AjaxResult arrayList(@PathVariable("bankCodes") String bankCodes)
{
// startPage();
// log.debug("bankCodes: {}", bankCodes);
List<ExamQuestionsBank> list = examQuestionsBankService.selectExamQuestionsBankListByCode(bankCodes.split(","));
return AjaxResult.success(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsbank:export')")
@Log(title = "题库管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamQuestionsBank examQuestionsBank)
{
List<ExamQuestionsBank> list = examQuestionsBankService.selectExamQuestionsBankList(examQuestionsBank);
ExcelUtil<ExamQuestionsBank> util = new ExcelUtil<ExamQuestionsBank>(ExamQuestionsBank.class);
return util.exportExcel(list, "题库管理数据");
}
/**
*
*/
@Log(title = "题库管理", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('questions:questionsbank:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<ExamQuestionsBank> util = new ExcelUtil<ExamQuestionsBank>(ExamQuestionsBank.class);
List<ExamQuestionsBank> examQuestionsBankList = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername();
String message = examQuestionsBankService.importExamQuestionsBank(examQuestionsBankList, updateSupport, operName);
return AjaxResult.success(message);
}
/**
*
*/
@GetMapping("/importTemplate")
public AjaxResult importTemplate()
{
ExcelUtil<ExamQuestionsBank> util = new ExcelUtil<ExamQuestionsBank>(ExamQuestionsBank.class);
return util.importTemplateExcel("题库管理数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsbank:query')")
@GetMapping(value = "/{bankCode}")
public AjaxResult getInfo(@PathVariable("bankCode") String bankCode)
{
return AjaxResult.success(examQuestionsBankService.selectExamQuestionsBankById(bankCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsbank:add')")
@Log(title = "题库管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamQuestionsBank examQuestionsBank)
{
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
log.debug("用户名: {}", loginUser.getUser().getUserName());
log.debug("部门ID: {}", loginUser.getUser().getDept().getDeptId());
examQuestionsBank.setCreateBy(loginUser.getUser().getUserName());
examQuestionsBank.setCreateDept(loginUser.getUser().getDept().getDeptId());
examQuestionsBank.setBankCode(UUIDGenerator.generate());
log.debug("examQuestionsBank: {}", examQuestionsBank.toString());
return toAjax(examQuestionsBankService.insertExamQuestionsBank(examQuestionsBank));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsbank:edit')")
@Log(title = "题库管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamQuestionsBank examQuestionsBank)
{
log.debug("examQuestionsBank: {}", examQuestionsBank.toString());
return toAjax(examQuestionsBankService.updateExamQuestionsBank(examQuestionsBank));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsbank:remove')")
@Log(title = "题库管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{bankCodes}")
public AjaxResult remove(@PathVariable String[] bankCodes)
{
return toAjax(examQuestionsBankService.deleteExamQuestionsBankByIds(bankCodes));
}
/**
*
*/
@PostMapping("/uploadphoto/{bankcode}")
public AjaxResult uploadPhoto(@PathVariable String bankcode,
@RequestParam("file") MultipartFile file)
{
// 取得原始文件名
String originalfile = file.getOriginalFilename();
// 拼接路径
String path = RuoYiConfig.getProfile() + photopath;
log.debug("拼接路径为: {}", path);
String filename = FileUpload.writeUploadFile(file,path);
String fileurl = photopath + "/" + filename;
log.debug("fileurl: {}", fileurl);
int count = 0;
// 相应赋值
ExamBankPicture examBankPicture = new ExamBankPicture(bankcode, path, fileurl, filename, originalfile);
log.debug("examBankPicture: {}", examBankPicture.toString());
try
{
examBankPictureService.deleteExamBankPictureById(bankcode);
count = examBankPictureService.insertExamBankPicture(examBankPicture);
}
catch(Exception e)
{
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(examBankPicture);
}
}

View File

@ -1,102 +0,0 @@
package com.hig.questions.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hig.questions.domain.ExamQuestionsContent;
import com.hig.questions.service.IExamQuestionsContentService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-28
*/
@RestController
@RequestMapping("/questions/questionscontent")
public class ExamQuestionsContentController extends BaseController
{
@Autowired
private IExamQuestionsContentService examQuestionsContentService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionscontent:list')")
@GetMapping("/list")
public TableDataInfo list(ExamQuestionsContent examQuestionsContent)
{
startPage();
List<ExamQuestionsContent> list = examQuestionsContentService.selectExamQuestionsContentList(examQuestionsContent);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionscontent:export')")
@Log(title = "题目内容表", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamQuestionsContent examQuestionsContent)
{
List<ExamQuestionsContent> list = examQuestionsContentService.selectExamQuestionsContentList(examQuestionsContent);
ExcelUtil<ExamQuestionsContent> util = new ExcelUtil<ExamQuestionsContent>(ExamQuestionsContent.class);
return util.exportExcel(list, "题目内容表数据");
}
/**
*
*/
@GetMapping(value = "/{questionsCode}")
public AjaxResult getInfo(@PathVariable("questionsCode") String questionsCode)
{
return AjaxResult.success(examQuestionsContentService.selectExamQuestionsContentById(questionsCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionscontent:add')")
@Log(title = "题目内容表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ExamQuestionsContent examQuestionsContent)
{
return toAjax(examQuestionsContentService.insertExamQuestionsContent(examQuestionsContent));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionscontent:edit')")
@Log(title = "题目内容表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ExamQuestionsContent examQuestionsContent)
{
return toAjax(examQuestionsContentService.updateExamQuestionsContent(examQuestionsContent));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionscontent:remove')")
@Log(title = "题目内容表", businessType = BusinessType.DELETE)
@DeleteMapping("/{questionsCodes}")
public AjaxResult remove(@PathVariable String[] questionsCodes)
{
return toAjax(examQuestionsContentService.deleteExamQuestionsContentByIds(questionsCodes));
}
}

View File

@ -1,268 +0,0 @@
package com.hig.questions.controller;
import java.util.*;
import com.ruoyi.common.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.hig.questions.domain.ExamQuestions;
import com.hig.questions.domain.ExamQuestionsAnswer;
import com.hig.questions.domain.ExamQuestionsContent;
import com.hig.questions.domain.ExamQuestionsProperty;
import com.hig.questions.service.IExamQuestionsAnswerService;
import com.hig.questions.service.IExamQuestionsContentService;
import com.hig.questions.service.IExamQuestionsPropertyService;
import com.hig.questions.service.IExamQuestionsService;
import com.hig.utils.UUIDGenerator;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-28
*/
@RestController
@RequestMapping("/questions/examquestions")
public class ExamQuestionsController extends BaseController
{
private static final Logger log = LoggerFactory.getLogger(ExamQuestionsController.class);
@Autowired
private IExamQuestionsService examQuestionsService;
@Autowired
private TokenService tokenService;
@Autowired
private IExamQuestionsAnswerService examQuestionsAnswerService;
@Autowired
private IExamQuestionsContentService examQuestionsContentService;
@Autowired
private IExamQuestionsPropertyService examQuestionsPropertyService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:examquestions:list')")
@GetMapping("/list")
public TableDataInfo list(ExamQuestions examQuestions)
{
startPage();
List<ExamQuestions> list = examQuestionsService.selectExamQuestionsList(examQuestions);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:examquestions:export')")
@Log(title = "考试题目", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamQuestions examQuestions)
{
List<ExamQuestions> list = examQuestionsService.selectExamQuestionsList(examQuestions);
ExcelUtil<ExamQuestions> util = new ExcelUtil<ExamQuestions>(ExamQuestions.class);
return util.exportExcel(list, "考试题目数据");
}
/**
*
*/
@Log(title = "考试题目", businessType = BusinessType.IMPORT)
@PreAuthorize("@ss.hasPermi('questions:examquestions:import')")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport,String bankCode) throws Exception
{
ExcelUtil<ExamQuestions> util = new ExcelUtil<ExamQuestions>(ExamQuestions.class);
List<ExamQuestions> examQuestionsList = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUsername();
List<ExamQuestions> examQuestions=new ArrayList<>();
examQuestionsList.forEach(x->{
x.setBankCode(bankCode);
String tmp= x.getQuestionsTypeStr();
boolean flag=false;
if("判断题".equals(tmp)){
x.setQuestionsType(1);
flag=true;
}
if("单选题".equals(tmp)){
x.setQuestionsType(2);
flag=true;
}
if("多选题".equals(tmp)){
x.setQuestionsType(3);
flag=true;
}
if(flag){
examQuestions.add(x);
}
if(StringUtils.isEmpty(x.getRateNumberStr())){
x.setRateNumber(0);
}else{
x.setRateNumber(x.getRateNumberStr().length()/2);
}
x.setCreateBy(operName);
x.setCreateTime(new Date());
x.setQuestionsCode(UUID.randomUUID().toString());
});
if(CollectionUtils.isEmpty(examQuestions)){
return AjaxResult.error("导入数据为空!");
}
String message = examQuestionsService.importExamQuestions(examQuestions, updateSupport, operName);
return AjaxResult.success(message);
}
/**
*
*/
@GetMapping("/importTemplate")
public AjaxResult importTemplate()
{
ExcelUtil<ExamQuestions> util = new ExcelUtil<ExamQuestions>(ExamQuestions.class);
return util.importTemplateExcel("考试题目数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:examquestions:query')")
@GetMapping(value = "/{questionsCode}")
public AjaxResult getInfo(@PathVariable("questionsCode") String questionsCode)
{
return AjaxResult.success(examQuestionsService.selectExamQuestionsById(questionsCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:examquestions:add')")
@Log(title = "考试题目", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody ExamQuestions examQuestions)
{
// 取得用户单位
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
examQuestions.setCreateBy(loginUser.getUser().getUserName());
examQuestions.setCreateDept(loginUser.getUser().getDept().getDeptId());
List<ExamQuestionsAnswer> answerList = examQuestions.getAnswerList();
ExamQuestionsProperty examQuestionsProperty = new ExamQuestionsProperty(examQuestions.getBankCode(),null,examQuestions.getQuestionsCode(),examQuestions.getQuestionsTitle(),
examQuestions.getQuestionsType(),examQuestions.getQuestionsScore(),examQuestions.getRateNumber(),examQuestions.getRightAnswer(),examQuestions.getAnswerAnalyse(),
0,examQuestions.getCreateBy(), examQuestions.getCreateDept());
ExamQuestionsContent examQuestionsContent = new ExamQuestionsContent(examQuestions.getQuestionsCode(), examQuestions.getQuestionsContent());
log.debug("examQuestionsContent: {}", examQuestionsContent.toString());
// 开始保存数据
// 保存题目选项
// 安全删除
examQuestionsAnswerService.deleteExamQuestionsAnswerById(examQuestions.getQuestionsCode());
for (ExamQuestionsAnswer questionsAnswer: answerList) {
questionsAnswer.setOrderId(null);
examQuestionsAnswerService.insertExamQuestionsAnswer(questionsAnswer);
}
// 保存题目数据
int count = 0;
examQuestionsContentService.deleteExamQuestionsContentById(examQuestions.getQuestionsCode());
count = examQuestionsContentService.insertExamQuestionsContent(examQuestionsContent);
if (count == 0) {
return new AjaxResult(0,"更新题目信息出错!");
}
// 安全删除
examQuestionsPropertyService.deleteExamQuestionsPropertyById(examQuestions.getQuestionsCode());
return toAjax(examQuestionsPropertyService.insertExamQuestionsProperty(examQuestionsProperty));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:examquestions:edit')")
@Log(title = "考试题目", businessType = BusinessType.UPDATE)
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamQuestions examQuestions)
{
List<ExamQuestionsAnswer> answerList = examQuestions.getAnswerList();
ExamQuestionsProperty examQuestionsProperty = new ExamQuestionsProperty(examQuestions.getBankCode(),null,examQuestions.getQuestionsCode(),examQuestions.getQuestionsTitle(),
examQuestions.getQuestionsType(),examQuestions.getQuestionsScore(),examQuestions.getRateNumber(),examQuestions.getRightAnswer(),examQuestions.getAnswerAnalyse(),
0,examQuestions.getCreateBy(), examQuestions.getCreateDept());
ExamQuestionsContent examQuestionsContent = new ExamQuestionsContent(examQuestions.getQuestionsCode(), examQuestions.getQuestionsContent());
// 开始保存数据
// 保存题目选项
// 安全删除
examQuestionsAnswerService.deleteExamQuestionsAnswerById(examQuestions.getQuestionsCode());
for (ExamQuestionsAnswer questionsAnswer: answerList) {
examQuestionsAnswerService.insertExamQuestionsAnswer(questionsAnswer);
}
// 保存题目数据
int count = 0;
examQuestionsContentService.deleteExamQuestionsContentById(examQuestions.getQuestionsCode());
count = examQuestionsContentService.insertExamQuestionsContent(examQuestionsContent);
if (count == 0) {
return new AjaxResult(0,"更新题目信息出错!");
}
return toAjax(examQuestionsPropertyService.updateExamQuestionsProperty(examQuestionsProperty));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:examquestions:remove')")
@Log(title = "考试题目", businessType = BusinessType.DELETE)
@GetMapping("/delete/{questionsCodes}")
public AjaxResult remove(@PathVariable String[] questionsCodes)
{
int count = questionsCodes.length;
for (String questionsCode: questionsCodes) {
examQuestionsAnswerService.deleteExamQuestionsAnswerById(questionsCode);
examQuestionsContentService.deleteExamQuestionsContentById(questionsCode);
examQuestionsPropertyService.deleteExamQuestionsPropertyById(questionsCode);
}
return toAjax(count);
}
}

View File

@ -1,63 +0,0 @@
package com.hig.questions.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.hig.questions.domain.ExamQuestionsList;
import com.hig.questions.domain.ExamQuestionsProperty;
import com.hig.questions.service.IExamQuestionsListService;
import com.hig.questions.service.IExamQuestionsPropertyService;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-28
*/
@RestController
@RequestMapping("/questions/questionslist")
public class ExamQuestionsListController extends BaseController
{
@Autowired
private IExamQuestionsListService examQuestionsListService;
@Autowired
private TokenService tokenService;
/**
*
*/
@GetMapping("/list")
public TableDataInfo list(ExamQuestionsList examQuestionsList)
{
startPage();
List<ExamQuestionsProperty> list = examQuestionsListService.selectExamQuestionsList(examQuestionsList.getBankCodes());
return getDataTable(list);
}
@GetMapping("/selectlist/{examCode}")
public AjaxResult selectList(@PathVariable("examCode") String examCode)
{
List<ExamQuestionsProperty> list = examQuestionsListService.selectChoiceExamQuestionsList(examCode);
return AjaxResult.success(list);
}
}

View File

@ -1,113 +0,0 @@
package com.hig.questions.controller;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.enums.BusinessType;
import com.hig.questions.domain.ExamQuestionsProperty;
import com.hig.questions.service.IExamQuestionsPropertyService;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author qnsdt
* @date 2022-12-28
*/
@RestController
@RequestMapping("/questions/questionsproperty")
public class ExamQuestionsPropertyController extends BaseController
{
@Autowired
private IExamQuestionsPropertyService examQuestionsPropertyService;
@Autowired
private TokenService tokenService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsproperty:list')")
@GetMapping("/list")
public TableDataInfo list(ExamQuestionsProperty examQuestionsProperty)
{
startPage();
List<ExamQuestionsProperty> list = examQuestionsPropertyService.selectExamQuestionsPropertyList(examQuestionsProperty);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsproperty:export')")
@Log(title = "题目属性", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(ExamQuestionsProperty examQuestionsProperty)
{
List<ExamQuestionsProperty> list = examQuestionsPropertyService.selectExamQuestionsPropertyList(examQuestionsProperty);
ExcelUtil<ExamQuestionsProperty> util = new ExcelUtil<ExamQuestionsProperty>(ExamQuestionsProperty.class);
return util.exportExcel(list, "题目属性数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsproperty:query')")
@GetMapping(value = "/{questionsCode}")
public AjaxResult getInfo(@PathVariable("questionsCode") String questionsCode)
{
return AjaxResult.success(examQuestionsPropertyService.selectExamQuestionsPropertyById(questionsCode));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsproperty:add')")
@Log(title = "题目属性", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody ExamQuestionsProperty examQuestionsProperty)
{
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
examQuestionsProperty.setCreateBy(loginUser.getUser().getUserName());
examQuestionsProperty.setCreateDept(loginUser.getUser().getDept().getDeptId());
return toAjax(examQuestionsPropertyService.insertExamQuestionsProperty(examQuestionsProperty));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsproperty:edit')")
@Log(title = "题目属性", businessType = BusinessType.UPDATE)
@PostMapping("/update")
public AjaxResult edit(@RequestBody ExamQuestionsProperty examQuestionsProperty)
{
return toAjax(examQuestionsPropertyService.updateExamQuestionsProperty(examQuestionsProperty));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('questions:questionsproperty:remove')")
@Log(title = "题目属性", businessType = BusinessType.DELETE)
@GetMapping("/delete/{questionsCodes}")
public AjaxResult remove(@PathVariable String[] questionsCodes)
{
return toAjax(examQuestionsPropertyService.deleteExamQuestionsPropertyByIds(questionsCodes));
}
}

Some files were not shown because too many files have changed in this diff Show More