Tony CHEMIT pushed to branch develop at ultreiaio / ird-observe Commits: ff61c3ef by Tony Chemit at 2022-12-05T19:38:52+01:00 Report - ajout du report psObservationCatchWeightByGroup - - - - - 3d0e57fa by Tony Chemit at 2022-12-05T19:38:53+01:00 Report - renommage du report psObservationCatchByGroup en psObservationCatchTotalCountByGroup - - - - - c83e69d1 by Tony Chemit at 2022-12-05T19:47:00+01:00 Merge branch 'feature/issue_2554' into develop Besoin d'un rapport Observations fournissant les captures par devenir, en poids - Closes #2554 - - - - - 6 changed files: - core/api/dto/src/main/resources/observe-reports.properties - core/services/local/src/test/java/fr/ird/observe/services/local/service/ReportServiceLocalReadTest.java - core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchByGroupReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchTotalCountByGroupReportFixture.java - + core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchWeightByGroupReportFixture.java - core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchByGroup.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchTotalCountByGroup.properties - + core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchWeightByGroup.properties Changes: ===================================== core/api/dto/src/main/resources/observe-reports.properties ===================================== @@ -887,12 +887,12 @@ report.psObservationCatch.request.3=2,0|row|\ Where m.id In :tripId report.psObservationCatch.request.3.repeat=speciesId|column ################################################################################ -## Captures par groupe d'espèces +## Observations - Dénombrement des captures par type de banc et devenir, filtrés par groupe ################################################################################ -report.psObservationCatchByGroup.modelType=PS -report.psObservationCatchByGroup.name=Observations - Dénombrement des captures par type de banc et devenir, filtrés par groupe -report.psObservationCatchByGroup.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir -report.psObservationCatchByGroup.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\ +report.psObservationCatchTotalCountByGroup.modelType=PS +report.psObservationCatchTotalCountByGroup.name=Observations - Dénombrement des captures par type de banc et devenir, filtrés par groupe +report.psObservationCatchTotalCountByGroup.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir, filtré par groupe +report.psObservationCatchTotalCountByGroup.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\ Select distinct sg \ From TripImpl t \ Join t.routeObs r \ @@ -903,7 +903,7 @@ Join ca.species e \ Join e.speciesGroup sg \ Where t.id In :tripId \ Order By sg.code -report.psObservationCatchByGroup.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\ +report.psObservationCatchTotalCountByGroup.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\ Select distinct e \ From TripImpl t \ Join t.routeObs r \ @@ -913,11 +913,11 @@ Join c.catches ca with ca.totalCount Is Not Null \ Join ca.species e with e.speciesGroup.id = :speciesGroup \ Where t.id In :tripId \ Order By e.homeId -report.psObservationCatchByGroup.repeatVariable.2.speciesFate=fr.ird.observe.entities.referential.ps.common.SpeciesFate|\ +report.psObservationCatchTotalCountByGroup.repeatVariable.2.speciesFate=fr.ird.observe.entities.referential.ps.common.SpeciesFate|\ Select sf \ From SpeciesFateImpl sf \ Order by sf.discard, sf.code -report.psObservationCatchByGroup.request.1=0,0|row|\ +report.psObservationCatchTotalCountByGroup.request.1=0,0|row|\ Select \ concat(\ '[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \ @@ -934,7 +934,7 @@ report.psObservationCatchByGroup.request.1=0,0|row|\ Where m.id In :tripId \ Group by e \ Order By e.homeId -report.psObservationCatchByGroup.operations.1=ExecuteRequestAndReorganizeCountByRepeatVariable:species|speciesFate|\ +report.psObservationCatchTotalCountByGroup.operations.1=ExecuteRequestAndReorganizeCountByRepeatVariable:species|speciesFate|\ Select \ s.id, sf.id, Sum(ca.totalCount) \ From TripImpl m \ @@ -947,9 +947,73 @@ Join ca.speciesFate sf with sf.id In :speciesFate \ Where m.id In :tripId \ Group by s, sf \ Order By s.homeId -report.psObservationCatchByGroup.operations.2=ComputeDynamicHeader:Espèce,Total BL,Total BO|speciesFate -report.psObservationCatchByGroup.operations.3=SumIntRow:1|3 -report.psObservationCatchByGroup.operations.4=SumIntColumn:1|1 +report.psObservationCatchTotalCountByGroup.operations.2=ComputeDynamicHeader:Espèce,Total BL,Total BO|speciesFate +report.psObservationCatchTotalCountByGroup.operations.3=SumIntRow:1|3 +report.psObservationCatchTotalCountByGroup.operations.4=SumIntColumn:1|1 +################################################################################ +## Poids des captures par groupe d'espèces +################################################################################ +report.psObservationCatchWeightByGroup.modelType=PS +report.psObservationCatchWeightByGroup.name=Observations - Poids des captures par type de banc et devenir, filtrés par groupe +report.psObservationCatchWeightByGroup.description=Afficher le poids de captures par groupe d'espèce selon le type de banc et le devenir, filtrés par groupe +report.psObservationCatchWeightByGroup.variable.speciesGroup=fr.ird.observe.dto.referential.common.SpeciesGroupDto|\ +Select distinct sg \ +From TripImpl t \ +Join t.routeObs r \ +Join r.activity a \ +Join a.set c \ +Join c.catches ca with ca.totalCount Is Not Null \ +Join ca.species e \ +Join e.speciesGroup sg \ +Where t.id In :tripId \ +Order By sg.code +report.psObservationCatchWeightByGroup.repeatVariable.1.species=fr.ird.observe.entities.referential.common.Species|\ +Select distinct e \ +From TripImpl t \ +Join t.routeObs r \ +Join r.activity a \ +Join a.set c \ +Join c.catches ca with ca.catchWeight Is Not Null \ +Join ca.species e with e.speciesGroup.id = :speciesGroup \ +Where t.id In :tripId \ +Order By e.homeId +report.psObservationCatchWeightByGroup.repeatVariable.2.speciesFate=fr.ird.observe.entities.referential.ps.common.SpeciesFate|\ +Select sf \ +From SpeciesFateImpl sf \ +Order by sf.discard, sf.code +report.psObservationCatchWeightByGroup.request.1=0,0|row|\ + Select \ + concat(\ + '[FAO]', (case when e.faoCode is not null then e.faoCode else '-' end), \ + ' [sc]', (case when e.scientificLabel is not null then e.scientificLabel else '-' end), \ + ' [fr]', (case when e.label2 is not null then e.label2 else '-' end)), \ + Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#2' then ca.catchWeight else 0 end), \ + Sum(case c.schoolType.id when 'fr.ird.referential.ps.common.SchoolType#0#1' then ca.catchWeight else 0 end) \ + From TripImpl m \ + Join m.routeObs r \ + Join r.activity a \ + Join a.set c \ + Join c.catches ca with ca.catchWeight Is Not Null \ + Join ca.species e with e.id In :species \ + Where m.id In :tripId \ + Group by e \ + Order By e.homeId +report.psObservationCatchWeightByGroup.operations.1=ExecuteRequestAndReorganizeCountByRepeatVariable:species|speciesFate|\ +Select \ +s.id, sf.id, Sum(ca.catchWeight) \ +From TripImpl m \ +Join m.routeObs r \ +Join r.activity a \ +Join a.set c \ +Join c.catches ca \ +Join ca.species s with s.id In :species \ +Join ca.speciesFate sf with sf.id In :speciesFate \ +Where m.id In :tripId \ +Group by s, sf \ +Order By s.homeId +report.psObservationCatchWeightByGroup.operations.2=ComputeDynamicHeader:Espèce,Total BL,Total BO|speciesFate +report.psObservationCatchWeightByGroup.operations.3=SumIntRow:1|3 +report.psObservationCatchWeightByGroup.operations.4=SumIntColumn:1|1 ########################################################### ## Distribution des tailles par espèces et type de mesure ########################################################### ===================================== core/services/local/src/test/java/fr/ird/observe/services/local/service/ReportServiceLocalReadTest.java ===================================== @@ -37,8 +37,13 @@ public class ReportServiceLocalReadTest extends GeneratedReportServiceLocalReadT } @Test - public void executeReportPsObservationCatchByGroup() { + public void executeReportPsObservationCatchTotalCountByGroup() { ReportService service = getService(); - fixtures.executeReport(getServicesProvider(), service, "psObservationCatchByGroup"); + fixtures.executeReport(getServicesProvider(), service, "psObservationCatchTotalCountByGroup"); + } + @Test + public void executeReportPsObservationCatchWeightByGroup() { + ReportService service = getService(); + fixtures.executeReport(getServicesProvider(), service, "psObservationCatchWeightByGroup"); } } ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchByGroupReportFixture.java → core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchTotalCountByGroupReportFixture.java ===================================== @@ -29,13 +29,13 @@ import fr.ird.observe.services.service.ReportFixture; import java.util.Iterator; /** - * Pour tester le report {@code discardedAccessoireByGroup} + * Pour tester le report {@code psObservationCatchTotalCountByGroup} * * @author Tony Chemit - dev@tchemit.fr * @since 1.9 */ @AutoService(ReportFixture.class) -public class PsObservationCatchByGroupReportFixture extends ReportFixture { +public class PsObservationCatchTotalCountByGroupReportFixture extends ReportFixture { @Override public void assertSyntax(Report report) { ===================================== core/services/test/src/main/java/fr/ird/observe/services/service/report/ps/PsObservationCatchWeightByGroupReportFixture.java ===================================== @@ -0,0 +1,53 @@ +package fr.ird.observe.services.service.report.ps; + +/*- + * #%L + * ObServe Core :: Services :: Test + * %% + * Copyright (C) 2008 - 2022 IRD, Ultreia.io + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import com.google.auto.service.AutoService; +import fr.ird.observe.dto.report.Report; +import fr.ird.observe.dto.report.ReportRequest; +import fr.ird.observe.services.service.ReportFixture; + +import java.util.Iterator; + +/** + * Created on 05/12/2022. + * + * @author Tony Chemit - dev@tchemit.fr + * @since 9.0.22 + */ +@AutoService(ReportFixture.class) +public class PsObservationCatchWeightByGroupReportFixture extends ReportFixture { + + @Override + public void assertSyntax(Report report) { + super.assertSyntax(report); + super.assertSyntax(report); + Iterator<ReportRequest> requests = getRequestIterator(report); + assertReportRequestDimension(requests, ReportRequest.RequestLayout.row, 0, 0); + } + + @Override + protected void setVariables(Report report) { + setVariableValue(report, "speciesGroup", "fr.ird.referential.common.SpeciesGroup#1239832683689#0.7120116158620075"); + } +} ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchByGroup.properties → core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchTotalCountByGroup.properties ===================================== @@ -20,7 +20,7 @@ # #L% ### syntax.name=Observations - Dénombrement des captures par type de banc et devenir, filtrés par groupe -syntax.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir +syntax.description=Afficher les nombres de captures par groupe d'espèce selon le type de banc et le devenir, filtré par groupe syntax.rows=-1 syntax.columns=-1 syntax.columnsHeader= ===================================== core/services/test/src/main/resources/fixtures/fr/ird/observe/services/service/ReportService-psObservationCatchWeightByGroup.properties ===================================== @@ -0,0 +1,32 @@ +### +# #%L +# ObServe Core :: Services :: Test +# %% +# Copyright (C) 2008 - 2022 IRD, Ultreia.io +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### +syntax.name=Observations - Poids des captures par type de banc et devenir, filtrés par groupe +syntax.description=Afficher le poids de captures par groupe d'espèce selon le type de banc et le devenir, filtrés par groupe +syntax.rows=-1 +syntax.columns=-1 +syntax.columnsHeader= +syntax.rowsHeader= +syntax.nbRequests=1 +result.columns=19 +result.rows=2 +result.0=Espèce^Total BL^Total BO^Ailerons seulements^Partiellement conservé (ex: ailerons de requin, poisson séché)^Autres (à préciser dans les notes)^Conservé pour raisons scientifiques^Conservé pour le marché local ou poisson séché/salé à bord^Conservé à destination de la conserverie^Utilisé en cuisine du bord^Echappe du filet (pour requin-baleine et cétacés)^Rejeté, statut non observé^Rejeté suffocant^Rejeté suffocant blessé^Sortie vivant du filet (pour requin-baleine et cétacés)^Sortie mort du filet (pour requin-baleine et cétacés)^Rejeté vivant^Rejeté mort^Total +result.1=[FAO]ALV [sc]Alopias vulpinus [fr]Renard^0.0^12.0^null^null^null^null^null^null^null^12.0^null^null^null^null^null^null^null^12 \ No newline at end of file View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/eaebe74a78f4bf9d98102569d... -- View it on GitLab: https://gitlab.com/ultreiaio/ird-observe/-/compare/eaebe74a78f4bf9d98102569d... You're receiving this email because of your account on gitlab.com.