maj secteur bloc et ajour parcelle_geom

avec colonne geometrique
This commit is contained in:
2025-03-13 18:36:04 +01:00
parent 1ada7fc78e
commit 4dd0d86fb0
13 changed files with 418 additions and 47 deletions

28
pom.xml
View File

@@ -97,35 +97,31 @@
<version>2.3.0</version> <version>2.3.0</version>
</dependency> </dependency>
<!--Dépendance géométry
<dependency>
<dependency>
<groupId>org.locationtech.jts</groupId> <groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId> <artifactId>jts-core</artifactId>
<version>1.16.1</version> <version>1.19.0</version>
</dependency> </dependency>
<dependency>
<dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId> <artifactId>hibernate-spatial</artifactId>
<version>${hibernate.version}</version> <version>${hibernate.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.n52.jackson</groupId> <groupId>org.n52.jackson</groupId>
<artifactId>jackson-datatype-jts</artifactId> <artifactId>jackson-datatype-jts</artifactId>
<version>1.2.4</version> <version>1.2.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.teiid</groupId> <groupId>org.teiid</groupId>
<artifactId>teiid-optional-geo</artifactId> <artifactId>teiid-optional-geo</artifactId>
<version>16.0.0</version> <version>16.0.0</version>
</dependency> </dependency>
dependance geometry-->
</dependencies> </dependencies>

View File

@@ -105,4 +105,13 @@ public class SecteurController {
} }
@GetMapping("/by-structure-id/{structureId}")
public ResponseEntity<?> getSecteurByStructureId(@PathVariable Long structureId) {
return new ResponseEntity<>(
new ApiResponse<>(true, secteurService.getSecteurById(structureId), "Secteur trouvée avec succès."),
HttpStatus.OK
);
}
} }

View File

