From 1352e6d1b084aefe002ad272c54dcc55d554c7c9 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 21 Sep 2017 10:55:31 +0200 Subject: [PATCH 01/17] fix typo --- script/arcopole/views/arcopoleHabitationDetails.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index d5e4f0e3..ed4f4ac8 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -7,7 +7,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select id_pev as pev,invar, - substr(codlot,1,4) as annee,dnudes, + substr(codlot,1,4) as annee, + dnudes, vsurzt from #DBSchema_arcopole.dgi_PPROF '::text) descproffessionnel( From bf91b69963ad325ab26d7ac8a682468316328ef1 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 21 Sep 2017 11:05:35 +0200 Subject: [PATCH 02/17] synchronize qgis and arcopole HabitationDetails.sql --- .../views/arcopoleHabitationDetails.sql | 50 +++++++++++-------- script/qgis/views/qgisHabitationDetails.sql | 3 +- 2 files changed, 31 insertions(+), 22 deletions(-) diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index ed4f4ac8..e0f39c48 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -1,26 +1,6 @@ --- HabitationDetails -- Create views deschabitation, descproffessionnel, descdependance based on Arcopole Models -CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS - SELECT * - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, - 'select - id_pev as pev,invar, - substr(codlot,1,4) as annee, - dnudes, - vsurzt - from #DBSchema_arcopole.dgi_PPROF '::text) - descproffessionnel( - pev character varying(19), - invar character varying(16), - annee character varying(4), - dnudes character varying(3), - vsurzt character varying(9)); - -ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; - - CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS SELECT * FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, @@ -116,6 +96,36 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS ALTER TABLE #schema_cadastrapp.deschabitation OWNER TO #user_cadastrapp; + + + + +CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS + SELECT * + FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + 'select + id_pev as pev,invar, + substr(codlot,1,4) as annee, + dnudes, + vsurzt + from #DBSchema_arcopole.dgi_PPROF '::text) + descproffessionnel( + pev character varying(19), + invar character varying(16), + annee character varying(4), + dnudes character varying(3), + vsurzt character varying(9)); + +ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; + + + + + + + + + CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS select * FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, diff --git a/script/qgis/views/qgisHabitationDetails.sql b/script/qgis/views/qgisHabitationDetails.sql index c186cecf..cfaab77e 100644 --- a/script/qgis/views/qgisHabitationDetails.sql +++ b/script/qgis/views/qgisHabitationDetails.sql @@ -1,5 +1,6 @@ -- Create views deschabitation, descproffessionnel, descdependance based on Qgis Models + CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation as SELECT * FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, 'select @@ -98,7 +99,6 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation as SELECT * ALTER TABLE #schema_cadastrapp.deschabitation OWNER TO #user_cadastrapp; --- View: cadastrapp_qgis.descproffessionnel CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS SELECT descproffessionnel.pev, @@ -125,7 +125,6 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; --- View: cadastrapp_qgis.descdependance CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS SELECT descdependance.pev, From b6c23cb4add21a4744de41c0a8156659ceee4b50 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 21 Sep 2017 14:05:38 +0200 Subject: [PATCH 03/17] majic 2017 : PEV local pro : dnudes et surzt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit création des attributs qui n'existe plus --- script/arcopole/views/arcopoleHabitationDetails.sql | 4 ++-- script/qgis/views/qgisHabitationDetails.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index e0f39c48..ca6d2ed9 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -106,8 +106,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS 'select id_pev as pev,invar, substr(codlot,1,4) as annee, - dnudes, - vsurzt + '''' as dnudes, + '''' as surzt from #DBSchema_arcopole.dgi_PPROF '::text) descproffessionnel( pev character varying(19), diff --git a/script/qgis/views/qgisHabitationDetails.sql b/script/qgis/views/qgisHabitationDetails.sql index cfaab77e..2b9f0e40 100644 --- a/script/qgis/views/qgisHabitationDetails.sql +++ b/script/qgis/views/qgisHabitationDetails.sql @@ -111,8 +111,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS pev, invar, annee, - dnudes, - vsurzt + '''' as dnudes, + '''' as surzt from #DBSchema_qgis.pevprofessionnelle order by annee,invar'::text) descproffessionnel ( pev character varying(20), From 583212e98b556f3fc0a0f73a61c149403854cdc3 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 21 Sep 2017 14:50:24 +0200 Subject: [PATCH 04/17] majic 2017 : PEV local pro : rajout des nouveaux attributs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + homogénéisation --- .../views/arcopoleHabitationDetails.sql | 53 +++++++++++++------ script/qgis/views/qgisHabitationDetails.sql | 39 ++++++++++---- 2 files changed, 65 insertions(+), 27 deletions(-) diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index ca6d2ed9..ad05bf49 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -100,29 +100,48 @@ ALTER TABLE #schema_cadastrapp.deschabitation OWNER TO #user_cadastrapp; -CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS - SELECT * +CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS + SELECT + descproffessionnel.pev, + descproffessionnel.invar, + descproffessionnel.annee, + descproffessionnel.dsupot, + descproffessionnel.dsup1, + descproffessionnel.dsup2, + descproffessionnel.dsup3, + descproffessionnel.dsupk1, + descproffessionnel.dsupk2, + descproffessionnel.dnudes, + descproffessionnel.vsurzt FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, - 'select - id_pev as pev,invar, + 'select + id_pev as pev, + invar, substr(codlot,1,4) as annee, + CAST(dsupot AS integer), + CAST(dsup1 AS integer), + CAST(dsup2 AS integer), + CAST(dsup3 AS integer), + CAST(dsupk1 AS integer), + CAST(dsupk2 AS integer), '''' as dnudes, - '''' as surzt - from #DBSchema_arcopole.dgi_PPROF '::text) + ''0'' as surzt + from #DBSchema_arcopole.dgi_pprof'::text) descproffessionnel( pev character varying(19), - invar character varying(16), - annee character varying(4), - dnudes character varying(3), - vsurzt character varying(9)); - -ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; - - - - - + invar character varying(16), + annee character varying(4), + dsupot integer, + dsup1 integer, + dsup2 integer, + dsup3 integer, + dsupk1 integer, + dsupk2 integer, + dnudes character varying(3), + vsurzt integer + ); +ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; diff --git a/script/qgis/views/qgisHabitationDetails.sql b/script/qgis/views/qgisHabitationDetails.sql index 2b9f0e40..28d4a360 100644 --- a/script/qgis/views/qgisHabitationDetails.sql +++ b/script/qgis/views/qgisHabitationDetails.sql @@ -101,25 +101,44 @@ ALTER TABLE #schema_cadastrapp.deschabitation OWNER TO #user_cadastrapp; CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS - SELECT descproffessionnel.pev, + SELECT + descproffessionnel.pev, descproffessionnel.invar, descproffessionnel.annee, + descproffessionnel.dsupot, + descproffessionnel.dsup1, + descproffessionnel.dsup2, + descproffessionnel.dsup3, + descproffessionnel.dsupk1, + descproffessionnel.dsupk2, descproffessionnel.dnudes, - descproffessionnel.vsurzt + descproffessionnel.vsurzt FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, - 'select + 'select pev, invar, annee, + CAST(dsupot AS integer), + CAST(dsup1 AS integer), + CAST(dsup2 AS integer), + CAST(dsup3 AS integer), + CAST(dsupk1 AS integer), + CAST(dsupk2 AS integer), '''' as dnudes, - '''' as surzt - from #DBSchema_qgis.pevprofessionnelle order by annee,invar'::text) + ''0'' as surzt + from #DBSchema_qgis.pevprofessionnelle'::text) descproffessionnel ( - pev character varying(20), - invar character varying(10), - annee character varying(4), - dnudes character varying(3), - vsurzt integer + pev character varying(19), + invar character varying(16), + annee character varying(4), + dsupot integer, + dsup1 integer, + dsup2 integer, + dsup3 integer, + dsupk1 integer, + dsupk2 integer, + dnudes character varying(3), + vsurzt integer ); ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; From 7589f7f4e671de3ab4853bf11178d30ccc9ceb23 Mon Sep 17 00:00:00 2001 From: MaelReboux Date: Thu, 21 Sep 2017 17:13:40 +0200 Subject: [PATCH 05/17] =?UTF-8?q?majic=202017=20:=20PEV=20local=20pro=20:?= =?UTF-8?q?=20typo,=20datatype,=20homog=C3=A9n=C3=A9isation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/arcopoleHabitationDetails.sql | 61 ++++++++++++------- script/qgis/views/qgisHabitationDetails.sql | 25 ++++---- 2 files changed, 51 insertions(+), 35 deletions(-) diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index ad05bf49..5d4a0887 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -3,8 +3,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS SELECT * - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, - 'select + FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + 'SELECT pev.id_pev as pev, substr(pev.codlot,1,4) as annee,pev.invar, dnupev,pev.ccoaff, @@ -38,21 +38,21 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS cconad2.description as cconad_cv, cconad3.description as cconad_gr, cconad4.description as cconav_tr, - dsueic_ga, - dsueic_cv, - dsueic_gr, - dsueic_tr, + CAST(dsueic_ga AS integer), + CAST(dsueic_cv AS integer), + CAST(dsueic_gr AS integer), + CAST(dsueic_tr AS integer), dmatgm, dmatto from #DBSchema_arcopole.DGI_PEV as pev - left join #DBSchema_arcopole.dgi_phab pevp on pev.id_pev=pevp.id_pev + left join #DBSchema_arcopole.dgi_phab pevp on pev.id_pev=pevp.id_pev left join #DBSchema_arcopole.dom_ccoaff as ccoaff on pev.ccoaff=ccoaff.code left join #DBSchema_arcopole.dom_cconad cconad1 on pevp.cconad_ga=cconad1.code left join #DBSchema_arcopole.dom_cconad cconad2 on pevp.cconad_cv=cconad2.code left join #DBSchema_arcopole.dom_cconad cconad3 on pevp.cconad_gr=cconad3.code - left join #DBSchema_arcopole.dom_cconad cconad4 on pevp.cconad_tr=cconad4.code '::text) + left join #DBSchema_arcopole.dom_cconad cconad4 on pevp.cconad_tr=cconad4.code'::text) deschabitation( - pev character varying(19), + pev character varying(20), annee character varying(4), invar character varying(16), dnupev character varying(3), @@ -87,19 +87,20 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS cconav_cv character varying(150), cconad_gr character varying(150), cconav_tr character varying(150), - dsueic_ga numeric, - dsueic_cv numeric, - dsueic_gr numeric, - dsueic_tr numeric, + dsueic_ga integer, + dsueic_cv integer, + dsueic_gr integer, + dsueic_tr integer, dmatgm character varying(2), - dmatto character varying(2)); - + dmatto character varying(2) + ); ALTER TABLE #schema_cadastrapp.deschabitation OWNER TO #user_cadastrapp; + CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS SELECT descproffessionnel.pev, @@ -114,7 +115,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS descproffessionnel.dnudes, descproffessionnel.vsurzt FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, - 'select + 'SELECT id_pev as pev, invar, substr(codlot,1,4) as annee, @@ -128,7 +129,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS ''0'' as surzt from #DBSchema_arcopole.dgi_pprof'::text) descproffessionnel( - pev character varying(19), + pev character varying(20), invar character varying(16), annee character varying(4), dsupot integer, @@ -146,9 +147,24 @@ ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS - select * - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, - 'select + SELECT + descdependance.pev, + descdependance.invar, + descdependance.annee, + descdependance.dnudes, + descdependance.cconad_lib, + descdependance.dsudep, + descdependance.dnbbai, + descdependance.dnbdou, + descdependance.dnblav, + descdependance.dnbwc, + descdependance.geaulc, + descdependance.gelelc, + descdependance.gchclc, + descdependance.dmatgm, + descdependance.dmatto + FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + 'SELECT id_pev as pev, invar, substr(codlot,1,4) as annee, @@ -167,7 +183,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS from #DBSchema_arcopole.dgi_dep as pevdependances left join #DBSchema_arcopole.dom_cconad as cconad on pevdependances.cconad=cconad.code'::text) descdependance( - pev character varying(19), + pev character varying(20), invar character varying(16), annee character varying(4), dnudes character varying(6), @@ -181,7 +197,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS gelelc character varying(1), gchclc character varying(1), dmatgm character varying(2), - dmatto character varying(2)); + dmatto character varying(2) + ); ALTER TABLE #schema_cadastrapp.descdependance OWNER TO #user_cadastrapp; diff --git a/script/qgis/views/qgisHabitationDetails.sql b/script/qgis/views/qgisHabitationDetails.sql index 28d4a360..a2015c1f 100644 --- a/script/qgis/views/qgisHabitationDetails.sql +++ b/script/qgis/views/qgisHabitationDetails.sql @@ -1,9 +1,10 @@ -- Create views deschabitation, descproffessionnel, descdependance based on Qgis Models -CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation as SELECT * +CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS + SELECT * FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, - 'select + 'SELECT pev.pev, pev.annee, pev.invar, @@ -51,8 +52,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation as SELECT * left join #DBSchema_qgis.cconad cconad1 on pevp.dep1_cconad=cconad1.cconad left join #DBSchema_qgis.cconad cconad2 on pevp.dep2_cconad=cconad2.cconad left join #DBSchema_qgis.cconad cconad3 on pevp.dep3_cconad=cconad3.cconad - left join #DBSchema_qgis.cconad cconad4 on pevp.dep4_cconad=cconad4.cconad - order by annee,invar'::text) + left join #DBSchema_qgis.cconad cconad4 on pevp.dep4_cconad=cconad4.cconad'::text) deschabitation ( pev character varying(20), annee character varying(4), @@ -91,8 +91,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation as SELECT * cconav_tr character varying(150), dsueic_ga integer, dsueic_cv integer, - dsueic_gr integer, - dsueic_tr integer, + dsueic_gr integer, + dsueic_tr integer, dmatgm character varying(2), dmatto character varying(2) ); @@ -114,7 +114,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS descproffessionnel.dnudes, descproffessionnel.vsurzt FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, - 'select + 'SELECT pev, invar, annee, @@ -128,7 +128,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS ''0'' as surzt from #DBSchema_qgis.pevprofessionnelle'::text) descproffessionnel ( - pev character varying(19), + pev character varying(20), invar character varying(16), annee character varying(4), dsupot integer, @@ -146,7 +146,8 @@ ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS - SELECT descdependance.pev, + SELECT + descdependance.pev, descdependance.invar, descdependance.annee, descdependance.dnudes, @@ -162,7 +163,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS descdependance.dmatgm, descdependance.dmatto FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, - 'select + 'SELECT pev, invar, annee, @@ -179,8 +180,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS dmatgm, dmatto from #DBSchema_qgis.pevdependances - left join #DBSchema_qgis.cconad on pevdependances.cconad=cconad.cconad - order by annee,invar'::text) + left join #DBSchema_qgis.cconad on pevdependances.cconad=cconad.cconad'::text) descdependance ( pev character varying(20), invar character varying(10), @@ -201,4 +201,3 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS ALTER TABLE #schema_cadastrapp.descdependance OWNER TO #user_cadastrapp; - From b13cd10e4851e40eccc0a40363ab46fa4d839ae6 Mon Sep 17 00:00:00 2001 From: pierre Date: Thu, 9 Nov 2017 16:34:51 +0100 Subject: [PATCH 06/17] Update script with port information (merge from #351) --- script/arcopole/createDBUsingArcopoleModel.sh | 43 +++++++++++-------- .../views/arcopoleCoProprieteParcelle.sql | 2 +- script/arcopole/views/arcopoleCommune.sql | 2 +- .../views/arcopoleHabitationDetails.sql | 6 +-- script/arcopole/views/arcopoleLot.sql | 2 +- script/arcopole/views/arcopoleParcelle.sql | 6 +-- .../arcopole/views/arcopoleProprietaire.sql | 2 +- .../views/arcopoleProprietaireParcelle.sql | 2 +- .../arcopole/views/arcopoleProprieteBatie.sql | 2 +- .../views/arcopoleProprieteNonBatie.sql | 2 +- .../views/arcopoleProprieteNonBatieSufExo.sql | 2 +- script/arcopole/views/arcopoleSection.sql | 2 +- 12 files changed, 41 insertions(+), 32 deletions(-) diff --git a/script/arcopole/createDBUsingArcopoleModel.sh b/script/arcopole/createDBUsingArcopoleModel.sh index a87d0be4..e09809eb 100755 --- a/script/arcopole/createDBUsingArcopoleModel.sh +++ b/script/arcopole/createDBUsingArcopoleModel.sh @@ -16,8 +16,8 @@ # @author Jégo Pierre # @since # @brief -# @date 20/06/2016 -# Version : 1.5 +# @date 08/11/2017 +# Version : 1.7 # # Change version | Author | Date | Comments # 1.0 | Pierre JEGO | 15/06/2015 | Init @@ -27,13 +27,14 @@ # 1.4 | Maël REBOUX | 07/06/2016 | Add capability to use non local postgresql database # 1.5 | Pierre JEGO | 20/06/2016 | Use script in batch mode # 1.6 | Pierre JEGO | 22/06/2016 | Add lot view +# 1.7 | Pierre JEGO | 08/11/2017 | Add port as done in Qgis Model #//////////////////////////////////////////////////////////////////// # Set parameters -if [ "$#" -ne 12 ]; then +if [ "$#" -ne 14 ]; then echo "No parameters given or not the good number of params" >&2 - echo "Usage could be : $0 Batchmode(0/1) DatabaseHost DatabaseAdminUser DatabaseName DatabaseSchema DatabaseUser DatabasePasswd ArcopoleHost ArcopoleDataBaseName ArcopoleDataBaseSchema ArcopoleDataBaseUser ArcopoleDataBasePasswd" >&2 + echo "Usage could be : $0 Batchmode(0/1) DatabaseHost DatabasePort DatabaseAdminUser DatabaseName DatabaseSchema DatabaseUser DatabasePasswd ArcopoleHost ArcopolePort ArcopoleDataBaseName ArcopoleDataBaseSchema ArcopoleDataBaseUser ArcopoleDataBasePasswd" >&2 echo "Use constant in script" >&2 ## TO BE SET MANUALLY IF NOT USING SCRIPT PARAMETERS @@ -47,6 +48,7 @@ if [ "$#" -ne 12 ]; then # Postgresql information (the database to load) dbhost="localhost" + dbport="5432" # Postgres user which have role creation and schema creation rights dbadminuser="admindbuser" dbname="cadastrapp_arcopole" @@ -56,6 +58,7 @@ if [ "$#" -ne 12 ]; then # REMOTE Arcopole Database information (the database to read) arcopoleDBHost="xxx" + arcopolePort="5432" arcopoleDBName="xxx" arcopoleDBSchema="xxx" arcopoleDBUser="xxx" @@ -64,22 +67,25 @@ else echo "Launch Script using parameters" >&2 batchmode=$1 dbhost=$2 - dbadminuser=$3 - dbname=$4 - schema=$5 - username=$6 - userpwd=$7 - - arcopoleDBHost=$8 - arcopoleDBName=$9 - arcopoleDBSchema=$10 - arcopoleDBUser=$11 - arcopoleDBPassword=$12 + dbport=$3 + dbadminuser=$4 + dbname=$5 + schema=$6 + username=$7 + userpwd=$8 + + arcopoleDBHost=$9 + arcopoleDBPort=$10 + arcopoleDBName=$11 + arcopoleDBSchema=$12 + arcopoleDBUser=$13 + arcopoleDBPassword=$14 fi echo "--------------------------------"; echo "Batch mode : $batchmode" echo "Database host : $dbhost" +echo "Database port : $dbport" echo "Database admin user : $dbadminuser" echo "Database name : $dbname" echo "Schema name : $schema" @@ -88,6 +94,7 @@ echo "Password : $userpwd" echo "If using batch mode, make sure username and password had been set in pgpass.conf in order to use batch mode" echo "Arcopole Database host : $arcopoleDBHost" +echo "Arcopole Database port : $arcopoleDBPort" echo "Arcopole Database name : $arcopoleDBName" echo "Arcopole Schema : $arcopoleDBSchema" echo "Arcopole UserName : $arcopoleDBUser" @@ -105,6 +112,7 @@ fi # #schema_cadastrapp replace with $schema # #pwd_cadastrapp replace with $userpwd # #DBHost_arcopole replace with $arcopoleDBHost +# #DBPort_arcopole replace wiht $arcopoleDBPort # #DBSchema_arcopole replace with $arcopoleDBSchema # #DBName_arcopole replace with $arcopoleDBName # #DBUser_arcopole replace with $arcopoleDBUser @@ -122,11 +130,12 @@ replaceAndLaunch (){ cat $1 | sed "{ s/#user_cadastrapp/$username/g s/#schema_cadastrapp/$schema/g s/#DBHost_arcopole/$arcopoleDBHost/g + s/#DBPort_arcopole/$arcopoleDBPort/g s/#DBName_arcopole/$arcopoleDBName/g s/#DBUser_arcopole/$arcopoleDBUser/g s/#DBpasswd_arcopole/$arcopoleDBPassword/g s/#DBSchema_arcopole/$arcopoleDBSchema/g }" |\ - psql -h $dbhost -U $username -d $dbname $connectionOption + psql -h $dbhost -p $dbport -U $username -d $dbname $connectionOption } # Init database @@ -137,7 +146,7 @@ cat ./database/init.sql | sed "{ s/#user_cadastrapp/$username/g s/#pwd_cadastrapp/$userpwd/g s/#dbname_arcopole/$dbname/g s/#schema_cadastrapp/$schema/g }" |\ - psql -h $dbhost -U $dbadminuser -d postgres $connectionOption + psql -h $dbhost -p $dbport -U $dbadminuser -d postgres $connectionOption echo "--------------------------------"; echo " Drop View and Tables except groupeAutorisation "; diff --git a/script/arcopole/views/arcopoleCoProprieteParcelle.sql b/script/arcopole/views/arcopoleCoProprieteParcelle.sql index 24c36bff..8dc33480 100644 --- a/script/arcopole/views/arcopoleCoProprieteParcelle.sql +++ b/script/arcopole/views/arcopoleCoProprieteParcelle.sql @@ -6,7 +6,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.co_propriete_parcelle AS co_propriete_parcelle.parcelle, co_propriete_parcelle.comptecommunal, co_propriete_parcelle.dnulot - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select d.codlot as lots, d.codparc as parcelle, diff --git a/script/arcopole/views/arcopoleCommune.sql b/script/arcopole/views/arcopoleCommune.sql index 17c4e6c8..c9c62a86 100644 --- a/script/arcopole/views/arcopoleCommune.sql +++ b/script/arcopole/views/arcopoleCommune.sql @@ -7,7 +7,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.commune AS commune.libcom, commune.libcom_maj, commune.libcom_min - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select id_comm as cgocommune, annmaj as annee, diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index 5d4a0887..ffaf3a3b 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -3,7 +3,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS SELECT * - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'SELECT pev.id_pev as pev, substr(pev.codlot,1,4) as annee,pev.invar, @@ -114,7 +114,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS descproffessionnel.dsupk2, descproffessionnel.dnudes, descproffessionnel.vsurzt - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'SELECT id_pev as pev, invar, @@ -163,7 +163,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS descdependance.gchclc, descdependance.dmatgm, descdependance.dmatto - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'SELECT id_pev as pev, invar, diff --git a/script/arcopole/views/arcopoleLot.sql b/script/arcopole/views/arcopoleLot.sql index 511285aa..1d2729aa 100644 --- a/script/arcopole/views/arcopoleLot.sql +++ b/script/arcopole/views/arcopoleLot.sql @@ -7,7 +7,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.lot AS lot.dnulot, lot.dnumql, lot.ddenql - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select distinct l.codlot, l.invloc as id_local, diff --git a/script/arcopole/views/arcopoleParcelle.sql b/script/arcopole/views/arcopoleParcelle.sql index 9b338eaa..95d8fef5 100644 --- a/script/arcopole/views/arcopoleParcelle.sql +++ b/script/arcopole/views/arcopoleParcelle.sql @@ -2,7 +2,7 @@ -- Create view for parcelle surface CREATE MATERIALIZED VIEW #schema_cadastrapp.v_parcelle_surfc as select parcelle, surfc, surfb - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select distinct ep.id_parc as parcelle, round(st_area(ep.shape)) as surfc, @@ -32,7 +32,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.parcelle AS parcelle.ccopre, parcelle.ccosec, parcelle.dcntpa - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select codparc as parcelle, codcomm as cgocommune, @@ -98,7 +98,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.parcelledetails AS parcelledetails.inspireid, surfc, surfb - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select codparc as parcelle, codcomm as cgocommune, diff --git a/script/arcopole/views/arcopoleProprietaire.sql b/script/arcopole/views/arcopoleProprietaire.sql index 95668050..95c9e519 100644 --- a/script/arcopole/views/arcopoleProprietaire.sql +++ b/script/arcopole/views/arcopoleProprietaire.sql @@ -62,7 +62,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietaire as prop_ccodem.ccodem_lib, prop_dnatpr.dnatpr, prop_dnatpr.dnatpr_lib - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select id_prop as id_proprietaire, id_prop as dnupro, diff --git a/script/arcopole/views/arcopoleProprietaireParcelle.sql b/script/arcopole/views/arcopoleProprietaireParcelle.sql index e4ff06cb..2a4b715c 100644 --- a/script/arcopole/views/arcopoleProprietaireParcelle.sql +++ b/script/arcopole/views/arcopoleProprietaireParcelle.sql @@ -4,7 +4,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietaire_parcelle AS SELECT proprietaire_parcelle.parcelle, proprietaire_parcelle.comptecommunal - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select p.codparc as parcelle, p.dnupro as comptecommunal diff --git a/script/arcopole/views/arcopoleProprieteBatie.sql b/script/arcopole/views/arcopoleProprieteBatie.sql index 3fe08dca..96613424 100644 --- a/script/arcopole/views/arcopoleProprieteBatie.sql +++ b/script/arcopole/views/arcopoleProprieteBatie.sql @@ -39,7 +39,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS proprietebatie.rcbaia_dep, proprietebatie.rcbaia_gp, proprietebatie.jannat - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select local.id_local, invar.codparc as parcelle, diff --git a/script/arcopole/views/arcopoleProprieteNonBatie.sql b/script/arcopole/views/arcopoleProprieteNonBatie.sql index ee3899e1..b5872269 100644 --- a/script/arcopole/views/arcopoleProprieteNonBatie.sql +++ b/script/arcopole/views/arcopoleProprieteNonBatie.sql @@ -32,7 +32,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietenonbatie AS proprietenonbatie.bisufad_com, proprietenonbatie.bisufad_dep, proprietenonbatie.bisufad_gp - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select suf.id_suf as id_local, nbati.codparc as parcelle, diff --git a/script/arcopole/views/arcopoleProprieteNonBatieSufExo.sql b/script/arcopole/views/arcopoleProprieteNonBatieSufExo.sql index 2024ce6a..00fe56e2 100644 --- a/script/arcopole/views/arcopoleProprieteNonBatieSufExo.sql +++ b/script/arcopole/views/arcopoleProprieteNonBatieSufExo.sql @@ -13,7 +13,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietenonbatiesufexo AS proprietenonbatiesufexo.rcexnba, proprietenonbatiesufexo.fcexn, proprietenonbatiesufexo.pexn - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select nbati.codparc as parcelle, suf.id_suf as id_local, diff --git a/script/arcopole/views/arcopoleSection.sql b/script/arcopole/views/arcopoleSection.sql index 112ad55c..b15ad6d2 100644 --- a/script/arcopole/views/arcopoleSection.sql +++ b/script/arcopole/views/arcopoleSection.sql @@ -5,7 +5,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.section AS section.cgocommune, section.ccosec, section.ccopre - FROM dblink('host=#DBHost_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, + FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select codcomm as cgocommune, ltrim(substr(id_sect,10,2),''0'') as ccosec , From 84ac0033b7cefb72fa4c04c116ede1beb9fbca23 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 10 Nov 2017 12:07:04 +0100 Subject: [PATCH 07/17] Add new article 50 values update service to add dsupot, dsup1, dsup2, dsup3, dsupk1, dsupk2 update addons to display thoses values. Keep old values in API if we want to plug API to 2016 values --- addons/cadastrapp/css/cadastrapp.css | 10 ++++ addons/cadastrapp/js/habitationDetails.js | 12 ++++- .../service/HabitationController.java | 50 ++++++++++++------- 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/addons/cadastrapp/css/cadastrapp.css b/addons/cadastrapp/css/cadastrapp.css index 8faba01d..2c5b3b36 100644 --- a/addons/cadastrapp/css/cadastrapp.css +++ b/addons/cadastrapp/css/cadastrapp.css @@ -72,6 +72,15 @@ margin:5px 2px; } +.profDetails{ + text-align: right; +} + +.profDetailsLabel{ + float: left; + padding-right: 15px; +} + .add-button { background-image: url(../img/famfamfam/add.png) } @@ -104,3 +113,4 @@ overflow: auto; } + diff --git a/addons/cadastrapp/js/habitationDetails.js b/addons/cadastrapp/js/habitationDetails.js index 94e4dc4b..1cfe2a2d 100644 --- a/addons/cadastrapp/js/habitationDetails.js +++ b/addons/cadastrapp/js/habitationDetails.js @@ -127,9 +127,17 @@ GEOR.Addons.Cadastre.showHabitationDetails = function(batiment, niveau, porte, a GEOR.Addons.Cadastre.createArcticle50Panel = function(article50Details) { if(article50Details){ + + var details50 = '
Surface pondérée ' + article50Details.dsupot + ' m²
'; + details50 = details50 + '
Surface des parties principales ' + article50Details.dsup1 + ' m²
'; + details50 = details50 + '
Surface des parties secondaires couvertes ' + article50Details.dsup2 + ' m²
'; + details50 = details50 + '
Surface des parties secondaires non couvertes ' + article50Details.dsup3 + ' m²
'; + details50 = details50 + '
Surface des stationnements couverts ' + article50Details.dsupk1 + ' m²
'; + details50 = details50 + '
Surface des stationnements non couverts ' + article50Details.dsupk2 + ' m²
'; + return new Ext.Panel({ - title: 'Partie professionelle ' + article50Details.dnudes, - html:'
Surface réelle ' + article50Details.vsurzt + ' m²
', + title: 'Partie professionelle ', + html: details50, layout: 'fit' }); } diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java index 27ddda63..ac755bed 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java @@ -17,10 +17,17 @@ import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; - +/** + * HabitationController + * + * Used to get article 40, 50 and 60 informations from cadastrapp database + * + * @author pierre + * + */ public class HabitationController extends CadController { - final static Logger logger = LoggerFactory.getLogger(HabitationController.class); + static final Logger logger = LoggerFactory.getLogger(HabitationController.class); @GET @@ -29,11 +36,13 @@ public class HabitationController extends CadController { /** * Returns information about habitation * - * @param headers http headers used - * @param annee - * @param invar id habitation + * @param headers HttpHeaders http headers used + * information will only be return if user is CNIL2 + * @param annee String corresponding to year of wanted information (normally only current year available) + * @param invar String id habitation * - * @return JSON list + * @return Map containing informations from article 40 50 and 60, + * empty list if missing input parameter or if user doesn't have privilege */ public Map getHabitationDetails(@Context HttpHeaders headers, @QueryParam("annee") String annee, @@ -41,12 +50,13 @@ public Map getHabitationDetails(@Context HttpHeaders headers, Map habitationDesc = new HashMap(); - List queryParams = new ArrayList(); - queryParams.add(annee); - queryParams.add(invar); - + // Check information are valid and that user have priviledge to see it if(annee != null && invar != null && getUserCNILLevel(headers) > 1) - { + { + List queryParams = new ArrayList(); + queryParams.add(annee); + queryParams.add(invar); + habitationDesc.put("article40", getArticle40Details(queryParams)); habitationDesc.put("article50", getArticle50Details(queryParams)); habitationDesc.put("article60", getArticle60Details(queryParams)); @@ -58,9 +68,10 @@ public Map getHabitationDetails(@Context HttpHeaders headers, } /** + * getArticle40Details * - * @param queryParams - * @return + * @param queryParams List composed with year and invar information + * @return List> */ private List> getArticle40Details(List queryParams){ @@ -86,9 +97,10 @@ private List> getArticle40Details(List queryParams){ } /** + * getArticle50Details * - * @param queryParams - * @return + * @param ueryParams List composed with year and invar information + * @return List> */ private List> getArticle50Details(List queryParams){ @@ -97,7 +109,7 @@ private List> getArticle50Details(List queryParams){ StringBuilder queryBuilder = new StringBuilder(); // CNIL Niveau 2 - queryBuilder.append("select pro.dnudes, pro.vsurzt"); + queryBuilder.append("select pro.dnudes, pro.vsurzt, pro.dsupot, pro.dsup1, pro.dsup2, pro.dsup3, pro.dsupk1, pro.dsupk2"); queryBuilder.append(" from "); queryBuilder.append(databaseSchema); queryBuilder.append(".descproffessionnel pro "); @@ -109,9 +121,10 @@ private List> getArticle50Details(List queryParams){ } /** + * getArticle60Details * - * @param queryParams - * @return + * @param queryParams List composed with year and invar information + * @return List> */ private List> getArticle60Details(List queryParams){ @@ -132,7 +145,6 @@ private List> getArticle60Details(List queryParams){ queryBuilder.append(" where dep.annee = ? and dep.invar = ? "); queryBuilder.append(" and dep.dmatgm = mur.code and dep.dmatto = toit.code ;"); - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.queryForList(queryBuilder.toString(), queryParams.toArray()); From 87c756e17aa1eae0f67dfdead387420e235ecac6 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 10 Nov 2017 15:13:45 +0100 Subject: [PATCH 08/17] =?UTF-8?q?Homog=C3=A9nisation=20des=20views=20entre?= =?UTF-8?q?=20Qgis=20et=20Arcopole?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/arcopoleHabitationDetails.sql | 17 +++++++---------- script/qgis/views/qgisHabitationDetails.sql | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index ffaf3a3b..e2402f3d 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -6,8 +6,10 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'SELECT pev.id_pev as pev, - substr(pev.codlot,1,4) as annee,pev.invar, - dnupev,pev.ccoaff, + substr(pev.codlot,1,4) as annee, + pev.invar, + dnupev, + pev.ccoaff, ''Partie principale d''''habitation'' as dnupev_lib, ccoaff.description as ccoaff_lib, pevp.dnudes, @@ -97,10 +99,6 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS ALTER TABLE #schema_cadastrapp.deschabitation OWNER TO #user_cadastrapp; - - - - CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS SELECT descproffessionnel.pev, @@ -145,7 +143,6 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; - CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS SELECT descdependance.pev, @@ -170,13 +167,13 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS substr(codlot,1,4) as annee, dnudes, description as cconad_lib, - dsudep, + CAST(dsudep AS integer), dnbbai, dnbdou, dnblav, dnbwc, geaulc, - GELECL as gelelc, + gelelc, gchclc, dmatgm, dmatto @@ -188,7 +185,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS annee character varying(4), dnudes character varying(6), cconad_lib character varying(150), - dsudep character varying(6), + dsudep integer, dnbbai character varying(2), dnbdou character varying(2), dnblav character varying(2), diff --git a/script/qgis/views/qgisHabitationDetails.sql b/script/qgis/views/qgisHabitationDetails.sql index a2015c1f..d84959e5 100644 --- a/script/qgis/views/qgisHabitationDetails.sql +++ b/script/qgis/views/qgisHabitationDetails.sql @@ -41,7 +41,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.deschabitation AS cconad3.cconad_lib as cconad_gr, cconad4.cconad_lib as cconav_tr, dep1_dsueic as dsueic_ga, - dep2_dsueic as dsueic_cv,dep3_dsueic + dep2_dsueic as dsueic_cv, + dep3_dsueic as dsueic_gr, dep4_dsueic as dsueic_tr, dmatgm, @@ -144,7 +145,6 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; - CREATE MATERIALIZED VIEW #schema_cadastrapp.descdependance AS SELECT descdependance.pev, From 9ea087c583374408290ef2b34d8886945f0624d3 Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 13 Nov 2017 14:05:47 +0100 Subject: [PATCH 09/17] Add article 21 information and correlation tables This is link to #348 --- addons/cadastrapp/css/cadastrapp.css | 5 ++ addons/cadastrapp/js/habitationDetails.js | 5 +- .../service/HabitationController.java | 8 +-- script/arcopole/createDBUsingArcopoleModel.sh | 3 ++ .../views/arcopoleHabitationDetails.sql | 48 ++++++++++++----- script/commun/dropTablesAndViews.sql | 2 + script/commun/tables/prop_ccocac.sql | 53 +++++++++++++++++++ script/commun/tables/prop_ccocac_simple.sql | 24 +++++++++ script/qgis/createDBUsingQgisModel.sh | 3 ++ script/qgis/views/qgisHabitationDetails.sql | 48 ++++++++++++----- 10 files changed, 168 insertions(+), 31 deletions(-) create mode 100644 script/commun/tables/prop_ccocac.sql create mode 100644 script/commun/tables/prop_ccocac_simple.sql diff --git a/addons/cadastrapp/css/cadastrapp.css b/addons/cadastrapp/css/cadastrapp.css index 2c5b3b36..1b70e119 100644 --- a/addons/cadastrapp/css/cadastrapp.css +++ b/addons/cadastrapp/css/cadastrapp.css @@ -81,6 +81,11 @@ padding-right: 15px; } +.profCategorie{ + width: 25em; + padding-bottom: 5px; +} + .add-button { background-image: url(../img/famfamfam/add.png) } diff --git a/addons/cadastrapp/js/habitationDetails.js b/addons/cadastrapp/js/habitationDetails.js index 1cfe2a2d..d4e4f1ca 100644 --- a/addons/cadastrapp/js/habitationDetails.js +++ b/addons/cadastrapp/js/habitationDetails.js @@ -128,7 +128,8 @@ GEOR.Addons.Cadastre.showHabitationDetails = function(batiment, niveau, porte, a if(article50Details){ - var details50 = '
Surface pondérée ' + article50Details.dsupot + ' m²
'; + var details50 = '
' +article50Details.ccocac_lib + '
'; + details50 = details50 + '
Surface pondérée ' + article50Details.dsupot + ' m²
'; details50 = details50 + '
Surface des parties principales ' + article50Details.dsup1 + ' m²
'; details50 = details50 + '
Surface des parties secondaires couvertes ' + article50Details.dsup2 + ' m²
'; details50 = details50 + '
Surface des parties secondaires non couvertes ' + article50Details.dsup3 + ' m²
'; @@ -136,7 +137,7 @@ GEOR.Addons.Cadastre.showHabitationDetails = function(batiment, niveau, porte, a details50 = details50 + '
Surface des stationnements non couverts ' + article50Details.dsupk2 + ' m²
'; return new Ext.Panel({ - title: 'Partie professionelle ', + title: 'Partie professionelle - ' + article50Details.ccocac, html: details50, layout: 'fit' }); diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java index ac755bed..297b4c68 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/HabitationController.java @@ -109,11 +109,13 @@ private List> getArticle50Details(List queryParams){ StringBuilder queryBuilder = new StringBuilder(); // CNIL Niveau 2 - queryBuilder.append("select pro.dnudes, pro.vsurzt, pro.dsupot, pro.dsup1, pro.dsup2, pro.dsup3, pro.dsupk1, pro.dsupk2"); + queryBuilder.append("select pro.dnudes, pro.vsurzt, pro.dsupot, pro.dsup1, pro.dsup2, pro.dsup3, pro.dsupk1, pro.dsupk2, pro.ccocac, cco.ccocac_lib"); queryBuilder.append(" from "); queryBuilder.append(databaseSchema); - queryBuilder.append(".descproffessionnel pro "); - queryBuilder.append(" where pro.annee = ? and pro.invar = ? ;"); + queryBuilder.append(".descproffessionnel pro , "); + queryBuilder.append(databaseSchema); + queryBuilder.append(".prop_ccocac cco"); + queryBuilder.append(" where pro.annee = ? and pro.invar = ? and pro.ccocac=cco.ccocac;"); JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); diff --git a/script/arcopole/createDBUsingArcopoleModel.sh b/script/arcopole/createDBUsingArcopoleModel.sh index e09809eb..cf2ddb56 100755 --- a/script/arcopole/createDBUsingArcopoleModel.sh +++ b/script/arcopole/createDBUsingArcopoleModel.sh @@ -159,6 +159,9 @@ echo " Create tables "; echo "--------------------------------"; replaceAndLaunch ./tables/uf_parcelle.sql +# Add properties correlation tables +replaceAndLaunch ../commun/tables/prop_ccocac.sql +replaceAndLaunch ../commun/tables/prop_ccocac_simple.sql replaceAndLaunch ../commun/tables/prop_ccodem.sql replaceAndLaunch ../commun/tables/prop_ccodro.sql replaceAndLaunch ../commun/tables/prop_ccoqua.sql diff --git a/script/arcopole/views/arcopoleHabitationDetails.sql b/script/arcopole/views/arcopoleHabitationDetails.sql index e2402f3d..6ca3f334 100644 --- a/script/arcopole/views/arcopoleHabitationDetails.sql +++ b/script/arcopole/views/arcopoleHabitationDetails.sql @@ -111,21 +111,36 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS descproffessionnel.dsupk1, descproffessionnel.dsupk2, descproffessionnel.dnudes, - descproffessionnel.vsurzt + descproffessionnel.vsurzt, + descproffessionnel.ccocac, + descproffessionnel.dnutrf, + descproffessionnel.dcfloc, + descproffessionnel.ccortar, + descproffessionnel.ccorvl, + descproffessionnel.dtaurv, + descproffessionnel.dcmloc FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'SELECT - id_pev as pev, - invar, - substr(codlot,1,4) as annee, - CAST(dsupot AS integer), - CAST(dsup1 AS integer), - CAST(dsup2 AS integer), - CAST(dsup3 AS integer), - CAST(dsupk1 AS integer), - CAST(dsupk2 AS integer), + prof.id_pev as pev, + prof.invar, + substr(prof.codlot,1,4) as annee, + CAST(prof.dsupot AS integer), + CAST(prof.dsup1 AS integer), + CAST(prof.dsup2 AS integer), + CAST(prof.dsup3 AS integer), + CAST(prof.dsupk1 AS integer), + CAST(prof.dsupk2 AS integer), '''' as dnudes, - ''0'' as surzt - from #DBSchema_arcopole.dgi_pprof'::text) + ''0'' as vsurzt, + gpev.ccocac, + gpev.dnutrf, + (0 || gpev.dcfloc)::integer, + (0 || gpev.ccortar)::integer, + gpev.ccorvl, + (0 || gpev.dtaurv)::integer, + (0 || gpev.dcmloc)::integer + from #DBSchema_arcopole.dgi_pprof prof + left join #DBSchema_arcopole.dgi_pev as gpev on prof.id_pev=gpev.id_pev'::text) descproffessionnel( pev character varying(20), invar character varying(16), @@ -137,7 +152,14 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS dsupk1 integer, dsupk2 integer, dnudes character varying(3), - vsurzt integer + vsurzt integer, + ccocac character varying(4), + dnutrf character varying(2), + dcfloc integer, + ccortar integer, + ccorvl character varying(2), + dtaurv integer, + dcmloc integer ); ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; diff --git a/script/commun/dropTablesAndViews.sql b/script/commun/dropTablesAndViews.sql index 6abed22c..9e27b4ce 100644 --- a/script/commun/dropTablesAndViews.sql +++ b/script/commun/dropTablesAndViews.sql @@ -26,6 +26,8 @@ DROP MATERIALIZED VIEW #schema_cadastrapp.section; -- Drop all tables (not user autorisation tables) DROP TABLE #schema_cadastrapp.uf_parcelle; +DROP TABLE #schema_cadastrapp.prop_ccocac; +DROP TABLE #schema_cadastrapp.prop_ccocac_simple; DROP TABLE #schema_cadastrapp.prop_ccodem; DROP TABLE #schema_cadastrapp.prop_ccodro; DROP TABLE #schema_cadastrapp.prop_ccogrm; diff --git a/script/commun/tables/prop_ccocac.sql b/script/commun/tables/prop_ccocac.sql new file mode 100644 index 00000000..633c54dd --- /dev/null +++ b/script/commun/tables/prop_ccocac.sql @@ -0,0 +1,53 @@ + +CREATE TABLE #schema_cadastrapp.prop_ccocac ( + ccocac character varying(4) NOT NULL, + ccocac_lib character varying(150) +); + + +ALTER TABLE #schema_cadastrapp.prop_ccocac OWNER TO #user_cadastrapp; + + +ALTER TABLE ONLY #schema_cadastrapp.prop_ccocac + ADD CONSTRAINT ccocac_pkey PRIMARY KEY (ccocac); + + +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG1', 'Boutiques et magasins sur rue (exemples : commerces, restaurants, cafés ou agences bancaires pour une surface principale inférieure à 400 m²)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG2', 'Commerces sans accès direct sur la rue (surface principale inférieure à 400 m²)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG3', 'Magasins appartenant à un ensemble commercial(surface principale inférieure à 400 m²)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG4', 'Magasins de grande surface(surface principale comprise entre 400 et 2 499 m²)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG5', 'Magasins de très grande surface (surface principale égale ou supérieure à 2 500 m²)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG6', 'Stations - service, stations de lavage et assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG7', 'Marchés'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('BUR1', 'Locaux à usage de bureaux d’agencement ancien'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('BUR2', 'Locaux à usage de bureaux d’agencement récent'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('BUR3', 'Locaux assimilables à des bureaux mais présentant des aménagements spécifiques'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('DEP1', 'Lieux de dépôt à ciel ouvert et terrains à usage commercial ou industriel'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('DEP2', 'Lieux de dépôt couverts'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('DEP3', 'Parcs de stationnement à ciel ouvert'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('DEP4', 'Parcs de stationnement couverts'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('DEP5', 'Installations spécifiques de stockage'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ATE1', 'Ateliers artisanaux'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ATE2', 'Locaux utilisés pour une activité de transformation, de manutention ou de maintenance'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ATE3', 'Chenils, viviers et autres locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('HOT1', 'Hôtels « confort » (4 étoiles et plus, ou confort identique)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('HOT2', 'Hôtels « supérieur » (2 ou 3 étoiles, ou confort identique)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('HOT3', 'Hôtels « standard » (1 étoile, ou confort identique)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('HOT4', 'Foyers d’hébergement, centres d’accueil, auberges de jeunesse'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('HOT5', 'Hôtels clubs, villages de vacances et résidences hôtelières'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE1', 'Salles de spectacles, musées et locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE2', 'Établissements ou terrains affectés à la pratique d’un sport ou à usage de spectacles sportifs'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE3', 'Salles de loisirs diverses'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE4', 'Terrains de camping confortables (3 étoiles et plus, ou confort identique)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE5', 'Terrains de camping ordinaires(1 ou 2 étoiles, ou confort identique)'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE6', 'Établissements de détente et de bien - être'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE7', 'Centres de loisirs, centres de colonies de vacances, maisons de jeunes'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ENS1', 'Écoles et institutions privées exploitées dans un but non lucratif'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ENS2', 'Établissements d’enseignement à but lucratif'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('CLI1', 'Cliniques et Établissements hospitaliers'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('CLI2', 'Centres médico-sociaux, centres de soins, crèches, halte - garderies'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('CLI3', 'Maisons de repos, maisons de retraite (médicalisées ou non) et locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('CLI4', 'Centres de rééducation, de thalassothérapie, établissements thermaux'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('IND1', 'Établissements industriels nécessitant un outillage important autres que les carrières et assimilés'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('IND2', 'carrières et Établissements assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('EXC1', 'Locaux ne relevant d’aucune des catégories précédentes par leurs caractéristiques sortant de l’ordinaire'); diff --git a/script/commun/tables/prop_ccocac_simple.sql b/script/commun/tables/prop_ccocac_simple.sql new file mode 100644 index 00000000..d2d82c84 --- /dev/null +++ b/script/commun/tables/prop_ccocac_simple.sql @@ -0,0 +1,24 @@ + +CREATE TABLE #schema_cadastrapp.prop_ccocac_simple ( + ccocac character varying(4) NOT NULL, + ccocac_lib character varying(150) +); + + +ALTER TABLE #schema_cadastrapp.prop_ccocac_simple OWNER TO #user_cadastrapp; + + +ALTER TABLE ONLY #schema_cadastrapp.prop_ccocac_simple + ADD CONSTRAINT ccocac_s_pkey PRIMARY KEY (ccocac); + + +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('MAG', 'Magasins et lieux de vente'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('BUR', 'Bureaux et locaux divers assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('DEP', 'Lieux de dépôt ou stockage et parcs de stationnement'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ATE', 'Ateliers et autres locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('HOT', 'Hôtels et locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('SPE', 'Etablissements de spectacles, de sports et de loisirs et autres locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('ENS', 'Etablissements d''enseignement et locaux assimilables'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('CLI', 'Cliniques et Établissements du secteur sanitaire et social'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('IND', 'Établissements industriels n''étant pas évaluées selon la méthode comptable'); +INSERT INTO #schema_cadastrapp.prop_ccocac VALUES ('EXC', 'Autres établissements'); diff --git a/script/qgis/createDBUsingQgisModel.sh b/script/qgis/createDBUsingQgisModel.sh index 1be16e64..164f5933 100755 --- a/script/qgis/createDBUsingQgisModel.sh +++ b/script/qgis/createDBUsingQgisModel.sh @@ -157,6 +157,9 @@ echo "--------------------------------"; replaceAndLaunch ./tables/uf_parcelle.sql +# Add properties correlation tables +replaceAndLaunch ../commun/tables/prop_ccocac.sql +replaceAndLaunch ../commun/tables/prop_ccocac_simple.sql replaceAndLaunch ../commun/tables/prop_ccodem.sql replaceAndLaunch ../commun/tables/prop_ccodro.sql replaceAndLaunch ../commun/tables/prop_ccoqua.sql diff --git a/script/qgis/views/qgisHabitationDetails.sql b/script/qgis/views/qgisHabitationDetails.sql index d84959e5..8ed7d327 100644 --- a/script/qgis/views/qgisHabitationDetails.sql +++ b/script/qgis/views/qgisHabitationDetails.sql @@ -113,21 +113,36 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS descproffessionnel.dsupk1, descproffessionnel.dsupk2, descproffessionnel.dnudes, - descproffessionnel.vsurzt + descproffessionnel.vsurzt, + descproffessionnel.ccocac, + descproffessionnel.dnutrf, + descproffessionnel.dcfloc, + descproffessionnel.ccortar, + descproffessionnel.ccorvl, + descproffessionnel.dtaurv, + descproffessionnel.dcmloc FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, 'SELECT - pev, - invar, - annee, - CAST(dsupot AS integer), - CAST(dsup1 AS integer), - CAST(dsup2 AS integer), - CAST(dsup3 AS integer), - CAST(dsupk1 AS integer), - CAST(dsupk2 AS integer), + pvep.pev, + pvep.invar, + pvep.annee, + CAST(pvep.dsupot AS integer), + CAST(pvep.dsup1 AS integer), + CAST(pvep.dsup2 AS integer), + CAST(pvep.dsup3 AS integer), + CAST(pvep.dsupk1 AS integer), + CAST(pvep.dsupk2 AS integer), '''' as dnudes, - ''0'' as surzt - from #DBSchema_qgis.pevprofessionnelle'::text) + ''0'' as vsurzt, + gpev.ccocac, + gpev.dnutrf, + gpev.dcfloc, + gpev.ccortar, + gpev.ccorvl, + gpev.dtaurv, + gpev.dcmloc + from #DBSchema_qgis.pevprofessionnelle as pvep + left join #DBSchema_qgis.pev as gpev on pvep.pev=gpev.pev'::text) descproffessionnel ( pev character varying(20), invar character varying(16), @@ -139,7 +154,14 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.descproffessionnel AS dsupk1 integer, dsupk2 integer, dnudes character varying(3), - vsurzt integer + vsurzt integer, + ccocac character varying(4), + dnutrf character varying(2), + dcfloc integer, + ccortar integer, + ccorvl character varying(2), + dtaurv integer, + dcmloc integer ); ALTER TABLE #schema_cadastrapp.descproffessionnel OWNER TO #user_cadastrapp; From 1722491e209099bb957d1b9365795a7c7e417678 Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 13 Nov 2017 15:21:58 +0100 Subject: [PATCH 10/17] Change "Revenu Cadastral" to "Base d'imposition" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reordre values Commune, next Groupement Commune, next Département. --- .../main/resources/xsl/relevePropriete.xsl | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cadastrapp/src/main/resources/xsl/relevePropriete.xsl b/cadastrapp/src/main/resources/xsl/relevePropriete.xsl index 8c2a6830..b5a7b28c 100644 --- a/cadastrapp/src/main/resources/xsl/relevePropriete.xsl +++ b/cadastrapp/src/main/resources/xsl/relevePropriete.xsl @@ -311,7 +311,7 @@ - Revenu cadastral + Base d'imposition @@ -566,7 +566,7 @@ - Département - + Grp. Com. - @@ -579,15 +579,15 @@ - € + - € + - Grp. Com. - + Département - @@ -600,10 +600,10 @@ - € + - € + @@ -721,7 +721,7 @@ - Revenu cadastral + Base d'imposition @@ -950,7 +950,7 @@ - Département - + Grp. Com - @@ -963,15 +963,15 @@ - € + - € + - Grp. Com - + Département - @@ -984,10 +984,10 @@ - € + - € + From 39bd25a4b5624600272a402636ac3b9c6b61857c Mon Sep 17 00:00:00 2001 From: pierre Date: Mon, 13 Nov 2017 20:49:57 +0100 Subject: [PATCH 11/17] Ajout de la nature du local professionel dans le RP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ajout de la taxation PSE d'une propriété batie Lié à #348 --- .../cadastrapp/model/pdf/ProprieteBatie.java | 18 ++++++++++++++++++ .../service/pdf/ReleveProprieteHelper.java | 5 +++-- .../src/main/resources/xsl/relevePropriete.xsl | 1 + .../resources/xsl/releveProprieteMinimal.xsl | 1 + .../arcopole/views/arcopoleProprieteBatie.sql | 14 +++++++++----- script/qgis/views/qgisProprieteBatie.sql | 9 ++++++--- 6 files changed, 38 insertions(+), 10 deletions(-) diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java index 906b04d9..9bf241b3 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java @@ -33,6 +33,9 @@ public class ProprieteBatie extends Propriete{ // Nature du local private String cconlc; + // Nature du local professionel + private String ccocac; + // Catégorie private String dcapec; @@ -164,6 +167,21 @@ public String getCconlc() { public void setCconlc(String cconlc) { this.cconlc = cconlc; } + + /** + * @return the cconlc + */ + public String getCcocac() { + return ccocac; + } + + @XmlAttribute + /** + * @param cconlc the cconlc to set + */ + public void setCcocac(String ccocac) { + this.ccocac = ccocac; + } /** * @return the dcapec diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java index f3058378..ea9344df 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java @@ -202,7 +202,7 @@ public RelevePropriete getReleveProprieteInformation(List idComptesCommu StringBuilder queryBuilderProprieteBatie = new StringBuilder(); - queryBuilderProprieteBatie.append("select distinct id_local, ccopre, ccosec, dnupla, COALESCE(natvoi,'')||' '||COALESCE(dvoilib,'') as voie, ccoriv, dnubat, descr, dniv, dpor, invar, ccoaff, ccoeva, cconlc, dcapec, ccolloc, gnextl, jandeb, janimp, gtauom, pexb, rcexba2, rcbaia_com, rcbaia_dep, rcbaia_gp, revcad, jdatat, parcelle "); + queryBuilderProprieteBatie.append("select distinct id_local, ccopre, ccosec, dnupla, COALESCE(natvoi,'')||' '||COALESCE(dvoilib,'') as voie, ccoriv, dnubat, descr, dniv, dpor, invar, ccoaff, ccoeva, cconlc, dcapec, ccolloc, gnextl, jandeb, janimp, gtauom, pexb, rcexba2, rcbaia_com, rcbaia_dep, rcbaia_gp, rcbaia_tse, revcad, jdatat, parcelle, ccocac "); queryBuilderProprieteBatie.append("from "); queryBuilderProprieteBatie.append(databaseSchema); queryBuilderProprieteBatie.append(".proprietebatie pb "); @@ -259,10 +259,11 @@ public RelevePropriete getReleveProprieteInformation(List idComptesCommu proprieteBatie.setCcoaff((String) propBat.get(CadastrappConstants.PB_AFFECTATION_PEV)); //AF proprieteBatie.setCcoeva((String) propBat.get(CadastrappConstants.PB_CODE_EVAL)); //M EVAL proprieteBatie.setCconlc((String) propBat.get(CadastrappConstants.PB_NATURE_LOCAL)); //NAT LOC + proprieteBatie.setCcocac((String) propBat.get(CadastrappConstants.PB_NATURE_LOCAL_PRO)); //NAT LOC PRO proprieteBatie.setCcopre((String) propBat.get(CadastrappConstants.PREFIX_SECTION)); //N°SETCION part1 proprieteBatie.setCcoriv((String) propBat.get(CadastrappConstants.CODE_RIVOLI_VOIE)); //code rivoli proprieteBatie.setCcosec((String) propBat.get(CadastrappConstants.LETTRE_SECTION)); //N°SETCION part2 - proprieteBatie.setDcapec((String) propBat.get(CadastrappConstants.PB_CATEGORIE)); //Cat (PAS DANS LE REQUETTE) + proprieteBatie.setDcapec((String) propBat.get(CadastrappConstants.PB_CATEGORIE)); //Cat proprieteBatie.setDescr((String) propBat.get(CadastrappConstants.PB_NUM_ENTREE)); //Ent proprieteBatie.setDniv((String) propBat.get(CadastrappConstants.PB_NIV_ETAGE)); //Niv proprieteBatie.setDnubat((String) propBat.get(CadastrappConstants.PB_LETTRE_BAT)); //Bat diff --git a/cadastrapp/src/main/resources/xsl/relevePropriete.xsl b/cadastrapp/src/main/resources/xsl/relevePropriete.xsl index b5a7b28c..7e3db44e 100644 --- a/cadastrapp/src/main/resources/xsl/relevePropriete.xsl +++ b/cadastrapp/src/main/resources/xsl/relevePropriete.xsl @@ -449,6 +449,7 @@ + diff --git a/cadastrapp/src/main/resources/xsl/releveProprieteMinimal.xsl b/cadastrapp/src/main/resources/xsl/releveProprieteMinimal.xsl index 8d255737..5fa18e02 100644 --- a/cadastrapp/src/main/resources/xsl/releveProprieteMinimal.xsl +++ b/cadastrapp/src/main/resources/xsl/releveProprieteMinimal.xsl @@ -526,6 +526,7 @@ + diff --git a/script/arcopole/views/arcopoleProprieteBatie.sql b/script/arcopole/views/arcopoleProprieteBatie.sql index 96613424..94057691 100644 --- a/script/arcopole/views/arcopoleProprieteBatie.sql +++ b/script/arcopole/views/arcopoleProprieteBatie.sql @@ -34,11 +34,12 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS proprietebatie.pexb, proprietebatie.gtauom, proprietebatie.rcexba2, - -- proprietebatie.rcbaia_tse, n'existe pas dans arcopole + proprietebatie.rcbaia_tse, proprietebatie.rcbaia_com, proprietebatie.rcbaia_dep, proprietebatie.rcbaia_gp, - proprietebatie.jannat + proprietebatie.jannat, + proprietebatie.ccocac FROM dblink('host=#DBHost_arcopole port=#DBPort_arcopole dbname=#DBName_arcopole user=#DBUser_arcopole password=#DBpasswd_arcopole'::text, 'select local.id_local, @@ -73,10 +74,12 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS CAST(exopev.pexb AS NUMERIC)/100 as pexb, local.gtauom, ROUND(CAST(exopev.rcexba2 AS NUMERIC),2) as rcexba2, + ROUND(CAST(taxpev.bipevla_reg AS NUMERIC),2) as rcbaia_tse, ROUND(CAST(taxpev.bipevla AS NUMERIC),2) as rcbaia_com, ROUND(CAST(taxpev.bipevla_dep AS NUMERIC),2) as rcbaia_dep, ROUND(CAST(taxpev.bipevla_gcom AS NUMERIC),2) as rcbaia_gp, - local.jannat + local.jannat, + pev.ccocac from #DBSchema_arcopole.dgi_local local left join #DBSchema_arcopole.dgi_invar invar on local.id_local=invar.invar left join #DBSchema_arcopole.dgi_voie voie on voie.id_voie=invar.id_voie @@ -116,11 +119,12 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS pexb numeric(3), gtauom character varying(2), rcexba2 numeric(10,2), - -- rcbaia_tse numeric(10,2), n'existe pas dans arcopole + rcbaia_tse numeric(10,2), rcbaia_com numeric(10,2), rcbaia_dep numeric(10,2), rcbaia_gp numeric(10,2), - jannat character varying(10)); + jannat character varying(10), + ccocac character varying(4)); ALTER TABLE #schema_cadastrapp.proprietebatie OWNER TO #user_cadastrapp; diff --git a/script/qgis/views/qgisProprieteBatie.sql b/script/qgis/views/qgisProprieteBatie.sql index 0220e6cd..1f0720c3 100644 --- a/script/qgis/views/qgisProprieteBatie.sql +++ b/script/qgis/views/qgisProprieteBatie.sql @@ -38,7 +38,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS proprietebatie.rcbaia_dep, proprietebatie.rcbaia_gp, proprietebatie.pexb, - proprietebatie.parcelle + proprietebatie.parcelle, + proprietebatie.ccocac FROM dblink('host=#DBHost_qgis port=#DBPort_qgis dbname=#DBName_qgis user=#DBUser_qgis password=#DBpasswd_qgis'::text, 'select l.local00 as id_local, @@ -78,7 +79,8 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS ROUND(CAST(pevtax.de_bipevla AS numeric),2) as rcbaia_dep, ROUND(CAST(pevtax.gp_bipevla AS numeric),2) as rcbaia_gp, pevx.pexb, - l.parcelle + l.parcelle, + pev.ccocac from #DBSchema_qgis.comptecommunal c left join #DBSchema_qgis.local10 as l on c.comptecommunal=l.comptecommunal left join #DBSchema_qgis.local00 as l00 on l00.local00=l.local00 @@ -126,6 +128,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS rcbaia_dep numeric(10,2), rcbaia_gp numeric(10,2), pexb numeric, - parcelle character varying(19)); + parcelle character varying(19), + ccocac character varying(4)); ALTER TABLE #schema_cadastrapp.proprietebatie OWNER TO #user_cadastrapp; From 49fc0026602818b518dc88675ae5333fd02fdfc2 Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 15 Nov 2017 10:37:53 +0100 Subject: [PATCH 12/17] RP modification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Commune, GroupeCommune, Département and TSE imposition information in RP Link to Majic 2017 and #348 --- .../cadastrapp/model/pdf/Imposition.java | 16 ++++ .../cadastrapp/model/pdf/ProprieteBatie.java | 18 +++++ .../service/pdf/ReleveProprieteHelper.java | 21 ++++- .../main/resources/xsl/relevePropriete.xsl | 79 +++++++++++++++++-- 4 files changed, 124 insertions(+), 10 deletions(-) diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/Imposition.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/Imposition.java index fc5aafd6..a7920909 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/Imposition.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/Imposition.java @@ -19,6 +19,8 @@ public class Imposition { private float departementRevenuImposable; private float groupementCommuneRevenuImposable; + + private float tseRevenuImposable; /** * @return the revenuImposable @@ -125,5 +127,19 @@ public void setGroupementCommuneRevenuImposable(float groupementCommuneRevenuImp this.groupementCommuneRevenuImposable = groupementCommuneRevenuImposable; } + /** + * @return the revenuImposable + */ + public float getTseRevenuImposable() { + return tseRevenuImposable; + } + + @XmlAttribute + /** + * @param revenuImposable the revenuImposable to set + */ + public void setTseRevenuImposable(float tseRevenuImposable) { + this.tseRevenuImposable = tseRevenuImposable; + } } diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java index 9bf241b3..95ac0194 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/model/pdf/ProprieteBatie.java @@ -47,6 +47,9 @@ public class ProprieteBatie extends Propriete{ // Liste de lots private List lots; + + // Imposition + private Imposition imposition; /** * @return the dnubat @@ -227,6 +230,21 @@ public String getGtauom() { public void setGtauom(String gtauom) { this.gtauom = gtauom; } + + /** + * @return the imposition + */ + public Imposition getImposition() { + return imposition; + } + + @XmlElement(name = "imposition") + /** + * @param imposition the imposition to set + */ + public void setImposition(Imposition imposition) { + this.imposition = imposition; + } /** * @return the lots diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java index ea9344df..725eef03 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java @@ -313,10 +313,25 @@ public RelevePropriete getReleveProprieteInformation(List idComptesCommu // Count only one taxable income for one invar if (!invarTICount.contains(proprieteId)) { invarTICount.add(proprieteId); + + float communeRevenuImposable = (propBat.get("rcbaia_com") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_com")).floatValue()); + float groupementCommuneRevenuImposable = (propBat.get("rcbaia_gp") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_gp")).floatValue()); + float departementRevenuImposable=(propBat.get("rcbaia_dep") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_dep")).floatValue()); + float tseRevenuImposable=(propBat.get("rcbaia_tse") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_tse")).floatValue()); + + Imposition pbImposition = new Imposition(); + + pbImposition.setCommuneRevenuImposable(communeRevenuImposable); + pbImposition.setGroupementCommuneRevenuImposable(groupementCommuneRevenuImposable); + pbImposition.setDepartementRevenuImposable(departementRevenuImposable); + pbImposition.setTseRevenuImposable(tseRevenuImposable); + + proprieteBatie.setImposition(pbImposition); + pbRevenuImposable = pbRevenuImposable + (propBat.get(CadastrappConstants.PB_VAL_LOCAT_TOTAL) == null ? 0 : ((BigDecimal) propBat.get(CadastrappConstants.PB_VAL_LOCAT_TOTAL)).floatValue()); - pbCommuneRevenuImposable = pbCommuneRevenuImposable + (propBat.get("rcbaia_com") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_com")).floatValue()); - pbDepartementRevenuImposable = pbDepartementRevenuImposable + (propBat.get("rcbaia_dep") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_dep")).floatValue()); - pbGroupementCommuneRevenuImposable = pbGroupementCommuneRevenuImposable + (propBat.get("rcbaia_gp") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_gp")).floatValue()); + pbCommuneRevenuImposable = pbCommuneRevenuImposable + communeRevenuImposable; + pbDepartementRevenuImposable = pbDepartementRevenuImposable + departementRevenuImposable; + pbGroupementCommuneRevenuImposable = pbGroupementCommuneRevenuImposable + groupementCommuneRevenuImposable; } proprietesBaties.add(proprieteBatie); diff --git a/cadastrapp/src/main/resources/xsl/relevePropriete.xsl b/cadastrapp/src/main/resources/xsl/relevePropriete.xsl index 7e3db44e..7ade80ff 100644 --- a/cadastrapp/src/main/resources/xsl/relevePropriete.xsl +++ b/cadastrapp/src/main/resources/xsl/relevePropriete.xsl @@ -207,9 +207,9 @@ - - + + @@ -453,11 +453,76 @@ - - - € - - + + + + + + + + + C + + + + + + + € + + + + + + + + + GC + + + + + + + € + + + + + + + + + D + + + + + + + € + + + + + + + + + TSE + + + + + + + € + + + + + + From 845c52111c3d95a6265aabb0f6aaea3e42b743ac Mon Sep 17 00:00:00 2001 From: pierre Date: Wed, 15 Nov 2017 10:38:14 +0100 Subject: [PATCH 13/17] Add missing constant for CCOCAC information --- .../cadastrapp/service/constants/CadastrappConstants.java | 1 + 1 file changed, 1 insertion(+) diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/constants/CadastrappConstants.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/constants/CadastrappConstants.java index d3df4221..7c155d18 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/constants/CadastrappConstants.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/constants/CadastrappConstants.java @@ -29,6 +29,7 @@ private CadastrappConstants() { public static final String PB_CODE_EVAL = "ccoeva"; public static final String PB_AFFECTATION_PEV = "ccoaff"; public static final String PB_NATURE_LOCAL = "cconlc"; + public static final String PB_NATURE_LOCAL_PRO = "ccocac"; public static final String PB_CATEGORIE = "dcapec"; public static final String PB_VAL_LOCAT_TOTAL = "revcad"; public static final String PB_CODE_COLL_EXO = "ccolloc"; From 203b3bc3fbb0d967f2faf246dc3180a1e447d6f9 Mon Sep 17 00:00:00 2001 From: pierre Date: Thu, 16 Nov 2017 20:26:07 +0100 Subject: [PATCH 14/17] Code review, correction of sonar detected bugs --- .../pdf/ReleveProprieteController.java | 6 +--- .../service/pdf/ReleveProprieteHelper.java | 29 ++++++++++--------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteController.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteController.java index d4c87bea..2ed5911d 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteController.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteController.java @@ -22,10 +22,7 @@ public class ReleveProprieteController extends CadController { - final static Logger logger = LoggerFactory.getLogger(ReleveProprieteController.class); - - final String xslTemplate = "xsl/relevePropriete.xsl"; - final String xslTemplateMinimal = "xsl/releveProprieteMinimal.xsl"; + static final Logger logger = LoggerFactory.getLogger(ReleveProprieteController.class); @Autowired ReleveProprieteHelper releveProprieteHelper; @@ -54,7 +51,6 @@ public Response createRelevePDFPropriete(@Context HttpHeaders headers, @QueryPar comptesCommunaux = Arrays.asList(comptesCommunaux.get(0).split(",")); } // Get information about releve de propriete - //RelevePropriete relevePropriete = getReleveProprieteInformation(comptesCommunaux, headers); RelevePropriete relevePropriete = releveProprieteHelper.getReleveProprieteInformation(comptesCommunaux, headers, idParcelle); File pdfResult = releveProprieteHelper.generatePDF(relevePropriete, false, false); diff --git a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java index 725eef03..a271e488 100644 --- a/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java +++ b/cadastrapp/src/main/java/org/georchestra/cadastrapp/service/pdf/ReleveProprieteHelper.java @@ -53,15 +53,18 @@ public final class ReleveProprieteHelper extends CadController { static final Logger logger = LoggerFactory.getLogger(ReleveProprieteHelper.class); - static final String xslTemplate = "xsl/relevePropriete.xsl"; - static final String xslTemplateMinimal = "xsl/releveProprieteMinimal.xsl"; - static final String xslTemplateError = "xsl/releveProprieteError.xsl"; + static final String XSL_TEMPLATE = "xsl/relevePropriete.xsl"; + static final String XSL_TEMPLATE_MINIMAL = "xsl/releveProprieteMinimal.xsl"; + static final String XSL_TEMPLATE_ERROR = "xsl/releveProprieteError.xsl"; /** + * Get propertie information using given imput from database * - * @param idComptesCommunaux - * @param headers - * @return + * @param idComptesCommunaux List composed with comptecommunalid + * @param headers HttpHeaders used to verify user privilege + * @param idParcelle String plot id + * + * @return RelevePropriete fill with database information */ public RelevePropriete getReleveProprieteInformation(List idComptesCommunaux, HttpHeaders headers, String idParcelle) { @@ -314,10 +317,10 @@ public RelevePropriete getReleveProprieteInformation(List idComptesCommu if (!invarTICount.contains(proprieteId)) { invarTICount.add(proprieteId); - float communeRevenuImposable = (propBat.get("rcbaia_com") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_com")).floatValue()); - float groupementCommuneRevenuImposable = (propBat.get("rcbaia_gp") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_gp")).floatValue()); - float departementRevenuImposable=(propBat.get("rcbaia_dep") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_dep")).floatValue()); - float tseRevenuImposable=(propBat.get("rcbaia_tse") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_tse")).floatValue()); + float communeRevenuImposable = propBat.get("rcbaia_com") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_com")).floatValue(); + float groupementCommuneRevenuImposable = propBat.get("rcbaia_gp") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_gp")).floatValue(); + float departementRevenuImposable = propBat.get("rcbaia_dep") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_dep")).floatValue(); + float tseRevenuImposable = propBat.get("rcbaia_tse") == null ? 0 : ((BigDecimal) propBat.get("rcbaia_tse")).floatValue(); Imposition pbImposition = new Imposition(); @@ -463,7 +466,7 @@ public RelevePropriete getReleveProprieteInformation(List idComptesCommu int surface = (Integer) propNonBat.get(CadastrappConstants.PNB_CONTENANCE_CA) == null ? 0 : (Integer) propNonBat.get(CadastrappConstants.PNB_CONTENANCE_CA); proprieteNonBatie.setDcntsf(surface); - float revenu = (propNonBat.get(CadastrappConstants.PNB_REVENU_CADASTRAL) == null ? 0 : ((BigDecimal) propNonBat.get(CadastrappConstants.PNB_REVENU_CADASTRAL)).floatValue()); + float revenu = propNonBat.get(CadastrappConstants.PNB_REVENU_CADASTRAL) == null ? 0 : ((BigDecimal) propNonBat.get(CadastrappConstants.PNB_REVENU_CADASTRAL)).floatValue(); proprieteNonBatie.setDrcsuba(revenu); pnbRevenuImposable = pnbRevenuImposable + revenu; @@ -533,9 +536,9 @@ public File generatePDF(RelevePropriete rp, boolean isMinimal, boolean isNoData) String template = null; if (isNoData) { - template = xslTemplateError; + template = XSL_TEMPLATE_ERROR; } else { - template = (isMinimal) ? xslTemplateMinimal : xslTemplate; + template = isMinimal ? XSL_TEMPLATE_MINIMAL : XSL_TEMPLATE; } // Pdf temporary filename using tmp folder and timestamp From cdf930e1663e203031e1caecf3ab1c1420eb653e Mon Sep 17 00:00:00 2001 From: pierre Date: Thu, 16 Nov 2017 21:54:22 +0100 Subject: [PATCH 15/17] Same order by Add ccolnc description in arcopole as in qgis model --- script/arcopole/views/arcopoleProprieteBatie.sql | 10 ++++++---- script/qgis/views/qgisProprieteBatie.sql | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/script/arcopole/views/arcopoleProprieteBatie.sql b/script/arcopole/views/arcopoleProprieteBatie.sql index 94057691..a4c6a623 100644 --- a/script/arcopole/views/arcopoleProprieteBatie.sql +++ b/script/arcopole/views/arcopoleProprieteBatie.sql @@ -57,13 +57,13 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS invar.dvoilib, invar.ccoriv, invar.dnubat, - invar.NDESC as descr, + invar.ndesc as descr, invar.dniv, invar.dpor, invar.invar, pev.ccoaff, local.ccoeva, - local.cconlc, + cconlc.description as cconlc, pev.dcapec, ( CASE WHEN pev.dvlpera::text <> '''' THEN ROUND(CEIL(CAST(pev.dvlpera AS NUMERIC)/2),2) END ) AS revcad, ltrim(exopev.ccolloc) as ccolloc, @@ -85,7 +85,9 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS left join #DBSchema_arcopole.dgi_voie voie on voie.id_voie=invar.id_voie left join #DBSchema_arcopole.dgi_pev pev on pev.codlot=invar.codlot and pev.invar=invar.invar left join #DBSchema_arcopole.dgi_exopev exopev on exopev.id_pev=pev.id_pev - left join #DBSchema_arcopole.dgi_taxpev as taxpev on taxpev.id_pev=pev.id_pev'::text) + left join #DBSchema_arcopole.dgi_taxpev as taxpev on taxpev.id_pev=pev.id_pev + left join #DBSchema_arcopole.dom_cconlc cconlc on cconlc.code = local.cconlc + order by invar.codparc,invar.dnvoiri,invar.dvoilib,invar.dnubat,invar.ndesc,invar.dniv,invar.dpor'::text) proprietebatie( id_local character varying(16), parcelle character varying(19), @@ -108,7 +110,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS invar character varying(16), ccoaff character varying(1), ccoeva character varying(1), - cconlc character varying(2), + cconlc character varying(255), dcapec character varying(2), revcad numeric(10,2), ccolloc character varying(2), diff --git a/script/qgis/views/qgisProprieteBatie.sql b/script/qgis/views/qgisProprieteBatie.sql index 1f0720c3..562a2d8f 100644 --- a/script/qgis/views/qgisProprieteBatie.sql +++ b/script/qgis/views/qgisProprieteBatie.sql @@ -89,7 +89,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS left join #DBSchema_qgis.pevexoneration as pevx on pevx.pev=pev.pev left join #DBSchema_qgis.pevtaxation as pevtax on pevtax.pev=pev.pev left join #DBSchema_qgis.cconlc on cconlc.cconlc = l.cconlc - order by c.ccodep,c.ccodir,c.ccocom,dnupla,v.voie,v.libvoi,l00.dnubat,l00.descr,l00.dniv,l00.dpor'::text) + order by l.parcelle,l00.ccoriv,v.libvoi,l00.dnubat,l00.descr,l00.dniv,l00.dpor'::text) proprietebatie( id_local character varying(17), comptecommunal character varying(15), @@ -113,7 +113,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS invar character varying(10), ccoaff character varying(1), ccoeva character varying(1), - cconlc character varying, + cconlc character varying(255), dcapec character varying(2), ccolloc character varying(2), gnextl character varying(2), From 0538c7c1e23dc8e19529d53522a9e0a271678ba5 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 17 Nov 2017 10:10:29 +0100 Subject: [PATCH 16/17] Correction of default param name for DB port --- script/arcopole/createDBUsingArcopoleModel.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/arcopole/createDBUsingArcopoleModel.sh b/script/arcopole/createDBUsingArcopoleModel.sh index cf2ddb56..ce4b425e 100755 --- a/script/arcopole/createDBUsingArcopoleModel.sh +++ b/script/arcopole/createDBUsingArcopoleModel.sh @@ -58,7 +58,7 @@ if [ "$#" -ne 14 ]; then # REMOTE Arcopole Database information (the database to read) arcopoleDBHost="xxx" - arcopolePort="5432" + arcopoleDBPort="5432" arcopoleDBName="xxx" arcopoleDBSchema="xxx" arcopoleDBUser="xxx" From 17b77d5de8e91cf789bf91a1f5b4f995c669b631 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 17 Nov 2017 11:00:58 +0100 Subject: [PATCH 17/17] Remove 0 from dnupla in RP This fixe #339 --- script/arcopole/views/arcopoleProprieteBatie.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/arcopole/views/arcopoleProprieteBatie.sql b/script/arcopole/views/arcopoleProprieteBatie.sql index a4c6a623..d75659dc 100644 --- a/script/arcopole/views/arcopoleProprieteBatie.sql +++ b/script/arcopole/views/arcopoleProprieteBatie.sql @@ -49,7 +49,7 @@ CREATE MATERIALIZED VIEW #schema_cadastrapp.proprietebatie AS invar.codcomm as cgocommune, regexp_replace(substr(invar.codparc,7,3), ''0{3}'', '''') as ccopre, ltrim(substr(invar.codparc,10,2), ''0'') ccosec , - substr(invar.codparc,12,4) as dnupla, + ltrim(substr(invar.codparc,12,4), ''0'') as dnupla, concat(substr(local.jdatat,1,2),''/'',substr(local.jdatat,3,2),''/'',substr(local.jdatat,5,4)) as jdatat, ltrim(invar.dnvoiri, ''0'') as dnvoiri, invar.dindic,