package com.talentcard.server.response;
|
|
import java.time.LocalDateTime;
|
|
import com.talentcard.server.entity.DependentCardApply;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
@Schema(name = "DependentCardApplyDetailResponse", description = "家属附属卡申请完整信息(仅本人主卡可见,用于驳回后修改重新提交)")
|
public record DependentCardApplyDetailResponse(
|
@Schema(description = "数据ID", example = "1001")
|
Long id,
|
@Schema(description = "申请编号", example = "DCA202608060001")
|
String applyNo,
|
@Schema(description = "家属姓名", example = "张三")
|
String dependentName,
|
@Schema(description = "家属身份证号(不脱敏,仅本人可见)", example = "510105199001011234")
|
String dependentIdCardNo,
|
@Schema(description = "家属手机号(不脱敏,仅本人可见)", example = "13800138000")
|
String dependentMobile,
|
@Schema(description = "家属关系", example = "配偶")
|
String relation,
|
@Schema(description = "审核状态:0待审核、1已通过、2已驳回、3已解绑", example = "2")
|
Integer status,
|
@Schema(description = "审核状态文本", example = "已驳回")
|
String statusText,
|
@Schema(description = "驳回原因", example = "身份证照片不清晰")
|
String auditRemark,
|
@Schema(description = "申请时间")
|
LocalDateTime applyTime
|
) {
|
|
public static DependentCardApplyDetailResponse from(DependentCardApply apply) {
|
return new DependentCardApplyDetailResponse(
|
apply.getId(),
|
apply.getApplyNo(),
|
apply.getDependentName(),
|
apply.getDependentIdCardNo(),
|
apply.getDependentMobile(),
|
apply.getRelation(),
|
apply.getStatus(),
|
statusText(apply.getStatus()),
|
apply.getAuditRemark(),
|
apply.getApplyTime()
|
);
|
}
|
|
private static String statusText(Integer status) {
|
if (status == null) {
|
return "";
|
}
|
return switch (status) {
|
case DependentCardApply.STATUS_PENDING_REVIEW -> "待审核";
|
case DependentCardApply.STATUS_APPROVED -> "已通过";
|
case DependentCardApply.STATUS_REJECTED -> "已驳回";
|
case DependentCardApply.STATUS_CANCELLED -> "已解绑";
|
default -> "未知";
|
};
|
}
|
}
|