-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify getFic to keep respond to this service when onglet = 1 Do not concat adress for this service. Add deprecated logs for this service.
- Loading branch information
1 parent
6ac1c1b
commit 3676845
Showing
6 changed files
with
85 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
cadastrapp/src/main/java/org/georchestra/cadastrapp/helper/ProprietaireHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.georchestra.cadastrapp.helper; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import javax.ws.rs.core.HttpHeaders; | ||
|
||
import org.georchestra.cadastrapp.service.CadController; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public final class ProprietaireHelper extends CadController { | ||
|
||
static final Logger logger = LoggerFactory.getLogger(ProprietaireHelper.class); | ||
|
||
/** | ||
* | ||
* @param parcelle | ||
* @return | ||
*/ | ||
public List<Map<String, Object>> getProprietairesByParcelles(HttpHeaders headers, List<String> parcelleList, boolean isAddressConcat) { | ||
|
||
// Init list to return response even if nothing in it. | ||
List<Map<String,Object>> proprietaires = new ArrayList<Map<String,Object>>(); | ||
|
||
// User need to be at least CNIL1 level | ||
if (getUserCNILLevel(headers)>0){ | ||
|
||
if(parcelleList != null && !parcelleList.isEmpty()){ | ||
|
||
StringBuilder queryBuilder = new StringBuilder(); | ||
queryBuilder.append("select distinct prop.dnulp, proparc.parcelle, prop.comptecommunal, prop.app_nom_usage, prop.app_nom_naissance, prop.dldnss, prop.jdatnss, prop.ccodro_lib , prop.ccodro, prop.dformjur, "); | ||
if(isAddressConcat){ | ||
queryBuilder.append(" COALESCE(prop.dlign3, '')||' '||COALESCE(prop.dlign4,'')||' '||COALESCE(prop.dlign5,'')||' '||COALESCE(prop.dlign6,'') as adresse "); | ||
|
||
}else{ | ||
queryBuilder.append(" prop.dlign3, prop.dlign4, prop.dlign5, prop.dlign6 "); | ||
} | ||
queryBuilder.append(" from "); | ||
queryBuilder.append(databaseSchema); | ||
queryBuilder.append(".proprietaire prop, "); | ||
queryBuilder.append(databaseSchema); | ||
queryBuilder.append(".proprietaire_parcelle proparc "); | ||
queryBuilder.append(createWhereInQuery(parcelleList.size(), "proparc.parcelle")); | ||
queryBuilder.append(" and prop.comptecommunal = proparc.comptecommunal"); | ||
queryBuilder.append(addAuthorizationFiltering(headers, "prop.")); | ||
queryBuilder.append(" ORDER BY prop.dnulp, prop.app_nom_usage "); | ||
|
||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); | ||
proprietaires = jdbcTemplate.queryForList(queryBuilder.toString(), parcelleList.toArray()); | ||
|
||
} | ||
else{ | ||
//log empty request | ||
logger.info(EMPTY_REQUEST_LOG); | ||
} | ||
}else{ | ||
logger.info(ACCES_ERROR_LOG); | ||
} | ||
return proprietaires; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters