TP-20240927-importfixes #115

Merged
hsh-michaelhoennig merged 33 commits from TP-20240927-importfixes into master 2024-11-21 10:27:36 +01:00
Showing only changes of commit a3418a1d49 - Show all commits

View File

@ -73,23 +73,17 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
-1 -1
); );
private static final List<Integer> LEGAL_PERSON_CONTACTS = Arrays.asList(
90641, // we have two persons with same name, but one is the legal person
-1
);
private static final List<Integer> INCORPORATED_FIRM_CONTACTS = Arrays.asList(
-1
);
private static final List<Integer> NATURAL_PERSON_CONTACTS = Arrays.asList(
-1
);
private static final List<Integer> IGNORE_CONTACTS = Arrays.asList( private static final List<Integer> IGNORE_CONTACTS = Arrays.asList(
90547, // Kontakt hat keine Rolle 90547, // Kontakt hat keine Rolle
90312, // es gibt bereits einen partner Contact 90312, // es gibt bereits einen partner Contact
-1 -1
); );
private static final Map<Integer, HsOfficePersonType> PERSON_TYPES_BY_CONTACT = Map.of(
90641, HsOfficePersonType.LEGAL_PERSON,
-1, HsOfficePersonType.LEGAL_PERSON
);
static Map<Integer, HsOfficeContactRealEntity> contacts = new WriteOnceMap<>(); static Map<Integer, HsOfficeContactRealEntity> contacts = new WriteOnceMap<>();
static Map<Integer, HsOfficePersonEntity> persons = new WriteOnceMap<>(); static Map<Integer, HsOfficePersonEntity> persons = new WriteOnceMap<>();
static Map<Integer, HsOfficePartnerEntity> partners = new WriteOnceMap<>(); static Map<Integer, HsOfficePartnerEntity> partners = new WriteOnceMap<>();
@ -971,6 +965,7 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
HsOfficePersonEntity contactPerson = partnerPerson; HsOfficePersonEntity contactPerson = partnerPerson;
if (!StringUtils.equals(rec.getString("firma"), partnerPerson.getTradeName()) || if (!StringUtils.equals(rec.getString("firma"), partnerPerson.getTradeName()) ||
partnerPerson.getPersonType() != determinePersonType(rec) ||
!StringUtils.equals(rec.getString("first_name"), partnerPerson.getGivenName()) || !StringUtils.equals(rec.getString("first_name"), partnerPerson.getGivenName()) ||
!StringUtils.equals(rec.getString("last_name"), partnerPerson.getFamilyName())) { !StringUtils.equals(rec.getString("last_name"), partnerPerson.getFamilyName())) {
contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec); contactPerson = addPerson(HsOfficePersonEntity.builder().build(), rec);
@ -1087,12 +1082,8 @@ public abstract class BaseOfficeDataImport extends CsvDataImport {
String givenName = contactRecord.getString("first_name"); String givenName = contactRecord.getString("first_name");
String tradeName = contactRecord.getString("firma"); String tradeName = contactRecord.getString("firma");
if (LEGAL_PERSON_CONTACTS.contains(contactRecord.getString("contact_id"))) { if (PERSON_TYPES_BY_CONTACT.containsKey(contactRecord.getInteger("contact_id"))) {
return HsOfficePersonType.LEGAL_PERSON; return PERSON_TYPES_BY_CONTACT.get(contactRecord.getInteger("contact_id"));
} else if (INCORPORATED_FIRM_CONTACTS.contains(contactRecord.getString("contact_id"))) {
return HsOfficePersonType.INCORPORATED_FIRM;
} else if (NATURAL_PERSON_CONTACTS.contains(contactRecord.getString("contact_id"))) {
return HsOfficePersonType.NATURAL_PERSON;
} }
if (tradeName.isBlank() || tradeName.startsWith("verstorben")) { if (tradeName.isBlank() || tradeName.startsWith("verstorben")) {