From b8981bd3646edae734499819b6e0adb8acfc2843 Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期五, 14 八月 2026 14:20:02 +0800
Subject: [PATCH] fix(admin): 优化学校地址布局并统一家属卡注册时间

---
 talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyAdminService.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyAdminService.java b/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyAdminService.java
index 204e12f..bca18a0 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyAdminService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyAdminService.java
@@ -61,7 +61,8 @@
 			throw new BusinessException(ErrorCode.BAD_REQUEST, "家属卡管理状态只能为正常或已解绑");
 		}
 		if (applyStart != null && applyEnd != null && applyStart.isAfter(applyEnd)) {
-			throw new BusinessException(ErrorCode.BAD_REQUEST, "申请开始时间不能晚于结束时间");
+			throw new BusinessException(ErrorCode.BAD_REQUEST,
+					management ? "注册开始时间不能晚于结束时间" : "申请开始时间不能晚于结束时间");
 		}
 		int safePage = Math.max(page, 1);
 		int safeSize = Math.min(Math.max(size, 1), 100);
@@ -85,15 +86,22 @@
 						.like(DependentCardApply::getTalentCardNo, talentKeyword.trim())
 						.or()
 						.apply("exists (select 1 from talent_user u where u.id = dependent_card_apply.talent_id and u.deleted = 0 and u.id_card_no like concat('%', {0}, '%'))", talentKeyword.trim()))
-				.ge(applyStart != null, DependentCardApply::getApplyTime, applyStart == null ? null : applyStart.atStartOfDay())
-				.lt(applyEnd != null, DependentCardApply::getApplyTime, applyEnd == null ? null : applyEnd.plusDays(1).atStartOfDay());
+				.ge(!management && applyStart != null, DependentCardApply::getApplyTime,
+						applyStart == null ? null : applyStart.atStartOfDay())
+				.lt(!management && applyEnd != null, DependentCardApply::getApplyTime,
+						applyEnd == null ? null : applyEnd.plusDays(1).atStartOfDay())
+				.ge(management && applyStart != null, DependentCardApply::getAuditTime,
+						applyStart == null ? null : applyStart.atStartOfDay())
+				.lt(management && applyEnd != null, DependentCardApply::getAuditTime,
+						applyEnd == null ? null : applyEnd.plusDays(1).atStartOfDay());
 		long total = mapper.selectCount(query);
 		if (total == 0) {
 			return new PageResult<>(List.of(), safePage, safeSize, 0);
 		}
 		long offset = (long) (safePage - 1) * safeSize;
 		List<DependentCardApplyAdminResponse> records = mapper.selectList(
-						query.orderByDesc(DependentCardApply::getApplyTime)
+						query.orderByDesc(management, DependentCardApply::getAuditTime)
+								.orderByDesc(!management, DependentCardApply::getApplyTime)
 								.orderByDesc(DependentCardApply::getId)
 								.last("limit " + safeSize + " offset " + offset)
 				).stream()

--
Gitblit v1.7.1