Fill dt attribute with GUTDF mapping
This commit is contained in:
parent
9b2e723f4c
commit
430ae8497a
1 changed files with 29 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.nbch.credit_tracker.builder;
|
package ru.nbch.credit_tracker.builder;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import ru.nbch.credit_tracker.entities.signal_package.Person;
|
import ru.nbch.credit_tracker.entities.signal_package.Person;
|
||||||
import ru.nbch.credit_tracker.service.indic.PersonService;
|
import ru.nbch.credit_tracker.service.indic.PersonService;
|
||||||
|
|
@ -9,6 +10,7 @@ import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class PersonFactoryBuilder {
|
public class PersonFactoryBuilder {
|
||||||
private final static DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy");
|
private final static DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
|
|
||||||
|
|
@ -59,8 +61,8 @@ public class PersonFactoryBuilder {
|
||||||
|
|
||||||
person.setPn(getPn(passportData.getSerNum(), passportData.getIdNum()));
|
person.setPn(getPn(passportData.getSerNum(), passportData.getIdNum()));
|
||||||
person.setPd(passportData.getIssDate() != null ? DATE_FORMAT.format(CTUtil.localDatetoDate(passportData.getIssDate())) : DEFAULT_DATE);
|
person.setPd(passportData.getIssDate() != null ? DATE_FORMAT.format(CTUtil.localDatetoDate(passportData.getIssDate())) : DEFAULT_DATE);
|
||||||
person.setDt(StringUtils.isNotBlank(passportData.getIdType2()) ? passportData.getIdType2() : passportData.getIdType());
|
person.setDt(getDt(passportData.getIdType(), passportData.getIdType2()));
|
||||||
if (person.getDt() != null && person.getDt().equals("999")){
|
if (person.getDt() != null && person.getDt().equals("999")) {
|
||||||
person.setOdt(ODT);
|
person.setOdt(ODT);
|
||||||
person.setConsentOdt(ODT);
|
person.setConsentOdt(ODT);
|
||||||
}
|
}
|
||||||
|
|
@ -95,4 +97,29 @@ public class PersonFactoryBuilder {
|
||||||
String normIdNum = CTUtil.normalize(idNum);
|
String normIdNum = CTUtil.normalize(idNum);
|
||||||
return StringUtils.isNotBlank(normSerNum) ? normSerNum + normIdNum : normIdNum;
|
return StringUtils.isNotBlank(normSerNum) ? normSerNum + normIdNum : normIdNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDt(String idType, String idType2) {
|
||||||
|
if (StringUtils.isNotBlank(idType2)) {
|
||||||
|
return idType2;
|
||||||
|
} else {
|
||||||
|
return switch (idType) {
|
||||||
|
case "21" -> "21";
|
||||||
|
case "22" -> "22.1";
|
||||||
|
case "09" -> "22.2";
|
||||||
|
case "26" -> "23";
|
||||||
|
case "04" -> "24";
|
||||||
|
case "07" -> "25";
|
||||||
|
case "14", "03" -> "27";
|
||||||
|
case "10" -> "31";
|
||||||
|
case "15" -> "32";
|
||||||
|
case "13" -> "37";
|
||||||
|
case "06", "27" -> "28";
|
||||||
|
case "01", "02" -> "999";
|
||||||
|
default -> {
|
||||||
|
log.warn("ID_TYPE2 is blank and no matching found for ID_TYPE {}", idType);
|
||||||
|
yield "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue