-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TFP-5185 legge til støtte for annenpart stillingsprosent (#352)
- Loading branch information
1 parent
4783069
commit 42fcd53
Showing
38 changed files
with
460 additions
and
154 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...nger/regler/uttak/fastsetteperiode/betingelser/aktkrav/SjekkOmAktivitetErDokumentert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...setteperiode/betingelser/aktkrav/SjekkOmMorErIArbeidMedStillingprosentUnder75Prosent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package no.nav.foreldrepenger.regler.uttak.fastsetteperiode.betingelser.aktkrav; | ||
|
||
import no.nav.foreldrepenger.regler.uttak.fastsetteperiode.FastsettePeriodeGrunnlag; | ||
import no.nav.foreldrepenger.regler.uttak.fastsetteperiode.grunnlag.MorsAktivitet; | ||
import no.nav.foreldrepenger.regler.uttak.fastsetteperiode.grunnlag.OppgittPeriode; | ||
import no.nav.fpsak.nare.doc.RuleDocumentation; | ||
import no.nav.fpsak.nare.evaluation.Evaluation; | ||
import no.nav.fpsak.nare.specification.LeafSpecification; | ||
|
||
@RuleDocumentation(SjekkOmMorErIArbeidMedStillingprosentUnder75Prosent.ID) | ||
public class SjekkOmMorErIArbeidMedStillingprosentUnder75Prosent extends LeafSpecification<FastsettePeriodeGrunnlag> { | ||
|
||
public static final String ID = "AKT_ARBEID_1"; | ||
public static final String BESKRIVELSE = "Er mor i arbeid og har en stillingsprosent under 75 prosent"; | ||
|
||
public SjekkOmMorErIArbeidMedStillingprosentUnder75Prosent() { | ||
super(ID); | ||
} | ||
|
||
@Override | ||
public Evaluation evaluate(FastsettePeriodeGrunnlag grunnlag) { | ||
var aktuellPeriode = grunnlag.getAktuellPeriode(); | ||
if (erMorIArbeidOgHarEnStillingsprosentMindreEnn75Prosent(aktuellPeriode)) { | ||
return ja(); | ||
} | ||
return nei(); | ||
} | ||
|
||
private static boolean erMorIArbeidOgHarEnStillingsprosentMindreEnn75Prosent(OppgittPeriode aktuellPeriode) { | ||
return MorsAktivitet.ARBEID.equals(aktuellPeriode.getMorsAktivitet()) && aktuellPeriode.getMorsStillingsprosent() != null; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...va/no/nav/foreldrepenger/regler/uttak/fastsetteperiode/grunnlag/MorsStillingsprosent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package no.nav.foreldrepenger.regler.uttak.fastsetteperiode.grunnlag; | ||
|
||
import java.math.BigDecimal; | ||
import java.math.RoundingMode; | ||
import java.util.Objects; | ||
|
||
public class MorsStillingsprosent implements Comparable<MorsStillingsprosent> { | ||
|
||
private final BigDecimal verdi; | ||
|
||
public MorsStillingsprosent(BigDecimal verdi) { | ||
Objects.requireNonNull(verdi, "Morsstillingssprosent må ha verdi hvis satt!"); | ||
this.verdi = scale(verdi); | ||
if (this.verdi.compareTo(BigDecimal.valueOf(75)) >= 0 || this.verdi.compareTo(BigDecimal.ZERO) <= 0) { | ||
throw new IllegalArgumentException("Mors stillingsprosent har en ugyldig verdi: " + this.verdi); | ||
} | ||
} | ||
|
||
public MorsStillingsprosent(int verdi) { | ||
this(BigDecimal.valueOf(verdi)); | ||
} | ||
|
||
public BigDecimal decimalValue() { | ||
return scale(verdi); | ||
} | ||
|
||
private BigDecimal scale(BigDecimal verdi) { | ||
return verdi.setScale(2, RoundingMode.UP); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return verdi.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
var that = (MorsStillingsprosent) o; | ||
return Objects.equals(decimalValue(), that.decimalValue()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(decimalValue()); | ||
} | ||
|
||
@Override | ||
public int compareTo(MorsStillingsprosent morsStillingsprosent) { | ||
return decimalValue().compareTo(morsStillingsprosent.decimalValue()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.