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