1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
| package com.talentcard.server.response;
|
| import java.time.LocalDate;
| import java.time.LocalDateTime;
| import java.util.Map;
|
| import com.talentcard.server.entity.DependentCardApply;
| import io.swagger.v3.oas.annotations.media.Schema;
|
| @Schema(name = "DependentCardApplyAdminResponse", description = "管理后台家属附属卡申请信息")
| public record DependentCardApplyAdminResponse(
| Long id,
| String applyNo,
| String applicationNo,
| Long talentId,
| Long talentCardId,
| String talentName,
| String talentMobile,
| String talentIdCardNo,
| Integer gender,
| String contactAddress,
| String workAddress,
| String talentCardNo,
| String cardLevel,
| LocalDate validStart,
| LocalDate validEnd,
| LocalDateTime issueTime,
| Integer familyCardLimit,
| Integer currentFamilyCardCount,
| String dependentName,
| String familyName,
| String dependentMobile,
| String familyMobile,
| String dependentIdCardNo,
| String idCardNo,
| String relation,
| String relationship,
| String proofFiles,
| Integer status,
| String statusText,
| LocalDateTime applyTime,
| Long auditBy,
| String auditorName,
| LocalDateTime auditTime,
| String auditRemark,
| LocalDateTime createdAt,
| LocalDateTime updatedAt
| ) {
| public static DependentCardApplyAdminResponse from(DependentCardApply apply) {
| return from(apply, Map.of());
| }
|
| public static DependentCardApplyAdminResponse from(DependentCardApply apply, Map<String, Object> extra) {
| String applyNo = apply.getApplyNo();
| String dependentName = apply.getDependentName();
| String dependentMobile = apply.getDependentMobile();
| String dependentIdCardNo = apply.getDependentIdCardNo();
| String relation = apply.getRelation();
| return new DependentCardApplyAdminResponse(
| apply.getId(),
| applyNo,
| applyNo,
| apply.getTalentId(),
| apply.getTalentCardId(),
| apply.getTalentName(),
| apply.getTalentMobile(),
| string(extra.get("talentIdCardNo")),
| integer(extra.get("gender")),
| string(extra.get("contactAddress")),
| string(extra.get("workAddress")),
| apply.getTalentCardNo(),
| apply.getCardLevel(),
| date(extra.get("validStart")),
| date(extra.get("validEnd")),
| dateTime(extra.get("issueTime")),
| integer(extra.get("familyCardLimit")),
| integer(extra.get("currentFamilyCardCount")),
| dependentName,
| dependentName,
| dependentMobile,
| dependentMobile,
| dependentIdCardNo,
| dependentIdCardNo,
| relation,
| relation,
| apply.getProofFiles(),
| apply.getStatus(),
| statusText(apply.getStatus()),
| apply.getApplyTime(),
| apply.getAuditBy(),
| string(extra.get("auditorName")),
| apply.getAuditTime(),
| apply.getAuditRemark(),
| apply.getCreatedAt(),
| apply.getUpdatedAt()
| );
| }
|
| 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 -> "未知";
| };
| }
|
| private static String string(Object value) {
| return value == null ? null : String.valueOf(value);
| }
|
| private static Integer integer(Object value) {
| if (value instanceof Number number) return number.intValue();
| if (value == null) return null;
| try {
| return Integer.valueOf(String.valueOf(value));
| } catch (NumberFormatException ex) {
| return null;
| }
| }
|
| private static LocalDate date(Object value) {
| if (value instanceof LocalDate localDate) return localDate;
| if (value == null) return null;
| return LocalDate.parse(String.valueOf(value));
| }
|
| private static LocalDateTime dateTime(Object value) {
| if (value instanceof LocalDateTime localDateTime) return localDateTime;
| if (value == null) return null;
| return LocalDateTime.parse(String.valueOf(value).replace(' ', 'T'));
| }
| }
|
|