Merge avec avec la branche aur-br05-26032025
This commit is contained in:
15
pom.xml
15
pom.xml
@@ -14,7 +14,7 @@
|
||||
<name>fiscad</name>
|
||||
<description>Application de collecte des données socio-foncières</description>
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<java.version>17</java.version>
|
||||
<spring-cloud.version>2020.0.3</spring-cloud.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
@@ -97,14 +97,12 @@
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.locationtech.jts</groupId>
|
||||
<artifactId>jts-core</artifactId>
|
||||
<version>1.19.0</version>
|
||||
<version>1.16.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-spatial</artifactId>
|
||||
@@ -116,6 +114,7 @@
|
||||
<artifactId>jackson-datatype-jts</artifactId>
|
||||
<version>1.2.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.teiid</groupId>
|
||||
<artifactId>teiid-optional-geo</artifactId>
|
||||
@@ -142,6 +141,14 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version> <!-- ou une version plus récente -->
|
||||
<configuration>
|
||||
<release>17</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "api/parcelleGeom", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequestMapping(value = "api/parcelle-geom", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@SecurityRequirement(name = "bearer")
|
||||
@Tag(name = "ParcelleGeometrie")
|
||||
@CrossOrigin(origins = "*")
|
||||
@@ -32,7 +32,7 @@ public class ParcelleGeomController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@PostMapping(value = "/create-from-geojsonfile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public ResponseEntity<?> createTpe(@RequestPart(required = true) MultipartFile file) {
|
||||
try{
|
||||
int n = parcelleGeomService.createParcelleFromGeoJsonFile(file);
|
||||
@@ -53,7 +53,15 @@ public class ParcelleGeomController {
|
||||
@GetMapping("/all")
|
||||
public ResponseEntity<?> getAllTpeList() {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomList(), "Liste des tpe chargée avec succès."),
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomList(), "Liste des parcelle chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/by-quartier/{codeQuartier}")
|
||||
public ResponseEntity<?> getAllTpeList(@PathVariable String codeQuartier) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomListUnQuatier(codeQuartier), "Liste des parcelle chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
@@ -63,18 +71,23 @@ public class ParcelleGeomController {
|
||||
public ResponseEntity<?> getAllTpePaged(@RequestParam int pageNo, @RequestParam int pageSize) {
|
||||
Pageable pageable = PageRequest.of(pageNo, pageSize);
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomList(pageable), "Liste des tpe chargée avec succès."),
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomList(pageable), "Liste des parcelle chargée avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
}
|
||||
|
||||
@GetMapping("/id/{id}")
|
||||
public ResponseEntity<?> getTpeById(@PathVariable Long id) {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomById(id), "Tpe trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
public ResponseEntity<?> getParcelleGeomById(@PathVariable Long id) {
|
||||
try {
|
||||
return new ResponseEntity<>(
|
||||
new ApiResponse<>(true, parcelleGeomService.getParcelleGeomById(id).orElse(null), "parcelle trouvé avec succès."),
|
||||
HttpStatus.OK
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(new ApiResponse(false, null, "An error has been occur and the content is {" + e.getMessage() + "}."), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ public class Arrondissement extends BaseEntity implements Serializable {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
@JsonIgnore
|
||||
|
||||
@@ -26,6 +26,8 @@ public class Commune extends BaseEntity implements Serializable {
|
||||
private Long id;
|
||||
private String code;
|
||||
private String nom;
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
@ManyToOne
|
||||
private Departement departement;
|
||||
@JsonIgnore
|
||||
|
||||
@@ -30,9 +30,7 @@ public class Secteur extends BaseEntity implements Serializable {
|
||||
private User chefSecteur;
|
||||
@ManyToOne
|
||||
private Structure structure;
|
||||
//@JsonIgnore
|
||||
//@OneToMany(mappedBy = "secteur")
|
||||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "secteur_id")
|
||||
private List<SecteurDecoupage> secteurDecoupages;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
package io.gmss.fiscad.entities.infocad.metier;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Quartier;
|
||||
import io.gmss.fiscad.entities.infocad.parametre.NatureDomaine;
|
||||
import io.gmss.fiscad.entities.rfu.metier.Batiment;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -15,15 +11,14 @@ import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.MultiPolygon;
|
||||
import org.locationtech.jts.geom.Point;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.n52.jackson.datatype.jts.GeometryDeserializer;
|
||||
import org.n52.jackson.datatype.jts.GeometrySerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Entity
|
||||
@@ -77,6 +72,9 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
@OneToOne
|
||||
private Parcelle parcelle;
|
||||
|
||||
@ManyToOne
|
||||
private Quartier quartier;
|
||||
|
||||
@ColumnDefault("0")
|
||||
private int geomSrid;
|
||||
|
||||
@@ -87,8 +85,8 @@ public class ParcelleGeom extends BaseEntity implements Serializable {
|
||||
|
||||
@JsonSerialize(using = GeometrySerializer.class)
|
||||
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
|
||||
// @Column(name = "geom_32631",columnDefinition = "geometry(Polygon,32631)")
|
||||
@Column(name = "geometry",columnDefinition = "geometry(Polygon,32631)")
|
||||
//private Polygon geometry32631 ;
|
||||
@Column(columnDefinition = "geometry")
|
||||
private Geometry geometry;
|
||||
}
|
||||
//@Column(columnDefinition = "geometry")
|
||||
private Polygon geometry;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.gmss.fiscad.entities.infocad.parametre;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.gmss.fiscad.entities.BaseEntity;
|
||||
import io.gmss.fiscad.entities.decoupage.Arrondissement;
|
||||
import io.gmss.fiscad.entities.decoupage.Commune;
|
||||
import io.gmss.fiscad.entities.user.User;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -43,6 +44,8 @@ public class Structure extends BaseEntity implements Serializable {
|
||||
private String tel;
|
||||
private String email;
|
||||
private String adresse;
|
||||
@ManyToOne
|
||||
private Commune commune;
|
||||
//@JsonIgnore
|
||||
@ManyToMany
|
||||
@JoinTable(name = "arrondissements_structures",
|
||||
|
||||
@@ -10,8 +10,11 @@ import io.gmss.fiscad.interfaces.infocad.metier.ParcelleGeomService;
|
||||
import io.gmss.fiscad.paylaods.request.ParcelleGeomPayload;
|
||||
import io.gmss.fiscad.repositories.infocad.metier.ParcelleGeomRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.locationtech.jts.geom.Coordinate;
|
||||
import org.locationtech.jts.geom.GeometryFactory;
|
||||
import org.locationtech.jts.geom.Polygon;
|
||||
import org.locationtech.jts.io.ParseException;
|
||||
import org.locationtech.jts.io.WKTWriter;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -57,6 +60,10 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
JsonNode feature = features.next();
|
||||
createOnParcelleFromGeoJson(feature);
|
||||
}
|
||||
try {
|
||||
parcelleGeomRepository.majIdQuartier();
|
||||
}catch (Exception e){
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -66,40 +73,43 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
JsonNode propertiesNode = feature.get("properties");
|
||||
WKTReader wktReader = new WKTReader();
|
||||
if (geometryNode != null) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
ParcelleGeomPayload parcelleGeomPayload =new ParcelleGeomPayload();
|
||||
Polygon geometry = null;
|
||||
try {
|
||||
parcelleGeomPayload = objectMapper.readValue(propertiesNode.toString(), ParcelleGeomPayload.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Geometry geometry = null;
|
||||
try {
|
||||
String wkt = convertGeoJsonToWKT(geometryNode);
|
||||
geometry = wktReader.read(wkt);
|
||||
geometry = convertGeoJsonToPolygon(geometryNode.toString());
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
e.printStackTrace();
|
||||
//throw new RuntimeException(e);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
}
|
||||
ParcelleGeom parcelleGeom = new ParcelleGeom();
|
||||
parcelleGeom.setGeometry(geometry);
|
||||
parcelleGeom.setCommune(parcelleGeomPayload.getDepartement());
|
||||
parcelleGeom.setArrondissement(parcelleGeomPayload.getArrondissement());
|
||||
parcelleGeom.setVillageQuartier(parcelleGeomPayload.getVillageQuartier());
|
||||
parcelleGeom.setCodeBloc(parcelleGeomPayload.getCodeBloc());
|
||||
parcelleGeom.setCodeParcelle(parcelleGeomPayload.getCodeParcelle());
|
||||
parcelleGeom.setCodeEquipe(parcelleGeomPayload.getCodeEquipe());
|
||||
parcelleGeom.setSuperficie(parcelleGeomPayload.getSuperficie());
|
||||
parcelleGeom.setElNumeroEtatLieux(parcelleGeomPayload.getElNumeroEtatLieux());
|
||||
parcelleGeom.setElLot(parcelleGeomPayload.getElLot());
|
||||
parcelleGeom.setRfuQuartierOuZone(parcelleGeomPayload.getRfuQuartierOuZone());
|
||||
parcelleGeom.setElLettreParcelle(parcelleGeomPayload.getElLettreParcelle());
|
||||
parcelleGeom.setRfuIlot(parcelleGeomPayload.getRfuIlot());
|
||||
parcelleGeom.setRfuLettreParcelle(parcelleGeomPayload.getRfuLettreParcelle());
|
||||
parcelleGeom.setDateCollecte(parcelleGeomPayload.getDateCollecte());
|
||||
parcelleGeom.setNomLotissement(parcelleGeomPayload.getNomLotissement());
|
||||
parcelleGeom.setNomEtPrenoms(parcelleGeomPayload.getNomEtPrenoms());
|
||||
parcelleGeom.setSourceCollecte(parcelleGeomPayload.getSourceCollecte());
|
||||
parcelleGeom.setObservations(parcelleGeomPayload.getObservations());
|
||||
parcelleGeom.setDepartement(propertiesNode.get("DEPARTEMENT").textValue());
|
||||
parcelleGeom.setCommune(propertiesNode.get("COMMUNE").textValue());
|
||||
parcelleGeom.setArrondissement(propertiesNode.get("ARRONDISSEMENT").textValue());
|
||||
parcelleGeom.setVillageQuartier(propertiesNode.get("VILLAGE_QUARTIER").textValue());
|
||||
parcelleGeom.setCodeBloc(propertiesNode.get("CODE_BLOC").textValue());
|
||||
parcelleGeom.setCodeParcelle(propertiesNode.get("CODE_PARCELLE").textValue());
|
||||
parcelleGeom.setCodeEquipe(propertiesNode.get("CODE_EQUIPE").textValue());
|
||||
|
||||
|
||||
try {
|
||||
parcelleGeom.setSuperficie(Integer.parseInt(propertiesNode.get("SUPERFICIE").textValue()));
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
parcelleGeom.setElNumeroEtatLieux(propertiesNode.get("EL_NUMERO_ETAT_LIEUX").textValue());
|
||||
parcelleGeom.setElLot(propertiesNode.get("EL_LOT").textValue());
|
||||
parcelleGeom.setRfuQuartierOuZone(propertiesNode.get("RFU_QUARTIER_OU_ZONE").textValue());
|
||||
parcelleGeom.setElLettreParcelle(propertiesNode.get("EL_LETTRE_PARCELLE").textValue());
|
||||
parcelleGeom.setRfuIlot(propertiesNode.get("RFU_ILOT").textValue());
|
||||
parcelleGeom.setRfuLettreParcelle(propertiesNode.get("RFU_LETTRE_PARCELLE").textValue());
|
||||
parcelleGeom.setDateCollecte(propertiesNode.get("DATE_COLLECTE").textValue());
|
||||
parcelleGeom.setNomLotissement(propertiesNode.get("NOM_LOTISSEMENT").textValue());
|
||||
parcelleGeom.setNomEtPrenoms(propertiesNode.get("NOM_ET_PRENOMS").textValue());
|
||||
parcelleGeom.setSourceCollecte(propertiesNode.get("SOURCE_COLLECTE").textValue());
|
||||
parcelleGeom.setObservations(propertiesNode.get("OBSERVATIONS").textValue());
|
||||
return parcelleGeomRepository.save(parcelleGeom);
|
||||
}else {
|
||||
return null;
|
||||
@@ -118,37 +128,53 @@ public class ParcelleGeomServiceImpl implements ParcelleGeomService {
|
||||
|
||||
@Override
|
||||
public Page<ParcelleGeom> getParcelleGeomList(Pageable pageable) {
|
||||
return null;
|
||||
return parcelleGeomRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleGeom> getParcelleGeomList() {
|
||||
return null;
|
||||
return parcelleGeomRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParcelleGeom> getParcelleGeomListUnQuatier(String codeQuartier) {
|
||||
return parcelleGeomRepository.findAllByQuartier_Code(codeQuartier);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<ParcelleGeom> getParcelleGeomById(Long id) {
|
||||
return Optional.empty();
|
||||
return parcelleGeomRepository.findById(id);
|
||||
}
|
||||
|
||||
|
||||
private String convertGeoJsonToWKT(JsonNode geometryNode) {
|
||||
String type = geometryNode.get("type").asText();
|
||||
String coordinates = geometryNode.get("coordinates").toString();
|
||||
switch (type) {
|
||||
case "Point":
|
||||
return "POINT " + formatCoordinates(coordinates);
|
||||
case "LineString":
|
||||
return "LINESTRING " + formatCoordinates(coordinates);
|
||||
case "Polygon":
|
||||
return "POLYGON " + formatCoordinates(coordinates);
|
||||
default:
|
||||
throw new RuntimeException("Type géométrique non pris en charge : " + type);
|
||||
public Polygon convertGeoJsonToPolygon(String geoJson) throws Exception {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode rootNode = mapper.readTree(geoJson);
|
||||
|
||||
if (!rootNode.has("type") || !rootNode.has("coordinates")) {
|
||||
throw new IllegalArgumentException("GeoJSON invalide");
|
||||
}
|
||||
|
||||
String type = rootNode.get("type").asText();
|
||||
JsonNode coordinatesNode = rootNode.get("coordinates");
|
||||
|
||||
GeometryFactory geometryFactory = new GeometryFactory();
|
||||
|
||||
if ("Polygon".equals(type) || "geometry".equals(type)) {
|
||||
JsonNode firstRing = coordinatesNode.get(0);
|
||||
Coordinate[] coordinates = new Coordinate[firstRing.size()];
|
||||
for (int i = 0; i < firstRing.size(); i++) {
|
||||
JsonNode point = firstRing.get(i);
|
||||
double x = point.get(0).asDouble();
|
||||
double y = point.get(1).asDouble();
|
||||
coordinates[i] = new Coordinate(x, y);
|
||||
}
|
||||
return geometryFactory.createPolygon(coordinates);
|
||||
}
|
||||
throw new UnsupportedOperationException("Type GeoJSON non supporté: " + type);
|
||||
}
|
||||
|
||||
private String formatCoordinates(String jsonCoords) {
|
||||
return jsonCoords.replace("[", "(").replace("]", ")").replace(",", " ");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,5 +20,7 @@ public interface ParcelleGeomService {
|
||||
void deleteParcelle(Long id) throws NotFoundException;
|
||||
Page<ParcelleGeom> getParcelleGeomList(Pageable pageable);
|
||||
List<ParcelleGeom> getParcelleGeomList();
|
||||
List<ParcelleGeom> getParcelleGeomListUnQuatier(String codeQuartier);
|
||||
|
||||
Optional<ParcelleGeom> getParcelleGeomById(Long id);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ public interface ArrondissementEnqResponse {
|
||||
public String getCode();
|
||||
|
||||
public String getLibelle();
|
||||
public String getLongitude();
|
||||
public String getLatitude();
|
||||
|
||||
public Long getCommuneId();
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ public interface ArrondissementSyncResponse {
|
||||
public String getCode();
|
||||
|
||||
public String getNom();
|
||||
public String getLongitude();
|
||||
public String getLatitude();
|
||||
|
||||
public Long getCommuneId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ public interface CommuneEnqResponse {
|
||||
public String getCode();
|
||||
|
||||
public String getLibelle();
|
||||
public String getLongitude();
|
||||
public String getLatitude();
|
||||
|
||||
public Long getNombreEnquete();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,9 @@ public interface CommuneSyncResponse {
|
||||
public Long getId();
|
||||
|
||||
public String getCode();
|
||||
|
||||
public String getLongitude();
|
||||
public String getLatitude();
|
||||
public String getNom();
|
||||
|
||||
public Long getDepartementId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,25 +12,25 @@ import java.util.List;
|
||||
public interface ArrondissementRepository extends JpaRepository<Arrondissement, Long> {
|
||||
List<Arrondissement> findAllByCommune(Commune commune);
|
||||
|
||||
@Query(value = "select a.id,code, nom, a.commune_id as communeId from arrondissement a" +
|
||||
@Query(value = "select a.id,code, nom,longitude,latitude, a.commune_id as communeId from arrondissement a" +
|
||||
" inner join arrondissements_structures sa on sa.arrondissement_id=a.id" +
|
||||
" where a.deleted is false and sa.structure_id = ?1 ", nativeQuery = true)
|
||||
List<ArrondissementSyncResponse> getArrondissementResponse(Long structure_id);
|
||||
|
||||
@Query(value = "Select distinct T.id,T.code, T.libelle, T.communeId, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select a.id,a.code, a.nom as libelle, a.commune_id as communeId, e.id as enqueteId from arrondissement a" +
|
||||
@Query(value = "Select distinct T.id,T.code, T.libelle,T.longitude,T.latitude, T.communeId, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select a.id,a.code, a.nom as libelle,a.longitude,a.latitude, a.commune_id as communeId, e.id as enqueteId from arrondissement a" +
|
||||
" left join bloc b on b.arrondissement_id=a.id " +
|
||||
" left join enquete e on e.bloc_id=b.id )T " +
|
||||
" group by T.id,T.code, T.libelle, T.communeId ", nativeQuery = true)
|
||||
" group by T.id,T.code, T.libelle,T.longitude,T.latitude, T.communeId ", nativeQuery = true)
|
||||
List<ArrondissementEnqResponse> getAdminArrondissementEnqResponse();
|
||||
|
||||
|
||||
@Query(value = "Select T.id,T.code, T.libelle, T.communeId, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select distinct a.id,a.code, a.nom as libelle, a.commune_id as communeId, e.id as enqueteId from arrondissement a" +
|
||||
@Query(value = "Select T.id,T.code, T.libelle,T.longitude,T.latitude, T.communeId, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select distinct a.id,a.code, a.nom as libelle,a.longitude,a.latitude, a.commune_id as communeId, e.id as enqueteId from arrondissement a" +
|
||||
" inner join arrondissements_structures sa on sa.arrondissement_id=a.id " +
|
||||
" left join bloc b on b.arrondissement_id=a.id " +
|
||||
" left join enquete e on e.bloc_id=b.id" +
|
||||
" where sa.structure_id = ?1 )T " +
|
||||
" group by T.id,T.code, T.libelle, T.communeId ", nativeQuery = true)
|
||||
" group by T.id,T.code, T.libelle,T.longitude,T.latitude, T.communeId ", nativeQuery = true)
|
||||
List<ArrondissementEnqResponse> getArrondissementEnqResponse(Long structure_id);
|
||||
}
|
||||
|
||||
@@ -11,28 +11,28 @@ import java.util.List;
|
||||
|
||||
public interface CommuneRepository extends JpaRepository<Commune, Long> {
|
||||
|
||||
@Query(value = "select id, code, nom, departement_id as departementid from commune ", nativeQuery = true)
|
||||
@Query(value = "select id, code, nom,longitude,latitude, departement_id as departementid from commune ", nativeQuery = true)
|
||||
List<CommuneSyncResponse> getCommuneResponse();
|
||||
|
||||
List<Commune> findAllByDepartement(Departement departement);
|
||||
|
||||
@Query(value = " Select T.id,T.code, T.libelle, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select distinct c.id as id,c.code as code, c.nom as libelle, e.id as enqueteId from arrondissement a" +
|
||||
@Query(value = " Select T.id,T.code, T.libelle,T.longitude,T.latitude, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select distinct c.id as id,c.code as code, c.nom as libelle,c.longitude,c.latitude, e.id as enqueteId from arrondissement a" +
|
||||
" inner join arrondissements_structures sa on sa.arrondissement_id=a.id " +
|
||||
" inner join commune c on c.id= a.commune_id " +
|
||||
" left join bloc b on b.arrondissement_id=a.id " +
|
||||
" left join enquete e on e.bloc_id=b.id " +
|
||||
" where sa.structure_id = ?1 )T" +
|
||||
" group by T.id,T.code, T.libelle", nativeQuery = true)
|
||||
" group by T.id,T.code, T.libelle,T.longitude,T.latitude", nativeQuery = true)
|
||||
List<CommuneEnqResponse> getCommuneEnqResponse(Long structure_id);
|
||||
|
||||
@Query(value = " Select T.id,T.code, T.libelle, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select distinct c.id as id,c.code as code, c.nom as libelle, e.id as enqueteId from arrondissement a" +
|
||||
@Query(value = " Select T.id,T.code, T.libelle,T.longitude,T.latitude, sum(case when T.enqueteId is null then 0 else 1 end) as nombreEnquete " +
|
||||
" From (select distinct c.id as id,c.code as code,c.longitude,c.latitude, c.nom as libelle, e.id as enqueteId from arrondissement a" +
|
||||
" left join arrondissements_structures sa on sa.arrondissement_id=a.id " +
|
||||
" left join commune c on c.id= a.commune_id " +
|
||||
" left join bloc b on b.arrondissement_id=a.id " +
|
||||
" left join enquete e on e.bloc_id=b.id)T " +
|
||||
" group by T.id,T.code, T.libelle", nativeQuery = true)
|
||||
" group by T.id,T.code, T.libelle,T.longitude,T.latitude", nativeQuery = true)
|
||||
List<CommuneEnqResponse> getAdminCommuneEnqResponse();
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface QuartierRepository extends JpaRepository<Quartier, Long> {
|
||||
List<Quartier> getAllByArrondissement(Arrondissement arrondissement);
|
||||
@@ -23,5 +24,5 @@ public interface QuartierRepository extends JpaRepository<Quartier, Long> {
|
||||
" where q.deleted is false ", nativeQuery = true)
|
||||
List<QuartierSyncResponse> getAdminQuartierResponse();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,16 @@ import java.util.Optional;
|
||||
|
||||
public interface ParcelleGeomRepository extends JpaRepository<ParcelleGeom, Long> {
|
||||
|
||||
List<ParcelleGeom> findAllByQuartier_Code(String code);
|
||||
|
||||
@Query(value = "update parcelle_geom " +
|
||||
"set quartier_id=T.quartier_id " +
|
||||
"from " +
|
||||
"(select quartier.id as quartier_id,upper(quartier.nom) as nom_quartier,c.nom as nom_commune " +
|
||||
"from quartier inner join public.arrondissement a on a.id = quartier.arrondissement_id " +
|
||||
"inner join public.commune c on c.id = a.commune_id)T " +
|
||||
"where parcelle_geom.village_quartier=T.nom_quartier " +
|
||||
"and upper(parcelle_geom.commune)=upper(T.nom_commune) ",nativeQuery = true)
|
||||
void majIdQuartier();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user