From dbac69e9e108593f846214d94a07bb1a092c606c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20GRENOT?= Date: Thu, 31 Oct 2024 10:36:47 +0100 Subject: [PATCH] =?UTF-8?q?[SDIS=20973]=20Ajout=20de=20la=20num=C3=A9rotat?= =?UTF-8?q?ion=20du=20SDIS=20973?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: #226839 Change-Id: I22764cde2565e20db63069bd1b6c48dbc572d6d9 --- .../repository/NumeroUtilRepository.java | 29 +++++++++++++++++-- .../repository/NumeroUtilRepository.java | 29 +++++++++++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/api-remocra/api/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java b/api-remocra/api/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java index a051eb2b..06dcd5ad 100755 --- a/api-remocra/api/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java +++ b/api-remocra/api/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java @@ -51,7 +51,8 @@ public enum MethodeNumerotation { M_86, M_89, M_91, - M_95 + M_95, + M_973 } public static MethodeNumerotation getHydrantNumerotationMethode() { @@ -82,7 +83,8 @@ public enum MethodeNumerotationInterne { M_83, M_86, M_91, - M_95 + M_95, + M_973 } public static MethodeNumerotationInterne getHydrantNumerotationInterneMethode() { @@ -149,6 +151,8 @@ public static String computeNumero(Hydrant hydrant) { return NumeroUtilRepository.computeNumero91(hydrant); case M_95: return NumeroUtilRepository.computeNumero95(hydrant); + case M_973: + return NumeroUtilRepository.computeNumero973(hydrant); case M_83: default: return NumeroUtilRepository.computeNumero83(hydrant); @@ -586,6 +590,26 @@ protected static String computeNumero95(Hydrant hydrant) { return sb.append(String.format("%04d", hydrant.getNumeroInterne())).toString(); } + /** + * + * sans espace + * Exemple : 97309PI10, 97304PI122, 97314PA1 + * + * @param hydrant + * @return + */ + protected static String computeNumero973(Hydrant hydrant) { + StringBuilder sb = new StringBuilder(); + sb.append(getHydrantCommune(hydrant).getInsee()); + sb.append( + context + .select(TYPE_HYDRANT_NATURE.CODE) + .from(TYPE_HYDRANT_NATURE) + .where(TYPE_HYDRANT_NATURE.ID.eq(hydrant.getNature())) + .fetchOneInto(String.class)); + return sb.append(hydrant.getNumeroInterne()).toString(); + } + // ****************************** // ** Zone spéciale // ****************************** @@ -679,6 +703,7 @@ public static Integer computeNumeroInterne(Hydrant hydrant) { case M_58: return NumeroUtilRepository.computeNumeroInterne58(hydrant); case M_77: + case M_973: return NumeroUtilRepository.computeNumeroInterne77(hydrant); case M_86: return NumeroUtilRepository.computeNumeroInterne86(hydrant); diff --git a/remocra/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java b/remocra/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java index 8fed2857..469a4636 100755 --- a/remocra/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java +++ b/remocra/src/main/java/fr/sdis83/remocra/repository/NumeroUtilRepository.java @@ -50,7 +50,8 @@ public enum MethodeNumerotation { M_86, M_89, M_91, - M_95 + M_95, + M_973 } public static NumeroUtilRepository.MethodeNumerotation getHydrantNumerotationMethode() { @@ -83,7 +84,8 @@ public enum MethodeNumerotationInterne { M_83, M_86, M_91, - M_95 + M_95, + M_973 } public static NumeroUtilRepository.MethodeNumerotationInterne @@ -150,6 +152,8 @@ public static String computeNumero(Hydrant hydrant) { return NumeroUtilRepository.computeNumero91(hydrant); case M_95: return NumeroUtilRepository.computeNumero95(hydrant); + case M_973: + return NumeroUtilRepository.computeNumero973(hydrant); case M_83: default: return NumeroUtilRepository.computeNumero83(hydrant); @@ -587,6 +591,26 @@ protected static String computeNumero95(Hydrant hydrant) { return sb.append(String.format("%04d", hydrant.getNumeroInterne())).toString(); } + /** + * + * sans espace + * Exemple : 97309PI10, 97304PI122, 97314PA1 + * + * @param hydrant + * @return + */ + protected static String computeNumero973(Hydrant hydrant) { + StringBuilder sb = new StringBuilder(); + sb.append(getHydrantCommune(hydrant).getInsee()); + sb.append( + context + .select(TYPE_HYDRANT_NATURE.CODE) + .from(TYPE_HYDRANT_NATURE) + .where(TYPE_HYDRANT_NATURE.ID.eq(hydrant.getNature())) + .fetchOneInto(String.class)); + return sb.append(hydrant.getNumeroInterne()).toString(); + } + // ****************************** // ** Zone spéciale // ****************************** @@ -679,6 +703,7 @@ public static Integer computeNumeroInterne(Hydrant hydrant) { case M_58: return NumeroUtilRepository.computeNumeroInterne58(hydrant); case M_77: + case M_973: return NumeroUtilRepository.computeNumeroInterne77(hydrant); case M_86: return NumeroUtilRepository.computeNumeroInterne86(hydrant);