From 9090ec8dc46d29367df68c1f2784b7232fd1be81 Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Wed, 7 Aug 2024 09:07:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=80=83=E8=AF=95=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/exam/UserExamController.java | 18 ++++++ .../system/count/TdExamnumController.java | 14 +++-- .../system/elExam/userExam/userExam.html | 5 +- .../templates/system/examnum/examnum.html | 5 ++ .../dto/response/UserExamExportDTO.java | 62 +++++++++++++++++++ 5 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/response/UserExamExportDTO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserExamController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserExamController.java index 1b7793d..283be66 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserExamController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserExamController.java @@ -1,9 +1,16 @@ package com.ruoyi.web.controller.exam; +import cn.hutool.core.convert.Convert; +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.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.paper.dto.response.PaperListRespDTO; import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO; +import com.ruoyi.system.domain.userexam.dto.response.UserExamExportDTO; import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO; import com.ruoyi.web.controller.manager.UserExamManager; import io.swagger.annotations.Api; @@ -54,6 +61,17 @@ public class UserExamController extends BaseController { return getDataTable(list); } + + @Log(title = "考试详情", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(UserExamReqDTO reqDTO) { + List list = userExamManager.selectExamList(reqDTO); + List list1 = Convert.toList(UserExamExportDTO.class, list); + ExcelUtil util = new ExcelUtil(UserExamExportDTO.class); + return util.exportExcel(list1, "考试数据"); + } + @ApiOperation("详情") @GetMapping("/detail/{examId}/{userId}") public String detail(@PathVariable("examId") String examId, @PathVariable("userId") Long userId, ModelMap mmap) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java index 52737ce..0fa803a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/count/TdExamnumController.java @@ -2,7 +2,9 @@ package com.ruoyi.web.controller.system.count; import java.util.List; +import cn.hutool.core.convert.Convert; import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO; +import com.ruoyi.system.domain.userexam.dto.response.UserExamExportDTO; import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO; import com.ruoyi.web.controller.manager.UserExamManager; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -68,14 +70,14 @@ public class TdExamnumController extends BaseController * 导出考试结果列表 */ @RequiresPermissions("system:examnum:export") - @Log(title = "考试结果", businessType = BusinessType.EXPORT) + @Log(title = "考试详情", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(TdExamnum tdExamnum) - { - List list = tdExamnumService.selectTdExamnumList(tdExamnum); - ExcelUtil util = new ExcelUtil(TdExamnum.class); - return util.exportExcel(list, "考试结果数据"); + public AjaxResult export(UserExamReqDTO reqDTO) { + List list = userExamManager.selectExamList(reqDTO); + List list1 = Convert.toList(UserExamExportDTO.class, list); + ExcelUtil util = new ExcelUtil(UserExamExportDTO.class); + return util.exportExcel(list1, "考试数据"); } diff --git a/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/userExam.html b/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/userExam.html index b136e9c..f065c38 100644 --- a/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/userExam.html +++ b/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/userExam.html @@ -27,7 +27,9 @@ 关闭 - + + 导出 +
@@ -42,6 +44,7 @@ var options = { uniqueId: "id", url: prefix + "/list", + exportUrl: prefix + "/export", queryParams: queryParams, modalName: "考试", columns: [ diff --git a/ruoyi-admin/src/main/resources/templates/system/examnum/examnum.html b/ruoyi-admin/src/main/resources/templates/system/examnum/examnum.html index b682a4e..f52fca5 100644 --- a/ruoyi-admin/src/main/resources/templates/system/examnum/examnum.html +++ b/ruoyi-admin/src/main/resources/templates/system/examnum/examnum.html @@ -25,6 +25,10 @@
@@ -40,6 +44,7 @@ var options = { uniqueId: "id", url: prefix + "/list", + exportUrl: prefix + "/export", modalName: "考试", columns: [ { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/response/UserExamExportDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/response/UserExamExportDTO.java new file mode 100644 index 0000000..c694cb8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userexam/dto/response/UserExamExportDTO.java @@ -0,0 +1,62 @@ +package com.ruoyi.system.domain.userexam.dto.response; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * packageName com.ruoyi.system.domain.userexam.dto.response + * + * @author wangxy + * @version JDK 8 + * @className UserExamExportDTO + * @date 2024/8/7 + * @description 考试记录 + */ +@Data +@ApiModel(value="考试记录", description="考试记录") +public class UserExamExportDTO implements Serializable { + + + private static final long serialVersionUID = 1L; + + + private String id; + + @ApiModelProperty(value = "用户ID") + private Long userId; + + @ApiModelProperty(value = "考试ID") + private String examId; + + @ApiModelProperty(value = "考试名称") + @Excel(name = "考试名称") + private String title; + + @ApiModelProperty(value = "人员名称") + @Excel(name = "人员名称") + private String userName; + + @ApiModelProperty(value = "考试次数") + @Excel(name = "考试次数") + private Integer tryCount; + + @ApiModelProperty(value = "最高分数") + @Excel(name = "最高分数") + private Integer maxScore; + + @ApiModelProperty(value = "是否通过") + @Excel(name = "是否通过", readConverterExp = "false=未通过,true=通过") + private Boolean passed; + + @ApiModelProperty(value = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "更新时间") + @Excel(name = "最后考试时间", dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; +}