From ad02c4ad5046a56be15eb6980435ab1ac96aded4 Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Fri, 21 Aug 2020 14:00:22 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=B1=95=E7=A4=BAbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 ++ .../tms/api/EvaluationRulesControllerApi.java | 6 - .../msdw/tms/api/QuestionsControllerApi.java | 10 +- .../msdw/tms/common/utils/FilesResult.java | 36 +--- .../msdw/tms/config/MybatisPlusConfig.java | 18 ++ .../controller/EvaluationRulesController.java | 9 +- .../tms/controller/QuestionsController.java | 20 +- .../tms/entity/EvaluationRulesEntity.java | 5 +- .../com/msdw/tms/entity/QuestionsEntity.java | 4 +- .../msdw/tms/entity/XlsxTemplateEntity.java | 5 +- .../entity/request/QuestionsAddRequest.java | 18 +- .../request/QuestionsImportRequest.java | 2 - .../entity/request/QuestionsQueryRequest.java | 4 +- .../request/QuestionsUpdateRequest.java | 18 +- .../msdw/tms/entity/response/CommonCode.java | 10 +- .../msdw/tms/entity/response/Response.java | 4 +- .../tms/entity/response/ResponseResult.java | 6 - .../msdw/tms/entity/vo/EvaluationRulesVO.java | 4 - .../com/msdw/tms/entity/vo/EvaluationVO.java | 2 - .../msdw/tms/entity/vo/QuestionsDetailVO.java | 3 - .../com/msdw/tms/entity/vo/QuestionsVO.java | 2 - .../msdw/tms/service/AliyunOssService.java | 3 - .../tms/service/EvaluationRulesService.java | 2 - .../msdw/tms/service/XlsxTemplateService.java | 2 - .../service/impl/AliyunOssServiceImpl.java | 12 +- .../impl/EvaluationRulesServiceImpl.java | 24 +-- .../service/impl/QuestionsServiceImpl.java | 177 ++++++++---------- .../com/msdw/tms/TmsApplicationTests.java | 56 ++++-- .../tms/service/AliyunOssServiceTest.java | 62 ++++++ .../service/EvaluationRulesServiceTest.java | 33 ++++ .../tms/service/QuestionsServiceTest.java | 122 ++++++++++++ 31 files changed, 426 insertions(+), 265 deletions(-) create mode 100644 src/main/java/com/msdw/tms/config/MybatisPlusConfig.java create mode 100644 src/test/java/com/msdw/tms/service/AliyunOssServiceTest.java create mode 100644 src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java create mode 100644 src/test/java/com/msdw/tms/service/QuestionsServiceTest.java diff --git a/pom.xml b/pom.xml index 26abadc..a3e1a73 100644 --- a/pom.xml +++ b/pom.xml @@ -98,6 +98,18 @@ + + commons-io + commons-io + 2.6 + test + + + commons-fileupload + commons-fileupload + 1.4 + test + diff --git a/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java b/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java index ebafe18..dda9144 100644 --- a/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java +++ b/src/main/java/com/msdw/tms/api/EvaluationRulesControllerApi.java @@ -4,18 +4,12 @@ import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.EvaluationRulesEntity; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.springframework.web.bind.annotation.*; - -import java.util.Arrays; -import java.util.Map; /** * 测评规则信息记录,只记录一条信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Api(value = "测评规则管理", tags = "测评规则的查询和修改") public interface EvaluationRulesControllerApi { diff --git a/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java b/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java index ce25d72..bf4d9e7 100644 --- a/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java +++ b/src/main/java/com/msdw/tms/api/QuestionsControllerApi.java @@ -7,7 +7,6 @@ import com.msdw.tms.entity.request.QuestionsUpdateRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; @@ -18,8 +17,6 @@ import java.io.IOException; * 记录试题信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Api(value = "试题信息管理", tags = "提供试题信息的增删改查及导入等功能") public interface QuestionsControllerApi { @@ -54,7 +51,7 @@ public interface QuestionsControllerApi { * 是否禁用试题 */ @ApiOperation(value = "是否禁用试题", notes = "是否禁用试题") - R isnable(@ApiParam(name = "id", value = "试题主键", required = true) Integer id); + R isNable(@ApiParam(name = "id", value = "试题主键", required = true) Integer id); /** * 删除 @@ -70,17 +67,12 @@ public interface QuestionsControllerApi { /** * excel模板文件上传 - * - * @param file - * @return */ @ApiOperation(value = "excel模板文件上传", notes = "excel模板文件上传") R uploadFiles(@ApiParam(name = "file", value = "excel文件", required = true) MultipartFile file) throws IOException; /** * excel模板文件下载 - * - * @return */ @ApiOperation(value = "excel模板文件下载", notes = "excel模板文件下载") R downloadFiles(HttpServletResponse response) throws IOException; diff --git a/src/main/java/com/msdw/tms/common/utils/FilesResult.java b/src/main/java/com/msdw/tms/common/utils/FilesResult.java index 103ac4b..aa36a77 100644 --- a/src/main/java/com/msdw/tms/common/utils/FilesResult.java +++ b/src/main/java/com/msdw/tms/common/utils/FilesResult.java @@ -1,41 +1,15 @@ package com.msdw.tms.common.utils; -public class FilesResult { +import lombok.Data; +import lombok.ToString; +@Data +@ToString +public class FilesResult { // 文件名 private String fileName; // 文件在储存空间的路径 private String fileUrl; // 上传状态 private String status; - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public String getFileUrl() { - return fileUrl; - } - - public void setFileUrl(String fileUrl) { - this.fileUrl = fileUrl; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - @Override - public String toString() { - return "UploadFilesResult [fileName=" + fileName + ", fileUrl=" + fileUrl + ", status=" + status + "]"; - } - } diff --git a/src/main/java/com/msdw/tms/config/MybatisPlusConfig.java b/src/main/java/com/msdw/tms/config/MybatisPlusConfig.java new file mode 100644 index 0000000..e206ea3 --- /dev/null +++ b/src/main/java/com/msdw/tms/config/MybatisPlusConfig.java @@ -0,0 +1,18 @@ +package com.msdw.tms.config; + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class MybatisPlusConfig { + /** + * mybatis-plus分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + PaginationInterceptor page = new PaginationInterceptor(); + page.setDialectType("mysql"); + return page; + } +} \ No newline at end of file diff --git a/src/main/java/com/msdw/tms/controller/EvaluationRulesController.java b/src/main/java/com/msdw/tms/controller/EvaluationRulesController.java index 0efa731..99f70bd 100644 --- a/src/main/java/com/msdw/tms/controller/EvaluationRulesController.java +++ b/src/main/java/com/msdw/tms/controller/EvaluationRulesController.java @@ -5,22 +5,21 @@ import com.msdw.tms.common.utils.R; import com.msdw.tms.entity.EvaluationRulesEntity; import com.msdw.tms.entity.vo.EvaluationRulesVO; import com.msdw.tms.service.EvaluationRulesService; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; + /** * 测评规则信息记录,只记录一条信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @RestController @RequestMapping("tms/evaluationrules") public class EvaluationRulesController implements EvaluationRulesControllerApi { - @Autowired - private EvaluationRulesService evaluationRulesService; + @Resource + EvaluationRulesService evaluationRulesService; /** * 测评规则信息的展示 diff --git a/src/main/java/com/msdw/tms/controller/QuestionsController.java b/src/main/java/com/msdw/tms/controller/QuestionsController.java index bce1ca3..036b0de 100644 --- a/src/main/java/com/msdw/tms/controller/QuestionsController.java +++ b/src/main/java/com/msdw/tms/controller/QuestionsController.java @@ -9,12 +9,12 @@ import com.msdw.tms.entity.request.QuestionsQueryRequest; import com.msdw.tms.entity.request.QuestionsUpdateRequest; import com.msdw.tms.entity.vo.EvaluationVO; import com.msdw.tms.entity.vo.QuestionsDetailVO; -import com.msdw.tms.service.AliyunOssService; import com.msdw.tms.service.QuestionsService; -import org.springframework.beans.factory.annotation.Autowired; +import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.Arrays; @@ -24,17 +24,13 @@ import java.util.Arrays; * 记录试题信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @RestController @RequestMapping("tms/questions") public class QuestionsController implements QuestionsControllerApi { - @Autowired - private QuestionsService questionsService; - @Autowired - private AliyunOssService ossService; + @Resource + QuestionsService questionsService; /** * 列表 @@ -66,6 +62,7 @@ public class QuestionsController implements QuestionsControllerApi { /** * 保存 */ + @ApiOperation(value = "新增一道试题", notes = "传入新增试题所需相关参数") @Override @PostMapping("/save") //@RequiresPermissions("qms:questions:save") @@ -93,7 +90,7 @@ public class QuestionsController implements QuestionsControllerApi { @Override @PutMapping("/isnable") //@RequiresPermissions("qms:questions:isnable") - public R isnable(Integer id) { + public R isNable(Integer id) { boolean b = questionsService.isnable(id); return b ? R.ok() : R.error(); @@ -125,9 +122,6 @@ public class QuestionsController implements QuestionsControllerApi { /** * excel模板文件上传 - * - * @param file - * @return */ @Override @PostMapping("/upload") @@ -139,8 +133,6 @@ public class QuestionsController implements QuestionsControllerApi { /** * excel模板文件下载 - * - * @return */ @Override @GetMapping("/download") diff --git a/src/main/java/com/msdw/tms/entity/EvaluationRulesEntity.java b/src/main/java/com/msdw/tms/entity/EvaluationRulesEntity.java index 88f776e..9f25968 100644 --- a/src/main/java/com/msdw/tms/entity/EvaluationRulesEntity.java +++ b/src/main/java/com/msdw/tms/entity/EvaluationRulesEntity.java @@ -2,17 +2,14 @@ package com.msdw.tms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; import java.io.Serializable; -import java.util.Date; -import lombok.Data; /** * 测评规则信息记录,只记录一条信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data @TableName("tms_evaluation_rules") diff --git a/src/main/java/com/msdw/tms/entity/QuestionsEntity.java b/src/main/java/com/msdw/tms/entity/QuestionsEntity.java index f6ea702..fd56112 100644 --- a/src/main/java/com/msdw/tms/entity/QuestionsEntity.java +++ b/src/main/java/com/msdw/tms/entity/QuestionsEntity.java @@ -2,17 +2,15 @@ package com.msdw.tms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; import java.io.Serializable; import java.util.Date; -import lombok.Data; /** * 记录试题信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data @TableName("tms_questions") diff --git a/src/main/java/com/msdw/tms/entity/XlsxTemplateEntity.java b/src/main/java/com/msdw/tms/entity/XlsxTemplateEntity.java index cb3757a..163a0de 100644 --- a/src/main/java/com/msdw/tms/entity/XlsxTemplateEntity.java +++ b/src/main/java/com/msdw/tms/entity/XlsxTemplateEntity.java @@ -2,17 +2,14 @@ package com.msdw.tms.entity; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; import java.io.Serializable; -import java.util.Date; -import lombok.Data; /** * 模板文件信息记录 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data @TableName("tms_xlsx_template") diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java index 5d3da9e..8c52299 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsAddRequest.java @@ -8,8 +8,6 @@ import lombok.Data; * 试题的基本信息表 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-14 16:05:06 */ @Data @ApiModel(value = "QuestionsAddRequest", description = "添加试题请求体对象") @@ -27,32 +25,32 @@ public class QuestionsAddRequest { /** * A选项内容 */ - @ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼", required = false) + @ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼") private String optionA; /** * B选项内容 */ - @ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼", required = false) + @ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼") private String optionB; /** * C选项内容 */ - @ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马", required = false) + @ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马") private String optionC; /** * D选项内容 */ - @ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子", required = false) + @ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子") private String optionD; /** * E选项内容 */ - @ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象", required = false) + @ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象") private String optionE; /** * F选项内容 */ - @ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎", required = false) + @ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎") private String optionF; /** * 正确答案 @@ -62,11 +60,11 @@ public class QuestionsAddRequest { /** * 答案解析 */ - @ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物", required = false) + @ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物") private String answerAnalysis; /** * 试题科目 */ - @ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识", required = false) + @ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识") private String subjects; } diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java index 6ae49e1..77c6cf4 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java @@ -7,8 +7,6 @@ import lombok.Data; * 试题的基本信息表 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-14 16:05:06 */ @Data public class QuestionsImportRequest { diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java index 635285d..62f98bd 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java @@ -8,8 +8,6 @@ import lombok.Data; * 试题的基本信息表 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-14 16:05:06 */ @Data @ApiModel(value = "QuestionsQueryRequest", description = "条件查询请求对象") @@ -18,7 +16,7 @@ public class QuestionsQueryRequest { /** * 题干,问题描述 */ - @ApiModelProperty(value = "题干,问题描述", name = "questionStem", example = "世界上最大的哺乳动物是什么?", required = false) + @ApiModelProperty(value = "题干,问题描述", name = "questionStem", example = "世界上最大的哺乳动物是什么?") private String questionStem; // /** diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java index defadbb..494a20c 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsUpdateRequest.java @@ -8,8 +8,6 @@ import lombok.Data; * 试题的基本信息表 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-14 16:05:06 */ @Data @ApiModel(value = "QuestionsUpdateRequest", description = "修改试题请求体对象") @@ -32,32 +30,32 @@ public class QuestionsUpdateRequest { /** * A选项内容 */ - @ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼", required = false) + @ApiModelProperty(value = "A选项内容", name = "optionA", example = "鲸鱼") private String optionA; /** * B选项内容 */ - @ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼", required = false) + @ApiModelProperty(value = "B选项内容", name = "optionB", example = "鲨鱼") private String optionB; /** * C选项内容 */ - @ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马", required = false) + @ApiModelProperty(value = "C选项内容", name = "optionC", example = "河马") private String optionC; /** * D选项内容 */ - @ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子", required = false) + @ApiModelProperty(value = "D选项内容", name = "optionD", example = "豹子") private String optionD; /** * E选项内容 */ - @ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象", required = false) + @ApiModelProperty(value = "E选项内容", name = "optionE", example = "大象") private String optionE; /** * F选项内容 */ - @ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎", required = false) + @ApiModelProperty(value = "F选项内容", name = "optionF", example = "老虎") private String optionF; /** * 正确答案 @@ -67,11 +65,11 @@ public class QuestionsUpdateRequest { /** * 答案解析 */ - @ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物", required = false) + @ApiModelProperty(value = "答案解析", name = "answerAnalysis", example = "鲸鱼是最大的哺乳动物") private String answerAnalysis; /** * 试题科目 */ - @ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识", required = false) + @ApiModelProperty(value = "试题科目", name = "subjects", example = "基础通识") private String subjects; } diff --git a/src/main/java/com/msdw/tms/entity/response/CommonCode.java b/src/main/java/com/msdw/tms/entity/response/CommonCode.java index 5f33b78..19b0501 100644 --- a/src/main/java/com/msdw/tms/entity/response/CommonCode.java +++ b/src/main/java/com/msdw/tms/entity/response/CommonCode.java @@ -2,13 +2,6 @@ package com.msdw.tms.entity.response; import lombok.ToString; -/** - * @Author: mrt. - * @Description: - * @Date:Created in 2018/1/24 18:33. - * @Modified By: - */ - @ToString public enum CommonCode implements ResultCode { @@ -21,7 +14,6 @@ public enum CommonCode implements ResultCode { QUESTIONTYPE_INVALID(false, 10005, "题型错误!"), FAIL(false, 11111, "操作失败!"), SERVER_ERROR(false, 99999, "抱歉,系统繁忙,请稍后重试!"); - // private static ImmutableMap codes ; //操作是否成功 boolean success; //操作代码 @@ -29,7 +21,7 @@ public enum CommonCode implements ResultCode { //提示信息 String message; - private CommonCode(boolean success, int code, String message) { + CommonCode(boolean success, int code, String message) { this.success = success; this.code = code; this.message = message; diff --git a/src/main/java/com/msdw/tms/entity/response/Response.java b/src/main/java/com/msdw/tms/entity/response/Response.java index 9c159ea..35b841e 100644 --- a/src/main/java/com/msdw/tms/entity/response/Response.java +++ b/src/main/java/com/msdw/tms/entity/response/Response.java @@ -4,6 +4,6 @@ package com.msdw.tms.entity.response; * Created by admin on 2018/3/5. */ public interface Response { - public static final boolean SUCCESS = true; - public static final int SUCCESS_CODE = 10000; + boolean SUCCESS = true; + int SUCCESS_CODE = 10000; } diff --git a/src/main/java/com/msdw/tms/entity/response/ResponseResult.java b/src/main/java/com/msdw/tms/entity/response/ResponseResult.java index 0897404..c05f8ed 100644 --- a/src/main/java/com/msdw/tms/entity/response/ResponseResult.java +++ b/src/main/java/com/msdw/tms/entity/response/ResponseResult.java @@ -4,12 +4,6 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.ToString; -/** - * @Author: mrt. - * @Description: - * @Date:Created in 2018/1/24 18:33. - * @Modified By: - */ @Data @ToString @NoArgsConstructor diff --git a/src/main/java/com/msdw/tms/entity/vo/EvaluationRulesVO.java b/src/main/java/com/msdw/tms/entity/vo/EvaluationRulesVO.java index d8e375e..c331a09 100644 --- a/src/main/java/com/msdw/tms/entity/vo/EvaluationRulesVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/EvaluationRulesVO.java @@ -1,7 +1,5 @@ package com.msdw.tms.entity.vo; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.io.Serializable; @@ -10,8 +8,6 @@ import java.io.Serializable; * 测评规则信息记录,只记录一条信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data public class EvaluationRulesVO implements Serializable { diff --git a/src/main/java/com/msdw/tms/entity/vo/EvaluationVO.java b/src/main/java/com/msdw/tms/entity/vo/EvaluationVO.java index c4ce69e..68a8172 100644 --- a/src/main/java/com/msdw/tms/entity/vo/EvaluationVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/EvaluationVO.java @@ -10,8 +10,6 @@ import java.util.Set; * 测评规则信息记录,只记录一条信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data @TableName("tms_evaluation_rules") diff --git a/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java b/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java index 43dbb70..9d32676 100644 --- a/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java @@ -3,14 +3,11 @@ package com.msdw.tms.entity.vo; import lombok.Data; import java.io.Serializable; -import java.util.Date; /** * 记录试题信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data public class QuestionsDetailVO implements Serializable { diff --git a/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java b/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java index f1342ce..64a5c14 100644 --- a/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java @@ -9,8 +9,6 @@ import java.io.Serializable; * 试题列表展示信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ @Data @ToString diff --git a/src/main/java/com/msdw/tms/service/AliyunOssService.java b/src/main/java/com/msdw/tms/service/AliyunOssService.java index 5c12e80..9833ba4 100644 --- a/src/main/java/com/msdw/tms/service/AliyunOssService.java +++ b/src/main/java/com/msdw/tms/service/AliyunOssService.java @@ -18,15 +18,12 @@ public interface AliyunOssService { /** * 下载文件 * - * @param response * @param objectName 本地路径 */ void downloadFiles(HttpServletResponse response, String objectName) throws IOException; /** * 根据文件路径+文件名称,删除该文件 - * - * @param filename */ void deleteFile(String filename); } diff --git a/src/main/java/com/msdw/tms/service/EvaluationRulesService.java b/src/main/java/com/msdw/tms/service/EvaluationRulesService.java index a9578a3..48f31b9 100644 --- a/src/main/java/com/msdw/tms/service/EvaluationRulesService.java +++ b/src/main/java/com/msdw/tms/service/EvaluationRulesService.java @@ -8,8 +8,6 @@ import com.msdw.tms.entity.vo.EvaluationRulesVO; * 测评规则信息记录,只记录一条信息 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ public interface EvaluationRulesService extends IService { EvaluationRulesVO getEvaluationRules(); diff --git a/src/main/java/com/msdw/tms/service/XlsxTemplateService.java b/src/main/java/com/msdw/tms/service/XlsxTemplateService.java index 9f36b79..d478256 100644 --- a/src/main/java/com/msdw/tms/service/XlsxTemplateService.java +++ b/src/main/java/com/msdw/tms/service/XlsxTemplateService.java @@ -7,8 +7,6 @@ import com.msdw.tms.entity.XlsxTemplateEntity; * 模板文件信息记录 * * @author gongsj - * @email gongsj@gmail.com - * @date 2020-08-19 09:28:06 */ public interface XlsxTemplateService extends IService { } diff --git a/src/main/java/com/msdw/tms/service/impl/AliyunOssServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/AliyunOssServiceImpl.java index e5acfc7..5a687f4 100644 --- a/src/main/java/com/msdw/tms/service/impl/AliyunOssServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/AliyunOssServiceImpl.java @@ -6,10 +6,10 @@ import com.msdw.tms.common.utils.FilesResult; import com.msdw.tms.config.AliyunOssConfig; import com.msdw.tms.service.AliyunOssService; import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @@ -19,11 +19,11 @@ import java.io.IOException; @Service public class AliyunOssServiceImpl implements AliyunOssService { - @Autowired - private AliyunOssConfig config; + @Resource + AliyunOssConfig config; - @Autowired - private BeanFactory beanFactory; + @Resource + BeanFactory beanFactory; /** * 上传文件 @@ -38,7 +38,6 @@ public class AliyunOssServiceImpl implements AliyunOssService { /** * 下载文件 * - * @param response * @param objectName 本地路径 */ public void downloadFiles(HttpServletResponse response, String objectName) throws IOException { @@ -49,7 +48,6 @@ public class AliyunOssServiceImpl implements AliyunOssService { /** * 根据文件路径+文件名称,删除该文件 * - * @param filename */ public void deleteFile(String filename) { OSSClient client = beanFactory.getBean(OSSClient.class); diff --git a/src/main/java/com/msdw/tms/service/impl/EvaluationRulesServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/EvaluationRulesServiceImpl.java index 66afb7d..3977fd4 100644 --- a/src/main/java/com/msdw/tms/service/impl/EvaluationRulesServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/EvaluationRulesServiceImpl.java @@ -12,32 +12,34 @@ import com.msdw.tms.entity.vo.EvaluationRulesVO; import com.msdw.tms.service.EvaluationRulesService; import com.msdw.tms.service.QuestionsService; import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + @Service("evaluationRulesService") public class EvaluationRulesServiceImpl extends ServiceImpl implements EvaluationRulesService { - @Autowired + @Resource QuestionsService questionsService; + //TODO 此表数据可存在redis中,提高系统性能 @Override public EvaluationRulesVO getEvaluationRules() { EvaluationRulesVO evaluationRulesVO = new EvaluationRulesVO(); EvaluationRulesEntity evaluationRules = this.getById(Constant.EVALUATION_RULES_ID); - if (evaluationRules.getEvaluationType() == Constant.RulesType.CUSTOMIZE.getType()) {//自定义 + if (evaluationRules.getEvaluationType().equals(Constant.RulesType.CUSTOMIZE.getType())) {//自定义 int totalNum = 0; - if (evaluationRules.getIsSingleEnable() == Constant.IsEnable.ENABLE.getType()) {//启用 + if (evaluationRules.getIsSingleEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 totalNum += evaluationRules.getSingleNum(); } - if (evaluationRules.getIsMultipleEnable() == Constant.IsEnable.ENABLE.getType()) {//启用 + if (evaluationRules.getIsMultipleEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 totalNum += evaluationRules.getMultipleNum(); } - if (evaluationRules.getIsJudgmentEnable() == Constant.IsEnable.ENABLE.getType()) {//启用 + if (evaluationRules.getIsJudgmentEnable().equals(Constant.IsEnable.ENABLE.getType())) {//启用 totalNum += evaluationRules.getJudgmentNum(); } @@ -76,27 +78,27 @@ public class EvaluationRulesServiceImpl extends ServiceImpl implements QuestionsService { - @Autowired - private AliyunOssService ossService; + @Resource + AliyunOssService ossService; - @Autowired + @Resource XlsxTemplateService xlsxTemplateService; - @Autowired + @Resource EvaluationRulesService evaluationRulesService; /** * 条件加分页查询,题干模糊查询,未删除,修改时间降序 - * - * @param page - * @param size - * @param request - * @return */ @Override public PageUtils queryQuestionsPage(Integer page, Integer size, QuestionsQueryRequest request) { - //请求包装类 + // 请求包装类 QueryWrapper queryWrapper = new QueryWrapper<>(); - //只查询未被删除的试题 + // 只查询未被删除的试题 queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()); - //判断请求体是否为空 + // 判断请求体是否为空 if (request != null) { // 题干:判断题干是否为空,不为空则加入搜索条件 if (request.getQuestionStem() != null) { queryWrapper.like("question_stem", request.getQuestionStem()); } -// 题型:判断题型是否为空,不为空则加入搜索条件 -// if (questionsRequest.getQuestionType() != null) { -// queryWrapper.eq("question_type", questionsRequest.getQuestionType()); -// } -// 修改时间:判断修改时间是否为空,不为空则加入搜索条件 -// if (questionsRequest.getModifyTime() != null) { -// queryWrapper.eq("modify_time", questionsRequest.getModifyTime()); -// } + //TODO 扩展搜索条件 + // 题型:判断题型是否为空,不为空则加入搜索条件 + // if (questionsRequest.getQuestionType() != null) { + // queryWrapper.eq("question_type", questionsRequest.getQuestionType()); + // } + // 修改时间:判断修改时间是否为空,不为空则加入搜索条件 + // if (questionsRequest.getModifyTime() != null) { + // queryWrapper.eq("modify_time", questionsRequest.getModifyTime()); + // } } - //修改时间降序 + // 修改时间降序 queryWrapper.orderByDesc("modify_time"); - IPage questionsEntityIPage = this.page( + IPage questionsIPage = this.page( new Query().getPage(page, size), queryWrapper ); - PageUtils questionsPage = new PageUtils(questionsEntityIPage); - List list = (List) questionsPage.getList(); + List records = questionsIPage.getRecords(); - List collect = list.stream().map(item -> { + List questions = records.stream().map(question -> { QuestionsVO questionsVO = new QuestionsVO(); - BeanUtils.copyProperties(item, questionsVO); + BeanUtils.copyProperties(question, questionsVO); //处理时间格式 - questionsVO.setCreateTime(handleTime(item.getCreateTime())); - questionsVO.setModifyTime(handleTime(item.getModifyTime())); + questionsVO.setCreateTime(handleTime(question.getCreateTime())); + questionsVO.setModifyTime(handleTime(question.getModifyTime())); return questionsVO; }).collect(Collectors.toList()); - questionsPage.setList(collect); + PageUtils questionsPage = new PageUtils(questionsIPage); + + new PageUtils(questionsIPage).setList(questions); return questionsPage; } @@ -161,9 +157,6 @@ public class QuestionsServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("is_del", Constant.IsDel.NOT_DEL.getType()) + .eq("question_stem", questions.getQuestionStem()); + int count = this.count(queryWrapper); + if (count > 0) {//说明已存在 + //抛出题目已存在异常 + ExceptionCast.cast(CommonCode.QUESTION_EXISTS); } + // 将传入的对象内容拷贝到QuestionsEntity并返回 + QuestionsEntity questionsEntity = getQuestionsEntity(questions); + questionsEntity.setCreateTime(new Date()); questionsEntity.setModifyTime(new Date()); //TODO 创建者和修改者。。。 @@ -208,18 +192,38 @@ public class QuestionsServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("id", questions.getId()) + .eq("question_stem", questions.getQuestionStem()) + .eq("is_del", Constant.IsDel.NOT_DEL.getType()); + int count = this.count(queryWrapper); + if (count > 0) {//说明除了本题之外题干已存在 + //抛出题目已存在异常 + ExceptionCast.cast(CommonCode.QUESTION_EXISTS); + } // 判断id是否存在 if (this.getById(questions.getId()) == null) { ExceptionCast.cast(CommonCode.INVALID_PARAM); } + // 将传入的对象内容拷贝到QuestionsEntity并返回 + QuestionsEntity questionsEntity = getQuestionsEntity(questions); + + questionsEntity.setModifyTime(new Date()); + //TODO 设置修改者。。。 + + return this.updateById(questionsEntity); + } + + // 将传入的对象内容拷贝到QuestionsEntity并返回 + private QuestionsEntity getQuestionsEntity(T questions) { QuestionsEntity questionsEntity = new QuestionsEntity(); + BeanUtils.copyProperties(questions, questionsEntity); - String questionType = questions.getQuestionType(); + String questionType = questionsEntity.getQuestionType(); //根据题型名称得到题型号 if (questionType.equals(Constant.QuestionType.SINGLE_CHOICE.getDesc())) { //单选题 @@ -230,23 +234,11 @@ public class QuestionsServiceImpl extends ServiceImpl().eq("question_stem", stem)); - if (count > 0) {//说明已存在 - //抛出题目已存在异常 - ExceptionCast.cast(CommonCode.QUESTION_EXISTS); - } + return questionsEntity; } @Override @@ -255,11 +247,11 @@ public class QuestionsServiceImpl extends ServiceImpl list = new ExcelImportUtil(QuestionsImportRequest.class) - .readExcel(file.getInputStream(), Constant.STARTING_ROW, Constant.STARTING_CELL); + // 使用excel导入工具类获取试题数据列表 + List list = new ExcelImportUtil(QuestionsImportRequest.class).readExcel(file.getInputStream(), Constant.STARTING_ROW, Constant.STARTING_CELL); if (list == null || list.size() == 0) { ExceptionCast.cast(CommonCode.INVALID_PARAM); } - //List unique = persons.stream().collect( - // Collectors.collectingAndThen( - // Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Person::getName))), ArrayList::new) - //); List collect = list.stream().map(item -> { - int count = this.count(new QueryWrapper().eq("question_stem", item.getQuestionStem())); if (count > 0) {//说明已存在 return null; @@ -327,19 +310,18 @@ public class QuestionsServiceImpl extends ServiceImpl question != null).collect(Collectors.collectingAndThen( + }).filter(Objects::nonNull)// 过滤掉为null的对象 + .collect(Collectors.collectingAndThen(// 去重收集 Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(QuestionsEntity::getQuestionStem))), ArrayList::new )); + // 批量新增 return this.saveBatch(collect); } /** * 上传模板文件,修改模板信息表数据 - * - * @param file - * @return */ @Override @Transactional @@ -360,7 +342,6 @@ public class QuestionsServiceImpl extends ServiceImpl singleChoice = this.list(queryWrapper.eq("question_type_no", Constant.QuestionType.SINGLE_CHOICE.getType())); set.addAll(getRandomList(singleNum, singleChoice)); } - if (evaluationRules.getIsMultipleEnable() == Constant.IsEnable.ENABLE.getType()) { + if (evaluationRules.getIsMultipleEnable().equals(Constant.IsEnable.ENABLE.getType())) { multipleNum = evaluationRules.getMultipleNum(); List multipleChoice = this.list(queryWrapper.eq("question_type_no", Constant.QuestionType.MULTIPLE_CHOICE.getType())); - set.addAll(getRandomList(multipleNum, multipleChoice)); } - if (evaluationRules.getIsJudgmentEnable() == Constant.IsEnable.ENABLE.getType()) { + if (evaluationRules.getIsJudgmentEnable().equals(Constant.IsEnable.ENABLE.getType())) { judgmentNum = evaluationRules.getJudgmentNum(); + List judgments = this.list(queryWrapper.eq("question_type_no", Constant.QuestionType.TRUE_OR_FALSE.getType())); set.addAll(getRandomList(judgmentNum, judgments)); } + // 总题数等于各类题目数量之和 evaluation.setQuestionNum(singleNum + multipleNum + judgmentNum); } Set collect = set.stream().map(item -> { @@ -431,7 +416,7 @@ public class QuestionsServiceImpl extends ServiceImpl getRandomList(int len, List list) { Set set = new HashSet<>(); Random random = new Random(); - int i = 0; + int i; while (true) { i = random.nextInt(list.size()); set.add(list.get(i)); diff --git a/src/test/java/com/msdw/tms/TmsApplicationTests.java b/src/test/java/com/msdw/tms/TmsApplicationTests.java index 641de60..648253d 100644 --- a/src/test/java/com/msdw/tms/TmsApplicationTests.java +++ b/src/test/java/com/msdw/tms/TmsApplicationTests.java @@ -3,18 +3,15 @@ package com.msdw.tms; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Date; - @SpringBootTest class TmsApplicationTests { @Test void contextLoads() { + printMsg(1, 2, 3, "哈哈哈"); +// ------------------------------------------------------------------------------------------ + // QuestionsVO questionsVO = new QuestionsVO(); // // QuestionsEntity questionsEntity = new QuestionsEntity(); @@ -43,16 +40,45 @@ class TmsApplicationTests { // // System.out.println(questionsVO.toString()); - Date date = new Date(); - Instant instant = date.toInstant(); - ZoneId zoneId = ZoneId.systemDefault(); +// ------------------------------------------------------------------------------------------ + +// Date date = new Date(); +// Instant instant = date.toInstant(); +// ZoneId zoneId = ZoneId.systemDefault(); +// +// LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); +// System.out.println("Date = " + date); +// System.out.println("LocalDateTime = " + localDateTime); +// String DateNow = localDateTime.format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间 +// // String DateNow = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间 +// System.out.println(DateNow); + } + + void printMsg(T... args) { + for (T t : args) { + System.out.println("t is " + t); + } + } + + /** + * 泛型方法的基本介绍 + * + * @param tClass 传入的泛型实参 + * @return T 返回值为T类型 + * 说明: + * 1)public 与 返回值中间非常重要,可以理解为声明此方法为泛型方法。 + * 2)只有声明了的方法才是泛型方法,泛型类中的使用了泛型的成员方法并不是泛型方法。 + * 3)表明该方法将使用泛型类型T,此时才可以在方法中使用泛型类型T。 + * 4)与泛型类的定义一样,此处T可以随便写为任意标识,常见的如T、E、K、V等形式的参数常用于表示泛型。 + */ + public T genericMethod(Class tClass) throws InstantiationException, + IllegalAccessException { + T instance = tClass.newInstance(); + return instance; + } - LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); - System.out.println("Date = " + date); - System.out.println("LocalDateTime = " + localDateTime); - String DateNow = localDateTime.format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间 - // String DateNow = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss")); // 当前日期和时间 - System.out.println(DateNow); + public T TestG(T t){ + return t; } } diff --git a/src/test/java/com/msdw/tms/service/AliyunOssServiceTest.java b/src/test/java/com/msdw/tms/service/AliyunOssServiceTest.java new file mode 100644 index 0000000..c9583fd --- /dev/null +++ b/src/test/java/com/msdw/tms/service/AliyunOssServiceTest.java @@ -0,0 +1,62 @@ +package com.msdw.tms.service; + +import com.msdw.tms.common.utils.FilesResult; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItem; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.file.Files; + +@SpringBootTest +class AliyunOssServiceTest { + + @Autowired + AliyunOssService aliyunOssService; + + /** + * 测试上传文件 + */ + @Test + void testUploadFiles() throws IOException { + File file = new File("D:\\pic\\1.jpg"); + FileItem fileItem = new DiskFileItem("file", + Files.probeContentType(file.toPath()), + false, + file.getName(), + (int) file.length(), + file.getParentFile()); + IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream()); + MultipartFile multipartFile = new CommonsMultipartFile(fileItem); + FilesResult filesResult = aliyunOssService.uploadFiles(multipartFile); + System.out.println(filesResult.toString()); + } + + /** + * 测试下载文件 + */ + @Test + void testDownloadFiles() throws IOException { + HttpServletResponse response = new MockHttpServletResponse(); + AliyunOssService aliyunOssService = this.aliyunOssService; + aliyunOssService.downloadFiles(response, + "http://liuwanr.oss-cn-shenzhen.aliyuncs.com/jpg/20200807/1596787474773.jpg"); + } + + /** + * 测试根据文件路径+文件名称,删除该文件 + */ + @Test + void testDeleteFile() { + aliyunOssService.deleteFile("http://liuwanr.oss-cn-shenzhen.aliyuncs.com/jpg/20200807/1596787474773.jpg"); + } +} diff --git a/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java b/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java new file mode 100644 index 0000000..7f79ad0 --- /dev/null +++ b/src/test/java/com/msdw/tms/service/EvaluationRulesServiceTest.java @@ -0,0 +1,33 @@ +package com.msdw.tms.service; + +import com.msdw.tms.entity.EvaluationRulesEntity; +import com.msdw.tms.entity.vo.EvaluationRulesVO; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +/** + * 测评规则信息记录,只记录一条信息 + * + * @author gongsj + */ +@SpringBootTest +class EvaluationRulesServiceTest { + + @Autowired + EvaluationRulesService evaluationRulesService; + + @Test + void getEvaluationRules() { + EvaluationRulesVO evaluationRules = evaluationRulesService.getEvaluationRules(); + System.out.println(evaluationRules.toString()); + } + + @Test + void updateEvaluationRulesById() { + EvaluationRulesEntity evaluationRules = new EvaluationRulesEntity(); + boolean b = evaluationRulesService.updateEvaluationRulesById(evaluationRules); + System.out.println(b); + } +} + diff --git a/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java new file mode 100644 index 0000000..1ba4f4f --- /dev/null +++ b/src/test/java/com/msdw/tms/service/QuestionsServiceTest.java @@ -0,0 +1,122 @@ +package com.msdw.tms.service; + +import com.msdw.tms.common.utils.FilesResult; +import com.msdw.tms.common.utils.PageUtils; +import com.msdw.tms.entity.request.QuestionsAddRequest; +import com.msdw.tms.entity.request.QuestionsQueryRequest; +import com.msdw.tms.entity.request.QuestionsUpdateRequest; +import com.msdw.tms.entity.vo.EvaluationVO; +import com.msdw.tms.entity.vo.QuestionsDetailVO; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.disk.DiskFileItem; +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.nio.file.Files; +import java.util.ArrayList; +import java.util.List; + +/** + * 记录试题信息 + * + * @author gongsj + */ +@SpringBootTest +class QuestionsServiceTest { + + @Autowired + QuestionsService questionsService; + + @Test + void queryQuestionsPage() { + Integer page = 1; + Integer size = 10; + QuestionsQueryRequest request = new QuestionsQueryRequest(); + PageUtils pageUtils = questionsService.queryQuestionsPage(page, size, request); + System.out.println(pageUtils.toString()); + } + + @Test + void getQuestionDetailById() { + Integer id = 1; + QuestionsDetailVO detail = questionsService.getQuestionDetailById(id); + System.out.println(detail.toString()); + } + + @Test + void saveQuestion() { + QuestionsAddRequest questions = new QuestionsAddRequest(); + System.out.println(questionsService.saveQuestion(questions)); + } + + @Test + void updateQuestionById() { + QuestionsUpdateRequest questions = new QuestionsUpdateRequest(); + System.out.println(questionsService.updateQuestionById(questions)); + } + + @Test + void isnable() { + Integer id = 1; + System.out.println(questionsService.isnable(id)); + } + + @Test + void deleteByIds() { + List asList = new ArrayList<>(); + System.out.println(questionsService.deleteByIds(asList)); + } + + @Test + void importQuestion() throws IOException { + File file = new File("D:\\pic\\1.jpg"); + FileItem fileItem = new DiskFileItem("file", + Files.probeContentType(file.toPath()), + false, + file.getName(), + (int) file.length(), + file.getParentFile()); + IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream()); + MultipartFile multipartFile = new CommonsMultipartFile(fileItem); + + boolean b = questionsService.importQuestion(multipartFile); + + System.out.println(b); + } + + @Test + void uploadFiles() throws IOException { + File file = new File("D:\\pic\\1.jpg"); + FileItem fileItem = new DiskFileItem("file", + Files.probeContentType(file.toPath()), + false, + file.getName(), + (int) file.length(), + file.getParentFile()); + IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream()); + MultipartFile multipartFile = new CommonsMultipartFile(fileItem); + FilesResult filesResult = questionsService.uploadFiles(multipartFile); + System.out.println(filesResult.toString()); + } + + @Test + void downloadFiles() throws IOException { + HttpServletResponse response = null; + questionsService.downloadFiles(response); + } + + @Test + void evaluation() { + EvaluationVO evaluation = questionsService.evaluation(); + System.out.println(evaluation.toString()); + } +} + From e929a380c061b41821285db61ca16faa90b28783 Mon Sep 17 00:00:00 2001 From: shijie <648688341@qq.com> Date: Fri, 21 Aug 2020 14:16:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=B1=95=E7=A4=BAbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++++++ .../com/msdw/tms/service/impl/QuestionsServiceImpl.java | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index a3e1a73..ce557e1 100644 --- a/pom.xml +++ b/pom.xml @@ -118,6 +118,14 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-surefire-plugin + 2.20.1 + + true + + diff --git a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java index 97fc05c..a2d7274 100644 --- a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java @@ -104,7 +104,7 @@ public class QuestionsServiceImpl extends ServiceImpl Date: Fri, 21 Aug 2020 15:58:25 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E6=89=93war=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 ++++++++ src/main/java/com/msdw/tms/TmsApplication.java | 8 +++++++- .../java/com/msdw/tms/entity/QuestionsEntity.java | 2 +- .../tms/entity/request/QuestionsQueryRequest.java | 9 +++++---- .../msdw/tms/service/impl/QuestionsServiceImpl.java | 12 ++++++------ 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index ce557e1..5d3a89c 100644 --- a/pom.xml +++ b/pom.xml @@ -14,6 +14,7 @@ tms 测评管理系统 + war 1.8 @@ -39,6 +40,13 @@ org.springframework.boot spring-boot-starter-web + + org.springframework.boot + spring-boot-starter-tomcat + + provided + com.baomidou diff --git a/src/main/java/com/msdw/tms/TmsApplication.java b/src/main/java/com/msdw/tms/TmsApplication.java index 33869c2..4bf070b 100644 --- a/src/main/java/com/msdw/tms/TmsApplication.java +++ b/src/main/java/com/msdw/tms/TmsApplication.java @@ -2,12 +2,18 @@ package com.msdw.tms; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; @SpringBootApplication -public class TmsApplication { +public class TmsApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(TmsApplication.class, args); } + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { + return builder.sources(TmsApplication.class); + } } diff --git a/src/main/java/com/msdw/tms/entity/QuestionsEntity.java b/src/main/java/com/msdw/tms/entity/QuestionsEntity.java index fd56112..03600ef 100644 --- a/src/main/java/com/msdw/tms/entity/QuestionsEntity.java +++ b/src/main/java/com/msdw/tms/entity/QuestionsEntity.java @@ -23,7 +23,7 @@ public class QuestionsEntity implements Serializable { @TableId private Integer id; /** - * 题型号:用于区分是什么题型 + * 题型号:1、单选题,2、多选题,3、判断题 */ private Integer questionTypeNo; /** diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java index 62f98bd..f73f4a3 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsQueryRequest.java @@ -19,10 +19,11 @@ public class QuestionsQueryRequest { @ApiModelProperty(value = "题干,问题描述", name = "questionStem", example = "世界上最大的哺乳动物是什么?") private String questionStem; - // /** - // * 题型id - // */ - // private Integer questionType; + /** + * 题型id + */ + @ApiModelProperty(value = "题型号:1、单选题,2、多选题,3、判断题", name = "questionTypeNo", example = "1") + private Integer questionTypeNo; // /** // * 参考答案 // */ diff --git a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java index a2d7274..6ece057 100644 --- a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java @@ -70,14 +70,14 @@ public class QuestionsServiceImpl extends ServiceImpl Date: Mon, 24 Aug 2020 09:29:11 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../request/QuestionsImportRequest.java | 26 ++++++++---------- .../excel-template/试题导入模板.xlsx | Bin 10390 -> 11155 bytes .../service/EvaluationRulesServiceTest.java | 2 ++ .../tms/service/QuestionsServiceTest.java | 6 ++++ 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java b/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java index 77c6cf4..e671e12 100644 --- a/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java +++ b/src/main/java/com/msdw/tms/entity/request/QuestionsImportRequest.java @@ -10,59 +10,55 @@ import lombok.Data; */ @Data public class QuestionsImportRequest { - /** - * 试题科目 - */ - @ExcelAttribute(sort = 0) - private String subjects; + /** * 题干,问题描述 */ - @ExcelAttribute(sort = 1) + @ExcelAttribute(sort = 0) private String questionStem; /** * 题型 */ - @ExcelAttribute(sort = 2) + @ExcelAttribute(sort = 1) private String questionType; /** * 选项A */ - @ExcelAttribute(sort = 3) + @ExcelAttribute(sort = 2) private String optionA; /** * 选项B */ - @ExcelAttribute(sort = 4) + @ExcelAttribute(sort = 3) private String optionB; /** * 选项C */ - @ExcelAttribute(sort = 5) + @ExcelAttribute(sort = 4) private String optionC; /** * 选项D */ - @ExcelAttribute(sort = 6) + @ExcelAttribute(sort = 5) private String optionD; /** * 选项E */ - @ExcelAttribute(sort = 7) + @ExcelAttribute(sort = 6) private String optionE; /** * 选项F */ - @ExcelAttribute(sort = 8) + @ExcelAttribute(sort = 7) private String optionF; /** * 正确答案 */ - @ExcelAttribute(sort = 9) + @ExcelAttribute(sort = 8) private String answer; /** * 答案解析 */ - @ExcelAttribute(sort = 10) + @ExcelAttribute(sort = 9) private String answerAnalysis; } diff --git a/src/main/resources/excel-template/试题导入模板.xlsx b/src/main/resources/excel-template/试题导入模板.xlsx index 4c064f05758899d5bb7b598d5b5e06d99a469fb2..30c5e1403a0831064c7070de3ab74e5b19a87302 100644 GIT binary patch delta 8517 zcmZvBWmFwY)9%KdARBjg3+@g9f;$NWcMI-=LvYx*OCSUb?hxEvf2|CpE+XVEFzI5iQnpKFMG^)1aA80Rx@XHrzbtS|$ zZCUSim8lI;zD1Wioe4j^%aIQJTBa3U6Bo&yi;s440zX}c@V;@;nAMu{g^~uByB3*q zxAR=-k3?y>s3c7r<4y@Qa5sM-JlLfRt-#=lZ_MWrq{c!hzpCBZs`{2wi~2`~Gl?c^ z;!QLIxJsp|_MS{`e`pGvt6ybFARtL5W>p4NZ1qhR1jhrG_#SySN8FibTQH(?D2CMvXtntW^OD%P9C{Dw>{5#t?-cJL5j|#x zk1sZJ5tQO?gcn~SaD@sRfO;tDWI2BwMSNGfguarMFHZJ5`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O5gcWT_UTJV(fx zN>OI;>%VmaPhZ3s(KRidWT<=Bxv~;?i*1M_x1#Ro;&!p27E3A`XvT_!PC8)ZfO`$v`gFg< z{__1UkUn(00eTAd8nv}|302BX23dq+qP0da@FxM2T7Fl*ZSuBg9YWRGM7Ro}Kg6CgkaG*Tg=H&bHJjHc|9Dd3Jj1Sw+L#X)S*~6)?vIWqh$^_~HQ@Plw}x z&vZx#Y5NlAhL{J^(IyNlg##`0L*z_)StT!bjE8B3ba0na<$#v*t5DwQaMcU1nz7me zGB(+$bJ za}e9+$e>|T4g$7j{suk2yl>$*sI%9Qj2!HUMMGdz?6u7!ZXI7T3vj;)p~XradlQ{F zTY`oscejEv;Elz_U^og8@wv3Aw9O}rSWQc|11&(Z3S0dOl+C6i{^|s1_#Z`Udnw6F zju<0&g2yODD>q>D()nvII|{xnq8WE)J2640ZFg2yPa_|tT`e5`EMjB-W@uL*d@n8T z#`Pls@>8ZX_}+kHcC;@v*s{PL7UBuxj8>_)qM32l&NW4#EYb`(Q zp(&#>&=`R6)cZ~{Vs&d=0q|?`*L5>rDOki}li(f`e}2uFA@ub4F2YQ^5+LB19Q8(5tYm*iiW=FQvw1|<56db6hC!Geq|B>$^q{Kdc_fu9*D zN&fcT0RWu8-Zv`@87##l2K^BOOiDouu42L@{@)JQU$_Z)h>?!?e;LDHKPMQGiGt*B zy#fFb{B^!rYeZmSR3dN=BPPlJ?-_5Og!Nyb9C9!VGd0QIzu--v`7Zzt6_}ioF_{^Y Z asList = new ArrayList<>(); System.out.println(questionsService.deleteByIds(asList)); } @Test + @Transactional void importQuestion() throws IOException { File file = new File("D:\\pic\\1.jpg"); FileItem fileItem = new DiskFileItem("file",