|
|
@@ -4,6 +4,9 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
import java.io.IOException;
|
|
|
@@ -127,27 +130,371 @@ public class XgStudentMsgController extends BaseController {
|
|
|
/**
|
|
|
* 高级检索学生信息的导出
|
|
|
*
|
|
|
- * @param bo 高级检索条件
|
|
|
- * @return 学生信息分页列表
|
|
|
+ * @param requestBody 高级检索条件
|
|
|
+ * @param response HTTP响应对象
|
|
|
*/
|
|
|
@SaCheckPermission("studentMsg:studentMsg:export")
|
|
|
@Log(title = "学生信息", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/advancedSearchExport")
|
|
|
public void advancedSearchExport(@RequestBody XgStudentMsgAdvancedSearchBo bo, HttpServletResponse response) {
|
|
|
- log.info("接收到高级检索请求,检索条件: {}", bo);
|
|
|
+
|
|
|
+ // System.out.println("advancedSearchExport - requestBody:" + requestBody);
|
|
|
+ // log.info("advancedSearchExport - requestBody:" + requestBody);
|
|
|
+ // // 从请求体中解析高级检索条件
|
|
|
+ // XgStudentMsgAdvancedSearchBo bo = new XgStudentMsgAdvancedSearchBo();
|
|
|
+
|
|
|
+ // // ==================== 基础信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("studentNo")) {
|
|
|
+ // bo.setStudentNo((String) requestBody.get("studentNo"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("name")) {
|
|
|
+ // bo.setName((String) requestBody.get("name"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("idCard")) {
|
|
|
+ // bo.setIdCard((String) requestBody.get("idCard"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("phone")) {
|
|
|
+ // bo.setPhone((String) requestBody.get("phone"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("email")) {
|
|
|
+ // bo.setEmail((String) requestBody.get("email"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("gender")) {
|
|
|
+ // Object value = requestBody.get("gender");
|
|
|
+ // bo.setGender(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("nationality")) {
|
|
|
+ // Object value = requestBody.get("nationality");
|
|
|
+ // bo.setNationality(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("politicalStatus")) {
|
|
|
+ // Object value = requestBody.get("politicalStatus");
|
|
|
+ // bo.setPoliticalStatus(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("birthDateStart")) {
|
|
|
+ // bo.setBirthDateStart(parseDate(requestBody.get("birthDateStart")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("birthDateEnd")) {
|
|
|
+ // bo.setBirthDateEnd(parseDate(requestBody.get("birthDateEnd")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("nameEnglish")) {
|
|
|
+ // bo.setNameEnglish((String) requestBody.get("nameEnglish"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("formerName")) {
|
|
|
+ // bo.setFormerName((String) requestBody.get("formerName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("nativePlace")) {
|
|
|
+ // Object value = requestBody.get("nativePlace");
|
|
|
+ // bo.setNativePlace(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("hukouLocation")) {
|
|
|
+ // bo.setHukouLocation((String) requestBody.get("hukouLocation"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("homeAddress")) {
|
|
|
+ // bo.setHomeAddress((String) requestBody.get("homeAddress"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("currentAddress")) {
|
|
|
+ // bo.setCurrentAddress((String) requestBody.get("currentAddress"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("qq")) {
|
|
|
+ // bo.setQq((String) requestBody.get("qq"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("wechat")) {
|
|
|
+ // bo.setWechat((String) requestBody.get("wechat"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("maritalStatus")) {
|
|
|
+ // Object value = requestBody.get("maritalStatus");
|
|
|
+ // bo.setMaritalStatus(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("religion")) {
|
|
|
+ // bo.setReligion((String) requestBody.get("religion"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("householdRegisterType")) {
|
|
|
+ // Object value = requestBody.get("householdRegisterType");
|
|
|
+ // bo.setHouseholdRegisterType(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("educationLevel")) {
|
|
|
+ // Object value = requestBody.get("educationLevel");
|
|
|
+ // bo.setEducationLevel(parseStringList(value));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 学籍信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("studentStatus")) {
|
|
|
+ // Object value = requestBody.get("studentStatus");
|
|
|
+ // bo.setStudentStatus(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("enrollmentYearStart")) {
|
|
|
+ // bo.setEnrollmentYearStart(parseLong(requestBody.get("enrollmentYearStart")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("enrollmentYearEnd")) {
|
|
|
+ // bo.setEnrollmentYearEnd(parseLong(requestBody.get("enrollmentYearEnd")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("enrollmentDateStart")) {
|
|
|
+ // bo.setEnrollmentDateStart(parseDate(requestBody.get("enrollmentDateStart")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("enrollmentDateEnd")) {
|
|
|
+ // bo.setEnrollmentDateEnd(parseDate(requestBody.get("enrollmentDateEnd")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("admissionCategory")) {
|
|
|
+ // Object value = requestBody.get("admissionCategory");
|
|
|
+ // bo.setAdmissionCategory(parseStringList(value));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 学院专业班级检索 ====================
|
|
|
+ // if (requestBody.containsKey("collegeName")) {
|
|
|
+ // bo.setCollegeName((String) requestBody.get("collegeName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("majorName")) {
|
|
|
+ // bo.setMajorName((String) requestBody.get("majorName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("className")) {
|
|
|
+ // bo.setClassName((String) requestBody.get("className"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("grade")) {
|
|
|
+ // Object value = requestBody.get("grade");
|
|
|
+ // bo.setGrade(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("gradeMin")) {
|
|
|
+ // bo.setGradeMin((String) requestBody.get("gradeMin"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("gradeMax")) {
|
|
|
+ // bo.setGradeMax((String) requestBody.get("gradeMax"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("counselorName")) {
|
|
|
+ // bo.setCounselorName((String) requestBody.get("counselorName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("classTeacherName")) {
|
|
|
+ // bo.setClassTeacherName((String) requestBody.get("classTeacherName"));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 家庭信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("fatherName")) {
|
|
|
+ // bo.setFatherName((String) requestBody.get("fatherName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("motherName")) {
|
|
|
+ // bo.setMotherName((String) requestBody.get("motherName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("guardianName")) {
|
|
|
+ // bo.setGuardianName((String) requestBody.get("guardianName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("familyEconomicStatus")) {
|
|
|
+ // Object value = requestBody.get("familyEconomicStatus");
|
|
|
+ // bo.setFamilyEconomicStatus(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("familyIncomeMin")) {
|
|
|
+ // bo.setFamilyIncomeMin(parseDouble(requestBody.get("familyIncomeMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("familyIncomeMax")) {
|
|
|
+ // bo.setFamilyIncomeMax(parseDouble(requestBody.get("familyIncomeMax")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("perCapitaIncomeMin")) {
|
|
|
+ // bo.setPerCapitaIncomeMin(parseDouble(requestBody.get("perCapitaIncomeMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("perCapitaIncomeMax")) {
|
|
|
+ // bo.setPerCapitaIncomeMax(parseDouble(requestBody.get("perCapitaIncomeMax")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("familyMembersMin")) {
|
|
|
+ // bo.setFamilyMembersMin(parseLong(requestBody.get("familyMembersMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("familyMembersMax")) {
|
|
|
+ // bo.setFamilyMembersMax(parseLong(requestBody.get("familyMembersMax")));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 特殊身份检索 ====================
|
|
|
+ // if (requestBody.containsKey("isPoorStudent")) {
|
|
|
+ // Object value = requestBody.get("isPoorStudent");
|
|
|
+ // bo.setIsPoorStudent(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("isMinority")) {
|
|
|
+ // Object value = requestBody.get("isMinority");
|
|
|
+ // bo.setIsMinority(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("isDisabled")) {
|
|
|
+ // Object value = requestBody.get("isDisabled");
|
|
|
+ // bo.setIsDisabled(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("isOrphan")) {
|
|
|
+ // Object value = requestBody.get("isOrphan");
|
|
|
+ // bo.setIsOrphan(parseStringList(value));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 健康信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("heightMin")) {
|
|
|
+ // bo.setHeightMin(parseDouble(requestBody.get("heightMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("heightMax")) {
|
|
|
+ // bo.setHeightMax(parseDouble(requestBody.get("heightMax")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("weightMin")) {
|
|
|
+ // bo.setWeightMin(parseDouble(requestBody.get("weightMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("weightMax")) {
|
|
|
+ // bo.setWeightMax(parseDouble(requestBody.get("weightMax")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("bloodType")) {
|
|
|
+ // Object value = requestBody.get("bloodType");
|
|
|
+ // bo.setBloodType(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("healthStatus")) {
|
|
|
+ // bo.setHealthStatus((String) requestBody.get("healthStatus"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("disabilityType")) {
|
|
|
+ // Object value = requestBody.get("disabilityType");
|
|
|
+ // bo.setDisabilityType(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("disabilityLevel")) {
|
|
|
+ // bo.setDisabilityLevel((String) requestBody.get("disabilityLevel"));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 住宿信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("isBoarder")) {
|
|
|
+ // Object value = requestBody.get("isBoarder");
|
|
|
+ // bo.setIsBoarder(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("dormitoryBuilding")) {
|
|
|
+ // Object value = requestBody.get("dormitoryBuilding");
|
|
|
+ // bo.setDormitoryBuilding(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("dormitoryRoom")) {
|
|
|
+ // bo.setDormitoryRoom((String) requestBody.get("dormitoryRoom"));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 家庭详细信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("fatherPhone")) {
|
|
|
+ // bo.setFatherPhone((String) requestBody.get("fatherPhone"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("fatherWorkUnit")) {
|
|
|
+ // bo.setFatherWorkUnit((String) requestBody.get("fatherWorkUnit"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("motherPhone")) {
|
|
|
+ // bo.setMotherPhone((String) requestBody.get("motherPhone"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("motherWorkUnit")) {
|
|
|
+ // bo.setMotherWorkUnit((String) requestBody.get("motherWorkUnit"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("guardianPhone")) {
|
|
|
+ // bo.setGuardianPhone((String) requestBody.get("guardianPhone"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("guardianRelation")) {
|
|
|
+ // bo.setGuardianRelation((String) requestBody.get("guardianRelation"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("incomeSource")) {
|
|
|
+ // bo.setIncomeSource((String) requestBody.get("incomeSource"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("emergencyContactName")) {
|
|
|
+ // bo.setEmergencyContactName((String) requestBody.get("emergencyContactName"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("emergencyContactPhone")) {
|
|
|
+ // bo.setEmergencyContactPhone((String)
|
|
|
+ // requestBody.get("emergencyContactPhone"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("emergencyContactRelation")) {
|
|
|
+ // bo.setEmergencyContactRelation((String)
|
|
|
+ // requestBody.get("emergencyContactRelation"));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 其他个人信息 ====================
|
|
|
+ // if (requestBody.containsKey("specialties")) {
|
|
|
+ // bo.setSpecialties((String) requestBody.get("specialties"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("awards")) {
|
|
|
+ // bo.setAwards((String) requestBody.get("awards"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("violations")) {
|
|
|
+ // bo.setViolations((String) requestBody.get("violations"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("socialActivities")) {
|
|
|
+ // bo.setSocialActivities((String) requestBody.get("socialActivities"));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 健康详细信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("specialCondition")) {
|
|
|
+ // bo.setSpecialCondition((String) requestBody.get("specialCondition"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("medicalHistory")) {
|
|
|
+ // bo.setMedicalHistory((String) requestBody.get("medicalHistory"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("allergies")) {
|
|
|
+ // bo.setAllergies((String) requestBody.get("allergies"));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 其他信息检索 ====================
|
|
|
+ // if (requestBody.containsKey("sourceRegion")) {
|
|
|
+ // Object value = requestBody.get("sourceRegion");
|
|
|
+ // bo.setSourceRegion(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("graduateSchool")) {
|
|
|
+ // bo.setGraduateSchool((String) requestBody.get("graduateSchool"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("trainingType")) {
|
|
|
+ // Object value = requestBody.get("trainingType");
|
|
|
+ // bo.setTrainingType(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("academicLevel")) {
|
|
|
+ // Object value = requestBody.get("academicLevel");
|
|
|
+ // bo.setAcademicLevel(parseStringList(value));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("schoolSystemMin")) {
|
|
|
+ // bo.setSchoolSystemMin(parseLong(requestBody.get("schoolSystemMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("schoolSystemMax")) {
|
|
|
+ // bo.setSchoolSystemMax(parseLong(requestBody.get("schoolSystemMax")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("infoStatus")) {
|
|
|
+ // bo.setInfoStatus((String) requestBody.get("infoStatus"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("dataSource")) {
|
|
|
+ // bo.setDataSource((String) requestBody.get("dataSource"));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("isComplete")) {
|
|
|
+ // bo.setIsComplete(parseLong(requestBody.get("isComplete")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("completionRateMin")) {
|
|
|
+ // bo.setCompletionRateMin(parseDouble(requestBody.get("completionRateMin")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("completionRateMax")) {
|
|
|
+ // bo.setCompletionRateMax(parseDouble(requestBody.get("completionRateMax")));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 时间范围检索 ====================
|
|
|
+ // if (requestBody.containsKey("createTimeStart")) {
|
|
|
+ // bo.setCreateTimeStart(parseDate(requestBody.get("createTimeStart")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("createTimeEnd")) {
|
|
|
+ // bo.setCreateTimeEnd(parseDate(requestBody.get("createTimeEnd")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("updateTimeStart")) {
|
|
|
+ // bo.setUpdateTimeStart(parseDate(requestBody.get("updateTimeStart")));
|
|
|
+ // }
|
|
|
+ // if (requestBody.containsKey("updateTimeEnd")) {
|
|
|
+ // bo.setUpdateTimeEnd(parseDate(requestBody.get("updateTimeEnd")));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 部门树节点 ====================
|
|
|
+ // if (requestBody.containsKey("deptIds")) {
|
|
|
+ // Object value = requestBody.get("deptIds");
|
|
|
+ // bo.setDeptIds(parseLongList(value));
|
|
|
+ // }
|
|
|
+
|
|
|
+ // // ==================== 分页参数 ====================
|
|
|
+ // bo.setPageNum(1);
|
|
|
+ // // 导出时设置较大的pageSize以获取更多数据
|
|
|
+ // bo.setPageSize(500000);
|
|
|
+
|
|
|
+ log.info("接收到高级检索导出请求,检索条件: {}", bo);
|
|
|
+
|
|
|
// 预加载导出所需的字典数据
|
|
|
preloadExportDicts();
|
|
|
+
|
|
|
+ // 当前临时方案:手动转换
|
|
|
TableDataInfo<XgStudentMsgVo> tableDataInfo = xgStudentMsgService.advancedSearch(bo);
|
|
|
List<XgStudentMsgVo> list = tableDataInfo.getRows();
|
|
|
-
|
|
|
- // 将XgStudentMsgVo转换为XgStudentMsgExportVo
|
|
|
- List<XgStudentMsgExportVo> exportList = MapstructUtils.convert(list, XgStudentMsgExportVo.class);
|
|
|
+ List<XgStudentMsgExportVo> exportList = convertToExportVoList(list);
|
|
|
|
|
|
ExcelUtil.exportExcel(exportList, "学生信息", XgStudentMsgExportVo.class, response);
|
|
|
|
|
|
// 导出完成后记录缓存统计
|
|
|
logCacheStats();
|
|
|
- // return xgStudentMsgService.advancedSearch(bo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -494,4 +841,347 @@ public class XgStudentMsgController extends BaseController {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析字符串列表参数
|
|
|
+ *
|
|
|
+ * @param value 参数值,可能是String或List<String>
|
|
|
+ * @return 解析后的字符串列表
|
|
|
+ */
|
|
|
+ private List<String> parseStringList(Object value) {
|
|
|
+ if (value == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (value instanceof List) {
|
|
|
+ try {
|
|
|
+ return (List<String>) value;
|
|
|
+ } catch (ClassCastException e) {
|
|
|
+ // 如果List中包含非String元素,转换为String
|
|
|
+ List<?> list = (List<?>) value;
|
|
|
+ return list.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(Object::toString)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ } else if (value instanceof String) {
|
|
|
+ String str = (String) value;
|
|
|
+ return StringUtils.isNotBlank(str) ? List.of(str) : null;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析Long列表参数
|
|
|
+ *
|
|
|
+ * @param value 参数值
|
|
|
+ * @return 解析后的Long列表
|
|
|
+ */
|
|
|
+ private List<Long> parseLongList(Object value) {
|
|
|
+ if (value == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (value instanceof List) {
|
|
|
+ try {
|
|
|
+ List<?> list = (List<?>) value;
|
|
|
+ return list.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .map(item -> {
|
|
|
+ if (item instanceof Number) {
|
|
|
+ return ((Number) item).longValue();
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ return Long.parseLong(item.toString());
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.warn("无法解析Long值: {}", item);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("解析Long列表失败", e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Long longValue = parseLong(value);
|
|
|
+ return longValue != null ? List.of(longValue) : null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析Date参数
|
|
|
+ *
|
|
|
+ * @param value 参数值
|
|
|
+ * @return 解析后的Date对象
|
|
|
+ */
|
|
|
+ private Date parseDate(Object value) {
|
|
|
+ if (value == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (value instanceof Date) {
|
|
|
+ return (Date) value;
|
|
|
+ }
|
|
|
+ if (value instanceof String) {
|
|
|
+ String dateStr = (String) value;
|
|
|
+ if (StringUtils.isBlank(dateStr)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ // 尝试多种日期格式
|
|
|
+ if (dateStr.length() == 10) {
|
|
|
+ // yyyy-MM-dd 格式
|
|
|
+ return java.sql.Date.valueOf(dateStr);
|
|
|
+ } else if (dateStr.length() == 19) {
|
|
|
+ // yyyy-MM-dd HH:mm:ss 格式
|
|
|
+ java.time.LocalDateTime localDateTime = java.time.LocalDateTime.parse(
|
|
|
+ dateStr, java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
+ return Date.from(localDateTime.atZone(java.time.ZoneId.systemDefault()).toInstant());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("日期解析失败: {}", dateStr, e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析Long参数
|
|
|
+ *
|
|
|
+ * @param value 参数值
|
|
|
+ * @return 解析后的Long对象
|
|
|
+ */
|
|
|
+ private Long parseLong(Object value) {
|
|
|
+ if (value == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (value instanceof Number) {
|
|
|
+ return ((Number) value).longValue();
|
|
|
+ }
|
|
|
+ if (value instanceof String) {
|
|
|
+ String str = (String) value;
|
|
|
+ if (StringUtils.isBlank(str)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return Long.parseLong(str);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.warn("Long解析失败: {}", str, e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析Double参数
|
|
|
+ *
|
|
|
+ * @param value 参数值
|
|
|
+ * @return 解析后的Double对象
|
|
|
+ */
|
|
|
+ private Double parseDouble(Object value) {
|
|
|
+ if (value == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (value instanceof Number) {
|
|
|
+ return ((Number) value).doubleValue();
|
|
|
+ }
|
|
|
+ if (value instanceof String) {
|
|
|
+ String str = (String) value;
|
|
|
+ if (StringUtils.isBlank(str)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return Double.parseDouble(str);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.warn("Double解析失败: {}", str, e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析Integer参数
|
|
|
+ *
|
|
|
+ * @param value 参数值
|
|
|
+ * @return 解析后的Integer对象
|
|
|
+ */
|
|
|
+ private Integer parseInteger(Object value) {
|
|
|
+ if (value == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ if (value instanceof Number) {
|
|
|
+ return ((Number) value).intValue();
|
|
|
+ }
|
|
|
+ if (value instanceof String) {
|
|
|
+ String str = (String) value;
|
|
|
+ if (StringUtils.isBlank(str)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ return Integer.parseInt(str);
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ log.warn("Integer解析失败: {}", str, e);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将XgStudentMsgVo列表转换为XgStudentMsgExportVo列表
|
|
|
+ * 用于解决MapStruct转换器缺失的问题
|
|
|
+ *
|
|
|
+ * @param voList 学生信息视图对象列表
|
|
|
+ * @return 学生信息导出对象列表
|
|
|
+ */
|
|
|
+ private List<XgStudentMsgExportVo> convertToExportVoList(List<XgStudentMsgVo> voList) {
|
|
|
+ if (voList == null || voList.isEmpty()) {
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ return voList.stream()
|
|
|
+ .map(this::convertToExportVo)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将XgStudentMsgVo转换为XgStudentMsgExportVo
|
|
|
+ * 使用手动转换,避免MapStruct转换器问题
|
|
|
+ *
|
|
|
+ * @param vo 学生信息视图对象
|
|
|
+ * @return 学生信息导出对象
|
|
|
+ */
|
|
|
+ private XgStudentMsgExportVo convertToExportVo(XgStudentMsgVo vo) {
|
|
|
+ if (vo == null) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ XgStudentMsgExportVo exportVo = new XgStudentMsgExportVo();
|
|
|
+
|
|
|
+ // 基础信息
|
|
|
+ exportVo.setId(vo.getId());
|
|
|
+ exportVo.setCreateTime(vo.getCreateTime());
|
|
|
+ exportVo.setUpdateTime(vo.getUpdateTime());
|
|
|
+ exportVo.setStudentNo(vo.getStudentNo());
|
|
|
+ exportVo.setIdCard(vo.getIdCard());
|
|
|
+ exportVo.setName(vo.getName());
|
|
|
+ exportVo.setNameEnglish(vo.getNameEnglish());
|
|
|
+ exportVo.setFormerName(vo.getFormerName());
|
|
|
+ exportVo.setGender(vo.getGender());
|
|
|
+ exportVo.setBirthDate(vo.getBirthDate());
|
|
|
+ exportVo.setNationality(vo.getNationality());
|
|
|
+
|
|
|
+ // 政治面貌和地址信息
|
|
|
+ exportVo.setPoliticalStatus(vo.getPoliticalStatus());
|
|
|
+ exportVo.setHukouLocation(vo.getHukouLocation());
|
|
|
+ exportVo.setHomeAddress(vo.getHomeAddress());
|
|
|
+ exportVo.setCurrentAddress(vo.getCurrentAddress());
|
|
|
+ exportVo.setPostalCode(vo.getPostalCode());
|
|
|
+ exportVo.setPhotoUrl(vo.getPhotoUrl());
|
|
|
+ exportVo.setPhotoPath(vo.getPhotoPath());
|
|
|
+
|
|
|
+ // 联系方式
|
|
|
+ exportVo.setPhone(vo.getPhone());
|
|
|
+ exportVo.setEmail(vo.getEmail());
|
|
|
+ exportVo.setQq(vo.getQq());
|
|
|
+ exportVo.setWechat(vo.getWechat());
|
|
|
+
|
|
|
+ // 住宿和教育信息
|
|
|
+ exportVo.setIsBoarder(vo.getIsBoarder());
|
|
|
+ exportVo.setEducationLevel(vo.getEducationLevel());
|
|
|
+ exportVo.setHouseholdRegisterType(vo.getHouseholdRegisterType());
|
|
|
+ exportVo.setReligion(vo.getReligion());
|
|
|
+ exportVo.setGraduateSchool(vo.getGraduateSchool());
|
|
|
+ exportVo.setMaritalStatus(vo.getMaritalStatus());
|
|
|
+
|
|
|
+ // 紧急联系人
|
|
|
+ exportVo.setEmergencyContactName(vo.getEmergencyContactName());
|
|
|
+ exportVo.setEmergencyContactPhone(vo.getEmergencyContactPhone());
|
|
|
+ exportVo.setEmergencyContactRelation(vo.getEmergencyContactRelation());
|
|
|
+
|
|
|
+ // 特殊身份标识
|
|
|
+ exportVo.setIsPoorStudent(vo.getIsPoorStudent());
|
|
|
+ exportVo.setIsMinority(vo.getIsMinority());
|
|
|
+ exportVo.setIsDisabled(vo.getIsDisabled());
|
|
|
+ exportVo.setIsOrphan(vo.getIsOrphan());
|
|
|
+ exportVo.setIsLeftBehindChild(vo.getIsLeftBehindChild());
|
|
|
+ exportVo.setIsSingleChild(vo.getIsSingleChild());
|
|
|
+ exportVo.setIsLowIncome(vo.getIsLowIncome());
|
|
|
+ exportVo.setHasLoan(vo.getHasLoan());
|
|
|
+ exportVo.setLoanAmount(vo.getLoanAmount());
|
|
|
+
|
|
|
+ // 个人发展信息
|
|
|
+ exportVo.setSpecialties(vo.getSpecialties());
|
|
|
+ exportVo.setAwards(vo.getAwards());
|
|
|
+ exportVo.setViolations(vo.getViolations());
|
|
|
+ exportVo.setSocialActivities(vo.getSocialActivities());
|
|
|
+
|
|
|
+ // 家庭信息
|
|
|
+ exportVo.setFatherName(vo.getFatherName());
|
|
|
+ exportVo.setFatherPhone(vo.getFatherPhone());
|
|
|
+ exportVo.setFatherWorkUnit(vo.getFatherWorkUnit());
|
|
|
+ exportVo.setMotherName(vo.getMotherName());
|
|
|
+ exportVo.setMotherPhone(vo.getMotherPhone());
|
|
|
+ exportVo.setMotherWorkUnit(vo.getMotherWorkUnit());
|
|
|
+ exportVo.setGuardianName(vo.getGuardianName());
|
|
|
+ exportVo.setGuardianPhone(vo.getGuardianPhone());
|
|
|
+ exportVo.setGuardianRelation(vo.getGuardianRelation());
|
|
|
+
|
|
|
+ // 经济信息
|
|
|
+ exportVo.setFamilyIncome(vo.getFamilyIncome());
|
|
|
+ exportVo.setPerCapitaIncome(vo.getPerCapitaIncome());
|
|
|
+ exportVo.setIncomeSource(vo.getIncomeSource());
|
|
|
+ exportVo.setFamilyEconomicStatus(vo.getFamilyEconomicStatus());
|
|
|
+ exportVo.setFamilyMembers(vo.getFamilyMembers());
|
|
|
+
|
|
|
+ // 健康信息
|
|
|
+ exportVo.setHeight(vo.getHeight());
|
|
|
+ exportVo.setWeight(vo.getWeight());
|
|
|
+ exportVo.setBloodType(vo.getBloodType());
|
|
|
+ exportVo.setHealthStatus(vo.getHealthStatus());
|
|
|
+ exportVo.setSpecialCondition(vo.getSpecialCondition());
|
|
|
+ exportVo.setMedicalHistory(vo.getMedicalHistory());
|
|
|
+ exportVo.setAllergies(vo.getAllergies());
|
|
|
+ exportVo.setDisabilityType(vo.getDisabilityType());
|
|
|
+ exportVo.setDisabilityLevel(vo.getDisabilityLevel());
|
|
|
+
|
|
|
+ // 学籍信息
|
|
|
+ exportVo.setAdmissionCategory(vo.getAdmissionCategory());
|
|
|
+ exportVo.setStudentStatus(vo.getStudentStatus());
|
|
|
+ exportVo.setEnrollmentYear(vo.getEnrollmentYear());
|
|
|
+ exportVo.setEnrollmentDate(vo.getEnrollmentDate());
|
|
|
+
|
|
|
+ // 银行信息
|
|
|
+ exportVo.setBankCardNo(vo.getBankCardNo());
|
|
|
+ exportVo.setBankName(vo.getBankName());
|
|
|
+ exportVo.setBankBranch(vo.getBankBranch());
|
|
|
+ exportVo.setCardHolderName(vo.getCardHolderName());
|
|
|
+
|
|
|
+ // 系统信息
|
|
|
+ exportVo.setInfoStatus(vo.getInfoStatus());
|
|
|
+ exportVo.setDataSource(vo.getDataSource());
|
|
|
+
|
|
|
+ // 学校信息(关联数据)
|
|
|
+ exportVo.setSchoolSystem(vo.getSchoolSystem());
|
|
|
+ exportVo.setAcademicLevel(vo.getAcademicLevel());
|
|
|
+ exportVo.setTrainingType(vo.getTrainingType());
|
|
|
+ exportVo.setMajorId(vo.getMajorId());
|
|
|
+ exportVo.setMajorName(vo.getMajorName());
|
|
|
+ exportVo.setClassId(vo.getClassId());
|
|
|
+ exportVo.setClassName(vo.getClassName());
|
|
|
+ exportVo.setGrade(vo.getGrade());
|
|
|
+ exportVo.setCollegeId(vo.getCollegeId());
|
|
|
+ exportVo.setCollegeName(vo.getCollegeName());
|
|
|
+ exportVo.setClassTeacherId(vo.getClassTeacherId());
|
|
|
+ exportVo.setClassTeacherName(vo.getClassTeacherName());
|
|
|
+ exportVo.setDormitoryBuilding(vo.getDormitoryBuilding());
|
|
|
+ exportVo.setDormitoryRoom(vo.getDormitoryRoom());
|
|
|
+
|
|
|
+ // 备注
|
|
|
+ exportVo.setRemark(vo.getRemark());
|
|
|
+
|
|
|
+ return exportVo;
|
|
|
+ }
|
|
|
}
|