@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
@RestController @RestController
@RequestMapping(value = "api/bloc", produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "api/bloc", produces = MediaType.APPLICATION_JSON_VALUE)
@SecurityRequirement(name = "bearer") //@SecurityRequirement(name = "bearer")
@Tag(name = "Bloc") @Tag(name = "Bloc")
@CrossOrigin(origins = "*") @CrossOrigin(origins = "*")
public class BlocController { public class BlocController {
@@ -104,6 +104,15 @@ public class BlocController {
); );
} }
@GetMapping("/list-by-secteur")
@Tag(name = "Liste blocs",description = "Liste des blocs d'un secteur")
public ResponseEntity<?> getAllBlocListBySecteur(@RequestParam Long idSecteur) {
return new ResponseEntity<>(
new ApiResponse<>(true, blocService.getBlocsBySecteur(idSecteur), "Liste des blocs chargée avec succès."),
HttpStatus.OK
);
}
@GetMapping("/all-paged") @GetMapping("/all-paged")
public ResponseEntity<?> getAllBlocPaged(@RequestParam int pageNo, @RequestParam int pageSize) { public ResponseEntity<?> getAllBlocPaged(@RequestParam int pageNo, @RequestParam int pageSize) {
Pageable pageable = PageRequest.of(pageNo, pageSize); Pageable pageable = PageRequest.of(pageNo, pageSize);

View File

@@ -0,0 +1,65 @@
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;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.ColumnDefault;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Point;
import org.n52.jackson.datatype.jts.GeometryDeserializer;
import org.n52.jackson.datatype.jts.GeometrySerializer;
import java.io.Serializable;
import java.util.List;
@EqualsAndHashCode(callSuper = true)
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@SQLDelete(sql =
"UPDATE parcelle " +
"SET deleted = true " +
"WHERE id = ?")
@Where(clause = " deleted = false")
public class ParcelleGeom extends BaseEntity implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String q;
private String ilot;
private String zone;
private String p;
@Column(unique = true,nullable = true)
private String nup;
@Column(unique = true,nullable = true)
private String nupProvisoire;
private String longitude;
private String latitude;
private String pointsPolygone;
@ColumnDefault("0")
private int geomSrid;
@JsonSerialize(using = GeometrySerializer.class)
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
@Column(name = "geom",columnDefinition = "geometry(MultiPolygon,4326)")
private MultiPolygon geometry ;
@JsonSerialize(using = GeometrySerializer.class)
@JsonDeserialize(contentUsing = GeometryDeserializer.class)
@Column(name = "geom_32631",columnDefinition = "geometry(MultiPolygon,32631)")
private MultiPolygon geometry32631 ;
}

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import io.gmss.fiscad.entities.BaseEntity; import io.gmss.fiscad.entities.BaseEntity;
import io.gmss.fiscad.entities.decoupage.Arrondissement; import io.gmss.fiscad.entities.decoupage.Arrondissement;
import io.gmss.fiscad.entities.decoupage.Quartier; import io.gmss.fiscad.entities.decoupage.Quartier;
import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage; import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
import io.gmss.fiscad.entities.infocad.metier.Enquete; import io.gmss.fiscad.entities.infocad.metier.Enquete;
import jakarta.persistence.*; import jakarta.persistence.*;
@@ -62,9 +63,14 @@ public class Bloc extends BaseEntity implements Serializable {
@JsonIgnore @JsonIgnore
@OneToMany(mappedBy = "bloc") @OneToMany(mappedBy = "bloc")
private List<Enquete> enquetes; private List<Enquete> enquetes;
@ManyToOne @ManyToOne
private SecteurDecoupage secteurDecoupage; private SecteurDecoupage secteurDecoupage;
@JsonIgnore
@ManyToOne
private Secteur secteur;
public String getNomArrondissement() { public String getNomArrondissement() {
return arrondissement.getNom(); return arrondissement.getNom();
} }

View File

@@ -2,6 +2,7 @@ package io.gmss.fiscad.implementations.decoupage;
import io.gmss.fiscad.entities.decoupage.Secteur; import io.gmss.fiscad.entities.decoupage.Secteur;
import io.gmss.fiscad.entities.decoupage.SecteurDecoupage; import io.gmss.fiscad.entities.decoupage.SecteurDecoupage;
import io.gmss.fiscad.entities.infocad.parametre.Structure;
import io.gmss.fiscad.entities.user.User; import io.gmss.fiscad.entities.user.User;
import io.gmss.fiscad.exceptions.BadRequestException; import io.gmss.fiscad.exceptions.BadRequestException;
import io.gmss.fiscad.exceptions.NotFoundException; import io.gmss.fiscad.exceptions.NotFoundException;
@@ -11,6 +12,7 @@ import io.gmss.fiscad.paylaods.request.SecteurPayload;
import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository; import io.gmss.fiscad.repositories.decoupage.ArrondissementRepository;
import io.gmss.fiscad.repositories.decoupage.QuartierRepository; import io.gmss.fiscad.repositories.decoupage.QuartierRepository;
import io.gmss.fiscad.repositories.decoupage.SecteurRepository; import io.gmss.fiscad.repositories.decoupage.SecteurRepository;
import io.gmss.fiscad.repositories.infocad.parametre.StructureRepository;
import io.gmss.fiscad.repositories.user.UserRepository; import io.gmss.fiscad.repositories.user.UserRepository;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@@ -26,12 +28,14 @@ public class SecteurServiceImpl implements SecteurService {
private final UserRepository userRepository; private final UserRepository userRepository;
private final ArrondissementRepository arrondissementRepository; private final ArrondissementRepository arrondissementRepository;
private final QuartierRepository quartierRepository; private final QuartierRepository quartierRepository;
private final StructureRepository structureRepository;
public SecteurServiceImpl(SecteurRepository secteurRepository, UserRepository userRepository, ArrondissementRepository arrondissementRepository, QuartierRepository quartierRepository) { public SecteurServiceImpl(SecteurRepository secteurRepository, UserRepository userRepository, ArrondissementRepository arrondissementRepository, QuartierRepository quartierRepository, StructureRepository structureRepository) {
this.secteurRepository = secteurRepository; this.secteurRepository = secteurRepository;
this.userRepository = userRepository; this.userRepository = userRepository;
this.arrondissementRepository = arrondissementRepository; this.arrondissementRepository = arrondissementRepository;
this.quartierRepository = quartierRepository; this.quartierRepository = quartierRepository;
this.structureRepository = structureRepository;
} }
@@ -53,6 +57,8 @@ public class SecteurServiceImpl implements SecteurService {
Secteur secteur=new Secteur(); Secteur secteur=new Secteur();
Optional<User> optionalUser=userRepository.findById(secteurPayload.getChefSecteurId()); Optional<User> optionalUser=userRepository.findById(secteurPayload.getChefSecteurId());
secteur.setChefSecteur(optionalUser.orElse(null)); secteur.setChefSecteur(optionalUser.orElse(null));
Optional<Structure> optionalStructure=structureRepository.findById(secteurPayload.getStructureId());
secteur.setStructure(optionalStructure.orElse(null));
List<SecteurDecoupage> secteurDecoupageList=new ArrayList<>(); List<SecteurDecoupage> secteurDecoupageList=new ArrayList<>();
for (SecteurDecoupagePayload sdp: secteurPayload.getSecteurDecoupages()){ for (SecteurDecoupagePayload sdp: secteurPayload.getSecteurDecoupages()){
@@ -117,6 +123,10 @@ public class SecteurServiceImpl implements SecteurService {
return secteurRepository.findAll(); return secteurRepository.findAll();
} }
@Override
public List<Secteur> getSecteurListUneStruture(Long structureId) {
return secteurRepository.findAllByStructure_Id(structureId);
}
@Override @Override

View File

@@ -40,6 +40,7 @@ public class BlocServiceImpl implements BlocService {
} }
String idBlocParArrondissement = getIdBlocParArrondissementValue(bloc); String idBlocParArrondissement = getIdBlocParArrondissementValue(bloc);
bloc.setIdBlocParArrondissement(idBlocParArrondissement); bloc.setIdBlocParArrondissement(idBlocParArrondissement);
if(bloc.getStructure() == null){ if(bloc.getStructure() == null){
bloc.setCote(getCoteValue(bloc, idBlocParArrondissement, null)); bloc.setCote(getCoteValue(bloc, idBlocParArrondissement, null));
}else{ }else{
@@ -49,7 +50,9 @@ public class BlocServiceImpl implements BlocService {
if(bloc.getQuartier() != null){ if(bloc.getQuartier() != null){
bloc.setCoteq(getCoteQuartierByCoteBloc(bloc.getCote(), bloc.getQuartier())); bloc.setCoteq(getCoteQuartierByCoteBloc(bloc.getCote(), bloc.getQuartier()));
} }
if(bloc.getSecteurDecoupage()!=null) {
bloc.setSecteur(bloc.getSecteurDecoupage().getSecteur());
}
return blocRepository.save(bloc); return blocRepository.save(bloc);
} }
@@ -130,6 +133,11 @@ public class BlocServiceImpl implements BlocService {
} }
} }
@Override
public List<Bloc> getBlocsBySecteur(Long idSecteur) {
return blocRepository.findAllBySecteur_Id(idSecteur);
}
@Override @Override
public List<Bloc> getBlocList() { public List<Bloc> getBlocList() {
return blocRepository.findAll(); return blocRepository.findAll();

View File

@@ -17,6 +17,7 @@ public interface SecteurService {
void deleteSecteur(Long id) throws NotFoundException; void deleteSecteur(Long id) throws NotFoundException;
Page<Secteur> getSecteurList(Pageable pageable); Page<Secteur> getSecteurList(Pageable pageable);
List<Secteur> getSecteurList(); List<Secteur> getSecteurList();
List<Secteur> getSecteurListUneStruture(Long structureId);
Optional<Secteur> getSecteurById(Long id); Optional<Secteur> getSecteurById(Long id);
} }

View File

@@ -17,6 +17,7 @@ public interface BlocService {
Page<Bloc> getBlocList(Pageable pageable); Page<Bloc> getBlocList(Pageable pageable);
List<Bloc> getBlocsByArrondissement(Long idArrondissement); List<Bloc> getBlocsByArrondissement(Long idArrondissement);
List<Bloc> getBlocsByStructure(Long idStructure); List<Bloc> getBlocsByStructure(Long idStructure);
List<Bloc> getBlocsBySecteur(Long idSecteur);
List<Bloc> getBlocList(); List<Bloc> getBlocList();
Optional<Bloc> getBlocById(Long id); Optional<Bloc> getBlocById(Long id);

View File

@@ -15,6 +15,6 @@ public class SecteurPayload implements Serializable {
private String code ; private String code ;
private String nom ; private String nom ;
private Long chefSecteurId ; private Long chefSecteurId ;
private Long structure_id ; private Long structureId ;
private List<SecteurDecoupagePayload> secteurDecoupages ; private List<SecteurDecoupagePayload> secteurDecoupages ;
} }

View File

@@ -3,5 +3,8 @@ package io.gmss.fiscad.repositories.decoupage;
import io.gmss.fiscad.entities.decoupage.Secteur; import io.gmss.fiscad.entities.decoupage.Secteur;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface SecteurRepository extends JpaRepository<Secteur, Long> { public interface SecteurRepository extends JpaRepository<Secteur, Long> {
List<Secteur> findAllByStructure_Id(Long structureId);
} }

View File

@@ -13,6 +13,7 @@ import java.util.List;
public interface BlocRepository extends JpaRepository<Bloc, Long> { public interface BlocRepository extends JpaRepository<Bloc, Long> {
List<Bloc> findAllByStructure_Id(Long structureId); List<Bloc> findAllByStructure_Id(Long structureId);
List<Bloc> findAllBySecteur_Id(Long secteurId);
@Query(value = "select b.id, b.cote, b.nom, b.arrondissement_id as arrondissementid, b.quartier_id as quartierid " + @Query(value = "select b.id, b.cote, b.nom, b.arrondissement_id as arrondissementid, b.quartier_id as quartierid " +
" from bloc b" + " from bloc b" +
" where b.deleted is false and b.structure_id = ?1 ",nativeQuery = true) " where b.deleted is false and b.structure_id = ?1 ",nativeQuery = true)

View File

@@ -1,24 +1,286 @@
package io.gmss.fiscad.service; package io.gmss.fiscad.service;
import org.springframework.beans.factory.annotation.Value;
//import org.locationtech.jts.geom.GeometryFactory;
//import org.locationtech.jts.geom.Point;
//import org.locationtech.jts.geom.PrecisionModel;
//import org.locationtech.jts.io.ParseException;
//import org.locationtech.jts.io.WKTReader;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.locationtech.jts.geom.*;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.teiid.CommandContext;
import org.teiid.api.exception.query.FunctionExecutionException;
import org.teiid.core.types.GeometryType;
import org.teiid.geo.GeometryTransformUtils;
import org.teiid.query.function.GeometryUtils;
import java.sql.SQLException;
import java.util.List;
import static org.teiid.geo.GeometryTransformUtils.lookupProj4Text;
//
@Service @Service
public class GeometryService { public class GeometryService {
// public Point toGeometryPoint(String wkt, int srid) throws SQLException { @Value("${infocad.geom.srid}")
// if(wkt == null) { private String defaultSrid;
// @Autowired
// private ParcelleService parcelleService;
// @Autowired
// private ParcelleGeomRepository parcelleGeomRepository;
// @Autowired
// private ParcelleRepository parcelleRepository;
// @Autowired
// private AppartenirRepository appartenirRepository;
//
//
//
//
//// public Geometry transform(Geometry source) {
//// try {
//// MathTransform crsTransform = GeotoolsDataStoreUtils.makeCrsTransform("EPSG:27700");
//// if (crsTransform.isTransforming()) {
//// Geometry transformableArea = crsTransform.getTransformableGeometry();
//// if (null != transformableArea && !transformableArea.covers(source)) {
//// source = source.intersection(transformableArea);
//// }
//// return JTS.transform(source, crsTransform);
//// } else {
//// return source;
//// }
//// } catch (Exception e) { // NOSONAR typically TopologyException, TransformException or FactoryException
//// logEnvelopeSuggestCrsTransformInfo(crsTransform.getId(), source, e);
//// return createEmptyGeometryForClass(source.getClass());
//// }
//// }
//
//// public Geometry getShape(String wtk) throws FactoryException, TransformException {
//// GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), Subject.SRID);
//// WKTReader reader = new WKTReader(geometryFactory);
//// MathTransform crsTransform = GeotoolsDataStoreUtils.makeCrsTransform("EPSG:27700");
////
//// try {
//// LineString line = (LineString) reader.read(wtk);
//// Geometry transformedGeom = JTS.transform(line, crsTransform);
//// return transformedGeom;
//// } catch (ParseException e) {
//// e.printStackTrace();
//// // log.error("Not a valid geometry");
//// return null;
//// }
//// }
//
public MultiPolygon toGeometry(String wkt, int srid) throws SQLException {
if(wkt == null) {
return null;
}
try {
WKTReader wktReaderSRID = new WKTReader(new GeometryFactory(new PrecisionModel(),srid));
MultiPolygon multiPolygon = (MultiPolygon) wktReaderSRID.read(String.format("MULTIPOLYGON( ((%s)) )",wkt));
// GeometryTransformUtils.transform(multiPolygon,srid);
return multiPolygon;
} catch (ParseException ex) {
throw new SQLException(ex);
}
}
//
// public void saveParcelleGeom(Parcelle parcelle){
// try {
// MultiPolygon multiPolygon=null;
// if (parcelle.getCoordonnees() != null){
// multiPolygon = toGeometry(parcelle.getCoordonnees(), parcelle.getGeomSrid());//Integer.parseInt(defaultSrid));
// }
//
// RechercheParcellePayLoad rechercheParcellePayLoad=new RechercheParcellePayLoad();
// rechercheParcellePayLoad.setEp(parcelle.getEntrePorte());
// rechercheParcellePayLoad.setI(parcelle.getCodeIlotParcellaire());
// rechercheParcellePayLoad.setNumTF(parcelle.getNumTitreFonc());
// rechercheParcellePayLoad.setP(parcelle.getCodeAdressageParcellaire());
// rechercheParcellePayLoad.setQz(parcelle.getCodeQuartierZoneParcellaire());
// rechercheParcellePayLoad.setR(parcelle.getRue().getNumero());
// rechercheParcellePayLoad.setNup(parcelle.getNup());
// ParcelleGeom parcelleGeom=rechercheParcelleGeom(rechercheParcellePayLoad);
// parcelleGeom.setParcelle(parcelle);
// if(parcelleGeom.getId()!=null){
// if (parcelle.getCoordonnees() != null) {
// parcelleGeom.setGeometry(multiPolygon);
// }
// }else{
// if (parcelle.getCoordonnees() != null) {
// parcelleGeom.setCodeQuartierZoneParcellaire(parcelle.getCodeQuartierZoneParcellaire());
// parcelleGeom.setCodeAdressageParcellaire(parcelle.getCodeAdressageParcellaire());
// parcelleGeom.setCodeIlotParcellaire(parcelle.getCodeIlotParcellaire());
// parcelleGeom.setEntrePorte(parcelle.getEntrePorte());
// parcelleGeom.setNumTitre(parcelle.getNumTitreFonc());
// parcelleGeom.setNup(parcelle.getNup());
// parcelleGeom.setGeometry(multiPolygon);
// if(parcelle.getRue()!=null)
// parcelleGeom.setNumRue(parcelle.getRue().getNumero());
// parcelleGeom.setVillageQuartier(parcelle.getVillageQuartier());
// if(parcelle.getVillageQuartier()!=null)
// parcelleGeom.setCommune(parcelle.getVillageQuartier().getArrondissement().getCommune());
// //TODO
// //parcelleGeom.setLattitudeGeoCentrique(multiPolygon);
// //parcelleGeom.setLongitudeGeoCentrique(multiPolygon);
// }
// }
// ///////////MAJ PROPRIETAIRE COURANT//////////////////
// try {
// majProprietaireCourant(parcelle);
// }catch (Exception e){
//
// }
// ///////////////////////////////////////////////////////
//
// parcelleGeomRepository.save(parcelleGeom);
// } catch (SQLException e) {
// e.printStackTrace();
// }
// }
//
// public ParcelleGeom saveParcelleGeom(ParcelleGeomPayload parcelleGeomPayload){
// try {
// MultiPolygon multiPolygon=toGeometry(parcelleGeomPayload.getCoordonnees(),parcelleGeomPayload.getSrid());//Integer.parseInt(defaultSrid));
//
// RechercheParcellePayLoad rechercheParcellePayLoad=new RechercheParcellePayLoad();
// rechercheParcellePayLoad.setEp(parcelleGeomPayload.getEntrePorte());
// rechercheParcellePayLoad.setI(parcelleGeomPayload.getCodeIlotParcellaire());
// rechercheParcellePayLoad.setNumTF(parcelleGeomPayload.getNumTitre());
// rechercheParcellePayLoad.setP(parcelleGeomPayload.getCodeAdressageParcellaire());
// rechercheParcellePayLoad.setQz(parcelleGeomPayload.getCodeQuartierZoneParcellaire());
// rechercheParcellePayLoad.setR(parcelleGeomPayload.getNumRue());
// rechercheParcellePayLoad.setNup(parcelleGeomPayload.getNup());
//
// ParcelleGeom parcelleGeom=rechercheParcelleGeom(rechercheParcellePayLoad);
//
// if(parcelleGeom.getId()!=null){
// parcelleGeom.setGeometry(multiPolygon);
// }else{
// parcelleGeom.setCodeQuartierZoneParcellaire(parcelleGeomPayload.getCodeQuartierZoneParcellaire());
// parcelleGeom.setCodeAdressageParcellaire(parcelleGeomPayload.getCodeAdressageParcellaire());
// parcelleGeom.setCodeIlotParcellaire(parcelleGeomPayload.getCodeIlotParcellaire());
// parcelleGeom.setEntrePorte(parcelleGeomPayload.getEntrePorte());
// parcelleGeom.setNup(parcelleGeomPayload.getNup());
// parcelleGeom.setNumTitre(parcelleGeomPayload.getNumTitre());
// parcelleGeom.setNumRue(parcelleGeomPayload.getNumRue());
// parcelleGeom.setArrondissement_nom(parcelleGeomPayload.getArrondissement_nom());
// parcelleGeom.setGeometry(multiPolygon);
//// if(parcelleGeomPayload.getRue()!=null)
//// parcelleGeom.setNumRue(parcelleGeomPayload.getRue().getNumero());
//// parcelleGeom.setVillageQuartier(parcelleGeomPayload.getVillageQuartier());
//// if(parcelleGeomPayload.getVillageQuartier()!=null)
//// parcelleGeom.setCommune(parcelleGeomPayload.getVillageQuartier().getArrondissement().getCommune());
//
// //TODO
// //parcelleGeom.setLattitudeGeoCentrique(multiPolygon);
// //parcelleGeom.setLongitudeGeoCentrique(multiPolygon);
// }
// System.out.println("COORDONNEES : "+multiPolygon.getCoordinates().toString());
// System.out.println("COORDONNEES : "+multiPolygon.toText());
//
// return parcelleGeomRepository.save(parcelleGeom);
//// parcelleGeomRepository.save(parcelleGeom);
// } catch (SQLException e) {
// e.printStackTrace();
// return null; // return null;
// } // }
// }
//
// public ParcelleGeom rechercheParcelleGeom(RechercheParcellePayLoad rechercheParcellePayLoad){
// ParcelleGeom parcelleGeom=new ParcelleGeom();
// if(rechercheParcellePayLoad.getQz()!=null && rechercheParcellePayLoad.getI()!=null && rechercheParcellePayLoad.getP()!=null){
// List<ParcelleGeom> parcelleGeoms= parcelleGeomRepository.findFirstByCodeQuartierZoneParcellaireAndCodeIlotParcellaireAndCodeAdressageParcellaire(rechercheParcellePayLoad.getQz(),rechercheParcellePayLoad.getI(),rechercheParcellePayLoad.getP());
// if(!parcelleGeoms.isEmpty()){
// parcelleGeom= parcelleGeoms.get(0);
// }
// }
//
// if(rechercheParcellePayLoad.getEp()!=null && rechercheParcellePayLoad.getR()!=null){
// List<ParcelleGeom> parcelleGeoms= parcelleGeomRepository.findFirstByNumRueAndEntrePorte(rechercheParcellePayLoad.getEp(),rechercheParcellePayLoad.getR());
// if(!parcelleGeoms.isEmpty()){
// parcelleGeom= parcelleGeoms.get(0);
// }
// }
//
// if(rechercheParcellePayLoad.getNup()!=null){
// List<ParcelleGeom> parcelleGeoms= parcelleGeomRepository.findFirstByNup(rechercheParcellePayLoad.getNup());
// if(!parcelleGeoms.isEmpty()){
// parcelleGeom= parcelleGeoms.get(0);
// }
// }
// return parcelleGeom;
// }
//
//
// public ParcelleGeom rechercheParcelleGeomParParcelle(Parcelle parcelle){
// ParcelleGeom parcelleGeom=new ParcelleGeom();
// RechercheParcellePayLoad rechercheParcellePayLoad=new RechercheParcellePayLoad();
// rechercheParcellePayLoad.setEp(parcelle.getEntrePorte());
// rechercheParcellePayLoad.setI(parcelle.getCodeIlotParcellaire());
// rechercheParcellePayLoad.setNumTF(parcelle.getNumTitreFonc());
// rechercheParcellePayLoad.setP(parcelle.getCodeAdressageParcellaire());
// rechercheParcellePayLoad.setQz(parcelle.getCodeQuartierZoneParcellaire());
// rechercheParcellePayLoad.setR(parcelle.getRue().getNumero());
// rechercheParcellePayLoad.setNup(parcelle.getNup());
//
// if(rechercheParcellePayLoad.getQz()!=null && rechercheParcellePayLoad.getI()!=null && rechercheParcellePayLoad.getP()!=null){
// List<ParcelleGeom> parcelleGeoms= parcelleGeomRepository.findFirstByCodeQuartierZoneParcellaireAndCodeIlotParcellaireAndCodeAdressageParcellaire(rechercheParcellePayLoad.getQz(),rechercheParcellePayLoad.getI(),rechercheParcellePayLoad.getP());
// if(!parcelleGeoms.isEmpty()){
// parcelleGeom= parcelleGeoms.get(0);
// }
// }
//
// if(rechercheParcellePayLoad.getEp()!=null && rechercheParcellePayLoad.getR()!=null){
// List<ParcelleGeom> parcelleGeoms= parcelleGeomRepository.findFirstByNumRueAndEntrePorte(rechercheParcellePayLoad.getEp(),rechercheParcellePayLoad.getR());
// if(!parcelleGeoms.isEmpty()){
// parcelleGeom= parcelleGeoms.get(0);
// }
// }
//
// if(rechercheParcellePayLoad.getNup()!=null){
// List<ParcelleGeom> parcelleGeoms= parcelleGeomRepository.findFirstByNup(rechercheParcellePayLoad.getNup());
// if(!parcelleGeoms.isEmpty()){
// parcelleGeom= parcelleGeoms.get(0);
// }
// }
// return parcelleGeom;
// }
//
// public void majProprietaireCourant(Parcelle parcelle){
// ///////////MAJ PROPRIETAIRE COURANT//////////////////
// try { // try {
// WKTReader wktReaderSRID = new WKTReader(new GeometryFactory(new PrecisionModel(),srid)); // Appartenir proprietaireCourant=appartenirRepository.getProprietaireCourant(parcelle.getId());
// Point point = (Point) wktReaderSRID.read(String.format("POINT( ((%s)) )",wkt)); // if(proprietaireCourant!=null){
// return point; // parcelle.setProprietaireCourant(proprietaireCourant.getContribuable());
// } catch (ParseException ex) { // parcelleRepository.save(parcelle);
// throw new SQLException(ex); // ParcelleGeom parcelleGeom=rechercheParcelleGeomParParcelle(proprietaireCourant.getParcelle());
// if(parcelleGeom!=null){
// parcelleGeom.setProprietaireCourant(proprietaireCourant.getContribuable());
// parcelleGeomRepository.save(parcelleGeom);
// } // }
// } // }
// }catch (Exception e){
//
// }
// ///////////////////////////////////////////////////////
// }
//
//// public String listCoordonneesToPolygonString(List<Coordonnees> coordonnees){
//// StringBuilder wkt= new StringBuilder();
//// if(coordonnees==null){
//// return null;
//// }
//// wkt.append(coordonnees.get(0).getXY());
//// coordonnees.forEach(coordonnees1 -> {
//// wkt.append(",").append(coordonnees.get(0).getXY());
//// });
//// return String.format("MULTIPOLYGON( ((%s)) )",wkt.toString());
//// }
//
//
//
//
//
} }