TP-202405-filtered_import #78
@ -134,6 +134,17 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
|
|
||||||
static int relationId = 2000000;
|
static int relationId = 2000000;
|
||||||
|
|
||||||
|
private static final List<Integer> IGNORE_BUSINESS_PARTNERS = Arrays.asList(
|
||||||
|
512167, // 11139, partner without contractual contact
|
||||||
|
512170, // 11142, partner without contractual contact
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
|
||||||
|
private static final List<Integer> IGNORE_CONTACTS = Arrays.asList(
|
||||||
|
90547, // Kontakt hat keine Rolle
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
|
||||||
@Value("${spring.datasource.url}")
|
@Value("${spring.datasource.url}")
|
||||||
private String jdbcUrl;
|
private String jdbcUrl;
|
||||||
|
|
||||||
@ -171,7 +182,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Order(1010)
|
@Order(1010)
|
||||||
void importBusinessPartners() {
|
void importBusinessPartners() {
|
||||||
|
|
||||||
try (Reader reader = resourceReader("migration/business-partners.csv")) {
|
try (Reader reader = resourceReader("migration.data/business-partners.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importBusinessPartners(justHeader(lines), withoutHeader(lines));
|
importBusinessPartners(justHeader(lines), withoutHeader(lines));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -217,7 +228,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Order(1020)
|
@Order(1020)
|
||||||
void importContacts() {
|
void importContacts() {
|
||||||
|
|
||||||
try (Reader reader = resourceReader("migration/contacts.csv")) {
|
try (Reader reader = resourceReader("migration.data/contacts.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importContacts(justHeader(lines), withoutHeader(lines));
|
importContacts(justHeader(lines), withoutHeader(lines));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -317,7 +328,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Order(1030)
|
@Order(1030)
|
||||||
void importSepaMandates() {
|
void importSepaMandates() {
|
||||||
|
|
||||||
try (Reader reader = resourceReader("migration/sepa-mandates.csv")) {
|
try (Reader reader = resourceReader("migration.data/sepa-mandates.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importSepaMandates(justHeader(lines), withoutHeader(lines));
|
importSepaMandates(justHeader(lines), withoutHeader(lines));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -349,7 +360,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Test
|
@Test
|
||||||
@Order(1040)
|
@Order(1040)
|
||||||
void importCoopShares() {
|
void importCoopShares() {
|
||||||
try (Reader reader = resourceReader("migration/share-transactions.csv")) {
|
try (Reader reader = resourceReader("migration.data/share-transactions.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importCoopShares(justHeader(lines), withoutHeader(lines));
|
importCoopShares(justHeader(lines), withoutHeader(lines));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -376,7 +387,7 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
@Order(1050)
|
@Order(1050)
|
||||||
void importCoopAssets() {
|
void importCoopAssets() {
|
||||||
|
|
||||||
try (Reader reader = resourceReader("migration/asset-transactions.csv")) {
|
try (Reader reader = resourceReader("migration.data/asset-transactions.csv")) {
|
||||||
final var lines = readAllLines(reader);
|
final var lines = readAllLines(reader);
|
||||||
importCoopAssets(justHeader(lines), withoutHeader(lines));
|
importCoopAssets(justHeader(lines), withoutHeader(lines));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -736,6 +747,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.map(this::trimAll)
|
.map(this::trimAll)
|
||||||
.map(row -> new Record(columns, row))
|
.map(row -> new Record(columns, row))
|
||||||
.forEach(rec -> {
|
.forEach(rec -> {
|
||||||
|
if (this.IGNORE_BUSINESS_PARTNERS.contains(rec.getInteger("bp_id"))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final var person = HsOfficePersonEntity.builder().build();
|
final var person = HsOfficePersonEntity.builder().build();
|
||||||
|
|
||||||
final var partnerRel = addRelation(
|
final var partnerRel = addRelation(
|
||||||
@ -837,6 +852,11 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.map(row -> new Record(columns, row))
|
.map(row -> new Record(columns, row))
|
||||||
.forEach(rec -> {
|
.forEach(rec -> {
|
||||||
final var bpId = rec.getInteger("bp_id");
|
final var bpId = rec.getInteger("bp_id");
|
||||||
|
|
||||||
|
if (this.IGNORE_BUSINESS_PARTNERS.contains(bpId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final var member = ofNullable(memberships.get(bpId))
|
final var member = ofNullable(memberships.get(bpId))
|
||||||
.orElseGet(() -> createOnDemandMembership(bpId));
|
.orElseGet(() -> createOnDemandMembership(bpId));
|
||||||
|
|
||||||
@ -907,6 +927,10 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
.forEach(rec -> {
|
.forEach(rec -> {
|
||||||
final var debitor = debitors.get(rec.getInteger("bp_id"));
|
final var debitor = debitors.get(rec.getInteger("bp_id"));
|
||||||
|
|
||||||
|
if (this.IGNORE_BUSINESS_PARTNERS.contains(rec.getInteger("bp_id"))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final var sepaMandate = HsOfficeSepaMandateEntity.builder()
|
final var sepaMandate = HsOfficeSepaMandateEntity.builder()
|
||||||
.debitor(debitor)
|
.debitor(debitor)
|
||||||
.bankAccount(HsOfficeBankAccountEntity.builder()
|
.bankAccount(HsOfficeBankAccountEntity.builder()
|
||||||
@ -938,6 +962,13 @@ public class ImportOfficeData extends ContextBasedTest {
|
|||||||
final var contactId = rec.getInteger("contact_id");
|
final var contactId = rec.getInteger("contact_id");
|
||||||
final var bpId = rec.getInteger("bp_id");
|
final var bpId = rec.getInteger("bp_id");
|
||||||
|
|
||||||
|
if (this.IGNORE_CONTACTS.contains(contactId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.IGNORE_BUSINESS_PARTNERS.contains(bpId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (rec.getString("roles").isBlank()) {
|
if (rec.getString("roles").isBlank()) {
|
||||||
fail("empty roles assignment not allowed for contact_id: " + contactId);
|
fail("empty roles assignment not allowed for contact_id: " + contactId);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user