入伍保留学籍申请导出

This commit is contained in:
2026-03-19 16:40:29 +08:00
parent 21e967a72e
commit ae92e4372b
3 changed files with 198 additions and 4 deletions

View File

@@ -215,7 +215,7 @@
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName> <warName>${project.artifactId}</warName>
</configuration> </configuration>
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>8</source><target>8</target></configuration></plugin> </plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>14</source><target>14</target></configuration></plugin>
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
</build> </build>

View File

@@ -1,9 +1,11 @@
package com.srs.web.controller.routine; package com.srs.web.controller.routine;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.srs.dormitory.domain.DmsOutsideAccommodationApply; import com.srs.dormitory.domain.DmsOutsideAccommodationApply;
import com.srs.routine.domain.dto.RtEnlistmentReserveExportDto;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -56,10 +58,72 @@ public class RtEnlistmentReserveController extends BaseController {
@PostMapping("/export") @PostMapping("/export")
@ApiOperation("导出应征入伍保留学籍申请列表") @ApiOperation("导出应征入伍保留学籍申请列表")
public void export(HttpServletResponse response, RtEnlistmentReserve rtEnlistmentReserve) { public void export(HttpServletResponse response, RtEnlistmentReserve rtEnlistmentReserve) {
List<RtEnlistmentReserve> list = rtEnlistmentReserveService.selectRtEnlistmentReserveList(rtEnlistmentReserve); // 1. 查询原始数据列表
ExcelUtil<RtEnlistmentReserve> util = new ExcelUtil<RtEnlistmentReserve>(RtEnlistmentReserve.class); List<RtEnlistmentReserve> originalList = rtEnlistmentReserveService.selectRtEnlistmentReserveList(rtEnlistmentReserve);
util.exportExcel(response, list, "应征入伍保留学籍申请数据");
// 2. 转换为导出DTO + 中文值转换
List<RtEnlistmentReserveExportDto> exportList = originalList.stream()
.map(this::convertToExportDto)
.collect(Collectors.toList());
// 3. 导出Excel使用DTO的@Excel注解配置中文表头
ExcelUtil<RtEnlistmentReserveExportDto> 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();
};
}
/** /**
* 获取应征入伍保留学籍申请详细信息 * 获取应征入伍保留学籍申请详细信息

View File

@@ -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;
}