memberNumber as partnerNumber+memberNumberSuffix #13

Merged
hsh-michaelhoennig merged 78 commits from memberNumberSuffix-and-partnerNumber into master 2024-01-24 15:57:16 +01:00
4 changed files with 32 additions and 20 deletions
Showing only changes of commit 7e31e95d57 - Show all commits

View File

@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.office.coopassets;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
import net.hostsharing.hsadminng.repository.HasUuid;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable; import net.hostsharing.hsadminng.stringify.Stringifyable;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
@ -23,7 +24,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@DisplayName("CoopAssetsTransaction") @DisplayName("CoopAssetsTransaction")
public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable { public class HsOfficeCoopAssetsTransactionEntity implements Stringifyable, HasUuid {
private static Stringify<HsOfficeCoopAssetsTransactionEntity> stringify = stringify(HsOfficeCoopAssetsTransactionEntity.class) private static Stringify<HsOfficeCoopAssetsTransactionEntity> stringify = stringify(HsOfficeCoopAssetsTransactionEntity.class)
.withProp(e -> e.getMembership().getMemberNumber()) .withProp(e -> e.getMembership().getMemberNumber())

View File

@ -3,6 +3,7 @@ package net.hostsharing.hsadminng.hs.office.coopshares;
import lombok.*; import lombok.*;
import net.hostsharing.hsadminng.errors.DisplayName; import net.hostsharing.hsadminng.errors.DisplayName;
import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity; import net.hostsharing.hsadminng.hs.office.membership.HsOfficeMembershipEntity;
import net.hostsharing.hsadminng.repository.HasUuid;
import net.hostsharing.hsadminng.stringify.Stringify; import net.hostsharing.hsadminng.stringify.Stringify;
import net.hostsharing.hsadminng.stringify.Stringifyable; import net.hostsharing.hsadminng.stringify.Stringifyable;
@ -20,7 +21,7 @@ import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@DisplayName("CoopShareTransaction") @DisplayName("CoopShareTransaction")
public class HsOfficeCoopSharesTransactionEntity implements Stringifyable { public class HsOfficeCoopSharesTransactionEntity implements Stringifyable, HasUuid {
private static Stringify<HsOfficeCoopSharesTransactionEntity> stringify = stringify(HsOfficeCoopSharesTransactionEntity.class) private static Stringify<HsOfficeCoopSharesTransactionEntity> stringify = stringify(HsOfficeCoopSharesTransactionEntity.class)
.withProp(e -> e.getMembership().getMemberNumber()) .withProp(e -> e.getMembership().getMemberNumber())

View File

@ -231,11 +231,9 @@ public class ImportOfficeTables extends ContextBasedTest {
assertThat(coopAssets.toString()).isEqualToIgnoringWhitespace(""" assertThat(coopAssets.toString()).isEqualToIgnoringWhitespace("""
{ {
30000=CoopAssetsTransaction(10007, 2000-12-06, DEPOSIT, 1280.00, for subscription A), 30000=CoopAssetsTransaction(10007, 2000-12-06, DEPOSIT, 1280.00, for subscription A),
31001=CoopAssetsTransaction(10010, 2000-12-06, DEPOSIT, 18.00, for subscription B), 31000=CoopAssetsTransaction(10010, 2000-12-06, DEPOSIT, 128.00, for subscription B),
31002=CoopAssetsTransaction(10010, 2000-12-06, -18.00, for subscription B),
31003=CoopAssetsTransaction(10010, 2000-12-06, DEPOSIT, 128.00, for subscription B),
32000=CoopAssetsTransaction(10007, 2005-01-10, DEPOSIT, 2560.00, for subscription C), 32000=CoopAssetsTransaction(10007, 2005-01-10, DEPOSIT, 2560.00, for subscription C),
33001=CoopAssetsTransaction(10007, 2005-01-10, -512.00, for transfer to 10), 33001=CoopAssetsTransaction(10007, 2005-01-10, TRANSFER, -512.00, for transfer to 10),
33002=CoopAssetsTransaction(10010, 2005-01-10, ADOPTION, 512.00, for transfer from 7), 33002=CoopAssetsTransaction(10010, 2005-01-10, ADOPTION, 512.00, for transfer from 7),
34001=CoopAssetsTransaction(10010, 2016-12-31, CLEARING, -8.00, for cancellation D), 34001=CoopAssetsTransaction(10010, 2016-12-31, CLEARING, -8.00, for cancellation D),
34002=CoopAssetsTransaction(10010, 2016-12-31, DISBURSAL, -100.00, for cancellation D), 34002=CoopAssetsTransaction(10010, 2016-12-31, DISBURSAL, -100.00, for cancellation D),
@ -267,7 +265,11 @@ public class ImportOfficeTables extends ContextBasedTest {
sepaMandates.forEach((id, mandate) -> em.persist(mandate)); sepaMandates.forEach((id, mandate) -> em.persist(mandate));
updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id"); updateLegacyIds(sepaMandates, "hs_office_sepamandate_legacy_id", "sepa_mandate_id");
// TODO: coopshares+coopassets coopShares.forEach((id, shareTransaction) -> em.persist(shareTransaction));
updateLegacyIds(coopShares, "hs_office_coopsharestransaction_legacy_id", "member_share_id");
coopAssets.forEach((id, assetTransaction) -> em.persist(assetTransaction));
updateLegacyIds(coopShares, "hs_office_coopassetstransaction_legacy_id", "member_asset_id");
em.flush(); em.flush();
} }
@ -392,7 +394,8 @@ public class ImportOfficeTables extends ContextBasedTest {
.forEach(rec -> { .forEach(rec -> {
final var member = memberships.get(rec.getInteger("bp_id")); final var member = memberships.get(rec.getInteger("bp_id"));
final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {{ final var assetTypeMapping = new HashMap<String, HsOfficeCoopAssetsTransactionType>() {
{
put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER); put("HANDOVER", HsOfficeCoopAssetsTransactionType.TRANSFER);
put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION); put("ADOPTION", HsOfficeCoopAssetsTransactionType.ADOPTION);
put("LOSS", HsOfficeCoopAssetsTransactionType.LOSS); put("LOSS", HsOfficeCoopAssetsTransactionType.LOSS);
@ -400,7 +403,16 @@ public class ImportOfficeTables extends ContextBasedTest {
put("PRESCRIPTION", HsOfficeCoopAssetsTransactionType.LIMITATION); put("PRESCRIPTION", HsOfficeCoopAssetsTransactionType.LIMITATION);
put("PAYBACK", HsOfficeCoopAssetsTransactionType.DISBURSAL); put("PAYBACK", HsOfficeCoopAssetsTransactionType.DISBURSAL);
put("PAYMENT", HsOfficeCoopAssetsTransactionType.DEPOSIT); put("PAYMENT", HsOfficeCoopAssetsTransactionType.DEPOSIT);
}}; }
public HsOfficeCoopAssetsTransactionType get(final String key) {
final var value = super.get(key);
if ( value != null ) {
return value;
}
throw new IllegalStateException("no mapping value found for: " + key);
}
};
final var assetTransaction = HsOfficeCoopAssetsTransactionEntity.builder() final var assetTransaction = HsOfficeCoopAssetsTransactionEntity.builder()
.membership(member) .membership(member)

View File

@ -1,10 +1,8 @@
member_asset_id; bp_id; date; action; amount; comment member_asset_id; bp_id; date; action; amount; comment
30000; 7; 2000-12-06; PAYMENT; 1280.00; for subscription A 30000; 7; 2000-12-06; PAYMENT; 1280.00; for subscription A
31001; 10; 2000-12-06; PAYMENT; 18.00; for subscription B 31000; 10; 2000-12-06; PAYMENT; 128.00; for subscription B
31002; 10; 2000-12-06; ADJUSTMENT; -18.00; for subscription B
31003; 10; 2000-12-06; PAYMENT; 128.00; for subscription B
32000; 7; 2005-01-10; PAYMENT; 2560.00; for subscription C 32000; 7; 2005-01-10; PAYMENT; 2560.00; for subscription C
33001; 7; 2005-01-10; TRANSFER; -512.00; for transfer to 10 33001; 7; 2005-01-10; HANDOVER; -512.00; for transfer to 10
33002; 10; 2005-01-10; ADOPTION; 512.00; for transfer from 7 33002; 10; 2005-01-10; ADOPTION; 512.00; for transfer from 7
34001; 10; 2016-12-31; CLEARING; -8.00; for cancellation D 34001; 10; 2016-12-31; CLEARING; -8.00; for cancellation D
34002; 10; 2016-12-31; PAYBACK; -100.00; for cancellation D 34002; 10; 2016-12-31; PAYBACK; -100.00; for cancellation D

1 member_asset_id bp_id date action amount comment
2 30000 17 7 2000-12-06 PAYMENT 1280.00 for subscription A
3 31000 20 10 2000-12-06 PAYMENT 128.00 for subscription B
32000 17 2005-01-10 PAYMENT 2560.00 for subscription C
33001 17 2005-01-10 HANDOVER -512.00 for transfer to 10
4 33002 32000 20 7 2005-01-10 ADOPTION PAYMENT 512.00 2560.00 for transfer from 7 for subscription C
5 34001 33001 20 7 2016-12-31 2005-01-10 CLEARING HANDOVER -8.00 -512.00 for cancellation D for transfer to 10
6 34002 33002 20 10 2016-12-31 2005-01-10 PAYBACK ADOPTION -100.00 512.00 for cancellation D for transfer from 7
7 34003 34001 20 10 2016-12-31 LOSS CLEARING -20.00 -8.00 for cancellation D
8 34002 10 2016-12-31 PAYBACK -100.00 for cancellation D