ExtractPFTradingPartners.ktActs as the bridge between ProjectForge's legacy financial data (incoming invoices, outgoing invoices, and customer master data) and D-velop's trading partner model. It scans 5 years of invoice data, deduplicates entities across accounts, handles the "divers" (miscellaneous) account pattern, parses free-text billing addresses into structured fields, and classifies entities as VENDOR, CUSTOMER, or PARTNER. Also provides Excel export functionality for reconciliation.
ContextA mutable accumulator that collects extracted trading partners during the multi-phase extraction process:
| Member | Description |
|---|---|
vendors | MutableList<TradingPartner> — Creditor/vendor partners extracted from incoming invoices |
customers | MutableList<TradingPartner> — Customer partners extracted from outgoing invoices + customer master |
sequence | Auto-incrementing counter starting at 7,000,000 for generating unique partner numbers |
allPartners | Combined, deduplicated, sorted list of all partners (vendors + customers) |
nextVal | Returns and increments the sequence counter |
getVendorByDatevKonto(konto) | Looks up a vendor by matching the konto number against importCode |
cleanUp() | Clears the temporary importCode field if it matches the partner number (no longer needed post-migration) |
extractTradingVendors(invoices)Processes EingangsrechnungDO (incoming/creditor invoices):
kreditor name or konto assignmentnextVal) because multiple creditors share the same accountimportCode is set to the konto number for cross-reference during later phasesdatevKonto set to the konto number and remarks prepended with account infoextractTradingCustomersInvoices(invoices, context)Processes RechnungDO (outgoing/customer invoices):
kunde (customer), delegates to handleKunde()extractTradingCustomers(customers, context)Processes KundeDO (customer master data) for any customers not already captured via invoices. Calls context.cleanUp() at the end.
handleKunde()The most complex method in this service. For each KundeDO:
datevKontoACQUISITION or ACTIVE status (or null)checkBillAddress()Parses free-text billing addresses from invoice customerAddress strings using a bottom-up heuristic:
extractZipCodeCity())billToAddressAdditionalextractZipCodeCity(line)Uses a regex pattern ^[0-9 ]{5,10} to extract a German-style 5+ digit postal code. Strips "D-" and "D " country prefixes. Returns Pair<String, String> of (zipCode, city) or null if no match.
| Method | Description |
|---|---|
appendRemarks(partner, remarks) | Appends text to partner.remarks with newline separator |
prependRemarks(partner, konto) | Prepends DATEV-Konto info (number + description) to remarks |
checkIfGiven(vararg str) | Returns true if any string is non-blank |
lineEquals(line, vararg strs) | Case-insensitive trimmed comparison |
createVendor(number, kreditor, konto) | Factory for vendor TradingPartners |
createCustomer(...) | Factory for customer TradingPartners |
extractTradingPartnersAsExcel()Creates a two-sheet Excel workbook using ExcelWorkbook:
Columns include number, datevKonto, importCode, type, company, shortName, remarks, active, and all billing address fields. Enum values (contactType, type, active) are resolved to their value string representation.
| Dao | Purpose |
|---|---|
EingangsrechnungDao | Query incoming/creditor invoices |
KundeDao | Query customer master data |
RechnungDao | Query outgoing/customer invoices |
868d6abb7 2025 -> 2026 78a38ca8f ExcelUtils.createFont and used by all font creating excel routines. 63081666f Source file headers: 2024-> 2025. 1b50060c3 BaseDao: renamed: get -> find, save -> insert, getList -> select, load -> select 87aaf6a5a Migration stuff in progress... BaseDao refactored (not yet finished) internal* methods renamed. e33c8b9c2 Migration stuff in progress... b6092df09 Copyright 2023 -> 2024 b710c3267 WIP D.velop 3ef41086d WIP D.velop be750e77e WIP D.velop 5145a8199 WIP D.velop 9ebb99c88 WIP D.velop cb2915283 WIP D.velop b46787d5f WIP D-velop 2fe7d6f33 WIP D-velop 975af1cd6 WIP D-velop 1dee5f23f WIP D-velop 3ec5c7354 WIP D-velop cb6d633f9 WIP D-velop eb005b878 WIP D-velop