Compare commits
No commits in common. "5d7a245d9d21aa4413d07ee25cf048af442e2e1d" and "ab281c93a7aae94c9a728b2f7661ad818023280d" have entirely different histories.
5d7a245d9d
...
ab281c93a7
@ -129,7 +129,7 @@ openapiProcessor {
|
|||||||
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
||||||
apiPath "$projectDir/src/main/resources/api-definition.yaml"
|
apiPath "$projectDir/src/main/resources/api-definition.yaml"
|
||||||
mapping "$projectDir/src/main/resources/api-mappings.yaml"
|
mapping "$projectDir/src/main/resources/api-mappings.yaml"
|
||||||
targetDir "$buildDir/generated/sources/openapi-javax"
|
targetDir "$projectDir/build/generated/sources/openapi-javax"
|
||||||
showWarnings true
|
showWarnings true
|
||||||
openApiNullable true
|
openApiNullable true
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ openapiProcessor {
|
|||||||
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
||||||
apiPath "$projectDir/src/main/resources/api-definition/rbac/rbac.yaml"
|
apiPath "$projectDir/src/main/resources/api-definition/rbac/rbac.yaml"
|
||||||
mapping "$projectDir/src/main/resources/api-definition/rbac/api-mappings.yaml"
|
mapping "$projectDir/src/main/resources/api-definition/rbac/api-mappings.yaml"
|
||||||
targetDir "$buildDir/generated/sources/openapi-javax"
|
targetDir "$projectDir/build/generated/sources/openapi-javax"
|
||||||
showWarnings true
|
showWarnings true
|
||||||
openApiNullable true
|
openApiNullable true
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ openapiProcessor {
|
|||||||
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
||||||
apiPath "$projectDir/src/main/resources/api-definition/test/test.yaml"
|
apiPath "$projectDir/src/main/resources/api-definition/test/test.yaml"
|
||||||
mapping "$projectDir/src/main/resources/api-definition/test/api-mappings.yaml"
|
mapping "$projectDir/src/main/resources/api-definition/test/api-mappings.yaml"
|
||||||
targetDir "$buildDir/generated/sources/openapi-javax"
|
targetDir "$projectDir/build/generated/sources/openapi-javax"
|
||||||
showWarnings true
|
showWarnings true
|
||||||
openApiNullable true
|
openApiNullable true
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ openapiProcessor {
|
|||||||
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
processor 'io.openapiprocessor:openapi-processor-spring:2022.5'
|
||||||
apiPath "$projectDir/src/main/resources/api-definition/hs-office/hs-office.yaml"
|
apiPath "$projectDir/src/main/resources/api-definition/hs-office/hs-office.yaml"
|
||||||
mapping "$projectDir/src/main/resources/api-definition/hs-office/api-mappings.yaml"
|
mapping "$projectDir/src/main/resources/api-definition/hs-office/api-mappings.yaml"
|
||||||
targetDir "$buildDir/generated/sources/openapi-javax"
|
targetDir "$projectDir/build/generated/sources/openapi-javax"
|
||||||
showWarnings true
|
showWarnings true
|
||||||
openApiNullable true
|
openApiNullable true
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,6 @@ import net.hostsharing.hsadminng.stringify.Stringifyable;
|
|||||||
import org.hibernate.annotations.GenericGenerator;
|
import org.hibernate.annotations.GenericGenerator;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
import static net.hostsharing.hsadminng.stringify.Stringify.stringify;
|
||||||
@ -29,7 +28,6 @@ public class HsOfficeDebitorEntity implements Stringifyable {
|
|||||||
stringify(HsOfficeDebitorEntity.class, "debitor")
|
stringify(HsOfficeDebitorEntity.class, "debitor")
|
||||||
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
.withProp(HsOfficeDebitorEntity::getDebitorNumber)
|
||||||
.withProp(HsOfficeDebitorEntity::getPartner)
|
.withProp(HsOfficeDebitorEntity::getPartner)
|
||||||
// TODO: add defaultPrefix?
|
|
||||||
.withSeparator(": ")
|
.withSeparator(": ")
|
||||||
.quotedValues(false);
|
.quotedValues(false);
|
||||||
|
|
||||||
@ -61,34 +59,21 @@ public class HsOfficeDebitorEntity implements Stringifyable {
|
|||||||
@Column(name = "vatbusiness")
|
@Column(name = "vatbusiness")
|
||||||
private boolean vatBusiness;
|
private boolean vatBusiness;
|
||||||
|
|
||||||
@Column(name = "vatreversecharge")
|
|
||||||
private boolean vatReverseCharge;
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "refundbankaccountuuid")
|
@JoinColumn(name = "refundbankaccountuuid")
|
||||||
private HsOfficeBankAccountEntity refundBankAccount;
|
private HsOfficeBankAccountEntity refundBankAccount;
|
||||||
|
|
||||||
@Column(name = "defaultprefix", columnDefinition = "char(3) not null")
|
|
||||||
private String defaultPrefix;
|
|
||||||
|
|
||||||
public String getDebitorNumberString() {
|
public String getDebitorNumberString() {
|
||||||
// TODO: refactor
|
|
||||||
if (partner.getDebitorNumberPrefix() == null ) {
|
|
||||||
if (debitorNumberSuffix == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return String.format("%02d", debitorNumberSuffix);
|
|
||||||
}
|
|
||||||
if (debitorNumberSuffix == null) {
|
|
||||||
return partner.getDebitorNumberPrefix() + "??";
|
|
||||||
}
|
|
||||||
return partner.getDebitorNumberPrefix() + String.format("%02d", debitorNumberSuffix);
|
return partner.getDebitorNumberPrefix() + String.format("%02d", debitorNumberSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getDebitorNumber() {
|
public int getDebitorNumber() {
|
||||||
return Optional.ofNullable(getDebitorNumberString()).map(Integer::parseInt).orElse(null);
|
return Integer.parseInt(getDebitorNumberString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Column(name = "defaultprefix", columnDefinition = "char(3) not null")
|
||||||
|
private String defaultPrefix;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return stringify.apply(this);
|
return stringify.apply(this);
|
||||||
|
@ -13,8 +13,7 @@ create table hs_office_debitor
|
|||||||
billingContactUuid uuid not null references hs_office_contact(uuid),
|
billingContactUuid uuid not null references hs_office_contact(uuid),
|
||||||
vatId varchar(24), -- TODO.spec: here or in person?
|
vatId varchar(24), -- TODO.spec: here or in person?
|
||||||
vatCountryCode varchar(2),
|
vatCountryCode varchar(2),
|
||||||
vatBusiness boolean not null,
|
vatBusiness boolean not null, -- TODO.spec: more of such?
|
||||||
vatReverseCharge boolean not null,
|
|
||||||
refundBankAccountUuid uuid references hs_office_bankaccount(uuid),
|
refundBankAccountUuid uuid references hs_office_bankaccount(uuid),
|
||||||
defaultPrefix char(3) not null
|
defaultPrefix char(3) not null
|
||||||
constraint check_member_code check (
|
constraint check_member_code check (
|
||||||
|
@ -193,7 +193,6 @@ call generateRbacRestrictedView('hs_office_debitor', 'target.debitorNumberSuffix
|
|||||||
vatId = new.vatId,
|
vatId = new.vatId,
|
||||||
vatCountryCode = new.vatCountryCode,
|
vatCountryCode = new.vatCountryCode,
|
||||||
vatBusiness = new.vatBusiness,
|
vatBusiness = new.vatBusiness,
|
||||||
vatreversecharge = new.vatreversecharge,
|
|
||||||
defaultPrefix = new.defaultPrefix
|
defaultPrefix = new.defaultPrefix
|
||||||
$updates$);
|
$updates$);
|
||||||
--//
|
--//
|
||||||
|
@ -38,8 +38,8 @@ begin
|
|||||||
raise notice '- using partner (%): %', relatedPartner.uuid, relatedPartner;
|
raise notice '- using partner (%): %', relatedPartner.uuid, relatedPartner;
|
||||||
raise notice '- using billingContact (%): %', relatedContact.uuid, relatedContact;
|
raise notice '- using billingContact (%): %', relatedContact.uuid, relatedContact;
|
||||||
insert
|
insert
|
||||||
into hs_office_debitor (uuid, partneruuid, debitornumbersuffix, billable, billingcontactuuid, vatbusiness, vatreversecharge, refundbankaccountuuid, defaultprefix)
|
into hs_office_debitor (uuid, partneruuid, debitornumbersuffix, billable, billingcontactuuid, vatbusiness, refundbankaccountuuid, defaultprefix)
|
||||||
values (uuid_generate_v4(), relatedPartner.uuid, debitorNumberSuffix, true, relatedContact.uuid, true, false, relatedBankAccountUuid, defaultPrefix);
|
values (uuid_generate_v4(), relatedPartner.uuid, debitorNumberSuffix, true, relatedContact.uuid, true, relatedBankAccountUuid, defaultPrefix);
|
||||||
end; $$;
|
end; $$;
|
||||||
--//
|
--//
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||||||
* which reads CSV files from the file system.
|
* which reads CSV files from the file system.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Disabled
|
||||||
@DataJpaTest
|
@DataJpaTest
|
||||||
@Import({ Context.class, JpaAttempt.class })
|
@Import({ Context.class, JpaAttempt.class })
|
||||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||||
@ -105,15 +106,15 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
assertThat(contacts.toString()).isEqualTo("{}");
|
assertThat(contacts.toString()).isEqualTo("{}");
|
||||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=debitor(1000700: null, null),
|
7=debitor(10007: null, null),
|
||||||
10=debitor(1001000: null, null),
|
10=debitor(10010: null, null),
|
||||||
12=debitor(1101200: null, null)}
|
12=debitor(11012: null, null)}
|
||||||
""");
|
""");
|
||||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=Membership(10007, null, null, 1000700, [2000-12-06,), NONE),
|
7=Membership(10007, null, null, 10007, [2000-12-06,), NONE),
|
||||||
10=Membership(10010, null, null, 1001000, [2000-12-06,2016-01-01), UNKNOWN),
|
10=Membership(10010, null, null, 10010, [2000-12-06,2016-01-01), UNKNOWN),
|
||||||
12=Membership(11012, null, null, 1101200, [2021-04-01,), NONE)
|
12=Membership(11012, null, null, 11012, [2021-04-01,), NONE)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@ -153,16 +154,16 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
""");
|
""");
|
||||||
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(debitors.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=debitor(1000700: Mellies, Michael),
|
7=debitor(10007: Mellies, Michael),
|
||||||
10=debitor(1001000: JM e.K.),
|
10=debitor(10010: JM e.K.),
|
||||||
12=debitor(1101200: Test PS)
|
12=debitor(11012: Test PS)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
assertThat(memberships.toString()).isEqualToIgnoringWhitespace("""
|
||||||
{
|
{
|
||||||
7=Membership(10007, Mellies, Michael, 1000700, [2000-12-06,), NONE),
|
7=Membership(10007, Mellies, Michael, 10007, [2000-12-06,), NONE),
|
||||||
10=Membership(10010, JM e.K., 1001000, [2000-12-06,2016-01-01), UNKNOWN),
|
10=Membership(10010, JM e.K., 10010, [2000-12-06,2016-01-01), UNKNOWN),
|
||||||
12=Membership(11012, Test PS, 1101200, [2021-04-01,), NONE)
|
12=Membership(11012, Test PS, 11012, [2021-04-01,), NONE)
|
||||||
}
|
}
|
||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
@ -312,7 +313,6 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
persons.put(rec.getInteger("bp_id"), person);
|
persons.put(rec.getInteger("bp_id"), person);
|
||||||
|
|
||||||
final var partner = HsOfficePartnerEntity.builder()
|
final var partner = HsOfficePartnerEntity.builder()
|
||||||
.debitorNumberPrefix(rec.getInteger("member_id"))
|
|
||||||
.details(HsOfficePartnerDetailsEntity.builder().build())
|
.details(HsOfficePartnerDetailsEntity.builder().build())
|
||||||
.contact(HsOfficeContactEntity.builder().build())
|
.contact(HsOfficeContactEntity.builder().build())
|
||||||
.person(person)
|
.person(person)
|
||||||
@ -321,12 +321,12 @@ public class ImportOfficeTables extends ContextBasedTest {
|
|||||||
|
|
||||||
final var debitor = HsOfficeDebitorEntity.builder()
|
final var debitor = HsOfficeDebitorEntity.builder()
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.debitorNumberSuffix((byte)0)
|
// .debitorNumberSuffix(rec.getByte("member_id"))
|
||||||
.defaultPrefix(rec.getString("member_code"))
|
// .defaultPrefix(rec.getString("member_code"))
|
||||||
.partner(partner)
|
.partner(partner)
|
||||||
.billingContact(partner.getContact())
|
.billingContact(partner.getContact())
|
||||||
.billable(rec.isEmpty("free"))
|
.billable(rec.isEmpty("free"))
|
||||||
.vatReverseCharge(rec.getBoolean("exempt_vat"))
|
// .vatExempt(toBool(rec.get("exempt_vat")) (reverse-charge) TODO: add as vat-reverse-charge to debitor
|
||||||
.vatBusiness("GROSS".equals(rec.getString("indicator_vat"))) // TODO: remove
|
.vatBusiness("GROSS".equals(rec.getString("indicator_vat"))) // TODO: remove
|
||||||
.vatId(rec.getString("uid_vat"))
|
.vatId(rec.getString("uid_vat"))
|
||||||
.build();
|
.build();
|
||||||
@ -624,14 +624,9 @@ class Record {
|
|||||||
return isNotBlank(value) ? Byte.valueOf(value.trim()) : 0;
|
return isNotBlank(value) ? Byte.valueOf(value.trim()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean getBoolean(final String columnName) {
|
|
||||||
final String value = getString(columnName);
|
|
||||||
return isNotBlank(value) && Boolean.parseBoolean(value.trim());
|
|
||||||
}
|
|
||||||
|
|
||||||
Integer getInteger(final String columnName) {
|
Integer getInteger(final String columnName) {
|
||||||
final String value = getString(columnName);
|
final String value = getString(columnName);
|
||||||
return isNotBlank(value) ? Integer.parseInt(value.trim()) : 0;
|
return isNotBlank(value) ? Integer.valueOf(value.trim()) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal getBigDecimal(final String columnName) {
|
BigDecimal getBigDecimal(final String columnName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user