-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f86c2bb
commit 704b9aa
Showing
46 changed files
with
1,891 additions
and
728 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
7 changes: 7 additions & 0 deletions
7
.../src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/LogbookOperationType.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 |
---|---|---|
@@ -1,8 +1,15 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.entities.logbook | ||
|
||
enum class LogbookOperationType { | ||
/** Transmission. */ | ||
DAT, | ||
|
||
/** Correction. */ | ||
COR, | ||
|
||
/** Suppression. */ | ||
DEL, | ||
|
||
/** Acquittement. */ | ||
RET, | ||
} |
7 changes: 7 additions & 0 deletions
7
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/LogbookTripGear.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,7 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.entities.logbook | ||
|
||
data class LogbookTripGear( | ||
val gear: String, | ||
val mesh: Int, | ||
val dimensions: String, | ||
) |
9 changes: 9 additions & 0 deletions
9
...nd/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/logbook/LogbookTripSegment.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 fr.gouv.cnsp.monitorfish.domain.entities.logbook | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
data class LogbookTripSegment( | ||
val segment: String, | ||
@JsonProperty("segment_name") | ||
val segmentName: String, | ||
) |
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
6 changes: 6 additions & 0 deletions
6
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/entities/vessel/VesselId.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,6 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.entities.vessel | ||
|
||
data class VesselId( | ||
val identifier: VesselIdentifier, | ||
val value: String, | ||
) |
15 changes: 15 additions & 0 deletions
15
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/filters/LogbookReportFilter.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,15 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.filters | ||
|
||
import fr.gouv.cnsp.monitorfish.domain.entities.vessel.VesselId | ||
|
||
data class LogbookReportFilter( | ||
val flagStates: List<String>? = null, | ||
val integratedAfter: String? = null, | ||
val integratedBefore: String? = null, | ||
val portLocodes: List<String>? = null, | ||
val searchQuery: String? = null, | ||
val specyCodes: List<String>? = null, | ||
val tripSegmentSegments: List<String>? = null, | ||
val tripGearCodes: List<String>? = null, | ||
val vesselId: VesselId? = null, | ||
) |
21 changes: 21 additions & 0 deletions
21
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/filters/PriorNotificationFilter.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,21 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.filters | ||
|
||
data class PriorNotificationFilter( | ||
val countryCodes: List<String>? = null, | ||
val fleetSegmentSegments: List<String>? = null, | ||
val gearCodes: List<String>? = listOf(), | ||
val hasOneOrMoreReportings: Boolean? = null, | ||
val isLessThanTwelveMetersVessel: Boolean? = null, | ||
val isSent: Boolean? = null, | ||
val isVesselPretargeted: Boolean? = null, | ||
val lastControlStartDate: String? = null, | ||
val lastControlEndDate: String? = null, | ||
val portLocodes: List<String>? = null, | ||
val query: String? = null, | ||
val receivedAtStartDate: String? = null, | ||
val receivedAtEndDate: String? = null, | ||
// val seaFrontGroup: SeaFrontGroup | 'EXTRA', | ||
val specyCodes: List<String>? = null, | ||
val searchQuery: String? = null, | ||
// val types: PriorNotification.PriorNotificationType[] | ||
) |
11 changes: 11 additions & 0 deletions
11
backend/src/main/kotlin/fr/gouv/cnsp/monitorfish/domain/filters/ReportingFilter.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,11 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.filters | ||
|
||
import fr.gouv.cnsp.monitorfish.domain.entities.reporting.ReportingType | ||
import fr.gouv.cnsp.monitorfish.domain.entities.vessel.VesselId | ||
|
||
data class ReportingFilter( | ||
val isArchived: Boolean? = null, | ||
val isDeleted: Boolean? = null, | ||
val types: List<ReportingType>? = null, | ||
val vesselId: VesselId? = null, | ||
) |
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
50 changes: 50 additions & 0 deletions
50
...lin/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/GetPriorNotifications.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,50 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.use_cases.prior_notification | ||
|
||
import fr.gouv.cnsp.monitorfish.config.UseCase | ||
import fr.gouv.cnsp.monitorfish.domain.exceptions.CodeNotFoundException | ||
import fr.gouv.cnsp.monitorfish.domain.filters.LogbookReportFilter | ||
import fr.gouv.cnsp.monitorfish.domain.use_cases.prior_notification.dtos.PriorNotification | ||
import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.JpaLogbookReportRepository | ||
import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.JpaPortRepository | ||
import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.JpaRiskFactorsRepository | ||
import fr.gouv.cnsp.monitorfish.infrastructure.database.repositories.JpaVesselRepository | ||
|
||
@UseCase | ||
class GetPriorNotifications( | ||
private val logbookReportRepository: JpaLogbookReportRepository, | ||
private val portRepository: JpaPortRepository, | ||
private val riskFactorRepository: JpaRiskFactorsRepository, | ||
private val vesselRepository: JpaVesselRepository, | ||
) { | ||
fun execute(filter: LogbookReportFilter): List<PriorNotification> { | ||
val priorNotifications = | ||
logbookReportRepository.findAllPriorNotifications(filter).map { priorNotification -> | ||
val port = | ||
priorNotification.portLocode?.let { | ||
try { | ||
portRepository.find(it) | ||
} catch (e: CodeNotFoundException) { | ||
null | ||
} | ||
} | ||
val vessel = | ||
vesselRepository.findVessel( | ||
priorNotification.vesselInternalReferenceNumber, | ||
priorNotification.vesselExternalReferenceNumber, | ||
priorNotification.vesselIrcs, | ||
) | ||
val vesselRiskFactor = | ||
priorNotification.vesselInternalReferenceNumber?.let { | ||
riskFactorRepository.findVesselRiskFactors(it) | ||
} | ||
|
||
priorNotification.copy( | ||
port = port, | ||
vessel = vessel, | ||
vesselRiskFactor = vesselRiskFactor, | ||
) | ||
} | ||
|
||
return priorNotifications | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...in/fr/gouv/cnsp/monitorfish/domain/use_cases/prior_notification/dtos/PriorNotification.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,26 @@ | ||
package fr.gouv.cnsp.monitorfish.domain.use_cases.prior_notification.dtos | ||
|
||
import fr.gouv.cnsp.monitorfish.domain.entities.logbook.LogbookTripGear | ||
import fr.gouv.cnsp.monitorfish.domain.entities.logbook.LogbookTripSegment | ||
import fr.gouv.cnsp.monitorfish.domain.entities.logbook.messages.LogbookMessageValue | ||
import fr.gouv.cnsp.monitorfish.domain.entities.port.Port | ||
import fr.gouv.cnsp.monitorfish.domain.entities.risk_factor.VesselRiskFactor | ||
import fr.gouv.cnsp.monitorfish.domain.entities.vessel.Vessel | ||
|
||
data class PriorNotification( | ||
val id: Long, | ||
val message: LogbookMessageValue?, | ||
val portLocode: String?, | ||
val receivedAt: String, | ||
val tripGears: List<LogbookTripGear>, | ||
val tripSegments: List<LogbookTripSegment>, | ||
val vesselExternalReferenceNumber: String?, | ||
val vesselFlagState: String?, | ||
val vesselImo: String?, | ||
val vesselInternalReferenceNumber: String?, | ||
val vesselIrcs: String?, | ||
val vesselName: String?, | ||
val port: Port? = null, | ||
val vessel: Vessel? = null, | ||
val vesselRiskFactor: VesselRiskFactor? = null, | ||
) |
Oops, something went wrong.