入伍保留学籍申请导出
This commit is contained in:
@@ -215,7 +215,7 @@
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</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>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
@@ -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<RtEnlistmentReserve> list = rtEnlistmentReserveService.selectRtEnlistmentReserveList(rtEnlistmentReserve);
|
||||
ExcelUtil<RtEnlistmentReserve> util = new ExcelUtil<RtEnlistmentReserve>(RtEnlistmentReserve.class);
|
||||
util.exportExcel(response, list, "应征入伍保留学籍申请数据");
|
||||
// 1. 查询原始数据列表
|
||||
List<RtEnlistmentReserve> originalList = rtEnlistmentReserveService.selectRtEnlistmentReserveList(rtEnlistmentReserve);
|
||||
|
||||
// 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();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取应征入伍保留学籍申请详细信息
|
||||
|
||||
Reference in New Issue
Block a user