etreschenkov 2026-01-19 13:20:51 +03:00
parent 9838eb1541
commit ce10dbafcc

View file

@ -47,7 +47,9 @@ public class PersonServiceV2 {
Collectors.collectingAndThen(
Collectors.toList(),
docs -> docs.stream()
.filter(p -> "21".equals(p.getIdType2()) || "21".equals(p.getIdType()))
.filter(p ->
("21".equals(p.getIdType2()) || "21".equals(p.getIdType()))
&& CTUtil.normalizePassport(p).length() == 10)
.max(byDatesDesc)
.or(() -> docs.stream().max(byDatesDesc))
.orElse(null)
@ -72,7 +74,7 @@ public class PersonServiceV2 {
return names.stream()
.filter(name ->
StringUtils.isNotEmpty(name.getFirst()) &&
StringUtils.isNotEmpty(name.getFirst()) &&
StringUtils.isNotEmpty(name.getLast()) &&
name.getBirthDate() != null && !LocalDate.of(1, 1, 1).equals(name.getBirthDate())
)
@ -96,10 +98,8 @@ public class PersonServiceV2 {
} catch (NumberFormatException e) {
idType2 = null;
}
String serNum = CTUtil.normalizePassport(p);
return serNum.length() == 10 &&
((idType != null && idType <= 30 && idType != 12) ||
(idType2 != null && (idType2 >= 1 && idType2 <= 999)));
return (idType != null && idType <= 30 && idType != 12) ||
(idType2 != null && (idType2 >= 1 && idType2 <= 999));
}
}