|
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+package com.sundot.airport.ledger.service.impl;
|
|
|
2
|
+
|
|
|
3
|
+import com.sundot.airport.common.core.domain.entity.SysRole;
|
|
|
4
|
+import com.sundot.airport.common.core.domain.entity.SysUser;
|
|
|
5
|
+import com.sundot.airport.ledger.domain.ScoreDimension;
|
|
|
6
|
+import com.sundot.airport.ledger.domain.ScoreEvent;
|
|
|
7
|
+import com.sundot.airport.ledger.dto.DeptMemberDistributionDTO;
|
|
|
8
|
+import com.sundot.airport.ledger.dto.DeptMemberDTO;
|
|
|
9
|
+import com.sundot.airport.ledger.dto.DeptPortraitQueryDTO;
|
|
|
10
|
+import com.sundot.airport.ledger.mapper.ScoreDimensionMapper;
|
|
|
11
|
+import com.sundot.airport.ledger.mapper.ScoreEventMapper;
|
|
|
12
|
+import com.sundot.airport.ledger.service.IDeptPortraitService;
|
|
|
13
|
+import com.sundot.airport.system.domain.BasePosition;
|
|
|
14
|
+import com.sundot.airport.system.mapper.BasePositionMapper;
|
|
|
15
|
+import com.sundot.airport.system.mapper.SysRoleMapper;
|
|
|
16
|
+import com.sundot.airport.system.mapper.SysUserMapper;
|
|
|
17
|
+import org.slf4j.Logger;
|
|
|
18
|
+import org.slf4j.LoggerFactory;
|
|
|
19
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
20
|
+import org.springframework.stereotype.Service;
|
|
|
21
|
+
|
|
|
22
|
+import java.math.BigDecimal;
|
|
|
23
|
+import java.math.RoundingMode;
|
|
|
24
|
+import java.time.LocalDate;
|
|
|
25
|
+import java.time.Period;
|
|
|
26
|
+import java.time.format.DateTimeFormatter;
|
|
|
27
|
+import java.util.*;
|
|
|
28
|
+import java.util.function.Function;
|
|
|
29
|
+import java.util.stream.Collectors;
|
|
|
30
|
+
|
|
|
31
|
+/**
|
|
|
32
|
+ * <b>功能名:</b>DeptPortraitServiceImpl<br>
|
|
|
33
|
+ * <b>说明:</b> 部门画像Service实现(团队成员查询)<br>
|
|
|
34
|
+ * <b>著作权:</b> Copyright (C) 2025 SUNDOT CORPORATION<br>
|
|
|
35
|
+ *
|
|
|
36
|
+ * @author Claude
|
|
|
37
|
+ */
|
|
|
38
|
+@Service
|
|
|
39
|
+public class DeptPortraitServiceImpl implements IDeptPortraitService {
|
|
|
40
|
+
|
|
|
41
|
+ private static final Logger log = LoggerFactory.getLogger(DeptPortraitServiceImpl.class);
|
|
|
42
|
+
|
|
|
43
|
+ @Autowired
|
|
|
44
|
+ private SysUserMapper sysUserMapper;
|
|
|
45
|
+
|
|
|
46
|
+ @Autowired
|
|
|
47
|
+ private SysRoleMapper sysRoleMapper;
|
|
|
48
|
+
|
|
|
49
|
+ @Autowired
|
|
|
50
|
+ private ScoreEventMapper scoreEventMapper;
|
|
|
51
|
+
|
|
|
52
|
+ @Autowired
|
|
|
53
|
+ private ScoreDimensionMapper scoreDimensionMapper;
|
|
|
54
|
+
|
|
|
55
|
+ @Autowired
|
|
|
56
|
+ private BasePositionMapper basePositionMapper;
|
|
|
57
|
+
|
|
|
58
|
+ @Override
|
|
|
59
|
+ public List<DeptMemberDTO> getDeptMembers(DeptPortraitQueryDTO query) {
|
|
|
60
|
+ // 递归查询所有下级部门的用户
|
|
|
61
|
+ SysUser userQuery = new SysUser();
|
|
|
62
|
+ userQuery.setDeptId(query.getDeptId());
|
|
|
63
|
+ userQuery.setStatus("0");
|
|
|
64
|
+
|
|
|
65
|
+ List<SysUser> allUsers = sysUserMapper.selectUserList(userQuery);
|
|
|
66
|
+
|
|
|
67
|
+ if (allUsers == null || allUsers.isEmpty()) {
|
|
|
68
|
+ return Collections.emptyList();
|
|
|
69
|
+ }
|
|
|
70
|
+
|
|
|
71
|
+ List<DeptMemberDTO> result = allUsers.stream()
|
|
|
72
|
+ .map(user -> convertToDeptMemberDTO(user, query.getStartDate(), query.getEndDate()))
|
|
|
73
|
+ .collect(Collectors.toList());
|
|
|
74
|
+
|
|
|
75
|
+ return result;
|
|
|
76
|
+ }
|
|
|
77
|
+
|
|
|
78
|
+ @Override
|
|
|
79
|
+ public DeptMemberDistributionDTO getMemberDistribution(DeptPortraitQueryDTO query) {
|
|
|
80
|
+ SysUser userQuery = new SysUser();
|
|
|
81
|
+ userQuery.setDeptId(query.getDeptId());
|
|
|
82
|
+ userQuery.setStatus("0");
|
|
|
83
|
+
|
|
|
84
|
+ List<SysUser> allUsers = sysUserMapper.selectUserList(userQuery);
|
|
|
85
|
+
|
|
|
86
|
+ if (allUsers == null || allUsers.isEmpty()) {
|
|
|
87
|
+ return new DeptMemberDistributionDTO();
|
|
|
88
|
+ }
|
|
|
89
|
+
|
|
|
90
|
+ DeptMemberDistributionDTO distribution = new DeptMemberDistributionDTO();
|
|
|
91
|
+ distribution.setSexDistribution(calculateDistribution(allUsers, SysUser::getSex, this::decodeSex));
|
|
|
92
|
+ distribution.setNationDistribution(calculateDistribution(allUsers, SysUser::getNation, this::decodeNation));
|
|
|
93
|
+ distribution.setPoliticalDistribution(calculateDistribution(allUsers, SysUser::getPoliticalStatus, this::decodePoliticalStatusForDistribution));
|
|
|
94
|
+
|
|
|
95
|
+ return distribution;
|
|
|
96
|
+ }
|
|
|
97
|
+
|
|
|
98
|
+ @Override
|
|
|
99
|
+ public DeptMemberDistributionDTO getPositionDistribution(DeptPortraitQueryDTO query) {
|
|
|
100
|
+ SysUser userQuery = new SysUser();
|
|
|
101
|
+ userQuery.setDeptId(query.getDeptId());
|
|
|
102
|
+ userQuery.setStatus("0");
|
|
|
103
|
+
|
|
|
104
|
+ List<SysUser> allUsers = sysUserMapper.selectUserList(userQuery);
|
|
|
105
|
+
|
|
|
106
|
+ if (allUsers == null || allUsers.isEmpty()) {
|
|
|
107
|
+ return new DeptMemberDistributionDTO();
|
|
|
108
|
+ }
|
|
|
109
|
+
|
|
|
110
|
+ DeptMemberDistributionDTO distribution = new DeptMemberDistributionDTO();
|
|
|
111
|
+
|
|
|
112
|
+ // 统计职业资格等级分布
|
|
|
113
|
+ distribution.setQualificationDistribution(calculateQualificationDistribution(allUsers));
|
|
|
114
|
+
|
|
|
115
|
+ // 统计开机年限分布
|
|
|
116
|
+ distribution.setXrayYearDistribution(calculateXrayYearDistribution(allUsers));
|
|
|
117
|
+
|
|
|
118
|
+ // 统计岗位资质分布
|
|
|
119
|
+ distribution.setPositionDistribution(calculatePositionDistribution(allUsers));
|
|
|
120
|
+
|
|
|
121
|
+ return distribution;
|
|
|
122
|
+ }
|
|
|
123
|
+
|
|
|
124
|
+ /**
|
|
|
125
|
+ * 统计职业资格等级分布
|
|
|
126
|
+ */
|
|
|
127
|
+ private List<DeptMemberDistributionDTO.DistributionItem> calculateQualificationDistribution(List<SysUser> users) {
|
|
|
128
|
+ return users.stream()
|
|
|
129
|
+ .map(SysUser::getQualificationLevel)
|
|
|
130
|
+ .filter(Objects::nonNull)
|
|
|
131
|
+ .filter(s -> !s.isEmpty())
|
|
|
132
|
+ .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
|
|
|
133
|
+ .entrySet().stream()
|
|
|
134
|
+ .map(entry -> new DeptMemberDistributionDTO.DistributionItem(
|
|
|
135
|
+ decodeQualificationLevelForChart(entry.getKey()),
|
|
|
136
|
+ entry.getValue().intValue()
|
|
|
137
|
+ ))
|
|
|
138
|
+ .sorted((a, b) -> {
|
|
|
139
|
+ // 按等级排序
|
|
|
140
|
+ String[] order = {"等级1", "等级2", "等级3", "等级4", "等级5"};
|
|
|
141
|
+ return Arrays.asList(order).indexOf(a.getName()) - Arrays.asList(order).indexOf(b.getName());
|
|
|
142
|
+ })
|
|
|
143
|
+ .collect(Collectors.toList());
|
|
|
144
|
+ }
|
|
|
145
|
+
|
|
|
146
|
+ /**
|
|
|
147
|
+ * 统计开机年限分布
|
|
|
148
|
+ */
|
|
|
149
|
+ private List<DeptMemberDistributionDTO.DistributionItem> calculateXrayYearDistribution(List<SysUser> users) {
|
|
|
150
|
+ Map<String, Integer> yearRanges = new LinkedHashMap<>();
|
|
|
151
|
+ yearRanges.put("0-3", 0);
|
|
|
152
|
+ yearRanges.put("4-7", 0);
|
|
|
153
|
+ yearRanges.put("8-11", 0);
|
|
|
154
|
+ yearRanges.put("12-15", 0);
|
|
|
155
|
+ yearRanges.put("15-18", 0);
|
|
|
156
|
+
|
|
|
157
|
+ for (SysUser user : users) {
|
|
|
158
|
+ if (user.getXrayOperatorStarttime() != null) {
|
|
|
159
|
+ int years = calculateYears(user.getXrayOperatorStarttime());
|
|
|
160
|
+ if (years >= 0 && years <= 3) {
|
|
|
161
|
+ yearRanges.put("0-3", yearRanges.get("0-3") + 1);
|
|
|
162
|
+ } else if (years >= 4 && years <= 7) {
|
|
|
163
|
+ yearRanges.put("4-7", yearRanges.get("4-7") + 1);
|
|
|
164
|
+ } else if (years >= 8 && years <= 11) {
|
|
|
165
|
+ yearRanges.put("8-11", yearRanges.get("8-11") + 1);
|
|
|
166
|
+ } else if (years >= 12 && years <= 15) {
|
|
|
167
|
+ yearRanges.put("12-15", yearRanges.get("12-15") + 1);
|
|
|
168
|
+ } else if (years >= 16) {
|
|
|
169
|
+ yearRanges.put("15-18", yearRanges.get("15-18") + 1);
|
|
|
170
|
+ }
|
|
|
171
|
+ }
|
|
|
172
|
+ }
|
|
|
173
|
+
|
|
|
174
|
+ return yearRanges.entrySet().stream()
|
|
|
175
|
+ .map(entry -> new DeptMemberDistributionDTO.DistributionItem(
|
|
|
176
|
+ entry.getKey() + "年",
|
|
|
177
|
+ entry.getValue()
|
|
|
178
|
+ ))
|
|
|
179
|
+ .collect(Collectors.toList());
|
|
|
180
|
+ }
|
|
|
181
|
+
|
|
|
182
|
+ /**
|
|
|
183
|
+ * 统计岗位资质分布
|
|
|
184
|
+ * 从base_position表查询岗位资质,按position_type='SECURITY_POSITION'筛选
|
|
|
185
|
+ */
|
|
|
186
|
+ private List<DeptMemberDistributionDTO.DistributionItem> calculatePositionDistribution(List<SysUser> users) {
|
|
|
187
|
+ // 查询所有安检岗位
|
|
|
188
|
+ BasePosition query = new BasePosition();
|
|
|
189
|
+ query.setPositionType("SECURITY_POSITION");
|
|
|
190
|
+ List<BasePosition> allPositions = basePositionMapper.selectBasePositionList(query);
|
|
|
191
|
+
|
|
|
192
|
+ // 初始化岗位统计Map,按岗位名称统计
|
|
|
193
|
+ Map<String, Integer> positionMap = new LinkedHashMap<>();
|
|
|
194
|
+ if (allPositions != null) {
|
|
|
195
|
+ for (BasePosition pos : allPositions) {
|
|
|
196
|
+ positionMap.put(pos.getName(), 0);
|
|
|
197
|
+ }
|
|
|
198
|
+ }
|
|
|
199
|
+
|
|
|
200
|
+ // 统计每个用户的岗位
|
|
|
201
|
+ for (SysUser user : users) {
|
|
|
202
|
+ String positions = user.getSecurityInspectionPosition();
|
|
|
203
|
+ if (positions != null && !positions.isEmpty()) {
|
|
|
204
|
+ // 岗位可能用逗号分隔
|
|
|
205
|
+ String[] positionArray = positions.split("[,,]");
|
|
|
206
|
+ for (String pos : positionArray) {
|
|
|
207
|
+ String trimmed = pos.trim();
|
|
|
208
|
+ if (positionMap.containsKey(trimmed)) {
|
|
|
209
|
+ positionMap.put(trimmed, positionMap.get(trimmed) + 1);
|
|
|
210
|
+ }
|
|
|
211
|
+ }
|
|
|
212
|
+ }
|
|
|
213
|
+ }
|
|
|
214
|
+
|
|
|
215
|
+ return positionMap.entrySet().stream()
|
|
|
216
|
+ .map(entry -> new DeptMemberDistributionDTO.DistributionItem(
|
|
|
217
|
+ entry.getKey(),
|
|
|
218
|
+ entry.getValue()
|
|
|
219
|
+ ))
|
|
|
220
|
+ .collect(Collectors.toList());
|
|
|
221
|
+ }
|
|
|
222
|
+
|
|
|
223
|
+ /**
|
|
|
224
|
+ * 解码职业资格等级(用于图表显示)
|
|
|
225
|
+ */
|
|
|
226
|
+ private String decodeQualificationLevelForChart(String v) {
|
|
|
227
|
+ if (v == null) return "未知";
|
|
|
228
|
+ switch (v) {
|
|
|
229
|
+ case "LEVEL_ONE": return "等级1";
|
|
|
230
|
+ case "LEVEL_TWO": return "等级2";
|
|
|
231
|
+ case "LEVEL_THREE": return "等级3";
|
|
|
232
|
+ case "LEVEL_FOUR": return "等级4";
|
|
|
233
|
+ case "LEVEL_FIVE": return "等级5";
|
|
|
234
|
+ default: return v;
|
|
|
235
|
+ }
|
|
|
236
|
+ }
|
|
|
237
|
+
|
|
|
238
|
+ private List<DeptMemberDistributionDTO.DistributionItem> calculateDistribution(
|
|
|
239
|
+ List<SysUser> users,
|
|
|
240
|
+ Function<SysUser, String> extractor,
|
|
|
241
|
+ Function<String, String> decoder) {
|
|
|
242
|
+
|
|
|
243
|
+ return users.stream()
|
|
|
244
|
+ .map(extractor)
|
|
|
245
|
+ .filter(Objects::nonNull)
|
|
|
246
|
+ .filter(s -> !s.isEmpty())
|
|
|
247
|
+ .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
|
|
|
248
|
+ .entrySet().stream()
|
|
|
249
|
+ .map(entry -> new DeptMemberDistributionDTO.DistributionItem(
|
|
|
250
|
+ decoder.apply(entry.getKey()),
|
|
|
251
|
+ entry.getValue().intValue()
|
|
|
252
|
+ ))
|
|
|
253
|
+ .sorted((a, b) -> b.getCount() - a.getCount())
|
|
|
254
|
+ .collect(Collectors.toList());
|
|
|
255
|
+ }
|
|
|
256
|
+
|
|
|
257
|
+ private String decodeSex(String sex) {
|
|
|
258
|
+ if (sex == null || sex.isEmpty()) return "未知";
|
|
|
259
|
+ return "0".equals(sex) ? "男" : "1".equals(sex) ? "女" : "其他";
|
|
|
260
|
+ }
|
|
|
261
|
+
|
|
|
262
|
+ private String decodeNation(String nation) {
|
|
|
263
|
+ if (nation == null || nation.isEmpty()) return "未知";
|
|
|
264
|
+ return nation;
|
|
|
265
|
+ }
|
|
|
266
|
+
|
|
|
267
|
+ private String decodePoliticalStatusForDistribution(String politicalStatus) {
|
|
|
268
|
+ if (politicalStatus == null || politicalStatus.isEmpty()) return "未知";
|
|
|
269
|
+ switch (politicalStatus) {
|
|
|
270
|
+ case "COMMUNIST_PARTY_MEMBER": return "中共党员";
|
|
|
271
|
+ case "PROBATIONARY_COMMUNIST_PARTY_MEMBER": return "中共预备党员";
|
|
|
272
|
+ case "COMMUNIST_YOUTH_LEAGUE_MEMBER": return "共青团员";
|
|
|
273
|
+ case "MASS_PUBLIC": return "群众";
|
|
|
274
|
+ default: return politicalStatus;
|
|
|
275
|
+ }
|
|
|
276
|
+ }
|
|
|
277
|
+
|
|
|
278
|
+ private DeptMemberDTO convertToDeptMemberDTO(SysUser user, String startDate, String endDate) {
|
|
|
279
|
+ DeptMemberDTO dto = new DeptMemberDTO();
|
|
|
280
|
+ dto.setUserId(user.getUserId());
|
|
|
281
|
+ dto.setPersonName(user.getNickName());
|
|
|
282
|
+ dto.setSex("0".equals(user.getSex()) ? "男" : "1".equals(user.getSex()) ? "女" : "");
|
|
|
283
|
+ dto.setNation(user.getNation());
|
|
|
284
|
+ dto.setPoliticalStatus(decodePoliticalStatus(user.getPoliticalStatus()));
|
|
|
285
|
+ dto.setQualificationLevel(decodeQualificationLevel(user.getQualificationLevel()));
|
|
|
286
|
+ dto.setAge(calculateAgeFromIdCard(user.getCardNumber()));
|
|
|
287
|
+
|
|
|
288
|
+ if (user.getStartWorkingDate() != null) {
|
|
|
289
|
+ dto.setWorkYears(calculateYears(user.getStartWorkingDate()));
|
|
|
290
|
+ }
|
|
|
291
|
+ if (user.getXrayOperatorStarttime() != null) {
|
|
|
292
|
+ dto.setXrayOperatorYears(calculateYears(user.getXrayOperatorStarttime()));
|
|
|
293
|
+ }
|
|
|
294
|
+
|
|
|
295
|
+ List<SysRole> roles = sysRoleMapper.selectRolesByUserName(user.getUserName());
|
|
|
296
|
+ if (roles != null && !roles.isEmpty()) {
|
|
|
297
|
+ String roleNames = roles.stream()
|
|
|
298
|
+ .map(SysRole::getRoleName)
|
|
|
299
|
+ .filter(s -> s != null && !s.isEmpty())
|
|
|
300
|
+ .collect(Collectors.joining("、"));
|
|
|
301
|
+ dto.setRoleNames(roleNames);
|
|
|
302
|
+ }
|
|
|
303
|
+
|
|
|
304
|
+ BigDecimal totalScore = calculateTotalScore(user.getNickName(), startDate, endDate);
|
|
|
305
|
+ dto.setTotalScore(totalScore);
|
|
|
306
|
+
|
|
|
307
|
+ return dto;
|
|
|
308
|
+ }
|
|
|
309
|
+
|
|
|
310
|
+ private BigDecimal calculateTotalScore(String personName, String beginTime, String endTime) {
|
|
|
311
|
+ ScoreEvent eventQuery = new ScoreEvent();
|
|
|
312
|
+ eventQuery.setPersonName(personName);
|
|
|
313
|
+ if (beginTime != null && !beginTime.isEmpty()) {
|
|
|
314
|
+ eventQuery.getParams().put("beginTime", beginTime);
|
|
|
315
|
+ }
|
|
|
316
|
+ if (endTime != null && !endTime.isEmpty()) {
|
|
|
317
|
+ eventQuery.getParams().put("endTime", endTime);
|
|
|
318
|
+ }
|
|
|
319
|
+ List<ScoreEvent> events = scoreEventMapper.selectList(eventQuery);
|
|
|
320
|
+
|
|
|
321
|
+ if (events == null || events.isEmpty()) {
|
|
|
322
|
+ return BigDecimal.valueOf(80);
|
|
|
323
|
+ }
|
|
|
324
|
+
|
|
|
325
|
+ Map<Long, BigDecimal> dimMap = new HashMap<>();
|
|
|
326
|
+ for (ScoreEvent e : events) {
|
|
|
327
|
+ Long dimId = e.getDimensionId();
|
|
|
328
|
+ if (dimId == null) continue;
|
|
|
329
|
+ String raw = e.getPersonName();
|
|
|
330
|
+ if (raw == null) continue;
|
|
|
331
|
+ boolean matched = false;
|
|
|
332
|
+ for (String n : raw.split("[,,]")) {
|
|
|
333
|
+ if (personName.equals(n.trim())) {
|
|
|
334
|
+ matched = true;
|
|
|
335
|
+ break;
|
|
|
336
|
+ }
|
|
|
337
|
+ }
|
|
|
338
|
+ if (!matched) continue;
|
|
|
339
|
+ BigDecimal val = e.getTotalScore() != null ? e.getTotalScore() : BigDecimal.ZERO;
|
|
|
340
|
+ dimMap.merge(dimId, val, BigDecimal::add);
|
|
|
341
|
+ }
|
|
|
342
|
+
|
|
|
343
|
+ ScoreDimension dq = new ScoreDimension();
|
|
|
344
|
+ dq.setStatus("0");
|
|
|
345
|
+ List<ScoreDimension> dims = scoreDimensionMapper.selectList(dq);
|
|
|
346
|
+ dims.sort(Comparator.comparing(d -> d.getSortOrder() == null ? 999 : d.getSortOrder()));
|
|
|
347
|
+
|
|
|
348
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
349
|
+ for (ScoreDimension dim : dims) {
|
|
|
350
|
+ BigDecimal eventScore = dimMap.getOrDefault(dim.getId(), BigDecimal.ZERO);
|
|
|
351
|
+ BigDecimal base = dim.getBaseScore() != null ? dim.getBaseScore() : BigDecimal.valueOf(80);
|
|
|
352
|
+ BigDecimal dimScore = base.add(eventScore);
|
|
|
353
|
+ BigDecimal weight = dim.getWeight() != null ? dim.getWeight() : BigDecimal.ZERO;
|
|
|
354
|
+ BigDecimal contribution = dimScore.multiply(weight)
|
|
|
355
|
+ .divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP);
|
|
|
356
|
+ total = total.add(contribution);
|
|
|
357
|
+ }
|
|
|
358
|
+
|
|
|
359
|
+ return total.setScale(1, RoundingMode.HALF_UP);
|
|
|
360
|
+ }
|
|
|
361
|
+
|
|
|
362
|
+ private Integer calculateAgeFromIdCard(String idCard) {
|
|
|
363
|
+ if (idCard == null || idCard.length() < 14) {
|
|
|
364
|
+ return null;
|
|
|
365
|
+ }
|
|
|
366
|
+ try {
|
|
|
367
|
+ String birthDateStr = idCard.substring(6, 14);
|
|
|
368
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
369
|
+ LocalDate birthDate = LocalDate.parse(birthDateStr, formatter);
|
|
|
370
|
+ LocalDate now = LocalDate.now();
|
|
|
371
|
+ return Period.between(birthDate, now).getYears();
|
|
|
372
|
+ } catch (Exception e) {
|
|
|
373
|
+ log.warn("从身份证计算年龄失败: {}", idCard, e);
|
|
|
374
|
+ return null;
|
|
|
375
|
+ }
|
|
|
376
|
+ }
|
|
|
377
|
+
|
|
|
378
|
+ private Integer calculateYears(Date startDate) {
|
|
|
379
|
+ if (startDate == null) {
|
|
|
380
|
+ return null;
|
|
|
381
|
+ }
|
|
|
382
|
+ long nowMs = System.currentTimeMillis();
|
|
|
383
|
+ return (int) ((nowMs - startDate.getTime()) / (365L * 24 * 3600 * 1000));
|
|
|
384
|
+ }
|
|
|
385
|
+
|
|
|
386
|
+ private String decodePoliticalStatus(String v) {
|
|
|
387
|
+ if (v == null) return "";
|
|
|
388
|
+ switch (v) {
|
|
|
389
|
+ case "COMMUNIST_PARTY_MEMBER": return "中共党员";
|
|
|
390
|
+ case "PROBATIONARY_COMMUNIST_PARTY_MEMBER": return "中共预备党员";
|
|
|
391
|
+ case "COMMUNIST_YOUTH_LEAGUE_MEMBER": return "共青团员";
|
|
|
392
|
+ case "MASS_PUBLIC": return "群众";
|
|
|
393
|
+ default: return v;
|
|
|
394
|
+ }
|
|
|
395
|
+ }
|
|
|
396
|
+
|
|
|
397
|
+ private String decodeQualificationLevel(String v) {
|
|
|
398
|
+ if (v == null) return "";
|
|
|
399
|
+ switch (v) {
|
|
|
400
|
+ case "LEVEL_ONE": return "一级";
|
|
|
401
|
+ case "LEVEL_TWO": return "二级";
|
|
|
402
|
+ case "LEVEL_THREE": return "三级";
|
|
|
403
|
+ case "LEVEL_FOUR": return "四级";
|
|
|
404
|
+ case "LEVEL_FIVE": return "五级";
|
|
|
405
|
+ default: return v;
|
|
|
406
|
+ }
|
|
|
407
|
+ }
|
|
|
408
|
+}
|