Tony CHEMIT pushed to branch develop-9.0.x at ultreiaio / ird-observe
Commits:
-
118fdb99
by Tony Chemit at 2023-01-25T11:39:02+01:00
-
56d21588
by Tony Chemit at 2023-01-25T11:39:02+01:00
-
e04df8f4
by Tony Chemit at 2023-01-25T11:39:02+01:00
-
123ae78e
by Tony Chemit at 2023-01-25T11:47:47+01:00
6 changed files:
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/ImportEngineExecution.java
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/ImportReferentialContext.java
- core/persistence/avdth/src/main/java/fr/ird/observe/persistence/avdth/data/logbook/FloatingObjectReader.java
- core/persistence/java/src/main/java/fr/ird/observe/entities/data/ps/common/TripConsolidateEngine.java
- src/site/markdown/avdth/logbook.md
- src/site/markdown/avdth/referential.md
Changes:
| ... | ... | @@ -22,7 +22,6 @@ package fr.ird.observe.persistence.avdth.data; |
| 22 | 22 | * #L%
|
| 23 | 23 | */
|
| 24 | 24 | |
| 25 | -import fr.ird.observe.services.service.data.ps.AvdthDataImportConfiguration;
|
|
| 26 | 25 | import fr.ird.observe.entities.ObserveTopiaApplicationContext;
|
| 27 | 26 | import fr.ird.observe.entities.data.ps.common.Trip;
|
| 28 | 27 | import fr.ird.observe.entities.data.ps.localmarket.Survey;
|
| ... | ... | @@ -36,10 +35,11 @@ import fr.ird.observe.entities.data.ps.logbook.WellPlan; |
| 36 | 35 | import fr.ird.observe.persistence.avdth.Query;
|
| 37 | 36 | import fr.ird.observe.persistence.avdth.data.common.TripReader;
|
| 38 | 37 | import fr.ird.observe.persistence.avdth.data.logbook.ActivityReader;
|
| 38 | +import fr.ird.observe.services.service.data.ps.AvdthDataImportConfiguration;
|
|
| 39 | 39 | import io.ultreia.java4all.util.TimeLog;
|
| 40 | +import io.ultreia.java4all.util.sql.SqlScriptWriter;
|
|
| 40 | 41 | import org.apache.logging.log4j.LogManager;
|
| 41 | 42 | import org.apache.logging.log4j.Logger;
|
| 42 | -import io.ultreia.java4all.util.sql.SqlScriptWriter;
|
|
| 43 | 43 | |
| 44 | 44 | import java.io.IOException;
|
| 45 | 45 | import java.sql.ResultSet;
|
| ... | ... | @@ -191,18 +191,19 @@ public class ImportEngineExecution extends ImportEngine { |
| 191 | 191 | protected void loadCatch(Activity activity, String activityId, List<Object> activityPrimaryKey) throws SQLException {
|
| 192 | 192 | int catchesCount = 0;
|
| 193 | 193 | tables.catchTableReader.setPrimaryKey(activityPrimaryKey);
|
| 194 | - boolean baitsFishingOnly = false;
|
|
| 194 | + // If one catch is on baits, then will add observed system 102 on activity
|
|
| 195 | + // See https://gitlab.com/ultreiaio/ird-observe/-/issues/1883#note_617802311
|
|
| 196 | + boolean addBaitsFishingOnlyObservedSystem = false;
|
|
| 195 | 197 | while (tables.catchTableReader.hasNext()) {
|
| 196 | 198 | ResultSet catchRow = tables.catchTableReader.next();
|
| 197 | 199 | int speciesCode = catchRow.getInt(6);
|
| 198 | 200 | if (speciesCode >= 700 && speciesCode < 720) {
|
| 199 | - baitsFishingOnly = true;
|
|
| 201 | + addBaitsFishingOnlyObservedSystem = true;
|
|
| 200 | 202 | }
|
| 201 | 203 | catchWriter.intercept(catchRow, activityId, catchesCount++);
|
| 202 | 204 | }
|
| 203 | - if (baitsFishingOnly) {
|
|
| 204 | - // See #1883
|
|
| 205 | - context.addBaitOnlyObservedSystem(activity);
|
|
| 205 | + if (addBaitsFishingOnlyObservedSystem) {
|
|
| 206 | + activity.addObservedSystem(context.getObservedSystem102());
|
|
| 206 | 207 | }
|
| 207 | 208 | }
|
| 208 | 209 |
| ... | ... | @@ -24,7 +24,6 @@ package fr.ird.observe.persistence.avdth.data; |
| 24 | 24 | |
| 25 | 25 | import com.google.common.collect.ImmutableMap;
|
| 26 | 26 | import com.google.common.collect.Maps;
|
| 27 | -import fr.ird.observe.entities.data.ps.logbook.Activity;
|
|
| 28 | 27 | import fr.ird.observe.entities.referential.common.DataQuality;
|
| 29 | 28 | import fr.ird.observe.entities.referential.common.FpaZone;
|
| 30 | 29 | import fr.ird.observe.entities.referential.common.Harbour;
|
| ... | ... | @@ -134,6 +133,7 @@ public class ImportReferentialContext { |
| 134 | 133 | private ObservedSystem observedSystem0;
|
| 135 | 134 | private SpeciesCache speciesCache;
|
| 136 | 135 | private ObservedSystem observedSystem20;
|
| 136 | + private ObservedSystem observedSystem102;
|
|
| 137 | 137 | private ObservedSystem observedSystem103;
|
| 138 | 138 | private ObservedSystem observedSystem110;
|
| 139 | 139 | private VesselActivity vesselActivity6;
|
| ... | ... | @@ -207,6 +207,7 @@ public class ImportReferentialContext { |
| 207 | 207 | observedSystem0 = observedSystem.get("0");
|
| 208 | 208 | observedSystem20 = observedSystem.get("20");
|
| 209 | 209 | observedSystem103 = observedSystem.get("103");
|
| 210 | + observedSystem102 = observedSystem.get("102");
|
|
| 210 | 211 | observedSystem110 = observedSystem.get("110");
|
| 211 | 212 | |
| 212 | 213 | // dcp
|
| ... | ... | @@ -502,6 +503,10 @@ public class ImportReferentialContext { |
| 502 | 503 | return observedSystem0;
|
| 503 | 504 | }
|
| 504 | 505 | |
| 506 | + public ObservedSystem getObservedSystem102() {
|
|
| 507 | + return observedSystem102;
|
|
| 508 | + }
|
|
| 509 | + |
|
| 505 | 510 | public ObservedSystem getObservedSystem103() {
|
| 506 | 511 | return observedSystem103;
|
| 507 | 512 | }
|
| ... | ... | @@ -550,10 +555,6 @@ public class ImportReferentialContext { |
| 550 | 555 | return code == null ? null : fpaZone.get(code);
|
| 551 | 556 | }
|
| 552 | 557 | |
| 553 | - public void addBaitOnlyObservedSystem(Activity entity) {
|
|
| 554 | - entity.addObservedSystem(getObservedSystem("102"));
|
|
| 555 | - }
|
|
| 556 | - |
|
| 557 | 558 | public ObjectOperation getObjectOperation(String objectOperationCode) {
|
| 558 | 559 | return objectOperation.get(objectOperationCode);
|
| 559 | 560 | }
|
| ... | ... | @@ -67,19 +67,21 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 67 | 67 | .put("0", "99")
|
| 68 | 68 | .put("1", "99")
|
| 69 | 69 | .put("2", "99")
|
| 70 | - .put("3", "99")
|
|
| 71 | - .put("4", "99")
|
|
| 72 | - .put("10", "99")
|
|
| 73 | - .put("14", "99")
|
|
| 70 | + |
|
| 71 | + .put("3", "2")
|
|
| 72 | + .put("4", "2")
|
|
| 73 | + .put("5", "1")
|
|
| 74 | + .put("6", "4")
|
|
| 75 | + |
|
| 74 | 76 | .put("7", "99")
|
| 75 | 77 | .put("8", "99")
|
| 76 | 78 | .put("9", "99")
|
| 79 | + .put("10", "99")
|
|
| 77 | 80 | .put("12", "99")
|
| 78 | 81 | .put("13", "99")
|
| 82 | + .put("14", "99")
|
|
| 79 | 83 | .put("15", "99")
|
| 80 | 84 | |
| 81 | - .put("5", "1")
|
|
| 82 | - .put("6", "4")
|
|
| 83 | 85 | .put("22", "4")
|
| 84 | 86 | .put("23", "1")
|
| 85 | 87 | .put("24", "4")
|
| ... | ... | @@ -101,8 +103,16 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 101 | 103 | * If for a given {@code ACTIVITE.C_OPERA}, no value is found here, this means that there is no buoy to create.
|
| 102 | 104 | */
|
| 103 | 105 | public static final Map<String, String> TRANSMITTING_BUOY_OPERATION_CODE_MAPPING = ImmutableMap.<String, String>builder()
|
| 106 | + .put("3", "1") // Visite | Visite
|
|
| 107 | + .put("4", "1") // Visite | Visite
|
|
| 104 | 108 | .put("5", "3") // Mise à l'eau | null ou 3 Mise à l'eau
|
| 105 | 109 | .put("6", "2") // Retrait | null ou 2 Récupération
|
| 110 | + .put("7", "1") // Visite | Visite
|
|
| 111 | + .put("10", "1")// Visite | Visite
|
|
| 112 | + .put("12", "1")// Visite | Visite
|
|
| 113 | + .put("13", "1")// Visite | Visite
|
|
| 114 | + .put("14", "1")// Visite | Visite
|
|
| 115 | + .put("15", "1")// Visite | Visite
|
|
| 106 | 116 | .put("23", "3") // Mise à l'eau | 3 Mise à l'eau
|
| 107 | 117 | .put("24", "2") // Retrait | 2 Récupération
|
| 108 | 118 | .put("25", "3") // Visite | 3 Mise à l'eau
|
| ... | ... | @@ -128,15 +138,15 @@ public class FloatingObjectReader extends DataReader<FloatingObject> { |
| 128 | 138 | "2",
|
| 129 | 139 | "3",
|
| 130 | 140 | "4",
|
| 141 | + "6",
|
|
| 142 | + "7",
|
|
| 143 | + "8",
|
|
| 131 | 144 | "9",
|
| 132 | 145 | "10",
|
| 133 | 146 | "12",
|
| 147 | + "13",
|
|
| 134 | 148 | "14",
|
| 135 | 149 | "15",
|
| 136 | - "7",
|
|
| 137 | - "8",
|
|
| 138 | - "13",
|
|
| 139 | - "6",
|
|
| 140 | 150 | "22",
|
| 141 | 151 | "24",
|
| 142 | 152 | "25",
|
| ... | ... | @@ -38,7 +38,6 @@ import fr.ird.observe.dto.data.ps.observation.consolidate.ActivityConsolidateRes |
| 38 | 38 | import fr.ird.observe.dto.data.ps.observation.consolidate.FloatingObjectConsolidateRequest;
|
| 39 | 39 | import fr.ird.observe.dto.referential.I18nReferentialHelper;
|
| 40 | 40 | import fr.ird.observe.dto.referential.ReferentialLocale;
|
| 41 | -import fr.ird.observe.dto.referential.ps.common.VesselActivityReference;
|
|
| 42 | 41 | import fr.ird.observe.entities.ObserveTopiaDaoSupplier;
|
| 43 | 42 | import fr.ird.observe.entities.ToolkitTopiaPersistenceContextSupport;
|
| 44 | 43 | import fr.ird.observe.entities.data.ps.localmarket.Batch;
|
| ... | ... | @@ -178,9 +177,8 @@ public class TripConsolidateEngine { |
| 178 | 177 | |
| 179 | 178 | String activityPrefix = String.format("%s - Activity [%s/%s] ", routePrefix, ++activityIndex, activityMax);
|
| 180 | 179 | |
| 181 | - boolean floatingObjectEmpty = activity.isFloatingObjectEmpty();
|
|
| 182 | - if (!VesselActivityReference.isSetOperation(activity) && floatingObjectEmpty) {
|
|
| 183 | - log.debug(String.format("%s Skip activity (No set nor dcp found): %s", activityPrefix, activity.getTopiaId()));
|
|
| 180 | + if (activity.getSetSize() == 0 && activity.isFloatingObjectEmpty()) {
|
|
| 181 | + log.info(String.format("%s Skip activity (No set nor floating object found): %s", activityPrefix, activity.getTopiaId()));
|
|
| 184 | 182 | continue;
|
| 185 | 183 | }
|
| 186 | 184 |
| ... | ... | @@ -69,11 +69,13 @@ On effecute la somme pour toutes les activités AVDTH du jour |
| 69 | 69 | |
| 70 | 70 | * Note 4
|
| 71 | 71 | ### <a name="n_0_4"></a>
|
| 72 | -Voir mapping [REF_VESSEL_ACTIVITY_TYPE](./referential.html#REF_VESSEL_ACTIVITY_TYPE) si code 13 (dans ObServe) alors on ajoute un dcp
|
|
| 72 | +Voir mapping [REF_VESSEL_ACTIVITY_TYPE](./referential.html#REF_VESSEL_ACTIVITY_TYPE)
|
|
| 73 | 73 | |
| 74 | 74 | * Note 5
|
| 75 | 75 | ### <a name="n_0_5"></a>
|
| 76 | -Voir mapping [REF_SCHOOL_TYPE](./referential.html#REF_SCHOOL_TYPE)
|
|
| 76 | +Voir mapping [REF_SCHOOL_TYPE](./referential.html#REF_SCHOOL_TYPE).
|
|
| 77 | + |
|
| 78 | +**À noter que cette donée est renseigné uniquement si ```ACTIVITE_C_OPERA in (0, 1, 2, 14)```**
|
|
| 77 | 79 | |
| 78 | 80 | * Note 6
|
| 79 | 81 | ### <a name="n_0_6"></a>
|
| ... | ... | @@ -103,6 +105,36 @@ Donnée non persistée dans ObServe, (voir https://gitlab.com/ultreiaio/ird-obse |
| 103 | 105 | ### <a name="n_0_12"></a>
|
| 104 | 106 | Mapping sur le code.
|
| 105 | 107 | |
| 108 | +### Cas des activités de pêche à partir de ```ACTIVITE.C_OPERA```
|
|
| 109 | + |
|
| 110 | +Pour les activités de pêche, on rajoute des données sur l'activité pour décrire la calée.
|
|
| 111 | + |
|
| 112 | +| ACTIVITE.C_OPERA | SetSuccessStatus [1](#n_5_1) | ReasonForNullSet [1](#n_5_1) | SetCount | SchoolType |
|
|
| 113 | +|-----------------:|-----------------------------:|------------------------------:|:---------|:-----------|
|
|
| 114 | +| 0 | 0 | 0 | (1) | (2) |
|
|
| 115 | +| 1 | 1 | non renseigné | (1) | (2) |
|
|
| 116 | +| 2 | 2 | non renseigné | (1) | (2) |
|
|
| 117 | +| 14 (3) | 2 | non renseigné | (1) | (2) |
|
|
| 118 | + |
|
| 119 | +* Note 1
|
|
| 120 | +#### <a name="n_5_1"></a>
|
|
| 121 | + |
|
| 122 | +On utilise le code du réferentiel ObServe
|
|
| 123 | + |
|
| 124 | +* Note 2
|
|
| 125 | +#### <a name="n_5_2"></a>
|
|
| 126 | + |
|
| 127 | +* Note 3
|
|
| 128 | +#### <a name="n_5_3"></a>
|
|
| 129 | + |
|
| 130 | +* Note 4
|
|
| 131 | +#### <a name="n_5_4"></a>
|
|
| 132 | + |
|
| 133 | +0.
|
|
| 134 | +1. calculé depuis ```ACTIVITE.V_NB_OP```
|
|
| 135 | +2. calculé depuis ```ACTIVITE.C_TBANC```
|
|
| 136 | +3. dans ce cas on rajoute aussi le système observé ***110**
|
|
| 137 | + |
|
| 106 | 138 | ### Ajout d'un DCP
|
| 107 | 139 | |
| 108 | 140 | On ajoute un DCP uniquement pour une activité avec **vesselActivity.code == 13**.
|
| ... | ... | @@ -223,8 +223,8 @@ Mapping type d'activité |
| 223 | 223 | | 1 | 6 (1) |
|
| 224 | 224 | | 2 | 6 (1) |
|
| 225 | 225 | | 14 | 6 (1) (3) |
|
| 226 | -| 3 | 2 |
|
|
| 227 | -| 4 | 1 |
|
|
| 226 | +| 3 | 2 (ou 102) (4) |
|
|
| 227 | +| 4 | 1 (ou 101) (4) |
|
|
| 228 | 228 | | 5 | 13 (2) |
|
| 229 | 229 | | 6 | 13 (2) |
|
| 230 | 230 | | 22 | 13 (2) |
|
| ... | ... | @@ -251,11 +251,13 @@ Mapping type d'activité |
| 251 | 251 | | 19 | 29 |
|
| 252 | 252 | | 20 | 30 |
|
| 253 | 253 | | 35 | 31 |
|
| 254 | -| 36 | 99 **FIXME** |
|
|
| 254 | +| 36 | 36 (5) |
|
|
| 255 | 255 | |
| 256 | 256 | 1. **Seule une activité de code 6 permet la création de captures**.
|
| 257 | 257 | 2. **Seule une activité de code 13 permet la création de DCP**.
|
| 258 | 258 | 3. On ajoute en plus un système observé **110** et **setSuccessStatus** à **2**.
|
| 259 | +4. Si un dcp est trouvé alors on utilise un type d'activité introduit en version *9.1.0* qui permet l'ajout de dcp.
|
|
| 260 | +5. Le type d'activité a été ajouté lors de la migration de la version *9.1.0* (avant on utilisait *99*)
|
|
| 259 | 261 | |
| 260 | 262 | ### REF_SCHOOL_TYPE
|
| 261 | 263 |