-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1257 from navikt/doed-brevmottaker-svarbrev
Quick fix for handling failures when sending automatic svarbrev.
- Loading branch information
Showing
13 changed files
with
245 additions
and
192 deletions.
There are no files selected for viewing
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
46 changes: 46 additions & 0 deletions
46
src/main/kotlin/no/nav/klage/oppgave/domain/klage/TaskListMerkantil.kt
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,46 @@ | ||
package no.nav.klage.oppgave.domain.klage | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import java.time.LocalDateTime | ||
import java.util.* | ||
|
||
@Entity | ||
@Table(name = "task_list_merkantil", schema = "klage") | ||
class TaskListMerkantil( | ||
@Id | ||
val id: UUID = UUID.randomUUID(), | ||
@Column(name = "behandling_id") | ||
val behandlingId: UUID, | ||
@Column(name = "reason") | ||
val reason: String, | ||
@Column(name = "created") | ||
val created: LocalDateTime, | ||
@Column(name = "date_handled") | ||
var dateHandled: LocalDateTime?, | ||
@Column(name = "handled_by") | ||
var handledBy: String?, | ||
@Column(name = "handled_by_name") | ||
var handledByName: String?, | ||
@Column(name = "comment") | ||
var comment: String? | ||
) { | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (javaClass != other?.javaClass) return false | ||
|
||
other as TaskListMerkantil | ||
|
||
return id == other.id | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return id.hashCode() | ||
} | ||
|
||
override fun toString(): String { | ||
return "TaskListMerkantil(id=$id, behandlingId=$behandlingId, reason=$reason, created=$created, dateHandled=$dateHandled, handledBy=$handledBy, handledByName=$handledByName, comment=$comment)" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/no/nav/klage/oppgave/repositories/TaskListMerkantilRepository.kt
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,9 @@ | ||
package no.nav.klage.oppgave.repositories | ||
|
||
import no.nav.klage.oppgave.domain.klage.TaskListMerkantil | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.stereotype.Repository | ||
import java.util.* | ||
|
||
@Repository | ||
interface TaskListMerkantilRepository : JpaRepository<TaskListMerkantil, UUID> |
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
60 changes: 60 additions & 0 deletions
60
src/main/kotlin/no/nav/klage/oppgave/service/ExternalMottakFacade.kt
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,60 @@ | ||
package no.nav.klage.oppgave.service | ||
|
||
import no.nav.klage.dokument.service.DokumentUnderArbeidService | ||
import no.nav.klage.oppgave.api.view.OversendtKlageAnkeV3 | ||
import no.nav.klage.oppgave.api.view.OversendtKlageV2 | ||
import no.nav.klage.oppgave.domain.klage.Behandling | ||
import no.nav.klage.oppgave.util.getLogger | ||
import no.nav.klage.oppgave.util.getSecureLogger | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class ExternalMottakFacade( | ||
private val mottakService: MottakService, | ||
private val dokumentUnderArbeidService: DokumentUnderArbeidService, | ||
) { | ||
|
||
companion object { | ||
@Suppress("JAVA_CLASS_ON_COMPANION") | ||
private val logger = getLogger(javaClass.enclosingClass) | ||
private val secureLogger = getSecureLogger() | ||
} | ||
|
||
fun createMottakForKlageAnkeV3(oversendtKlageAnke: OversendtKlageAnkeV3) { | ||
val behandling = mottakService.createMottakForKlageAnkeV3(oversendtKlageAnke) | ||
|
||
tryToSendSvarbrev(behandling, hindreAutomatiskSvarbrev = oversendtKlageAnke.hindreAutomatiskSvarbrev == true) | ||
} | ||
|
||
fun createMottakForKlageV2(oversendtKlage: OversendtKlageV2) { | ||
val behandling = mottakService.createMottakForKlageV2(oversendtKlage) | ||
|
||
tryToSendSvarbrev(behandling, hindreAutomatiskSvarbrev = oversendtKlage.hindreAutomatiskSvarbrev == true) | ||
} | ||
|
||
fun createMottakForKlageAnkeV3ForE2ETests(oversendtKlageAnke: OversendtKlageAnkeV3): Behandling { | ||
val behandling = mottakService.createMottakForKlageAnkeV3(oversendtKlageAnke) | ||
|
||
tryToSendSvarbrev(behandling, hindreAutomatiskSvarbrev = oversendtKlageAnke.hindreAutomatiskSvarbrev == true) | ||
|
||
return behandling | ||
} | ||
|
||
private fun tryToSendSvarbrev( | ||
behandling: Behandling, | ||
hindreAutomatiskSvarbrev: Boolean | ||
) { | ||
try { | ||
dokumentUnderArbeidService.sendSvarbrev( | ||
behandling = behandling, | ||
hindreAutomatiskSvarbrev = hindreAutomatiskSvarbrev, | ||
) | ||
} catch (e: Exception) { | ||
mottakService.createTaskForMerkantil( | ||
behandlingId = behandling.id, | ||
reason = e.message ?: "Ukjent feil" | ||
) | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.