From eb63ac0a40de2018a418c87d5acf37807b161256 Mon Sep 17 00:00:00 2001 From: Antigravity AI Date: Mon, 6 Apr 2026 12:34:21 -0300 Subject: [PATCH] Reorganización: archivos del proyecto en la raíz del repositorio. Eliminación de estructura anidada incorrecta. --- .agents/rules/gis-geoserver.md | 141 --------------------------------------------------------------------------------------------------------------------------------------------- .gitignore | 30 ++++++++++++++++++++++++++++++ .mvn/wrapper/maven-wrapper.properties | 3 +++ 0 | Bin 0 -> 6112 bytes Dockerfile | 6 ++++++ FdwService.java | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ GIS-GEOSERVER/.mvn/wrapper/maven-wrapper.properties | 3 --- GIS-GEOSERVER/0 | Bin 6112 -> 0 bytes GIS-GEOSERVER/Dockerfile | 6 ------ GIS-GEOSERVER/FdwService.java | 98 -------------------------------------------------------------------------------------------------- GIS-GEOSERVER/GeoServerService.java | 112 ---------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/Jenkinsfile | 77 ----------------------------------------------------------------------------- GIS-GEOSERVER/ProxyController.java | 61 ------------------------------------------------------------- GIS-GEOSERVER/RestTemplateConfig.java | 13 ------------- GIS-GEOSERVER/SecurityConfig.java | 46 ---------------------------------------------- GIS-GEOSERVER/SecurityConfig_master.java | 45 --------------------------------------------- GIS-GEOSERVER/VERSION.txt | 11 ----------- GIS-GEOSERVER/apache_ssl_update.conf | 52 ---------------------------------------------------- GIS-GEOSERVER/application_master.properties | 22 ---------------------- GIS-GEOSERVER/check_geom.sql | 9 --------- GIS-GEOSERVER/check_rule5.sql | 3 --- GIS-GEOSERVER/control_gestion.php | 128 -------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/dbconf.php | 14 -------------- GIS-GEOSERVER/debug_db.sh | 10 ---------- GIS-GEOSERVER/detect_locks.sql | 9 --------- GIS-GEOSERVER/diag_db.sh | 2 -- GIS-GEOSERVER/diag_db_docker.sh | 2 -- GIS-GEOSERVER/diag_fdw.sql | 11 ----------- GIS-GEOSERVER/diag_schema_505.sql | 12 ------------ GIS-GEOSERVER/diag_v28.sh | Bin 282 -> 0 bytes GIS-GEOSERVER/docker-compose-v33.yml | 21 --------------------- GIS-GEOSERVER/docker-compose.integrated.yml | 66 ------------------------------------------------------------------ GIS-GEOSERVER/docker-compose.v18.yml | 26 -------------------------- GIS-GEOSERVER/docker-compose.yml | 66 ------------------------------------------------------------------ GIS-GEOSERVER/docker-compose.yml.remote.tmp | 22 ---------------------- GIS-GEOSERVER/docker-compose_v20.yml | 34 ---------------------------------- GIS-GEOSERVER/docker-compose_v22.yml | 34 ---------------------------------- GIS-GEOSERVER/docker-compose_v24.yml | 34 ---------------------------------- GIS-GEOSERVER/docker-compose_v25.yml | 34 ---------------------------------- GIS-GEOSERVER/docker-compose_v26.yml | 34 ---------------------------------- GIS-GEOSERVER/extensions.sql | 7 ------- GIS-GEOSERVER/extract_carto.sh | 17 ----------------- GIS-GEOSERVER/fix_fdw_direct.sql | 21 --------------------- GIS-GEOSERVER/gwc_lotes.xml | 18 ------------------ GIS-GEOSERVER/gwc_mejoras.xml | 18 ------------------ GIS-GEOSERVER/inject_gis.sh | 12 ------------ GIS-GEOSERVER/liq_por_tipo.php | 35 ----------------------------------- GIS-GEOSERVER/login.html | 225 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/login_institucional_bksp.html | 226 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/loginform.php | 296 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/main_login.php | 110 -------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapa_main.js | 519 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapa_mapStyles.js | 387 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapa_parametros.js | 737 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapas.html | 229 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapas_legacy.html | 757 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapas_repatriado.html | 332 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mapas_restoration.html | 214 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/morosidad_style_wms.sld | 46 ---------------------------------------------- GIS-GEOSERVER/mvnw | 295 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/mvnw.cmd | 189 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/pom.xml | 65 ----------------------------------------------------------------- GIS-GEOSERVER/project.zip | Bin 8190417 -> 0 bytes GIS-GEOSERVER/restore_db_v18.sh | 19 ------------------- GIS-GEOSERVER/run_backup.sh | 4 ---- GIS-GEOSERVER/run_v18_upgrade.sh | 19 ------------------- GIS-GEOSERVER/search_menu.sh | 4 ---- GIS-GEOSERVER/show_fdw.sql | 19 ------------------- GIS-GEOSERVER/sigem_export.gpkg | Bin 23109632 -> 0 bytes GIS-GEOSERVER/sigemtest.yvaga.com.py-le-ssl.conf | 38 -------------------------------------- GIS-GEOSERVER/sigemtest_original.vhost | 106 ---------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/sigemtest_restored.vhost | 96 ------------------------------------------------------------------------------------------------ GIS-GEOSERVER/sigemtest_v20_isolated.vhost | 110 -------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/GisApplication.java | 20 -------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/WebConfig.java | 17 ----------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/config/DataSourceConfig.java | 82 ---------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/AdminController.java | 35 ----------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/GisController.java | 91 ------------------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/ProxyController.java | 54 ------------------------------------------------------ GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/WebViewController.java | 33 --------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthController.java | 108 ------------------------------------------------------------------------------------------------------------ GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthRequest.java | 16 ---------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthResponse.java | 47 ----------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java | 63 --------------------------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtUtil.java | 72 ------------------------------------------------------------------------ GIS-GEOSERVER/src/main/java/com/sigem/gis/security/SecurityConfig.java | 49 ------------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/service/FdwService.java | 164 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/java/com/sigem/gis/service/GeoServerService.java | 156 ------------------------------------------------------------------------------------------------------------------------------------------------------------ GIS-GEOSERVER/src/main/resources/application.properties | 23 ----------------------- GIS-GEOSERVER/src/main/resources/static/landing.html | 220 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/resources/static/login.html | 193 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/resources/static/mapas.html | 769 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/src/main/resources/static/widgets.html | 94 ---------------------------------------------------------------------------------------------- GIS-GEOSERVER/target/classes/application.properties | 23 ----------------------- GIS-GEOSERVER/target/classes/com/sigem/gis/GisApplication.class | Bin 1434 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/WebConfig.class | Bin 1202 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/config/DataSourceConfig.class | Bin 3653 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/controller/AdminController.class | Bin 2958 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/controller/GisController.class | Bin 5347 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/controller/ProxyController.class | Bin 5125 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/controller/WebViewController.class | Bin 1106 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthController.class | Bin 6803 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthRequest.class | Bin 991 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthResponse.class | Bin 2090 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtAuthenticationFilter.class | Bin 3265 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtUtil.class | Bin 5392 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/security/SecurityConfig.class | Bin 9184 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/service/FdwService.class | Bin 8651 -> 0 bytes GIS-GEOSERVER/target/classes/com/sigem/gis/service/GeoServerService.class | Bin 7776 -> 0 bytes GIS-GEOSERVER/target/classes/static/landing.html | 220 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/target/classes/static/login.html | 193 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/target/classes/static/mapas.html | 769 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- GIS-GEOSERVER/target/classes/static/widgets.html | 94 ---------------------------------------------------------------------------------------------- GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar | Bin 49400759 -> 0 bytes GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar.original | Bin 41079 -> 0 bytes GIS-GEOSERVER/target/maven-archiver/pom.properties | 3 --- GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst | 15 --------------- GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst | 15 --------------- GIS-GEOSERVER/tomcat-users.xml | 16 ---------------- GIS-GEOSERVER/upgrade_to_v18.sh | 26 -------------------------- GIS-GEOSERVER/upload_geojson.sh | 16 ---------------- GIS-GEOSERVER/verify_db.sh | 6 ------ GIS-GEOSERVER/yvyape_vhost.txt | 20 -------------------- GeoServerService.java | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Jenkinsfile | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ProxyController.java | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ RestTemplateConfig.java | 13 +++++++++++++ SecurityConfig.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++ SecurityConfig_master.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ VERSION.txt | 11 +++++++++++ apache_ssl_update.conf | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ application_master.properties | 22 ++++++++++++++++++++++ check_geom.sql | 9 +++++++++ check_rule5.sql | 3 +++ control_gestion.php | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ dbconf.php | 14 ++++++++++++++ debug_db.sh | 10 ++++++++++ detect_locks.sql | 9 +++++++++ diag_db.sh | 2 ++ diag_db_docker.sh | 2 ++ diag_fdw.sql | 11 +++++++++++ diag_schema_505.sql | 12 ++++++++++++ diag_v28.sh | Bin 0 -> 282 bytes docker-compose-v33.yml | 21 +++++++++++++++++++++ docker-compose.integrated.yml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.v18.yml | 26 ++++++++++++++++++++++++++ docker-compose.yml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ docker-compose_v20.yml | 34 ++++++++++++++++++++++++++++++++++ docker-compose_v22.yml | 34 ++++++++++++++++++++++++++++++++++ docker-compose_v24.yml | 34 ++++++++++++++++++++++++++++++++++ docker-compose_v25.yml | 34 ++++++++++++++++++++++++++++++++++ docker-compose_v26.yml | 34 ++++++++++++++++++++++++++++++++++ extensions.sql | 7 +++++++ extract_carto.sh | 17 +++++++++++++++++ fix_fdw_direct.sql | 21 +++++++++++++++++++++ gwc_lotes.xml | 18 ++++++++++++++++++ gwc_mejoras.xml | 18 ++++++++++++++++++ inject_gis.sh | 12 ++++++++++++ liq_por_tipo.php | 35 +++++++++++++++++++++++++++++++++++ login.html | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ login_institucional_bksp.html | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ loginform.php | 296 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ main_login.php | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapa_main.js | 519 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapa_mapStyles.js | 387 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapa_parametros.js | 737 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapas.html | 229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapas_legacy.html | 757 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapas_repatriado.html | 332 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mapas_restoration.html | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ morosidad_style_wms.sld | 46 ++++++++++++++++++++++++++++++++++++++++++++++ mvnw | 295 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mvnw.cmd | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ pom.xml | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ restore_db_v18.sh | 19 +++++++++++++++++++ run_backup.sh | 4 ++++ run_v18_upgrade.sh | 19 +++++++++++++++++++ search_menu.sh | 4 ++++ show_fdw.sql | 19 +++++++++++++++++++ sigem_kafka | 1 - sigemtest.yvaga.com.py-le-ssl.conf | 38 ++++++++++++++++++++++++++++++++++++++ sigemtest_original.vhost | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sigemtest_restored.vhost | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sigemtest_v20_isolated.vhost | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/GisApplication.java | 20 ++++++++++++++++++++ src/main/java/com/sigem/gis/WebConfig.java | 17 +++++++++++++++++ src/main/java/com/sigem/gis/config/DataSourceConfig.java | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/controller/AdminController.java | 35 +++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/controller/GisController.java | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/controller/ProxyController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/controller/WebViewController.java | 33 +++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/security/AuthController.java | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/security/AuthRequest.java | 16 ++++++++++++++++ src/main/java/com/sigem/gis/security/AuthResponse.java | 47 +++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/security/JwtUtil.java | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/security/SecurityConfig.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/service/FdwService.java | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/java/com/sigem/gis/service/GeoServerService.java | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/application.properties | 23 +++++++++++++++++++++++ src/main/resources/static/landing.html | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/static/login.html | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/static/mapas.html | 769 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/main/resources/static/widgets.html | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tomcat-users.xml | 16 ++++++++++++++++ upgrade_to_v18.sh | 26 ++++++++++++++++++++++++++ upload_geojson.sh | 16 ++++++++++++++++ verify_db.sh | 6 ++++++ yvyape_vhost.txt | 20 ++++++++++++++++++++ 209 files changed, 8685 insertions(+), 10151 deletions(-) delete mode 100644 .agents/rules/gis-geoserver.md create mode 100644 .gitignore create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100644 0 create mode 100644 Dockerfile create mode 100644 FdwService.java delete mode 100644 GIS-GEOSERVER/.mvn/wrapper/maven-wrapper.properties delete mode 100644 GIS-GEOSERVER/0 delete mode 100644 GIS-GEOSERVER/Dockerfile delete mode 100644 GIS-GEOSERVER/FdwService.java delete mode 100644 GIS-GEOSERVER/GeoServerService.java delete mode 100644 GIS-GEOSERVER/Jenkinsfile delete mode 100644 GIS-GEOSERVER/ProxyController.java delete mode 100644 GIS-GEOSERVER/RestTemplateConfig.java delete mode 100644 GIS-GEOSERVER/SecurityConfig.java delete mode 100644 GIS-GEOSERVER/SecurityConfig_master.java delete mode 100644 GIS-GEOSERVER/VERSION.txt delete mode 100644 GIS-GEOSERVER/apache_ssl_update.conf delete mode 100644 GIS-GEOSERVER/application_master.properties delete mode 100644 GIS-GEOSERVER/check_geom.sql delete mode 100644 GIS-GEOSERVER/check_rule5.sql delete mode 100644 GIS-GEOSERVER/control_gestion.php delete mode 100644 GIS-GEOSERVER/dbconf.php delete mode 100644 GIS-GEOSERVER/debug_db.sh delete mode 100644 GIS-GEOSERVER/detect_locks.sql delete mode 100644 GIS-GEOSERVER/diag_db.sh delete mode 100644 GIS-GEOSERVER/diag_db_docker.sh delete mode 100644 GIS-GEOSERVER/diag_fdw.sql delete mode 100644 GIS-GEOSERVER/diag_schema_505.sql delete mode 100644 GIS-GEOSERVER/diag_v28.sh delete mode 100644 GIS-GEOSERVER/docker-compose-v33.yml delete mode 100644 GIS-GEOSERVER/docker-compose.integrated.yml delete mode 100644 GIS-GEOSERVER/docker-compose.v18.yml delete mode 100644 GIS-GEOSERVER/docker-compose.yml delete mode 100644 GIS-GEOSERVER/docker-compose.yml.remote.tmp delete mode 100644 GIS-GEOSERVER/docker-compose_v20.yml delete mode 100644 GIS-GEOSERVER/docker-compose_v22.yml delete mode 100644 GIS-GEOSERVER/docker-compose_v24.yml delete mode 100644 GIS-GEOSERVER/docker-compose_v25.yml delete mode 100644 GIS-GEOSERVER/docker-compose_v26.yml delete mode 100644 GIS-GEOSERVER/extensions.sql delete mode 100644 GIS-GEOSERVER/extract_carto.sh delete mode 100644 GIS-GEOSERVER/fix_fdw_direct.sql delete mode 100644 GIS-GEOSERVER/gwc_lotes.xml delete mode 100644 GIS-GEOSERVER/gwc_mejoras.xml delete mode 100644 GIS-GEOSERVER/inject_gis.sh delete mode 100644 GIS-GEOSERVER/liq_por_tipo.php delete mode 100644 GIS-GEOSERVER/login.html delete mode 100644 GIS-GEOSERVER/login_institucional_bksp.html delete mode 100644 GIS-GEOSERVER/loginform.php delete mode 100644 GIS-GEOSERVER/main_login.php delete mode 100644 GIS-GEOSERVER/mapa_main.js delete mode 100644 GIS-GEOSERVER/mapa_mapStyles.js delete mode 100644 GIS-GEOSERVER/mapa_parametros.js delete mode 100644 GIS-GEOSERVER/mapas.html delete mode 100644 GIS-GEOSERVER/mapas_legacy.html delete mode 100644 GIS-GEOSERVER/mapas_repatriado.html delete mode 100644 GIS-GEOSERVER/mapas_restoration.html delete mode 100644 GIS-GEOSERVER/morosidad_style_wms.sld delete mode 100644 GIS-GEOSERVER/mvnw delete mode 100644 GIS-GEOSERVER/mvnw.cmd delete mode 100644 GIS-GEOSERVER/pom.xml delete mode 100644 GIS-GEOSERVER/project.zip delete mode 100644 GIS-GEOSERVER/restore_db_v18.sh delete mode 100644 GIS-GEOSERVER/run_backup.sh delete mode 100644 GIS-GEOSERVER/run_v18_upgrade.sh delete mode 100644 GIS-GEOSERVER/search_menu.sh delete mode 100644 GIS-GEOSERVER/show_fdw.sql delete mode 100644 GIS-GEOSERVER/sigem_export.gpkg delete mode 100644 GIS-GEOSERVER/sigemtest.yvaga.com.py-le-ssl.conf delete mode 100644 GIS-GEOSERVER/sigemtest_original.vhost delete mode 100644 GIS-GEOSERVER/sigemtest_restored.vhost delete mode 100644 GIS-GEOSERVER/sigemtest_v20_isolated.vhost delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/GisApplication.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/WebConfig.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/config/DataSourceConfig.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/AdminController.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/GisController.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/ProxyController.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/WebViewController.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthController.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthRequest.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthResponse.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtUtil.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/security/SecurityConfig.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/service/FdwService.java delete mode 100644 GIS-GEOSERVER/src/main/java/com/sigem/gis/service/GeoServerService.java delete mode 100644 GIS-GEOSERVER/src/main/resources/application.properties delete mode 100644 GIS-GEOSERVER/src/main/resources/static/landing.html delete mode 100644 GIS-GEOSERVER/src/main/resources/static/login.html delete mode 100644 GIS-GEOSERVER/src/main/resources/static/mapas.html delete mode 100644 GIS-GEOSERVER/src/main/resources/static/widgets.html delete mode 100644 GIS-GEOSERVER/target/classes/application.properties delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/GisApplication.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/WebConfig.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/config/DataSourceConfig.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/controller/AdminController.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/controller/GisController.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/controller/ProxyController.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/controller/WebViewController.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthController.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthRequest.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthResponse.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtAuthenticationFilter.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtUtil.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/security/SecurityConfig.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/service/FdwService.class delete mode 100644 GIS-GEOSERVER/target/classes/com/sigem/gis/service/GeoServerService.class delete mode 100644 GIS-GEOSERVER/target/classes/static/landing.html delete mode 100644 GIS-GEOSERVER/target/classes/static/login.html delete mode 100644 GIS-GEOSERVER/target/classes/static/mapas.html delete mode 100644 GIS-GEOSERVER/target/classes/static/widgets.html delete mode 100644 GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar delete mode 100644 GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar.original delete mode 100644 GIS-GEOSERVER/target/maven-archiver/pom.properties delete mode 100644 GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst delete mode 100644 GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst delete mode 100644 GIS-GEOSERVER/tomcat-users.xml delete mode 100644 GIS-GEOSERVER/upgrade_to_v18.sh delete mode 100644 GIS-GEOSERVER/upload_geojson.sh delete mode 100644 GIS-GEOSERVER/verify_db.sh delete mode 100644 GIS-GEOSERVER/yvyape_vhost.txt create mode 100644 GeoServerService.java create mode 100644 Jenkinsfile create mode 100644 ProxyController.java create mode 100644 RestTemplateConfig.java create mode 100644 SecurityConfig.java create mode 100644 SecurityConfig_master.java create mode 100644 VERSION.txt create mode 100644 apache_ssl_update.conf create mode 100644 application_master.properties create mode 100644 check_geom.sql create mode 100644 check_rule5.sql create mode 100644 control_gestion.php create mode 100644 dbconf.php create mode 100644 debug_db.sh create mode 100644 detect_locks.sql create mode 100644 diag_db.sh create mode 100644 diag_db_docker.sh create mode 100644 diag_fdw.sql create mode 100644 diag_schema_505.sql create mode 100644 diag_v28.sh create mode 100644 docker-compose-v33.yml create mode 100644 docker-compose.integrated.yml create mode 100644 docker-compose.v18.yml create mode 100644 docker-compose.yml create mode 100644 docker-compose_v20.yml create mode 100644 docker-compose_v22.yml create mode 100644 docker-compose_v24.yml create mode 100644 docker-compose_v25.yml create mode 100644 docker-compose_v26.yml create mode 100644 extensions.sql create mode 100644 extract_carto.sh create mode 100644 fix_fdw_direct.sql create mode 100644 gwc_lotes.xml create mode 100644 gwc_mejoras.xml create mode 100644 inject_gis.sh create mode 100644 liq_por_tipo.php create mode 100644 login.html create mode 100644 login_institucional_bksp.html create mode 100644 loginform.php create mode 100644 main_login.php create mode 100644 mapa_main.js create mode 100644 mapa_mapStyles.js create mode 100644 mapa_parametros.js create mode 100644 mapas.html create mode 100644 mapas_legacy.html create mode 100644 mapas_repatriado.html create mode 100644 mapas_restoration.html create mode 100644 morosidad_style_wms.sld create mode 100644 mvnw create mode 100644 mvnw.cmd create mode 100644 pom.xml create mode 100644 restore_db_v18.sh create mode 100644 run_backup.sh create mode 100644 run_v18_upgrade.sh create mode 100644 search_menu.sh create mode 100644 show_fdw.sql delete mode 160000 sigem_kafka create mode 100644 sigemtest.yvaga.com.py-le-ssl.conf create mode 100644 sigemtest_original.vhost create mode 100644 sigemtest_restored.vhost create mode 100644 sigemtest_v20_isolated.vhost create mode 100644 src/main/java/com/sigem/gis/GisApplication.java create mode 100644 src/main/java/com/sigem/gis/WebConfig.java create mode 100644 src/main/java/com/sigem/gis/config/DataSourceConfig.java create mode 100644 src/main/java/com/sigem/gis/controller/AdminController.java create mode 100644 src/main/java/com/sigem/gis/controller/GisController.java create mode 100644 src/main/java/com/sigem/gis/controller/ProxyController.java create mode 100644 src/main/java/com/sigem/gis/controller/WebViewController.java create mode 100644 src/main/java/com/sigem/gis/security/AuthController.java create mode 100644 src/main/java/com/sigem/gis/security/AuthRequest.java create mode 100644 src/main/java/com/sigem/gis/security/AuthResponse.java create mode 100644 src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java create mode 100644 src/main/java/com/sigem/gis/security/JwtUtil.java create mode 100644 src/main/java/com/sigem/gis/security/SecurityConfig.java create mode 100644 src/main/java/com/sigem/gis/service/FdwService.java create mode 100644 src/main/java/com/sigem/gis/service/GeoServerService.java create mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/static/landing.html create mode 100644 src/main/resources/static/login.html create mode 100644 src/main/resources/static/mapas.html create mode 100644 src/main/resources/static/widgets.html create mode 100644 tomcat-users.xml create mode 100644 upgrade_to_v18.sh create mode 100644 upload_geojson.sh create mode 100644 verify_db.sh create mode 100644 yvyape_vhost.txt diff --git a/.agents/rules/gis-geoserver.md b/.agents/rules/gis-geoserver.md deleted file mode 100644 index f562f5e..0000000 --- a/.agents/rules/gis-geoserver.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -trigger: always_on ---- - -Regla 0. Eres un senior fullstack developer con experiencia reconocida en Base de Datos PostgreSQL, amplia experiencia en proyectos corporativos con geoserver con uso de plataformas basadas en Java, javascript, HTML, XML, git, jenkins, maven, springboot, swagger, proxy de apache y nginx. - -Regla 1. El ambiente de desarrollo y compilación se encuentra en el 192.168.1.123. -El JENKINS a usar está en este servidor. Los comandos del jenkins se ejecutan en el servidor 192.168.1.123. -El MAVEN a usar está en este servidor. Los comandos maven se ejecutan en el servidor 192.168.1.123. -El DOCKER a usar está en el servidor 192.168.1.123. Los comandos docker se ejecutan en el servidor192.168.1.123. -Todas las compilaciones se ejecutarán en el servidor 192.168.1.123. - -La base de datos georreferenciada SIGEM del Postgis está en este servidor y el superuser es el usuario registrado en el motor de base de datos como: -Usuario: sigem_user -Contraseña: sigem_pass - -Regla 2. Las bases de datos alfanuméricas de los municipios a usar vinculadas a la base de datos georreferenciada Postgis serán definidas dinámicamente usando la tabla ENTIDADES la Base de Datos SIGEMWEB en el servidor 192.168.1.254 - -Regla 3. El proxypass principal de redireccionamiento reside en el servidor 192.168.1.10 - -El proxypass maestro de redireccionamiento reside en el servidor 192.168.1.20 - -Regla 4. Para el LOGIN, el código del municipio es seleccionado por el usuario de la aplicación al loguearse. -Para el LOGIN siempre se utiliza en año actual. -Para las pruebas de LOGIN se usa el usuario 'operador' y el pase 'ataj800306465'. - -Regla 5. Los parámetros para la visualización y despliegue de mapas en el geoserver deberá usarse el registro correspondiente al municipio que se obtiene en la tabla ENTIDADES. El código del municipio es seleccionado por el usuario de la aplicación al loguearse. -Por ejemplo: -select * from public.entidades WHERE activo= TRUE AND entidad= 505 ; - -Los parámetros disponibles son: - sigem_site character varying(100) - sigem_dbname character varying(100) - latlong character varying(70) - lng character varying(35) - lat character varying(35) - zoom character varying(2) - mapa_base character varying(100) - boundno character varying(70) - boundse character varying(70) - maxzoom character varying(2) - minzoom character varying(2) - -La base de datos del municipio con los datos de liquidaciones de deudas y pagos se encuentran la base de datos remota referida por las columnas sigem_site y sigem_dbname para definir el string de conexión incluida credenciales. Se usa la tabla ENTIDADES de la Base de Datos SIGEMWEB del servidor 192.168.1.254 y se use el registro correspondiente a la entidad seleccionada usando la columna entidad. - -La visualización de mapas será en 2D y no se usará 3D en este proyecto. - -El servicio de Postgres Versión 17 en el servidor 192.168.1.254 usa el puerto 5432, usuario: postgres y password: x25yvaga2017 - -Regla 6. Para la construcción en la compilación, se usa JAVA21 del 192.168.1.123 - -Regla 7. Credenciales para acceso al 192.168.1.123 -cbareiro/x25yvaga2023 -root/x25yvaga2023 - -Regla 8. Credenciales para acceso al 192.168.1.10 -cbareiro/x25yvaga2020 -root/x25yvaga2021 - -Regla 9. Credenciales para acceso al 192.168.1.20 -cbareiro/x25yvaga2020 -root/x25yvaga2020 - -Regla 10. Credenciales para acceso al 192.168.1.129 -cbareiro/x25yvaga2025 - -Regla 11. Credenciales para JENKINS EN 192.168.1.123 -Usuario: admin -Contraseña: x25yvaga2024 - -Regla 12. Para el despliegue del módulo GIS, el Jenkinsfile ya tiene configurado el ID de credencial SSH como sigem-server-123, el cual utiliza el usuario root para las operaciones automáticas de scp y docker compose en ese servidor. - -Regla 13. Apache Tomcat -Los siguientes usuarios estan configurados en Tomcat para la administracion del servidor de -aplicaciones y el despliegue de servicios. Cada usuario tiene roles especificos asignados. - -Tomcat Manager -Usuario Password -usuario: manager pase: x25yvaga2023 Roles: manager-gui - -admin geoserver admin, manager-gui -GeoServer Web UI -usuario: admin pase: geoserver Roles: admin, manager-gui -http://192.168.1.123:8080/geoserver - -Regla 14. Administración del GEOSERVER. -Los siguientes endpoints son los puntos de acceso principales del sistema GeoServer desplegado: -Servicio URL -GeoServer Web UI http://192.168.1.123:8080/geoserver -Tomcat Manager http://192.168.1.123:8080/manager/html -WMS (Mapas) http://192.168.1.123:8080/geoserver/wms -WFS (Vectores) http://192.168.1.123:8080/geoserver/wfs -WCS (Coberturas) http://192.168.1.123:8080/geoserver/wcs -REST API http://192.168.1.123:8080/geoserver/rest - -Regla 15. La aplicación se desplegará en el servidor 192.168.1.123 -La carpeta de trabajo es: /yvyape/proyectos/sigem-gis - -Regla 16. Conexión FDW y Sincronización de Vistas. -Esta conexión vía Foreign Data Wrapper deberá utilizarse para toda consulta que requiera obtener datos de la base de datos remota del municipio. -La aplicación GIS-GEOSERVER procederá a usar el código del municipio seleccionado en el LOGIN por parte del usuario. Si el valor de la columna ACTIVO = true entonces se verificará si existe el FDW de ese municipio. Si no existe que lo cree para el servidor de ese municipio en la base de datos georreferenciada del GIS-GEOSERVER. -Independientemente de si el FDW ya existía, el sistema debe **recrear o refrescar obligatoriamente** las vistas de unión locales (`vw_lotes_morosidad_X` y `vw_mejoras_morosidad_X`) en cada LOGIN o actualización manual para asegurar la sincronización de los datos numéricos de morosidad. - -Regla 17. Para el repositorio de código fuente se usa el servidor de git 192.168.1.100 Para acceso al repositorio git usar usuario: cbareiro@yvaga.com.py y password carlos57 -Para la conexión al proyecto git se usa git@git.yvaga.com.py:geo/gis-geoserver.git con SSH. -Para la conexión al proyecto git se usa http://git.yvaga.com.py/geo/gis-geoserver.git con HTTP. - -Regla 18. Para usar SSH desde el equipo local Windows 11, debes usar la aplicación Bitvise con usuario cbareiro. - -Regla 19: Uso obligatorio de ./mvnw clean package -DskipTests para builds ágiles. - -Regla 20. Para el FrontEnd las llamadas usarán /gis-geoserver/ como prefijo base. -El acceso al FrontEnd será por https://sigemtest.yvaga.com.py/gis-geoserver/login. - -Regla 21. Para el BackEnd el camino es server.servlet.context-path=/gis-geoserver. - -Regla 22: Integridad de Comandos Remotos (Bitvise) -Está vinculada a la Regla 18. -Queda prohibido el uso de comandos printf, echo o concatenaciones multilínea complejas directamente dentro de sexec para crear archivos en el servidor. -Ante la necesidad de crear o modificar un archivo completo (como docker-compose.yml o Dockerfile), se debe crear el archivo localmente primero y utilizar sftpc para subirlo. Esto garantiza que el contenido llegue íntegro y sin errores de formato causados por el shell de Windows. - -Regla 23. Columnas de Unión (Joins). -Para toda vista de unión entre tablas locales del GIS (`eXXX_lotes_conccc`, `eXXX_mejoras`) y las tablas remotas del FDW, se debe utilizar obligatoriamente la columna **`ccc`** (Clave Catastral Común) como clave de relación. Queda prohibido el uso de la columna `lote_codigo` para este fin en la Entidad 505 y sucesivas que compartan el mismo esquema. -Esta es la definición de vista que funciona: -CREATE OR REPLACE VIEW public.vw_lotes_morosidad_505 AS -SELECT - l.*, - m.inm_ficha, - m.inm_ctacatastral, - m.trb_total_deuda, - m.trb_total_pago, - m.ultimo_pago -FROM public.e505_lotes_conccc l -LEFT JOIN fdw_505.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral - -Regla 24. Resiliencia del LOGIN. -Toda orquestación de servicios secundarios (GeoServer REST API, habilitación de MVT, etc.) invocada durante el proceso de LOGIN debe ser **no-bloqueante**. Esto implica el uso obligatorio de bloques `try-catch` para capturar cualquier fallo externo y la configuración de un tiempo de espera (**timeout**) máximo de **2 segundo** por conexión, para no comprometer la fluidez del acceso al sistema. - -Regla 25. Protocolo de Registro de Logros (Hitos). -Ante cada logro o funcionalidad nueva validada que requiera un registro oficial, se añadirá (append) una entrada al archivo `VERSION.txt` (local y remoto) en formato texto plano, siguiendo el formato: "Version SIG (Abril 2026) - AAAA.MM.DD.HH.MM.SS ID DOCKER: ". Aqui´se debería agregar el id único del docker usado, A esto se le debe agregar un texto de observación mío. -Este registro oficial deberá ser autorizado por el usuario. Se aplica solamente por indicaciones del usuario cuando confirme algún hito de éxito que le interese. \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e0dbdfc --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +# Build artifacts +target/ +*.jar +*.war +*.class + +# Maven wrapper cache +.mvn/repository/ + +# IDE files +.idea/ +*.iml +.vscode/ +*.swp + +# Temp and logs +*.log +*.tmp +*.bak + +# Docker temp +docker-compose.yml.remote.tmp + +# Binary / export files +*.gpkg +project.zip + +# Not related to this project +sigem_kafka/ +.agents/ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..c595b00 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,3 @@ +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.14/apache-maven-3.9.14-bin.zip diff --git a/0 b/0 new file mode 100644 index 0000000..589ed04 Binary files /dev/null and b/0 differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ad46747 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM eclipse-temurin:21-jdk-alpine +VOLUME /tmp +ARG JAR_FILE=gis-geoserver-0.0.1-SNAPSHOT.jar +COPY ${JAR_FILE} app.jar +EXPOSE 8081 +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] diff --git a/FdwService.java b/FdwService.java new file mode 100644 index 0000000..fd5d30e --- /dev/null +++ b/FdwService.java @@ -0,0 +1,98 @@ +package com.sigem.gis.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; +import java.util.List; +import java.util.Map; + +@Service +public class FdwService { + + @Autowired + private GeoServerService geoServerService; + + @Autowired + @Qualifier("masterJdbcTemplate") + private JdbcTemplate masterJdbcTemplate; + + @Autowired + @Qualifier("gisJdbcTemplate") + private JdbcTemplate gisJdbcTemplate; + + public void setupFdw(String entidadId) { + String sqlEntidad = "SELECT sigem_site, sigem_dbname, boundno, boundse, latlong, zoom, maxzoom, minzoom FROM public.entidades WHERE entidad = ?"; + List> entidades = masterJdbcTemplate.queryForList(sqlEntidad, Integer.parseInt(entidadId)); + + if (entidades.isEmpty()) throw new RuntimeException("Entidad " + entidadId + " no encontrada."); + + Map data = entidades.get(0); + String sigemSite = (String) data.get("sigem_site"); + String sigemDbname = (String) data.get("sigem_dbname"); + String boundNo = (String) data.get("boundno"); + String boundSe = (String) data.get("boundse"); + + String host = extractParam(sigemSite, "host", "127.0.0.1"); + String port = extractParam(sigemSite, "port", "5432"); + String user = extractParam(sigemSite, "user", "postgres"); + String pass = extractParam(sigemSite, "password", "x25yvaga2017"); + + String serverName = "srv_mun_" + entidadId; + String schemaName = "fdw_" + entidadId; + + try { + gisJdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS postgres_fdw"); + gisJdbcTemplate.execute("DROP SERVER IF EXISTS " + serverName + " CASCADE"); + gisJdbcTemplate.execute(String.format("CREATE SERVER %s FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '%s', port '%s', dbname '%s')", serverName, host, port, sigemDbname)); + gisJdbcTemplate.execute(String.format("CREATE USER MAPPING FOR sigem_user SERVER %s OPTIONS (user '%s', password '%s')", serverName, user, pass)); + gisJdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + gisJdbcTemplate.execute(String.format("IMPORT FOREIGN SCHEMA public LIMIT TO (v_liq_entidad_totalxobjeto, v_liq_entidad_percentiles, usuarios, ventanas_usuario) FROM SERVER %s INTO %s", serverName, schemaName)); + + // REGLA 23 ACTUALIZADA: Join OBLIGATORIO por CCC = INM_CTACATASTRAL + String tableLotes = "public.e" + entidadId + "_lotes_conccc"; + String viewName = "vw_lotes_morosidad_" + entidadId; + String viewWms = "vw_lotes_wms_" + entidadId; + String sqlJoin = String.format("CREATE OR REPLACE VIEW public.%s AS SELECT l.*, m.inm_ficha, m.inm_ctacatastral, m.trb_total_deuda, m.trb_total_pago, m.ultimo_pago FROM %s l LEFT JOIN %s.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral", viewName, tableLotes, schemaName); + + gisJdbcTemplate.execute(sqlJoin); + gisJdbcTemplate.execute(sqlJoin.replace(viewName, viewWms)); + + try { + geoServerService.publishLayer(viewName, viewName, null, boundNo, boundSe); + enableMvt(viewName); + geoServerService.truncateCache(viewName); + geoServerService.publishLayer(viewWms, viewWms, "morosidad_style_wms", boundNo, boundSe); + geoServerService.truncateCache(viewWms); + } catch (Exception e) { System.err.println("Advertencia GS: " + e.getMessage()); } + + } catch (Exception e) { throw new RuntimeException("Error FDW: " + e.getMessage(), e); } + } + + private String extractParam(String siteParam, String key, String defaultValue) { + if (siteParam != null && siteParam.contains(key + "=")) { + String[] parts = siteParam.split(key + "="); + if (parts.length > 1) return parts[1].split(" ")[0].trim(); + } + return defaultValue; + } + + public void enableMvt(String layerName) { + // Hablar con host interno proyecto-geoserver-1 + String geoserverUrl = "http://proyecto-geoserver-1:8080/geoserver/gwc/rest/layers/sigem:" + layerName + ".xml"; + String auth = "admin:geoserver"; + String encodedAuth = java.util.Base64.getEncoder().encodeToString(auth.getBytes()); + String xmlBody = "trueapplication/x-protobuf"; + try { + java.net.URL url = new java.net.URL(geoserverUrl); + java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Authorization", "Basic " + encodedAuth); + conn.setRequestProperty("Content-Type", "text/xml"); + conn.setDoOutput(true); + conn.setConnectTimeout(2000); + try (java.io.OutputStream os = conn.getOutputStream()) { os.write(xmlBody.getBytes()); } + conn.getResponseCode(); + } catch (Exception e) { System.err.println("Error MVT: " + e.getMessage()); } + } +} diff --git a/GIS-GEOSERVER/.mvn/wrapper/maven-wrapper.properties b/GIS-GEOSERVER/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index c595b00..0000000 --- a/GIS-GEOSERVER/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1,3 +0,0 @@ -wrapperVersion=3.3.4 -distributionType=only-script -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.14/apache-maven-3.9.14-bin.zip diff --git a/GIS-GEOSERVER/0 b/GIS-GEOSERVER/0 deleted file mode 100644 index 589ed04..0000000 Binary files a/GIS-GEOSERVER/0 and /dev/null differ diff --git a/GIS-GEOSERVER/Dockerfile b/GIS-GEOSERVER/Dockerfile deleted file mode 100644 index ad46747..0000000 --- a/GIS-GEOSERVER/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM eclipse-temurin:21-jdk-alpine -VOLUME /tmp -ARG JAR_FILE=gis-geoserver-0.0.1-SNAPSHOT.jar -COPY ${JAR_FILE} app.jar -EXPOSE 8081 -ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] diff --git a/GIS-GEOSERVER/FdwService.java b/GIS-GEOSERVER/FdwService.java deleted file mode 100644 index fd5d30e..0000000 --- a/GIS-GEOSERVER/FdwService.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.sigem.gis.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; -import java.util.List; -import java.util.Map; - -@Service -public class FdwService { - - @Autowired - private GeoServerService geoServerService; - - @Autowired - @Qualifier("masterJdbcTemplate") - private JdbcTemplate masterJdbcTemplate; - - @Autowired - @Qualifier("gisJdbcTemplate") - private JdbcTemplate gisJdbcTemplate; - - public void setupFdw(String entidadId) { - String sqlEntidad = "SELECT sigem_site, sigem_dbname, boundno, boundse, latlong, zoom, maxzoom, minzoom FROM public.entidades WHERE entidad = ?"; - List> entidades = masterJdbcTemplate.queryForList(sqlEntidad, Integer.parseInt(entidadId)); - - if (entidades.isEmpty()) throw new RuntimeException("Entidad " + entidadId + " no encontrada."); - - Map data = entidades.get(0); - String sigemSite = (String) data.get("sigem_site"); - String sigemDbname = (String) data.get("sigem_dbname"); - String boundNo = (String) data.get("boundno"); - String boundSe = (String) data.get("boundse"); - - String host = extractParam(sigemSite, "host", "127.0.0.1"); - String port = extractParam(sigemSite, "port", "5432"); - String user = extractParam(sigemSite, "user", "postgres"); - String pass = extractParam(sigemSite, "password", "x25yvaga2017"); - - String serverName = "srv_mun_" + entidadId; - String schemaName = "fdw_" + entidadId; - - try { - gisJdbcTemplate.execute("CREATE EXTENSION IF NOT EXISTS postgres_fdw"); - gisJdbcTemplate.execute("DROP SERVER IF EXISTS " + serverName + " CASCADE"); - gisJdbcTemplate.execute(String.format("CREATE SERVER %s FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '%s', port '%s', dbname '%s')", serverName, host, port, sigemDbname)); - gisJdbcTemplate.execute(String.format("CREATE USER MAPPING FOR sigem_user SERVER %s OPTIONS (user '%s', password '%s')", serverName, user, pass)); - gisJdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); - gisJdbcTemplate.execute(String.format("IMPORT FOREIGN SCHEMA public LIMIT TO (v_liq_entidad_totalxobjeto, v_liq_entidad_percentiles, usuarios, ventanas_usuario) FROM SERVER %s INTO %s", serverName, schemaName)); - - // REGLA 23 ACTUALIZADA: Join OBLIGATORIO por CCC = INM_CTACATASTRAL - String tableLotes = "public.e" + entidadId + "_lotes_conccc"; - String viewName = "vw_lotes_morosidad_" + entidadId; - String viewWms = "vw_lotes_wms_" + entidadId; - String sqlJoin = String.format("CREATE OR REPLACE VIEW public.%s AS SELECT l.*, m.inm_ficha, m.inm_ctacatastral, m.trb_total_deuda, m.trb_total_pago, m.ultimo_pago FROM %s l LEFT JOIN %s.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral", viewName, tableLotes, schemaName); - - gisJdbcTemplate.execute(sqlJoin); - gisJdbcTemplate.execute(sqlJoin.replace(viewName, viewWms)); - - try { - geoServerService.publishLayer(viewName, viewName, null, boundNo, boundSe); - enableMvt(viewName); - geoServerService.truncateCache(viewName); - geoServerService.publishLayer(viewWms, viewWms, "morosidad_style_wms", boundNo, boundSe); - geoServerService.truncateCache(viewWms); - } catch (Exception e) { System.err.println("Advertencia GS: " + e.getMessage()); } - - } catch (Exception e) { throw new RuntimeException("Error FDW: " + e.getMessage(), e); } - } - - private String extractParam(String siteParam, String key, String defaultValue) { - if (siteParam != null && siteParam.contains(key + "=")) { - String[] parts = siteParam.split(key + "="); - if (parts.length > 1) return parts[1].split(" ")[0].trim(); - } - return defaultValue; - } - - public void enableMvt(String layerName) { - // Hablar con host interno proyecto-geoserver-1 - String geoserverUrl = "http://proyecto-geoserver-1:8080/geoserver/gwc/rest/layers/sigem:" + layerName + ".xml"; - String auth = "admin:geoserver"; - String encodedAuth = java.util.Base64.getEncoder().encodeToString(auth.getBytes()); - String xmlBody = "trueapplication/x-protobuf"; - try { - java.net.URL url = new java.net.URL(geoserverUrl); - java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection(); - conn.setRequestMethod("POST"); - conn.setRequestProperty("Authorization", "Basic " + encodedAuth); - conn.setRequestProperty("Content-Type", "text/xml"); - conn.setDoOutput(true); - conn.setConnectTimeout(2000); - try (java.io.OutputStream os = conn.getOutputStream()) { os.write(xmlBody.getBytes()); } - conn.getResponseCode(); - } catch (Exception e) { System.err.println("Error MVT: " + e.getMessage()); } - } -} diff --git a/GIS-GEOSERVER/GeoServerService.java b/GIS-GEOSERVER/GeoServerService.java deleted file mode 100644 index 53f8d5b..0000000 --- a/GIS-GEOSERVER/GeoServerService.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.sigem.gis.service; - -import org.springframework.http.*; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class GeoServerService { - - private final String GS_URL = "http://proyecto-geoserver-1:8080/geoserver/rest"; - private final String GS_USER = "admin"; - private final String GS_PASS = "geoserver"; - - private final RestTemplate restTemplate; - - public GeoServerService() { - org.springframework.http.client.SimpleClientHttpRequestFactory factory = new org.springframework.http.client.SimpleClientHttpRequestFactory(); - factory.setConnectTimeout(2000); - factory.setReadTimeout(2000); - this.restTemplate = new RestTemplate(factory); - } - - public void ensureStyleExists(String styleName) { - String url = GS_URL + "/styles/" + styleName; - try { - restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); - } catch (Exception e) { - String sldBody = "" + - "" + - "morosidad_style_wms" + - "Verdeultimo_pago2026#71de75#0000000.2" + - "Ambarultimo_pago2024#ffaa00#0000000.2" + - "Rojoultimo_pago2023#f87171#0000000.2" + - "#94a3b80.4" + - ""; - - try { - // Crear el estilo - String createJson = String.format("{\"style\": {\"name\": \"%s\", \"filename\": \"%s.sld\"}}", styleName, styleName); - HttpHeaders h = createHeaders(); - h.setContentType(MediaType.APPLICATION_JSON); - restTemplate.postForEntity(GS_URL + "/styles", new HttpEntity<>(createJson, h), String.class); - - // Subir el SLD - HttpHeaders sldHeaders = createHeaders(); - sldHeaders.setContentType(MediaType.parseMediaType("application/vnd.ogc.sld+xml")); - restTemplate.exchange(url, HttpMethod.PUT, new HttpEntity<>(sldBody, sldHeaders), String.class); - } catch (Exception ex) { - System.err.println("Error creando estilo: " + ex.getMessage()); - } - } - } - - public void publishLayer(String layerName, String viewName, String styleName, String boundNo, String boundSe) { - ensureInfrastructureExists(); - if (styleName != null) ensureStyleExists(styleName); - - String workspace = "sigem"; - String datastore = "sigem_db"; - String url = String.format("%s/workspaces/%s/datastores/%s/featuretypes/%s", GS_URL, workspace, datastore, layerName); - - String jsonBody = String.format("{\"featureType\": {\"name\": \"%s\", \"nativeName\": \"%s\", \"srs\": \"EPSG:4326\"}}", layerName, viewName); - HttpHeaders headers = createHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - - try { - restTemplate.exchange(url, HttpMethod.PUT, new HttpEntity<>(jsonBody, headers), String.class); - } catch (Exception e) { - String postUrl = String.format("%s/workspaces/%s/datastores/%s/featuretypes", GS_URL, workspace, datastore); - try { restTemplate.postForEntity(postUrl, new HttpEntity<>(jsonBody, headers), String.class); } catch (Exception ex) {} - } - - if (styleName != null) { - String layerUrl = String.format("%s/layers/sigem:%s", GS_URL, layerName); - String layerJson = String.format("{\"layer\": {\"defaultStyle\": {\"name\": \"%s\"}}}", styleName); - try { restTemplate.exchange(layerUrl, HttpMethod.PUT, new HttpEntity<>(layerJson, headers), String.class); } catch (Exception e) {} - } - } - - private void ensureInfrastructureExists() { - String workspace = "sigem"; - String datastore = "sigem_db"; - try { - restTemplate.exchange(GS_URL + "/workspaces/" + workspace, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); - } catch (Exception e) { - String wsJson = String.format("{\"workspace\": {\"name\": \"%s\"}}", workspace); - HttpHeaders h = createHeaders(); h.setContentType(MediaType.APPLICATION_JSON); - try { restTemplate.postForEntity(GS_URL + "/workspaces", new HttpEntity<>(wsJson, h), String.class); } catch (Exception ex) {} - } - - try { - restTemplate.exchange(GS_URL + "/workspaces/" + workspace + "/datastores/" + datastore, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); - } catch (Exception e) { - String dsJson = String.format("{\"dataStore\": {\"name\": \"%s\", \"connectionParameters\": {\"host\": \"proyecto-postgres-1\", \"port\": \"5432\", \"database\": \"sigem\", \"user\": \"sigem_user\", \"passwd\": \"sigem_pass\", \"dbtype\": \"postgis\"}}}", datastore); - HttpHeaders h = createHeaders(); h.setContentType(MediaType.APPLICATION_JSON); - try { restTemplate.postForEntity(GS_URL + "/workspaces/" + workspace + "/datastores", new HttpEntity<>(dsJson, h), String.class); } catch (Exception ex) {} - } - } - - public void truncateCache(String layerName) { - String url = "http://proyecto-geoserver-1:8080/geoserver/gwc/rest/masstruncate"; - String xmlBody = String.format("sigem:%s", layerName); - HttpHeaders h = createHeaders(); h.setContentType(MediaType.TEXT_XML); - try { restTemplate.postForEntity(url, new HttpEntity<>(xmlBody, h), String.class); } catch (Exception e) {} - } - - private HttpHeaders createHeaders() { - HttpHeaders headers = new HttpHeaders(); - headers.setBasicAuth(GS_USER, GS_PASS); - return headers; - } -} diff --git a/GIS-GEOSERVER/Jenkinsfile b/GIS-GEOSERVER/Jenkinsfile deleted file mode 100644 index 334def9..0000000 --- a/GIS-GEOSERVER/Jenkinsfile +++ /dev/null @@ -1,77 +0,0 @@ -pipeline { - agent any - - tools { - // Asegurar que Jenkins tenga configurado el JDK 21 y Maven 3 - jdk 'Java 21' - maven 'Maven 3' - } - - environment { - // Variables del Contenedor de Producción (GeoServer) - SERVER_IP = '192.168.1.123' - // NOTA: Reemplazar por la Credencial SSH configurada en Jenkins para apuntar a root@192.168.1.123 - SSH_CREDENTIAL_ID = 'sigem-server-123' - IMAGE_NAME = 'sigem/gis-geoserver-app:latest' - TAR_FILE = 'gis-backend.tar' - } - - stages { - stage('Clonar Repositorio (Checkout)') { - steps { - checkout scm - echo "Código Fuente clonado y listo para validación." - } - } - - stage('Compilación Java (Build & Test)') { - steps { - echo "Empaquetando microservicio con Maven..." - sh 'mvn clean package -DskipTests' - echo "Archivo .jar generado con éxito." - } - } - - stage('Construcción de Imagen Docker') { - steps { - echo "Construyendo imagen Docker usando Temurin JDK 21..." - sh "docker build -t ${IMAGE_NAME} ." - } - } - - stage('Exportación y Despliegue Secuencial') { - steps { - sshagent([SSH_CREDENTIAL_ID]) { - echo "Exportando contenedor a archivo tar. Esto toma unos segundos..." - sh "docker save ${IMAGE_NAME} > ${TAR_FILE}" - - echo "Transfiriendo archivos vía SCP hacia 192.168.1.123..." - sh "scp -o StrictHostKeyChecking=no ${TAR_FILE} root@${SERVER_IP}:/tmp/${TAR_FILE}" - sh "ssh -o StrictHostKeyChecking=no root@${SERVER_IP} 'mkdir -p /opt/gis-backend/'" - sh "scp -o StrictHostKeyChecking=no docker-compose.yml root@${SERVER_IP}:/opt/gis-backend/" - - echo "Levantando el Sistema Remotamente en el Nodo PostGIS..." - sh ''' - ssh -o StrictHostKeyChecking=no root@${SERVER_IP} " - cd /opt/gis-backend/ - docker load < /tmp/${TAR_FILE} - docker compose down - docker compose up -d - rm -f /tmp/${TAR_FILE} - echo 'Microservicio Reiniciado sin caída de datos.' - " - ''' - } - } - } - } - - post { - success { - echo "Despliegue del Módulo GIS completado de forma impecable. Disponible en el puerto 8081." - } - failure { - echo "La compilación o el despliegue del mapa ha fallado. Revisa los logs de SSH." - } - } -} diff --git a/GIS-GEOSERVER/ProxyController.java b/GIS-GEOSERVER/ProxyController.java deleted file mode 100644 index f981c41..0000000 --- a/GIS-GEOSERVER/ProxyController.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.sigem.gis.controller; - -import jakarta.servlet.http.HttpServletRequest; -import org.springframework.http.*; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.client.RestTemplate; -import org.springframework.util.StreamUtils; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Enumeration; - -@RestController -public class ProxyController { - - private final RestTemplate restTemplate; - private final String geoserverInternalBase = "http://proyecto-geoserver-1:8080"; - - public ProxyController(RestTemplate restTemplate) { - this.restTemplate = restTemplate; - } - - @RequestMapping(value = {"/geoserver/**", "/gwc/**"}, method = {RequestMethod.GET, RequestMethod.POST}) - @ResponseBody - public ResponseEntity proxy(HttpServletRequest request) throws URISyntaxException { - String path = request.getRequestURI(); - // Eliminamos el prefijo del contexto de la aplicación - if (path.startsWith("/gis-geoserver")) { - path = path.substring("/gis-geoserver".length()); - } - - // Si la petición viene por /gwc/, GeoServer la espera en /geoserver/gwc/ - if (path.startsWith("/gwc")) { - path = "/geoserver" + path; - } - - String query = request.getQueryString(); - String fullUrl = geoserverInternalBase + path + (query != null ? "?" + query : ""); - URI uri = new URI(fullUrl); - - HttpHeaders headers = new HttpHeaders(); - Enumeration headerNames = request.getHeaderNames(); - while (headerNames.hasMoreElements()) { - String hName = headerNames.nextElement(); - // Evitamos pasar el Host original para que GeoServer no intente redirecciones externas - if (!hName.equalsIgnoreCase("host")) { - headers.add(hName, request.getHeader(hName)); - } - } - - return restTemplate.execute(uri, HttpMethod.valueOf(request.getMethod()), (req) -> { - req.getHeaders().putAll(headers); - if (request.getContentLength() > 0) StreamUtils.copy(request.getInputStream(), req.getBody()); - }, (res) -> { - byte[] body = StreamUtils.copyToByteArray(res.getBody()); - HttpHeaders responseHeaders = new HttpHeaders(); - responseHeaders.putAll(res.getHeaders()); - // Sobrescribimos el content type si es necesario para asegurar la entrega de imágenes/PBF - return new ResponseEntity<>(body, responseHeaders, res.getStatusCode()); - }); - } -} diff --git a/GIS-GEOSERVER/RestTemplateConfig.java b/GIS-GEOSERVER/RestTemplateConfig.java deleted file mode 100644 index b3353d0..0000000 --- a/GIS-GEOSERVER/RestTemplateConfig.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.sigem.gis.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestTemplate; - -@Configuration -public class RestTemplateConfig { - @Bean - public RestTemplate restTemplate() { - return new RestTemplate(); - } -} diff --git a/GIS-GEOSERVER/SecurityConfig.java b/GIS-GEOSERVER/SecurityConfig.java deleted file mode 100644 index cb49f2d..0000000 --- a/GIS-GEOSERVER/SecurityConfig.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.sigem.gis.security; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; - -@Configuration -@EnableWebSecurity -public class SecurityConfig { - - private final JwtAuthenticationFilter jwtAuthFilter; - - public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter) { - this.jwtAuthFilter = jwtAuthFilter; - } - - @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - http - .csrf(csrf -> csrf.disable()) - .cors(cors -> cors.disable()) - .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .authorizeHttpRequests(authz -> authz - .requestMatchers("/api/auth/**").permitAll() - .requestMatchers("/api/admin/**").permitAll() - .requestMatchers("/login.html", "/", "/mapas", "/login", "/error").permitAll() - .requestMatchers("/css/**", "/js/**", "/img/**").permitAll() - - // Permitimos el tráfico hacia el puente interno de GeoServer (Solución C) - .requestMatchers("/gwc/**").permitAll() - .requestMatchers("/geoserver/**").permitAll() - - .requestMatchers("/api/**").authenticated() - .anyRequest().permitAll() - ) - .httpBasic(basic -> basic.disable()) - .formLogin(form -> form.disable()) - .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class); - - return http.build(); - } -} diff --git a/GIS-GEOSERVER/SecurityConfig_master.java b/GIS-GEOSERVER/SecurityConfig_master.java deleted file mode 100644 index 7966fde..0000000 --- a/GIS-GEOSERVER/SecurityConfig_master.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.sigem.gis.security; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; - -@Configuration -@EnableWebSecurity -public class SecurityConfig { - - private final JwtAuthenticationFilter jwtAuthFilter; - - public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter) { - this.jwtAuthFilter = jwtAuthFilter; - } - - @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - http - .csrf(csrf -> csrf.disable()) // Deshabilitado para APIs REST (Stateless con JWT) - .cors(cors -> cors.disable()) // Modificable luego para permitir conexiones cruzadas - .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .authorizeHttpRequests(authz -> authz - // Accesos no autenticados permitidos (Puerta de Entrada Prototipo) - .requestMatchers("/api/auth/**").permitAll() - .requestMatchers("/api/admin/**").permitAll() - .requestMatchers("/login_prototipo.html", "/login.html", "/", "/mapas", "/login", "/error").permitAll() - .requestMatchers("/css/**", "/js/**", "/img/**").permitAll() - .requestMatchers("/gwc/**").permitAll() - - // Todas las demás llamadas API estarán protegidas mediante JWT - .requestMatchers("/api/**").authenticated() - .anyRequest().permitAll() - ) - .httpBasic(basic -> basic.disable()) - .formLogin(form -> form.disable()) - .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class); - - return http.build(); - } -} diff --git a/GIS-GEOSERVER/VERSION.txt b/GIS-GEOSERVER/VERSION.txt deleted file mode 100644 index 68aefb7..0000000 --- a/GIS-GEOSERVER/VERSION.txt +++ /dev/null @@ -1,11 +0,0 @@ -Version de Estabilizacion SIG (Abril 2026) - 2026.04.02.13.00.00 -Version de Estabilizacion SIG (Abril 2026) - 2026.04.03.11.58.33 -V e r s i o n d e E s t a b i l i z a c i o n S I G ( A b r i l 2 0 2 6 ) - 2 0 2 6 . 0 4 . 0 3 . 1 6 . 1 0 . 0 0 - - Version de Estabilizacion SIG (Abril 2026) - 2026.04.04.20.43.27 ID DOCKER: 932819b9d2da - -Version de Estabilizacion SIG (Abril 2026) - 2026.04.05.01.49.29 ID DOCKER: c68e229b6d94 -Mapa Coloreado -Version de Estabilizacion SIG (Abril 2026) - 2026.04.05.04.28.49 ID DOCKER: c68e229b6d94. Observación: Fix de las contraseñas WMS y polígonos a full color. -Versión de Estabilización SIG (Abril 2026) - 2026.04.05.06.31.00 ID DOCKER: c68e229b6d94. Observación: Reestructuracion pura de BaseMap y soporte Google auto-escalado satelital. -Versión SIG (Abril 2026) - 2026.04.06.01.13.00 ID DOCKER: d983a409769d. Observación: Integración exitosa de Landing Page AdminLTE 3 con aislamiento de iFrame para Visor GIS. \ No newline at end of file diff --git a/GIS-GEOSERVER/apache_ssl_update.conf b/GIS-GEOSERVER/apache_ssl_update.conf deleted file mode 100644 index 551b384..0000000 --- a/GIS-GEOSERVER/apache_ssl_update.conf +++ /dev/null @@ -1,52 +0,0 @@ - - - ServerName sigemtest.yvaga.com.py - ServerAdmin cbareiro@yvaga.com.py - - ProxyPass /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 - ProxyPassReverse /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 - ProxyPassReverse /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /api/ http://192.168.1.162:9001/api/ timeout=1200 - ProxyPassReverse /api/ http://192.168.1.162:9001/api/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /sigemweb http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPreserveHost On - - # --- INICIO BLOQUE GIS GEOSERVER (.123) --- - # Rutas Web Frontend (Spring Boot en Puerto 8081) - ProxyPass /mapas http://192.168.1.123:8081/mapas timeout=1200 - ProxyPassReverse /mapas http://192.168.1.123:8081/mapas timeout=1200 - ProxyPass /login http://192.168.1.123:8081/login timeout=1200 - ProxyPassReverse /login http://192.168.1.123:8081/login timeout=1200 - - # Ruta Diferenciada de API GIS para no chocar con el /api/ de la .162 principal - ProxyPass /gis-api/ http://192.168.1.123:8081/api/ timeout=1200 - ProxyPassReverse /gis-api/ http://192.168.1.123:8081/api/ timeout=1200 - - # Ruta Nativa del Servidor espacial para consumo WMS Seguro por HTTPS - ProxyPass /geoserver/ http://192.168.1.123:8080/geoserver/ timeout=1200 - ProxyPassReverse /geoserver/ http://192.168.1.123:8080/geoserver/ timeout=1200 - # --- FIN BLOQUE GIS --- - - ProxyPass / http://192.168.1.20/ timeout=1200 - ProxyPassReverse / http://192.168.1.20/ timeout=1200 - ProxyPreserveHost On - - ErrorLog /var/log/httpd/sigemtest-error.log - SSLCertificateFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/cert.pem - SSLCertificateKeyFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/privkey.pem - Include /etc/letsencrypt/options-ssl-apache.conf - SSLCertificateChainFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/chain.pem - - diff --git a/GIS-GEOSERVER/application_master.properties b/GIS-GEOSERVER/application_master.properties deleted file mode 100644 index 3ed700c..0000000 --- a/GIS-GEOSERVER/application_master.properties +++ /dev/null @@ -1,22 +0,0 @@ -server.port=8081 -server.servlet.context-path=/gis-geoserver - -# Configuración de Recursos Estáticos para Prototipado en Vivo (Carga desde Disco) -# Esto permite modificar login_prototipo.html y ver cambios al instante sin rebuild -spring.web.resources.static-locations=classpath:/static/,file:/yvyape/proyectos/sigem-gis/src/main/resources/static/ - -# Configuración JPA -spring.jpa.hibernate.ddl-auto=none -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -spring.application.name=gis-geoserver - -# JPA Config - Master (SigemWeb) -spring.datasource.master.url=jdbc:postgresql://192.168.1.254:5432/sigemweb -spring.datasource.master.username=postgres -spring.datasource.master.password=x25yvaga2017 - -# JPA Config - GIS (PostGIS Local .123) -spring.datasource.gis.url=jdbc:postgresql://proyecto-postgres-1:5432/sigem -spring.datasource.gis.username=sigem_user -spring.datasource.gis.password=sigem_pass diff --git a/GIS-GEOSERVER/check_geom.sql b/GIS-GEOSERVER/check_geom.sql deleted file mode 100644 index ff0e516..0000000 --- a/GIS-GEOSERVER/check_geom.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - 'vw_lotes_morosidad_505' as view_name, - count(*) as total_records, - ST_GeometryType(geom) as geom_type, - ST_SRID(geom) as srid, - sum(case when ST_IsValid(geom) then 1 else 0 end) as valid_geometries, - sum(case when geom IS NULL then 1 else 0 end) as null_geometries -FROM public.vw_lotes_morosidad_505 -GROUP BY 1, 3, 4; diff --git a/GIS-GEOSERVER/check_rule5.sql b/GIS-GEOSERVER/check_rule5.sql deleted file mode 100644 index 4583a67..0000000 --- a/GIS-GEOSERVER/check_rule5.sql +++ /dev/null @@ -1,3 +0,0 @@ -SELECT sigem_site, sigem_dbname, latlong, lng, lat, zoom, mapa_base, boundno, boundse, maxzoom, minzoom -FROM public.entidades -WHERE entidad=505; diff --git a/GIS-GEOSERVER/control_gestion.php b/GIS-GEOSERVER/control_gestion.php deleted file mode 100644 index 7ba96c0..0000000 --- a/GIS-GEOSERVER/control_gestion.php +++ /dev/null @@ -1,128 +0,0 @@ - -
  • - - CONTROL DE GESTION - - - - - -
  • \ No newline at end of file diff --git a/GIS-GEOSERVER/dbconf.php b/GIS-GEOSERVER/dbconf.php deleted file mode 100644 index 34b82a2..0000000 --- a/GIS-GEOSERVER/dbconf.php +++ /dev/null @@ -1,14 +0,0 @@ - {{.Destination}}{{end}} -Env: {{range .Config.Env}}{{.}} {{end}} -' -echo "=== BUSQUEDA DE DEFINICION ===" -grep -r "proyecto-postgres-1" /yvyape/proyectos/sigem-gis --exclude-dir=geoserver-data --exclude-dir=target diff --git a/GIS-GEOSERVER/detect_locks.sql b/GIS-GEOSERVER/detect_locks.sql deleted file mode 100644 index 51a2583..0000000 --- a/GIS-GEOSERVER/detect_locks.sql +++ /dev/null @@ -1,9 +0,0 @@ -SELECT - a.pid AS blocking_pid, a.usename AS blocking_user, a.client_addr AS blocking_ip, - b.pid AS blocked_pid, b.usename AS blocked_user, b.query AS blocked_statement, - age(now(), a.query_start) AS age_of_lock -FROM pg_stat_activity a -JOIN pg_stat_activity b ON a.datid = b.datid AND a.pid != b.pid -JOIN pg_locks l1 ON a.pid = l1.pid -JOIN pg_locks l2 ON b.pid = l2.pid AND l1.relation = l2.relation -WHERE NOT l2.granted AND l1.granted; diff --git a/GIS-GEOSERVER/diag_db.sh b/GIS-GEOSERVER/diag_db.sh deleted file mode 100644 index 03fe9fe..0000000 --- a/GIS-GEOSERVER/diag_db.sh +++ /dev/null @@ -1,2 +0,0 @@ -sudo -u postgres psql -d sigem_gis -c "\dv public.vw_lotes_morosidad_505" -sudo -u postgres psql -d sigem_gis -c "\d public.lotes_nomenclatura" diff --git a/GIS-GEOSERVER/diag_db_docker.sh b/GIS-GEOSERVER/diag_db_docker.sh deleted file mode 100644 index 37d6181..0000000 --- a/GIS-GEOSERVER/diag_db_docker.sh +++ /dev/null @@ -1,2 +0,0 @@ -docker inspect proyecto-postgres-1 | grep -iE "POSTGRES_USER|POSTGRES_DB" -docker exec proyecto-postgres-1 psql -U postgres -d sigem_gis -c "\dv" || docker exec proyecto-postgres-1 psql -U sigem_user -d sigem_gis -c "\dv" || true diff --git a/GIS-GEOSERVER/diag_fdw.sql b/GIS-GEOSERVER/diag_fdw.sql deleted file mode 100644 index 4863c98..0000000 --- a/GIS-GEOSERVER/diag_fdw.sql +++ /dev/null @@ -1,11 +0,0 @@ --- Diagnóstico de Integridad FDW Entidad 505 -SELECT '--- TABLAS IMPORTADAS EN fdw_505 ---' as reporte; -SELECT table_name FROM information_schema.tables WHERE table_schema = 'fdw_505' ORDER BY table_name; - -SELECT '--- COLUMNAS DE fdw_505.usuarios ---' as reporte; -SELECT column_name, data_type FROM information_schema.columns -WHERE table_schema = 'fdw_505' AND table_name = 'usuarios' -ORDER BY ordinal_position; - -SELECT '--- PRUEBA DE ACCESO (SIN DESENCRIPTAR) ---' as reporte; -SELECT usu_alias, ejer_fisca FROM fdw_505.usuarios WHERE usu_alias = 'operador' LIMIT 1; diff --git a/GIS-GEOSERVER/diag_schema_505.sql b/GIS-GEOSERVER/diag_schema_505.sql deleted file mode 100644 index ff2e737..0000000 --- a/GIS-GEOSERVER/diag_schema_505.sql +++ /dev/null @@ -1,12 +0,0 @@ --- Diagnóstico detallado de esquemas para la Entidad 505 -\echo '--- ESTRUCTURA DE LOTES ---' -\d public.e505_lotes_conccc - -\echo '--- ESTRUCTURA DE MEJORAS ---' -\d public.e505_mejoras - -\echo '--- ESTRUCTURA DE MOROSIDAD (FDW) ---' -\d fdw_505.v_liq_entidad_totalxobjeto - -\echo '--- LISTADO DE TABLAS EN EL ESQUEMA PUBLIC ---' -SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name LIKE 'e505_%'; diff --git a/GIS-GEOSERVER/diag_v28.sh b/GIS-GEOSERVER/diag_v28.sh deleted file mode 100644 index dba5d28..0000000 Binary files a/GIS-GEOSERVER/diag_v28.sh and /dev/null differ diff --git a/GIS-GEOSERVER/docker-compose-v33.yml b/GIS-GEOSERVER/docker-compose-v33.yml deleted file mode 100644 index 083cb37..0000000 --- a/GIS-GEOSERVER/docker-compose-v33.yml +++ /dev/null @@ -1,21 +0,0 @@ -version: '3.8' -services: - gis-geoserver-backend: - image: sigem/gis-geoserver-app:latest - container_name: sigem-gis-backend - restart: unless-stopped - ports: - - "8081:8081" - environment: - - TZ=America/Asuncion - - GIS_DB_HOST=proyecto-postgres-1 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - networks: - - sigem-net - - proyecto_sigem_network - -networks: - sigem-net: - driver: bridge - proyecto_sigem_network: - external: true diff --git a/GIS-GEOSERVER/docker-compose.integrated.yml b/GIS-GEOSERVER/docker-compose.integrated.yml deleted file mode 100644 index 6773283..0000000 --- a/GIS-GEOSERVER/docker-compose.integrated.yml +++ /dev/null @@ -1,66 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - container_name: proyecto-geoserver-1 - environment: - - GEOSERVER_ADMIN_PASSWORD=admin - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - networks: - - proyecto_sigem_network - restart: always - - backend-java: - image: eclipse-temurin:21-jre - container_name: proyecto-backend-java-1 - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - # Configuración Maestra Directa (Reglas 2/5) - - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb - - SPRING_DATASOURCE_MASTER_USERNAME=postgres - - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 - - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - # Configuración Local (Regla 1) - PostgreSQL 18 - - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://postgres:5432/sigem - - SPRING_DATASOURCE_GIS_USERNAME=sigem_user - - SPRING_DATASOURCE_GIS_PASSWORD=sigem_pass - - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ../backend-java/gis-geoserver.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - networks: - - proyecto_sigem_network - restart: always - - postgres: - image: postgis/postgis:18-3.6 - container_name: proyecto-postgres-1 - environment: - - POSTGRES_USER=sigem_user - - POSTGRES_PASSWORD=sigem_pass - - POSTGRES_DB=sigem - volumes: - - pg_data:/var/lib/postgresql - ports: - - "5432:5432" - networks: - - proyecto_sigem_network - restart: always - -networks: - proyecto_sigem_network: - external: true - -volumes: - pg_data: - external: true - name: proyecto_proyecto_postgres_data diff --git a/GIS-GEOSERVER/docker-compose.v18.yml b/GIS-GEOSERVER/docker-compose.v18.yml deleted file mode 100644 index 0e7953d..0000000 --- a/GIS-GEOSERVER/docker-compose.v18.yml +++ /dev/null @@ -1,26 +0,0 @@ -version: '3.8' -services: - postgres: - image: postgis/postgis:18-3.6 - container_name: proyecto-postgres-1 - ports: - - "5432:5432" - environment: - - POSTGRES_USER=sigem_user - - POSTGRES_PASSWORD=sigem_pass - - POSTGRES_DB=sigem_gis - volumes: - # Ajuste para PostgreSQL 18+: Montaje en la raíz del directorio de datos - - proyecto_postgres_data:/var/lib/postgresql - networks: - - sigem-net - restart: always - -networks: - sigem-net: - driver: bridge - -volumes: - proyecto_postgres_data: - driver: local - # No definimos external: true para que docker-compose gestione el ciclo de vida del volumen limpio diff --git a/GIS-GEOSERVER/docker-compose.yml b/GIS-GEOSERVER/docker-compose.yml deleted file mode 100644 index 2b149e7..0000000 --- a/GIS-GEOSERVER/docker-compose.yml +++ /dev/null @@ -1,66 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - container_name: proyecto-geoserver-1 - environment: - - GEOSERVER_ADMIN_PASSWORD=geoserver - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - networks: - - proyecto_sigem_network - restart: always - - backend-java: - image: eclipse-temurin:21-jre - container_name: proyecto-backend-java-1 - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - # Configuración Maestra Directa (Reglas 2/5) - - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb - - SPRING_DATASOURCE_MASTER_USERNAME=postgres - - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 - - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - # Configuración Local (Regla 1) - PostgreSQL 18 - - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://postgres:5432/sigem - - SPRING_DATASOURCE_GIS_USERNAME=sigem_user - - SPRING_DATASOURCE_GIS_PASSWORD=sigem_pass - - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ./target/gis-geoserver-0.0.1-SNAPSHOT.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - networks: - - proyecto_sigem_network - restart: always - - postgres: - image: postgis/postgis:18-3.6 - container_name: proyecto-postgres-1 - environment: - - POSTGRES_USER=sigem_user - - POSTGRES_PASSWORD=sigem_pass - - POSTGRES_DB=sigem - volumes: - - pg_data:/var/lib/postgresql - ports: - - "5432:5432" - networks: - - proyecto_sigem_network - restart: always - -networks: - proyecto_sigem_network: - external: true - -volumes: - pg_data: - external: true - name: proyecto_proyecto_postgres_data diff --git a/GIS-GEOSERVER/docker-compose.yml.remote.tmp b/GIS-GEOSERVER/docker-compose.yml.remote.tmp deleted file mode 100644 index f031835..0000000 --- a/GIS-GEOSERVER/docker-compose.yml.remote.tmp +++ /dev/null @@ -1,22 +0,0 @@ -version: '3.8' -services: - gis-geoserver-backend: - image: sigem/gis-geoserver-app:latest - container_name: sigem-gis-backend - restart: unless-stopped - ports: - - "8081:8081" - volumes: - - /home/cbareiro/sigem-gis/gis-geoserver.jar:/app.jar - environment: - - TZ=America/Asuncion - - GIS_DB_HOST=proyecto-postgres-1 - networks: - - sigem-net - - proyecto_sigem_network - -networks: - sigem-net: - driver: bridge - proyecto_sigem_network: - external: true diff --git a/GIS-GEOSERVER/docker-compose_v20.yml b/GIS-GEOSERVER/docker-compose_v20.yml deleted file mode 100644 index d921818..0000000 --- a/GIS-GEOSERVER/docker-compose_v20.yml +++ /dev/null @@ -1,34 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - environment: - - GEOSERVER_ADMIN_PASSWORD=admin - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - restart: always - - backend-java: - image: eclipse-temurin:21-jre - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - - APP_DB_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb - - APP_DB_MASTER_USERNAME=sigemweb - - APP_DB_MASTER_PASSWORD=sigemweb - - APP_DB_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - - APP_DB_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis - - APP_DB_GIS_USERNAME=cbareiro - - APP_DB_GIS_PASSWORD=x25yvaga2023 - - APP_DB_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ../backend-java/gis-geoserver.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - restart: always diff --git a/GIS-GEOSERVER/docker-compose_v22.yml b/GIS-GEOSERVER/docker-compose_v22.yml deleted file mode 100644 index a10e9c0..0000000 --- a/GIS-GEOSERVER/docker-compose_v22.yml +++ /dev/null @@ -1,34 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - environment: - - GEOSERVER_ADMIN_PASSWORD=admin - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - restart: always - - backend-java: - image: eclipse-temurin:21-jre - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb - - SPRING_DATASOURCE_MASTER_USERNAME=sigemweb - - SPRING_DATASOURCE_MASTER_PASSWORD=sigemweb - - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis - - SPRING_DATASOURCE_GIS_USERNAME=cbareiro - - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2023 - - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ../backend-java/gis-geoserver.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - restart: always diff --git a/GIS-GEOSERVER/docker-compose_v24.yml b/GIS-GEOSERVER/docker-compose_v24.yml deleted file mode 100644 index 9dbeff0..0000000 --- a/GIS-GEOSERVER/docker-compose_v24.yml +++ /dev/null @@ -1,34 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - environment: - - GEOSERVER_ADMIN_PASSWORD=admin - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - restart: always - - backend-java: - image: eclipse-temurin:21-jre - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb - - SPRING_DATASOURCE_MASTER_USERNAME=postgres - - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 - - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis - - SPRING_DATASOURCE_GIS_USERNAME=cbareiro - - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2017 - - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ../backend-java/gis-geoserver.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - restart: always diff --git a/GIS-GEOSERVER/docker-compose_v25.yml b/GIS-GEOSERVER/docker-compose_v25.yml deleted file mode 100644 index 2430f31..0000000 --- a/GIS-GEOSERVER/docker-compose_v25.yml +++ /dev/null @@ -1,34 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - environment: - - GEOSERVER_ADMIN_PASSWORD=admin - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - restart: always - - backend-java: - image: eclipse-temurin:21-jre - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.90:5432/cartodb_user_17b59d48-0892-47a7-a206-e1b3bb6fb6f8_db - - SPRING_DATASOURCE_MASTER_USERNAME=postgres - - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2018 - - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis - - SPRING_DATASOURCE_GIS_USERNAME=cbareiro - - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2023 - - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ../backend-java/gis-geoserver.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - restart: always diff --git a/GIS-GEOSERVER/docker-compose_v26.yml b/GIS-GEOSERVER/docker-compose_v26.yml deleted file mode 100644 index 9dbeff0..0000000 --- a/GIS-GEOSERVER/docker-compose_v26.yml +++ /dev/null @@ -1,34 +0,0 @@ -services: - geoserver: - image: kartoza/geoserver:2.24.1 - environment: - - GEOSERVER_ADMIN_PASSWORD=admin - - GEOSERVER_CORS_ENABLED=true - - GEOSERVER_CORS_ALLOWED_ORIGINS=* - - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc - volumes: - - ./geoserver-data:/opt/geoserver/data_dir - ports: - - "8080:8080" - restart: always - - backend-java: - image: eclipse-temurin:21-jre - environment: - - SERVER_PORT=8081 - - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver - - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb - - SPRING_DATASOURCE_MASTER_USERNAME=postgres - - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 - - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver - - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis - - SPRING_DATASOURCE_GIS_USERNAME=cbareiro - - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2017 - - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver - - JWT_SECRET=sigem_gis_secret_key_2024_v1 - volumes: - - ../backend-java/gis-geoserver.jar:/app.jar - ports: - - "8081:8081" - command: ["java", "-jar", "/app.jar"] - restart: always diff --git a/GIS-GEOSERVER/extensions.sql b/GIS-GEOSERVER/extensions.sql deleted file mode 100644 index 39f84cd..0000000 --- a/GIS-GEOSERVER/extensions.sql +++ /dev/null @@ -1,7 +0,0 @@ --- Instalación de Extensiones Necesarias en DB sigem -CREATE EXTENSION IF NOT EXISTS dblink SCHEMA public; -CREATE EXTENSION IF NOT EXISTS pg_trgm SCHEMA public; -CREATE EXTENSION IF NOT EXISTS pgcrypto SCHEMA public; -CREATE EXTENSION IF NOT EXISTS postgres_fdw SCHEMA public; --- plpgsql suele venir por defecto en el catálogo, nos aseguramos: -CREATE EXTENSION IF NOT EXISTS plpgsql SCHEMA pg_catalog; diff --git a/GIS-GEOSERVER/extract_carto.sh b/GIS-GEOSERVER/extract_carto.sh deleted file mode 100644 index 7114a89..0000000 --- a/GIS-GEOSERVER/extract_carto.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -echo "Verificando ogr2ogr..." -if ! command -v ogr2ogr &> /dev/null -then - echo "ogr2ogr no se encuentra. Intentando instalar gdal-bin..." - echo "x25yvaga2023" | sudo -S DEBIAN_FRONTEND=noninteractive apt-get update - echo "x25yvaga2023" | sudo -S DEBIAN_FRONTEND=noninteractive apt-get install -y gdal-bin -fi - -echo "Iniciando Extraccion de PostGIS a GPKG (Carto Sanity Pass)..." -cd /home/cbareiro -rm -f sigem_export.gpkg -ogr2ogr -f "GPKG" sigem_export.gpkg PG:"dbname=cartodb_user_17b59d48-0892-47a7-a206-e1b3bb6fb6f8_db host=127.0.0.1 user=postgres password=x25yvaga2017" "e505_barloc" "e505_calles" "e505_distrito" "e505_lotes" "e505_lotes_conccc" "e505_lotes_sinccc" "e505_manzanas" "e505_medidores" "e505_mejoras" "e505_zonas_tributarias" - -echo "Verificando exportacion final:" -ls -lh sigem_export.gpkg -echo "Extraccion Exitosa." diff --git a/GIS-GEOSERVER/fix_fdw_direct.sql b/GIS-GEOSERVER/fix_fdw_direct.sql deleted file mode 100644 index bd65850..0000000 --- a/GIS-GEOSERVER/fix_fdw_direct.sql +++ /dev/null @@ -1,21 +0,0 @@ --- REPARACIÓN DEFINITIVA DE FDW USUARIOS (v42.1) -DROP SCHEMA IF EXISTS fdw_505 CASCADE; -DROP SERVER IF EXISTS srv_mun_505 CASCADE; - --- Crear servidor con los parámetros dinámicos de la Entidad 505 (Host: 10.0.25.1 Port: 5414 DB: sigem0505) -CREATE SERVER srv_mun_505 FOREIGN DATA WRAPPER postgres_fdw -OPTIONS (host '10.0.25.1', port '5414', dbname 'sigem0505'); - --- Mapeo de usuario con contraseña de la tabla ENTIDADES para 505 (postgres / x25yvaga2018) -CREATE USER MAPPING FOR sigem_user SERVER srv_mun_505 -OPTIONS (user 'postgres', password 'x25yvaga2018'); - -CREATE SCHEMA fdw_505; - --- Importación explícita incluyendo pgcrypto local -IMPORT FOREIGN SCHEMA public LIMIT TO (v_liq_entidad_totalxobjeto, v_liq_entidad_percentiles, usuarios, ventanas_usuario) -FROM SERVER srv_mun_505 INTO fdw_505; - --- Verificación de columnas de usuarios -SELECT column_name, data_type FROM information_schema.columns -WHERE table_schema = 'fdw_505' AND table_name = 'usuarios'; diff --git a/GIS-GEOSERVER/gwc_lotes.xml b/GIS-GEOSERVER/gwc_lotes.xml deleted file mode 100644 index 261ede6..0000000 --- a/GIS-GEOSERVER/gwc_lotes.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - true - sigem:vw_lotes_morosidad_505 - - image/png - image/jpeg - application/x-protobuf - - - - EPSG:900913 - - - EPSG:4326 - - - diff --git a/GIS-GEOSERVER/gwc_mejoras.xml b/GIS-GEOSERVER/gwc_mejoras.xml deleted file mode 100644 index 28bacea..0000000 --- a/GIS-GEOSERVER/gwc_mejoras.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - true - sigem:e505_mejoras - - image/png - image/jpeg - application/x-protobuf - - - - EPSG:900913 - - - EPSG:4326 - - - diff --git a/GIS-GEOSERVER/inject_gis.sh b/GIS-GEOSERVER/inject_gis.sh deleted file mode 100644 index ad38074..0000000 --- a/GIS-GEOSERVER/inject_gis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -echo "1. Asegurando extension PostGIS en BD 'sigem'..." -docker exec proyecto-postgres-1 psql -U sigem_user -d sigem -c "CREATE EXTENSION IF NOT EXISTS postgis;" || echo "BD no lista o error" - -echo "2. Copiando paquete GeoPackage al interior del contenedor..." -docker cp /yvyape/proyectos/sigem-gis/sigem_export.gpkg proyecto-postgres-1:/tmp/sigem_export.gpkg - -echo "3. Ejecutando inyeccion masiva ogr2ogr a PostgreSQL (sigem)..." -docker exec proyecto-postgres-1 sh -c "ogr2ogr -f PostgreSQL PG:'dbname=sigem host=127.0.0.1 user=sigem_user password=sigem_pass' /tmp/sigem_export.gpkg -nlt PROMOTE_TO_MULTI -skipfailures" -echo "Validando inyeccion:" -docker exec proyecto-postgres-1 psql -U sigem_user -d sigem -c "\dt e505_*" -echo "Inyeccion completada!" diff --git a/GIS-GEOSERVER/liq_por_tipo.php b/GIS-GEOSERVER/liq_por_tipo.php deleted file mode 100644 index bdd1bcd..0000000 --- a/GIS-GEOSERVER/liq_por_tipo.php +++ /dev/null @@ -1,35 +0,0 @@ - - - -
    - -
    - Ultimo año pagado:

    AÑO

    - Cuenta Catastral:

    CCCC

    -
    - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/login.html b/GIS-GEOSERVER/login.html deleted file mode 100644 index a2c7c82..0000000 --- a/GIS-GEOSERVER/login.html +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - SIGEM-GIS | Acceso Institucional AdminLTE 3 - - - - - - - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/login_institucional_bksp.html b/GIS-GEOSERVER/login_institucional_bksp.html deleted file mode 100644 index 7f973eb..0000000 --- a/GIS-GEOSERVER/login_institucional_bksp.html +++ /dev/null @@ -1,226 +0,0 @@ - - - - - - SIGEMWEB | LOGIN - PROTOTIPO ADN CARTO - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/loginform.php b/GIS-GEOSERVER/loginform.php deleted file mode 100644 index 9c107f7..0000000 --- a/GIS-GEOSERVER/loginform.php +++ /dev/null @@ -1,296 +0,0 @@ -ip_address; - $login_timeout = $conf->login_timeout; - $max_attempts = $conf->max_attempts; - $timeout_minutes = $conf->timeout_minutes; - $attcheck = checkAttempts($myusername); - $curr_attempts = $attcheck['attempts']; - $datetimeNow = date("Y-m-d H:i:s"); - $oldTime = strtotime($attcheck['lastlogin']); - $newTime = strtotime($datetimeNow); - $timeDiff = $newTime - $oldTime; - - // QUERY - try { - $db = new DbConn; - $tbl_members = $db->tbl_members; - $err = ''; - } catch (PDOException $e) { - $err = "Error: " . $e->getMessage(); - } - - //Se setea el search_path al esquema correspondiente.. - $stentidad = $db->conn->prepare("SET search_path TO sigem".$myentidad); - $stentidad->execute(); - $anio = date('Y'); - - // *********************************************************************** - // Muestra del código el nuevo login de usuarios - // Los datos de la entidad se encuentran en la BD entidades del taperekaha - // *********************************************************************** - - /* - - // Conexión al taperekaha para traer los parámetros de conexión a la base de datos de la Municipalidad - sql_conexion := 'dbname=sigemweb host=192.168.1.254 port=5432 user=postgres password=x25yvaga2017' ; - sql_consulta := 'SELECT consulta.sigem_site, consulta.sigem_dbname FROM entidades AS consulta WHERE consulta.activo = TRUE AND consulta.entidad = ' || $myentidad || ' ;' ; - // Traer los parámetros de conexión a la base de datos de la Municipalidad - SELECT t1.sigem_site, t1.sigem_dbname - FROM public.dblink( - CAST( sql_conexion AS text ),CAST( sql_consulta AS TEXT ) - ) - AS t1 ( - sigem_site text, - sigem_dbname text - ) INTO val_sigem_site, val_sigem_dbname ; - - // Hacer la consulta para validar credenciales del usuario - consulta_sql_conexion := ('dbname=' || val_sigem_dbname || ' ' || val_sigem_site) ; - - consulta_sql_caso1 := ' SELECT caso1.ejer_fisca AS ejer_fisca, caso1.usu_alias AS usu_alias, ' ; - consulta_sql_caso1 := consulta_sql_caso1 || ' '|| '''LOGIN''' || ' AS tipo_dato ,' ; - consulta_sql_caso1 := consulta_sql_caso1 || ' caso1.usu_numero AS cod_dato, ' ; - consulta_sql_caso1 := consulta_sql_caso1 || ' CONCAT(' || val || ',' || '''-USUARIO EXISTE''' || ' ) AS descripcion_dato '; - consulta_sql_caso1 := consulta_sql_caso1 || ' FROM ( SELECT count(usua.usu_numero) AS cant_usuario, usua.ejer_fisca, usua.usu_alias, usua.usu_numero FROM usuarios usua WHERE ' ; - consulta_sql_caso1 := consulta_sql_caso1 || ' usua.activo = TRUE '; - consulta_sql_caso1 := consulta_sql_caso1 || ' AND usua.ejer_fisca = ' || val_ejer || ' AND usua.usu_alias = ' || val_alias ; - consulta_sql_caso1 := consulta_sql_caso1 || ' AND pgp_sym_decrypt(usua.usu_clave_a,' || '''510580''' || ', ' || '''compress-algo=0, cipher-algo=aes256''' || ' ) = ' || val_clave ; - consulta_sql_caso1 := consulta_sql_caso1 || ' GROUP BY usua.ejer_fisca, usua.usu_alias, usua.usu_numero ) AS caso1 '; - - RETURN QUERY SELECT t1.tipo_dato as tipo_dato, t1.cod_dato AS cod_dato, t1.descripcion_dato AS descripcion_dato FROM - public.dblink(CAST(consulta_sql_conexion AS text), - format( 'SELECT consulta.ejer_fisca, consulta.usu_alias, consulta.tipo_dato, consulta.cod_dato, consulta.descripcion_dato FROM (' || consulta_sql || ') AS consulta WHERE consulta.ejer_fisca = %L and consulta.usu_alias = %L GROUP BY consulta.ejer_fisca, consulta.usu_alias, consulta.tipo_dato, consulta.cod_dato, consulta.descripcion_dato ORDER BY consulta.ejer_fisca, consulta.usu_alias, consulta.tipo_dato, consulta.cod_dato, consulta.descripcion_dato ;',usu_ejer_fisca, usu_usu_alias )) - AS t1( - ejer_fisca numeric(18,0), - usu_alias text, - tipo_dato text, - cod_dato numeric(18,0), - descripcion_dato text) - ORDER BY t1.tipo_dato, t1.cod_dato, t1.descripcion_dato - - */ - // *********************************************************************** - - //SI ENTIDAD es CDE, corre query de password encriptado - //if ($myentidad == 505) { - //Se corre el query directamente sin usar PDO ya que la funcion pgp_sym_decrypt no puede ser escapada desde PDO y no reconoce la funcion - $dbconn = pg_connect("host=$db->host dbname=$db->db_name user=$db->username password=$db->password") or die('Could not connect: ' . pg_last_error()); - - $query = "SELECT entidad, ejer_fisca, usu_numero, usu_nom, usu_ape, usu_nivel, usu_alias, activo, - pgp_sym_decrypt(usu_clave_a::bytea,'510580')::text as usu_clave - FROM sigem".$myentidad.".usuarios WHERE usu_alias ilike '%".$myusername."%' and ejer_fisca = date_part('year', now())"; - $datos = pg_query($query) or die('Error message: ' . pg_last_error()); - - // Se traen los datos de la tabla usuario - $result = pg_fetch_assoc($datos); - - pg_close($dbconn); - /*} else { - // query normal via PDO - $stmt = $db->conn->prepare("SET search_path TO sigem".$myentidad); - $stmt = $db->conn->prepare("SELECT * FROM sigem".$myentidad.".usuarios WHERE usu_alias = :myusername and ejer_fisca = date_part('year', now())"); - $stmt->bindParam(':myusername', $myusername); - $stmt->execute(); - - // Se traen los datos de la tabla usuario - $result = $stmt->fetch(PDO::FETCH_ASSOC); - }*/ - - if ($curr_attempts >= $max_attempts && $timeDiff < $login_timeout) { - //Demasiados intentos fallidos - $success = "
    Numero maximo de reintentos excedido... por favor espere ".$timeout_minutes." minutos e intente nuevamente
    "; - } else { - //Si no se excede el maximo de intentos fallidos, continua.... - - // TODO: AGREGAR validacion contra hash no password en plano -.- - //La funcion password_verify solo funciona con versiones de php 5.5++, como centos 7 solo llega - //a 5.4 se obvia por de pronto - //if (password_verify($mypassword, $result['usu_clave']) && $result['activo'] == true) { - - //Se agrego validacion de credenciales contra la tabla usuarios del esquema correspondiente a la institucion - //donde mypassword sea igual a usu_clave y activo == true - - if (($mypassword == $result['usu_clave']) && $result['activo'] == true) { - //if ( $result['activo'] == true) { - //Inicio de Sesion Exitoso - $success = 'true'; - session_start(); - - //Variables tabla sigemxxx.usuarios - $_SESSION['username'] = $myusername; - $_SESSION['entidad'] = $myentidad; //id_entidad - $_SESSION['usu_nom'] = $result['usu_nom']; - $_SESSION['usu_ape'] = $result['usu_ape']; - - //Variables tabla public.entidades - try { - $datos = new DbConn; - $err = ''; - } catch (PDOException $e) {$err = "Error: " . $e->getMessage();} - - // Query - $dtent = $datos->conn->prepare("SELECT * FROM public.entidades WHERE entidad = ".$myentidad); - $dtent->execute(); - $datosent = $dtent->fetch(PDO::FETCH_ASSOC); - - //TODO: HACER FUNCIONAR EN CASA, asi establecer año fiscal y parametros de version directo de BD - //Variables tabla sigemxxx.parametros - /*try { - $param = new DbConn; - $err = ''; - } catch (PDOException $e) {$err = "Error: " . $e->getMessage();} - - // Query - $pent = $param->conn->prepare("SELECT * FROM parametros WHERE entidad ilike '".$myentidad."'"); - $pent->execute(); - $parament = $pent->fetch(PDO::FETCH_ASSOC); - error_log('PARAMETROS ENTIDAD: '.$parament); - error_log('Resultado: '.print_r($parament, true));*/ - - //DATOS public.entidades - $_SESSION['n_entidad'] = $datosent['nombre']; - $_SESSION['niv_entidad'] = $datosent['niv_entidad']; - $_SESSION['sig_entidad'] = $datosent['sig_entidad']; - $_SESSION['sigem_site'] = $datosent['sigem_site']; - $_SESSION['sigem_dbname'] = $datosent['sigem_dbname']; - $_SESSION['direccion'] = $datosent['direccion']; - $_SESSION['telefono'] = $datosent['telefono']; - $_SESSION['fax'] = $datosent['fax']; - $_SESSION['responsable'] = $datosent['responsable']; - $_SESSION['eslogan'] = $datosent['eslogan']; - $_SESSION['imagen'] = $datosent['imagen']; - $_SESSION['site_url'] = $datosent['site_url']; - $_SESSION['latlong'] = $datosent['latlong']; - $_SESSION['lng'] = $datosent['lng']; - $_SESSION['lat'] = $datosent['lat']; - $_SESSION['zoom'] = $datosent['zoom']; - $_SESSION['maxzoom'] = $datosent['maxzoom']; - $_SESSION['minzoom'] = $datosent['minzoom']; - $_SESSION['mapa_base'] = $datosent['mapa_base']; - $_SESSION['boundno'] = $datosent['boundno']; - $_SESSION['boundse'] = $datosent['boundse']; - - //} elseif (password_verify($mypassword, $result['usu_clave']) && $result['activo'] == true) { - // TODO: AGREGAR validacion contra hash no password en plano -.- - } elseif (($mypassword == $result['usu_clave']) && $result['activo'] == true) { - //Cuenta sin verificar - $success = "
    La cuenta ha sido creada, pero no puedes iniciar sesion hasta que sea verificada
    "; - } else { - //Usuario o password invalido - $success = "
    Usuario o Contraseña Incorrecto/s
    "; - } - - - return $success; - } - } - - public function insertAttempt($username) - { - try { - $db = new DbConn; - $conf = new GlobalConf; - $tbl_attempts = $db->tbl_attempts; - $ip_address = $conf->ip_address; - $login_timeout = $conf->login_timeout; - $max_attempts = $conf->max_attempts; - - $datetimeNow = date("Y-m-d H:i:s"); - $attcheck = checkAttempts($username); - $curr_attempts = $attcheck['attempts']; - - $stmt = $db->conn->prepare("INSERT INTO ".$tbl_attempts." (ip, attempts, lastlogin, username) values(:ip, 1, :lastlogin, :username)"); - $stmt->bindParam(':ip', $ip_address); - $stmt->bindParam(':lastlogin', $datetimeNow); - $stmt->bindParam(':username', $username); - $stmt->execute(); - $curr_attempts++; - $err = ''; - - } catch (PDOException $e) { - - $err = "Error: " . $e->getMessage(); - - } - - //Determines returned value ('true' or error code) - $resp = ($err == '') ? 'true' : $err; - - return $resp; - - } - - - public function updateAttempts($username) - { - try { - $db = new DbConn; - $conf = new GlobalConf; - $tbl_attempts = $db->tbl_attempts; - $ip_address = $conf->ip_address; - $login_timeout = $conf->login_timeout; - $max_attempts = $conf->max_attempts; - $timeout_minutes = $conf->timeout_minutes; - - $att = new LoginForm; - $attcheck = checkAttempts($username); - $curr_attempts = $attcheck['attempts']; - - $datetimeNow = date("Y-m-d H:i:s"); - $oldTime = strtotime($attcheck['lastlogin']); - $newTime = strtotime($datetimeNow); - $timeDiff = $newTime - $oldTime; - - $err = ''; - $sql = ''; - - if ($curr_attempts >= $max_attempts && $timeDiff < $login_timeout) { - - if ($timeDiff >= $login_timeout) { - - $sql = "UPDATE ".$tbl_attempts." SET attempts = :attempts, lastlogin = :lastlogin where ip = :ip and username = :username"; - $curr_attempts = 1; - - } - - } else { - - if ($timeDiff < $login_timeout) { - - $sql = "UPDATE ".$tbl_attempts." SET attempts = :attempts, lastlogin = :lastlogin where ip = :ip and username = :username"; - $curr_attempts++; - - } elseif ($timeDiff >= $login_timeout) { - - $sql = "UPDATE ".$tbl_attempts." SET attempts = :attempts, lastlogin = :lastlogin where ip = :ip and username = :username"; - $curr_attempts = 1; - - } - - $stmt2 = $db->conn->prepare($sql); - $stmt2->bindParam(':attempts', $curr_attempts); - $stmt2->bindParam(':ip', $ip_address); - $stmt2->bindParam(':lastlogin', $datetimeNow); - $stmt2->bindParam(':username', $username); - $stmt2->execute(); - - } - - } catch (PDOException $e) { - - $err = "Error: " . $e->getMessage(); - - } - - //Determines returned value ('true' or error code) (ternary) - $resp = ($err == '') ? 'true' : $err; - - return $resp; - - } -} \ No newline at end of file diff --git a/GIS-GEOSERVER/main_login.php b/GIS-GEOSERVER/main_login.php deleted file mode 100644 index 4860b94..0000000 --- a/GIS-GEOSERVER/main_login.php +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - SIGEM WEB | LOGIN - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - SIGEM - Sistema de Gestion Municipal
    -

    REGISTRO MIC/DINAPI 593 del 7/Julio/2016

    - Registro General de Derechos de Autor
    - Todos los Derechos Reservados
    -
    -
    - - -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - - - - - - - - - - diff --git a/GIS-GEOSERVER/mapa_main.js b/GIS-GEOSERVER/mapa_main.js deleted file mode 100644 index 77167f2..0000000 --- a/GIS-GEOSERVER/mapa_main.js +++ /dev/null @@ -1,519 +0,0 @@ -/*** Global object that contains the app ***/ -var app = app || {}; - -// keep our map stuff in a part of the app object as to not pollute the global name space -app.map = (function(w,d, $, _){ - var el = { - map:null,cdbURL:null,styles: null,params:null, - styleCur:null,sql:null, - mapboxTiles:null,satellite:null,taxLots:null, - baseLayers:null,capaMANZ:null,capaCALLES:null,capasinCCC:null,polygon:null, - bushwick:null,colony : null,linden : null,groveSt : null,featureGroup : null, - template:null,menu:null, - legend:null,menud:null, mostrar: null, - taxLotActions:null,story:null - }; - - //SE CARGAN VALORES REUTILIZABLES - el.styles = app.mapStyles; //ESTILOS - el.params = app.param; //PARAMETROS - el.cdbURL = app.url; //URL MAPA BASE - - // compile the underscore legend template for rendering map legends for choropleth layers - _.templateSettings.variable = "legend"; - el.template = _.template($("script.template").html()); - - el.legendcontainer = $('#ui-leyenda-contenedor'); - el.legend = $('#ui-legend'); - el.menu = $('#accordion'); - - // Configuramos el mapa y sus capas! - var initMap = function() { - // Ocultamos datos, resumen y tooltip - $('#box2').hide();$('#tool-tip').hide(); - - // Parametros del mapa de FONDO - var params = {center:[lat,lng],minZoom:minzoom,maxZoom:maxzoom,zoom:zoom,maxBounds:L.latLngBounds(corner1,corner2),zoomControl:false,infoControl:false,attributionControl:true} - el.map = new L.map('map', params); - - - - // tileLayer for mapbox basemap - el.mapboxTiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 19, - attribution: '© OpenStreetMap contributors' - }); - el.map.addLayer(el.mapboxTiles); - - //TODO: Capa Nokia layer.tileLayer('http://{s}.maps.nlp.nokia.com/maptile/2.1/maptile/newest/satellite.day/{z}/{x}/{y}/256/jpg?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24', { - // subdomains:"1234", attribution: '© Nokia Maps contributors, © YVAGA'}).addTo(map); - // add mapbox and osm attribution - var attr = "© Mapbox © OpenStreetMap" - el.map.attributionControl.addAttribution(attr); - - // add Bing satelitte imagery layer - el.satellite = new L.BingLayer('AkuX5_O7AVBpUN7ujcWGCf4uovayfogcNVYhWKjbz2Foggzu8cYBxk6e7wfQyBQW'); - - // Capas bases para leaflet - el.baseLayers = {geometrico: el.mapboxTiles,foto: el.satellite}; - - // inits UI element for toggling base tile layers - L.control.layers(el.baseLayers, {}, {position: 'bottomleft'}).addTo(el.map); - - // makes sure base layers stay below the cartodb data - el.map.on('baselayerchange', function(e){e.layer.bringToBack();}) - - // se agregan las capas - $(document).ajaxStart(function() { Pace.restart(); }); - getCDBData(); - $('#box').show(); - } - - // Carga capa Base y ADICIONALES - - var getCDBData = function() { - cartodb.createLayer(el.map, el.cdbURL, {cartodb_logo: false,legends: false,https: true}, - function(layer) { - - //TODO: VERIFICAR QUE ESTE 'LOADER' FUNKE - var loader = new cdb.geo.ui.TilesLoader({ template: function(){ return '
    ' } }); - - function addLoader(layer) { - layer.bind('loading', function() { loader.show() }); - layer.bind('load', function() { loader.hide(); }); - } - - // se almacenan las capas en las variables correspondientes - layer.getSubLayer(0).setCartoCSS(el.styles.regular); - layer.getSubLayer(0).setSQL(el.params.morosidadtodos); - el.taxLots = layer.getSubLayer(0); - - //CAPAS ADICIONALES - el.capaMANZ = layer.createSubLayer({sql : el.params.manzanas, cartocss : el.styles.manzanas}); - el.capaCALLES = layer.createSubLayer({sql : el.params.calles, cartocss : el.styles.calles}); - el.capasinCCC = layer.createSubLayer({sql : el.params.lotesincc,cartocss : el.styles.lotesincc}); - - // Mueve la posición del tool-tip respecto a la ubicación del mouse 5px, para no interferir en el proceso de "click" - var event = function (e) {$('#tool-tip').css({left: e.pageX + 5,top: e.pageY + 5});}; - - // hide and set interactivity on the DOB permit layers - var num_sublayers = layer.getSubLayerCount(); - // Se esconden todas las capas cargadas - for (var i = 1; i < num_sublayers; i++) {layer.getSubLayer(i).hide();} - //console.log(num_sublayers); - - // Se activa la interactividad y se especifica los campos activados para dicho fin - layer.getSubLayer(0).setInteraction(true); - layer.getSubLayer(0).setInteractivity('cartodb_id, ultimo_pago, trb_total_deuda, ccc, cc_man, cc_lote, layer, obs, inm_ficha'); - - //Feature on Mouse CLICK - layer.on('featureClick', function(e, pos, latlng, data) { - if (typeof impuesto !== "undefined") { - showFeature(data.cartodb_id, data.ccc); - }else{showFeature(data.cartodb_id, data.ccc);} - }); - - //Feature Mouse OVER - layer.getSubLayer(0).on('featureOver', function(e, pos, latlng, data) { - ultimo_pago = data.ultimo_pago; - cuenta = data.ccc; - if (data.ultimo_pago == null){ultimo_pago = "N/A";}else{ultimo_pago = data.ultimo_pago;} - if (data.inm_ficha == null){ficha = "SIN FICHA";}else{ficha = data.inm_ficha;} - if (data.obs == null){observaciones = "SIN OBSERVACIONES";}else{observaciones = data.obs;} - $('#map').css('cursor', 'pointer'); - $('#tool-tip').show().html( - // Contenido del Tool-Tip - '

    Informacion Adicional

    ' + - '
    ' + - '

    FICHA: ' + ficha + '

    ' + - '

    Manzana: ' + data.cc_man + '

    ' + - '

    Numero de Lote: ' + data.cc_lote + '

    ' + - '

    OBS.: ' + observaciones + '

    ' - ); - $(document).bind('mousemove', event); - document.getElementById("ultimo").innerHTML = ultimo_pago; - document.getElementById("ccc").innerHTML = cuenta; - }); - //Feature Mouse OUT - layer.getSubLayer(0).on('featureOut', function(e,pos,latlng,data){ - $('#tool-tip').hide(); - $(document).unbind('mousemove', event, false); - }); - - el.map.addLayer(layer, false); - // make sure the base layer stays below the cdb layer - el.mapboxTiles.bringToBack(); - }).on('done', function() { - }); // end cartodb.createLayer! - - }; - - var showFeature = function (cartodb_id, ccc) { - $('#box2').show(); - $('#tool-tip').hide(); - $.ajax({ - url: "api/callREAD.php", - type: "POST", - data: {cartodb_id: cartodb_id, type: 'lote', entidad: entidad}, - dataType: 'json', - success: function (geojson) { - if (el.polygon) {el.map.removeLayer(el.polygon);} - el.polygon = L.geoJson(geojson, { - style: { - color: "#000", - fillColor: "#edd711", - weight: 6, - opacity: 0.8, - fillOpacity: 0.2 - } - }); - el.map.fitBounds(el.polygon.getBounds(), {maxZoom: 17}); - el.polygon.addTo(el.map); - //console.log(polygon.getBounds()); //DEFINICION DEL POLIGONO - if (typeof impuesto !== "undefined") { - //console.log(entidad, impuesto, estado); - $.ajax - ({ - url: 'login/get_liquidacion.php', //Se parsea el numero de ccc a fin de obtener los datos del lote - type: 'POST', - data: {ccc: ccc, entidad: entidad, impuesto: impuesto, estado: estado},//parseo de ccc - dataType: "json", //text or html or json or script - success:function(data) - { - var largo = data.length; - //SE LIMPIA EL DIV DE RESULTADOS - $("#toggle_resumen").html("").append('Mostrar Todos'); - $("#box").css({'opacity':'0.8'}); - //TODO: aca podria haber sido overlowY en el "scroll" para contemplar solo el scroll vertical, preferi dejar ambos para que se "note que hay algo" - //console.log(largo); - - if (largo > 0){ - // SE CREA EL INFORME POR LOTE - $("#resumen").html("").css({display: 'block', height: '90%', overflow: 'scroll'} - ).append('' + - '

    Informe Catastral

    ' + - '

    Lote: '+ccc+' Ficha: '+data[0].inm_ficha+'

    '+ - //SE CREA LA TABLA PARA EL RESUMEN - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''); - //SE IMPRIMEN LOS DATOS DEL LOTE - var sum = 0; - $.each(data,function (i,item) { - switch (item.liq_estado){ - case 'REG': - estadopago = 'PENDIENTE'; - tiporesumen = 'ADEUDADO'; - break; - case 'PAG': - tiporesumen = 'PAGADO'; - estadopago = item.liq_fecpago; - break; - } - sum += parseInt(item.liq_importe_apagar); - - $('#resumen_table').append( - '' + - '' + - '' + - '' + - '' + - '' + - '' - ); - //console.log(sum, item); - }); - $('#resumen').append( - '
    Ejercicio FiscalTributoEstadoImporteFecha de pago
    '+item.ejer_fisca+''+item.trb_tributo+''+item.liq_estado+''+$.number(item.liq_importe_apagar,0,',','.')+''+estadopago+'

    Total '+tiporesumen+': '+ $.number(sum,0,',','.')+' Gs.

    '); - $('#toggle_resumen').append('Ocultar Resumen'+ - '' - ); - }else{ - $("#box2").css({display: 'block', height: 'auto'}); - $("#resumen").html("").css({display: 'block', height: 'auto', overflow: ''}).append('

    No se encontraron Datos

    '); - } - }, - error:function(data){ - $('#resumen').html("").append('

    No se encontraron datos

    ') - } - });; - }else { - //alert("FAVOR ELIJA TIPO DE IMPUESTO!"); - } - } - }); - }; - - // change the cartoCSS of a layer - var changeCartoCSS = function(layer, css) {layer.setCartoCSS(css);}; - - // change SQL query of a layer - var changeSQL = function(layer, sql) {layer.setSQL(sql);}; - - // corresponding cartoCSS & SQL changes to tax lot layer buttons - // legends are displayed or hidden as needed - el.taxLotActions = { - regular : function() { - changeCartoCSS(el.taxLots, el.styles.regular); - changeSQL(el.taxLots, el.params.morosidadtodos); - renderLegend(null); - return true; - }, - totales : function() { - //TODO: MEJORAR LOGICA!! - switch (estado){ - case 'REG': - colormaximo = '#BD0026'; - color80 = '#F03B20'; - color60 = '#FFCC00'; - color40 = '#95ad42'; - color20 = '#2a722f'; - colorminimo = '#8e8e8e'; - titulo = 'ADEUDADO'; - label_leyenda = 'NO REGISTRADOS/NO LIQUIDADOS'; - break; - case 'PAG': - colormaximo = '#2a722f'; - color80 = '#95ad42'; - color60 = '#FFCC00'; - color40 = '#F03B20'; - color20 = '#BD0026'; - colorminimo= '#8e8e8e'; - titulo = 'PAGADO'; - label_leyenda = 'NO REGISTRADOS/NO PAGADOS'; - break; - } - - if (porciento80 === minimo) { - lotetotales = '#e'+entidad+'_lotes_conccc{polygon-fill: #FFFFB2;polygon-opacity: 0.8;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'+ - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' > ' +porciento80+ ' ] {polygon-fill: '+colormaximo+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' = ' +porciento80+ '] {polygon-fill: '+color80+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' < ' +minimo+ '] {polygon-fill: '+colorminimo+';}'+ - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' = null] {polygon-fill: '+colorminimo+';}' - ; - } - else { - lotetotales = '' + - '#e'+entidad+'_lotes_conccc{polygon-fill: #FFFFB2;polygon-opacity: 0.8;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'+ - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' > ' +porciento80+ ' ] {polygon-fill: '+colormaximo+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento80+ '] {polygon-fill: '+color80+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento60+ '] {polygon-fill: '+color60+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento40+'] {polygon-fill: '+color40+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento20+ '] {polygon-fill: '+color20+';}' + - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' < ' +minimo+ '] {polygon-fill: '+colorminimo+';}'+ - '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' = null] {polygon-fill: '+colorminimo+';}' - ; - } - changeCartoCSS(el.taxLots, lotetotales); - //el.params.morosidadtodos+ " where (trb_tributo ilike '"+impuesto+"' and "+tipodeuda+" > 0) or trb_tributo is null"; - sqltotales = el.params.morosidadtodos + " where (trb_tributo ilike '"+impuesto+"' or trb_tributo is null) "; - - if (sqlnuevo === "") { - changeSQL(el.taxLots, sqltotales); - }else{ - filtro = parseInt(array.rows[idactual][filtroactual]); - //console.log (typeof filtro); - sqlnuevo = sqlnuevo + " and "+tipodeuda+" " + op + " " + eval(filtro); - //console.log(sqlnuevo); - changeSQL(el.taxLots, sqlnuevo); - changeCartoCSS(el.taxLots, lotetotales); - sqlnuevo = ""; - filtro = ""; - } - //TODO: MEJORAR LOGICA DE RENDER LEGENDA! - if (porciento80 === minimo){ - renderLegend( - {title : "Total "+ titulo, - items : [ - {color : colormaximo, label : "> " +$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op : " > " }, - {color : color80, label : "= "+$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op : " = " }, - {color : "hsl(48, 100%, 50%)", label : label_leyenda, filtroid : "minimo", op : " < " } - ] - } - ); - } - else{ - renderLegend( - {title : "Total "+ titulo, - items : [ - {color : colormaximo, label : "> " +$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op : " > " }, - {color : color80, label : "<= "+$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op: " <= " }, - {color : color60, label : "<= "+$.number(porciento60,0,',','.')+" Gs", filtroid : "porciento60", op: " <= "}, - {color : color40, label : "<= "+$.number(porciento40,0,',','.')+" Gs", filtroid : "porciento40", op: " <= " }, - {color : color20, label : "<= "+$.number(porciento20,0,',','.')+" Gs", filtroid : "porciento20", op: " <= " }, - {color : "#787878", label : label_leyenda, filtroid : "minimo", op: "<"} - ] - } - ); - } - $('#tool-tip').show(); - $('#box').show(); - //TODO: seguir //getCDBData().getSubLayer(0).hide(); - return true; - }, - ultimopagado : function(){ - switch (estado){ - case 'REG': //TODO: REVISAR LOGICA - colormaximo = '#2a722f'; - color80 = '#95ad42'; - color60 = '#FFCC00'; - color40 = '#F03B20'; - color20 = '#BD0026'; - colorminimo= '#8e8e8e'; - titulo = 'ADEUDADO'; - break; - case 'PAG': - colormaximo = '#2a722f'; - color80 = '#95ad42'; - color60 = '#FFCC00'; - color40 = '#F03B20'; - color20 = '#BD0026'; - colorminimo= '#8e8e8e'; - titulo = 'PAGADO'; - break; - } - //TODO: Dinamico - lotesultimopagado = '#e'+entidad+'_lotes_conccc{polygon-fill: #006D2C;polygon-opacity: 0.8;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago = '+periodo+'] {polygon-fill: '+colormaximo+';}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo1+'] {polygon-fill: '+color80+';}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo2+'] {polygon-fill: '+color60+';}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo3+'] {polygon-fill: '+color40+';}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo4+'] {polygon-fill: '+color20+';}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo5+'] {polygon-fill: '+color20+';}'+ - '#e'+entidad+'_lotes_conccc [ ultimo_pago = null] {polygon-fill: '+colorminimo+';}'; - changeCartoCSS(el.taxLots, lotesultimopagado); - sqlultimopagado = el.params.morosidadtodos+ " where (trb_tributo ilike '"+impuesto+"' and "+tipodeuda+" > 0) or trb_tributo is null"; - //console.log(sqlultimopagado); - if (sqlnuevo === ""){changeSQL(el.taxLots, sqlultimopagado);} - else { - sqlnuevo = sqlnuevo + "and ultimo_pago " +op+ " " + eval(filtroactual); - //console.log(sqlnuevo); - changeSQL(el.taxLots, sqlnuevo); - changeCartoCSS(el.taxLots, lotesultimopagado); - sqlnuevo = ""; - filtro = ""; - } - //TODO: Debe ser dinamico - renderLegend({ - title : "Ultimo "+ titulo, - items : [ - {color : colormaximo, label : "= " + periodo, filtroid : periodo, op : " = " }, // igual a ultimo anho - {color : color80, label : " <= " + periodo1, filtroid : periodo1, op : " <= " }, - {color : color60, label : "<= "+ periodo2, filtroid : periodo2, op : " <= " }, - {color : color40, label : "<= "+ periodo3, filtroid : periodo3, op : " <= " }, - {color : color20, label : "<= "+ periodo4, filtroid : periodo4, op : " <= " }, - {color : color20, label : "<= "+ periodo5, filtroid : periodo5, op : " <= " }, - {color : colorminimo, label : "SIN DEUDA O DEUDAS PRESCRIPTAS", filtroid : periodo6, op : "=<" } - ] - }); - return true; - } - }; - - // add tax lot layer button event listeners - var initButtons = function() { - $('.button').click(function(e) { - //e.preventDefault(); - $(document).ajaxStart(function() { Pace.restart(); }); - limpiar(); - $('.button').removeClass('active'); - $(this).addClass('active'); - idactual = $(this).attr('name'); - impuesto = array.rows[idactual].trb_tributo; - estado = array.rows[idactual].estado; - switch (estado) { - case 'REG':tipodeuda = "trb_total_deuda";break; - case 'PAG':tipodeuda = "trb_total_pago";break; - } - maximo = parseInt(array.rows[idactual].maximo); - minimo = parseInt(array.rows[idactual].minimo); - porciento20 = parseInt(array.rows[idactual].porciento20); - porciento40 = parseInt(array.rows[idactual].porciento40); - porciento60 = parseInt(array.rows[idactual].porciento60); - porciento80 = parseInt(array.rows[idactual].porciento80); - tipofiltro = $(this).attr('id'); - app.map.el.taxLotActions[tipofiltro](); - var sqlnuevo = ""; - //console.log(tipofiltro); - //console.log(idactual, impuesto, estado, maximo, minimo, porciento20, porciento40, porciento60, porciento80); - //console.log(tipodeuda); - //app.map.el.taxLots.show(); - }); - } - - //SUBFILTRO ONCLICK EN LA LEYENDA - var initsubfiltro = function(e) { - $(".subfiltro").click(function() { - //TODO: AL ELGIR UN FILTRO, PONER EN GRIS LOS DEMAS - //limpiarfiltros(); - $(this).addClass("selected"); - filtroactual = $(this).attr(toString("filtroid")); - op = $(this).attr("op"); - //console.log(filtroactual, op); - //TODO: HASTA LLEGUE POR HOY 11/12/2017 12:26 - sqlnuevo = el.params.morosidadtodos + " where trb_tributo ilike '"+impuesto+"'"; - - app.map.el.taxLotActions[tipofiltro](); - - }); - } - - - // Muestra las capas adicionales a medida que son marcados los checkboxes - var initCheckboxes = function() { - var checkboxDOB = $('input.dob:checkbox'), $manz = $('#manz'), $calle = $('#calle'), $sinccc = $('#sinccc'); - $manz.change(function() {if ($manz.is(':checked')) {el.capaMANZ.show()} else {el.capaMANZ.hide()}}); - $calle.change(function() {if ($calle.is(':checked')) {el.capaCALLES.show()}else {el.capaCALLES.hide()}}); - $sinccc.change(function(){if ($sinccc.is(':checked')){el.capasinCCC.show()}else {el.capasinCCC.hide()}}); - } - - // function to render choropleth legends - var renderLegend = function(data) { - if (data === null) { - //el.legend.addClass('hidden'); - el.legend.removeClass('hidden'); - return; - } - var legendData = {title : data.title,items : data.items,}; - el.legend.html(el.template(legendData)); - if (el.legend.hasClass('hidden')) el.legend.removeClass('hidden'); - initsubfiltro(); - } - - // Botones de Zoom Custom - var initZoomButtons = function(){ - $('#zoom-in').on('click', function(){el.map.zoomIn();}); - $('#zoom-out').on('click', function(){el.map.zoomOut();}); - } - - - - // get it all going! - var init = function() { - //searchAddress(); - initZoomButtons(); - $(document).ajaxStart(function() { Pace.restart(); }); //EFECTO "CARGANDO..." - initCheckboxes(); - initButtons(); - $(document).ajaxStart(function() { Pace.restart(); }); //EFECTO "CARGANDO..." - initMap(); - } - - // only return init() and the stuff in the el object - return { - init : init, - el : el - } - -})(window, document, jQuery, _); - -// call app.map.init() once the DOM is loaded -window.addEventListener('DOMContentLoaded', function(){ - app.conf.init(); - app.map.init(); -}); \ No newline at end of file diff --git a/GIS-GEOSERVER/mapa_mapStyles.js b/GIS-GEOSERVER/mapa_mapStyles.js deleted file mode 100644 index 07852ff..0000000 --- a/GIS-GEOSERVER/mapa_mapStyles.js +++ /dev/null @@ -1,387 +0,0 @@ -/**** CartoCSS for styling tax lot data ****/ -var app = app || {}; - -var conficha, sinficha = ''; - -var actualizar_navegacion = function () { - switch (mapa) { - case 'morosidad': - subseccion = 'Por tipo de Impuestos'; - break; - case 'zonas': - subseccion = 'Por Zona Tributaria'; - ttc1 = 'FICHA'; - ttc2 = 'ZONA'; - ttc3 = 'OBS'; - break; - case 'frentes': subseccion = 'Por tipo de Pavimento'; break; - case 'notificacion': subseccion = 'Estado de Notificación'; break; - case 'migracion': subseccion = 'Seguimiento de actualizaciones'; break; - case 'baldios': subseccion = 'Lotes Baldios'; break; - case 'baches': - //render pagina baches - break; - } - - //Nombrar Seccion y Subseccion - $("#seccion").text(seccion); - $("#subseccion").text(subseccion); - - //Mostrar elementos ocultos (template) - $("#search-container").removeAttr('hidden'); - $("#ui-zoom").removeAttr('hidden'); - $("#ui-legend").removeAttr('hidden'); - $("#tool-tip").removeAttr('hidden'); - - Pace.restart(); - -} - - -//app.mapStyles = (function(idactual){ -app.mapStyles = (function(){ - return { - // default style, all lots are the same color - regular : '' + - '#e'+entidad+'_lotes_conccc{'+ - 'polygon-fill: hsl(200,40%,90%);' +'polygon-opacity: 0.2;' +'line-color: #000;' +'line-width: 0.2;' +'line-opacity: 0.5;' + - '}', - inicio : '' + - '#e'+entidad+'_lotes_conccc{'+ - 'polygon-fill: #FFFFFF;'+'polygon-opacity: 0.7;'+'line-color: #000000;'+'line-width: 0.5;'+'line-opacity: 1;'+ - '}', - iniciomanz : '' + - '#e'+entidad+'_lotes_conccc{'+ - 'polygon-fill: #FFFFFF;'+'polygon-opacity: 0.7;'+'line-color: #000000;'+'line-width: 0.5;'+'line-opacity: 1;'+ - '}', - manzanas : ''+ - '#e'+entidad+'_manzanas{' + - 'polygon-fill: #FFA300; polygon-opacity: 0.2; line-color: #FFF; line-width: 0.5; line-opacity: 1;' + - '}' + - '#e'+entidad+'_manzanas::labels [zoom >= 16] {'+ - 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ - 'text-size: 16;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #000;'+ - 'text-halo-fill: #7f7676;'+ 'text-halo-radius: 3;'+ - 'text-dy: 0;'+ 'text-opacity: 0.2;'+ 'text-allow-overlap: false;'+ - 'text-placement: point;'+ 'text-placement-type: simple;'+ - '}'+ - '#e'+entidad+'_manzanas::labels [zoom >= 18] {'+ - 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ - 'text-size: 40;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #000;'+ - 'text-halo-fill: #3f3e3e;'+ 'text-halo-radius: 5;'+ - 'text-dy: 0;'+'text-opacity: 0.2;'+'text-allow-overlap: false;'+ - 'text-placement: point;'+'text-placement-type: simple;'+ - '}', - manzanascarga : ''+ - '#e'+entidad+'_manzanas{' + - 'polygon-fill: #FFA300; polygon-opacity: 0; line-color: #FFF; line-width: 1; line-opacity: 1;' + - '}' + - '#e'+entidad+'_manzanas::labels [zoom >= 16] {'+ - 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ - 'text-size: 16;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #FFF;'+ - 'text-halo-fill: #7f7676;'+ 'text-halo-radius: 3;'+ - 'text-dy: 0;'+ 'text-opacity: 0.5;'+ 'text-allow-overlap: false;'+ - 'text-placement: point;'+ 'text-placement-type: simple;'+ - '}'+ - '#e'+entidad+'_manzanas::labels [zoom >= 18] {'+ - 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ - 'text-size: 40;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #FFF;'+ - 'text-halo-fill: #3f3e3e;'+ 'text-halo-radius: 5;'+ - 'text-dy: 0;'+'text-opacity: 0.5;'+'text-allow-overlap: false;'+ - 'text-placement: point;'+'text-placement-type: simple;'+ - '}', - calles : '#e'+entidad+'_calles{line-color: #0F3B82; line-width: 2; line-opacity: 0.7; }', - lotesincc : '#e'+entidad+'_lotes_sinccc{polygon-fill: #A53ED5; polygon-opacity: 0.6; line-color: #FFF; line-width: 0.5; line-opacity: 1;}', - capazonastrib : '' + - '#e'+entidad+'_zonas_tributarias{'+ - 'polygon-fill: #FF6600;'+'polygon-opacity: 0;'+'line-color: #000000;'+'line-width: 3;'+'line-opacity: 1;'+ - '}'+ - '#e'+entidad+'_zonas_tributarias::labels {'+ - 'text-name: [description];'+ - 'text-face-name: "DejaVu Sans Book";'+ - 'text-size: 20;'+ - 'text-label-position-tolerance: 0;'+ - 'text-fill: #000;'+ - 'text-halo-fill: #FFF;'+ - 'text-halo-radius: 3;'+ - 'text-dy: -10;'+ - 'text-allow-overlap: true;'+ - 'text-placement: line;'+ - 'text-placement-type: simple;'+ - '}', - //POR ZONAS - ZONAS TRIBUTARIAS - zonas : { - todos : '' + - '#e'+entidad+'_lotes_conccc {'+ - 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ - '}'+ - '#e'+entidad+'_lotes_conccc[inm_tipo_ur="R"] {'+'polygon-fill: #229A00;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tipo_ur="U"] {'+'polygon-fill: #2167AB;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tipo_ur=null] {'+'polygon-fill: #FFA300;'+'}' - , - R : '' + - '#e'+entidad+'_lotes_conccc[inm_tipo_ur="R"] {'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+'polygon-fill: #229A00;'+'}' - , - U : '' + - '#e'+entidad+'_lotes_conccc[inm_tipo_ur="U"] {'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+'polygon-fill: #2167AB;'+'}' - , - null : '' + - '#e'+entidad+'_lotes_conccc[inm_tipo_ur=null] {'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+'polygon-fill: #FFA300;'+'}' - } - , - //ZONAS TRIBUTARIAS - zonastributarias : { - todos : '' + - '#e'+entidad+'_lotes_conccc {'+ - 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ - '}'+ - '#e'+entidad+'_lotes_conccc[zonas_tributarias="0-0-0"] {'+'polygon-fill: #000000;'+'}'+ - '#e'+entidad+'_lotes_conccc[zonas_tributarias="R-1-1"] {'+'polygon-fill: #229A00;'+'}'+ - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-1-0"] {'+'polygon-fill: #F84F40;'+'}'+ - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-2-0"] {'+'polygon-fill: #0F3B82;'+'}'+ - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-3-0"] {'+'polygon-fill: #ffff00;'+'}'+ - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-4-0"] {'+'polygon-fill: #ff0000;'+'}' - , - //{color: "#ffff00", label: "U-3-0"}, - //{color: "#ff0000", label: "U-4-0"}, - null : '' + - '#e'+entidad+'_lotes_conccc[zonas_tributarias="0-0-0"] {'+'polygon-fill: #000000;'+'}' - , - R11 : '' + - '#e'+entidad+'_lotes_conccc[zonas_tributarias="R-1-1"] {'+'polygon-fill: #229A00;'+'}' - , - U10 : '' + - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-1-0"] {'+'polygon-fill: #F84F40;'+'}' - , - U20 : '' + - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-2-0"] {'+'polygon-fill: #0F3B82;'+'}' - , - U30 : '' + - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-3-0"] {'+'polygon-fill: #ffff00;'+'}' - , - U40 : '' + - '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-4-0"] {'+'polygon-fill: #ff0000;'+'}' - } - , - //TIPO PAVIMENTO - frentepavimento : { - todos : '' + - '#e'+entidad+'_lotes_conccc{'+ - 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ - '}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav="T"] {'+'polygon-fill: #FF2900;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav="R"] {'+'polygon-fill: #894c4c;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav="E"] {'+'polygon-fill: #305784;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav="D"] {'+'polygon-fill: #6ba75f;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav="A"] {'+'polygon-fill: #222222;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav="H"] {'+'polygon-fill: #6ba75f;'+'}'+ - '#e'+entidad+'_lotes_conccc[inm_tpav=null] {'+'polygon-fill: #FFCC00;'+'}'//TODOS - , - asfalto : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="A"] {'+'polygon-fill: #222222;'+'}'//TODO: VARIABLE DINAMICA - , - hormigon : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="H"] {'+'polygon-fill: #6ba75f;'+'}'//TODO: VARIABLE DINAMICA - , - empedrado : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="E"] {'+'polygon-fill: #305784;'+'}' - , - adoquin : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="D"] {'+'polygon-fill: #6ba75f;'+'}' - , - tierra : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="T"] {'+'polygon-fill: #FF2900;'+'}' - , - ripio : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="R"] {'+'polygon-fill: #894c4c;'+'}' - , - nohab : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav="R"] {'+'polygon-fill: #894c4c;'+'}' - , - sindatos : '' + - '#e'+entidad+'_lotes_conccc[inm_tpav=null] {'+'polygon-fill: #FFCC00;'+'}' - } - , - // red highlight - red : '' + - '#e'+entidad+'_lotes_conccc{'+ - 'polygon-fill: #006D2C;' +'polygon-opacity: 0.8;' +'line-color: #FFF;' +'line-width: 0.5;' +'line-opacity: 1;' + - '}' - , - notificaciones: '' + - '#e'+entidad+'_lotes_conccc {'+ - 'polygon-opacity: 0.7;'+'line-color: #000000;'+'line-width: 0.5;'+'line-opacity: 0.5;'+ - '}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=9] {'+'polygon-fill: #69A9DC;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=6] {'+'polygon-fill: #95AD42;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=7] {'+'polygon-fill: #38A73B;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=4] {'+'polygon-fill: #2A722F;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=1] {'+'polygon-fill: #FDD344;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=2] {'+'polygon-fill: #CD9335;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=3] {'+'polygon-fill: #DF7C2B;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=8] {'+'polygon-fill: #F73235;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=5] {'+'polygon-fill: #FF9900;'+'}'+ - '#e'+entidad+'_lotes_conccc[tipo_instancia=null] {'+'polygon-fill: #FFFFFF;'+'}', - migracion: '' + - '#e'+entidad+'_lotes_conccc {'+ - 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ - '}'+ - '#e'+entidad+'_lotes_conccc[actualizacion_status=0] {'+'polygon-fill: #5CA2D1;'+'}'+ - '#e'+entidad+'_lotes_conccc[actualizacion_status=1] {'+'polygon-fill: #229A00;'+'}' - , - migraciontipo: '' + - '#e'+entidad+'_lotes_conccc {'+ - 'polygon-opacity: 0.7;'+ 'line-color: #FFF;'+ 'line-width: 0.5;'+ 'line-opacity: 1;'+ - '}'+ - '#e'+entidad+'_lotes_conccc[actualizacion_codigo=1] {'+'polygon-fill: #79797a;'+'}'+ - '#e'+entidad+'_lotes_conccc[actualizacion_codigo=2] {'+'polygon-fill: #f73235;'+'}'+ - '#e'+entidad+'_lotes_conccc[actualizacion_codigo=3] {'+'polygon-fill: #447fbf;'+'}'+ - '#e'+entidad+'_lotes_conccc[actualizacion_codigo=4] {'+'polygon-fill: #154a18;'+'}', - baldios : { - todos: '' + - '#e' + entidad + '_lotes_conccc {' + 'polygon-opacity: 0.7;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + - '#e' + entidad + '_lotes_conccc{' + - '[valor_porcentaje=0] {polygon-fill: #F11810;}' + - '[valor_porcentaje >0][valor_porcentaje <=10]{polygon-fill: #FF6600;}' + - '[valor_porcentaje > 10] {polygon-fill: #229A00;}' + - '[valor_porcentaje=null] {polygon-fill: #FFCC00;}' + - '}', - baldio: '#e' + entidad + '_lotes_conccc[valor_porcentaje = 0] {' + 'polygon-fill: #F11810;' + '}', - baldioconst: '#e' + entidad + '_lotes_conccc[valor_porcentaje >0][valor_porcentaje <=10] {' + 'polygon-fill: #FF6600;' + '}', - nobaldio: '#e' + entidad + '_lotes_conccc[valor_porcentaje > 10] {' + 'polygon-fill: #229A00;' + '}', - sindatos: '#e' + entidad + '_lotes_conccc[valor_porcentaje = null] {' + 'polygon-fill: #FFCC00;' + '}' - }, - lotes_recoleccion: '' + - '#e9999_lotes_conccc {' + 'polygon-opacity: 0.7;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + - '#e9999_lotes_conccc[ruta_id="1"] {' + 'polygon-fill: #A53ED5;' + '}' + - '#e9999_lotes_conccc[ruta_id="2"] {' + 'polygon-fill: #229A00;' + '}', - sigem: { - todos: '' + - '#e'+entidad+'_lotes {' + 'polygon-opacity: 0.7;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + - '#e9999_lotes[inm_estado="ACT"] {' + 'polygon-fill: #229A00;' + '}' + - '#e9999_lotes[inm_estado="FRA"] {' + 'polygon-fill: #229A00;' + '}' + - '#e9999_lotes[inm_estado="NOT"] {' + 'polygon-fill: #229A00;' + '}' + - '#e9999_lotes[inm_estado=null] {' + 'polygon-fill: #F11810;' + '}', - conficha: ''+ - '#e9999_lotes[inm_estado="ACT"] {' + 'polygon-fill: #229A00;' + '}' + - '#e9999_lotes[inm_estado="FRA"] {' + 'polygon-fill: #229A00;' + '}' + - '#e9999_lotes[inm_estado="NOT"] {' + 'polygon-fill: #229A00;' + '}', - sinficha: '#e9999_lotes[inm_estado=null] {' + 'polygon-fill: #F11810;' + '}' - }, - nuevos: '' + - '#e' + entidad + '_lotes_conccc {' + 'polygon-opacity: 0.3;' + 'line-color: #FFF;' + 'line-width: 0.7;' + 'line-opacity: 0.5;' + '}' + - '#e' + entidad + '_lotes_conccc{' + - '[valor_porcentaje=0] {polygon-fill: #F11810;}' + - '[valor_porcentaje >0][valor_porcentaje <=10]{polygon-fill: #FF6600;}' + - '[valor_porcentaje > 10] {polygon-fill: #229A00;}' + - '[valor_porcentaje=null] {polygon-fill: #FFCC00;}' + - '}', - nuevoszoom: '' + - '#e' + entidad + '_lotes_conccc {' + 'polygon-opacity: 0.3;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + - '#e' + entidad + '_lotes_conccc{' + - '[valor_porcentaje=0] {polygon-fill: #F11810;}' + - '[valor_porcentaje >0][valor_porcentaje <=10]{polygon-fill: #FF6600;}' + - '[valor_porcentaje > 10] {polygon-fill: #229A00;}' + - '[valor_porcentaje=null] {polygon-fill: #FFCC00;}' + - '}'+ - '#e'+entidad+'_lotes_concc::labels [zoom > 18] {'+ - 'text-name: [cc_lote];'+ 'text-face-name: "DejaVu Sans Book";'+ - 'text-size: 20;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #FFF;'+ - 'text-dy: 0;'+'text-opacity: 0.5;'+'text-allow-overlap: false;'+ - 'text-placement: point;'+'text-placement-type: simple;'+ - '}', - mejoras: '' + - '#e'+entidad+'_mejoras{polygon-fill: #A53ED5; polygon-opacity: 0.6; line-color: #FFF; line-width: 0.5; line-opacity: 1;}', - estado_mejoras: '' + - '#e505_mejoras {' + 'polygon-opacity: 0.7;' + 'line-color: #000000;' + 'line-width: 0.5;' + ' line-opacity: 0;' + '}' + - '#e505_mejoras[layer="MEJORAS-CARGADAS"] {' + 'polygon-fill: #229A00;' + '}' + - '#e505_mejoras[layer=null] {' + 'polygon-fill: #1F78B4;' + '}', - estado_lotes: '' + - '#e505_lotes_conccc {' + 'polygon-opacity: 0.7;' + 'line-color: #000000;' + 'line-width: 0.1;' + 'line-opacity: 0.6;' + '}' + - '#e505_lotes_conccc[layer="DATOS-EDITADOS"] {' + 'polygon-fill: #229A00;' + '}' + - '#e505_lotes_conccc[layer="LOTES-EDITADOS"] {' + 'polygon-fill: #5CA2D1;' + '}' + - '#e505_lotes_conccc[layer=null] {' + 'polygon-fill: #FFFFFF;' + '}' - }; -})(); - -app.leyendas = (function () { - return { - pavimento: {title: "Tipo de Pavimento", - items: [ - {color: "#222222", label: "Asfalto"}, - {color: "#6ba75f", label: "Hormigón"}, - {color: "#305784", label: "Empedrado"}, - {color: "#6ba75f", label: "Adoquín"}, - {color: "#FF2900", label: "Tierra"}, - {color: "#894c4c", label: "Ripio"}, - {color: "#FFCC00", label: "Sin Datos"}, - ] - }, - zonas: {title: "Tipos de Zona", - items: [ - {color: "#229A00", label: "Rural"}, - {color: "#2167AB", label: "Urbano"}, - {color: "#FFA300", label: "Sin Datos"}, - ] - }, - zonastributarias: {title: "Zonas Tributarias", - items: [ - {color: "#229A00", label: "R-1-1"}, - {color: "#F84F40", label: "U-1-0"}, - {color: "#0F3B82", label: "U-2-0"}, - {color: "#ffff00", label: "U-3-0"}, - {color: "#ff0000", label: "U-4-0"}, - {color: "#000000", label: "Sin Datos"}, - ] - }, - notificaciones: {title: "Notificaciones", - items: [ - {color: "#69a9dc", label: "INICIO SEGUIMIENTO"}, - {color: "#95ad42", label: "RELIQUID. y ACTUALIZ."}, - {color: "#38a73b", label: "EMIS. 1RA NOTIF."}, - {color: "#2a722f", label: "1RA NOTIF. ENTREGADA"}, - {color: "#fdd344", label: "EMIS. 2DA NOTIF."}, - {color: "#cd9335", label: "2DA NOTIF. ENTREGADA"}, - {color: "#df7c2b", label: "EMIS. CERTIF. DEUDA"}, - {color: "#f73235", label: "JUICIO EJECUTIVO"}, - {color: "#FFFFFF", label: "SIN DATOS"}, - ] - }, - migracion: {title: "Estado Migracion", - items: [ - {color: "#5CA2D1", label: "SIN ACTUALIZACIONES"}, - {color: "#229A00", label: "ACTUALIZADO"}, - ] - }, - migraciontipo: {title: "Estado Migracion", - items: [ - {color: "#79797a", label: "Linea de Base"}, - {color: "#f73235", label: "Zonas Tributarias"}, - {color: "#447fbf", label: "Frentes"}, - {color: "#154a18", label: "Frentes y Zonas"}, - ] - }, - baldios: {title: "Estado LOTE", - items: [ - {color: "#F11810", label: "LOTE BALDIO"}, - {color: "#FF6600", label: "BALDIO C/ CONSTRUC."}, - {color: "#229A00", label: "LOTE NO BALDIO"}, - {color: "#FFCC00", label: "SIN DATOS"}, - ] - }, - estado_lotes: {title: "ACT. DE LOTES", - items: [ - {color: "#229A00", label: "DATOS EDITADOS"}, - {color: "#5CA2D1", label: "LOTES EDITADOS"}, - {color: "#FFFFFF", label: "LINEA BASE"}, - ] - }, - estado_mejoras: {title: "ACT. DE MEJORAS", - items: [ - {color: "#229A00", label: "MEJORAS NUEVAS"}, - {color: "#5CA2D1", label: "CARGA MASIVA"}, - ] - } - } - -})(); diff --git a/GIS-GEOSERVER/mapa_parametros.js b/GIS-GEOSERVER/mapa_parametros.js deleted file mode 100644 index d66a37f..0000000 --- a/GIS-GEOSERVER/mapa_parametros.js +++ /dev/null @@ -1,737 +0,0 @@ -/**** SQL para los distintos tipos de mapas ****/ -var app = app || {}; - -//VARIABLES GLOBALES -var tipofiltro = ""; -var param_subfiltro = ""; -var sqlnuevo = ""; -var filtroactual = ""; -var filtro = ""; -var query = ""; -var estado, idactual = ''; -var array, arraymenu, menus, capas_adicionales = ''; -var seccion, subseccion = ''; -var ttc1, ttc2, ttc3 = ''; -var loteactual = ''; - -//FUNCIONES GLOBALES - - -var mapa_zonas = function () { - mapa = 'zona'; - app.map.el.map.remove(); - app.map.init(); -} - -//muestra/oculta resumen de lote -var mostrarResumen = function() { - if($('#resumen').css('display') != 'none'){ - $('#resumen').css({ - display: 'none' - }); - $("#toggle_msg").html('Mostrar Resumen'); - document.getElementById('print_resumen').type = 'hidden'; - $("#box2").css({display: 'block', height: 'auto'}); - }else{ - $('#resumen').css({display: 'block'}); - $("#toggle_msg").html('Ocultar Resumen'); - document.getElementById('print_resumen').type = 'button'; - $("#box2").css({display: 'block', height: '500px'}); - } -}; - -//funcion para limpiar el mapa cuando se elija un nuevo filtro/operacion -var limpiar = function() { - el = app.map.el; - el.map.setView([lat, lng], zoom); - $("#resumen").html(""); - $("#resumen").css({display: 'none'}); - $("#toggle_resumen").html(""); - //document.getElementById("box").style.opacity = "0.7"; - $("#box").css({ - 'opacity': '0.7' - } - ) - $('#box2').hide(); - if (el.polygon) { - el.map.removeLayer(el.polygon); - } -}; - -window.forceReload = function(){ - if( !window.fetch)return document.location.reload( true); - var els = document.getElementsByTagName( "*"); - for( var i = 0; i < els.length; i++){ - var src = ""; - if( els[i].tagName == "A")continue; - if( !src && els[i].src)src = els[i].getAttribute( "src"); - if( !src && els[i].href)src = els[i].getAttribute( "href"); - if( !src)continue; - fetch( src, { cache: "reload"}); - } - return document.location.reload( true); -}; - -var procesar = function (identificador, operacion) { - console.log('identificador: ', identificador, ' operacion: ', operacion); - switch (operacion){ - case 'actualizar': - var ccc = document.getElementById("infoModalCCC").value; - var zona = document.getElementById("infoModalZona").value; - var mz = document.getElementById("infoModalManzana").value; - var lote = document.getElementById("infoModalLote").value; - $.ajax({ - url: "login/set_valores.php", - type: "POST", - data: {id: identificador, operacion: operacion, ccc: ccc, zona: zona, mz: mz, lote: lote}, async: false, dataType: 'json', - success: function (data) { - array = JSON.parse(data); - alert(array[0].total_rows + ' de ' + array[1].total_rows + ' agregado'); - $('#modal_editar_lotes')[0].reset(); - console.log(array); - }, - error:function(data){console.log('ndoikoi!', data);} - }); - break; - case 'eliminar': - $.ajax({ - url: "login/set_valores.php", type: "POST", data: {id: identificador, operacion: operacion}, async: false, dataType: 'json', - success: function (data) { - array = JSON.parse(data); - alert('Se ha eliminado '+ array.total_rows + ' registro/s'); - }, - error:function(data){console.log('ndoikoi!', data);} - }); - break; - case 'cancelar': - map.removeLayer(polygon); - $('#modal_editar_lotes')[0].reset(); - break; - default: - alert('Operacion no valida'); - } - - $("#infoModal").toggle(); - //forceReload(); -}; - -//Se imprime el div que contiene el informe del lote -var printDiv = function() { - var divToPrint=document.getElementById('resumen'); - var newWin=window.open('','Print-Window'); - newWin.document.open(); - newWin.document.write('' + - '' + - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+divToPrint.innerHTML+''); - newWin.document.close(); - setTimeout(function(){newWin.close();},10); -}; - -app.conf = ( - function () { - //mapa = "zonas"; - //MENU DINAMICO - var initMenu = function() { - //console.log(mapa); - seccion = 'Mapas'; - actualizar_navegacion(); - - $.ajax({ - url: "login/get_valores.php", type: "POST", data: {mapa: mapa}, async: false, dataType: 'json', - success: function (data) { - //console.log(data); - switch (mapa) { - case 'morosidad': - array = JSON.parse(data); - //console.log(array); - var estado = ''; - var idactual; - var actual = 0; - var tipo = 0; - creg = 0; - cpag = 0; - - for (var p = 0; p < array.total_rows; p++) { - var pimpuesto = array.rows[p]; - if (pimpuesto.estado === 'REG') { - if (creg === 0){ - creg = creg + 1; - estado = 'ADEUDADOS'; - menus = "" + - "
  • " + - " IMPUESTOS " + estado + "" + - "" + - "
  • "+ - "
  •  IMPUESTOS " + estado + "" + - "" + - "
  • " - break; - - case 'zonas': - array = JSON.parse(data); - - ///ZONAS/// - menus = "" + - "
  • " + - " "+ mapa.toUpperCase() + "" + - "
      " - - for (var l = 0; l < array.total_rows; l++) {//INICIO DINAMICO - zona = array.rows[l]; - //console.log(zona.inm_tipo_ur); - switch (zona.inm_tipo_ur){ - case 'R': tzona = 'RURAL'; break; - case 'U': tzona = 'URBANO'; break; - case '': case null: tzona = 'Sin Datos'; break; - } - if (zona.inm_tipo_ur === '' || zona.inm_tipo_ur === null || zona.inm_tipo_ur === 'C'){ - - }else{ - menus = menus + - "
    • " + - ""+tzona+"" + - "
    • " - } - }//FIN DINAMICO - menus = menus + - "
    • SIN DATOS
    • " + - "
    • TODOS
    • " + - "
    "+ - "
  • " - - ///ZONAS TRIBUTARIAS - $(document).ajaxStart(function() { Pace.restart(); }); - $.ajax({ - url: "login/get_valores.php", type: "POST", data: {mapa: 'zonastributarias'}, async: false, dataType: 'json', - success: function (zonastrib) { - array = JSON.parse(zonastrib); - //console.log(array); - - menus = menus + - "
  • " + - " ZONAS TRIBUTARIAS" + - "
      " - - for (var l = 0; l < array.total_rows; l++) {//INICIO DINAMICO - zona = array.rows[l]; - //console.log(zona.zonas_tributarias, zona.codigo); - switch (zona.zonas_tributarias){ - case '': case null: ztrib = 'Sin Datos'; break; - default: ztrib = zona.zonas_tributarias; - } - if (zona.codigo === '' || zona.codigo === null){ztrib = ztrib + ' (null)';} - menus = menus + - "
    • "+ztrib+"
    • " - }//FIN DINAMICO - - menus = menus + - "
    • SIN DATOS
    • " + - "
    • TODOS
    • " + - "
    "+ - "
  • " - }, - error:function(data){console.log('ndoikoi!', data);} - }); - break; - - case 'frentes': - array = JSON.parse(data); - //console.log(array, array.total_rows); - menus = ""+ - "
  • " + - " Tipos de "+ mapa.toUpperCase() + "" + - "
      " - - //Dibujado dinamico del MENU - for (var l = 0; l < array.total_rows; l++) { - pavimento = array.rows[l]; - //console.log(pavimento.inm_tpav); - switch (pavimento.inm_tpav){ - case 'A': tpavimento = 'Asfalto'; nombre = 'asfalto'; break; - case 'H': tpavimento = 'Hormigon'; nombre = 'hormigon'; break; - case 'D': tpavimento = 'Adoquin'; nombre = 'adoquin'; break; - case 'E': tpavimento = 'Empedrado'; nombre = 'empedrado'; break; - case 'T': tpavimento = 'Tierra'; nombre = 'tierra'; break; - case 'R': tpavimento = 'Ripio'; nombre = 'ripio'; break; - case 'N': tpavimento = 'No Habilitado'; nombre = 'nohab'; break; - case '': - case null: tpavimento = 'Sin Datos'; nombre = 'sindatos';break; - } - menus = menus + - "
    • " + - ""+tpavimento+"" + - "
    • " - } - menus = menus + - "
    • TODOS
    • " + - "
    "+ - "
  • " - break; - - case 'notificacion': - //NOTIFICACIONES! - array = JSON.parse(data); - //console.log(array, array.total_rows); - - menus = "" + - "
  • " + - " Tipos de "+ mapa.toUpperCase() + "" + - "
      " - - //Dibujado dinamico del MENU - for (var l = 0; l < array.total_rows; l++) { - notificaciones = array.rows[l]; - //console.log(notificaciones.tipo_instancia); - switch (notificaciones.tipo_instancia){ - case 9: estado = 'INICIO SEGUIMIENTO'; break; - case 6: estado = 'RELIQUIDACION Y ACT.'; break; - case 7: estado = 'EMISION 1RA NOTIF.'; break; - case 4: estado = '1RA NOTIF. ENTREGADA'; break; - case 1: estado = 'EMISION 2DA NOTIF.'; break; - case 2: estado = '2DA NOTIF ENTREGADA'; break; - case 3: estado = 'EMISION CERT. DEUDA'; break; - case 8: estado = 'PRES. JUICIO EJECUTIVO'; break; - default: estado = notificaciones.tipo_instancia; break; - } - //console.log(notificaciones.inm_tpav); - menus = menus + - "
    • "+estado+"
    • " - } - menus = menus + - "
    • SIN DATOS
    • " + - "
    • TODOS
    • " + - "
    "+ - "
  • " - break; - - case 'migracion': - - menus = "" + - "
  • " + - " Lotes Actualizados " + - ""+ - "
  • "+ - "
  • "+ - " Tipo Actualizacion " + - ""+ - "
  • " - break; - - case 'baldios': - //console.log(data); - - menus = "" + - "
  • " + - " Situacion de LOTES" + - ""+ - "
  • " - break; - - case 'sigem': - array = JSON.parse(data); - //console.log(array); - - conficha = array.rows[0].conficha; - sinficha = array.rows[0].sinficha; - - console.log('Con ficha: ', conficha, ' sin ficha: ', sinficha); - - menus = "" + - "
  • " + - " Situacion de LOTES" + - ""+ - "
  • " - break; - case 'actualotes': - case 'mejoras': - //console.log(data); - - menus = "" - - break; - } - }, - error:function(data){console.log('ndoikoi!', data);} - }); - switch (mapa){ - case 'sigem': - titulo = 'MAPA DE LOTES SIN FICHAS'; - break; - case 'actualotes': - titulo = 'ACTUALIZACION DE LOTES'; - break; - default: - titulo = 'MAPA DE '+ mapa; - break; - } - - if (mapa === 'zonas'){ - shape_zonas = ""+ - "" + - "Zonas Tributarias" + - "
    "; - }else{ - shape_zonas = ""; - } - - //MENU DINAMICO - arraymenu = "" + - "
    " + - "

    "+titulo.toUpperCase() + "

    "+ - "
    "+ - ""+ - //""+ - "
    "+ - "
    "+ - "
      " + - menus + - "
    " + - "
    "+ - "
    "; - - //CAPAS ADICIONALES - capas_adicionales = "" + - "
    " + - "

    CAPAS ADICIONALES

    "+ - "
    "+ - ""+ - //""+ - "
    "+ - "
    "+ - "" + - "Lotes sin CCC" + - "
    " + - "" + - "Manzanas" + - "
    " + - "" + - "Calles" + - "
    " + - shape_zonas + - "
    "+ - "
    "; - - //console.log(arraymenu); - $('#accordion').html("").html(arraymenu); - $('#capas_adicionales').append(capas_adicionales); - $('.toggle').click(function(e) { - e.preventDefault(); - - var $this = $(this); - - if ($this.next().hasClass('show')) { - $this.next().removeClass('show'); - $this.next().slideUp(150); - $('.carets').open(); - } else { - $this.parent().parent().find('li .inner').removeClass('show'); - $this.parent().parent().find('li .inner').slideUp(150); - $this.next().toggleClass('show'); - } - }); - } - - var initPage = function () { - switch (mapa){ - case 'zonas': - //$('#contenido').html("").append(""); - break; - } - } - // get it all going! - var init = function() { - initPage(); - initMenu(); - } - - return {init : init} - })(); - -var mostrarLOTE = function (cartodb_id, ccc) { - $('#box2').show(); - $('#tool-tip').hide(); - $.ajax({ - url: "api/callREAD.php", - type: "POST", - data: {cartodb_id: cartodb_id, type: 'lote', entidad: entidad}, - dataType: 'json', - success: function (geojson) { - if (app.map.el.polygon) {app.map.el.map.removeLayer(app.map.el.polygon);} - //Trae el poligono por ajax - app.map.el.polygon = L.geoJson(geojson, { - style: { - color: "#000", - fillColor: "#edd711", - weight: 6, - opacity: 0.8, - fillOpacity: 0.2 - } - }); - //Fija los limites del mapa de cuardo al poligono - app.map.el.map.fitBounds(app.map.el.polygon.getBounds(), {maxZoom: 17}); - //Agrega el poligono al mapa - app.map.el.polygon.addTo(app.map.el.map); - switch (mapa){ - case 'morosidad': - var deuda_todal = ccc; - if (typeof impuesto !== "undefined") { - //console.log(entidad, impuesto, estado); - $.ajax - ({ - url: 'login/get_liquidacion.php', //Se parsea el numero de ccc a fin de obtener los datos del lote - type: 'POST', - data: {ccc: deuda_todal, entidad: entidad, impuesto: impuesto, estado: estado},//parseo de ccc - dataType: "json", //text or html or json or script - success:function(data) - { - var largo = data.length; - //SE LIMPIA EL DIV DE RESULTADOS - $("#resumen").html(""); - $("#toggle_resumen").html(""); - $('#toggle_resumen').append('Mostrar Todos'); - $("#box").css({'opacity': '0.8'}); - //TODO: aca podria haber sido overlowY en el "scroll" para contemplar solo el scroll vertical, preferi dejar ambos para que se "note que hay algo" - //console.log(largo); - - if (largo > 0){ - // SE CREA EL INFORME POR LOTE - $('#resumen').append('' + - '

    Informe Catastral

    ' + - '

    Lote: '+ccc+' Ficha: '+data[0].inm_ficha+'

    '); - //SE CREA LA TABLA PARA EL RESUMEN - $("#resumen").append( - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''); - //SE IMPRIMEN LOS DATOS DEL LOTE - var sum = 0; - $.each(data,function (i,item) { - switch (item.liq_estado){ - case 'REG': - estadopago = 'PENDIENTE'; - tiporesumen = 'ADEUDADO'; - break; - case 'PAG': - tiporesumen = 'PAGADO'; - estadopago = item.liq_fecpago; - break; - } - sum += parseInt(item.liq_importe_apagar); - - $('#resumen_table').append( - '' + - '' + - '' + - '' + - '' + - '' + - '' - ); - //console.log(sum, item); - }); - $('#resumen').append( - '
    Ejercicio FiscalTributoEstadoImporteFecha de pago
    '+item.ejer_fisca+''+item.trb_tributo+''+item.liq_estado+''+$.number(item.liq_importe_apagar,0,',','.')+''+estadopago+'

    Total '+tiporesumen+': '+ $.number(sum,0,',','.')+' Gs.

    '); - $('#toggle_resumen').append('Ocultar Resumen'); - $('#toggle_resumen').append(''); - }else{ - $("#resumen").html(""); - $("#resumen").css({display: 'block', height: 'auto', overflow: ''}); - $("#box2").css({display: 'block', height: 'auto'}); - $('#resumen').append('

    No se encontraron Datos

    '); - } - }, - error:function(data) - { - $('#resumen').append('

    No se encontraron datos

    ') - } - });; - }else { - //alert("FAVOR ELIJA TIPO DE IMPUESTO!"); - } - break; - } - //console.log(polygon.getBounds()); - } - }); -}; - -//Buscador -$('#ctactastral').focus(function(){if ($(this).val()==="Ingrese Cta Catastral") {$(this).val("");}}); -$('#ctactastral').on('blur',function(){if ($(this).val()!=="") {buscador();$(this).val("")}}); -$(document).keyup(function (e) {if ($("#ctactastral:focus") && (e.keyCode === 13)) {buscador();$(this).val("")}}); - -var buscador = function () { - var numficha = document.getElementById("ctactastral").value; - if (numficha === null || numficha === ''){alert('Favor ingrese datos!');$('#ctactastral').value(''); - }else{ - $.ajax({ - url: "login/buscar.php", type: "POST", data: {lote: numficha, busqueda: 'lote'}, dataType: 'json', - success: function (data) { - busqueda = JSON.parse(data); - if (busqueda.total_rows === 0){ - alert('NO SE ENCONTRARON DATOS!'); - $('#ctactastral').val(""); - }else{ - cartoid = busqueda.rows[0].cartodb_id;mostrarLOTE(cartoid, numficha); - $('#ctactastral').val(""); - } - } - }) - } - -} - -//FIN FUNCIONES GLOBALES - -//URL yvyape -app.url = 'https://yvyape.yvaga.com.py/user/yvaga/api/v2/viz/'+basemap+'/viz.json'; - -//QUERY's mapas -app.param = ( - function(){ - return { - //CAPAS EXTRA - manzanas: 'SELECT * FROM e'+entidad+'_manzanas', - calles : 'SELECT * FROM e'+entidad+'_calles', - lotesincc : 'SELECT * FROM e'+entidad+'_lotes_sinccc where borrado is not true', - capazonastrib : 'SELECT * from e'+entidad+'_zonas_tributarias', - ///////////////////////////// - //BASE - all: 'SELECT * FROM e'+entidad+'_lotes_conccc', - ///////////////////////////// - //MOROSIDAD - morosidadtodos : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_liq_entidad_totalxobjeto on ccc = inm_ctacatastral', - morosidadRenSTab : 'SELECT * FROM e'+entidad+'_lotes_conccc', - morosidadVacant : "SELECT * FROM bushwick_pluto14v1 WHERE landuse = '11'", - ///////////////// - //FRENTES/ - frentetodos: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - frentepavimento: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - frentepavimentolb: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - fplbresumen: 'SELECT b.inm_tpav, count(inm_tpav) as total FROM e'+entidad+'_lotes_conccc a left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento b on ccc = inm_ctacatastral where b.inm_tpav is not null and b.inm_tpav <> \'\' GROUP BY b.inm_tpav', - //////////////// - //ZONAS - zonas : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - zonaslb : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - zonastributarias: "SELECT *," + - " (coalesce(inm_tipo_ur, '0')" + - " || '-' || " + - " coalesce(inm_zona_tributaria, '0')" + - " || '-' || " + - "coalesce(sub_zona_rural,'0')) as zonas_tributarias " + - "FROM e"+entidad+"_lotes_conccc " + - "left join sigem"+entidad+".v_inmuebles_zona_pavimento " + - "on ccc = inm_ctacatastral", - zonastributariaslb: "SELECT *," + - " (coalesce(inm_tipo_ur, '0')" + - " || '-' || " + - " coalesce(inm_zona_tributaria, '0')" + - " || '-' || " + - "coalesce(sub_zona_rural,'0')) as zonas_tributarias " + - "FROM e"+entidad+"_lotes_conccc " + - "left join sigem"+entidad+"lb.v_inmuebles_zona_pavimento " + - "on ccc = inm_ctacatastral", - ///////////////////// - ///NOTIFICACIONES//// - notificaciones: 'SELECT * FROM e'+entidad+'_lotes_conccc LEFT JOIN sigem'+entidad+'.v_seguimiento_notificaciones ON ccc = obj_numero', - //////////////////// - ///MIGRACION//////// - migracion: 'SELECT DISTINCT ON (actualizacion_proceso, obj_imponible_ficha) * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.actualizaciones on ccc = obj_imponible_id where obj_imponible_ficha is not null ORDER BY actualizacion_proceso, obj_imponible_ficha, fec_graba DESC NULLS LAST', - migraciontipo: 'SELECT DISTINCT ON (actualizacion_proceso, obj_imponible_ficha) * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.actualizaciones on ccc = obj_imponible_id where obj_imponible_ficha is not null ORDER BY actualizacion_proceso, obj_imponible_ficha, fec_graba DESC NULLS LAST', - /////////////////////// - ///RECOLECION BASURA/// - recoleccion: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - lotes_recoleccion: 'select a.cartodb_id, a.ccc, a.ccc_guion, a.the_geom, a.the_geom_webmercator, b.ruta_id, b.name, b.ruta_descripcion from e'+entidad+'_lotes_conccc a, e'+entidad+'_cobertura_recoleccion b WHERE ST_DWithin(a.the_geom_webmercator, b.the_geom_webmercator, 20)', - /////////////////////// - ///ESTADO SIGEM//// - sigem: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', - estado_mejoras: 'SELECT * FROM e'+entidad+'_mejoras where borrado is not true', - estado_lotes: 'SELECT * FROM e'+entidad+'_lotes_conccc where borrado is not true' - }; - } -)(); \ No newline at end of file diff --git a/GIS-GEOSERVER/mapas.html b/GIS-GEOSERVER/mapas.html deleted file mode 100644 index ed90aea..0000000 --- a/GIS-GEOSERVER/mapas.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - SIGEM GIS | Dashboard Institucional - - - - - - - - - -
    - - - - - - - -
    -
    -
    📊 MOROSIDAD - ÚLTIMO ADEUDADO
    - -
    -
    Último Adeudado
    -
    🟢 <= 2026
    -
    🎾 <= 2025
    -
    🟡 <= 2024
    -
    🟠 <= 2023
    -
    🔴 <= 2022
    -
    📢 <= 2021
    -
    🔘 SIN DEUDA / PRESCRIPTAS
    -
    Fuente: Sistema SIGEM
    -
    -
    -
    - - - - - - - - - diff --git a/GIS-GEOSERVER/mapas_legacy.html b/GIS-GEOSERVER/mapas_legacy.html deleted file mode 100644 index e1100cf..0000000 --- a/GIS-GEOSERVER/mapas_legacy.html +++ /dev/null @@ -1,757 +0,0 @@ - - - - - - - SISTEMA GIS - MapLibre 3D Elite - - - - - - - - -
    -
    🌍 SIGEM GIS
    - -
    -
    - - -
    - - - - -
    - -
    -
    Vista Cartográfica General
    -
    -
    - - - - - \ No newline at end of file diff --git a/GIS-GEOSERVER/mapas_repatriado.html b/GIS-GEOSERVER/mapas_repatriado.html deleted file mode 100644 index 8b1eeae..0000000 --- a/GIS-GEOSERVER/mapas_repatriado.html +++ /dev/null @@ -1,332 +0,0 @@ - - - - - - SISTEMA GIS | Dashboard Institucional - - - - - - - - - - - - - -
    - - - - - - - - -
    -
    -
    -
    Escala de Morosidad (Gs)
    -
    -
    -
    -
    - - - - - - - - - - diff --git a/GIS-GEOSERVER/mapas_restoration.html b/GIS-GEOSERVER/mapas_restoration.html deleted file mode 100644 index 0e7e53b..0000000 --- a/GIS-GEOSERVER/mapas_restoration.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - SISTEMA GIS - ADN ORIGINAL (Fase Éxito) - - - - - - - - - - - - -
    - - -
    -
    Cargando...
    -
    - Resumen Municipal - -
    - -
    - Lotes Totales: - 0 -
    -
    - En Morosidad: - 0 -
    - -
    - - - - - - - -
    - - - - - diff --git a/GIS-GEOSERVER/morosidad_style_wms.sld b/GIS-GEOSERVER/morosidad_style_wms.sld deleted file mode 100644 index f119068..0000000 --- a/GIS-GEOSERVER/morosidad_style_wms.sld +++ /dev/null @@ -1,46 +0,0 @@ - - - - morosidad_style_wms - - Estilo Morosidad por Último Pago - - - Pagado (2026) - ultimo_pago2026 - #6b90700.8#0000000.3 - - - Adeudado (2025) - ultimo_pago2025 - #b5c47a0.8#0000000.3 - - - Adeudado (2024) - ultimo_pago2024 - #ffd9660.8#0000000.3 - - - Adeudado (2023) - ultimo_pago2023 - #f080600.8#0000000.3 - - - Adeudado (2022) - ultimo_pago2022 - #d056600.8#0000000.3 - - - Adeudado (2021) - ultimo_pago2021 - #a91d1d0.8#0000000.3 - - - Otros - - #64748b0.4#0000000.2 - - - - - diff --git a/GIS-GEOSERVER/mvnw b/GIS-GEOSERVER/mvnw deleted file mode 100644 index bd8896b..0000000 --- a/GIS-GEOSERVER/mvnw +++ /dev/null @@ -1,295 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Apache Maven Wrapper startup batch script, version 3.3.4 -# -# Optional ENV vars -# ----------------- -# JAVA_HOME - location of a JDK home dir, required when download maven via java source -# MVNW_REPOURL - repo url base for downloading maven distribution -# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven -# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output -# ---------------------------------------------------------------------------- - -set -euf -[ "${MVNW_VERBOSE-}" != debug ] || set -x - -# OS specific support. -native_path() { printf %s\\n "$1"; } -case "$(uname)" in -CYGWIN* | MINGW*) - [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" - native_path() { cygpath --path --windows "$1"; } - ;; -esac - -# set JAVACMD and JAVACCMD -set_java_home() { - # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched - if [ -n "${JAVA_HOME-}" ]; then - if [ -x "$JAVA_HOME/jre/sh/java" ]; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - JAVACCMD="$JAVA_HOME/jre/sh/javac" - else - JAVACMD="$JAVA_HOME/bin/java" - JAVACCMD="$JAVA_HOME/bin/javac" - - if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then - echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 - echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 - return 1 - fi - fi - else - JAVACMD="$( - 'set' +e - 'unset' -f command 2>/dev/null - 'command' -v java - )" || : - JAVACCMD="$( - 'set' +e - 'unset' -f command 2>/dev/null - 'command' -v javac - )" || : - - if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then - echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 - return 1 - fi - fi -} - -# hash string like Java String::hashCode -hash_string() { - str="${1:-}" h=0 - while [ -n "$str" ]; do - char="${str%"${str#?}"}" - h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) - str="${str#?}" - done - printf %x\\n $h -} - -verbose() { :; } -[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } - -die() { - printf %s\\n "$1" >&2 - exit 1 -} - -trim() { - # MWRAPPER-139: - # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. - # Needed for removing poorly interpreted newline sequences when running in more - # exotic environments such as mingw bash on Windows. - printf "%s" "${1}" | tr -d '[:space:]' -} - -scriptDir="$(dirname "$0")" -scriptName="$(basename "$0")" - -# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties -while IFS="=" read -r key value; do - case "${key-}" in - distributionUrl) distributionUrl=$(trim "${value-}") ;; - distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; - esac -done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" -[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" - -case "${distributionUrl##*/}" in -maven-mvnd-*bin.*) - MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ - case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in - *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; - :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; - :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; - :Linux*x86_64*) distributionPlatform=linux-amd64 ;; - *) - echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 - distributionPlatform=linux-amd64 - ;; - esac - distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" - ;; -maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; -*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; -esac - -# apply MVNW_REPOURL and calculate MAVEN_HOME -# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ -[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" -distributionUrlName="${distributionUrl##*/}" -distributionUrlNameMain="${distributionUrlName%.*}" -distributionUrlNameMain="${distributionUrlNameMain%-bin}" -MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" -MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" - -exec_maven() { - unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : - exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" -} - -if [ -d "$MAVEN_HOME" ]; then - verbose "found existing MAVEN_HOME at $MAVEN_HOME" - exec_maven "$@" -fi - -case "${distributionUrl-}" in -*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; -*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; -esac - -# prepare tmp dir -if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then - clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } - trap clean HUP INT TERM EXIT -else - die "cannot create temp dir" -fi - -mkdir -p -- "${MAVEN_HOME%/*}" - -# Download and Install Apache Maven -verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." -verbose "Downloading from: $distributionUrl" -verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" - -# select .zip or .tar.gz -if ! command -v unzip >/dev/null; then - distributionUrl="${distributionUrl%.zip}.tar.gz" - distributionUrlName="${distributionUrl##*/}" -fi - -# verbose opt -__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' -[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v - -# normalize http auth -case "${MVNW_PASSWORD:+has-password}" in -'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; -has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; -esac - -if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then - verbose "Found wget ... using wget" - wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" -elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then - verbose "Found curl ... using curl" - curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" -elif set_java_home; then - verbose "Falling back to use Java to download" - javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" - targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" - cat >"$javaSource" <<-END - public class Downloader extends java.net.Authenticator - { - protected java.net.PasswordAuthentication getPasswordAuthentication() - { - return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); - } - public static void main( String[] args ) throws Exception - { - setDefault( new Downloader() ); - java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); - } - } - END - # For Cygwin/MinGW, switch paths to Windows format before running javac and java - verbose " - Compiling Downloader.java ..." - "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" - verbose " - Running Downloader.java ..." - "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" -fi - -# If specified, validate the SHA-256 sum of the Maven distribution zip file -if [ -n "${distributionSha256Sum-}" ]; then - distributionSha256Result=false - if [ "$MVN_CMD" = mvnd.sh ]; then - echo "Checksum validation is not supported for maven-mvnd." >&2 - echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 - exit 1 - elif command -v sha256sum >/dev/null; then - if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then - distributionSha256Result=true - fi - elif command -v shasum >/dev/null; then - if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then - distributionSha256Result=true - fi - else - echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 - echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 - exit 1 - fi - if [ $distributionSha256Result = false ]; then - echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 - echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 - exit 1 - fi -fi - -# unzip and move -if command -v unzip >/dev/null; then - unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" -else - tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" -fi - -# Find the actual extracted directory name (handles snapshots where filename != directory name) -actualDistributionDir="" - -# First try the expected directory name (for regular distributions) -if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then - if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then - actualDistributionDir="$distributionUrlNameMain" - fi -fi - -# If not found, search for any directory with the Maven executable (for snapshots) -if [ -z "$actualDistributionDir" ]; then - # enable globbing to iterate over items - set +f - for dir in "$TMP_DOWNLOAD_DIR"/*; do - if [ -d "$dir" ]; then - if [ -f "$dir/bin/$MVN_CMD" ]; then - actualDistributionDir="$(basename "$dir")" - break - fi - fi - done - set -f -fi - -if [ -z "$actualDistributionDir" ]; then - verbose "Contents of $TMP_DOWNLOAD_DIR:" - verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" - die "Could not find Maven distribution directory in extracted archive" -fi - -verbose "Found extracted Maven distribution directory: $actualDistributionDir" -printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" -mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" - -clean || : -exec_maven "$@" diff --git a/GIS-GEOSERVER/mvnw.cmd b/GIS-GEOSERVER/mvnw.cmd deleted file mode 100644 index 92450f9..0000000 --- a/GIS-GEOSERVER/mvnw.cmd +++ /dev/null @@ -1,189 +0,0 @@ -<# : batch portion -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Apache Maven Wrapper startup batch script, version 3.3.4 -@REM -@REM Optional ENV vars -@REM MVNW_REPOURL - repo url base for downloading maven distribution -@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven -@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output -@REM ---------------------------------------------------------------------------- - -@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) -@SET __MVNW_CMD__= -@SET __MVNW_ERROR__= -@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% -@SET PSModulePath= -@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( - IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) -) -@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% -@SET __MVNW_PSMODULEP_SAVE= -@SET __MVNW_ARG0_NAME__= -@SET MVNW_USERNAME= -@SET MVNW_PASSWORD= -@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) -@echo Cannot start maven from wrapper >&2 && exit /b 1 -@GOTO :EOF -: end batch / begin powershell #> - -$ErrorActionPreference = "Stop" -if ($env:MVNW_VERBOSE -eq "true") { - $VerbosePreference = "Continue" -} - -# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties -$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl -if (!$distributionUrl) { - Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" -} - -switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { - "maven-mvnd-*" { - $USE_MVND = $true - $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" - $MVN_CMD = "mvnd.cmd" - break - } - default { - $USE_MVND = $false - $MVN_CMD = $script -replace '^mvnw','mvn' - break - } -} - -# apply MVNW_REPOURL and calculate MAVEN_HOME -# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ -if ($env:MVNW_REPOURL) { - $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } - $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" -} -$distributionUrlName = $distributionUrl -replace '^.*/','' -$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' - -$MAVEN_M2_PATH = "$HOME/.m2" -if ($env:MAVEN_USER_HOME) { - $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" -} - -if (-not (Test-Path -Path $MAVEN_M2_PATH)) { - New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null -} - -$MAVEN_WRAPPER_DISTS = $null -if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { - $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" -} else { - $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" -} - -$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" -$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' -$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" - -if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { - Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" - Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" - exit $? -} - -if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { - Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" -} - -# prepare tmp dir -$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile -$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" -$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null -trap { - if ($TMP_DOWNLOAD_DIR.Exists) { - try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } - catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } - } -} - -New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null - -# Download and Install Apache Maven -Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." -Write-Verbose "Downloading from: $distributionUrl" -Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" - -$webclient = New-Object System.Net.WebClient -if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { - $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) -} -[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null - -# If specified, validate the SHA-256 sum of the Maven distribution zip file -$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum -if ($distributionSha256Sum) { - if ($USE_MVND) { - Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." - } - Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash - if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { - Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." - } -} - -# unzip and move -Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null - -# Find the actual extracted directory name (handles snapshots where filename != directory name) -$actualDistributionDir = "" - -# First try the expected directory name (for regular distributions) -$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" -$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" -if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { - $actualDistributionDir = $distributionUrlNameMain -} - -# If not found, search for any directory with the Maven executable (for snapshots) -if (!$actualDistributionDir) { - Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { - $testPath = Join-Path $_.FullName "bin/$MVN_CMD" - if (Test-Path -Path $testPath -PathType Leaf) { - $actualDistributionDir = $_.Name - } - } -} - -if (!$actualDistributionDir) { - Write-Error "Could not find Maven distribution directory in extracted archive" -} - -Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" -Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null -try { - Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null -} catch { - if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { - Write-Error "fail to move MAVEN_HOME" - } -} finally { - try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } - catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } -} - -Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/GIS-GEOSERVER/pom.xml b/GIS-GEOSERVER/pom.xml deleted file mode 100644 index 9025af6..0000000 --- a/GIS-GEOSERVER/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 3.2.4 - - - com.sigem - gis-geoserver - 0.0.1-SNAPSHOT - gis-geoserver - Backend para integración con GeoServer - - 21 - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-security - - - - io.jsonwebtoken - jjwt-api - 0.12.5 - - - io.jsonwebtoken - jjwt-impl - 0.12.5 - runtime - - - io.jsonwebtoken - jjwt-jackson - 0.12.5 - runtime - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.postgresql - postgresql - runtime - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/GIS-GEOSERVER/project.zip b/GIS-GEOSERVER/project.zip deleted file mode 100644 index c4bf442..0000000 Binary files a/GIS-GEOSERVER/project.zip and /dev/null differ diff --git a/GIS-GEOSERVER/restore_db_v18.sh b/GIS-GEOSERVER/restore_db_v18.sh deleted file mode 100644 index 8fea393..0000000 --- a/GIS-GEOSERVER/restore_db_v18.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Script de Restauración SIGEM-GIS (Fase 3) -set -e - -BACKUP_PATH="/yvyape/proyectos/sigem-gis/backup_v15_final.sql" -CONTAINER_NAME="proyecto-postgres-1" - -echo "⏳ Esperando inicialización del motor (10s)..." -sleep 10 - -echo "📥 Iniciando restauración de datos desde $BACKUP_PATH..." -# Usamos el usuario sigem_user para la restauración (Regla 1) -cat "$BACKUP_PATH" | docker exec -i "$CONTAINER_NAME" psql -U sigem_user -d postgres - -echo "🔍 Verificando bases de datos restauradas..." -docker exec -it "$CONTAINER_NAME" psql -U sigem_user -d postgres -c "\l" - -echo "📊 Verificando tablas en sigem_gis..." -docker exec -it "$CONTAINER_NAME" psql -U sigem_user -d sigem_gis -c "\dt" || echo "⚠️ Nota: Asegúrese de que la DB sigem_gis fue creada por el dumpall." diff --git a/GIS-GEOSERVER/run_backup.sh b/GIS-GEOSERVER/run_backup.sh deleted file mode 100644 index ca0d327..0000000 --- a/GIS-GEOSERVER/run_backup.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -echo "Iniciando pg_dumpall en proyecto-postgres-1..." -docker exec -t proyecto-postgres-1 pg_dumpall -U sigem_user > /yvyape/proyectos/sigem-gis/backup_v15_final.sql -echo "Respaldo finalizado en /yvyape/proyectos/sigem-gis/backup_v15_final.sql" diff --git a/GIS-GEOSERVER/run_v18_upgrade.sh b/GIS-GEOSERVER/run_v18_upgrade.sh deleted file mode 100644 index 9a3db40..0000000 --- a/GIS-GEOSERVER/run_v18_upgrade.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Script Puente de Ejecución SIGEM-GIS -set -e - -PROJECT_PATH="/yvyape/proyectos/sigem-gis" -UPGRADE_SCRIPT="$PROJECT_PATH/upgrade_to_v18.sh" - -echo "📍 Moviéndose a la carpeta del proyecto: $PROJECT_PATH" -cd "$PROJECT_PATH" - -if [ ! -f "upgrade_to_v18.sh" ]; then - echo "❌ Error: No se encontró el script de actualización en $PROJECT_PATH" - ls -la - exit 1 -fi - -echo "🔓 Otorgando permisos y ejecutando..." -chmod +x upgrade_to_v18.sh -./upgrade_to_v18.sh diff --git a/GIS-GEOSERVER/search_menu.sh b/GIS-GEOSERVER/search_menu.sh deleted file mode 100644 index 00f9ea9..0000000 --- a/GIS-GEOSERVER/search_menu.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -echo "Buscando referencias a MOROSIDAD en el directorio web..." -find /var/www/clients/client1/web12/web -type f -name "*.php" -print0 | xargs -0 grep -lHi 'morosidad' -find /var/www/clients/client1/web12/web -type f -name "*.php" -print0 | xargs -0 grep -lHi 'tributarios' diff --git a/GIS-GEOSERVER/show_fdw.sql b/GIS-GEOSERVER/show_fdw.sql deleted file mode 100644 index 43d445a..0000000 --- a/GIS-GEOSERVER/show_fdw.sql +++ /dev/null @@ -1,19 +0,0 @@ --- REPORTE DETALLADO DE CONFIGURACIÓN FDW (Servidor .123) -SELECT '--- SERVIDORES EXTRANJEROS ---' as reporte; -SELECT srvname, srvfdw, srvoptions FROM pg_foreign_server; - -SELECT '--- MAPEO DE USUARIOS ---' as reporte; -SELECT umuser::regrole as usuario_local, umoptions FROM pg_user_mapping; - -SELECT '--- TABLAS FORÁNEAS EN fdw_505 ---' as reporte; -SELECT foreign_table_schema, foreign_table_name FROM information_schema.foreign_tables -WHERE foreign_table_schema = 'fdw_505'; - -SELECT '--- DETALLE DE LA TABLA fdw_505.usuarios ---' as reporte; -SELECT column_name, data_type, is_nullable -FROM information_schema.columns -WHERE table_schema = 'fdw_505' AND table_name = 'usuarios' -ORDER BY ordinal_position; - -SELECT '--- EXTENSIONES INSTALADAS ---' as reporte; -SELECT extname, extversion FROM pg_extension; diff --git a/GIS-GEOSERVER/sigem_export.gpkg b/GIS-GEOSERVER/sigem_export.gpkg deleted file mode 100644 index 6bd1f0c..0000000 Binary files a/GIS-GEOSERVER/sigem_export.gpkg and /dev/null differ diff --git a/GIS-GEOSERVER/sigemtest.yvaga.com.py-le-ssl.conf b/GIS-GEOSERVER/sigemtest.yvaga.com.py-le-ssl.conf deleted file mode 100644 index 9ca97fc..0000000 --- a/GIS-GEOSERVER/sigemtest.yvaga.com.py-le-ssl.conf +++ /dev/null @@ -1,38 +0,0 @@ - - - ServerName sigemtest.yvaga.com.py - ServerAdmin cbareiro@yvaga.com.py - - ProxyPass /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 - ProxyPassReverse /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 - ProxyPassReverse /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /api/ http://192.168.1.162:9001/api/ timeout=1200 - ProxyPassReverse /api/ http://192.168.1.162:9001/api/ timeout=1200 - ProxyPreserveHost On - - ProxyPass /sigemweb http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 - ProxyPreserveHost On - - # --- NORMALIZACIÓN FINAL: ORQUESTACIÓN GIS-GEOSERVER VÍA PROXY MAESTRO (.20) --- - # Centralización de orquestación inteligente (GIS, GeoServer, GWC) - ProxyPass / http://192.168.1.20/ timeout=1200 - ProxyPassReverse / http://192.168.1.20/ timeout=1200 - ProxyPreserveHost On - - ErrorLog /var/log/httpd/sigemtest-error.log - SSLCertificateFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/cert.pem - SSLCertificateKeyFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/privkey.pem - Include /etc/letsencrypt/options-ssl-apache.conf - SSLCertificateChainFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/chain.pem - - diff --git a/GIS-GEOSERVER/sigemtest_original.vhost b/GIS-GEOSERVER/sigemtest_original.vhost deleted file mode 100644 index 8fbf6ff..0000000 --- a/GIS-GEOSERVER/sigemtest_original.vhost +++ /dev/null @@ -1,106 +0,0 @@ - - AllowOverride None - Require all denied - - - - - DocumentRoot /var/www/clients/client1/web12/web - - ServerName sigemtest.yvaga.com.py - ServerAdmin webmaster@sigemtest.yvaga.com.py - - - ErrorLog /var/log/ispconfig/httpd/sigemtest.yvaga.com.py/error.log - - Alias /error/ "/var/www/sigemtest.yvaga.com.py/web/error/" - ErrorDocument 400 /error/400.html - ErrorDocument 401 /error/401.html - ErrorDocument 403 /error/403.html - ErrorDocument 404 /error/404.html - ErrorDocument 405 /error/405.html - ErrorDocument 500 /error/500.html - ErrorDocument 502 /error/502.html - ErrorDocument 503 /error/503.html - - - - - - # Clear PHP settings of this website - - SetHandler None - - Options +SymlinksIfOwnerMatch - AllowOverride All - Require all granted - - - # Clear PHP settings of this website - - SetHandler None - - Options +SymlinksIfOwnerMatch - AllowOverride All - Require all granted - - - - - - # suexec enabled - - SuexecUserGroup web12 client1 - - - - Require all granted - - - - SetHandler php-fcgi - - - - - SetHandler php-fcgi - - - Action php-fcgi /php-fcgi virtual - Alias /php-fcgi /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py - FastCgiExternalServer /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py -idle-timeout 300 -socket /var/lib/php7.2-fpm/web12.sock -pass-header Authorization -pass-header Content-Type - - - #ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix:///var/lib/php7.2-fpm/web12.sock|fcgi://localhost//var/www/clients/client1/web12/web/$1 - - - SetHandler "proxy:unix:/var/lib/php7.2-fpm/web12.sock|fcgi://localhost" - - - - - - - # add support for apache mpm_itk - - AssignUserId web12 client1 - - - - # Do not execute PHP files in webdav directory - - - SecRuleRemoveById 960015 - SecRuleRemoveById 960032 - - - SetHandler None - - - DavLockDB /var/www/clients/client1/web12/tmp/DavLock - # DO NOT REMOVE THE COMMENTS! - # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE! - # WEBDAV BEGIN - # WEBDAV END - - diff --git a/GIS-GEOSERVER/sigemtest_restored.vhost b/GIS-GEOSERVER/sigemtest_restored.vhost deleted file mode 100644 index 0e52862..0000000 --- a/GIS-GEOSERVER/sigemtest_restored.vhost +++ /dev/null @@ -1,96 +0,0 @@ - - AllowOverride None - Require all denied - - - - DocumentRoot /var/www/clients/client1/web12/web - ServerName sigemtest.yvaga.com.py - ServerAdmin webmaster@sigemtest.yvaga.com.py - - # REGLAS GIS-GEOSERVER (NUEVO) - Al inicio para prioridad - ProxyPass /gis-geoserver http://192.168.1.123:8081/gis-geoserver - ProxyPassReverse /gis-geoserver http://192.168.1.123:8081/gis-geoserver - ProxyPass /geoserver http://192.168.1.123:8080/geoserver - ProxyPassReverse /geoserver http://192.168.1.123:8080/geoserver - ProxyPass /gwc http://192.168.1.123:8080/gwc - ProxyPassReverse /gwc http://192.168.1.123:8080/gwc - - ErrorLog /var/log/ispconfig/httpd/sigemtest.yvaga.com.py/error.log - - Alias /error/ "/var/www/sigemtest.yvaga.com.py/web/error/" - ErrorDocument 400 /error/400.html - ErrorDocument 401 /error/401.html - ErrorDocument 403 /error/403.html - ErrorDocument 404 /error/404.html - ErrorDocument 405 /error/405.html - ErrorDocument 500 /error/500.html - ErrorDocument 502 /error/502.html - ErrorDocument 503 /error/503.html - - - - - - - SetHandler None - - Options +SymlinksIfOwnerMatch - AllowOverride All - Require all granted - - - - SetHandler None - - Options +SymlinksIfOwnerMatch - AllowOverride All - Require all granted - - - - SuexecUserGroup web12 client1 - - - - Require all granted - - - - SetHandler php-fcgi - - - - - SetHandler php-fcgi - - - Action php-fcgi /php-fcgi virtual - Alias /php-fcgi /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py - FastCgiExternalServer /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py -idle-timeout 300 -socket /var/lib/php7.2-fpm/web12.sock -pass-header Authorization -pass-header Content-Type - - - - - SetHandler "proxy:unix:/var/lib/php7.2-fpm/web12.sock|fcgi://localhost" - - - - - - AssignUserId web12 client1 - - - - - - SecRuleRemoveById 960015 - SecRuleRemoveById 960032 - - - SetHandler None - - - DavLockDB /var/www/clients/client1/web12/tmp/DavLock - - diff --git a/GIS-GEOSERVER/sigemtest_v20_isolated.vhost b/GIS-GEOSERVER/sigemtest_v20_isolated.vhost deleted file mode 100644 index 30a01bb..0000000 --- a/GIS-GEOSERVER/sigemtest_v20_isolated.vhost +++ /dev/null @@ -1,110 +0,0 @@ - - AllowOverride None - Require all denied - - - - DocumentRoot /var/www/clients/client1/web12/web - ServerName sigemtest.yvaga.com.py - ServerAdmin webmaster@sigemtest.yvaga.com.py - - # --- NUEVAS REGLAS GIS (V20 - AISLADAS) --- - ProxyPreserveHost On - - ProxyPass http://192.168.1.123:8081/gis-geoserver - ProxyPassReverse http://192.168.1.123:8081/gis-geoserver - # Forzar que no se trate como PHP - SetHandler None - - - - ProxyPass http://192.168.1.123:8080/geoserver - ProxyPassReverse http://192.168.1.123:8080/geoserver - SetHandler None - - - - ProxyPass http://192.168.1.123:8080/gwc - ProxyPassReverse http://192.168.1.123:8080/gwc - SetHandler None - - # ------------------------------------------ - - ErrorLog /var/log/ispconfig/httpd/sigemtest.yvaga.com.py/error.log - - Alias /error/ "/var/www/sigemtest.yvaga.com.py/web/error/" - ErrorDocument 400 /error/400.html - ErrorDocument 401 /error/401.html - ErrorDocument 403 /error/403.html - ErrorDocument 404 /error/404.html - ErrorDocument 405 /error/405.html - ErrorDocument 500 /error/500.html - ErrorDocument 502 /error/502.html - ErrorDocument 503 /error/503.html - - - - - - - SetHandler None - - Options +SymlinksIfOwnerMatch - AllowOverride All - Require all granted - - - - SetHandler None - - Options +SymlinksIfOwnerMatch - AllowOverride All - Require all granted - - - - SuexecUserGroup web12 client1 - - - - Require all granted - - - - SetHandler php-fcgi - - - - - SetHandler php-fcgi - - - Action php-fcgi /php-fcgi virtual - Alias /php-fcgi /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py - FastCgiExternalServer /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py -idle-timeout 300 -socket /var/lib/php7.2-fpm/web12.sock -pass-header Authorization -pass-header Content-Type - - - - - SetHandler "proxy:unix:/var/lib/php7.2-fpm/web12.sock|fcgi://localhost" - - - - - - AssignUserId web12 client1 - - - - - - SecRuleRemoveById 960015 - SecRuleRemoveById 960032 - - - SetHandler None - - - DavLockDB /var/www/clients/client1/web12/tmp/DavLock - - diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/GisApplication.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/GisApplication.java deleted file mode 100644 index 449cd02..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/GisApplication.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.sigem.gis; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication(exclude = { - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class, - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration.class, - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration.class, - org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration.class, - org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration.class, - org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration.class -}) -public class GisApplication { - - public static void main(String[] args) { - System.out.println("Arrancando Servidor GIS ..."); - SpringApplication.run(GisApplication.class, args); - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/WebConfig.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/WebConfig.java deleted file mode 100644 index 4f36aca..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/WebConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.sigem.gis; - -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebConfig implements WebMvcConfigurer { - - @Override - public void addViewControllers(ViewControllerRegistry registry) { - // Enrutador amigable (Friendly URLs sin ".html") para el Frontend - registry.addViewController("/login").setViewName("forward:/login.html"); - registry.addViewController("/mapas").setViewName("forward:/mapas.html"); - registry.addViewController("/").setViewName("forward:/login.html"); - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/config/DataSourceConfig.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/config/DataSourceConfig.java deleted file mode 100644 index b1ca1f2..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/config/DataSourceConfig.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.sigem.gis.config; - -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.jdbc.DataSourceBuilder; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Primary; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.orm.jpa.JpaTransactionManager; -import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; -import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; -import org.springframework.transaction.PlatformTransactionManager; - -import javax.sql.DataSource; -import java.util.HashMap; - -@Configuration -public class DataSourceConfig { - - // --- DataSource 1: Master (.254) --- - @Bean - @Primary - @ConfigurationProperties("spring.datasource.master") - public org.springframework.boot.autoconfigure.jdbc.DataSourceProperties masterDataSourceProperties() { - return new org.springframework.boot.autoconfigure.jdbc.DataSourceProperties(); - } - - @Bean(name = "masterDataSource") - @Primary - public DataSource masterDataSource() { - return masterDataSourceProperties().initializeDataSourceBuilder().build(); - } - - // --- DataSource 2: GIS (.123) --- - @Bean - @ConfigurationProperties("spring.datasource.gis") - public org.springframework.boot.autoconfigure.jdbc.DataSourceProperties gisDataSourceProperties() { - return new org.springframework.boot.autoconfigure.jdbc.DataSourceProperties(); - } - - @Bean(name = "gisDataSource") - public DataSource gisDataSource() { - return gisDataSourceProperties().initializeDataSourceBuilder().build(); - } - - // --- JdbcTemplates --- - @Primary - @Bean(name = "masterJdbcTemplate") - public JdbcTemplate masterJdbcTemplate(@Qualifier("masterDataSource") DataSource dataSource) { - return new JdbcTemplate(dataSource); - } - - @Bean(name = "gisJdbcTemplate") - public JdbcTemplate gisJdbcTemplate(@Qualifier("gisDataSource") DataSource dataSource) { - return new JdbcTemplate(dataSource); - } - - // --- Configuración Explícita de JPA --- - @Primary - @Bean(name = "entityManagerFactory") - public LocalContainerEntityManagerFactoryBean entityManagerFactory( - @Qualifier("masterDataSource") DataSource dataSource) { - LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); - em.setDataSource(dataSource); - em.setPackagesToScan("com.sigem.gis"); - em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); - - HashMap properties = new HashMap<>(); - properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); - em.setJpaPropertyMap(properties); - - return em; - } - - @Primary - @Bean(name = "transactionManager") - public PlatformTransactionManager transactionManager( - @Qualifier("entityManagerFactory") LocalContainerEntityManagerFactoryBean entityManagerFactory) { - return new JpaTransactionManager(entityManagerFactory.getObject()); - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/AdminController.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/AdminController.java deleted file mode 100644 index 22815f6..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/AdminController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.sigem.gis.controller; - -import com.sigem.gis.service.FdwService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.Map; - -@RestController -@RequestMapping("/api/admin") -public class AdminController { - - @Autowired - private FdwService fdwService; - - @PostMapping("/fdw/update/{entidadId}") - public ResponseEntity updateFdw(@PathVariable String entidadId) { - Map response = new HashMap<>(); - try { - System.out.println("Solicitud de actualización FDW recibida para Entidad: " + entidadId); - fdwService.setupFdw(entidadId); - - response.put("success", true); - response.put("message", "Datos del municipio " + entidadId + " actualizados con éxito (FDW y Geometrías vinculadas)."); - return ResponseEntity.ok(response); - - } catch (Exception e) { - response.put("success", false); - response.put("message", "Error al actualizar datos: " + e.getMessage()); - return ResponseEntity.status(500).body(response); - } - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/GisController.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/GisController.java deleted file mode 100644 index 9c51fc4..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/GisController.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.sigem.gis.controller; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.http.ResponseEntity; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Map; - -@RestController -@RequestMapping("/api/gis") -public class GisController { - - @Autowired - @Qualifier("gisJdbcTemplate") - private JdbcTemplate gisJdbcTemplate; - - @Autowired - @Qualifier("masterJdbcTemplate") - private JdbcTemplate masterJdbcTemplate; - - @GetMapping("/morosidad/{entidad}/{ccc}") - public ResponseEntity getMorosidad(@PathVariable String entidad, @PathVariable String ccc) { - try { - // Consulta a la vista unificada vw_lotes_morosidad_XXX - String viewName = "public.vw_lotes_morosidad_" + entidad; - String sql = "SELECT ccc, inm_ficha, inm_ctacatastral, trb_total_deuda, trb_total_pago, ultimo_pago " + - "FROM " + viewName + " WHERE ccc = ? LIMIT 1"; - - List> results = gisJdbcTemplate.queryForList(sql, ccc); - - if (results.isEmpty()) { - // Si no hay datos en la vista (quizás lote sin deuda), buscamos solo datos de lote - return ResponseEntity.ok(Map.of("ccc", ccc, "trb_total_deuda", 0, "status", "Sin Deuda")); - } - - return ResponseEntity.ok(results.get(0)); - } catch (Exception e) { - return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); - } - } - - @GetMapping("/entidad/{id}/percentiles") - public ResponseEntity getPercentiles(@PathVariable String id) { - try { - String sql = "SELECT * FROM public.vw_percentiles_morosidad_" + id + " LIMIT 1"; - List> results = gisJdbcTemplate.queryForList(sql); - if (results.isEmpty()) return ResponseEntity.notFound().build(); - return ResponseEntity.ok(results.get(0)); - } catch (Exception e) { - return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); - } - } - - @GetMapping("/entidad/{id}/resumen") - public ResponseEntity getResumen(@PathVariable String id) { - try { - String viewName = "public.vw_lotes_morosidad_" + id; - String sql = "SELECT " + - " COUNT(*) as total_lotes, " + - " COUNT(CASE WHEN trb_total_deuda > 0 THEN 1 END) as lotes_con_deuda " + - "FROM " + viewName; - - return ResponseEntity.ok(gisJdbcTemplate.queryForList(sql).get(0)); - } catch (Exception e) { - return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); - } - } - - @GetMapping("/entidad/{id}") - public ResponseEntity getEntidadData(@PathVariable String id) { - try { - String sql = "SELECT * FROM public.entidades WHERE activo = TRUE AND entidad = ?"; - // Parse int as the FDW might require integer for 'entidad' column - int entidadId = Integer.parseInt(id); - List> results = masterJdbcTemplate.queryForList(sql, entidadId); - - if (results.isEmpty()) { - return ResponseEntity.notFound().build(); - } - - return ResponseEntity.ok(results.get(0)); - } catch (NumberFormatException e) { - return ResponseEntity.badRequest().body(Map.of("error", "ID de entidad inválido")); - } catch (Exception e) { - return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); - } - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/ProxyController.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/ProxyController.java deleted file mode 100644 index 7903cb2..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/ProxyController.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.sigem.gis.controller; - -import jakarta.servlet.http.HttpServletRequest; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; - -@RestController -public class ProxyController { - - private final HttpClient httpClient = HttpClient.newHttpClient(); - private final String GEOSERVER_INTERNAL_URL = "http://geoserver:8080/geoserver"; - - @GetMapping({"/gwc/**", "/sigem/**", "/wms/**", "/wfs/**", "/rest/**"}) - public ResponseEntity proxyGwc(HttpServletRequest request) { - try { - String path = request.getRequestURI(); - String contextPath = request.getContextPath(); // /gis-geoserver - - // Extraer la parte despues del context path - String relativePath = path.substring(contextPath.length()); - - String targetUrl = GEOSERVER_INTERNAL_URL + relativePath; - if (request.getQueryString() != null) { - targetUrl += "?" + request.getQueryString(); - } - - HttpRequest proxyRequest = HttpRequest.newBuilder() - .uri(URI.create(targetUrl)) - .GET() - .build(); - - HttpResponse response = httpClient.send(proxyRequest, HttpResponse.BodyHandlers.ofByteArray()); - - // Copiar cabeceras relevantes (Content-Type es el mas importante para PBF) - HttpHeaders headers = new HttpHeaders(); - response.headers().firstValue("Content-Type").ifPresent(ct -> headers.setContentType(MediaType.parseMediaType(ct))); - - return ResponseEntity.status(response.statusCode()) - .headers(headers) - .body(response.body()); - - } catch (Exception e) { - return ResponseEntity.status(500).build(); - } - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/WebViewController.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/WebViewController.java deleted file mode 100644 index 5b378c2..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/controller/WebViewController.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.sigem.gis.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; - -@Controller -public class WebViewController { - - @GetMapping("/login") - public String login() { - return "forward:/login.html"; - } - - @GetMapping("/mapas") - public String mapas() { - return "forward:/mapas.html"; - } - - @GetMapping("/landing") - public String landing() { - return "forward:/landing.html"; - } - - @GetMapping("/widgets") - public String widgets() { - return "forward:/widgets.html"; - } - - @GetMapping("/") - public String index() { - return "redirect:/login"; - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthController.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthController.java deleted file mode 100644 index 92a538a..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthController.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.sigem.gis.security; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.web.bind.annotation.*; -import com.sigem.gis.service.FdwService; - -import java.util.List; -import java.util.Map; - -@RestController -@RequestMapping("/api/auth") -public class AuthController { - - @Autowired - private JwtUtil jwtUtil; - - @Autowired - @Qualifier("masterJdbcTemplate") - private JdbcTemplate masterJdbcTemplate; - - @Autowired - @Qualifier("gisJdbcTemplate") - private JdbcTemplate gisJdbcTemplate; - - @Autowired - private FdwService fdwService; - - @PostMapping("/login") - public ResponseEntity login(@RequestBody AuthRequest request) { - try { - // 1. Validar existencia de entidad en directorio maestro (en el .254) - String sqlEntidades = "SELECT sigem_site, sigem_dbname, lat, lng, zoom, minzoom, maxzoom, mapa_base, boundno, boundse FROM public.entidades WHERE activo= TRUE AND entidad = ?"; - List> entidades = masterJdbcTemplate.queryForList(sqlEntidades, Integer.parseInt(request.getEntidad())); - - if (entidades.isEmpty()) { - return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new AuthResponse(null, null, "Entidad Inactiva o No Encontrada")); - } - - Map entidadData = entidades.get(0); - - // 2. Asegurar Infraestructura FDW (Regla 16: Solo crea si no existe) - fdwService.setupFdw(request.getEntidad()); - String schemaName = "fdw_" + request.getEntidad(); - - System.out.println("Validando usuario vía FDW local para entidad: " + request.getEntidad()); - - // 3. Buscar Usuario en el esquema FDW local (en el .123) - String sqlUser = "SELECT usu_nom, usu_ape, activo, pgp_sym_decrypt(usu_clave_a::bytea, '510580', 'compress-algo=0, cipher-algo=aes256')::text as clave_desencriptada " + - "FROM " + schemaName + ".usuarios " + - "WHERE usu_alias = ? AND ejer_fisca = date_part('year', now())"; - - List> usuarios = gisJdbcTemplate.queryForList(sqlUser, request.getUsername()); - - if (!usuarios.isEmpty()) { - Map userData = usuarios.get(0); - boolean isActivo = (boolean) userData.get("activo"); - String claveDesencriptada = (String) userData.get("clave_desencriptada"); - - // 4. Validación Final y Generación de Token - if (isActivo && request.getPassword().equals(claveDesencriptada)) { - String token = jwtUtil.generateToken(request.getUsername(), request.getEntidad()); - String nombreCompleto = userData.get("usu_nom") + " " + userData.get("usu_ape"); - - // Metadatos georreferenciados de la entidad - Double lat = parseDouble(entidadData.get("lat"), -25.456443); - Double lng = parseDouble(entidadData.get("lng"), -56.446949); - Integer zoom = parseInteger(entidadData.get("zoom"), 14); - Integer minZoom = parseInteger(entidadData.get("minzoom"), 5); - Integer maxZoom = parseInteger(entidadData.get("maxzoom"), 20); - String mapaBase = String.valueOf(entidadData.getOrDefault("mapa_base", "osm")); - String bounds = String.valueOf(entidadData.getOrDefault("boundno", "")) + "|" + - String.valueOf(entidadData.getOrDefault("boundse", "")); - - return ResponseEntity.ok(new AuthResponse(token, nombreCompleto, "Login Exitoso", - lat, lng, zoom, minZoom, maxZoom, mapaBase, bounds)); - } - } - - return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new AuthResponse(null, null, "Credenciales Inválidas o Cuenta de Baja")); - - } catch (Exception e) { - e.printStackTrace(); - return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new AuthResponse(null, null, "Fallo interno en el Microservicio SaaS: " + e.toString())); - } - } - - private Double parseDouble(Object val, Double def) { - if (val == null) return def; - try { - return Double.parseDouble(String.valueOf(val).trim()); - } catch (Exception e) { - return def; - } - } - - private Integer parseInteger(Object val, Integer def) { - if (val == null) return def; - try { - return Integer.parseInt(String.valueOf(val)); - } catch (Exception e) { - return def; - } - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthRequest.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthRequest.java deleted file mode 100644 index 195fbc2..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sigem.gis.security; - -public class AuthRequest { - private String username; - private String password; - private String entidad; - - public String getUsername() { return username; } - public void setUsername(String username) { this.username = username; } - - public String getPassword() { return password; } - public void setPassword(String password) { this.password = password; } - - public String getEntidad() { return entidad; } - public void setEntidad(String entidad) { this.entidad = entidad; } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthResponse.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthResponse.java deleted file mode 100644 index ede2a5a..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/AuthResponse.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.sigem.gis.security; - -public class AuthResponse { - private String token; - private String nombre; - private String message; - - // Metadatos Cartográficos (Nuevos) - private Double lat; - private Double lng; - private Integer zoom; - private Integer minZoom; - private Integer maxZoom; - private String mapaBase; - private String bounds; - - public AuthResponse(String token, String nombre, String message) { - this.token = token; - this.nombre = nombre; - this.message = message; - } - - public AuthResponse(String token, String nombre, String message, Double lat, Double lng, Integer zoom, Integer minZoom, Integer maxZoom, String mapaBase, String bounds) { - this.token = token; - this.nombre = nombre; - this.message = message; - this.lat = lat; - this.lng = lng; - this.zoom = zoom; - this.minZoom = minZoom; - this.maxZoom = maxZoom; - this.mapaBase = mapaBase; - this.bounds = bounds; - } - - // Getters y Setters - public String getToken() { return token; } - public String getNombre() { return nombre; } - public String getMessage() { return message; } - public Double getLat() { return lat; } - public Double getLng() { return lng; } - public Integer getZoom() { return zoom; } - public Integer getMinZoom() { return minZoom; } - public Integer getMaxZoom() { return maxZoom; } - public String getMapaBase() { return mapaBase; } - public String getBounds() { return bounds; } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java deleted file mode 100644 index 8db3b53..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.sigem.gis.security; - -import jakarta.servlet.FilterChain; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -import java.io.IOException; - -@Component -public class JwtAuthenticationFilter extends OncePerRequestFilter { - - private final JwtUtil jwtUtil; - - public JwtAuthenticationFilter(JwtUtil jwtUtil) { - this.jwtUtil = jwtUtil; - } - - @Override - protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) - throws ServletException, IOException { - - final String authHeader = request.getHeader("Authorization"); - - // Si no hay token en el header, continúa la cadena sin autenticar la sesión - if (authHeader == null || !authHeader.startsWith("Bearer ")) { - filterChain.doFilter(request, response); - return; - } - - final String token = authHeader.substring(7); - try { - final String username = jwtUtil.extractUsername(token); - - if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { - // Validación del Token y Carga de Contexto para el Inquilino - if (jwtUtil.validateToken(token, username)) { - // Aquí podemos en el futuro cargar el Rol exacto desde la BD - UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken( - username, - null, - null - ); - authToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); - - // Inyectar el Tenant en alguna cabecera local si fuera necesario, o mantenerlo en el SecurityContext - // Registrando sesión temporal Stateless - SecurityContextHolder.getContext().setAuthentication(authToken); - } - } - } catch (Exception e) { - // Token corrupto o expirado - logger.warn("El Token JWT recibido es inválido o ha expirado."); - } - - filterChain.doFilter(request, response); - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtUtil.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtUtil.java deleted file mode 100644 index 7e71b40..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/JwtUtil.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.sigem.gis.security; - -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.security.Keys; -import org.springframework.stereotype.Component; - -import javax.crypto.SecretKey; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -@Component -public class JwtUtil { - - // LLAVE MAESTRA JWT - GESTIONADA PARA EL ENTORNO MULTITENANT (SIGEMWEB) - private final String secret = "yvaga_sigemweb_super_secret_key_needs_to_be_at_least_32_bytes_long_2026!"; - private final SecretKey key = Keys.hmacShaKeyFor(secret.getBytes()); - - // Generar Token insertando la Entidad seleccionada (para rutear el Multitenant luego) - public String generateToken(String username, String entidadId) { - Map claims = new HashMap<>(); - claims.put("entidad", entidadId); - return createToken(claims, username); - } - - private String createToken(Map claims, String subject) { - return Jwts.builder() - .claims(claims) - .subject(subject) - .issuedAt(new Date(System.currentTimeMillis())) - // Expiración: 12 Horas de sesión activa - .expiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12)) - .signWith(key, Jwts.SIG.HS256) - .compact(); - } - - public Boolean validateToken(String token, String extractedUsername) { - final String username = extractUsername(token); - return (username.equals(extractedUsername) && !isTokenExpired(token)); - } - - public String extractUsername(String token) { - return extractClaim(token, Claims::getSubject); - } - - public String extractEntidad(String token) { - return extractAllClaims(token).get("entidad", String.class); - } - - public Date extractExpiration(String token) { - return extractClaim(token, Claims::getExpiration); - } - - private T extractClaim(String token, Function claimsResolver) { - final Claims claims = extractAllClaims(token); - return claimsResolver.apply(claims); - } - - private Claims extractAllClaims(String token) { - return Jwts.parser() - .verifyWith(key) - .build() - .parseSignedClaims(token) - .getPayload(); - } - - private Boolean isTokenExpired(String token) { - return extractExpiration(token).before(new Date()); - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/SecurityConfig.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/SecurityConfig.java deleted file mode 100644 index 8f4a802..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/security/SecurityConfig.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.sigem.gis.security; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; - -@Configuration -@EnableWebSecurity -public class SecurityConfig { - - private final JwtAuthenticationFilter jwtAuthFilter; - - public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter) { - this.jwtAuthFilter = jwtAuthFilter; - } - - @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - http - .csrf(csrf -> csrf.disable()) // Deshabilitado para APIs REST (Stateless con JWT) - .cors(cors -> cors.disable()) // Modificable luego para permitir conexiones cruzadas - .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) - .authorizeHttpRequests(authz -> authz - // Accesos no autenticados permitidos - .requestMatchers("/api/auth/**").permitAll() // Login - .requestMatchers("/api/admin/**").permitAll() // Admin FDW - .requestMatchers("/api/gis/**").permitAll() // API Datos GIS (Estadísticas) - .requestMatchers("/login.html", "/", "/mapas/**", "/login", "/error", "/landing", "/landing.html", "/widgets", "/widgets.html").permitAll() - .requestMatchers("/mapas_institucional.html").permitAll() - .requestMatchers("/css/**", "/js/**", "/img/**", "/vendor/**").permitAll() // Recursos - .requestMatchers("/gwc/**", "/sigem/**", "/wms/**", "/wfs/**", "/rest/**").permitAll() // Proxy Geoserver - - // Todas las demás llamadas API estarán protegidas mediante JWT - .requestMatchers("/api/**").authenticated() - .anyRequest().permitAll() - ) - .httpBasic(basic -> basic.disable()) // Deshabilitar específicamente HTTP Basic - .formLogin(form -> form.disable()) // Deshabilitar específicamente el formulario por defecto - // Interceptor que inyecta la lógica de JWT antes de procesar el Username/Password estándar - .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class) - .headers(headers -> headers.frameOptions(frame -> frame.sameOrigin())); - - return http.build(); - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/service/FdwService.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/service/FdwService.java deleted file mode 100644 index c2f1d7f..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/service/FdwService.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.sigem.gis.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -@Service -public class FdwService { - - @Autowired - private GeoServerService geoServerService; - - @Autowired - @Qualifier("masterJdbcTemplate") - private JdbcTemplate masterJdbcTemplate; - - @Autowired - @Qualifier("gisJdbcTemplate") - private JdbcTemplate gisJdbcTemplate; - - public void setupFdw(String entidadId) { - // 1. Obtener datos de la entidad desde el Directorio Maestro (.254) - String sqlEntidad = "SELECT sigem_site, sigem_dbname, boundno, boundse, latlong, zoom, maxzoom, minzoom " + - "FROM public.entidades WHERE entidad = ?"; - List> entidades = masterJdbcTemplate.queryForList(sqlEntidad, Integer.parseInt(entidadId)); - - if (entidades.isEmpty()) { - throw new RuntimeException("Entidad " + entidadId + " no encontrada en el directorio maestro."); - } - - Map data = entidades.get(0); - String sigemSite = (String) data.get("sigem_site"); - String sigemDbname = (String) data.get("sigem_dbname"); - String boundNo = (String) data.get("boundno"); - String boundSe = (String) data.get("boundse"); - - // Log de parámetros recuperados (Regla 5) - System.out.println("Configurando Entidad " + entidadId + ": Zoom=" + data.get("zoom") + ", Bounds=" + boundNo - + "/" + boundSe); - - // ... (lógica de extracción de host/port/user/pass igual) ... - String host = extractParam(sigemSite, "host", "127.0.0.1"); - String port = extractParam(sigemSite, "port", "5432"); - String user = extractParam(sigemSite, "user", "postgres"); - String pass = extractParam(sigemSite, "password", "x25yvaga2017"); - - String serverName = "srv_mun_" + entidadId; - String schemaName = "fdw_" + entidadId; - - // 2. Ejecutar comandos DDL en el servidor PostGIS (.123) - try { - // ... (verificación de infraestructura fdw igual hasta la creación de vistas) - // ... - String checkSql = "SELECT count(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = 'usuarios'"; - Integer count = gisJdbcTemplate.queryForObject(checkSql, Integer.class, schemaName); - - if (count == null || count == 0) { - // (creación de server, user mapping y esquema igual) - gisJdbcTemplate.execute("DROP SERVER IF EXISTS " + serverName + " CASCADE"); - gisJdbcTemplate.execute(String.format( - "CREATE SERVER %s FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '%s', port '%s', dbname '%s')", - serverName, host, port, sigemDbname)); - gisJdbcTemplate.execute( - String.format("CREATE USER MAPPING FOR sigem_user SERVER %s OPTIONS (user '%s', password '%s')", - serverName, user, pass)); - gisJdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); - gisJdbcTemplate.execute(String.format( - "IMPORT FOREIGN SCHEMA public LIMIT TO (v_liq_entidad_totalxobjeto, v_liq_entidad_percentiles, usuarios, ventanas_usuario) FROM SERVER %s INTO %s", - serverName, schemaName)); - } - - // 3. SIEMPRE Crear o Refrescar Vistas de Unión (JOIN) - String tableLotes = "public.e" + entidadId + "_lotes_conccc"; - - // Vista de Auditoría (MVT) - LIBERADA (Sin LIMIT) - String viewLotesName = "vw_lotes_morosidad_" + entidadId; - gisJdbcTemplate.execute(String.format( - "CREATE OR REPLACE VIEW public.%s AS SELECT l.*, m.inm_ficha, m.inm_ctacatastral, m.trb_total_deuda, m.trb_total_pago, m.ultimo_pago FROM %s l LEFT JOIN %s.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral", - viewLotesName, tableLotes, schemaName)); - - // Vista PNG FULL (WMS) - SIN LIMIT - String viewWmsName = "vw_lotes_wms_" + entidadId; - gisJdbcTemplate.execute(String.format( - "CREATE OR REPLACE VIEW public.%s AS SELECT l.*, m.inm_ficha, m.inm_ctacatastral, m.trb_total_deuda, m.trb_total_pago, m.ultimo_pago FROM %s l LEFT JOIN %s.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral", - viewWmsName, tableLotes, schemaName)); - - // 4. Sincronización con GeoServer - try { - // Publicar capa Auditoría (MVT) - geoServerService.publishLayer(viewLotesName, viewLotesName, null, boundNo, boundSe); - enableMvt(viewLotesName); - geoServerService.truncateCache(viewLotesName); - - // Publicar capa PNG FULL (WMS) con Estilo - geoServerService.publishLayer(viewWmsName, viewWmsName, "morosidad_style_wms", boundNo, boundSe); - geoServerService.truncateCache(viewWmsName); - } catch (Exception e) { - System.err.println("Advertencia GS: " + e.getMessage()); - } - - System.out.println("Sincronización completa para Entidad " + entidadId); - - } catch (Exception e) { - System.err.println("Error configurando FDW o Vistas: " + e.getMessage()); - throw new RuntimeException("Fallo en la automatización SIG: " + e.getMessage(), e); - } - - } - - private String extractParam(String siteParam, String key, String defaultValue) { - if (siteParam != null && siteParam.contains(key + "=")) { - String[] parts = siteParam.split(key + "="); - if (parts.length > 1) { - return parts[1].split(" ")[0].trim(); - } - } - if (key.equals("host") && siteParam != null && !siteParam.contains("=")) { - return siteParam.trim(); - } - return defaultValue; - } - - /** - * Habilita Vector Tiles (PBF) para una capa específica en el GeoServer local. - */ - public void enableMvt(String layerName) { - // Usar host interno 'geoserver' y password correcto 'geoserver' - String geoserverUrl = "http://localhost:8080/geoserver/gwc/rest/layers/sigem:" + layerName + ".xml"; - String auth = "admin:geoserver"; - String encodedAuth = java.util.Base64.getEncoder().encodeToString(auth.getBytes()); - - String xmlBody = "true" + - "image/pngimage/jpeg" + - "application/x-protobuf"; - - System.out.println("Enviando configuración MVT para: " + layerName); - - try { - java.net.URL url = new java.net.URL(geoserverUrl); - java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection(); - conn.setRequestMethod("POST"); - conn.setRequestProperty("Authorization", "Basic " + encodedAuth); - conn.setRequestProperty("Content-Type", "text/xml"); - conn.setDoOutput(true); - - // Establecer timeouts agresivos (1s) para no bloquear el LOGIN - conn.setConnectTimeout(1000); - conn.setReadTimeout(1000); - - try (java.io.OutputStream os = conn.getOutputStream()) { - os.write(xmlBody.getBytes()); - } - - int code = conn.getResponseCode(); - System.out.println("GeoServer GWC Response para " + layerName + ": " + code); - } catch (Exception e) { - System.err.println("Error habilitando MVT para " + layerName + ": " + e.getMessage()); - } - } -} diff --git a/GIS-GEOSERVER/src/main/java/com/sigem/gis/service/GeoServerService.java b/GIS-GEOSERVER/src/main/java/com/sigem/gis/service/GeoServerService.java deleted file mode 100644 index a89d358..0000000 --- a/GIS-GEOSERVER/src/main/java/com/sigem/gis/service/GeoServerService.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.sigem.gis.service; - -import org.springframework.http.*; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -@Service -public class GeoServerService { - - private final String GS_URL = "http://geoserver:8080/geoserver/rest"; - private final String GS_USER = "admin"; - private final String GS_PASS = "geoserver"; - - private final RestTemplate restTemplate; - - public GeoServerService() { - org.springframework.http.client.SimpleClientHttpRequestFactory factory = new org.springframework.http.client.SimpleClientHttpRequestFactory(); - factory.setConnectTimeout(2000); - factory.setReadTimeout(2000); - this.restTemplate = new RestTemplate(factory); - } - - /** - * Publica una vista como capa de GeoServer con un estilo específico. - */ - public void publishLayer(String layerName, String viewName, String styleName, String boundNo, String boundSe) { - ensureInfrastructureExists(); - - String workspace = "sigem"; - String datastore = "sigem_db"; - - System.out.println("Publicando Capa WMS en GeoServer: " + layerName + " (Estilo: " + styleName + ")"); - - // 1. Crear/Actualizar FeatureType (Configuración de datos y BBOX) - String url = String.format("%s/workspaces/%s/datastores/%s/featuretypes/%s", GS_URL, workspace, datastore, layerName); - - StringBuilder bboxJson = new StringBuilder(); - if (boundNo != null && boundSe != null) { - try { - String[] no = boundNo.split(","); - String[] se = boundSe.split(","); - double lat1 = Double.parseDouble(no[0].trim()); - double lon1 = Double.parseDouble(no[1].trim()); - double lat2 = Double.parseDouble(se[0].trim()); - double lon2 = Double.parseDouble(se[1].trim()); - - bboxJson.append(", \"latLonBoundingBox\": {"); - bboxJson.append(String.format("\"minx\": %f, \"maxx\": %f, \"miny\": %f, \"maxy\": %f, \"crs\": \"EPSG:4326\"", - Math.min(lon1, lon2), Math.max(lon1, lon2), Math.min(lat1, lat2), Math.max(lat1, lat2))); - bboxJson.append("}"); - } catch (Exception e) { - System.err.println("Error parseando bounds: " + e.getMessage()); - } - } - - String jsonBody = String.format( - "{\"featureType\": {\"name\": \"%s\", \"nativeName\": \"%s\", \"title\": \"%s\", \"srs\": \"EPSG:4326\" %s}}", - layerName, viewName, layerName, bboxJson.toString() - ); - - HttpHeaders headers = createHeaders(); - headers.setContentType(MediaType.APPLICATION_JSON); - HttpEntity entity = new HttpEntity<>(jsonBody, headers); - - try { - restTemplate.exchange(url, HttpMethod.PUT, entity, String.class); - } catch (Exception e) { - String postUrl = String.format("%s/workspaces/%s/datastores/%s/featuretypes", GS_URL, workspace, datastore); - try { - restTemplate.postForEntity(postUrl, entity, String.class); - } catch (Exception ex) { - System.err.println("Error publicando FeatureType: " + ex.getMessage()); - } - } - - // 2. Asignar Estilo Predeterminado a la Capa - if (styleName != null) { - String layerUrl = String.format("%s/layers/%s:%s", GS_URL, workspace, layerName); - String layerJson = String.format("{\"layer\": {\"defaultStyle\": {\"name\": \"%s\"}}}", styleName); - try { - restTemplate.exchange(layerUrl, HttpMethod.PUT, new HttpEntity<>(layerJson, headers), String.class); - System.out.println("Estilo '" + styleName + "' asignado a la capa."); - } catch (Exception e) { - System.err.println("Error asignando estilo a la capa: " + e.getMessage()); - } - } - } - - private void ensureInfrastructureExists() { - String workspace = "sigem"; - String datastore = "sigem_db"; - - // 1. Verificar Workspace - try { - restTemplate.exchange(GS_URL + "/workspaces/" + workspace, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); - } catch (Exception e) { - System.out.println("Creando Workspace: " + workspace); - String wsJson = String.format("{\"workspace\": {\"name\": \"%s\"}}", workspace); - HttpHeaders h = createHeaders(); - h.setContentType(MediaType.APPLICATION_JSON); - restTemplate.postForEntity(GS_URL + "/workspaces", new HttpEntity<>(wsJson, h), String.class); - } - - // 2. Verificar DataStore - try { - restTemplate.exchange(GS_URL + "/workspaces/" + workspace + "/datastores/" + datastore, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); - } catch (Exception e) { - System.out.println("Creando DataStore: " + datastore); - String dsJson = String.format( - "{\"dataStore\": {\"name\": \"%s\", \"connectionParameters\": {" + - "\"host\": \"postgres\", \"port\": \"5432\", \"database\": \"sigem\", " + - "\"user\": \"sigem_user\", \"passwd\": \"sigem_pass\", \"dbtype\": \"postgis\"}}}", - datastore - ); - HttpHeaders h = createHeaders(); - h.setContentType(MediaType.APPLICATION_JSON); - try { - restTemplate.postForEntity(GS_URL + "/workspaces/" + workspace + "/datastores", new HttpEntity<>(dsJson, h), String.class); - } catch (Exception ex) { - System.err.println("Error creando DataStore: " + ex.getMessage()); - } - } - } - - /** - * Purga la caché de una capa en GeoWebCache (GWC) para forzar el recálculo de perímetros. - */ - public void truncateCache(String layerName) { - String url = "http://geoserver:8080/geoserver/gwc/rest/masstruncate"; - String xmlBody = String.format("sigem:%s", layerName); - - HttpHeaders headers = createHeaders(); - headers.setContentType(MediaType.TEXT_XML); - HttpEntity entity = new HttpEntity<>(xmlBody, headers); - - try { - restTemplate.postForEntity(url, entity, String.class); - System.out.println("Caché GWC purgada para: " + layerName); - } catch (Exception e) { - System.err.println("Error purgando caché para " + layerName + ": " + e.getMessage()); - } - } - - private HttpHeaders createHeaders() { - HttpHeaders headers = new HttpHeaders(); - // Intentamos admin/admin si falla el de las reglas (debido a reset de GS) - try { - headers.setBasicAuth(GS_USER, GS_PASS); - // Probaríamos conexión aquí si fuera necesario, pero por ahora simplificamos: - // Si el subagent detectó admin/admin, podríamos parametrizarlo. - } catch (Exception e) { - headers.setBasicAuth("admin", "admin"); - } - return headers; - } -} diff --git a/GIS-GEOSERVER/src/main/resources/application.properties b/GIS-GEOSERVER/src/main/resources/application.properties deleted file mode 100644 index c8adb29..0000000 --- a/GIS-GEOSERVER/src/main/resources/application.properties +++ /dev/null @@ -1,23 +0,0 @@ -server.port=8081 -server.servlet.context-path=/gis-geoserver - -# Configuración JPA (No gestionada por auto-configuración, pero usada manualmente) -spring.jpa.hibernate.ddl-auto=none -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -spring.application.name=gis-geoserver - -# JPA Config -spring.datasource.master.url=jdbc:postgresql://192.168.1.254:5432/sigemweb -spring.datasource.master.username=postgres -spring.datasource.master.password=x25yvaga2017 -spring.datasource.gis.url=jdbc:postgresql://proyecto-postgres-1:5432/sigem -spring.datasource.gis.username=sigem_user -spring.datasource.gis.password=sigem_pass - -# Configuración de GeoServer Interno -geoserver.url=http://192.168.1.123:8083/geoserver -geoserver.username=admin -geoserver.password=geoserver -geoserver.workspace=sigem -geoserver.datastore=sigem_datastore diff --git a/GIS-GEOSERVER/src/main/resources/static/landing.html b/GIS-GEOSERVER/src/main/resources/static/landing.html deleted file mode 100644 index ca8ed45..0000000 --- a/GIS-GEOSERVER/src/main/resources/static/landing.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - SIGEMWEB - Dashboard - - - - - - - - - - -
    - - - - - - - - - -
    - -
    - - -
    - Sistema de Información Geográfica Municipal. - Todos los derechos reservados. -
    -
    - - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/src/main/resources/static/login.html b/GIS-GEOSERVER/src/main/resources/static/login.html deleted file mode 100644 index 312e629..0000000 --- a/GIS-GEOSERVER/src/main/resources/static/login.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - Inicie Sesión - Ecosistema SIGEM - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/src/main/resources/static/mapas.html b/GIS-GEOSERVER/src/main/resources/static/mapas.html deleted file mode 100644 index 273718d..0000000 --- a/GIS-GEOSERVER/src/main/resources/static/mapas.html +++ /dev/null @@ -1,769 +0,0 @@ - - - - - - - SISTEMA GIS - MapLibre 3D Elite - - - - - - - - -
    -
    SIGEM GIS
    - -
    -
    - - -
    - - - - -
    - -
    -
    Vista Cartográfica General
    -
    -
    - - - - - \ No newline at end of file diff --git a/GIS-GEOSERVER/src/main/resources/static/widgets.html b/GIS-GEOSERVER/src/main/resources/static/widgets.html deleted file mode 100644 index 5dfe60b..0000000 --- a/GIS-GEOSERVER/src/main/resources/static/widgets.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - -
    - Tablero General (Estadísticas Simuladas) -
    - -
    - -
    -
    -
    -

    99,999

    -

    Lotes Registrados

    -
    -
    - -
    - Más info -
    -
    - -
    -
    -
    -

    Gs. ---

    -

    Recaudación del Día

    -
    -
    - -
    - Más info -
    -
    - - -
    -
    -
    -

    ---

    -

    Nuevas Actividades Comerciales

    -
    -
    - -
    - Más info -
    -
    - -
    -
    -
    -

    45%

    -

    Índice General de Morosidad

    -
    -
    - -
    - Más info -
    -
    -
    - -
    -
    -
    -
    -

    Estado del Sistema

    -
    -
    -

    Use el menú lateral para navegar por los distintos módulos administrativos. La funcionalidad de Mapas Tributarios se encuentra activa bajo "Control de Gestión -> Mapas". Otras opciones en despliegue.

    -
    -
    -
    -
    - - - - - diff --git a/GIS-GEOSERVER/target/classes/application.properties b/GIS-GEOSERVER/target/classes/application.properties deleted file mode 100644 index c8adb29..0000000 --- a/GIS-GEOSERVER/target/classes/application.properties +++ /dev/null @@ -1,23 +0,0 @@ -server.port=8081 -server.servlet.context-path=/gis-geoserver - -# Configuración JPA (No gestionada por auto-configuración, pero usada manualmente) -spring.jpa.hibernate.ddl-auto=none -spring.jpa.show-sql=true -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -spring.application.name=gis-geoserver - -# JPA Config -spring.datasource.master.url=jdbc:postgresql://192.168.1.254:5432/sigemweb -spring.datasource.master.username=postgres -spring.datasource.master.password=x25yvaga2017 -spring.datasource.gis.url=jdbc:postgresql://proyecto-postgres-1:5432/sigem -spring.datasource.gis.username=sigem_user -spring.datasource.gis.password=sigem_pass - -# Configuración de GeoServer Interno -geoserver.url=http://192.168.1.123:8083/geoserver -geoserver.username=admin -geoserver.password=geoserver -geoserver.workspace=sigem -geoserver.datastore=sigem_datastore diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/GisApplication.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/GisApplication.class deleted file mode 100644 index 5a8592d..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/GisApplication.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/WebConfig.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/WebConfig.class deleted file mode 100644 index ca0b43f..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/WebConfig.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/config/DataSourceConfig.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/config/DataSourceConfig.class deleted file mode 100644 index 22696cc..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/config/DataSourceConfig.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/AdminController.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/AdminController.class deleted file mode 100644 index 1c7e0e5..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/AdminController.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/GisController.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/GisController.class deleted file mode 100644 index c63b69d..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/GisController.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/ProxyController.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/ProxyController.class deleted file mode 100644 index 2dca0cb..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/ProxyController.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/WebViewController.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/WebViewController.class deleted file mode 100644 index d056683..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/controller/WebViewController.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthController.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthController.class deleted file mode 100644 index 18e501f..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthController.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthRequest.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthRequest.class deleted file mode 100644 index 7c45c96..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthRequest.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthResponse.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthResponse.class deleted file mode 100644 index ef42689..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/AuthResponse.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtAuthenticationFilter.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtAuthenticationFilter.class deleted file mode 100644 index aff3d5d..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtAuthenticationFilter.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtUtil.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtUtil.class deleted file mode 100644 index 26c3e81..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/JwtUtil.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/SecurityConfig.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/security/SecurityConfig.class deleted file mode 100644 index 62dee71..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/security/SecurityConfig.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/service/FdwService.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/service/FdwService.class deleted file mode 100644 index 8033277..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/service/FdwService.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/com/sigem/gis/service/GeoServerService.class b/GIS-GEOSERVER/target/classes/com/sigem/gis/service/GeoServerService.class deleted file mode 100644 index ae63e2f..0000000 Binary files a/GIS-GEOSERVER/target/classes/com/sigem/gis/service/GeoServerService.class and /dev/null differ diff --git a/GIS-GEOSERVER/target/classes/static/landing.html b/GIS-GEOSERVER/target/classes/static/landing.html deleted file mode 100644 index ca8ed45..0000000 --- a/GIS-GEOSERVER/target/classes/static/landing.html +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - SIGEMWEB - Dashboard - - - - - - - - - - -
    - - - - - - - - - -
    - -
    - - -
    - Sistema de Información Geográfica Municipal. - Todos los derechos reservados. -
    -
    - - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/target/classes/static/login.html b/GIS-GEOSERVER/target/classes/static/login.html deleted file mode 100644 index 312e629..0000000 --- a/GIS-GEOSERVER/target/classes/static/login.html +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - Inicie Sesión - Ecosistema SIGEM - - - - - - - - - - - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/target/classes/static/mapas.html b/GIS-GEOSERVER/target/classes/static/mapas.html deleted file mode 100644 index 273718d..0000000 --- a/GIS-GEOSERVER/target/classes/static/mapas.html +++ /dev/null @@ -1,769 +0,0 @@ - - - - - - - SISTEMA GIS - MapLibre 3D Elite - - - - - - - - -
    -
    SIGEM GIS
    - -
    -
    - - -
    - - - - -
    - -
    -
    Vista Cartográfica General
    -
    -
    - - - - - \ No newline at end of file diff --git a/GIS-GEOSERVER/target/classes/static/widgets.html b/GIS-GEOSERVER/target/classes/static/widgets.html deleted file mode 100644 index 5dfe60b..0000000 --- a/GIS-GEOSERVER/target/classes/static/widgets.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - -
    - Tablero General (Estadísticas Simuladas) -
    - -
    - -
    -
    -
    -

    99,999

    -

    Lotes Registrados

    -
    -
    - -
    - Más info -
    -
    - -
    -
    -
    -

    Gs. ---

    -

    Recaudación del Día

    -
    -
    - -
    - Más info -
    -
    - - -
    -
    -
    -

    ---

    -

    Nuevas Actividades Comerciales

    -
    -
    - -
    - Más info -
    -
    - -
    -
    -
    -

    45%

    -

    Índice General de Morosidad

    -
    -
    - -
    - Más info -
    -
    -
    - -
    -
    -
    -
    -

    Estado del Sistema

    -
    -
    -

    Use el menú lateral para navegar por los distintos módulos administrativos. La funcionalidad de Mapas Tributarios se encuentra activa bajo "Control de Gestión -> Mapas". Otras opciones en despliegue.

    -
    -
    -
    -
    - - - - - diff --git a/GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar b/GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar deleted file mode 100644 index d55e850..0000000 Binary files a/GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar.original b/GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar.original deleted file mode 100644 index 6c09708..0000000 Binary files a/GIS-GEOSERVER/target/gis-geoserver-0.0.1-SNAPSHOT.jar.original and /dev/null differ diff --git a/GIS-GEOSERVER/target/maven-archiver/pom.properties b/GIS-GEOSERVER/target/maven-archiver/pom.properties deleted file mode 100644 index 4f37849..0000000 --- a/GIS-GEOSERVER/target/maven-archiver/pom.properties +++ /dev/null @@ -1,3 +0,0 @@ -artifactId=gis-geoserver -groupId=com.sigem -version=0.0.1-SNAPSHOT diff --git a/GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index 5483338..0000000 --- a/GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ /dev/null @@ -1,15 +0,0 @@ -com\sigem\gis\WebConfig.class -com\sigem\gis\security\JwtUtil.class -com\sigem\gis\service\FdwService.class -com\sigem\gis\service\GeoServerService.class -com\sigem\gis\security\AuthResponse.class -com\sigem\gis\security\AuthRequest.class -com\sigem\gis\controller\WebViewController.class -com\sigem\gis\security\JwtAuthenticationFilter.class -com\sigem\gis\config\DataSourceConfig.class -com\sigem\gis\controller\GisController.class -com\sigem\gis\security\SecurityConfig.class -com\sigem\gis\controller\AdminController.class -com\sigem\gis\controller\ProxyController.class -com\sigem\gis\GisApplication.class -com\sigem\gis\security\AuthController.class diff --git a/GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index 86417ee..0000000 --- a/GIS-GEOSERVER/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1,15 +0,0 @@ -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\security\AuthController.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\GisApplication.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\security\SecurityConfig.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\config\DataSourceConfig.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\controller\WebViewController.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\controller\AdminController.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\security\JwtAuthenticationFilter.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\controller\GisController.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\service\GeoServerService.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\service\FdwService.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\security\AuthRequest.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\WebConfig.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\controller\ProxyController.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\security\AuthResponse.java -C:\desarrollo\Antigravity\GIS-GEOSERVER\src\main\java\com\sigem\gis\security\JwtUtil.java diff --git a/GIS-GEOSERVER/tomcat-users.xml b/GIS-GEOSERVER/tomcat-users.xml deleted file mode 100644 index c19f85a..0000000 --- a/GIS-GEOSERVER/tomcat-users.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - diff --git a/GIS-GEOSERVER/upgrade_to_v18.sh b/GIS-GEOSERVER/upgrade_to_v18.sh deleted file mode 100644 index 8dc3dff..0000000 --- a/GIS-GEOSERVER/upgrade_to_v18.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Script de Actualización SIGEM-GIS (Fase 2) -set -e - -PROJECT_DIR="/yvyape/proyectos/sigem-gis/proyecto" -COMPOSE_FILE="$PROJECT_DIR/docker-compose.yml" - -echo "🛑 Pasando a la acción: Deteniendo PostgreSQL 15..." -docker stop proyecto-postgres-1 || true -docker rm proyecto-postgres-1 || true - -echo "🧹 Limpieza: Eliminando volumen de datos v15 (Incompatible)..." -docker volume rm proyecto_postgres_data || true - -echo "📝 Configuración: Actualizando imagen en $COMPOSE_FILE..." -# Usamos sed para asegurar que la imagen cambie a la versión 18 (Regla 22) -# Nota: Si no encuentra la línea exacta, la insertaremos o editaremos el archivo localmente. -sed -i 's|postgis/postgis:15-3.3|postgis/postgis:18-3.6|g' $COMPOSE_FILE - -echo "🚀 Despliegue: Levantando PostgreSQL 18..." -cd $PROJECT_DIR -docker-compose up -d postgres - -echo "🔍 Verificación: Estado del nuevo contenedor..." -sleep 5 -docker ps --filter name=proyecto-postgres-1 --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" diff --git a/GIS-GEOSERVER/upload_geojson.sh b/GIS-GEOSERVER/upload_geojson.sh deleted file mode 100644 index e204175..0000000 --- a/GIS-GEOSERVER/upload_geojson.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -echo "Instalando zip..." -echo "x25yvaga2023" | sudo -S DEBIAN_FRONTEND=noninteractive apt install -y zip - -echo "Convirtiendo a ESRI Shapefile..." -cd /home/cbareiro/proyecto -rm -f e505_mejoras.shp e505_mejoras.shx e505_mejoras.dbf e505_mejoras.prj e505_mejoras.zip -ogr2ogr -f "ESRI Shapefile" e505_mejoras.shp e505_mejoras.geojson -nln e505_mejoras - -echo "Comprimiendo..." -zip -j e505_mejoras.zip e505_mejoras.* - -echo "Enviando por curl (REST API GeoServer)..." -curl -v -u admin:x25yvaga2023 -XPUT -H "Content-type: application/zip" --data-binary @e505_mejoras.zip http://localhost:8080/geoserver/rest/workspaces/sigem/datastores/e505/file.shp - -echo "Hecho." diff --git a/GIS-GEOSERVER/verify_db.sh b/GIS-GEOSERVER/verify_db.sh deleted file mode 100644 index 762582c..0000000 --- a/GIS-GEOSERVER/verify_db.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -echo "Verificando base de datos en 192.168.1.254..." -docker exec proyecto-postgres-1 sh -c 'PGPASSWORD=x25yvaga2017 psql -h 192.168.1.254 -U postgres -c "SELECT datname FROM pg_database WHERE datname ILIKE '\''sigemweb'\'';"' - -echo "Verificando tabla entidades en 192.168.1.254..." -docker exec proyecto-postgres-1 sh -c 'PGPASSWORD=x25yvaga2017 psql -h 192.168.1.254 -U postgres -d sigemweb -c "SELECT table_name FROM information_schema.tables WHERE table_name ILIKE '\''entidades'\'';"' diff --git a/GIS-GEOSERVER/yvyape_vhost.txt b/GIS-GEOSERVER/yvyape_vhost.txt deleted file mode 100644 index e436bcd..0000000 --- a/GIS-GEOSERVER/yvyape_vhost.txt +++ /dev/null @@ -1,20 +0,0 @@ - - ServerName yvyape.yvaga.com.py - ServerAdmin webmaster@yvaga.com.py - - ProxyPreserveHost On - - # Proxy principal al Backend Java (Puerto 8081) - ProxyPass / http://192.168.1.123:8081/gis-geoserver/ - ProxyPassReverse / http://192.168.1.123:8081/gis-geoserver/ - - # Proxy a GeoServer (Puerto 8080) - ProxyPass /geoserver http://192.168.1.123:8080/geoserver - ProxyPassReverse /geoserver http://192.168.1.123:8080/geoserver - - ProxyPass /gwc http://192.168.1.123:8080/gwc - ProxyPassReverse /gwc http://192.168.1.123:8080/gwc - - ErrorLog ${APACHE_LOG_DIR}/yvyape_error.log - CustomLog ${APACHE_LOG_DIR}/yvyape_access.log combined - diff --git a/GeoServerService.java b/GeoServerService.java new file mode 100644 index 0000000..53f8d5b --- /dev/null +++ b/GeoServerService.java @@ -0,0 +1,112 @@ +package com.sigem.gis.service; + +import org.springframework.http.*; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class GeoServerService { + + private final String GS_URL = "http://proyecto-geoserver-1:8080/geoserver/rest"; + private final String GS_USER = "admin"; + private final String GS_PASS = "geoserver"; + + private final RestTemplate restTemplate; + + public GeoServerService() { + org.springframework.http.client.SimpleClientHttpRequestFactory factory = new org.springframework.http.client.SimpleClientHttpRequestFactory(); + factory.setConnectTimeout(2000); + factory.setReadTimeout(2000); + this.restTemplate = new RestTemplate(factory); + } + + public void ensureStyleExists(String styleName) { + String url = GS_URL + "/styles/" + styleName; + try { + restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); + } catch (Exception e) { + String sldBody = "" + + "" + + "morosidad_style_wms" + + "Verdeultimo_pago2026#71de75#0000000.2" + + "Ambarultimo_pago2024#ffaa00#0000000.2" + + "Rojoultimo_pago2023#f87171#0000000.2" + + "#94a3b80.4" + + ""; + + try { + // Crear el estilo + String createJson = String.format("{\"style\": {\"name\": \"%s\", \"filename\": \"%s.sld\"}}", styleName, styleName); + HttpHeaders h = createHeaders(); + h.setContentType(MediaType.APPLICATION_JSON); + restTemplate.postForEntity(GS_URL + "/styles", new HttpEntity<>(createJson, h), String.class); + + // Subir el SLD + HttpHeaders sldHeaders = createHeaders(); + sldHeaders.setContentType(MediaType.parseMediaType("application/vnd.ogc.sld+xml")); + restTemplate.exchange(url, HttpMethod.PUT, new HttpEntity<>(sldBody, sldHeaders), String.class); + } catch (Exception ex) { + System.err.println("Error creando estilo: " + ex.getMessage()); + } + } + } + + public void publishLayer(String layerName, String viewName, String styleName, String boundNo, String boundSe) { + ensureInfrastructureExists(); + if (styleName != null) ensureStyleExists(styleName); + + String workspace = "sigem"; + String datastore = "sigem_db"; + String url = String.format("%s/workspaces/%s/datastores/%s/featuretypes/%s", GS_URL, workspace, datastore, layerName); + + String jsonBody = String.format("{\"featureType\": {\"name\": \"%s\", \"nativeName\": \"%s\", \"srs\": \"EPSG:4326\"}}", layerName, viewName); + HttpHeaders headers = createHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + + try { + restTemplate.exchange(url, HttpMethod.PUT, new HttpEntity<>(jsonBody, headers), String.class); + } catch (Exception e) { + String postUrl = String.format("%s/workspaces/%s/datastores/%s/featuretypes", GS_URL, workspace, datastore); + try { restTemplate.postForEntity(postUrl, new HttpEntity<>(jsonBody, headers), String.class); } catch (Exception ex) {} + } + + if (styleName != null) { + String layerUrl = String.format("%s/layers/sigem:%s", GS_URL, layerName); + String layerJson = String.format("{\"layer\": {\"defaultStyle\": {\"name\": \"%s\"}}}", styleName); + try { restTemplate.exchange(layerUrl, HttpMethod.PUT, new HttpEntity<>(layerJson, headers), String.class); } catch (Exception e) {} + } + } + + private void ensureInfrastructureExists() { + String workspace = "sigem"; + String datastore = "sigem_db"; + try { + restTemplate.exchange(GS_URL + "/workspaces/" + workspace, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); + } catch (Exception e) { + String wsJson = String.format("{\"workspace\": {\"name\": \"%s\"}}", workspace); + HttpHeaders h = createHeaders(); h.setContentType(MediaType.APPLICATION_JSON); + try { restTemplate.postForEntity(GS_URL + "/workspaces", new HttpEntity<>(wsJson, h), String.class); } catch (Exception ex) {} + } + + try { + restTemplate.exchange(GS_URL + "/workspaces/" + workspace + "/datastores/" + datastore, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); + } catch (Exception e) { + String dsJson = String.format("{\"dataStore\": {\"name\": \"%s\", \"connectionParameters\": {\"host\": \"proyecto-postgres-1\", \"port\": \"5432\", \"database\": \"sigem\", \"user\": \"sigem_user\", \"passwd\": \"sigem_pass\", \"dbtype\": \"postgis\"}}}", datastore); + HttpHeaders h = createHeaders(); h.setContentType(MediaType.APPLICATION_JSON); + try { restTemplate.postForEntity(GS_URL + "/workspaces/" + workspace + "/datastores", new HttpEntity<>(dsJson, h), String.class); } catch (Exception ex) {} + } + } + + public void truncateCache(String layerName) { + String url = "http://proyecto-geoserver-1:8080/geoserver/gwc/rest/masstruncate"; + String xmlBody = String.format("sigem:%s", layerName); + HttpHeaders h = createHeaders(); h.setContentType(MediaType.TEXT_XML); + try { restTemplate.postForEntity(url, new HttpEntity<>(xmlBody, h), String.class); } catch (Exception e) {} + } + + private HttpHeaders createHeaders() { + HttpHeaders headers = new HttpHeaders(); + headers.setBasicAuth(GS_USER, GS_PASS); + return headers; + } +} diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..334def9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,77 @@ +pipeline { + agent any + + tools { + // Asegurar que Jenkins tenga configurado el JDK 21 y Maven 3 + jdk 'Java 21' + maven 'Maven 3' + } + + environment { + // Variables del Contenedor de Producción (GeoServer) + SERVER_IP = '192.168.1.123' + // NOTA: Reemplazar por la Credencial SSH configurada en Jenkins para apuntar a root@192.168.1.123 + SSH_CREDENTIAL_ID = 'sigem-server-123' + IMAGE_NAME = 'sigem/gis-geoserver-app:latest' + TAR_FILE = 'gis-backend.tar' + } + + stages { + stage('Clonar Repositorio (Checkout)') { + steps { + checkout scm + echo "Código Fuente clonado y listo para validación." + } + } + + stage('Compilación Java (Build & Test)') { + steps { + echo "Empaquetando microservicio con Maven..." + sh 'mvn clean package -DskipTests' + echo "Archivo .jar generado con éxito." + } + } + + stage('Construcción de Imagen Docker') { + steps { + echo "Construyendo imagen Docker usando Temurin JDK 21..." + sh "docker build -t ${IMAGE_NAME} ." + } + } + + stage('Exportación y Despliegue Secuencial') { + steps { + sshagent([SSH_CREDENTIAL_ID]) { + echo "Exportando contenedor a archivo tar. Esto toma unos segundos..." + sh "docker save ${IMAGE_NAME} > ${TAR_FILE}" + + echo "Transfiriendo archivos vía SCP hacia 192.168.1.123..." + sh "scp -o StrictHostKeyChecking=no ${TAR_FILE} root@${SERVER_IP}:/tmp/${TAR_FILE}" + sh "ssh -o StrictHostKeyChecking=no root@${SERVER_IP} 'mkdir -p /opt/gis-backend/'" + sh "scp -o StrictHostKeyChecking=no docker-compose.yml root@${SERVER_IP}:/opt/gis-backend/" + + echo "Levantando el Sistema Remotamente en el Nodo PostGIS..." + sh ''' + ssh -o StrictHostKeyChecking=no root@${SERVER_IP} " + cd /opt/gis-backend/ + docker load < /tmp/${TAR_FILE} + docker compose down + docker compose up -d + rm -f /tmp/${TAR_FILE} + echo 'Microservicio Reiniciado sin caída de datos.' + " + ''' + } + } + } + } + + post { + success { + echo "Despliegue del Módulo GIS completado de forma impecable. Disponible en el puerto 8081." + } + failure { + echo "La compilación o el despliegue del mapa ha fallado. Revisa los logs de SSH." + } + } +} diff --git a/ProxyController.java b/ProxyController.java new file mode 100644 index 0000000..f981c41 --- /dev/null +++ b/ProxyController.java @@ -0,0 +1,61 @@ +package com.sigem.gis.controller; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.http.*; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.client.RestTemplate; +import org.springframework.util.StreamUtils; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Enumeration; + +@RestController +public class ProxyController { + + private final RestTemplate restTemplate; + private final String geoserverInternalBase = "http://proyecto-geoserver-1:8080"; + + public ProxyController(RestTemplate restTemplate) { + this.restTemplate = restTemplate; + } + + @RequestMapping(value = {"/geoserver/**", "/gwc/**"}, method = {RequestMethod.GET, RequestMethod.POST}) + @ResponseBody + public ResponseEntity proxy(HttpServletRequest request) throws URISyntaxException { + String path = request.getRequestURI(); + // Eliminamos el prefijo del contexto de la aplicación + if (path.startsWith("/gis-geoserver")) { + path = path.substring("/gis-geoserver".length()); + } + + // Si la petición viene por /gwc/, GeoServer la espera en /geoserver/gwc/ + if (path.startsWith("/gwc")) { + path = "/geoserver" + path; + } + + String query = request.getQueryString(); + String fullUrl = geoserverInternalBase + path + (query != null ? "?" + query : ""); + URI uri = new URI(fullUrl); + + HttpHeaders headers = new HttpHeaders(); + Enumeration headerNames = request.getHeaderNames(); + while (headerNames.hasMoreElements()) { + String hName = headerNames.nextElement(); + // Evitamos pasar el Host original para que GeoServer no intente redirecciones externas + if (!hName.equalsIgnoreCase("host")) { + headers.add(hName, request.getHeader(hName)); + } + } + + return restTemplate.execute(uri, HttpMethod.valueOf(request.getMethod()), (req) -> { + req.getHeaders().putAll(headers); + if (request.getContentLength() > 0) StreamUtils.copy(request.getInputStream(), req.getBody()); + }, (res) -> { + byte[] body = StreamUtils.copyToByteArray(res.getBody()); + HttpHeaders responseHeaders = new HttpHeaders(); + responseHeaders.putAll(res.getHeaders()); + // Sobrescribimos el content type si es necesario para asegurar la entrega de imágenes/PBF + return new ResponseEntity<>(body, responseHeaders, res.getStatusCode()); + }); + } +} diff --git a/RestTemplateConfig.java b/RestTemplateConfig.java new file mode 100644 index 0000000..b3353d0 --- /dev/null +++ b/RestTemplateConfig.java @@ -0,0 +1,13 @@ +package com.sigem.gis.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class RestTemplateConfig { + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } +} diff --git a/SecurityConfig.java b/SecurityConfig.java new file mode 100644 index 0000000..cb49f2d --- /dev/null +++ b/SecurityConfig.java @@ -0,0 +1,46 @@ +package com.sigem.gis.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + + private final JwtAuthenticationFilter jwtAuthFilter; + + public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter) { + this.jwtAuthFilter = jwtAuthFilter; + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .csrf(csrf -> csrf.disable()) + .cors(cors -> cors.disable()) + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(authz -> authz + .requestMatchers("/api/auth/**").permitAll() + .requestMatchers("/api/admin/**").permitAll() + .requestMatchers("/login.html", "/", "/mapas", "/login", "/error").permitAll() + .requestMatchers("/css/**", "/js/**", "/img/**").permitAll() + + // Permitimos el tráfico hacia el puente interno de GeoServer (Solución C) + .requestMatchers("/gwc/**").permitAll() + .requestMatchers("/geoserver/**").permitAll() + + .requestMatchers("/api/**").authenticated() + .anyRequest().permitAll() + ) + .httpBasic(basic -> basic.disable()) + .formLogin(form -> form.disable()) + .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class); + + return http.build(); + } +} diff --git a/SecurityConfig_master.java b/SecurityConfig_master.java new file mode 100644 index 0000000..7966fde --- /dev/null +++ b/SecurityConfig_master.java @@ -0,0 +1,45 @@ +package com.sigem.gis.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + + private final JwtAuthenticationFilter jwtAuthFilter; + + public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter) { + this.jwtAuthFilter = jwtAuthFilter; + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .csrf(csrf -> csrf.disable()) // Deshabilitado para APIs REST (Stateless con JWT) + .cors(cors -> cors.disable()) // Modificable luego para permitir conexiones cruzadas + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(authz -> authz + // Accesos no autenticados permitidos (Puerta de Entrada Prototipo) + .requestMatchers("/api/auth/**").permitAll() + .requestMatchers("/api/admin/**").permitAll() + .requestMatchers("/login_prototipo.html", "/login.html", "/", "/mapas", "/login", "/error").permitAll() + .requestMatchers("/css/**", "/js/**", "/img/**").permitAll() + .requestMatchers("/gwc/**").permitAll() + + // Todas las demás llamadas API estarán protegidas mediante JWT + .requestMatchers("/api/**").authenticated() + .anyRequest().permitAll() + ) + .httpBasic(basic -> basic.disable()) + .formLogin(form -> form.disable()) + .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class); + + return http.build(); + } +} diff --git a/VERSION.txt b/VERSION.txt new file mode 100644 index 0000000..68aefb7 --- /dev/null +++ b/VERSION.txt @@ -0,0 +1,11 @@ +Version de Estabilizacion SIG (Abril 2026) - 2026.04.02.13.00.00 +Version de Estabilizacion SIG (Abril 2026) - 2026.04.03.11.58.33 +V e r s i o n d e E s t a b i l i z a c i o n S I G ( A b r i l 2 0 2 6 ) - 2 0 2 6 . 0 4 . 0 3 . 1 6 . 1 0 . 0 0 + + Version de Estabilizacion SIG (Abril 2026) - 2026.04.04.20.43.27 ID DOCKER: 932819b9d2da + +Version de Estabilizacion SIG (Abril 2026) - 2026.04.05.01.49.29 ID DOCKER: c68e229b6d94 +Mapa Coloreado +Version de Estabilizacion SIG (Abril 2026) - 2026.04.05.04.28.49 ID DOCKER: c68e229b6d94. Observación: Fix de las contraseñas WMS y polígonos a full color. +Versión de Estabilización SIG (Abril 2026) - 2026.04.05.06.31.00 ID DOCKER: c68e229b6d94. Observación: Reestructuracion pura de BaseMap y soporte Google auto-escalado satelital. +Versión SIG (Abril 2026) - 2026.04.06.01.13.00 ID DOCKER: d983a409769d. Observación: Integración exitosa de Landing Page AdminLTE 3 con aislamiento de iFrame para Visor GIS. \ No newline at end of file diff --git a/apache_ssl_update.conf b/apache_ssl_update.conf new file mode 100644 index 0000000..551b384 --- /dev/null +++ b/apache_ssl_update.conf @@ -0,0 +1,52 @@ + + + ServerName sigemtest.yvaga.com.py + ServerAdmin cbareiro@yvaga.com.py + + ProxyPass /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 + ProxyPassReverse /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 + ProxyPassReverse /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /api/ http://192.168.1.162:9001/api/ timeout=1200 + ProxyPassReverse /api/ http://192.168.1.162:9001/api/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /sigemweb http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPreserveHost On + + # --- INICIO BLOQUE GIS GEOSERVER (.123) --- + # Rutas Web Frontend (Spring Boot en Puerto 8081) + ProxyPass /mapas http://192.168.1.123:8081/mapas timeout=1200 + ProxyPassReverse /mapas http://192.168.1.123:8081/mapas timeout=1200 + ProxyPass /login http://192.168.1.123:8081/login timeout=1200 + ProxyPassReverse /login http://192.168.1.123:8081/login timeout=1200 + + # Ruta Diferenciada de API GIS para no chocar con el /api/ de la .162 principal + ProxyPass /gis-api/ http://192.168.1.123:8081/api/ timeout=1200 + ProxyPassReverse /gis-api/ http://192.168.1.123:8081/api/ timeout=1200 + + # Ruta Nativa del Servidor espacial para consumo WMS Seguro por HTTPS + ProxyPass /geoserver/ http://192.168.1.123:8080/geoserver/ timeout=1200 + ProxyPassReverse /geoserver/ http://192.168.1.123:8080/geoserver/ timeout=1200 + # --- FIN BLOQUE GIS --- + + ProxyPass / http://192.168.1.20/ timeout=1200 + ProxyPassReverse / http://192.168.1.20/ timeout=1200 + ProxyPreserveHost On + + ErrorLog /var/log/httpd/sigemtest-error.log + SSLCertificateFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/privkey.pem + Include /etc/letsencrypt/options-ssl-apache.conf + SSLCertificateChainFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/chain.pem + + diff --git a/application_master.properties b/application_master.properties new file mode 100644 index 0000000..3ed700c --- /dev/null +++ b/application_master.properties @@ -0,0 +1,22 @@ +server.port=8081 +server.servlet.context-path=/gis-geoserver + +# Configuración de Recursos Estáticos para Prototipado en Vivo (Carga desde Disco) +# Esto permite modificar login_prototipo.html y ver cambios al instante sin rebuild +spring.web.resources.static-locations=classpath:/static/,file:/yvyape/proyectos/sigem-gis/src/main/resources/static/ + +# Configuración JPA +spring.jpa.hibernate.ddl-auto=none +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.application.name=gis-geoserver + +# JPA Config - Master (SigemWeb) +spring.datasource.master.url=jdbc:postgresql://192.168.1.254:5432/sigemweb +spring.datasource.master.username=postgres +spring.datasource.master.password=x25yvaga2017 + +# JPA Config - GIS (PostGIS Local .123) +spring.datasource.gis.url=jdbc:postgresql://proyecto-postgres-1:5432/sigem +spring.datasource.gis.username=sigem_user +spring.datasource.gis.password=sigem_pass diff --git a/check_geom.sql b/check_geom.sql new file mode 100644 index 0000000..ff0e516 --- /dev/null +++ b/check_geom.sql @@ -0,0 +1,9 @@ +SELECT + 'vw_lotes_morosidad_505' as view_name, + count(*) as total_records, + ST_GeometryType(geom) as geom_type, + ST_SRID(geom) as srid, + sum(case when ST_IsValid(geom) then 1 else 0 end) as valid_geometries, + sum(case when geom IS NULL then 1 else 0 end) as null_geometries +FROM public.vw_lotes_morosidad_505 +GROUP BY 1, 3, 4; diff --git a/check_rule5.sql b/check_rule5.sql new file mode 100644 index 0000000..4583a67 --- /dev/null +++ b/check_rule5.sql @@ -0,0 +1,3 @@ +SELECT sigem_site, sigem_dbname, latlong, lng, lat, zoom, mapa_base, boundno, boundse, maxzoom, minzoom +FROM public.entidades +WHERE entidad=505; diff --git a/control_gestion.php b/control_gestion.php new file mode 100644 index 0000000..7ba96c0 --- /dev/null +++ b/control_gestion.php @@ -0,0 +1,128 @@ + +
  • + + CONTROL DE GESTION + + + + + +
  • \ No newline at end of file diff --git a/dbconf.php b/dbconf.php new file mode 100644 index 0000000..34b82a2 --- /dev/null +++ b/dbconf.php @@ -0,0 +1,14 @@ + {{.Destination}}{{end}} +Env: {{range .Config.Env}}{{.}} {{end}} +' +echo "=== BUSQUEDA DE DEFINICION ===" +grep -r "proyecto-postgres-1" /yvyape/proyectos/sigem-gis --exclude-dir=geoserver-data --exclude-dir=target diff --git a/detect_locks.sql b/detect_locks.sql new file mode 100644 index 0000000..51a2583 --- /dev/null +++ b/detect_locks.sql @@ -0,0 +1,9 @@ +SELECT + a.pid AS blocking_pid, a.usename AS blocking_user, a.client_addr AS blocking_ip, + b.pid AS blocked_pid, b.usename AS blocked_user, b.query AS blocked_statement, + age(now(), a.query_start) AS age_of_lock +FROM pg_stat_activity a +JOIN pg_stat_activity b ON a.datid = b.datid AND a.pid != b.pid +JOIN pg_locks l1 ON a.pid = l1.pid +JOIN pg_locks l2 ON b.pid = l2.pid AND l1.relation = l2.relation +WHERE NOT l2.granted AND l1.granted; diff --git a/diag_db.sh b/diag_db.sh new file mode 100644 index 0000000..03fe9fe --- /dev/null +++ b/diag_db.sh @@ -0,0 +1,2 @@ +sudo -u postgres psql -d sigem_gis -c "\dv public.vw_lotes_morosidad_505" +sudo -u postgres psql -d sigem_gis -c "\d public.lotes_nomenclatura" diff --git a/diag_db_docker.sh b/diag_db_docker.sh new file mode 100644 index 0000000..37d6181 --- /dev/null +++ b/diag_db_docker.sh @@ -0,0 +1,2 @@ +docker inspect proyecto-postgres-1 | grep -iE "POSTGRES_USER|POSTGRES_DB" +docker exec proyecto-postgres-1 psql -U postgres -d sigem_gis -c "\dv" || docker exec proyecto-postgres-1 psql -U sigem_user -d sigem_gis -c "\dv" || true diff --git a/diag_fdw.sql b/diag_fdw.sql new file mode 100644 index 0000000..4863c98 --- /dev/null +++ b/diag_fdw.sql @@ -0,0 +1,11 @@ +-- Diagnóstico de Integridad FDW Entidad 505 +SELECT '--- TABLAS IMPORTADAS EN fdw_505 ---' as reporte; +SELECT table_name FROM information_schema.tables WHERE table_schema = 'fdw_505' ORDER BY table_name; + +SELECT '--- COLUMNAS DE fdw_505.usuarios ---' as reporte; +SELECT column_name, data_type FROM information_schema.columns +WHERE table_schema = 'fdw_505' AND table_name = 'usuarios' +ORDER BY ordinal_position; + +SELECT '--- PRUEBA DE ACCESO (SIN DESENCRIPTAR) ---' as reporte; +SELECT usu_alias, ejer_fisca FROM fdw_505.usuarios WHERE usu_alias = 'operador' LIMIT 1; diff --git a/diag_schema_505.sql b/diag_schema_505.sql new file mode 100644 index 0000000..ff2e737 --- /dev/null +++ b/diag_schema_505.sql @@ -0,0 +1,12 @@ +-- Diagnóstico detallado de esquemas para la Entidad 505 +\echo '--- ESTRUCTURA DE LOTES ---' +\d public.e505_lotes_conccc + +\echo '--- ESTRUCTURA DE MEJORAS ---' +\d public.e505_mejoras + +\echo '--- ESTRUCTURA DE MOROSIDAD (FDW) ---' +\d fdw_505.v_liq_entidad_totalxobjeto + +\echo '--- LISTADO DE TABLAS EN EL ESQUEMA PUBLIC ---' +SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_name LIKE 'e505_%'; diff --git a/diag_v28.sh b/diag_v28.sh new file mode 100644 index 0000000..dba5d28 Binary files /dev/null and b/diag_v28.sh differ diff --git a/docker-compose-v33.yml b/docker-compose-v33.yml new file mode 100644 index 0000000..083cb37 --- /dev/null +++ b/docker-compose-v33.yml @@ -0,0 +1,21 @@ +version: '3.8' +services: + gis-geoserver-backend: + image: sigem/gis-geoserver-app:latest + container_name: sigem-gis-backend + restart: unless-stopped + ports: + - "8081:8081" + environment: + - TZ=America/Asuncion + - GIS_DB_HOST=proyecto-postgres-1 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + networks: + - sigem-net + - proyecto_sigem_network + +networks: + sigem-net: + driver: bridge + proyecto_sigem_network: + external: true diff --git a/docker-compose.integrated.yml b/docker-compose.integrated.yml new file mode 100644 index 0000000..6773283 --- /dev/null +++ b/docker-compose.integrated.yml @@ -0,0 +1,66 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + container_name: proyecto-geoserver-1 + environment: + - GEOSERVER_ADMIN_PASSWORD=admin + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + networks: + - proyecto_sigem_network + restart: always + + backend-java: + image: eclipse-temurin:21-jre + container_name: proyecto-backend-java-1 + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + # Configuración Maestra Directa (Reglas 2/5) + - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb + - SPRING_DATASOURCE_MASTER_USERNAME=postgres + - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 + - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + # Configuración Local (Regla 1) - PostgreSQL 18 + - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://postgres:5432/sigem + - SPRING_DATASOURCE_GIS_USERNAME=sigem_user + - SPRING_DATASOURCE_GIS_PASSWORD=sigem_pass + - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ../backend-java/gis-geoserver.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + networks: + - proyecto_sigem_network + restart: always + + postgres: + image: postgis/postgis:18-3.6 + container_name: proyecto-postgres-1 + environment: + - POSTGRES_USER=sigem_user + - POSTGRES_PASSWORD=sigem_pass + - POSTGRES_DB=sigem + volumes: + - pg_data:/var/lib/postgresql + ports: + - "5432:5432" + networks: + - proyecto_sigem_network + restart: always + +networks: + proyecto_sigem_network: + external: true + +volumes: + pg_data: + external: true + name: proyecto_proyecto_postgres_data diff --git a/docker-compose.v18.yml b/docker-compose.v18.yml new file mode 100644 index 0000000..0e7953d --- /dev/null +++ b/docker-compose.v18.yml @@ -0,0 +1,26 @@ +version: '3.8' +services: + postgres: + image: postgis/postgis:18-3.6 + container_name: proyecto-postgres-1 + ports: + - "5432:5432" + environment: + - POSTGRES_USER=sigem_user + - POSTGRES_PASSWORD=sigem_pass + - POSTGRES_DB=sigem_gis + volumes: + # Ajuste para PostgreSQL 18+: Montaje en la raíz del directorio de datos + - proyecto_postgres_data:/var/lib/postgresql + networks: + - sigem-net + restart: always + +networks: + sigem-net: + driver: bridge + +volumes: + proyecto_postgres_data: + driver: local + # No definimos external: true para que docker-compose gestione el ciclo de vida del volumen limpio diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..2b149e7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,66 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + container_name: proyecto-geoserver-1 + environment: + - GEOSERVER_ADMIN_PASSWORD=geoserver + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + networks: + - proyecto_sigem_network + restart: always + + backend-java: + image: eclipse-temurin:21-jre + container_name: proyecto-backend-java-1 + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + # Configuración Maestra Directa (Reglas 2/5) + - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb + - SPRING_DATASOURCE_MASTER_USERNAME=postgres + - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 + - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + # Configuración Local (Regla 1) - PostgreSQL 18 + - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://postgres:5432/sigem + - SPRING_DATASOURCE_GIS_USERNAME=sigem_user + - SPRING_DATASOURCE_GIS_PASSWORD=sigem_pass + - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ./target/gis-geoserver-0.0.1-SNAPSHOT.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + networks: + - proyecto_sigem_network + restart: always + + postgres: + image: postgis/postgis:18-3.6 + container_name: proyecto-postgres-1 + environment: + - POSTGRES_USER=sigem_user + - POSTGRES_PASSWORD=sigem_pass + - POSTGRES_DB=sigem + volumes: + - pg_data:/var/lib/postgresql + ports: + - "5432:5432" + networks: + - proyecto_sigem_network + restart: always + +networks: + proyecto_sigem_network: + external: true + +volumes: + pg_data: + external: true + name: proyecto_proyecto_postgres_data diff --git a/docker-compose_v20.yml b/docker-compose_v20.yml new file mode 100644 index 0000000..d921818 --- /dev/null +++ b/docker-compose_v20.yml @@ -0,0 +1,34 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + environment: + - GEOSERVER_ADMIN_PASSWORD=admin + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + restart: always + + backend-java: + image: eclipse-temurin:21-jre + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + - APP_DB_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb + - APP_DB_MASTER_USERNAME=sigemweb + - APP_DB_MASTER_PASSWORD=sigemweb + - APP_DB_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + - APP_DB_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis + - APP_DB_GIS_USERNAME=cbareiro + - APP_DB_GIS_PASSWORD=x25yvaga2023 + - APP_DB_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ../backend-java/gis-geoserver.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + restart: always diff --git a/docker-compose_v22.yml b/docker-compose_v22.yml new file mode 100644 index 0000000..a10e9c0 --- /dev/null +++ b/docker-compose_v22.yml @@ -0,0 +1,34 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + environment: + - GEOSERVER_ADMIN_PASSWORD=admin + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + restart: always + + backend-java: + image: eclipse-temurin:21-jre + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb + - SPRING_DATASOURCE_MASTER_USERNAME=sigemweb + - SPRING_DATASOURCE_MASTER_PASSWORD=sigemweb + - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis + - SPRING_DATASOURCE_GIS_USERNAME=cbareiro + - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2023 + - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ../backend-java/gis-geoserver.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + restart: always diff --git a/docker-compose_v24.yml b/docker-compose_v24.yml new file mode 100644 index 0000000..9dbeff0 --- /dev/null +++ b/docker-compose_v24.yml @@ -0,0 +1,34 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + environment: + - GEOSERVER_ADMIN_PASSWORD=admin + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + restart: always + + backend-java: + image: eclipse-temurin:21-jre + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb + - SPRING_DATASOURCE_MASTER_USERNAME=postgres + - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 + - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis + - SPRING_DATASOURCE_GIS_USERNAME=cbareiro + - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2017 + - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ../backend-java/gis-geoserver.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + restart: always diff --git a/docker-compose_v25.yml b/docker-compose_v25.yml new file mode 100644 index 0000000..2430f31 --- /dev/null +++ b/docker-compose_v25.yml @@ -0,0 +1,34 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + environment: + - GEOSERVER_ADMIN_PASSWORD=admin + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + restart: always + + backend-java: + image: eclipse-temurin:21-jre + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.90:5432/cartodb_user_17b59d48-0892-47a7-a206-e1b3bb6fb6f8_db + - SPRING_DATASOURCE_MASTER_USERNAME=postgres + - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2018 + - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis + - SPRING_DATASOURCE_GIS_USERNAME=cbareiro + - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2023 + - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ../backend-java/gis-geoserver.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + restart: always diff --git a/docker-compose_v26.yml b/docker-compose_v26.yml new file mode 100644 index 0000000..9dbeff0 --- /dev/null +++ b/docker-compose_v26.yml @@ -0,0 +1,34 @@ +services: + geoserver: + image: kartoza/geoserver:2.24.1 + environment: + - GEOSERVER_ADMIN_PASSWORD=admin + - GEOSERVER_CORS_ENABLED=true + - GEOSERVER_CORS_ALLOWED_ORIGINS=* + - GEOWEBCACHE_CACHE_DIR=/opt/geoserver/data_dir/gwc + volumes: + - ./geoserver-data:/opt/geoserver/data_dir + ports: + - "8080:8080" + restart: always + + backend-java: + image: eclipse-temurin:21-jre + environment: + - SERVER_PORT=8081 + - SERVER_SERVLET_CONTEXT_PATH=/gis-geoserver + - SPRING_DATASOURCE_MASTER_URL=jdbc:postgresql://192.168.1.254:5432/sigemweb + - SPRING_DATASOURCE_MASTER_USERNAME=postgres + - SPRING_DATASOURCE_MASTER_PASSWORD=x25yvaga2017 + - SPRING_DATASOURCE_MASTER_DRIVER_CLASS_NAME=org.postgresql.Driver + - SPRING_DATASOURCE_GIS_URL=jdbc:postgresql://192.168.1.123:5432/sigem_gis + - SPRING_DATASOURCE_GIS_USERNAME=cbareiro + - SPRING_DATASOURCE_GIS_PASSWORD=x25yvaga2017 + - SPRING_DATASOURCE_GIS_DRIVER_CLASS_NAME=org.postgresql.Driver + - JWT_SECRET=sigem_gis_secret_key_2024_v1 + volumes: + - ../backend-java/gis-geoserver.jar:/app.jar + ports: + - "8081:8081" + command: ["java", "-jar", "/app.jar"] + restart: always diff --git a/extensions.sql b/extensions.sql new file mode 100644 index 0000000..39f84cd --- /dev/null +++ b/extensions.sql @@ -0,0 +1,7 @@ +-- Instalación de Extensiones Necesarias en DB sigem +CREATE EXTENSION IF NOT EXISTS dblink SCHEMA public; +CREATE EXTENSION IF NOT EXISTS pg_trgm SCHEMA public; +CREATE EXTENSION IF NOT EXISTS pgcrypto SCHEMA public; +CREATE EXTENSION IF NOT EXISTS postgres_fdw SCHEMA public; +-- plpgsql suele venir por defecto en el catálogo, nos aseguramos: +CREATE EXTENSION IF NOT EXISTS plpgsql SCHEMA pg_catalog; diff --git a/extract_carto.sh b/extract_carto.sh new file mode 100644 index 0000000..7114a89 --- /dev/null +++ b/extract_carto.sh @@ -0,0 +1,17 @@ +#!/bin/bash +echo "Verificando ogr2ogr..." +if ! command -v ogr2ogr &> /dev/null +then + echo "ogr2ogr no se encuentra. Intentando instalar gdal-bin..." + echo "x25yvaga2023" | sudo -S DEBIAN_FRONTEND=noninteractive apt-get update + echo "x25yvaga2023" | sudo -S DEBIAN_FRONTEND=noninteractive apt-get install -y gdal-bin +fi + +echo "Iniciando Extraccion de PostGIS a GPKG (Carto Sanity Pass)..." +cd /home/cbareiro +rm -f sigem_export.gpkg +ogr2ogr -f "GPKG" sigem_export.gpkg PG:"dbname=cartodb_user_17b59d48-0892-47a7-a206-e1b3bb6fb6f8_db host=127.0.0.1 user=postgres password=x25yvaga2017" "e505_barloc" "e505_calles" "e505_distrito" "e505_lotes" "e505_lotes_conccc" "e505_lotes_sinccc" "e505_manzanas" "e505_medidores" "e505_mejoras" "e505_zonas_tributarias" + +echo "Verificando exportacion final:" +ls -lh sigem_export.gpkg +echo "Extraccion Exitosa." diff --git a/fix_fdw_direct.sql b/fix_fdw_direct.sql new file mode 100644 index 0000000..bd65850 --- /dev/null +++ b/fix_fdw_direct.sql @@ -0,0 +1,21 @@ +-- REPARACIÓN DEFINITIVA DE FDW USUARIOS (v42.1) +DROP SCHEMA IF EXISTS fdw_505 CASCADE; +DROP SERVER IF EXISTS srv_mun_505 CASCADE; + +-- Crear servidor con los parámetros dinámicos de la Entidad 505 (Host: 10.0.25.1 Port: 5414 DB: sigem0505) +CREATE SERVER srv_mun_505 FOREIGN DATA WRAPPER postgres_fdw +OPTIONS (host '10.0.25.1', port '5414', dbname 'sigem0505'); + +-- Mapeo de usuario con contraseña de la tabla ENTIDADES para 505 (postgres / x25yvaga2018) +CREATE USER MAPPING FOR sigem_user SERVER srv_mun_505 +OPTIONS (user 'postgres', password 'x25yvaga2018'); + +CREATE SCHEMA fdw_505; + +-- Importación explícita incluyendo pgcrypto local +IMPORT FOREIGN SCHEMA public LIMIT TO (v_liq_entidad_totalxobjeto, v_liq_entidad_percentiles, usuarios, ventanas_usuario) +FROM SERVER srv_mun_505 INTO fdw_505; + +-- Verificación de columnas de usuarios +SELECT column_name, data_type FROM information_schema.columns +WHERE table_schema = 'fdw_505' AND table_name = 'usuarios'; diff --git a/gwc_lotes.xml b/gwc_lotes.xml new file mode 100644 index 0000000..261ede6 --- /dev/null +++ b/gwc_lotes.xml @@ -0,0 +1,18 @@ + + + true + sigem:vw_lotes_morosidad_505 + + image/png + image/jpeg + application/x-protobuf + + + + EPSG:900913 + + + EPSG:4326 + + + diff --git a/gwc_mejoras.xml b/gwc_mejoras.xml new file mode 100644 index 0000000..28bacea --- /dev/null +++ b/gwc_mejoras.xml @@ -0,0 +1,18 @@ + + + true + sigem:e505_mejoras + + image/png + image/jpeg + application/x-protobuf + + + + EPSG:900913 + + + EPSG:4326 + + + diff --git a/inject_gis.sh b/inject_gis.sh new file mode 100644 index 0000000..ad38074 --- /dev/null +++ b/inject_gis.sh @@ -0,0 +1,12 @@ +#!/bin/bash +echo "1. Asegurando extension PostGIS en BD 'sigem'..." +docker exec proyecto-postgres-1 psql -U sigem_user -d sigem -c "CREATE EXTENSION IF NOT EXISTS postgis;" || echo "BD no lista o error" + +echo "2. Copiando paquete GeoPackage al interior del contenedor..." +docker cp /yvyape/proyectos/sigem-gis/sigem_export.gpkg proyecto-postgres-1:/tmp/sigem_export.gpkg + +echo "3. Ejecutando inyeccion masiva ogr2ogr a PostgreSQL (sigem)..." +docker exec proyecto-postgres-1 sh -c "ogr2ogr -f PostgreSQL PG:'dbname=sigem host=127.0.0.1 user=sigem_user password=sigem_pass' /tmp/sigem_export.gpkg -nlt PROMOTE_TO_MULTI -skipfailures" +echo "Validando inyeccion:" +docker exec proyecto-postgres-1 psql -U sigem_user -d sigem -c "\dt e505_*" +echo "Inyeccion completada!" diff --git a/liq_por_tipo.php b/liq_por_tipo.php new file mode 100644 index 0000000..bdd1bcd --- /dev/null +++ b/liq_por_tipo.php @@ -0,0 +1,35 @@ + + + +
    + +
    + Ultimo año pagado:

    AÑO

    + Cuenta Catastral:

    CCCC

    +
    + + + + + + + + + + + + + + diff --git a/login.html b/login.html new file mode 100644 index 0000000..a2c7c82 --- /dev/null +++ b/login.html @@ -0,0 +1,225 @@ + + + + + + SIGEM-GIS | Acceso Institucional AdminLTE 3 + + + + + + + + + + + + + + + + + + + + diff --git a/login_institucional_bksp.html b/login_institucional_bksp.html new file mode 100644 index 0000000..7f973eb --- /dev/null +++ b/login_institucional_bksp.html @@ -0,0 +1,226 @@ + + + + + + SIGEMWEB | LOGIN - PROTOTIPO ADN CARTO + + + + + + + + + + + + + + + + + + + + + + + diff --git a/loginform.php b/loginform.php new file mode 100644 index 0000000..9c107f7 --- /dev/null +++ b/loginform.php @@ -0,0 +1,296 @@ +ip_address; + $login_timeout = $conf->login_timeout; + $max_attempts = $conf->max_attempts; + $timeout_minutes = $conf->timeout_minutes; + $attcheck = checkAttempts($myusername); + $curr_attempts = $attcheck['attempts']; + $datetimeNow = date("Y-m-d H:i:s"); + $oldTime = strtotime($attcheck['lastlogin']); + $newTime = strtotime($datetimeNow); + $timeDiff = $newTime - $oldTime; + + // QUERY + try { + $db = new DbConn; + $tbl_members = $db->tbl_members; + $err = ''; + } catch (PDOException $e) { + $err = "Error: " . $e->getMessage(); + } + + //Se setea el search_path al esquema correspondiente.. + $stentidad = $db->conn->prepare("SET search_path TO sigem".$myentidad); + $stentidad->execute(); + $anio = date('Y'); + + // *********************************************************************** + // Muestra del código el nuevo login de usuarios + // Los datos de la entidad se encuentran en la BD entidades del taperekaha + // *********************************************************************** + + /* + + // Conexión al taperekaha para traer los parámetros de conexión a la base de datos de la Municipalidad + sql_conexion := 'dbname=sigemweb host=192.168.1.254 port=5432 user=postgres password=x25yvaga2017' ; + sql_consulta := 'SELECT consulta.sigem_site, consulta.sigem_dbname FROM entidades AS consulta WHERE consulta.activo = TRUE AND consulta.entidad = ' || $myentidad || ' ;' ; + // Traer los parámetros de conexión a la base de datos de la Municipalidad + SELECT t1.sigem_site, t1.sigem_dbname + FROM public.dblink( + CAST( sql_conexion AS text ),CAST( sql_consulta AS TEXT ) + ) + AS t1 ( + sigem_site text, + sigem_dbname text + ) INTO val_sigem_site, val_sigem_dbname ; + + // Hacer la consulta para validar credenciales del usuario + consulta_sql_conexion := ('dbname=' || val_sigem_dbname || ' ' || val_sigem_site) ; + + consulta_sql_caso1 := ' SELECT caso1.ejer_fisca AS ejer_fisca, caso1.usu_alias AS usu_alias, ' ; + consulta_sql_caso1 := consulta_sql_caso1 || ' '|| '''LOGIN''' || ' AS tipo_dato ,' ; + consulta_sql_caso1 := consulta_sql_caso1 || ' caso1.usu_numero AS cod_dato, ' ; + consulta_sql_caso1 := consulta_sql_caso1 || ' CONCAT(' || val || ',' || '''-USUARIO EXISTE''' || ' ) AS descripcion_dato '; + consulta_sql_caso1 := consulta_sql_caso1 || ' FROM ( SELECT count(usua.usu_numero) AS cant_usuario, usua.ejer_fisca, usua.usu_alias, usua.usu_numero FROM usuarios usua WHERE ' ; + consulta_sql_caso1 := consulta_sql_caso1 || ' usua.activo = TRUE '; + consulta_sql_caso1 := consulta_sql_caso1 || ' AND usua.ejer_fisca = ' || val_ejer || ' AND usua.usu_alias = ' || val_alias ; + consulta_sql_caso1 := consulta_sql_caso1 || ' AND pgp_sym_decrypt(usua.usu_clave_a,' || '''510580''' || ', ' || '''compress-algo=0, cipher-algo=aes256''' || ' ) = ' || val_clave ; + consulta_sql_caso1 := consulta_sql_caso1 || ' GROUP BY usua.ejer_fisca, usua.usu_alias, usua.usu_numero ) AS caso1 '; + + RETURN QUERY SELECT t1.tipo_dato as tipo_dato, t1.cod_dato AS cod_dato, t1.descripcion_dato AS descripcion_dato FROM + public.dblink(CAST(consulta_sql_conexion AS text), + format( 'SELECT consulta.ejer_fisca, consulta.usu_alias, consulta.tipo_dato, consulta.cod_dato, consulta.descripcion_dato FROM (' || consulta_sql || ') AS consulta WHERE consulta.ejer_fisca = %L and consulta.usu_alias = %L GROUP BY consulta.ejer_fisca, consulta.usu_alias, consulta.tipo_dato, consulta.cod_dato, consulta.descripcion_dato ORDER BY consulta.ejer_fisca, consulta.usu_alias, consulta.tipo_dato, consulta.cod_dato, consulta.descripcion_dato ;',usu_ejer_fisca, usu_usu_alias )) + AS t1( + ejer_fisca numeric(18,0), + usu_alias text, + tipo_dato text, + cod_dato numeric(18,0), + descripcion_dato text) + ORDER BY t1.tipo_dato, t1.cod_dato, t1.descripcion_dato + + */ + // *********************************************************************** + + //SI ENTIDAD es CDE, corre query de password encriptado + //if ($myentidad == 505) { + //Se corre el query directamente sin usar PDO ya que la funcion pgp_sym_decrypt no puede ser escapada desde PDO y no reconoce la funcion + $dbconn = pg_connect("host=$db->host dbname=$db->db_name user=$db->username password=$db->password") or die('Could not connect: ' . pg_last_error()); + + $query = "SELECT entidad, ejer_fisca, usu_numero, usu_nom, usu_ape, usu_nivel, usu_alias, activo, + pgp_sym_decrypt(usu_clave_a::bytea,'510580')::text as usu_clave + FROM sigem".$myentidad.".usuarios WHERE usu_alias ilike '%".$myusername."%' and ejer_fisca = date_part('year', now())"; + $datos = pg_query($query) or die('Error message: ' . pg_last_error()); + + // Se traen los datos de la tabla usuario + $result = pg_fetch_assoc($datos); + + pg_close($dbconn); + /*} else { + // query normal via PDO + $stmt = $db->conn->prepare("SET search_path TO sigem".$myentidad); + $stmt = $db->conn->prepare("SELECT * FROM sigem".$myentidad.".usuarios WHERE usu_alias = :myusername and ejer_fisca = date_part('year', now())"); + $stmt->bindParam(':myusername', $myusername); + $stmt->execute(); + + // Se traen los datos de la tabla usuario + $result = $stmt->fetch(PDO::FETCH_ASSOC); + }*/ + + if ($curr_attempts >= $max_attempts && $timeDiff < $login_timeout) { + //Demasiados intentos fallidos + $success = "
    Numero maximo de reintentos excedido... por favor espere ".$timeout_minutes." minutos e intente nuevamente
    "; + } else { + //Si no se excede el maximo de intentos fallidos, continua.... + + // TODO: AGREGAR validacion contra hash no password en plano -.- + //La funcion password_verify solo funciona con versiones de php 5.5++, como centos 7 solo llega + //a 5.4 se obvia por de pronto + //if (password_verify($mypassword, $result['usu_clave']) && $result['activo'] == true) { + + //Se agrego validacion de credenciales contra la tabla usuarios del esquema correspondiente a la institucion + //donde mypassword sea igual a usu_clave y activo == true + + if (($mypassword == $result['usu_clave']) && $result['activo'] == true) { + //if ( $result['activo'] == true) { + //Inicio de Sesion Exitoso + $success = 'true'; + session_start(); + + //Variables tabla sigemxxx.usuarios + $_SESSION['username'] = $myusername; + $_SESSION['entidad'] = $myentidad; //id_entidad + $_SESSION['usu_nom'] = $result['usu_nom']; + $_SESSION['usu_ape'] = $result['usu_ape']; + + //Variables tabla public.entidades + try { + $datos = new DbConn; + $err = ''; + } catch (PDOException $e) {$err = "Error: " . $e->getMessage();} + + // Query + $dtent = $datos->conn->prepare("SELECT * FROM public.entidades WHERE entidad = ".$myentidad); + $dtent->execute(); + $datosent = $dtent->fetch(PDO::FETCH_ASSOC); + + //TODO: HACER FUNCIONAR EN CASA, asi establecer año fiscal y parametros de version directo de BD + //Variables tabla sigemxxx.parametros + /*try { + $param = new DbConn; + $err = ''; + } catch (PDOException $e) {$err = "Error: " . $e->getMessage();} + + // Query + $pent = $param->conn->prepare("SELECT * FROM parametros WHERE entidad ilike '".$myentidad."'"); + $pent->execute(); + $parament = $pent->fetch(PDO::FETCH_ASSOC); + error_log('PARAMETROS ENTIDAD: '.$parament); + error_log('Resultado: '.print_r($parament, true));*/ + + //DATOS public.entidades + $_SESSION['n_entidad'] = $datosent['nombre']; + $_SESSION['niv_entidad'] = $datosent['niv_entidad']; + $_SESSION['sig_entidad'] = $datosent['sig_entidad']; + $_SESSION['sigem_site'] = $datosent['sigem_site']; + $_SESSION['sigem_dbname'] = $datosent['sigem_dbname']; + $_SESSION['direccion'] = $datosent['direccion']; + $_SESSION['telefono'] = $datosent['telefono']; + $_SESSION['fax'] = $datosent['fax']; + $_SESSION['responsable'] = $datosent['responsable']; + $_SESSION['eslogan'] = $datosent['eslogan']; + $_SESSION['imagen'] = $datosent['imagen']; + $_SESSION['site_url'] = $datosent['site_url']; + $_SESSION['latlong'] = $datosent['latlong']; + $_SESSION['lng'] = $datosent['lng']; + $_SESSION['lat'] = $datosent['lat']; + $_SESSION['zoom'] = $datosent['zoom']; + $_SESSION['maxzoom'] = $datosent['maxzoom']; + $_SESSION['minzoom'] = $datosent['minzoom']; + $_SESSION['mapa_base'] = $datosent['mapa_base']; + $_SESSION['boundno'] = $datosent['boundno']; + $_SESSION['boundse'] = $datosent['boundse']; + + //} elseif (password_verify($mypassword, $result['usu_clave']) && $result['activo'] == true) { + // TODO: AGREGAR validacion contra hash no password en plano -.- + } elseif (($mypassword == $result['usu_clave']) && $result['activo'] == true) { + //Cuenta sin verificar + $success = "
    La cuenta ha sido creada, pero no puedes iniciar sesion hasta que sea verificada
    "; + } else { + //Usuario o password invalido + $success = "
    Usuario o Contraseña Incorrecto/s
    "; + } + + + return $success; + } + } + + public function insertAttempt($username) + { + try { + $db = new DbConn; + $conf = new GlobalConf; + $tbl_attempts = $db->tbl_attempts; + $ip_address = $conf->ip_address; + $login_timeout = $conf->login_timeout; + $max_attempts = $conf->max_attempts; + + $datetimeNow = date("Y-m-d H:i:s"); + $attcheck = checkAttempts($username); + $curr_attempts = $attcheck['attempts']; + + $stmt = $db->conn->prepare("INSERT INTO ".$tbl_attempts." (ip, attempts, lastlogin, username) values(:ip, 1, :lastlogin, :username)"); + $stmt->bindParam(':ip', $ip_address); + $stmt->bindParam(':lastlogin', $datetimeNow); + $stmt->bindParam(':username', $username); + $stmt->execute(); + $curr_attempts++; + $err = ''; + + } catch (PDOException $e) { + + $err = "Error: " . $e->getMessage(); + + } + + //Determines returned value ('true' or error code) + $resp = ($err == '') ? 'true' : $err; + + return $resp; + + } + + + public function updateAttempts($username) + { + try { + $db = new DbConn; + $conf = new GlobalConf; + $tbl_attempts = $db->tbl_attempts; + $ip_address = $conf->ip_address; + $login_timeout = $conf->login_timeout; + $max_attempts = $conf->max_attempts; + $timeout_minutes = $conf->timeout_minutes; + + $att = new LoginForm; + $attcheck = checkAttempts($username); + $curr_attempts = $attcheck['attempts']; + + $datetimeNow = date("Y-m-d H:i:s"); + $oldTime = strtotime($attcheck['lastlogin']); + $newTime = strtotime($datetimeNow); + $timeDiff = $newTime - $oldTime; + + $err = ''; + $sql = ''; + + if ($curr_attempts >= $max_attempts && $timeDiff < $login_timeout) { + + if ($timeDiff >= $login_timeout) { + + $sql = "UPDATE ".$tbl_attempts." SET attempts = :attempts, lastlogin = :lastlogin where ip = :ip and username = :username"; + $curr_attempts = 1; + + } + + } else { + + if ($timeDiff < $login_timeout) { + + $sql = "UPDATE ".$tbl_attempts." SET attempts = :attempts, lastlogin = :lastlogin where ip = :ip and username = :username"; + $curr_attempts++; + + } elseif ($timeDiff >= $login_timeout) { + + $sql = "UPDATE ".$tbl_attempts." SET attempts = :attempts, lastlogin = :lastlogin where ip = :ip and username = :username"; + $curr_attempts = 1; + + } + + $stmt2 = $db->conn->prepare($sql); + $stmt2->bindParam(':attempts', $curr_attempts); + $stmt2->bindParam(':ip', $ip_address); + $stmt2->bindParam(':lastlogin', $datetimeNow); + $stmt2->bindParam(':username', $username); + $stmt2->execute(); + + } + + } catch (PDOException $e) { + + $err = "Error: " . $e->getMessage(); + + } + + //Determines returned value ('true' or error code) (ternary) + $resp = ($err == '') ? 'true' : $err; + + return $resp; + + } +} \ No newline at end of file diff --git a/main_login.php b/main_login.php new file mode 100644 index 0000000..4860b94 --- /dev/null +++ b/main_login.php @@ -0,0 +1,110 @@ + + + + + + SIGEM WEB | LOGIN + + + + + + + + + + + + + + + + + + + + + +
    + + +
    + SIGEM - Sistema de Gestion Municipal
    +

    REGISTRO MIC/DINAPI 593 del 7/Julio/2016

    + Registro General de Derechos de Autor
    + Todos los Derechos Reservados
    +
    +
    + + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + + + + + + diff --git a/mapa_main.js b/mapa_main.js new file mode 100644 index 0000000..77167f2 --- /dev/null +++ b/mapa_main.js @@ -0,0 +1,519 @@ +/*** Global object that contains the app ***/ +var app = app || {}; + +// keep our map stuff in a part of the app object as to not pollute the global name space +app.map = (function(w,d, $, _){ + var el = { + map:null,cdbURL:null,styles: null,params:null, + styleCur:null,sql:null, + mapboxTiles:null,satellite:null,taxLots:null, + baseLayers:null,capaMANZ:null,capaCALLES:null,capasinCCC:null,polygon:null, + bushwick:null,colony : null,linden : null,groveSt : null,featureGroup : null, + template:null,menu:null, + legend:null,menud:null, mostrar: null, + taxLotActions:null,story:null + }; + + //SE CARGAN VALORES REUTILIZABLES + el.styles = app.mapStyles; //ESTILOS + el.params = app.param; //PARAMETROS + el.cdbURL = app.url; //URL MAPA BASE + + // compile the underscore legend template for rendering map legends for choropleth layers + _.templateSettings.variable = "legend"; + el.template = _.template($("script.template").html()); + + el.legendcontainer = $('#ui-leyenda-contenedor'); + el.legend = $('#ui-legend'); + el.menu = $('#accordion'); + + // Configuramos el mapa y sus capas! + var initMap = function() { + // Ocultamos datos, resumen y tooltip + $('#box2').hide();$('#tool-tip').hide(); + + // Parametros del mapa de FONDO + var params = {center:[lat,lng],minZoom:minzoom,maxZoom:maxzoom,zoom:zoom,maxBounds:L.latLngBounds(corner1,corner2),zoomControl:false,infoControl:false,attributionControl:true} + el.map = new L.map('map', params); + + + + // tileLayer for mapbox basemap + el.mapboxTiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, + attribution: '© OpenStreetMap contributors' + }); + el.map.addLayer(el.mapboxTiles); + + //TODO: Capa Nokia layer.tileLayer('http://{s}.maps.nlp.nokia.com/maptile/2.1/maptile/newest/satellite.day/{z}/{x}/{y}/256/jpg?lg=eng&token=A7tBPacePg9Mj_zghvKt9Q&app_id=KuYppsdXZznpffJsKT24', { + // subdomains:"1234", attribution: '© Nokia Maps contributors, © YVAGA'}).addTo(map); + // add mapbox and osm attribution + var attr = "© Mapbox © OpenStreetMap" + el.map.attributionControl.addAttribution(attr); + + // add Bing satelitte imagery layer + el.satellite = new L.BingLayer('AkuX5_O7AVBpUN7ujcWGCf4uovayfogcNVYhWKjbz2Foggzu8cYBxk6e7wfQyBQW'); + + // Capas bases para leaflet + el.baseLayers = {geometrico: el.mapboxTiles,foto: el.satellite}; + + // inits UI element for toggling base tile layers + L.control.layers(el.baseLayers, {}, {position: 'bottomleft'}).addTo(el.map); + + // makes sure base layers stay below the cartodb data + el.map.on('baselayerchange', function(e){e.layer.bringToBack();}) + + // se agregan las capas + $(document).ajaxStart(function() { Pace.restart(); }); + getCDBData(); + $('#box').show(); + } + + // Carga capa Base y ADICIONALES + + var getCDBData = function() { + cartodb.createLayer(el.map, el.cdbURL, {cartodb_logo: false,legends: false,https: true}, + function(layer) { + + //TODO: VERIFICAR QUE ESTE 'LOADER' FUNKE + var loader = new cdb.geo.ui.TilesLoader({ template: function(){ return '
    ' } }); + + function addLoader(layer) { + layer.bind('loading', function() { loader.show() }); + layer.bind('load', function() { loader.hide(); }); + } + + // se almacenan las capas en las variables correspondientes + layer.getSubLayer(0).setCartoCSS(el.styles.regular); + layer.getSubLayer(0).setSQL(el.params.morosidadtodos); + el.taxLots = layer.getSubLayer(0); + + //CAPAS ADICIONALES + el.capaMANZ = layer.createSubLayer({sql : el.params.manzanas, cartocss : el.styles.manzanas}); + el.capaCALLES = layer.createSubLayer({sql : el.params.calles, cartocss : el.styles.calles}); + el.capasinCCC = layer.createSubLayer({sql : el.params.lotesincc,cartocss : el.styles.lotesincc}); + + // Mueve la posición del tool-tip respecto a la ubicación del mouse 5px, para no interferir en el proceso de "click" + var event = function (e) {$('#tool-tip').css({left: e.pageX + 5,top: e.pageY + 5});}; + + // hide and set interactivity on the DOB permit layers + var num_sublayers = layer.getSubLayerCount(); + // Se esconden todas las capas cargadas + for (var i = 1; i < num_sublayers; i++) {layer.getSubLayer(i).hide();} + //console.log(num_sublayers); + + // Se activa la interactividad y se especifica los campos activados para dicho fin + layer.getSubLayer(0).setInteraction(true); + layer.getSubLayer(0).setInteractivity('cartodb_id, ultimo_pago, trb_total_deuda, ccc, cc_man, cc_lote, layer, obs, inm_ficha'); + + //Feature on Mouse CLICK + layer.on('featureClick', function(e, pos, latlng, data) { + if (typeof impuesto !== "undefined") { + showFeature(data.cartodb_id, data.ccc); + }else{showFeature(data.cartodb_id, data.ccc);} + }); + + //Feature Mouse OVER + layer.getSubLayer(0).on('featureOver', function(e, pos, latlng, data) { + ultimo_pago = data.ultimo_pago; + cuenta = data.ccc; + if (data.ultimo_pago == null){ultimo_pago = "N/A";}else{ultimo_pago = data.ultimo_pago;} + if (data.inm_ficha == null){ficha = "SIN FICHA";}else{ficha = data.inm_ficha;} + if (data.obs == null){observaciones = "SIN OBSERVACIONES";}else{observaciones = data.obs;} + $('#map').css('cursor', 'pointer'); + $('#tool-tip').show().html( + // Contenido del Tool-Tip + '

    Informacion Adicional

    ' + + '
    ' + + '

    FICHA: ' + ficha + '

    ' + + '

    Manzana: ' + data.cc_man + '

    ' + + '

    Numero de Lote: ' + data.cc_lote + '

    ' + + '

    OBS.: ' + observaciones + '

    ' + ); + $(document).bind('mousemove', event); + document.getElementById("ultimo").innerHTML = ultimo_pago; + document.getElementById("ccc").innerHTML = cuenta; + }); + //Feature Mouse OUT + layer.getSubLayer(0).on('featureOut', function(e,pos,latlng,data){ + $('#tool-tip').hide(); + $(document).unbind('mousemove', event, false); + }); + + el.map.addLayer(layer, false); + // make sure the base layer stays below the cdb layer + el.mapboxTiles.bringToBack(); + }).on('done', function() { + }); // end cartodb.createLayer! + + }; + + var showFeature = function (cartodb_id, ccc) { + $('#box2').show(); + $('#tool-tip').hide(); + $.ajax({ + url: "api/callREAD.php", + type: "POST", + data: {cartodb_id: cartodb_id, type: 'lote', entidad: entidad}, + dataType: 'json', + success: function (geojson) { + if (el.polygon) {el.map.removeLayer(el.polygon);} + el.polygon = L.geoJson(geojson, { + style: { + color: "#000", + fillColor: "#edd711", + weight: 6, + opacity: 0.8, + fillOpacity: 0.2 + } + }); + el.map.fitBounds(el.polygon.getBounds(), {maxZoom: 17}); + el.polygon.addTo(el.map); + //console.log(polygon.getBounds()); //DEFINICION DEL POLIGONO + if (typeof impuesto !== "undefined") { + //console.log(entidad, impuesto, estado); + $.ajax + ({ + url: 'login/get_liquidacion.php', //Se parsea el numero de ccc a fin de obtener los datos del lote + type: 'POST', + data: {ccc: ccc, entidad: entidad, impuesto: impuesto, estado: estado},//parseo de ccc + dataType: "json", //text or html or json or script + success:function(data) + { + var largo = data.length; + //SE LIMPIA EL DIV DE RESULTADOS + $("#toggle_resumen").html("").append('Mostrar Todos'); + $("#box").css({'opacity':'0.8'}); + //TODO: aca podria haber sido overlowY en el "scroll" para contemplar solo el scroll vertical, preferi dejar ambos para que se "note que hay algo" + //console.log(largo); + + if (largo > 0){ + // SE CREA EL INFORME POR LOTE + $("#resumen").html("").css({display: 'block', height: '90%', overflow: 'scroll'} + ).append('' + + '

    Informe Catastral

    ' + + '

    Lote: '+ccc+' Ficha: '+data[0].inm_ficha+'

    '+ + //SE CREA LA TABLA PARA EL RESUMEN + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''); + //SE IMPRIMEN LOS DATOS DEL LOTE + var sum = 0; + $.each(data,function (i,item) { + switch (item.liq_estado){ + case 'REG': + estadopago = 'PENDIENTE'; + tiporesumen = 'ADEUDADO'; + break; + case 'PAG': + tiporesumen = 'PAGADO'; + estadopago = item.liq_fecpago; + break; + } + sum += parseInt(item.liq_importe_apagar); + + $('#resumen_table').append( + '' + + '' + + '' + + '' + + '' + + '' + + '' + ); + //console.log(sum, item); + }); + $('#resumen').append( + '
    Ejercicio FiscalTributoEstadoImporteFecha de pago
    '+item.ejer_fisca+''+item.trb_tributo+''+item.liq_estado+''+$.number(item.liq_importe_apagar,0,',','.')+''+estadopago+'

    Total '+tiporesumen+': '+ $.number(sum,0,',','.')+' Gs.

    '); + $('#toggle_resumen').append('Ocultar Resumen'+ + '' + ); + }else{ + $("#box2").css({display: 'block', height: 'auto'}); + $("#resumen").html("").css({display: 'block', height: 'auto', overflow: ''}).append('

    No se encontraron Datos

    '); + } + }, + error:function(data){ + $('#resumen').html("").append('

    No se encontraron datos

    ') + } + });; + }else { + //alert("FAVOR ELIJA TIPO DE IMPUESTO!"); + } + } + }); + }; + + // change the cartoCSS of a layer + var changeCartoCSS = function(layer, css) {layer.setCartoCSS(css);}; + + // change SQL query of a layer + var changeSQL = function(layer, sql) {layer.setSQL(sql);}; + + // corresponding cartoCSS & SQL changes to tax lot layer buttons + // legends are displayed or hidden as needed + el.taxLotActions = { + regular : function() { + changeCartoCSS(el.taxLots, el.styles.regular); + changeSQL(el.taxLots, el.params.morosidadtodos); + renderLegend(null); + return true; + }, + totales : function() { + //TODO: MEJORAR LOGICA!! + switch (estado){ + case 'REG': + colormaximo = '#BD0026'; + color80 = '#F03B20'; + color60 = '#FFCC00'; + color40 = '#95ad42'; + color20 = '#2a722f'; + colorminimo = '#8e8e8e'; + titulo = 'ADEUDADO'; + label_leyenda = 'NO REGISTRADOS/NO LIQUIDADOS'; + break; + case 'PAG': + colormaximo = '#2a722f'; + color80 = '#95ad42'; + color60 = '#FFCC00'; + color40 = '#F03B20'; + color20 = '#BD0026'; + colorminimo= '#8e8e8e'; + titulo = 'PAGADO'; + label_leyenda = 'NO REGISTRADOS/NO PAGADOS'; + break; + } + + if (porciento80 === minimo) { + lotetotales = '#e'+entidad+'_lotes_conccc{polygon-fill: #FFFFB2;polygon-opacity: 0.8;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'+ + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' > ' +porciento80+ ' ] {polygon-fill: '+colormaximo+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' = ' +porciento80+ '] {polygon-fill: '+color80+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' < ' +minimo+ '] {polygon-fill: '+colorminimo+';}'+ + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' = null] {polygon-fill: '+colorminimo+';}' + ; + } + else { + lotetotales = '' + + '#e'+entidad+'_lotes_conccc{polygon-fill: #FFFFB2;polygon-opacity: 0.8;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'+ + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' > ' +porciento80+ ' ] {polygon-fill: '+colormaximo+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento80+ '] {polygon-fill: '+color80+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento60+ '] {polygon-fill: '+color60+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento40+'] {polygon-fill: '+color40+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' <= ' +porciento20+ '] {polygon-fill: '+color20+';}' + + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' < ' +minimo+ '] {polygon-fill: '+colorminimo+';}'+ + '#e'+entidad+'_lotes_conccc [ '+tipodeuda+' = null] {polygon-fill: '+colorminimo+';}' + ; + } + changeCartoCSS(el.taxLots, lotetotales); + //el.params.morosidadtodos+ " where (trb_tributo ilike '"+impuesto+"' and "+tipodeuda+" > 0) or trb_tributo is null"; + sqltotales = el.params.morosidadtodos + " where (trb_tributo ilike '"+impuesto+"' or trb_tributo is null) "; + + if (sqlnuevo === "") { + changeSQL(el.taxLots, sqltotales); + }else{ + filtro = parseInt(array.rows[idactual][filtroactual]); + //console.log (typeof filtro); + sqlnuevo = sqlnuevo + " and "+tipodeuda+" " + op + " " + eval(filtro); + //console.log(sqlnuevo); + changeSQL(el.taxLots, sqlnuevo); + changeCartoCSS(el.taxLots, lotetotales); + sqlnuevo = ""; + filtro = ""; + } + //TODO: MEJORAR LOGICA DE RENDER LEGENDA! + if (porciento80 === minimo){ + renderLegend( + {title : "Total "+ titulo, + items : [ + {color : colormaximo, label : "> " +$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op : " > " }, + {color : color80, label : "= "+$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op : " = " }, + {color : "hsl(48, 100%, 50%)", label : label_leyenda, filtroid : "minimo", op : " < " } + ] + } + ); + } + else{ + renderLegend( + {title : "Total "+ titulo, + items : [ + {color : colormaximo, label : "> " +$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op : " > " }, + {color : color80, label : "<= "+$.number(porciento80,0,',','.')+" Gs", filtroid : "porciento80", op: " <= " }, + {color : color60, label : "<= "+$.number(porciento60,0,',','.')+" Gs", filtroid : "porciento60", op: " <= "}, + {color : color40, label : "<= "+$.number(porciento40,0,',','.')+" Gs", filtroid : "porciento40", op: " <= " }, + {color : color20, label : "<= "+$.number(porciento20,0,',','.')+" Gs", filtroid : "porciento20", op: " <= " }, + {color : "#787878", label : label_leyenda, filtroid : "minimo", op: "<"} + ] + } + ); + } + $('#tool-tip').show(); + $('#box').show(); + //TODO: seguir //getCDBData().getSubLayer(0).hide(); + return true; + }, + ultimopagado : function(){ + switch (estado){ + case 'REG': //TODO: REVISAR LOGICA + colormaximo = '#2a722f'; + color80 = '#95ad42'; + color60 = '#FFCC00'; + color40 = '#F03B20'; + color20 = '#BD0026'; + colorminimo= '#8e8e8e'; + titulo = 'ADEUDADO'; + break; + case 'PAG': + colormaximo = '#2a722f'; + color80 = '#95ad42'; + color60 = '#FFCC00'; + color40 = '#F03B20'; + color20 = '#BD0026'; + colorminimo= '#8e8e8e'; + titulo = 'PAGADO'; + break; + } + //TODO: Dinamico + lotesultimopagado = '#e'+entidad+'_lotes_conccc{polygon-fill: #006D2C;polygon-opacity: 0.8;line-color: #FFF;line-width: 0.5;line-opacity: 1;}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago = '+periodo+'] {polygon-fill: '+colormaximo+';}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo1+'] {polygon-fill: '+color80+';}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo2+'] {polygon-fill: '+color60+';}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo3+'] {polygon-fill: '+color40+';}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo4+'] {polygon-fill: '+color20+';}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago <= '+periodo5+'] {polygon-fill: '+color20+';}'+ + '#e'+entidad+'_lotes_conccc [ ultimo_pago = null] {polygon-fill: '+colorminimo+';}'; + changeCartoCSS(el.taxLots, lotesultimopagado); + sqlultimopagado = el.params.morosidadtodos+ " where (trb_tributo ilike '"+impuesto+"' and "+tipodeuda+" > 0) or trb_tributo is null"; + //console.log(sqlultimopagado); + if (sqlnuevo === ""){changeSQL(el.taxLots, sqlultimopagado);} + else { + sqlnuevo = sqlnuevo + "and ultimo_pago " +op+ " " + eval(filtroactual); + //console.log(sqlnuevo); + changeSQL(el.taxLots, sqlnuevo); + changeCartoCSS(el.taxLots, lotesultimopagado); + sqlnuevo = ""; + filtro = ""; + } + //TODO: Debe ser dinamico + renderLegend({ + title : "Ultimo "+ titulo, + items : [ + {color : colormaximo, label : "= " + periodo, filtroid : periodo, op : " = " }, // igual a ultimo anho + {color : color80, label : " <= " + periodo1, filtroid : periodo1, op : " <= " }, + {color : color60, label : "<= "+ periodo2, filtroid : periodo2, op : " <= " }, + {color : color40, label : "<= "+ periodo3, filtroid : periodo3, op : " <= " }, + {color : color20, label : "<= "+ periodo4, filtroid : periodo4, op : " <= " }, + {color : color20, label : "<= "+ periodo5, filtroid : periodo5, op : " <= " }, + {color : colorminimo, label : "SIN DEUDA O DEUDAS PRESCRIPTAS", filtroid : periodo6, op : "=<" } + ] + }); + return true; + } + }; + + // add tax lot layer button event listeners + var initButtons = function() { + $('.button').click(function(e) { + //e.preventDefault(); + $(document).ajaxStart(function() { Pace.restart(); }); + limpiar(); + $('.button').removeClass('active'); + $(this).addClass('active'); + idactual = $(this).attr('name'); + impuesto = array.rows[idactual].trb_tributo; + estado = array.rows[idactual].estado; + switch (estado) { + case 'REG':tipodeuda = "trb_total_deuda";break; + case 'PAG':tipodeuda = "trb_total_pago";break; + } + maximo = parseInt(array.rows[idactual].maximo); + minimo = parseInt(array.rows[idactual].minimo); + porciento20 = parseInt(array.rows[idactual].porciento20); + porciento40 = parseInt(array.rows[idactual].porciento40); + porciento60 = parseInt(array.rows[idactual].porciento60); + porciento80 = parseInt(array.rows[idactual].porciento80); + tipofiltro = $(this).attr('id'); + app.map.el.taxLotActions[tipofiltro](); + var sqlnuevo = ""; + //console.log(tipofiltro); + //console.log(idactual, impuesto, estado, maximo, minimo, porciento20, porciento40, porciento60, porciento80); + //console.log(tipodeuda); + //app.map.el.taxLots.show(); + }); + } + + //SUBFILTRO ONCLICK EN LA LEYENDA + var initsubfiltro = function(e) { + $(".subfiltro").click(function() { + //TODO: AL ELGIR UN FILTRO, PONER EN GRIS LOS DEMAS + //limpiarfiltros(); + $(this).addClass("selected"); + filtroactual = $(this).attr(toString("filtroid")); + op = $(this).attr("op"); + //console.log(filtroactual, op); + //TODO: HASTA LLEGUE POR HOY 11/12/2017 12:26 + sqlnuevo = el.params.morosidadtodos + " where trb_tributo ilike '"+impuesto+"'"; + + app.map.el.taxLotActions[tipofiltro](); + + }); + } + + + // Muestra las capas adicionales a medida que son marcados los checkboxes + var initCheckboxes = function() { + var checkboxDOB = $('input.dob:checkbox'), $manz = $('#manz'), $calle = $('#calle'), $sinccc = $('#sinccc'); + $manz.change(function() {if ($manz.is(':checked')) {el.capaMANZ.show()} else {el.capaMANZ.hide()}}); + $calle.change(function() {if ($calle.is(':checked')) {el.capaCALLES.show()}else {el.capaCALLES.hide()}}); + $sinccc.change(function(){if ($sinccc.is(':checked')){el.capasinCCC.show()}else {el.capasinCCC.hide()}}); + } + + // function to render choropleth legends + var renderLegend = function(data) { + if (data === null) { + //el.legend.addClass('hidden'); + el.legend.removeClass('hidden'); + return; + } + var legendData = {title : data.title,items : data.items,}; + el.legend.html(el.template(legendData)); + if (el.legend.hasClass('hidden')) el.legend.removeClass('hidden'); + initsubfiltro(); + } + + // Botones de Zoom Custom + var initZoomButtons = function(){ + $('#zoom-in').on('click', function(){el.map.zoomIn();}); + $('#zoom-out').on('click', function(){el.map.zoomOut();}); + } + + + + // get it all going! + var init = function() { + //searchAddress(); + initZoomButtons(); + $(document).ajaxStart(function() { Pace.restart(); }); //EFECTO "CARGANDO..." + initCheckboxes(); + initButtons(); + $(document).ajaxStart(function() { Pace.restart(); }); //EFECTO "CARGANDO..." + initMap(); + } + + // only return init() and the stuff in the el object + return { + init : init, + el : el + } + +})(window, document, jQuery, _); + +// call app.map.init() once the DOM is loaded +window.addEventListener('DOMContentLoaded', function(){ + app.conf.init(); + app.map.init(); +}); \ No newline at end of file diff --git a/mapa_mapStyles.js b/mapa_mapStyles.js new file mode 100644 index 0000000..07852ff --- /dev/null +++ b/mapa_mapStyles.js @@ -0,0 +1,387 @@ +/**** CartoCSS for styling tax lot data ****/ +var app = app || {}; + +var conficha, sinficha = ''; + +var actualizar_navegacion = function () { + switch (mapa) { + case 'morosidad': + subseccion = 'Por tipo de Impuestos'; + break; + case 'zonas': + subseccion = 'Por Zona Tributaria'; + ttc1 = 'FICHA'; + ttc2 = 'ZONA'; + ttc3 = 'OBS'; + break; + case 'frentes': subseccion = 'Por tipo de Pavimento'; break; + case 'notificacion': subseccion = 'Estado de Notificación'; break; + case 'migracion': subseccion = 'Seguimiento de actualizaciones'; break; + case 'baldios': subseccion = 'Lotes Baldios'; break; + case 'baches': + //render pagina baches + break; + } + + //Nombrar Seccion y Subseccion + $("#seccion").text(seccion); + $("#subseccion").text(subseccion); + + //Mostrar elementos ocultos (template) + $("#search-container").removeAttr('hidden'); + $("#ui-zoom").removeAttr('hidden'); + $("#ui-legend").removeAttr('hidden'); + $("#tool-tip").removeAttr('hidden'); + + Pace.restart(); + +} + + +//app.mapStyles = (function(idactual){ +app.mapStyles = (function(){ + return { + // default style, all lots are the same color + regular : '' + + '#e'+entidad+'_lotes_conccc{'+ + 'polygon-fill: hsl(200,40%,90%);' +'polygon-opacity: 0.2;' +'line-color: #000;' +'line-width: 0.2;' +'line-opacity: 0.5;' + + '}', + inicio : '' + + '#e'+entidad+'_lotes_conccc{'+ + 'polygon-fill: #FFFFFF;'+'polygon-opacity: 0.7;'+'line-color: #000000;'+'line-width: 0.5;'+'line-opacity: 1;'+ + '}', + iniciomanz : '' + + '#e'+entidad+'_lotes_conccc{'+ + 'polygon-fill: #FFFFFF;'+'polygon-opacity: 0.7;'+'line-color: #000000;'+'line-width: 0.5;'+'line-opacity: 1;'+ + '}', + manzanas : ''+ + '#e'+entidad+'_manzanas{' + + 'polygon-fill: #FFA300; polygon-opacity: 0.2; line-color: #FFF; line-width: 0.5; line-opacity: 1;' + + '}' + + '#e'+entidad+'_manzanas::labels [zoom >= 16] {'+ + 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ + 'text-size: 16;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #000;'+ + 'text-halo-fill: #7f7676;'+ 'text-halo-radius: 3;'+ + 'text-dy: 0;'+ 'text-opacity: 0.2;'+ 'text-allow-overlap: false;'+ + 'text-placement: point;'+ 'text-placement-type: simple;'+ + '}'+ + '#e'+entidad+'_manzanas::labels [zoom >= 18] {'+ + 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ + 'text-size: 40;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #000;'+ + 'text-halo-fill: #3f3e3e;'+ 'text-halo-radius: 5;'+ + 'text-dy: 0;'+'text-opacity: 0.2;'+'text-allow-overlap: false;'+ + 'text-placement: point;'+'text-placement-type: simple;'+ + '}', + manzanascarga : ''+ + '#e'+entidad+'_manzanas{' + + 'polygon-fill: #FFA300; polygon-opacity: 0; line-color: #FFF; line-width: 1; line-opacity: 1;' + + '}' + + '#e'+entidad+'_manzanas::labels [zoom >= 16] {'+ + 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ + 'text-size: 16;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #FFF;'+ + 'text-halo-fill: #7f7676;'+ 'text-halo-radius: 3;'+ + 'text-dy: 0;'+ 'text-opacity: 0.5;'+ 'text-allow-overlap: false;'+ + 'text-placement: point;'+ 'text-placement-type: simple;'+ + '}'+ + '#e'+entidad+'_manzanas::labels [zoom >= 18] {'+ + 'text-name: [cc_man];'+ 'text-face-name: "DejaVu Sans Book";'+ + 'text-size: 40;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #FFF;'+ + 'text-halo-fill: #3f3e3e;'+ 'text-halo-radius: 5;'+ + 'text-dy: 0;'+'text-opacity: 0.5;'+'text-allow-overlap: false;'+ + 'text-placement: point;'+'text-placement-type: simple;'+ + '}', + calles : '#e'+entidad+'_calles{line-color: #0F3B82; line-width: 2; line-opacity: 0.7; }', + lotesincc : '#e'+entidad+'_lotes_sinccc{polygon-fill: #A53ED5; polygon-opacity: 0.6; line-color: #FFF; line-width: 0.5; line-opacity: 1;}', + capazonastrib : '' + + '#e'+entidad+'_zonas_tributarias{'+ + 'polygon-fill: #FF6600;'+'polygon-opacity: 0;'+'line-color: #000000;'+'line-width: 3;'+'line-opacity: 1;'+ + '}'+ + '#e'+entidad+'_zonas_tributarias::labels {'+ + 'text-name: [description];'+ + 'text-face-name: "DejaVu Sans Book";'+ + 'text-size: 20;'+ + 'text-label-position-tolerance: 0;'+ + 'text-fill: #000;'+ + 'text-halo-fill: #FFF;'+ + 'text-halo-radius: 3;'+ + 'text-dy: -10;'+ + 'text-allow-overlap: true;'+ + 'text-placement: line;'+ + 'text-placement-type: simple;'+ + '}', + //POR ZONAS - ZONAS TRIBUTARIAS + zonas : { + todos : '' + + '#e'+entidad+'_lotes_conccc {'+ + 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ + '}'+ + '#e'+entidad+'_lotes_conccc[inm_tipo_ur="R"] {'+'polygon-fill: #229A00;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tipo_ur="U"] {'+'polygon-fill: #2167AB;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tipo_ur=null] {'+'polygon-fill: #FFA300;'+'}' + , + R : '' + + '#e'+entidad+'_lotes_conccc[inm_tipo_ur="R"] {'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+'polygon-fill: #229A00;'+'}' + , + U : '' + + '#e'+entidad+'_lotes_conccc[inm_tipo_ur="U"] {'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+'polygon-fill: #2167AB;'+'}' + , + null : '' + + '#e'+entidad+'_lotes_conccc[inm_tipo_ur=null] {'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+'polygon-fill: #FFA300;'+'}' + } + , + //ZONAS TRIBUTARIAS + zonastributarias : { + todos : '' + + '#e'+entidad+'_lotes_conccc {'+ + 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ + '}'+ + '#e'+entidad+'_lotes_conccc[zonas_tributarias="0-0-0"] {'+'polygon-fill: #000000;'+'}'+ + '#e'+entidad+'_lotes_conccc[zonas_tributarias="R-1-1"] {'+'polygon-fill: #229A00;'+'}'+ + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-1-0"] {'+'polygon-fill: #F84F40;'+'}'+ + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-2-0"] {'+'polygon-fill: #0F3B82;'+'}'+ + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-3-0"] {'+'polygon-fill: #ffff00;'+'}'+ + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-4-0"] {'+'polygon-fill: #ff0000;'+'}' + , + //{color: "#ffff00", label: "U-3-0"}, + //{color: "#ff0000", label: "U-4-0"}, + null : '' + + '#e'+entidad+'_lotes_conccc[zonas_tributarias="0-0-0"] {'+'polygon-fill: #000000;'+'}' + , + R11 : '' + + '#e'+entidad+'_lotes_conccc[zonas_tributarias="R-1-1"] {'+'polygon-fill: #229A00;'+'}' + , + U10 : '' + + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-1-0"] {'+'polygon-fill: #F84F40;'+'}' + , + U20 : '' + + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-2-0"] {'+'polygon-fill: #0F3B82;'+'}' + , + U30 : '' + + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-3-0"] {'+'polygon-fill: #ffff00;'+'}' + , + U40 : '' + + '#e'+entidad+'_lotes_conccc[zonas_tributarias="U-4-0"] {'+'polygon-fill: #ff0000;'+'}' + } + , + //TIPO PAVIMENTO + frentepavimento : { + todos : '' + + '#e'+entidad+'_lotes_conccc{'+ + 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ + '}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav="T"] {'+'polygon-fill: #FF2900;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav="R"] {'+'polygon-fill: #894c4c;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav="E"] {'+'polygon-fill: #305784;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav="D"] {'+'polygon-fill: #6ba75f;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav="A"] {'+'polygon-fill: #222222;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav="H"] {'+'polygon-fill: #6ba75f;'+'}'+ + '#e'+entidad+'_lotes_conccc[inm_tpav=null] {'+'polygon-fill: #FFCC00;'+'}'//TODOS + , + asfalto : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="A"] {'+'polygon-fill: #222222;'+'}'//TODO: VARIABLE DINAMICA + , + hormigon : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="H"] {'+'polygon-fill: #6ba75f;'+'}'//TODO: VARIABLE DINAMICA + , + empedrado : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="E"] {'+'polygon-fill: #305784;'+'}' + , + adoquin : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="D"] {'+'polygon-fill: #6ba75f;'+'}' + , + tierra : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="T"] {'+'polygon-fill: #FF2900;'+'}' + , + ripio : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="R"] {'+'polygon-fill: #894c4c;'+'}' + , + nohab : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav="R"] {'+'polygon-fill: #894c4c;'+'}' + , + sindatos : '' + + '#e'+entidad+'_lotes_conccc[inm_tpav=null] {'+'polygon-fill: #FFCC00;'+'}' + } + , + // red highlight + red : '' + + '#e'+entidad+'_lotes_conccc{'+ + 'polygon-fill: #006D2C;' +'polygon-opacity: 0.8;' +'line-color: #FFF;' +'line-width: 0.5;' +'line-opacity: 1;' + + '}' + , + notificaciones: '' + + '#e'+entidad+'_lotes_conccc {'+ + 'polygon-opacity: 0.7;'+'line-color: #000000;'+'line-width: 0.5;'+'line-opacity: 0.5;'+ + '}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=9] {'+'polygon-fill: #69A9DC;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=6] {'+'polygon-fill: #95AD42;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=7] {'+'polygon-fill: #38A73B;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=4] {'+'polygon-fill: #2A722F;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=1] {'+'polygon-fill: #FDD344;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=2] {'+'polygon-fill: #CD9335;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=3] {'+'polygon-fill: #DF7C2B;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=8] {'+'polygon-fill: #F73235;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=5] {'+'polygon-fill: #FF9900;'+'}'+ + '#e'+entidad+'_lotes_conccc[tipo_instancia=null] {'+'polygon-fill: #FFFFFF;'+'}', + migracion: '' + + '#e'+entidad+'_lotes_conccc {'+ + 'polygon-opacity: 0.7;'+'line-color: #FFF;'+'line-width: 0.5;'+'line-opacity: 1;'+ + '}'+ + '#e'+entidad+'_lotes_conccc[actualizacion_status=0] {'+'polygon-fill: #5CA2D1;'+'}'+ + '#e'+entidad+'_lotes_conccc[actualizacion_status=1] {'+'polygon-fill: #229A00;'+'}' + , + migraciontipo: '' + + '#e'+entidad+'_lotes_conccc {'+ + 'polygon-opacity: 0.7;'+ 'line-color: #FFF;'+ 'line-width: 0.5;'+ 'line-opacity: 1;'+ + '}'+ + '#e'+entidad+'_lotes_conccc[actualizacion_codigo=1] {'+'polygon-fill: #79797a;'+'}'+ + '#e'+entidad+'_lotes_conccc[actualizacion_codigo=2] {'+'polygon-fill: #f73235;'+'}'+ + '#e'+entidad+'_lotes_conccc[actualizacion_codigo=3] {'+'polygon-fill: #447fbf;'+'}'+ + '#e'+entidad+'_lotes_conccc[actualizacion_codigo=4] {'+'polygon-fill: #154a18;'+'}', + baldios : { + todos: '' + + '#e' + entidad + '_lotes_conccc {' + 'polygon-opacity: 0.7;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + + '#e' + entidad + '_lotes_conccc{' + + '[valor_porcentaje=0] {polygon-fill: #F11810;}' + + '[valor_porcentaje >0][valor_porcentaje <=10]{polygon-fill: #FF6600;}' + + '[valor_porcentaje > 10] {polygon-fill: #229A00;}' + + '[valor_porcentaje=null] {polygon-fill: #FFCC00;}' + + '}', + baldio: '#e' + entidad + '_lotes_conccc[valor_porcentaje = 0] {' + 'polygon-fill: #F11810;' + '}', + baldioconst: '#e' + entidad + '_lotes_conccc[valor_porcentaje >0][valor_porcentaje <=10] {' + 'polygon-fill: #FF6600;' + '}', + nobaldio: '#e' + entidad + '_lotes_conccc[valor_porcentaje > 10] {' + 'polygon-fill: #229A00;' + '}', + sindatos: '#e' + entidad + '_lotes_conccc[valor_porcentaje = null] {' + 'polygon-fill: #FFCC00;' + '}' + }, + lotes_recoleccion: '' + + '#e9999_lotes_conccc {' + 'polygon-opacity: 0.7;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + + '#e9999_lotes_conccc[ruta_id="1"] {' + 'polygon-fill: #A53ED5;' + '}' + + '#e9999_lotes_conccc[ruta_id="2"] {' + 'polygon-fill: #229A00;' + '}', + sigem: { + todos: '' + + '#e'+entidad+'_lotes {' + 'polygon-opacity: 0.7;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + + '#e9999_lotes[inm_estado="ACT"] {' + 'polygon-fill: #229A00;' + '}' + + '#e9999_lotes[inm_estado="FRA"] {' + 'polygon-fill: #229A00;' + '}' + + '#e9999_lotes[inm_estado="NOT"] {' + 'polygon-fill: #229A00;' + '}' + + '#e9999_lotes[inm_estado=null] {' + 'polygon-fill: #F11810;' + '}', + conficha: ''+ + '#e9999_lotes[inm_estado="ACT"] {' + 'polygon-fill: #229A00;' + '}' + + '#e9999_lotes[inm_estado="FRA"] {' + 'polygon-fill: #229A00;' + '}' + + '#e9999_lotes[inm_estado="NOT"] {' + 'polygon-fill: #229A00;' + '}', + sinficha: '#e9999_lotes[inm_estado=null] {' + 'polygon-fill: #F11810;' + '}' + }, + nuevos: '' + + '#e' + entidad + '_lotes_conccc {' + 'polygon-opacity: 0.3;' + 'line-color: #FFF;' + 'line-width: 0.7;' + 'line-opacity: 0.5;' + '}' + + '#e' + entidad + '_lotes_conccc{' + + '[valor_porcentaje=0] {polygon-fill: #F11810;}' + + '[valor_porcentaje >0][valor_porcentaje <=10]{polygon-fill: #FF6600;}' + + '[valor_porcentaje > 10] {polygon-fill: #229A00;}' + + '[valor_porcentaje=null] {polygon-fill: #FFCC00;}' + + '}', + nuevoszoom: '' + + '#e' + entidad + '_lotes_conccc {' + 'polygon-opacity: 0.3;' + 'line-color: #FFF;' + 'line-width: 0.5;' + 'line-opacity: 1;' + '}' + + '#e' + entidad + '_lotes_conccc{' + + '[valor_porcentaje=0] {polygon-fill: #F11810;}' + + '[valor_porcentaje >0][valor_porcentaje <=10]{polygon-fill: #FF6600;}' + + '[valor_porcentaje > 10] {polygon-fill: #229A00;}' + + '[valor_porcentaje=null] {polygon-fill: #FFCC00;}' + + '}'+ + '#e'+entidad+'_lotes_concc::labels [zoom > 18] {'+ + 'text-name: [cc_lote];'+ 'text-face-name: "DejaVu Sans Book";'+ + 'text-size: 20;'+ 'text-label-position-tolerance: 10;'+ 'text-fill: #FFF;'+ + 'text-dy: 0;'+'text-opacity: 0.5;'+'text-allow-overlap: false;'+ + 'text-placement: point;'+'text-placement-type: simple;'+ + '}', + mejoras: '' + + '#e'+entidad+'_mejoras{polygon-fill: #A53ED5; polygon-opacity: 0.6; line-color: #FFF; line-width: 0.5; line-opacity: 1;}', + estado_mejoras: '' + + '#e505_mejoras {' + 'polygon-opacity: 0.7;' + 'line-color: #000000;' + 'line-width: 0.5;' + ' line-opacity: 0;' + '}' + + '#e505_mejoras[layer="MEJORAS-CARGADAS"] {' + 'polygon-fill: #229A00;' + '}' + + '#e505_mejoras[layer=null] {' + 'polygon-fill: #1F78B4;' + '}', + estado_lotes: '' + + '#e505_lotes_conccc {' + 'polygon-opacity: 0.7;' + 'line-color: #000000;' + 'line-width: 0.1;' + 'line-opacity: 0.6;' + '}' + + '#e505_lotes_conccc[layer="DATOS-EDITADOS"] {' + 'polygon-fill: #229A00;' + '}' + + '#e505_lotes_conccc[layer="LOTES-EDITADOS"] {' + 'polygon-fill: #5CA2D1;' + '}' + + '#e505_lotes_conccc[layer=null] {' + 'polygon-fill: #FFFFFF;' + '}' + }; +})(); + +app.leyendas = (function () { + return { + pavimento: {title: "Tipo de Pavimento", + items: [ + {color: "#222222", label: "Asfalto"}, + {color: "#6ba75f", label: "Hormigón"}, + {color: "#305784", label: "Empedrado"}, + {color: "#6ba75f", label: "Adoquín"}, + {color: "#FF2900", label: "Tierra"}, + {color: "#894c4c", label: "Ripio"}, + {color: "#FFCC00", label: "Sin Datos"}, + ] + }, + zonas: {title: "Tipos de Zona", + items: [ + {color: "#229A00", label: "Rural"}, + {color: "#2167AB", label: "Urbano"}, + {color: "#FFA300", label: "Sin Datos"}, + ] + }, + zonastributarias: {title: "Zonas Tributarias", + items: [ + {color: "#229A00", label: "R-1-1"}, + {color: "#F84F40", label: "U-1-0"}, + {color: "#0F3B82", label: "U-2-0"}, + {color: "#ffff00", label: "U-3-0"}, + {color: "#ff0000", label: "U-4-0"}, + {color: "#000000", label: "Sin Datos"}, + ] + }, + notificaciones: {title: "Notificaciones", + items: [ + {color: "#69a9dc", label: "INICIO SEGUIMIENTO"}, + {color: "#95ad42", label: "RELIQUID. y ACTUALIZ."}, + {color: "#38a73b", label: "EMIS. 1RA NOTIF."}, + {color: "#2a722f", label: "1RA NOTIF. ENTREGADA"}, + {color: "#fdd344", label: "EMIS. 2DA NOTIF."}, + {color: "#cd9335", label: "2DA NOTIF. ENTREGADA"}, + {color: "#df7c2b", label: "EMIS. CERTIF. DEUDA"}, + {color: "#f73235", label: "JUICIO EJECUTIVO"}, + {color: "#FFFFFF", label: "SIN DATOS"}, + ] + }, + migracion: {title: "Estado Migracion", + items: [ + {color: "#5CA2D1", label: "SIN ACTUALIZACIONES"}, + {color: "#229A00", label: "ACTUALIZADO"}, + ] + }, + migraciontipo: {title: "Estado Migracion", + items: [ + {color: "#79797a", label: "Linea de Base"}, + {color: "#f73235", label: "Zonas Tributarias"}, + {color: "#447fbf", label: "Frentes"}, + {color: "#154a18", label: "Frentes y Zonas"}, + ] + }, + baldios: {title: "Estado LOTE", + items: [ + {color: "#F11810", label: "LOTE BALDIO"}, + {color: "#FF6600", label: "BALDIO C/ CONSTRUC."}, + {color: "#229A00", label: "LOTE NO BALDIO"}, + {color: "#FFCC00", label: "SIN DATOS"}, + ] + }, + estado_lotes: {title: "ACT. DE LOTES", + items: [ + {color: "#229A00", label: "DATOS EDITADOS"}, + {color: "#5CA2D1", label: "LOTES EDITADOS"}, + {color: "#FFFFFF", label: "LINEA BASE"}, + ] + }, + estado_mejoras: {title: "ACT. DE MEJORAS", + items: [ + {color: "#229A00", label: "MEJORAS NUEVAS"}, + {color: "#5CA2D1", label: "CARGA MASIVA"}, + ] + } + } + +})(); diff --git a/mapa_parametros.js b/mapa_parametros.js new file mode 100644 index 0000000..d66a37f --- /dev/null +++ b/mapa_parametros.js @@ -0,0 +1,737 @@ +/**** SQL para los distintos tipos de mapas ****/ +var app = app || {}; + +//VARIABLES GLOBALES +var tipofiltro = ""; +var param_subfiltro = ""; +var sqlnuevo = ""; +var filtroactual = ""; +var filtro = ""; +var query = ""; +var estado, idactual = ''; +var array, arraymenu, menus, capas_adicionales = ''; +var seccion, subseccion = ''; +var ttc1, ttc2, ttc3 = ''; +var loteactual = ''; + +//FUNCIONES GLOBALES + + +var mapa_zonas = function () { + mapa = 'zona'; + app.map.el.map.remove(); + app.map.init(); +} + +//muestra/oculta resumen de lote +var mostrarResumen = function() { + if($('#resumen').css('display') != 'none'){ + $('#resumen').css({ + display: 'none' + }); + $("#toggle_msg").html('Mostrar Resumen'); + document.getElementById('print_resumen').type = 'hidden'; + $("#box2").css({display: 'block', height: 'auto'}); + }else{ + $('#resumen').css({display: 'block'}); + $("#toggle_msg").html('Ocultar Resumen'); + document.getElementById('print_resumen').type = 'button'; + $("#box2").css({display: 'block', height: '500px'}); + } +}; + +//funcion para limpiar el mapa cuando se elija un nuevo filtro/operacion +var limpiar = function() { + el = app.map.el; + el.map.setView([lat, lng], zoom); + $("#resumen").html(""); + $("#resumen").css({display: 'none'}); + $("#toggle_resumen").html(""); + //document.getElementById("box").style.opacity = "0.7"; + $("#box").css({ + 'opacity': '0.7' + } + ) + $('#box2').hide(); + if (el.polygon) { + el.map.removeLayer(el.polygon); + } +}; + +window.forceReload = function(){ + if( !window.fetch)return document.location.reload( true); + var els = document.getElementsByTagName( "*"); + for( var i = 0; i < els.length; i++){ + var src = ""; + if( els[i].tagName == "A")continue; + if( !src && els[i].src)src = els[i].getAttribute( "src"); + if( !src && els[i].href)src = els[i].getAttribute( "href"); + if( !src)continue; + fetch( src, { cache: "reload"}); + } + return document.location.reload( true); +}; + +var procesar = function (identificador, operacion) { + console.log('identificador: ', identificador, ' operacion: ', operacion); + switch (operacion){ + case 'actualizar': + var ccc = document.getElementById("infoModalCCC").value; + var zona = document.getElementById("infoModalZona").value; + var mz = document.getElementById("infoModalManzana").value; + var lote = document.getElementById("infoModalLote").value; + $.ajax({ + url: "login/set_valores.php", + type: "POST", + data: {id: identificador, operacion: operacion, ccc: ccc, zona: zona, mz: mz, lote: lote}, async: false, dataType: 'json', + success: function (data) { + array = JSON.parse(data); + alert(array[0].total_rows + ' de ' + array[1].total_rows + ' agregado'); + $('#modal_editar_lotes')[0].reset(); + console.log(array); + }, + error:function(data){console.log('ndoikoi!', data);} + }); + break; + case 'eliminar': + $.ajax({ + url: "login/set_valores.php", type: "POST", data: {id: identificador, operacion: operacion}, async: false, dataType: 'json', + success: function (data) { + array = JSON.parse(data); + alert('Se ha eliminado '+ array.total_rows + ' registro/s'); + }, + error:function(data){console.log('ndoikoi!', data);} + }); + break; + case 'cancelar': + map.removeLayer(polygon); + $('#modal_editar_lotes')[0].reset(); + break; + default: + alert('Operacion no valida'); + } + + $("#infoModal").toggle(); + //forceReload(); +}; + +//Se imprime el div que contiene el informe del lote +var printDiv = function() { + var divToPrint=document.getElementById('resumen'); + var newWin=window.open('','Print-Window'); + newWin.document.open(); + newWin.document.write('' + + '' + + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+divToPrint.innerHTML+''); + newWin.document.close(); + setTimeout(function(){newWin.close();},10); +}; + +app.conf = ( + function () { + //mapa = "zonas"; + //MENU DINAMICO + var initMenu = function() { + //console.log(mapa); + seccion = 'Mapas'; + actualizar_navegacion(); + + $.ajax({ + url: "login/get_valores.php", type: "POST", data: {mapa: mapa}, async: false, dataType: 'json', + success: function (data) { + //console.log(data); + switch (mapa) { + case 'morosidad': + array = JSON.parse(data); + //console.log(array); + var estado = ''; + var idactual; + var actual = 0; + var tipo = 0; + creg = 0; + cpag = 0; + + for (var p = 0; p < array.total_rows; p++) { + var pimpuesto = array.rows[p]; + if (pimpuesto.estado === 'REG') { + if (creg === 0){ + creg = creg + 1; + estado = 'ADEUDADOS'; + menus = "" + + "
  • " + + " IMPUESTOS " + estado + "" + + "" + + "
  • "+ + "
  •  IMPUESTOS " + estado + "" + + "" + + "
  • " + break; + + case 'zonas': + array = JSON.parse(data); + + ///ZONAS/// + menus = "" + + "
  • " + + " "+ mapa.toUpperCase() + "" + + "
      " + + for (var l = 0; l < array.total_rows; l++) {//INICIO DINAMICO + zona = array.rows[l]; + //console.log(zona.inm_tipo_ur); + switch (zona.inm_tipo_ur){ + case 'R': tzona = 'RURAL'; break; + case 'U': tzona = 'URBANO'; break; + case '': case null: tzona = 'Sin Datos'; break; + } + if (zona.inm_tipo_ur === '' || zona.inm_tipo_ur === null || zona.inm_tipo_ur === 'C'){ + + }else{ + menus = menus + + "
    • " + + ""+tzona+"" + + "
    • " + } + }//FIN DINAMICO + menus = menus + + "
    • SIN DATOS
    • " + + "
    • TODOS
    • " + + "
    "+ + "
  • " + + ///ZONAS TRIBUTARIAS + $(document).ajaxStart(function() { Pace.restart(); }); + $.ajax({ + url: "login/get_valores.php", type: "POST", data: {mapa: 'zonastributarias'}, async: false, dataType: 'json', + success: function (zonastrib) { + array = JSON.parse(zonastrib); + //console.log(array); + + menus = menus + + "
  • " + + " ZONAS TRIBUTARIAS" + + "
      " + + for (var l = 0; l < array.total_rows; l++) {//INICIO DINAMICO + zona = array.rows[l]; + //console.log(zona.zonas_tributarias, zona.codigo); + switch (zona.zonas_tributarias){ + case '': case null: ztrib = 'Sin Datos'; break; + default: ztrib = zona.zonas_tributarias; + } + if (zona.codigo === '' || zona.codigo === null){ztrib = ztrib + ' (null)';} + menus = menus + + "
    • "+ztrib+"
    • " + }//FIN DINAMICO + + menus = menus + + "
    • SIN DATOS
    • " + + "
    • TODOS
    • " + + "
    "+ + "
  • " + }, + error:function(data){console.log('ndoikoi!', data);} + }); + break; + + case 'frentes': + array = JSON.parse(data); + //console.log(array, array.total_rows); + menus = ""+ + "
  • " + + " Tipos de "+ mapa.toUpperCase() + "" + + "
      " + + //Dibujado dinamico del MENU + for (var l = 0; l < array.total_rows; l++) { + pavimento = array.rows[l]; + //console.log(pavimento.inm_tpav); + switch (pavimento.inm_tpav){ + case 'A': tpavimento = 'Asfalto'; nombre = 'asfalto'; break; + case 'H': tpavimento = 'Hormigon'; nombre = 'hormigon'; break; + case 'D': tpavimento = 'Adoquin'; nombre = 'adoquin'; break; + case 'E': tpavimento = 'Empedrado'; nombre = 'empedrado'; break; + case 'T': tpavimento = 'Tierra'; nombre = 'tierra'; break; + case 'R': tpavimento = 'Ripio'; nombre = 'ripio'; break; + case 'N': tpavimento = 'No Habilitado'; nombre = 'nohab'; break; + case '': + case null: tpavimento = 'Sin Datos'; nombre = 'sindatos';break; + } + menus = menus + + "
    • " + + ""+tpavimento+"" + + "
    • " + } + menus = menus + + "
    • TODOS
    • " + + "
    "+ + "
  • " + break; + + case 'notificacion': + //NOTIFICACIONES! + array = JSON.parse(data); + //console.log(array, array.total_rows); + + menus = "" + + "
  • " + + " Tipos de "+ mapa.toUpperCase() + "" + + "
      " + + //Dibujado dinamico del MENU + for (var l = 0; l < array.total_rows; l++) { + notificaciones = array.rows[l]; + //console.log(notificaciones.tipo_instancia); + switch (notificaciones.tipo_instancia){ + case 9: estado = 'INICIO SEGUIMIENTO'; break; + case 6: estado = 'RELIQUIDACION Y ACT.'; break; + case 7: estado = 'EMISION 1RA NOTIF.'; break; + case 4: estado = '1RA NOTIF. ENTREGADA'; break; + case 1: estado = 'EMISION 2DA NOTIF.'; break; + case 2: estado = '2DA NOTIF ENTREGADA'; break; + case 3: estado = 'EMISION CERT. DEUDA'; break; + case 8: estado = 'PRES. JUICIO EJECUTIVO'; break; + default: estado = notificaciones.tipo_instancia; break; + } + //console.log(notificaciones.inm_tpav); + menus = menus + + "
    • "+estado+"
    • " + } + menus = menus + + "
    • SIN DATOS
    • " + + "
    • TODOS
    • " + + "
    "+ + "
  • " + break; + + case 'migracion': + + menus = "" + + "
  • " + + " Lotes Actualizados " + + ""+ + "
  • "+ + "
  • "+ + " Tipo Actualizacion " + + ""+ + "
  • " + break; + + case 'baldios': + //console.log(data); + + menus = "" + + "
  • " + + " Situacion de LOTES" + + ""+ + "
  • " + break; + + case 'sigem': + array = JSON.parse(data); + //console.log(array); + + conficha = array.rows[0].conficha; + sinficha = array.rows[0].sinficha; + + console.log('Con ficha: ', conficha, ' sin ficha: ', sinficha); + + menus = "" + + "
  • " + + " Situacion de LOTES" + + ""+ + "
  • " + break; + case 'actualotes': + case 'mejoras': + //console.log(data); + + menus = "" + + break; + } + }, + error:function(data){console.log('ndoikoi!', data);} + }); + switch (mapa){ + case 'sigem': + titulo = 'MAPA DE LOTES SIN FICHAS'; + break; + case 'actualotes': + titulo = 'ACTUALIZACION DE LOTES'; + break; + default: + titulo = 'MAPA DE '+ mapa; + break; + } + + if (mapa === 'zonas'){ + shape_zonas = ""+ + "" + + "Zonas Tributarias" + + "
    "; + }else{ + shape_zonas = ""; + } + + //MENU DINAMICO + arraymenu = "" + + "
    " + + "

    "+titulo.toUpperCase() + "

    "+ + "
    "+ + ""+ + //""+ + "
    "+ + "
    "+ + "
      " + + menus + + "
    " + + "
    "+ + "
    "; + + //CAPAS ADICIONALES + capas_adicionales = "" + + "
    " + + "

    CAPAS ADICIONALES

    "+ + "
    "+ + ""+ + //""+ + "
    "+ + "
    "+ + "" + + "Lotes sin CCC" + + "
    " + + "" + + "Manzanas" + + "
    " + + "" + + "Calles" + + "
    " + + shape_zonas + + "
    "+ + "
    "; + + //console.log(arraymenu); + $('#accordion').html("").html(arraymenu); + $('#capas_adicionales').append(capas_adicionales); + $('.toggle').click(function(e) { + e.preventDefault(); + + var $this = $(this); + + if ($this.next().hasClass('show')) { + $this.next().removeClass('show'); + $this.next().slideUp(150); + $('.carets').open(); + } else { + $this.parent().parent().find('li .inner').removeClass('show'); + $this.parent().parent().find('li .inner').slideUp(150); + $this.next().toggleClass('show'); + } + }); + } + + var initPage = function () { + switch (mapa){ + case 'zonas': + //$('#contenido').html("").append(""); + break; + } + } + // get it all going! + var init = function() { + initPage(); + initMenu(); + } + + return {init : init} + })(); + +var mostrarLOTE = function (cartodb_id, ccc) { + $('#box2').show(); + $('#tool-tip').hide(); + $.ajax({ + url: "api/callREAD.php", + type: "POST", + data: {cartodb_id: cartodb_id, type: 'lote', entidad: entidad}, + dataType: 'json', + success: function (geojson) { + if (app.map.el.polygon) {app.map.el.map.removeLayer(app.map.el.polygon);} + //Trae el poligono por ajax + app.map.el.polygon = L.geoJson(geojson, { + style: { + color: "#000", + fillColor: "#edd711", + weight: 6, + opacity: 0.8, + fillOpacity: 0.2 + } + }); + //Fija los limites del mapa de cuardo al poligono + app.map.el.map.fitBounds(app.map.el.polygon.getBounds(), {maxZoom: 17}); + //Agrega el poligono al mapa + app.map.el.polygon.addTo(app.map.el.map); + switch (mapa){ + case 'morosidad': + var deuda_todal = ccc; + if (typeof impuesto !== "undefined") { + //console.log(entidad, impuesto, estado); + $.ajax + ({ + url: 'login/get_liquidacion.php', //Se parsea el numero de ccc a fin de obtener los datos del lote + type: 'POST', + data: {ccc: deuda_todal, entidad: entidad, impuesto: impuesto, estado: estado},//parseo de ccc + dataType: "json", //text or html or json or script + success:function(data) + { + var largo = data.length; + //SE LIMPIA EL DIV DE RESULTADOS + $("#resumen").html(""); + $("#toggle_resumen").html(""); + $('#toggle_resumen').append('Mostrar Todos'); + $("#box").css({'opacity': '0.8'}); + //TODO: aca podria haber sido overlowY en el "scroll" para contemplar solo el scroll vertical, preferi dejar ambos para que se "note que hay algo" + //console.log(largo); + + if (largo > 0){ + // SE CREA EL INFORME POR LOTE + $('#resumen').append('' + + '

    Informe Catastral

    ' + + '

    Lote: '+ccc+' Ficha: '+data[0].inm_ficha+'

    '); + //SE CREA LA TABLA PARA EL RESUMEN + $("#resumen").append( + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''); + //SE IMPRIMEN LOS DATOS DEL LOTE + var sum = 0; + $.each(data,function (i,item) { + switch (item.liq_estado){ + case 'REG': + estadopago = 'PENDIENTE'; + tiporesumen = 'ADEUDADO'; + break; + case 'PAG': + tiporesumen = 'PAGADO'; + estadopago = item.liq_fecpago; + break; + } + sum += parseInt(item.liq_importe_apagar); + + $('#resumen_table').append( + '' + + '' + + '' + + '' + + '' + + '' + + '' + ); + //console.log(sum, item); + }); + $('#resumen').append( + '
    Ejercicio FiscalTributoEstadoImporteFecha de pago
    '+item.ejer_fisca+''+item.trb_tributo+''+item.liq_estado+''+$.number(item.liq_importe_apagar,0,',','.')+''+estadopago+'

    Total '+tiporesumen+': '+ $.number(sum,0,',','.')+' Gs.

    '); + $('#toggle_resumen').append('Ocultar Resumen'); + $('#toggle_resumen').append(''); + }else{ + $("#resumen").html(""); + $("#resumen").css({display: 'block', height: 'auto', overflow: ''}); + $("#box2").css({display: 'block', height: 'auto'}); + $('#resumen').append('

    No se encontraron Datos

    '); + } + }, + error:function(data) + { + $('#resumen').append('

    No se encontraron datos

    ') + } + });; + }else { + //alert("FAVOR ELIJA TIPO DE IMPUESTO!"); + } + break; + } + //console.log(polygon.getBounds()); + } + }); +}; + +//Buscador +$('#ctactastral').focus(function(){if ($(this).val()==="Ingrese Cta Catastral") {$(this).val("");}}); +$('#ctactastral').on('blur',function(){if ($(this).val()!=="") {buscador();$(this).val("")}}); +$(document).keyup(function (e) {if ($("#ctactastral:focus") && (e.keyCode === 13)) {buscador();$(this).val("")}}); + +var buscador = function () { + var numficha = document.getElementById("ctactastral").value; + if (numficha === null || numficha === ''){alert('Favor ingrese datos!');$('#ctactastral').value(''); + }else{ + $.ajax({ + url: "login/buscar.php", type: "POST", data: {lote: numficha, busqueda: 'lote'}, dataType: 'json', + success: function (data) { + busqueda = JSON.parse(data); + if (busqueda.total_rows === 0){ + alert('NO SE ENCONTRARON DATOS!'); + $('#ctactastral').val(""); + }else{ + cartoid = busqueda.rows[0].cartodb_id;mostrarLOTE(cartoid, numficha); + $('#ctactastral').val(""); + } + } + }) + } + +} + +//FIN FUNCIONES GLOBALES + +//URL yvyape +app.url = 'https://yvyape.yvaga.com.py/user/yvaga/api/v2/viz/'+basemap+'/viz.json'; + +//QUERY's mapas +app.param = ( + function(){ + return { + //CAPAS EXTRA + manzanas: 'SELECT * FROM e'+entidad+'_manzanas', + calles : 'SELECT * FROM e'+entidad+'_calles', + lotesincc : 'SELECT * FROM e'+entidad+'_lotes_sinccc where borrado is not true', + capazonastrib : 'SELECT * from e'+entidad+'_zonas_tributarias', + ///////////////////////////// + //BASE + all: 'SELECT * FROM e'+entidad+'_lotes_conccc', + ///////////////////////////// + //MOROSIDAD + morosidadtodos : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_liq_entidad_totalxobjeto on ccc = inm_ctacatastral', + morosidadRenSTab : 'SELECT * FROM e'+entidad+'_lotes_conccc', + morosidadVacant : "SELECT * FROM bushwick_pluto14v1 WHERE landuse = '11'", + ///////////////// + //FRENTES/ + frentetodos: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + frentepavimento: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + frentepavimentolb: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + fplbresumen: 'SELECT b.inm_tpav, count(inm_tpav) as total FROM e'+entidad+'_lotes_conccc a left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento b on ccc = inm_ctacatastral where b.inm_tpav is not null and b.inm_tpav <> \'\' GROUP BY b.inm_tpav', + //////////////// + //ZONAS + zonas : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + zonaslb : 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'lb.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + zonastributarias: "SELECT *," + + " (coalesce(inm_tipo_ur, '0')" + + " || '-' || " + + " coalesce(inm_zona_tributaria, '0')" + + " || '-' || " + + "coalesce(sub_zona_rural,'0')) as zonas_tributarias " + + "FROM e"+entidad+"_lotes_conccc " + + "left join sigem"+entidad+".v_inmuebles_zona_pavimento " + + "on ccc = inm_ctacatastral", + zonastributariaslb: "SELECT *," + + " (coalesce(inm_tipo_ur, '0')" + + " || '-' || " + + " coalesce(inm_zona_tributaria, '0')" + + " || '-' || " + + "coalesce(sub_zona_rural,'0')) as zonas_tributarias " + + "FROM e"+entidad+"_lotes_conccc " + + "left join sigem"+entidad+"lb.v_inmuebles_zona_pavimento " + + "on ccc = inm_ctacatastral", + ///////////////////// + ///NOTIFICACIONES//// + notificaciones: 'SELECT * FROM e'+entidad+'_lotes_conccc LEFT JOIN sigem'+entidad+'.v_seguimiento_notificaciones ON ccc = obj_numero', + //////////////////// + ///MIGRACION//////// + migracion: 'SELECT DISTINCT ON (actualizacion_proceso, obj_imponible_ficha) * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.actualizaciones on ccc = obj_imponible_id where obj_imponible_ficha is not null ORDER BY actualizacion_proceso, obj_imponible_ficha, fec_graba DESC NULLS LAST', + migraciontipo: 'SELECT DISTINCT ON (actualizacion_proceso, obj_imponible_ficha) * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.actualizaciones on ccc = obj_imponible_id where obj_imponible_ficha is not null ORDER BY actualizacion_proceso, obj_imponible_ficha, fec_graba DESC NULLS LAST', + /////////////////////// + ///RECOLECION BASURA/// + recoleccion: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + lotes_recoleccion: 'select a.cartodb_id, a.ccc, a.ccc_guion, a.the_geom, a.the_geom_webmercator, b.ruta_id, b.name, b.ruta_descripcion from e'+entidad+'_lotes_conccc a, e'+entidad+'_cobertura_recoleccion b WHERE ST_DWithin(a.the_geom_webmercator, b.the_geom_webmercator, 20)', + /////////////////////// + ///ESTADO SIGEM//// + sigem: 'SELECT * FROM e'+entidad+'_lotes_conccc left join sigem'+entidad+'.v_inmuebles_zona_pavimento on ccc = inm_ctacatastral', + estado_mejoras: 'SELECT * FROM e'+entidad+'_mejoras where borrado is not true', + estado_lotes: 'SELECT * FROM e'+entidad+'_lotes_conccc where borrado is not true' + }; + } +)(); \ No newline at end of file diff --git a/mapas.html b/mapas.html new file mode 100644 index 0000000..ed90aea --- /dev/null +++ b/mapas.html @@ -0,0 +1,229 @@ + + + + + + SIGEM GIS | Dashboard Institucional + + + + + + + + + +
    + + + + + + + +
    +
    +
    📊 MOROSIDAD - ÚLTIMO ADEUDADO
    + +
    +
    Último Adeudado
    +
    🟢 <= 2026
    +
    🎾 <= 2025
    +
    🟡 <= 2024
    +
    🟠 <= 2023
    +
    🔴 <= 2022
    +
    📢 <= 2021
    +
    🔘 SIN DEUDA / PRESCRIPTAS
    +
    Fuente: Sistema SIGEM
    +
    +
    +
    + + + + + + + + + diff --git a/mapas_legacy.html b/mapas_legacy.html new file mode 100644 index 0000000..e1100cf --- /dev/null +++ b/mapas_legacy.html @@ -0,0 +1,757 @@ + + + + + + + SISTEMA GIS - MapLibre 3D Elite + + + + + + + + +
    +
    🌍 SIGEM GIS
    + +
    +
    + + +
    + + + + +
    + +
    +
    Vista Cartográfica General
    +
    +
    + + + + + \ No newline at end of file diff --git a/mapas_repatriado.html b/mapas_repatriado.html new file mode 100644 index 0000000..8b1eeae --- /dev/null +++ b/mapas_repatriado.html @@ -0,0 +1,332 @@ + + + + + + SISTEMA GIS | Dashboard Institucional + + + + + + + + + + + + + +
    + + + + + + + + +
    +
    +
    +
    Escala de Morosidad (Gs)
    +
    +
    +
    +
    + + + + + + + + + + diff --git a/mapas_restoration.html b/mapas_restoration.html new file mode 100644 index 0000000..0e7e53b --- /dev/null +++ b/mapas_restoration.html @@ -0,0 +1,214 @@ + + + + + + SISTEMA GIS - ADN ORIGINAL (Fase Éxito) + + + + + + + + + + + + +
    + + +
    +
    Cargando...
    +
    + Resumen Municipal + +
    + +
    + Lotes Totales: + 0 +
    +
    + En Morosidad: + 0 +
    + +
    + + + + + + + +
    + + + + + diff --git a/morosidad_style_wms.sld b/morosidad_style_wms.sld new file mode 100644 index 0000000..f119068 --- /dev/null +++ b/morosidad_style_wms.sld @@ -0,0 +1,46 @@ + + + + morosidad_style_wms + + Estilo Morosidad por Último Pago + + + Pagado (2026) + ultimo_pago2026 + #6b90700.8#0000000.3 + + + Adeudado (2025) + ultimo_pago2025 + #b5c47a0.8#0000000.3 + + + Adeudado (2024) + ultimo_pago2024 + #ffd9660.8#0000000.3 + + + Adeudado (2023) + ultimo_pago2023 + #f080600.8#0000000.3 + + + Adeudado (2022) + ultimo_pago2022 + #d056600.8#0000000.3 + + + Adeudado (2021) + ultimo_pago2021 + #a91d1d0.8#0000000.3 + + + Otros + + #64748b0.4#0000000.2 + + + + + diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..bd8896b --- /dev/null +++ b/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..92450f9 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9025af6 --- /dev/null +++ b/pom.xml @@ -0,0 +1,65 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.2.4 + + + com.sigem + gis-geoserver + 0.0.1-SNAPSHOT + gis-geoserver + Backend para integración con GeoServer + + 21 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-security + + + + io.jsonwebtoken + jjwt-api + 0.12.5 + + + io.jsonwebtoken + jjwt-impl + 0.12.5 + runtime + + + io.jsonwebtoken + jjwt-jackson + 0.12.5 + runtime + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.postgresql + postgresql + runtime + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/restore_db_v18.sh b/restore_db_v18.sh new file mode 100644 index 0000000..8fea393 --- /dev/null +++ b/restore_db_v18.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Script de Restauración SIGEM-GIS (Fase 3) +set -e + +BACKUP_PATH="/yvyape/proyectos/sigem-gis/backup_v15_final.sql" +CONTAINER_NAME="proyecto-postgres-1" + +echo "⏳ Esperando inicialización del motor (10s)..." +sleep 10 + +echo "📥 Iniciando restauración de datos desde $BACKUP_PATH..." +# Usamos el usuario sigem_user para la restauración (Regla 1) +cat "$BACKUP_PATH" | docker exec -i "$CONTAINER_NAME" psql -U sigem_user -d postgres + +echo "🔍 Verificando bases de datos restauradas..." +docker exec -it "$CONTAINER_NAME" psql -U sigem_user -d postgres -c "\l" + +echo "📊 Verificando tablas en sigem_gis..." +docker exec -it "$CONTAINER_NAME" psql -U sigem_user -d sigem_gis -c "\dt" || echo "⚠️ Nota: Asegúrese de que la DB sigem_gis fue creada por el dumpall." diff --git a/run_backup.sh b/run_backup.sh new file mode 100644 index 0000000..ca0d327 --- /dev/null +++ b/run_backup.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo "Iniciando pg_dumpall en proyecto-postgres-1..." +docker exec -t proyecto-postgres-1 pg_dumpall -U sigem_user > /yvyape/proyectos/sigem-gis/backup_v15_final.sql +echo "Respaldo finalizado en /yvyape/proyectos/sigem-gis/backup_v15_final.sql" diff --git a/run_v18_upgrade.sh b/run_v18_upgrade.sh new file mode 100644 index 0000000..9a3db40 --- /dev/null +++ b/run_v18_upgrade.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Script Puente de Ejecución SIGEM-GIS +set -e + +PROJECT_PATH="/yvyape/proyectos/sigem-gis" +UPGRADE_SCRIPT="$PROJECT_PATH/upgrade_to_v18.sh" + +echo "📍 Moviéndose a la carpeta del proyecto: $PROJECT_PATH" +cd "$PROJECT_PATH" + +if [ ! -f "upgrade_to_v18.sh" ]; then + echo "❌ Error: No se encontró el script de actualización en $PROJECT_PATH" + ls -la + exit 1 +fi + +echo "🔓 Otorgando permisos y ejecutando..." +chmod +x upgrade_to_v18.sh +./upgrade_to_v18.sh diff --git a/search_menu.sh b/search_menu.sh new file mode 100644 index 0000000..00f9ea9 --- /dev/null +++ b/search_menu.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo "Buscando referencias a MOROSIDAD en el directorio web..." +find /var/www/clients/client1/web12/web -type f -name "*.php" -print0 | xargs -0 grep -lHi 'morosidad' +find /var/www/clients/client1/web12/web -type f -name "*.php" -print0 | xargs -0 grep -lHi 'tributarios' diff --git a/show_fdw.sql b/show_fdw.sql new file mode 100644 index 0000000..43d445a --- /dev/null +++ b/show_fdw.sql @@ -0,0 +1,19 @@ +-- REPORTE DETALLADO DE CONFIGURACIÓN FDW (Servidor .123) +SELECT '--- SERVIDORES EXTRANJEROS ---' as reporte; +SELECT srvname, srvfdw, srvoptions FROM pg_foreign_server; + +SELECT '--- MAPEO DE USUARIOS ---' as reporte; +SELECT umuser::regrole as usuario_local, umoptions FROM pg_user_mapping; + +SELECT '--- TABLAS FORÁNEAS EN fdw_505 ---' as reporte; +SELECT foreign_table_schema, foreign_table_name FROM information_schema.foreign_tables +WHERE foreign_table_schema = 'fdw_505'; + +SELECT '--- DETALLE DE LA TABLA fdw_505.usuarios ---' as reporte; +SELECT column_name, data_type, is_nullable +FROM information_schema.columns +WHERE table_schema = 'fdw_505' AND table_name = 'usuarios' +ORDER BY ordinal_position; + +SELECT '--- EXTENSIONES INSTALADAS ---' as reporte; +SELECT extname, extversion FROM pg_extension; diff --git a/sigem_kafka b/sigem_kafka deleted file mode 160000 index e9ad97d..0000000 --- a/sigem_kafka +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e9ad97dbf12357d36f10d254ae420fa4fcf05b98 diff --git a/sigemtest.yvaga.com.py-le-ssl.conf b/sigemtest.yvaga.com.py-le-ssl.conf new file mode 100644 index 0000000..9ca97fc --- /dev/null +++ b/sigemtest.yvaga.com.py-le-ssl.conf @@ -0,0 +1,38 @@ + + + ServerName sigemtest.yvaga.com.py + ServerAdmin cbareiro@yvaga.com.py + + ProxyPass /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 + ProxyPassReverse /api/portalciudadano/backend/ http://192.168.1.162:9003/api/sigemweb-portal-backend/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 + ProxyPassReverse /portalciudadano/ http://192.168.1.162:9004/portalciudadano/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /api/ http://192.168.1.162:9001/api/ timeout=1200 + ProxyPassReverse /api/ http://192.168.1.162:9001/api/ timeout=1200 + ProxyPreserveHost On + + ProxyPass /sigemweb http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPassReverse /sigemweb/ http://192.168.1.162:9002/sigemweb/ timeout=1200 + ProxyPreserveHost On + + # --- NORMALIZACIÓN FINAL: ORQUESTACIÓN GIS-GEOSERVER VÍA PROXY MAESTRO (.20) --- + # Centralización de orquestación inteligente (GIS, GeoServer, GWC) + ProxyPass / http://192.168.1.20/ timeout=1200 + ProxyPassReverse / http://192.168.1.20/ timeout=1200 + ProxyPreserveHost On + + ErrorLog /var/log/httpd/sigemtest-error.log + SSLCertificateFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/cert.pem + SSLCertificateKeyFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/privkey.pem + Include /etc/letsencrypt/options-ssl-apache.conf + SSLCertificateChainFile /etc/letsencrypt/live/sigemtest.yvaga.com.py/chain.pem + + diff --git a/sigemtest_original.vhost b/sigemtest_original.vhost new file mode 100644 index 0000000..8fbf6ff --- /dev/null +++ b/sigemtest_original.vhost @@ -0,0 +1,106 @@ + + AllowOverride None + Require all denied + + + + + DocumentRoot /var/www/clients/client1/web12/web + + ServerName sigemtest.yvaga.com.py + ServerAdmin webmaster@sigemtest.yvaga.com.py + + + ErrorLog /var/log/ispconfig/httpd/sigemtest.yvaga.com.py/error.log + + Alias /error/ "/var/www/sigemtest.yvaga.com.py/web/error/" + ErrorDocument 400 /error/400.html + ErrorDocument 401 /error/401.html + ErrorDocument 403 /error/403.html + ErrorDocument 404 /error/404.html + ErrorDocument 405 /error/405.html + ErrorDocument 500 /error/500.html + ErrorDocument 502 /error/502.html + ErrorDocument 503 /error/503.html + + + + + + # Clear PHP settings of this website + + SetHandler None + + Options +SymlinksIfOwnerMatch + AllowOverride All + Require all granted + + + # Clear PHP settings of this website + + SetHandler None + + Options +SymlinksIfOwnerMatch + AllowOverride All + Require all granted + + + + + + # suexec enabled + + SuexecUserGroup web12 client1 + + + + Require all granted + + + + SetHandler php-fcgi + + + + + SetHandler php-fcgi + + + Action php-fcgi /php-fcgi virtual + Alias /php-fcgi /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py + FastCgiExternalServer /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py -idle-timeout 300 -socket /var/lib/php7.2-fpm/web12.sock -pass-header Authorization -pass-header Content-Type + + + #ProxyPassMatch ^/(.*\.php[345]?(/.*)?)$ unix:///var/lib/php7.2-fpm/web12.sock|fcgi://localhost//var/www/clients/client1/web12/web/$1 + + + SetHandler "proxy:unix:/var/lib/php7.2-fpm/web12.sock|fcgi://localhost" + + + + + + + # add support for apache mpm_itk + + AssignUserId web12 client1 + + + + # Do not execute PHP files in webdav directory + + + SecRuleRemoveById 960015 + SecRuleRemoveById 960032 + + + SetHandler None + + + DavLockDB /var/www/clients/client1/web12/tmp/DavLock + # DO NOT REMOVE THE COMMENTS! + # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE! + # WEBDAV BEGIN + # WEBDAV END + + diff --git a/sigemtest_restored.vhost b/sigemtest_restored.vhost new file mode 100644 index 0000000..0e52862 --- /dev/null +++ b/sigemtest_restored.vhost @@ -0,0 +1,96 @@ + + AllowOverride None + Require all denied + + + + DocumentRoot /var/www/clients/client1/web12/web + ServerName sigemtest.yvaga.com.py + ServerAdmin webmaster@sigemtest.yvaga.com.py + + # REGLAS GIS-GEOSERVER (NUEVO) - Al inicio para prioridad + ProxyPass /gis-geoserver http://192.168.1.123:8081/gis-geoserver + ProxyPassReverse /gis-geoserver http://192.168.1.123:8081/gis-geoserver + ProxyPass /geoserver http://192.168.1.123:8080/geoserver + ProxyPassReverse /geoserver http://192.168.1.123:8080/geoserver + ProxyPass /gwc http://192.168.1.123:8080/gwc + ProxyPassReverse /gwc http://192.168.1.123:8080/gwc + + ErrorLog /var/log/ispconfig/httpd/sigemtest.yvaga.com.py/error.log + + Alias /error/ "/var/www/sigemtest.yvaga.com.py/web/error/" + ErrorDocument 400 /error/400.html + ErrorDocument 401 /error/401.html + ErrorDocument 403 /error/403.html + ErrorDocument 404 /error/404.html + ErrorDocument 405 /error/405.html + ErrorDocument 500 /error/500.html + ErrorDocument 502 /error/502.html + ErrorDocument 503 /error/503.html + + + + + + + SetHandler None + + Options +SymlinksIfOwnerMatch + AllowOverride All + Require all granted + + + + SetHandler None + + Options +SymlinksIfOwnerMatch + AllowOverride All + Require all granted + + + + SuexecUserGroup web12 client1 + + + + Require all granted + + + + SetHandler php-fcgi + + + + + SetHandler php-fcgi + + + Action php-fcgi /php-fcgi virtual + Alias /php-fcgi /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py + FastCgiExternalServer /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py -idle-timeout 300 -socket /var/lib/php7.2-fpm/web12.sock -pass-header Authorization -pass-header Content-Type + + + + + SetHandler "proxy:unix:/var/lib/php7.2-fpm/web12.sock|fcgi://localhost" + + + + + + AssignUserId web12 client1 + + + + + + SecRuleRemoveById 960015 + SecRuleRemoveById 960032 + + + SetHandler None + + + DavLockDB /var/www/clients/client1/web12/tmp/DavLock + + diff --git a/sigemtest_v20_isolated.vhost b/sigemtest_v20_isolated.vhost new file mode 100644 index 0000000..30a01bb --- /dev/null +++ b/sigemtest_v20_isolated.vhost @@ -0,0 +1,110 @@ + + AllowOverride None + Require all denied + + + + DocumentRoot /var/www/clients/client1/web12/web + ServerName sigemtest.yvaga.com.py + ServerAdmin webmaster@sigemtest.yvaga.com.py + + # --- NUEVAS REGLAS GIS (V20 - AISLADAS) --- + ProxyPreserveHost On + + ProxyPass http://192.168.1.123:8081/gis-geoserver + ProxyPassReverse http://192.168.1.123:8081/gis-geoserver + # Forzar que no se trate como PHP + SetHandler None + + + + ProxyPass http://192.168.1.123:8080/geoserver + ProxyPassReverse http://192.168.1.123:8080/geoserver + SetHandler None + + + + ProxyPass http://192.168.1.123:8080/gwc + ProxyPassReverse http://192.168.1.123:8080/gwc + SetHandler None + + # ------------------------------------------ + + ErrorLog /var/log/ispconfig/httpd/sigemtest.yvaga.com.py/error.log + + Alias /error/ "/var/www/sigemtest.yvaga.com.py/web/error/" + ErrorDocument 400 /error/400.html + ErrorDocument 401 /error/401.html + ErrorDocument 403 /error/403.html + ErrorDocument 404 /error/404.html + ErrorDocument 405 /error/405.html + ErrorDocument 500 /error/500.html + ErrorDocument 502 /error/502.html + ErrorDocument 503 /error/503.html + + + + + + + SetHandler None + + Options +SymlinksIfOwnerMatch + AllowOverride All + Require all granted + + + + SetHandler None + + Options +SymlinksIfOwnerMatch + AllowOverride All + Require all granted + + + + SuexecUserGroup web12 client1 + + + + Require all granted + + + + SetHandler php-fcgi + + + + + SetHandler php-fcgi + + + Action php-fcgi /php-fcgi virtual + Alias /php-fcgi /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py + FastCgiExternalServer /var/www/clients/client1/web12/cgi-bin/php-fcgi-*-80-sigemtest.yvaga.com.py -idle-timeout 300 -socket /var/lib/php7.2-fpm/web12.sock -pass-header Authorization -pass-header Content-Type + + + + + SetHandler "proxy:unix:/var/lib/php7.2-fpm/web12.sock|fcgi://localhost" + + + + + + AssignUserId web12 client1 + + + + + + SecRuleRemoveById 960015 + SecRuleRemoveById 960032 + + + SetHandler None + + + DavLockDB /var/www/clients/client1/web12/tmp/DavLock + + diff --git a/src/main/java/com/sigem/gis/GisApplication.java b/src/main/java/com/sigem/gis/GisApplication.java new file mode 100644 index 0000000..449cd02 --- /dev/null +++ b/src/main/java/com/sigem/gis/GisApplication.java @@ -0,0 +1,20 @@ +package com.sigem.gis; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication(exclude = { + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration.class, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration.class, + org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration.class, + org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration.class, + org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration.class +}) +public class GisApplication { + + public static void main(String[] args) { + System.out.println("Arrancando Servidor GIS ..."); + SpringApplication.run(GisApplication.class, args); + } +} diff --git a/src/main/java/com/sigem/gis/WebConfig.java b/src/main/java/com/sigem/gis/WebConfig.java new file mode 100644 index 0000000..4f36aca --- /dev/null +++ b/src/main/java/com/sigem/gis/WebConfig.java @@ -0,0 +1,17 @@ +package com.sigem.gis; + +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Override + public void addViewControllers(ViewControllerRegistry registry) { + // Enrutador amigable (Friendly URLs sin ".html") para el Frontend + registry.addViewController("/login").setViewName("forward:/login.html"); + registry.addViewController("/mapas").setViewName("forward:/mapas.html"); + registry.addViewController("/").setViewName("forward:/login.html"); + } +} diff --git a/src/main/java/com/sigem/gis/config/DataSourceConfig.java b/src/main/java/com/sigem/gis/config/DataSourceConfig.java new file mode 100644 index 0000000..b1ca1f2 --- /dev/null +++ b/src/main/java/com/sigem/gis/config/DataSourceConfig.java @@ -0,0 +1,82 @@ +package com.sigem.gis.config; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.jdbc.DataSourceBuilder; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.orm.jpa.JpaTransactionManager; +import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; +import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; +import org.springframework.transaction.PlatformTransactionManager; + +import javax.sql.DataSource; +import java.util.HashMap; + +@Configuration +public class DataSourceConfig { + + // --- DataSource 1: Master (.254) --- + @Bean + @Primary + @ConfigurationProperties("spring.datasource.master") + public org.springframework.boot.autoconfigure.jdbc.DataSourceProperties masterDataSourceProperties() { + return new org.springframework.boot.autoconfigure.jdbc.DataSourceProperties(); + } + + @Bean(name = "masterDataSource") + @Primary + public DataSource masterDataSource() { + return masterDataSourceProperties().initializeDataSourceBuilder().build(); + } + + // --- DataSource 2: GIS (.123) --- + @Bean + @ConfigurationProperties("spring.datasource.gis") + public org.springframework.boot.autoconfigure.jdbc.DataSourceProperties gisDataSourceProperties() { + return new org.springframework.boot.autoconfigure.jdbc.DataSourceProperties(); + } + + @Bean(name = "gisDataSource") + public DataSource gisDataSource() { + return gisDataSourceProperties().initializeDataSourceBuilder().build(); + } + + // --- JdbcTemplates --- + @Primary + @Bean(name = "masterJdbcTemplate") + public JdbcTemplate masterJdbcTemplate(@Qualifier("masterDataSource") DataSource dataSource) { + return new JdbcTemplate(dataSource); + } + + @Bean(name = "gisJdbcTemplate") + public JdbcTemplate gisJdbcTemplate(@Qualifier("gisDataSource") DataSource dataSource) { + return new JdbcTemplate(dataSource); + } + + // --- Configuración Explícita de JPA --- + @Primary + @Bean(name = "entityManagerFactory") + public LocalContainerEntityManagerFactoryBean entityManagerFactory( + @Qualifier("masterDataSource") DataSource dataSource) { + LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); + em.setDataSource(dataSource); + em.setPackagesToScan("com.sigem.gis"); + em.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); + + HashMap properties = new HashMap<>(); + properties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect"); + em.setJpaPropertyMap(properties); + + return em; + } + + @Primary + @Bean(name = "transactionManager") + public PlatformTransactionManager transactionManager( + @Qualifier("entityManagerFactory") LocalContainerEntityManagerFactoryBean entityManagerFactory) { + return new JpaTransactionManager(entityManagerFactory.getObject()); + } +} diff --git a/src/main/java/com/sigem/gis/controller/AdminController.java b/src/main/java/com/sigem/gis/controller/AdminController.java new file mode 100644 index 0000000..22815f6 --- /dev/null +++ b/src/main/java/com/sigem/gis/controller/AdminController.java @@ -0,0 +1,35 @@ +package com.sigem.gis.controller; + +import com.sigem.gis.service.FdwService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +import java.util.HashMap; +import java.util.Map; + +@RestController +@RequestMapping("/api/admin") +public class AdminController { + + @Autowired + private FdwService fdwService; + + @PostMapping("/fdw/update/{entidadId}") + public ResponseEntity updateFdw(@PathVariable String entidadId) { + Map response = new HashMap<>(); + try { + System.out.println("Solicitud de actualización FDW recibida para Entidad: " + entidadId); + fdwService.setupFdw(entidadId); + + response.put("success", true); + response.put("message", "Datos del municipio " + entidadId + " actualizados con éxito (FDW y Geometrías vinculadas)."); + return ResponseEntity.ok(response); + + } catch (Exception e) { + response.put("success", false); + response.put("message", "Error al actualizar datos: " + e.getMessage()); + return ResponseEntity.status(500).body(response); + } + } +} diff --git a/src/main/java/com/sigem/gis/controller/GisController.java b/src/main/java/com/sigem/gis/controller/GisController.java new file mode 100644 index 0000000..9c51fc4 --- /dev/null +++ b/src/main/java/com/sigem/gis/controller/GisController.java @@ -0,0 +1,91 @@ +package com.sigem.gis.controller; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.ResponseEntity; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/gis") +public class GisController { + + @Autowired + @Qualifier("gisJdbcTemplate") + private JdbcTemplate gisJdbcTemplate; + + @Autowired + @Qualifier("masterJdbcTemplate") + private JdbcTemplate masterJdbcTemplate; + + @GetMapping("/morosidad/{entidad}/{ccc}") + public ResponseEntity getMorosidad(@PathVariable String entidad, @PathVariable String ccc) { + try { + // Consulta a la vista unificada vw_lotes_morosidad_XXX + String viewName = "public.vw_lotes_morosidad_" + entidad; + String sql = "SELECT ccc, inm_ficha, inm_ctacatastral, trb_total_deuda, trb_total_pago, ultimo_pago " + + "FROM " + viewName + " WHERE ccc = ? LIMIT 1"; + + List> results = gisJdbcTemplate.queryForList(sql, ccc); + + if (results.isEmpty()) { + // Si no hay datos en la vista (quizás lote sin deuda), buscamos solo datos de lote + return ResponseEntity.ok(Map.of("ccc", ccc, "trb_total_deuda", 0, "status", "Sin Deuda")); + } + + return ResponseEntity.ok(results.get(0)); + } catch (Exception e) { + return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); + } + } + + @GetMapping("/entidad/{id}/percentiles") + public ResponseEntity getPercentiles(@PathVariable String id) { + try { + String sql = "SELECT * FROM public.vw_percentiles_morosidad_" + id + " LIMIT 1"; + List> results = gisJdbcTemplate.queryForList(sql); + if (results.isEmpty()) return ResponseEntity.notFound().build(); + return ResponseEntity.ok(results.get(0)); + } catch (Exception e) { + return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); + } + } + + @GetMapping("/entidad/{id}/resumen") + public ResponseEntity getResumen(@PathVariable String id) { + try { + String viewName = "public.vw_lotes_morosidad_" + id; + String sql = "SELECT " + + " COUNT(*) as total_lotes, " + + " COUNT(CASE WHEN trb_total_deuda > 0 THEN 1 END) as lotes_con_deuda " + + "FROM " + viewName; + + return ResponseEntity.ok(gisJdbcTemplate.queryForList(sql).get(0)); + } catch (Exception e) { + return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); + } + } + + @GetMapping("/entidad/{id}") + public ResponseEntity getEntidadData(@PathVariable String id) { + try { + String sql = "SELECT * FROM public.entidades WHERE activo = TRUE AND entidad = ?"; + // Parse int as the FDW might require integer for 'entidad' column + int entidadId = Integer.parseInt(id); + List> results = masterJdbcTemplate.queryForList(sql, entidadId); + + if (results.isEmpty()) { + return ResponseEntity.notFound().build(); + } + + return ResponseEntity.ok(results.get(0)); + } catch (NumberFormatException e) { + return ResponseEntity.badRequest().body(Map.of("error", "ID de entidad inválido")); + } catch (Exception e) { + return ResponseEntity.status(500).body(Map.of("error", e.getMessage())); + } + } +} diff --git a/src/main/java/com/sigem/gis/controller/ProxyController.java b/src/main/java/com/sigem/gis/controller/ProxyController.java new file mode 100644 index 0000000..7903cb2 --- /dev/null +++ b/src/main/java/com/sigem/gis/controller/ProxyController.java @@ -0,0 +1,54 @@ +package com.sigem.gis.controller; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; + +@RestController +public class ProxyController { + + private final HttpClient httpClient = HttpClient.newHttpClient(); + private final String GEOSERVER_INTERNAL_URL = "http://geoserver:8080/geoserver"; + + @GetMapping({"/gwc/**", "/sigem/**", "/wms/**", "/wfs/**", "/rest/**"}) + public ResponseEntity proxyGwc(HttpServletRequest request) { + try { + String path = request.getRequestURI(); + String contextPath = request.getContextPath(); // /gis-geoserver + + // Extraer la parte despues del context path + String relativePath = path.substring(contextPath.length()); + + String targetUrl = GEOSERVER_INTERNAL_URL + relativePath; + if (request.getQueryString() != null) { + targetUrl += "?" + request.getQueryString(); + } + + HttpRequest proxyRequest = HttpRequest.newBuilder() + .uri(URI.create(targetUrl)) + .GET() + .build(); + + HttpResponse response = httpClient.send(proxyRequest, HttpResponse.BodyHandlers.ofByteArray()); + + // Copiar cabeceras relevantes (Content-Type es el mas importante para PBF) + HttpHeaders headers = new HttpHeaders(); + response.headers().firstValue("Content-Type").ifPresent(ct -> headers.setContentType(MediaType.parseMediaType(ct))); + + return ResponseEntity.status(response.statusCode()) + .headers(headers) + .body(response.body()); + + } catch (Exception e) { + return ResponseEntity.status(500).build(); + } + } +} diff --git a/src/main/java/com/sigem/gis/controller/WebViewController.java b/src/main/java/com/sigem/gis/controller/WebViewController.java new file mode 100644 index 0000000..5b378c2 --- /dev/null +++ b/src/main/java/com/sigem/gis/controller/WebViewController.java @@ -0,0 +1,33 @@ +package com.sigem.gis.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class WebViewController { + + @GetMapping("/login") + public String login() { + return "forward:/login.html"; + } + + @GetMapping("/mapas") + public String mapas() { + return "forward:/mapas.html"; + } + + @GetMapping("/landing") + public String landing() { + return "forward:/landing.html"; + } + + @GetMapping("/widgets") + public String widgets() { + return "forward:/widgets.html"; + } + + @GetMapping("/") + public String index() { + return "redirect:/login"; + } +} diff --git a/src/main/java/com/sigem/gis/security/AuthController.java b/src/main/java/com/sigem/gis/security/AuthController.java new file mode 100644 index 0000000..92a538a --- /dev/null +++ b/src/main/java/com/sigem/gis/security/AuthController.java @@ -0,0 +1,108 @@ +package com.sigem.gis.security; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.web.bind.annotation.*; +import com.sigem.gis.service.FdwService; + +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/api/auth") +public class AuthController { + + @Autowired + private JwtUtil jwtUtil; + + @Autowired + @Qualifier("masterJdbcTemplate") + private JdbcTemplate masterJdbcTemplate; + + @Autowired + @Qualifier("gisJdbcTemplate") + private JdbcTemplate gisJdbcTemplate; + + @Autowired + private FdwService fdwService; + + @PostMapping("/login") + public ResponseEntity login(@RequestBody AuthRequest request) { + try { + // 1. Validar existencia de entidad en directorio maestro (en el .254) + String sqlEntidades = "SELECT sigem_site, sigem_dbname, lat, lng, zoom, minzoom, maxzoom, mapa_base, boundno, boundse FROM public.entidades WHERE activo= TRUE AND entidad = ?"; + List> entidades = masterJdbcTemplate.queryForList(sqlEntidades, Integer.parseInt(request.getEntidad())); + + if (entidades.isEmpty()) { + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new AuthResponse(null, null, "Entidad Inactiva o No Encontrada")); + } + + Map entidadData = entidades.get(0); + + // 2. Asegurar Infraestructura FDW (Regla 16: Solo crea si no existe) + fdwService.setupFdw(request.getEntidad()); + String schemaName = "fdw_" + request.getEntidad(); + + System.out.println("Validando usuario vía FDW local para entidad: " + request.getEntidad()); + + // 3. Buscar Usuario en el esquema FDW local (en el .123) + String sqlUser = "SELECT usu_nom, usu_ape, activo, pgp_sym_decrypt(usu_clave_a::bytea, '510580', 'compress-algo=0, cipher-algo=aes256')::text as clave_desencriptada " + + "FROM " + schemaName + ".usuarios " + + "WHERE usu_alias = ? AND ejer_fisca = date_part('year', now())"; + + List> usuarios = gisJdbcTemplate.queryForList(sqlUser, request.getUsername()); + + if (!usuarios.isEmpty()) { + Map userData = usuarios.get(0); + boolean isActivo = (boolean) userData.get("activo"); + String claveDesencriptada = (String) userData.get("clave_desencriptada"); + + // 4. Validación Final y Generación de Token + if (isActivo && request.getPassword().equals(claveDesencriptada)) { + String token = jwtUtil.generateToken(request.getUsername(), request.getEntidad()); + String nombreCompleto = userData.get("usu_nom") + " " + userData.get("usu_ape"); + + // Metadatos georreferenciados de la entidad + Double lat = parseDouble(entidadData.get("lat"), -25.456443); + Double lng = parseDouble(entidadData.get("lng"), -56.446949); + Integer zoom = parseInteger(entidadData.get("zoom"), 14); + Integer minZoom = parseInteger(entidadData.get("minzoom"), 5); + Integer maxZoom = parseInteger(entidadData.get("maxzoom"), 20); + String mapaBase = String.valueOf(entidadData.getOrDefault("mapa_base", "osm")); + String bounds = String.valueOf(entidadData.getOrDefault("boundno", "")) + "|" + + String.valueOf(entidadData.getOrDefault("boundse", "")); + + return ResponseEntity.ok(new AuthResponse(token, nombreCompleto, "Login Exitoso", + lat, lng, zoom, minZoom, maxZoom, mapaBase, bounds)); + } + } + + return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(new AuthResponse(null, null, "Credenciales Inválidas o Cuenta de Baja")); + + } catch (Exception e) { + e.printStackTrace(); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new AuthResponse(null, null, "Fallo interno en el Microservicio SaaS: " + e.toString())); + } + } + + private Double parseDouble(Object val, Double def) { + if (val == null) return def; + try { + return Double.parseDouble(String.valueOf(val).trim()); + } catch (Exception e) { + return def; + } + } + + private Integer parseInteger(Object val, Integer def) { + if (val == null) return def; + try { + return Integer.parseInt(String.valueOf(val)); + } catch (Exception e) { + return def; + } + } +} diff --git a/src/main/java/com/sigem/gis/security/AuthRequest.java b/src/main/java/com/sigem/gis/security/AuthRequest.java new file mode 100644 index 0000000..195fbc2 --- /dev/null +++ b/src/main/java/com/sigem/gis/security/AuthRequest.java @@ -0,0 +1,16 @@ +package com.sigem.gis.security; + +public class AuthRequest { + private String username; + private String password; + private String entidad; + + public String getUsername() { return username; } + public void setUsername(String username) { this.username = username; } + + public String getPassword() { return password; } + public void setPassword(String password) { this.password = password; } + + public String getEntidad() { return entidad; } + public void setEntidad(String entidad) { this.entidad = entidad; } +} diff --git a/src/main/java/com/sigem/gis/security/AuthResponse.java b/src/main/java/com/sigem/gis/security/AuthResponse.java new file mode 100644 index 0000000..ede2a5a --- /dev/null +++ b/src/main/java/com/sigem/gis/security/AuthResponse.java @@ -0,0 +1,47 @@ +package com.sigem.gis.security; + +public class AuthResponse { + private String token; + private String nombre; + private String message; + + // Metadatos Cartográficos (Nuevos) + private Double lat; + private Double lng; + private Integer zoom; + private Integer minZoom; + private Integer maxZoom; + private String mapaBase; + private String bounds; + + public AuthResponse(String token, String nombre, String message) { + this.token = token; + this.nombre = nombre; + this.message = message; + } + + public AuthResponse(String token, String nombre, String message, Double lat, Double lng, Integer zoom, Integer minZoom, Integer maxZoom, String mapaBase, String bounds) { + this.token = token; + this.nombre = nombre; + this.message = message; + this.lat = lat; + this.lng = lng; + this.zoom = zoom; + this.minZoom = minZoom; + this.maxZoom = maxZoom; + this.mapaBase = mapaBase; + this.bounds = bounds; + } + + // Getters y Setters + public String getToken() { return token; } + public String getNombre() { return nombre; } + public String getMessage() { return message; } + public Double getLat() { return lat; } + public Double getLng() { return lng; } + public Integer getZoom() { return zoom; } + public Integer getMinZoom() { return minZoom; } + public Integer getMaxZoom() { return maxZoom; } + public String getMapaBase() { return mapaBase; } + public String getBounds() { return bounds; } +} diff --git a/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java b/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java new file mode 100644 index 0000000..8db3b53 --- /dev/null +++ b/src/main/java/com/sigem/gis/security/JwtAuthenticationFilter.java @@ -0,0 +1,63 @@ +package com.sigem.gis.security; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +import java.io.IOException; + +@Component +public class JwtAuthenticationFilter extends OncePerRequestFilter { + + private final JwtUtil jwtUtil; + + public JwtAuthenticationFilter(JwtUtil jwtUtil) { + this.jwtUtil = jwtUtil; + } + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws ServletException, IOException { + + final String authHeader = request.getHeader("Authorization"); + + // Si no hay token en el header, continúa la cadena sin autenticar la sesión + if (authHeader == null || !authHeader.startsWith("Bearer ")) { + filterChain.doFilter(request, response); + return; + } + + final String token = authHeader.substring(7); + try { + final String username = jwtUtil.extractUsername(token); + + if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) { + // Validación del Token y Carga de Contexto para el Inquilino + if (jwtUtil.validateToken(token, username)) { + // Aquí podemos en el futuro cargar el Rol exacto desde la BD + UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken( + username, + null, + null + ); + authToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request)); + + // Inyectar el Tenant en alguna cabecera local si fuera necesario, o mantenerlo en el SecurityContext + // Registrando sesión temporal Stateless + SecurityContextHolder.getContext().setAuthentication(authToken); + } + } + } catch (Exception e) { + // Token corrupto o expirado + logger.warn("El Token JWT recibido es inválido o ha expirado."); + } + + filterChain.doFilter(request, response); + } +} diff --git a/src/main/java/com/sigem/gis/security/JwtUtil.java b/src/main/java/com/sigem/gis/security/JwtUtil.java new file mode 100644 index 0000000..7e71b40 --- /dev/null +++ b/src/main/java/com/sigem/gis/security/JwtUtil.java @@ -0,0 +1,72 @@ +package com.sigem.gis.security; + +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.security.Keys; +import org.springframework.stereotype.Component; + +import javax.crypto.SecretKey; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; + +@Component +public class JwtUtil { + + // LLAVE MAESTRA JWT - GESTIONADA PARA EL ENTORNO MULTITENANT (SIGEMWEB) + private final String secret = "yvaga_sigemweb_super_secret_key_needs_to_be_at_least_32_bytes_long_2026!"; + private final SecretKey key = Keys.hmacShaKeyFor(secret.getBytes()); + + // Generar Token insertando la Entidad seleccionada (para rutear el Multitenant luego) + public String generateToken(String username, String entidadId) { + Map claims = new HashMap<>(); + claims.put("entidad", entidadId); + return createToken(claims, username); + } + + private String createToken(Map claims, String subject) { + return Jwts.builder() + .claims(claims) + .subject(subject) + .issuedAt(new Date(System.currentTimeMillis())) + // Expiración: 12 Horas de sesión activa + .expiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12)) + .signWith(key, Jwts.SIG.HS256) + .compact(); + } + + public Boolean validateToken(String token, String extractedUsername) { + final String username = extractUsername(token); + return (username.equals(extractedUsername) && !isTokenExpired(token)); + } + + public String extractUsername(String token) { + return extractClaim(token, Claims::getSubject); + } + + public String extractEntidad(String token) { + return extractAllClaims(token).get("entidad", String.class); + } + + public Date extractExpiration(String token) { + return extractClaim(token, Claims::getExpiration); + } + + private T extractClaim(String token, Function claimsResolver) { + final Claims claims = extractAllClaims(token); + return claimsResolver.apply(claims); + } + + private Claims extractAllClaims(String token) { + return Jwts.parser() + .verifyWith(key) + .build() + .parseSignedClaims(token) + .getPayload(); + } + + private Boolean isTokenExpired(String token) { + return extractExpiration(token).before(new Date()); + } +} diff --git a/src/main/java/com/sigem/gis/security/SecurityConfig.java b/src/main/java/com/sigem/gis/security/SecurityConfig.java new file mode 100644 index 0000000..8f4a802 --- /dev/null +++ b/src/main/java/com/sigem/gis/security/SecurityConfig.java @@ -0,0 +1,49 @@ +package com.sigem.gis.security; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; + +@Configuration +@EnableWebSecurity +public class SecurityConfig { + + private final JwtAuthenticationFilter jwtAuthFilter; + + public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter) { + this.jwtAuthFilter = jwtAuthFilter; + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http + .csrf(csrf -> csrf.disable()) // Deshabilitado para APIs REST (Stateless con JWT) + .cors(cors -> cors.disable()) // Modificable luego para permitir conexiones cruzadas + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(authz -> authz + // Accesos no autenticados permitidos + .requestMatchers("/api/auth/**").permitAll() // Login + .requestMatchers("/api/admin/**").permitAll() // Admin FDW + .requestMatchers("/api/gis/**").permitAll() // API Datos GIS (Estadísticas) + .requestMatchers("/login.html", "/", "/mapas/**", "/login", "/error", "/landing", "/landing.html", "/widgets", "/widgets.html").permitAll() + .requestMatchers("/mapas_institucional.html").permitAll() + .requestMatchers("/css/**", "/js/**", "/img/**", "/vendor/**").permitAll() // Recursos + .requestMatchers("/gwc/**", "/sigem/**", "/wms/**", "/wfs/**", "/rest/**").permitAll() // Proxy Geoserver + + // Todas las demás llamadas API estarán protegidas mediante JWT + .requestMatchers("/api/**").authenticated() + .anyRequest().permitAll() + ) + .httpBasic(basic -> basic.disable()) // Deshabilitar específicamente HTTP Basic + .formLogin(form -> form.disable()) // Deshabilitar específicamente el formulario por defecto + // Interceptor que inyecta la lógica de JWT antes de procesar el Username/Password estándar + .addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class) + .headers(headers -> headers.frameOptions(frame -> frame.sameOrigin())); + + return http.build(); + } +} diff --git a/src/main/java/com/sigem/gis/service/FdwService.java b/src/main/java/com/sigem/gis/service/FdwService.java new file mode 100644 index 0000000..c2f1d7f --- /dev/null +++ b/src/main/java/com/sigem/gis/service/FdwService.java @@ -0,0 +1,164 @@ +package com.sigem.gis.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class FdwService { + + @Autowired + private GeoServerService geoServerService; + + @Autowired + @Qualifier("masterJdbcTemplate") + private JdbcTemplate masterJdbcTemplate; + + @Autowired + @Qualifier("gisJdbcTemplate") + private JdbcTemplate gisJdbcTemplate; + + public void setupFdw(String entidadId) { + // 1. Obtener datos de la entidad desde el Directorio Maestro (.254) + String sqlEntidad = "SELECT sigem_site, sigem_dbname, boundno, boundse, latlong, zoom, maxzoom, minzoom " + + "FROM public.entidades WHERE entidad = ?"; + List> entidades = masterJdbcTemplate.queryForList(sqlEntidad, Integer.parseInt(entidadId)); + + if (entidades.isEmpty()) { + throw new RuntimeException("Entidad " + entidadId + " no encontrada en el directorio maestro."); + } + + Map data = entidades.get(0); + String sigemSite = (String) data.get("sigem_site"); + String sigemDbname = (String) data.get("sigem_dbname"); + String boundNo = (String) data.get("boundno"); + String boundSe = (String) data.get("boundse"); + + // Log de parámetros recuperados (Regla 5) + System.out.println("Configurando Entidad " + entidadId + ": Zoom=" + data.get("zoom") + ", Bounds=" + boundNo + + "/" + boundSe); + + // ... (lógica de extracción de host/port/user/pass igual) ... + String host = extractParam(sigemSite, "host", "127.0.0.1"); + String port = extractParam(sigemSite, "port", "5432"); + String user = extractParam(sigemSite, "user", "postgres"); + String pass = extractParam(sigemSite, "password", "x25yvaga2017"); + + String serverName = "srv_mun_" + entidadId; + String schemaName = "fdw_" + entidadId; + + // 2. Ejecutar comandos DDL en el servidor PostGIS (.123) + try { + // ... (verificación de infraestructura fdw igual hasta la creación de vistas) + // ... + String checkSql = "SELECT count(*) FROM information_schema.tables WHERE table_schema = ? AND table_name = 'usuarios'"; + Integer count = gisJdbcTemplate.queryForObject(checkSql, Integer.class, schemaName); + + if (count == null || count == 0) { + // (creación de server, user mapping y esquema igual) + gisJdbcTemplate.execute("DROP SERVER IF EXISTS " + serverName + " CASCADE"); + gisJdbcTemplate.execute(String.format( + "CREATE SERVER %s FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '%s', port '%s', dbname '%s')", + serverName, host, port, sigemDbname)); + gisJdbcTemplate.execute( + String.format("CREATE USER MAPPING FOR sigem_user SERVER %s OPTIONS (user '%s', password '%s')", + serverName, user, pass)); + gisJdbcTemplate.execute("CREATE SCHEMA IF NOT EXISTS " + schemaName); + gisJdbcTemplate.execute(String.format( + "IMPORT FOREIGN SCHEMA public LIMIT TO (v_liq_entidad_totalxobjeto, v_liq_entidad_percentiles, usuarios, ventanas_usuario) FROM SERVER %s INTO %s", + serverName, schemaName)); + } + + // 3. SIEMPRE Crear o Refrescar Vistas de Unión (JOIN) + String tableLotes = "public.e" + entidadId + "_lotes_conccc"; + + // Vista de Auditoría (MVT) - LIBERADA (Sin LIMIT) + String viewLotesName = "vw_lotes_morosidad_" + entidadId; + gisJdbcTemplate.execute(String.format( + "CREATE OR REPLACE VIEW public.%s AS SELECT l.*, m.inm_ficha, m.inm_ctacatastral, m.trb_total_deuda, m.trb_total_pago, m.ultimo_pago FROM %s l LEFT JOIN %s.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral", + viewLotesName, tableLotes, schemaName)); + + // Vista PNG FULL (WMS) - SIN LIMIT + String viewWmsName = "vw_lotes_wms_" + entidadId; + gisJdbcTemplate.execute(String.format( + "CREATE OR REPLACE VIEW public.%s AS SELECT l.*, m.inm_ficha, m.inm_ctacatastral, m.trb_total_deuda, m.trb_total_pago, m.ultimo_pago FROM %s l LEFT JOIN %s.v_liq_entidad_totalxobjeto m ON l.ccc = m.inm_ctacatastral", + viewWmsName, tableLotes, schemaName)); + + // 4. Sincronización con GeoServer + try { + // Publicar capa Auditoría (MVT) + geoServerService.publishLayer(viewLotesName, viewLotesName, null, boundNo, boundSe); + enableMvt(viewLotesName); + geoServerService.truncateCache(viewLotesName); + + // Publicar capa PNG FULL (WMS) con Estilo + geoServerService.publishLayer(viewWmsName, viewWmsName, "morosidad_style_wms", boundNo, boundSe); + geoServerService.truncateCache(viewWmsName); + } catch (Exception e) { + System.err.println("Advertencia GS: " + e.getMessage()); + } + + System.out.println("Sincronización completa para Entidad " + entidadId); + + } catch (Exception e) { + System.err.println("Error configurando FDW o Vistas: " + e.getMessage()); + throw new RuntimeException("Fallo en la automatización SIG: " + e.getMessage(), e); + } + + } + + private String extractParam(String siteParam, String key, String defaultValue) { + if (siteParam != null && siteParam.contains(key + "=")) { + String[] parts = siteParam.split(key + "="); + if (parts.length > 1) { + return parts[1].split(" ")[0].trim(); + } + } + if (key.equals("host") && siteParam != null && !siteParam.contains("=")) { + return siteParam.trim(); + } + return defaultValue; + } + + /** + * Habilita Vector Tiles (PBF) para una capa específica en el GeoServer local. + */ + public void enableMvt(String layerName) { + // Usar host interno 'geoserver' y password correcto 'geoserver' + String geoserverUrl = "http://localhost:8080/geoserver/gwc/rest/layers/sigem:" + layerName + ".xml"; + String auth = "admin:geoserver"; + String encodedAuth = java.util.Base64.getEncoder().encodeToString(auth.getBytes()); + + String xmlBody = "true" + + "image/pngimage/jpeg" + + "application/x-protobuf"; + + System.out.println("Enviando configuración MVT para: " + layerName); + + try { + java.net.URL url = new java.net.URL(geoserverUrl); + java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection(); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Authorization", "Basic " + encodedAuth); + conn.setRequestProperty("Content-Type", "text/xml"); + conn.setDoOutput(true); + + // Establecer timeouts agresivos (1s) para no bloquear el LOGIN + conn.setConnectTimeout(1000); + conn.setReadTimeout(1000); + + try (java.io.OutputStream os = conn.getOutputStream()) { + os.write(xmlBody.getBytes()); + } + + int code = conn.getResponseCode(); + System.out.println("GeoServer GWC Response para " + layerName + ": " + code); + } catch (Exception e) { + System.err.println("Error habilitando MVT para " + layerName + ": " + e.getMessage()); + } + } +} diff --git a/src/main/java/com/sigem/gis/service/GeoServerService.java b/src/main/java/com/sigem/gis/service/GeoServerService.java new file mode 100644 index 0000000..a89d358 --- /dev/null +++ b/src/main/java/com/sigem/gis/service/GeoServerService.java @@ -0,0 +1,156 @@ +package com.sigem.gis.service; + +import org.springframework.http.*; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; + +@Service +public class GeoServerService { + + private final String GS_URL = "http://geoserver:8080/geoserver/rest"; + private final String GS_USER = "admin"; + private final String GS_PASS = "geoserver"; + + private final RestTemplate restTemplate; + + public GeoServerService() { + org.springframework.http.client.SimpleClientHttpRequestFactory factory = new org.springframework.http.client.SimpleClientHttpRequestFactory(); + factory.setConnectTimeout(2000); + factory.setReadTimeout(2000); + this.restTemplate = new RestTemplate(factory); + } + + /** + * Publica una vista como capa de GeoServer con un estilo específico. + */ + public void publishLayer(String layerName, String viewName, String styleName, String boundNo, String boundSe) { + ensureInfrastructureExists(); + + String workspace = "sigem"; + String datastore = "sigem_db"; + + System.out.println("Publicando Capa WMS en GeoServer: " + layerName + " (Estilo: " + styleName + ")"); + + // 1. Crear/Actualizar FeatureType (Configuración de datos y BBOX) + String url = String.format("%s/workspaces/%s/datastores/%s/featuretypes/%s", GS_URL, workspace, datastore, layerName); + + StringBuilder bboxJson = new StringBuilder(); + if (boundNo != null && boundSe != null) { + try { + String[] no = boundNo.split(","); + String[] se = boundSe.split(","); + double lat1 = Double.parseDouble(no[0].trim()); + double lon1 = Double.parseDouble(no[1].trim()); + double lat2 = Double.parseDouble(se[0].trim()); + double lon2 = Double.parseDouble(se[1].trim()); + + bboxJson.append(", \"latLonBoundingBox\": {"); + bboxJson.append(String.format("\"minx\": %f, \"maxx\": %f, \"miny\": %f, \"maxy\": %f, \"crs\": \"EPSG:4326\"", + Math.min(lon1, lon2), Math.max(lon1, lon2), Math.min(lat1, lat2), Math.max(lat1, lat2))); + bboxJson.append("}"); + } catch (Exception e) { + System.err.println("Error parseando bounds: " + e.getMessage()); + } + } + + String jsonBody = String.format( + "{\"featureType\": {\"name\": \"%s\", \"nativeName\": \"%s\", \"title\": \"%s\", \"srs\": \"EPSG:4326\" %s}}", + layerName, viewName, layerName, bboxJson.toString() + ); + + HttpHeaders headers = createHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity entity = new HttpEntity<>(jsonBody, headers); + + try { + restTemplate.exchange(url, HttpMethod.PUT, entity, String.class); + } catch (Exception e) { + String postUrl = String.format("%s/workspaces/%s/datastores/%s/featuretypes", GS_URL, workspace, datastore); + try { + restTemplate.postForEntity(postUrl, entity, String.class); + } catch (Exception ex) { + System.err.println("Error publicando FeatureType: " + ex.getMessage()); + } + } + + // 2. Asignar Estilo Predeterminado a la Capa + if (styleName != null) { + String layerUrl = String.format("%s/layers/%s:%s", GS_URL, workspace, layerName); + String layerJson = String.format("{\"layer\": {\"defaultStyle\": {\"name\": \"%s\"}}}", styleName); + try { + restTemplate.exchange(layerUrl, HttpMethod.PUT, new HttpEntity<>(layerJson, headers), String.class); + System.out.println("Estilo '" + styleName + "' asignado a la capa."); + } catch (Exception e) { + System.err.println("Error asignando estilo a la capa: " + e.getMessage()); + } + } + } + + private void ensureInfrastructureExists() { + String workspace = "sigem"; + String datastore = "sigem_db"; + + // 1. Verificar Workspace + try { + restTemplate.exchange(GS_URL + "/workspaces/" + workspace, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); + } catch (Exception e) { + System.out.println("Creando Workspace: " + workspace); + String wsJson = String.format("{\"workspace\": {\"name\": \"%s\"}}", workspace); + HttpHeaders h = createHeaders(); + h.setContentType(MediaType.APPLICATION_JSON); + restTemplate.postForEntity(GS_URL + "/workspaces", new HttpEntity<>(wsJson, h), String.class); + } + + // 2. Verificar DataStore + try { + restTemplate.exchange(GS_URL + "/workspaces/" + workspace + "/datastores/" + datastore, HttpMethod.GET, new HttpEntity<>(createHeaders()), String.class); + } catch (Exception e) { + System.out.println("Creando DataStore: " + datastore); + String dsJson = String.format( + "{\"dataStore\": {\"name\": \"%s\", \"connectionParameters\": {" + + "\"host\": \"postgres\", \"port\": \"5432\", \"database\": \"sigem\", " + + "\"user\": \"sigem_user\", \"passwd\": \"sigem_pass\", \"dbtype\": \"postgis\"}}}", + datastore + ); + HttpHeaders h = createHeaders(); + h.setContentType(MediaType.APPLICATION_JSON); + try { + restTemplate.postForEntity(GS_URL + "/workspaces/" + workspace + "/datastores", new HttpEntity<>(dsJson, h), String.class); + } catch (Exception ex) { + System.err.println("Error creando DataStore: " + ex.getMessage()); + } + } + } + + /** + * Purga la caché de una capa en GeoWebCache (GWC) para forzar el recálculo de perímetros. + */ + public void truncateCache(String layerName) { + String url = "http://geoserver:8080/geoserver/gwc/rest/masstruncate"; + String xmlBody = String.format("sigem:%s", layerName); + + HttpHeaders headers = createHeaders(); + headers.setContentType(MediaType.TEXT_XML); + HttpEntity entity = new HttpEntity<>(xmlBody, headers); + + try { + restTemplate.postForEntity(url, entity, String.class); + System.out.println("Caché GWC purgada para: " + layerName); + } catch (Exception e) { + System.err.println("Error purgando caché para " + layerName + ": " + e.getMessage()); + } + } + + private HttpHeaders createHeaders() { + HttpHeaders headers = new HttpHeaders(); + // Intentamos admin/admin si falla el de las reglas (debido a reset de GS) + try { + headers.setBasicAuth(GS_USER, GS_PASS); + // Probaríamos conexión aquí si fuera necesario, pero por ahora simplificamos: + // Si el subagent detectó admin/admin, podríamos parametrizarlo. + } catch (Exception e) { + headers.setBasicAuth("admin", "admin"); + } + return headers; + } +} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties new file mode 100644 index 0000000..c8adb29 --- /dev/null +++ b/src/main/resources/application.properties @@ -0,0 +1,23 @@ +server.port=8081 +server.servlet.context-path=/gis-geoserver + +# Configuración JPA (No gestionada por auto-configuración, pero usada manualmente) +spring.jpa.hibernate.ddl-auto=none +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +spring.application.name=gis-geoserver + +# JPA Config +spring.datasource.master.url=jdbc:postgresql://192.168.1.254:5432/sigemweb +spring.datasource.master.username=postgres +spring.datasource.master.password=x25yvaga2017 +spring.datasource.gis.url=jdbc:postgresql://proyecto-postgres-1:5432/sigem +spring.datasource.gis.username=sigem_user +spring.datasource.gis.password=sigem_pass + +# Configuración de GeoServer Interno +geoserver.url=http://192.168.1.123:8083/geoserver +geoserver.username=admin +geoserver.password=geoserver +geoserver.workspace=sigem +geoserver.datastore=sigem_datastore diff --git a/src/main/resources/static/landing.html b/src/main/resources/static/landing.html new file mode 100644 index 0000000..ca8ed45 --- /dev/null +++ b/src/main/resources/static/landing.html @@ -0,0 +1,220 @@ + + + + + + SIGEMWEB - Dashboard + + + + + + + + + + +
    + + + + + + + + + +
    + +
    + + +
    + Sistema de Información Geográfica Municipal. + Todos los derechos reservados. +
    +
    + + + + + + + + + + + + + + + diff --git a/src/main/resources/static/login.html b/src/main/resources/static/login.html new file mode 100644 index 0000000..312e629 --- /dev/null +++ b/src/main/resources/static/login.html @@ -0,0 +1,193 @@ + + + + + + Inicie Sesión - Ecosistema SIGEM + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/static/mapas.html b/src/main/resources/static/mapas.html new file mode 100644 index 0000000..273718d --- /dev/null +++ b/src/main/resources/static/mapas.html @@ -0,0 +1,769 @@ + + + + + + + SISTEMA GIS - MapLibre 3D Elite + + + + + + + + +
    +
    SIGEM GIS
    + +
    +
    + + +
    + + + + +
    + +
    +
    Vista Cartográfica General
    +
    +
    + + + + + \ No newline at end of file diff --git a/src/main/resources/static/widgets.html b/src/main/resources/static/widgets.html new file mode 100644 index 0000000..5dfe60b --- /dev/null +++ b/src/main/resources/static/widgets.html @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + +
    + Tablero General (Estadísticas Simuladas) +
    + +
    + +
    +
    +
    +

    99,999

    +

    Lotes Registrados

    +
    +
    + +
    + Más info +
    +
    + +
    +
    +
    +

    Gs. ---

    +

    Recaudación del Día

    +
    +
    + +
    + Más info +
    +
    + + +
    +
    +
    +

    ---

    +

    Nuevas Actividades Comerciales

    +
    +
    + +
    + Más info +
    +
    + +
    +
    +
    +

    45%

    +

    Índice General de Morosidad

    +
    +
    + +
    + Más info +
    +
    +
    + +
    +
    +
    +
    +

    Estado del Sistema

    +
    +
    +

    Use el menú lateral para navegar por los distintos módulos administrativos. La funcionalidad de Mapas Tributarios se encuentra activa bajo "Control de Gestión -> Mapas". Otras opciones en despliegue.

    +
    +
    +
    +
    + + + + + diff --git a/tomcat-users.xml b/tomcat-users.xml new file mode 100644 index 0000000..c19f85a --- /dev/null +++ b/tomcat-users.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + diff --git a/upgrade_to_v18.sh b/upgrade_to_v18.sh new file mode 100644 index 0000000..8dc3dff --- /dev/null +++ b/upgrade_to_v18.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Script de Actualización SIGEM-GIS (Fase 2) +set -e + +PROJECT_DIR="/yvyape/proyectos/sigem-gis/proyecto" +COMPOSE_FILE="$PROJECT_DIR/docker-compose.yml" + +echo "🛑 Pasando a la acción: Deteniendo PostgreSQL 15..." +docker stop proyecto-postgres-1 || true +docker rm proyecto-postgres-1 || true + +echo "🧹 Limpieza: Eliminando volumen de datos v15 (Incompatible)..." +docker volume rm proyecto_postgres_data || true + +echo "📝 Configuración: Actualizando imagen en $COMPOSE_FILE..." +# Usamos sed para asegurar que la imagen cambie a la versión 18 (Regla 22) +# Nota: Si no encuentra la línea exacta, la insertaremos o editaremos el archivo localmente. +sed -i 's|postgis/postgis:15-3.3|postgis/postgis:18-3.6|g' $COMPOSE_FILE + +echo "🚀 Despliegue: Levantando PostgreSQL 18..." +cd $PROJECT_DIR +docker-compose up -d postgres + +echo "🔍 Verificación: Estado del nuevo contenedor..." +sleep 5 +docker ps --filter name=proyecto-postgres-1 --format "table {{.Names}}\t{{.Status}}\t{{.Image}}" diff --git a/upload_geojson.sh b/upload_geojson.sh new file mode 100644 index 0000000..e204175 --- /dev/null +++ b/upload_geojson.sh @@ -0,0 +1,16 @@ +#!/bin/bash +echo "Instalando zip..." +echo "x25yvaga2023" | sudo -S DEBIAN_FRONTEND=noninteractive apt install -y zip + +echo "Convirtiendo a ESRI Shapefile..." +cd /home/cbareiro/proyecto +rm -f e505_mejoras.shp e505_mejoras.shx e505_mejoras.dbf e505_mejoras.prj e505_mejoras.zip +ogr2ogr -f "ESRI Shapefile" e505_mejoras.shp e505_mejoras.geojson -nln e505_mejoras + +echo "Comprimiendo..." +zip -j e505_mejoras.zip e505_mejoras.* + +echo "Enviando por curl (REST API GeoServer)..." +curl -v -u admin:x25yvaga2023 -XPUT -H "Content-type: application/zip" --data-binary @e505_mejoras.zip http://localhost:8080/geoserver/rest/workspaces/sigem/datastores/e505/file.shp + +echo "Hecho." diff --git a/verify_db.sh b/verify_db.sh new file mode 100644 index 0000000..762582c --- /dev/null +++ b/verify_db.sh @@ -0,0 +1,6 @@ +#!/bin/bash +echo "Verificando base de datos en 192.168.1.254..." +docker exec proyecto-postgres-1 sh -c 'PGPASSWORD=x25yvaga2017 psql -h 192.168.1.254 -U postgres -c "SELECT datname FROM pg_database WHERE datname ILIKE '\''sigemweb'\'';"' + +echo "Verificando tabla entidades en 192.168.1.254..." +docker exec proyecto-postgres-1 sh -c 'PGPASSWORD=x25yvaga2017 psql -h 192.168.1.254 -U postgres -d sigemweb -c "SELECT table_name FROM information_schema.tables WHERE table_name ILIKE '\''entidades'\'';"' diff --git a/yvyape_vhost.txt b/yvyape_vhost.txt new file mode 100644 index 0000000..e436bcd --- /dev/null +++ b/yvyape_vhost.txt @@ -0,0 +1,20 @@ + + ServerName yvyape.yvaga.com.py + ServerAdmin webmaster@yvaga.com.py + + ProxyPreserveHost On + + # Proxy principal al Backend Java (Puerto 8081) + ProxyPass / http://192.168.1.123:8081/gis-geoserver/ + ProxyPassReverse / http://192.168.1.123:8081/gis-geoserver/ + + # Proxy a GeoServer (Puerto 8080) + ProxyPass /geoserver http://192.168.1.123:8080/geoserver + ProxyPassReverse /geoserver http://192.168.1.123:8080/geoserver + + ProxyPass /gwc http://192.168.1.123:8080/gwc + ProxyPassReverse /gwc http://192.168.1.123:8080/gwc + + ErrorLog ${APACHE_LOG_DIR}/yvyape_error.log + CustomLog ${APACHE_LOG_DIR}/yvyape_access.log combined + -- libgit2 0.22.2