From ae92e4372b236d21ad9f4d00ba5708242b0759cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E6=81=92=E6=88=90?= <962704835@qq.com>
Date: Thu, 19 Mar 2026 16:40:29 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E4=BC=8D=E4=BF=9D=E7=95=99=E5=AD=A6?=
=?UTF-8?q?=E7=B1=8D=E7=94=B3=E8=AF=B7=E5=AF=BC=E5=87=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
srs-admin/pom.xml | 2 +-
.../RtEnlistmentReserveController.java | 70 +++++++++-
.../dto/RtEnlistmentReserveExportDto.java | 130 ++++++++++++++++++
3 files changed, 198 insertions(+), 4 deletions(-)
create mode 100644 srs-routine/src/main/java/com/srs/routine/domain/dto/RtEnlistmentReserveExportDto.java
diff --git a/srs-admin/pom.xml b/srs-admin/pom.xml
index c4722a1..814b6ce 100644
--- a/srs-admin/pom.xml
+++ b/srs-admin/pom.xml
@@ -215,7 +215,7 @@
false
${project.artifactId}
- org.apache.maven.pluginsmaven-compiler-plugin88
+ org.apache.maven.pluginsmaven-compiler-plugin1414
${project.artifactId}
diff --git a/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java b/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java
index 669acb8..780b47b 100644
--- a/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java
+++ b/srs-admin/src/main/java/com/srs/web/controller/routine/RtEnlistmentReserveController.java
@@ -1,9 +1,11 @@
package com.srs.web.controller.routine;
import java.util.List;
+import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
import com.srs.dormitory.domain.DmsOutsideAccommodationApply;
+import com.srs.routine.domain.dto.RtEnlistmentReserveExportDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@@ -56,10 +58,72 @@ public class RtEnlistmentReserveController extends BaseController {
@PostMapping("/export")
@ApiOperation("导出应征入伍保留学籍申请列表")
public void export(HttpServletResponse response, RtEnlistmentReserve rtEnlistmentReserve) {
- List list = rtEnlistmentReserveService.selectRtEnlistmentReserveList(rtEnlistmentReserve);
- ExcelUtil util = new ExcelUtil(RtEnlistmentReserve.class);
- util.exportExcel(response, list, "应征入伍保留学籍申请数据");
+ // 1. 查询原始数据列表
+ List originalList = rtEnlistmentReserveService.selectRtEnlistmentReserveList(rtEnlistmentReserve);
+
+ // 2. 转换为导出DTO + 中文值转换
+ List exportList = originalList.stream()
+ .map(this::convertToExportDto)
+ .collect(Collectors.toList());
+
+ // 3. 导出Excel(使用DTO的@Excel注解配置中文表头)
+ ExcelUtil util = new ExcelUtil<>(RtEnlistmentReserveExportDto.class);
+ util.exportExcel(response, exportList, "应征入伍保留学籍申请数据");
}
+ /**
+ * 原始实体转换为导出DTO,并处理值的中文转换
+ */
+ private RtEnlistmentReserveExportDto convertToExportDto(RtEnlistmentReserve source) {
+ RtEnlistmentReserveExportDto dto = new RtEnlistmentReserveExportDto();
+
+ // 1. 基础字段赋值(一一映射)
+ dto.setApplyNo(source.getApplyNo());
+ dto.setTeacherName(source.getTeacherName());
+ dto.setStudentName(source.getStudentName());
+ dto.setNation(source.getNation());
+ dto.setGrade(source.getGrade());
+ dto.setStudentNo(source.getStudentNo());
+ dto.setClassName(source.getClassName());
+ dto.setMajor(source.getMajor());
+ dto.setFamilyAddress(source.getFamilyAddress());
+ dto.setParentPhone(source.getParentPhone());
+ dto.setApplyReason(source.getApplyReason());
+ dto.setReserveNo(source.getReserveNo());
+ dto.setReserveStartDate(source.getReserveStartDate());
+ dto.setReserveEndDate(source.getReserveEndDate());
+// dto.setApprovalNo(source.getApprovalNo());
+
+ // 2. 核心:0/1等值转换为中文
+ // 性别转换(1-男 0-女)
+ if (source.getGender() != null) {
+ dto.setGender("1".equals(source.getGender()) ? "男" : "0".equals(source.getGender()) ? "女" : source.getGender());
+ }
+
+ // 申请状态转换(0-草稿,1=待辅导员审批...7=驳回)
+ if (source.getApplyStatus() != null) {
+ dto.setApplyStatus(convertApplyStatus(source.getApplyStatus()));
+ }
+
+ return dto;
+ }
+
+ /**
+ * 申请状态值转换为中文描述(适配String类型)
+ */
+ private String convertApplyStatus(Long status) {
+ return switch (status.intValue()) {
+ case 0 -> "草稿";
+ case 1 -> "待辅导员审批";
+ case 2 -> "待学务审批";
+ case 3 -> "待二级学院审批";
+ case 4 -> "待学籍管理科审批";
+ case 5 -> "待教务处主管领导审批";
+ case 6 -> "审批通过";
+ case 7 -> "驳回";
+ default -> status.toString();
+ };
+ }
+
/**
* 获取应征入伍保留学籍申请详细信息
diff --git a/srs-routine/src/main/java/com/srs/routine/domain/dto/RtEnlistmentReserveExportDto.java b/srs-routine/src/main/java/com/srs/routine/domain/dto/RtEnlistmentReserveExportDto.java
new file mode 100644
index 0000000..8b75a8f
--- /dev/null
+++ b/srs-routine/src/main/java/com/srs/routine/domain/dto/RtEnlistmentReserveExportDto.java
@@ -0,0 +1,130 @@
+package com.srs.routine.domain.dto;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.srs.common.annotation.Excel;
+import lombok.Data;
+
+
+import java.util.Date;
+
+
+// 入伍申请导出专用DTO,只包含需要导出的字段
+@Data
+public class RtEnlistmentReserveExportDto {
+
+ /**
+ * 申请编号(规则:RY+年份+6位序号,如RY2024000001)
+ */
+ @Excel(name = "申请编号")
+ private String applyNo;
+
+
+ /**
+ * 辅导员姓名
+ */
+ @Excel(name = "辅导员姓名")
+ private String teacherName;
+
+ /**
+ * 姓名
+ */
+ @Excel(name = "学生姓名")
+ private String studentName;
+
+ /**
+ * 性别(0-男
+ */
+ @Excel(name = "性别")
+ private String gender;
+
+ /**
+ * 民族
+ */
+ @Excel(name = "民族")
+ private String nation;
+
+ /**
+ * 年级
+ */
+ @Excel(name = "年级")
+ private String grade;
+
+ /**
+ * 学号
+ */
+ @Excel(name = "学号")
+ private String studentNo;
+
+ /**
+ * 班级
+ */
+ @Excel(name = "班级")
+ private String className;
+
+ /**
+ * 专业名称
+ */
+ @Excel(name = "专业名称")
+ private String major;
+
+ /**
+ * 家庭地址
+ */
+ @Excel(name = "家庭地址")
+ private String familyAddress;
+
+ /**
+ * 家长联系电话
+ */
+ @Excel(name = "家长联系电话")
+ private String parentPhone;
+
+ /**
+ * 申请理由(含入伍时间、服役期限)
+ */
+ @Excel(name = "申请理由")
+ private String applyReason;
+
+ /**
+ * 申请状态(0-草稿,1=待辅导员审批,2=待学务审批,3=待二级学院审批,4=待学籍管理科审批,5=待教务处主管领导审批,6=审批通过,7=驳回)
+ */
+ @Excel(name = "申请状态")
+ private String applyStatus;
+
+ /**
+ * 保留学籍编号(审批通过后生成)
+ */
+ @Excel(name = "保留学籍编号")
+ private String reserveNo;
+
+ /**
+ * 保留学籍开始日期
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "保留学籍开始日期" , width = 30, dateFormat = "yyyy-MM-dd")
+ private Date reserveStartDate;
+
+ /**
+ * 保留学籍结束日期(入伍时间+服役期限)
+ */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ @Excel(name = "保留学籍结束日期" , width = 30, dateFormat = "yyyy-MM-dd")
+ private Date reserveEndDate;
+
+// /**
+// * 批文号
+// */
+// @Excel(name = "批文号")
+// private String approvalNo;
+
+// @JsonFormat(pattern = "yyyy-MM-dd")
+// private Date createTime;
+//
+// @JsonFormat(pattern = "yyyy-MM-dd")
+// private Date updateTime;
+
+
+
+}
+