From 746599f462f3c776732cb277355ffe5eb1124564 Mon Sep 17 00:00:00 2001
From: shinnosuke <tantao@1hoper.com>
Date: 星期一, 24 八月 2026 11:07:50 +0800
Subject: [PATCH] fix: finalize merchant and family card changes

---
 talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyService.java |   47 ++++++++++++++++++++++++++++-------------------
 1 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyService.java b/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyService.java
index 0cece42..a1917d1 100644
--- a/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyService.java
+++ b/talent-card-server/src/main/java/com/talentcard/server/service/DependentCardApplyService.java
@@ -1,5 +1,6 @@
 package com.talentcard.server.service;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -157,31 +158,39 @@
 		if (!Integer.valueOf(DependentCardApply.STATUS_REJECTED).equals(apply.getStatus())) {
 			throw new BusinessException(ErrorCode.CONFLICT, "仅已驳回的申请可以修改重新提交");
 		}
-		DependentCardApply resubmitted = new DependentCardApply(
-				BusinessIdGenerator.next("DCA"),
-				apply.getTalentId(),
-				apply.getTalentCardId(),
-				apply.getTalentName(),
-				apply.getTalentMobile(),
-				apply.getTalentCardNo(),
-				apply.getCardLevel(),
-				request.dependentName().trim(),
-				request.dependentMobile().trim(),
-				request.dependentIdCardNo().trim().toUpperCase(),
-				request.relation().trim()
+		LocalDateTime applyTime = LocalDateTime.now();
+		int updated = mapper.update(
+				null,
+				Wrappers.<DependentCardApply>lambdaUpdate()
+						.eq(DependentCardApply::getId, applyId)
+						.eq(DependentCardApply::getTalentCardId, request.talentCardId())
+						.eq(DependentCardApply::getStatus, DependentCardApply.STATUS_REJECTED)
+						.set(DependentCardApply::getDependentName, request.dependentName().trim())
+						.set(DependentCardApply::getDependentMobile, request.dependentMobile().trim())
+						.set(DependentCardApply::getDependentIdCardNo, request.dependentIdCardNo().trim().toUpperCase())
+						.set(DependentCardApply::getRelation, request.relation().trim())
+						.set(DependentCardApply::getApplyTime, applyTime)
+						.set(DependentCardApply::getStatus, DependentCardApply.STATUS_PENDING_REVIEW)
+						.set(DependentCardApply::getAuditBy, (Long) null)
+						.set(DependentCardApply::getAuditTime, (LocalDateTime) null)
+						.set(DependentCardApply::getAuditRemark, (String) null)
 		);
-		if (mapper.insert(resubmitted) != 1) {
-			throw new BusinessException(ErrorCode.INTERNAL_ERROR, "家属附属卡申请重新提交失败");
+		if (updated != 1) {
+			throw new BusinessException(ErrorCode.CONFLICT, "申请状态已变化,请刷新后重试");
 		}
 		recordStatus(
-				resubmitted,
-				null,
+				apply,
+				DependentCardApply.STATUS_REJECTED,
 				DependentCardApply.STATUS_PENDING_REVIEW,
 				"TALENT",
-				resubmitted.getTalentId(),
-				"用户基于已驳回申请重新提交,原申请ID:" + applyId
+				apply.getTalentId(),
+				"小程序修改后重新提交"
 		);
-		return DependentCardApplyItemResponse.from(resubmitted);
+		DependentCardApply updatedApply = mapper.selectById(applyId);
+		if (updatedApply == null) {
+			throw new BusinessException(ErrorCode.INTERNAL_ERROR, "家属附属卡申请重新提交失败");
+		}
+		return DependentCardApplyItemResponse.from(updatedApply);
 	}
 	private DependentCardApply ownerCard(Long talentCardId) {
 		requireTalentCardId(talentCardId);

--
Gitblit v1.7.1