| | |
| | | package com.talentcard.server.service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | 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); |