diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/repositories/mission/IRpnExportRepository.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/repositories/mission/IRpnExportRepository.kt index b94c8f36..c19a3f8e 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/repositories/mission/IRpnExportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/repositories/mission/IRpnExportRepository.kt @@ -2,14 +2,12 @@ package fr.gouv.dgampa.rapportnav.domain.repositories.mission import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.crew.MissionCrewEntity import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.export.MissionExportEntity -import java.time.LocalDate -import java.time.ZonedDateTime data class ExportParams( val service: String?, val id: String, - val startDateTime: ZonedDateTime?, - val endDateTime: ZonedDateTime?, + val startDateTime: String?, + val endDateTime: String?, val presenceMer: Map, val presenceQuai: Map, val indisponibilite: Map, @@ -21,7 +19,7 @@ data class ExportParams( val goMarine: Float?, val essence: Float?, val crew: List, - val timeline: Map>? + val timeline: Map>? ) interface IRpnExportRepository { diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/action/GroupActionByDate.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/action/GroupActionByDate.kt index 3b17a5f5..056881c7 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/action/GroupActionByDate.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/action/GroupActionByDate.kt @@ -2,16 +2,21 @@ package fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action import fr.gouv.dgampa.rapportnav.config.UseCase import fr.gouv.dgampa.rapportnav.domain.entities.mission.MissionActionEntity -import java.time.LocalDate @UseCase class GroupActionByDate { - fun execute(actions: List?): Map>? { + fun execute(actions: List?): Map>? { return actions?.groupBy { action -> when (action) { - is MissionActionEntity.EnvAction -> action.envAction?.controlAction?.action?.actionStartDateTimeUtc?.toLocalDate() - is MissionActionEntity.FishAction -> action.fishAction.controlAction?.action?.actionDatetimeUtc?.toLocalDate() - is MissionActionEntity.NavAction -> action.navAction.startDateTimeUtc.toLocalDate() + is MissionActionEntity.EnvAction -> action.envAction?.controlAction?.action?.actionStartDateTimeUtc?.takeIf { true } + ?.toLocalDate().toString() + + is MissionActionEntity.FishAction -> action.fishAction.controlAction?.action?.actionDatetimeUtc?.takeIf { true } + ?.toLocalDate().toString() + + is MissionActionEntity.NavAction -> action.navAction.startDateTimeUtc.takeIf { true } + ?.toLocalDate().toString() + else -> null // Handle other types of actions, if any } }?.mapNotNull { (date, actions) -> diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/ExportMission.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/ExportMission.kt index c8251805..c6a4ac43 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/ExportMission.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/ExportMission.kt @@ -49,8 +49,8 @@ class ExportMission( val exportParams = ExportParams( service = mission.openBy, id = "pam" + mission.id, - startDateTime = mission.startDateTimeUtc, - endDateTime = mission.endDateTimeUtc, + startDateTime = mission.startDateTimeUtc.toString(), + endDateTime = mission.endDateTimeUtc?.toString(), presenceMer = durations["atSeaDurations"].orEmpty(), presenceQuai = durations["dockingDurations"].orEmpty(), indisponibilite = durations["unavailabilityDurations"].orEmpty(), diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/FormatActionsForTimeline.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/FormatActionsForTimeline.kt index 71b9177d..9c2a06b0 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/FormatActionsForTimeline.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/domain/use_cases/mission/export/FormatActionsForTimeline.kt @@ -5,10 +5,12 @@ import fr.gouv.dgampa.rapportnav.domain.entities.mission.MissionActionEntity import fr.gouv.dgampa.rapportnav.domain.entities.mission.env.envActions.EnvActionControlEntity import fr.gouv.dgampa.rapportnav.domain.entities.mission.fish.fishActions.InfractionType import fr.gouv.dgampa.rapportnav.domain.entities.mission.fish.fishActions.MissionAction -import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action.* +import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action.ActionControlEntity +import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action.ActionFreeNoteEntity +import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action.ActionStatusEntity +import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.action.ActionType import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.status.mapActionStatusTypeToHumanString import fr.gouv.dgampa.rapportnav.domain.use_cases.mission.action.GroupActionByDate -import java.time.LocalDate import java.time.ZonedDateTime @UseCase @@ -16,7 +18,7 @@ class FormatActionsForTimeline( private val groupActionByDate: GroupActionByDate, ) { - fun formatTimeline(actions: List?): Map>? { + fun formatTimeline(actions: List?): Map>? { if (actions.isNullOrEmpty()) { return null diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/APIRpnExportRepository.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/APIRpnExportRepository.kt index 9b4ea85f..394a497b 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/APIRpnExportRepository.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/APIRpnExportRepository.kt @@ -28,8 +28,8 @@ class APIRpnExportRepository( val content = ExportMissionODTInput( service = params.service, id = params.id, - startDateTime = params.startDateTime?.toString(), - endDateTime = params.endDateTime?.toString(), + startDateTime = params.startDateTime, + endDateTime = params.endDateTime, presenceMer = params.presenceMer, presenceQuai = params.presenceQuai, indisponibilite = params.indisponibilite, diff --git a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/adapters/inputs/ExportMissionODTInput.kt b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/adapters/inputs/ExportMissionODTInput.kt index 5d8d3b46..d9b40551 100644 --- a/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/adapters/inputs/ExportMissionODTInput.kt +++ b/backend/src/main/kotlin/fr/gouv/dgampa/rapportnav/infrastructure/rapportnav1/adapters/inputs/ExportMissionODTInput.kt @@ -1,9 +1,8 @@ package fr.gouv.dgampa.rapportnav.infrastructure.rapportnav1.adapters.inputs import fr.gouv.dgampa.rapportnav.domain.entities.mission.nav.crew.MissionCrewEntity -import java.time.LocalDate -class ExportMissionODTInput ( +class ExportMissionODTInput( val service: String?, val id: String?, val startDateTime: String?, @@ -19,5 +18,5 @@ class ExportMissionODTInput ( val goMarine: Float?, val essence: Float?, val crew: List, - val timeline: Map>? + val timeline: Map>? )