| @ -0,0 +1,15 @@ | |||||
| Thumbs.db | |||||
| .DS_Store | |||||
| .gradle | |||||
| build/ | |||||
| target/ | |||||
| out/ | |||||
| .micronaut/ | |||||
| .idea | |||||
| *.iml | |||||
| *.ipr | |||||
| *.iws | |||||
| .project | |||||
| .settings | |||||
| .classpath | |||||
| .factorypath | |||||
| @ -0,0 +1,3 @@ | |||||
| { | |||||
| "java.configuration.updateBuildConfiguration": "interactive" | |||||
| } | |||||
| @ -0,0 +1,31 @@ | |||||
| ## Micronaut 4.8.3 Documentation | |||||
| - [User Guide](https://docs.micronaut.io/4.8.3/guide/index.html) | |||||
| - [API Reference](https://docs.micronaut.io/4.8.3/api/index.html) | |||||
| - [Configuration Reference](https://docs.micronaut.io/4.8.3/guide/configurationreference.html) | |||||
| - [Micronaut Guides](https://guides.micronaut.io/index.html) | |||||
| --- | |||||
| - [Shadow Gradle Plugin](https://gradleup.com/shadow/) | |||||
| - [Micronaut Gradle Plugin documentation](https://micronaut-projects.github.io/micronaut-gradle-plugin/latest/) | |||||
| - [GraalVM Gradle Plugin documentation](https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html) | |||||
| ## Feature validation documentation | |||||
| - [Micronaut Validation documentation](https://micronaut-projects.github.io/micronaut-validation/latest/guide/) | |||||
| ## Feature test-resources documentation | |||||
| - [Micronaut Test Resources documentation](https://micronaut-projects.github.io/micronaut-test-resources/latest/guide/) | |||||
| ## Feature micronaut-aot documentation | |||||
| - [Micronaut AOT documentation](https://micronaut-projects.github.io/micronaut-aot/latest/guide/) | |||||
| ## Feature jdbc-hikari documentation | |||||
| - [Micronaut Hikari JDBC Connection Pool documentation](https://micronaut-projects.github.io/micronaut-sql/latest/guide/index.html#jdbc) | |||||
| @ -0,0 +1,83 @@ | |||||
| plugins { | |||||
| id("io.micronaut.application") version "4.5.3" | |||||
| id("com.gradleup.shadow") version "8.3.6" | |||||
| id("io.micronaut.test-resources") version "4.5.3" | |||||
| id("io.micronaut.aot") version "4.5.3" | |||||
| } | |||||
| version = "0.1" | |||||
| group = "jumapacelaya.gob.mx" | |||||
| repositories { | |||||
| mavenCentral() | |||||
| flatDir { | |||||
| dirs 'libs' | |||||
| } | |||||
| } | |||||
| dependencies { | |||||
| implementation("io.micronaut.sql:micronaut-jdbc") | |||||
| annotationProcessor("io.micronaut:micronaut-http-validation") | |||||
| annotationProcessor("io.micronaut.validation:micronaut-validation-processor") | |||||
| implementation("io.micronaut:micronaut-jackson-databind") | |||||
| implementation("io.micronaut.sql:micronaut-jdbc-hikari") | |||||
| implementation("io.micronaut.validation:micronaut-validation") | |||||
| implementation("jakarta.validation:jakarta.validation-api") | |||||
| compileOnly("io.micronaut:micronaut-http-client") | |||||
| runtimeOnly("ch.qos.logback:logback-classic") | |||||
| runtimeOnly("com.oracle.database.jdbc:ojdbc11") | |||||
| //runtimeOnly("com.oracle.database.jdbc:ojdbc8:19.3.0.0") | |||||
| implementation("io.micronaut.data:micronaut-data-jdbc") | |||||
| testImplementation("io.micronaut:micronaut-http-client") | |||||
| runtimeOnly("org.yaml:snakeyaml") | |||||
| implementation("jakarta.persistence:jakarta.persistence-api:3.1.0") | |||||
| implementation("io.micronaut.data:micronaut-data-processor") | |||||
| annotationProcessor("io.micronaut.data:micronaut-data-processor") | |||||
| implementation("io.micronaut.data:micronaut-data-jpa") | |||||
| implementation("io.micronaut.data:micronaut-data-hibernate-jpa") | |||||
| } | |||||
| application { | |||||
| mainClass = "jumapacelaya.gob.mx.Application" | |||||
| } | |||||
| java { | |||||
| sourceCompatibility = JavaVersion.toVersion("21") | |||||
| targetCompatibility = JavaVersion.toVersion("21") | |||||
| } | |||||
| graalvmNative.toolchainDetection = false | |||||
| micronaut { | |||||
| runtime("netty") | |||||
| testRuntime("junit5") | |||||
| processing { | |||||
| incremental(true) | |||||
| annotations("jumapacelaya.gob.mx.*") | |||||
| } | |||||
| testResources { | |||||
| enabled = false | |||||
| //additionalModules.add("jdbc-oracle-free") | |||||
| } | |||||
| aot { | |||||
| // Please review carefully the optimizations enabled below | |||||
| // Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details | |||||
| optimizeServiceLoading = false | |||||
| convertYamlToJava = false | |||||
| precomputeOperations = true | |||||
| cacheEnvironment = true | |||||
| optimizeClassLoading = true | |||||
| deduceEnvironment = true | |||||
| optimizeNetty = true | |||||
| replaceLogbackXml = true | |||||
| } | |||||
| } | |||||
| tasks.named("dockerfileNative") { | |||||
| jdkVersion = "21" | |||||
| } | |||||
| @ -0,0 +1 @@ | |||||
| micronautVersion=4.8.3 | |||||
| @ -0,0 +1,7 @@ | |||||
| distributionBase=GRADLE_USER_HOME | |||||
| distributionPath=wrapper/dists | |||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip | |||||
| networkTimeout=10000 | |||||
| validateDistributionUrl=true | |||||
| zipStoreBase=GRADLE_USER_HOME | |||||
| zipStorePath=wrapper/dists | |||||
| @ -0,0 +1,251 @@ | |||||
| #!/bin/sh | |||||
| # | |||||
| # Copyright © 2015-2021 the original authors. | |||||
| # | |||||
| # Licensed 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 | |||||
| # | |||||
| # https://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. | |||||
| # | |||||
| # SPDX-License-Identifier: Apache-2.0 | |||||
| # | |||||
| ############################################################################## | |||||
| # | |||||
| # Gradle start up script for POSIX generated by Gradle. | |||||
| # | |||||
| # Important for running: | |||||
| # | |||||
| # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is | |||||
| # noncompliant, but you have some other compliant shell such as ksh or | |||||
| # bash, then to run this script, type that shell name before the whole | |||||
| # command line, like: | |||||
| # | |||||
| # ksh Gradle | |||||
| # | |||||
| # Busybox and similar reduced shells will NOT work, because this script | |||||
| # requires all of these POSIX shell features: | |||||
| # * functions; | |||||
| # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», | |||||
| # «${var#prefix}», «${var%suffix}», and «$( cmd )»; | |||||
| # * compound commands having a testable exit status, especially «case»; | |||||
| # * various built-in commands including «command», «set», and «ulimit». | |||||
| # | |||||
| # Important for patching: | |||||
| # | |||||
| # (2) This script targets any POSIX shell, so it avoids extensions provided | |||||
| # by Bash, Ksh, etc; in particular arrays are avoided. | |||||
| # | |||||
| # The "traditional" practice of packing multiple parameters into a | |||||
| # space-separated string is a well documented source of bugs and security | |||||
| # problems, so this is (mostly) avoided, by progressively accumulating | |||||
| # options in "$@", and eventually passing that to Java. | |||||
| # | |||||
| # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, | |||||
| # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; | |||||
| # see the in-line comments for details. | |||||
| # | |||||
| # There are tweaks for specific operating systems such as AIX, CygWin, | |||||
| # Darwin, MinGW, and NonStop. | |||||
| # | |||||
| # (3) This script is generated from the Groovy template | |||||
| # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt | |||||
| # within the Gradle project. | |||||
| # | |||||
| # You can find Gradle at https://github.com/gradle/gradle/. | |||||
| # | |||||
| ############################################################################## | |||||
| # Attempt to set APP_HOME | |||||
| # Resolve links: $0 may be a link | |||||
| app_path=$0 | |||||
| # Need this for daisy-chained symlinks. | |||||
| while | |||||
| APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path | |||||
| [ -h "$app_path" ] | |||||
| do | |||||
| ls=$( ls -ld "$app_path" ) | |||||
| link=${ls#*' -> '} | |||||
| case $link in #( | |||||
| /*) app_path=$link ;; #( | |||||
| *) app_path=$APP_HOME$link ;; | |||||
| esac | |||||
| done | |||||
| # This is normally unused | |||||
| # shellcheck disable=SC2034 | |||||
| APP_BASE_NAME=${0##*/} | |||||
| # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) | |||||
| APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit | |||||
| # Use the maximum available, or set MAX_FD != -1 to use that value. | |||||
| MAX_FD=maximum | |||||
| warn () { | |||||
| echo "$*" | |||||
| } >&2 | |||||
| die () { | |||||
| echo | |||||
| echo "$*" | |||||
| echo | |||||
| exit 1 | |||||
| } >&2 | |||||
| # OS specific support (must be 'true' or 'false'). | |||||
| cygwin=false | |||||
| msys=false | |||||
| darwin=false | |||||
| nonstop=false | |||||
| case "$( uname )" in #( | |||||
| CYGWIN* ) cygwin=true ;; #( | |||||
| Darwin* ) darwin=true ;; #( | |||||
| MSYS* | MINGW* ) msys=true ;; #( | |||||
| NONSTOP* ) nonstop=true ;; | |||||
| esac | |||||
| CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | |||||
| # Determine the Java command to use to start the JVM. | |||||
| 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 | |||||
| else | |||||
| JAVACMD=$JAVA_HOME/bin/java | |||||
| fi | |||||
| if [ ! -x "$JAVACMD" ] ; then | |||||
| die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | |||||
| Please set the JAVA_HOME variable in your environment to match the | |||||
| location of your Java installation." | |||||
| fi | |||||
| else | |||||
| JAVACMD=java | |||||
| if ! command -v java >/dev/null 2>&1 | |||||
| then | |||||
| die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | |||||
| Please set the JAVA_HOME variable in your environment to match the | |||||
| location of your Java installation." | |||||
| fi | |||||
| fi | |||||
| # Increase the maximum file descriptors if we can. | |||||
| if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then | |||||
| case $MAX_FD in #( | |||||
| max*) | |||||
| # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. | |||||
| # shellcheck disable=SC2039,SC3045 | |||||
| MAX_FD=$( ulimit -H -n ) || | |||||
| warn "Could not query maximum file descriptor limit" | |||||
| esac | |||||
| case $MAX_FD in #( | |||||
| '' | soft) :;; #( | |||||
| *) | |||||
| # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. | |||||
| # shellcheck disable=SC2039,SC3045 | |||||
| ulimit -n "$MAX_FD" || | |||||
| warn "Could not set maximum file descriptor limit to $MAX_FD" | |||||
| esac | |||||
| fi | |||||
| # Collect all arguments for the java command, stacking in reverse order: | |||||
| # * args from the command line | |||||
| # * the main class name | |||||
| # * -classpath | |||||
| # * -D...appname settings | |||||
| # * --module-path (only if needed) | |||||
| # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. | |||||
| # For Cygwin or MSYS, switch paths to Windows format before running java | |||||
| if "$cygwin" || "$msys" ; then | |||||
| APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) | |||||
| CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) | |||||
| JAVACMD=$( cygpath --unix "$JAVACMD" ) | |||||
| # Now convert the arguments - kludge to limit ourselves to /bin/sh | |||||
| for arg do | |||||
| if | |||||
| case $arg in #( | |||||
| -*) false ;; # don't mess with options #( | |||||
| /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath | |||||
| [ -e "$t" ] ;; #( | |||||
| *) false ;; | |||||
| esac | |||||
| then | |||||
| arg=$( cygpath --path --ignore --mixed "$arg" ) | |||||
| fi | |||||
| # Roll the args list around exactly as many times as the number of | |||||
| # args, so each arg winds up back in the position where it started, but | |||||
| # possibly modified. | |||||
| # | |||||
| # NB: a `for` loop captures its iteration list before it begins, so | |||||
| # changing the positional parameters here affects neither the number of | |||||
| # iterations, nor the values presented in `arg`. | |||||
| shift # remove old arg | |||||
| set -- "$@" "$arg" # push replacement arg | |||||
| done | |||||
| fi | |||||
| # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |||||
| DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' | |||||
| # Collect all arguments for the java command: | |||||
| # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, | |||||
| # and any embedded shellness will be escaped. | |||||
| # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be | |||||
| # treated as '${Hostname}' itself on the command line. | |||||
| set -- \ | |||||
| "-Dorg.gradle.appname=$APP_BASE_NAME" \ | |||||
| -classpath "$CLASSPATH" \ | |||||
| org.gradle.wrapper.GradleWrapperMain \ | |||||
| "$@" | |||||
| # Stop when "xargs" is not available. | |||||
| if ! command -v xargs >/dev/null 2>&1 | |||||
| then | |||||
| die "xargs is not available" | |||||
| fi | |||||
| # Use "xargs" to parse quoted args. | |||||
| # | |||||
| # With -n1 it outputs one arg per line, with the quotes and backslashes removed. | |||||
| # | |||||
| # In Bash we could simply go: | |||||
| # | |||||
| # readarray ARGS < <( xargs -n1 <<<"$var" ) && | |||||
| # set -- "${ARGS[@]}" "$@" | |||||
| # | |||||
| # but POSIX shell has neither arrays nor command substitution, so instead we | |||||
| # post-process each arg (as a line of input to sed) to backslash-escape any | |||||
| # character that might be a shell metacharacter, then use eval to reverse | |||||
| # that process (while maintaining the separation between arguments), and wrap | |||||
| # the whole thing up as a single "set" statement. | |||||
| # | |||||
| # This will of course break if any of these variables contains a newline or | |||||
| # an unmatched quote. | |||||
| # | |||||
| eval "set -- $( | |||||
| printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | | |||||
| xargs -n1 | | |||||
| sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | | |||||
| tr '\n' ' ' | |||||
| )" '"$@"' | |||||
| exec "$JAVACMD" "$@" | |||||
| @ -0,0 +1,94 @@ | |||||
| @rem | |||||
| @rem Copyright 2015 the original author or authors. | |||||
| @rem | |||||
| @rem Licensed under the Apache License, Version 2.0 (the "License"); | |||||
| @rem you may not use this file except in compliance with the License. | |||||
| @rem You may obtain a copy of the License at | |||||
| @rem | |||||
| @rem https://www.apache.org/licenses/LICENSE-2.0 | |||||
| @rem | |||||
| @rem Unless required by applicable law or agreed to in writing, software | |||||
| @rem distributed under the License is distributed on an "AS IS" BASIS, | |||||
| @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| @rem See the License for the specific language governing permissions and | |||||
| @rem limitations under the License. | |||||
| @rem | |||||
| @rem SPDX-License-Identifier: Apache-2.0 | |||||
| @rem | |||||
| @if "%DEBUG%"=="" @echo off | |||||
| @rem ########################################################################## | |||||
| @rem | |||||
| @rem Gradle startup script for Windows | |||||
| @rem | |||||
| @rem ########################################################################## | |||||
| @rem Set local scope for the variables with windows NT shell | |||||
| if "%OS%"=="Windows_NT" setlocal | |||||
| set DIRNAME=%~dp0 | |||||
| if "%DIRNAME%"=="" set DIRNAME=. | |||||
| @rem This is normally unused | |||||
| set APP_BASE_NAME=%~n0 | |||||
| set APP_HOME=%DIRNAME% | |||||
| @rem Resolve any "." and ".." in APP_HOME to make it shorter. | |||||
| for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi | |||||
| @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | |||||
| set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | |||||
| @rem Find java.exe | |||||
| if defined JAVA_HOME goto findJavaFromJavaHome | |||||
| set JAVA_EXE=java.exe | |||||
| %JAVA_EXE% -version >NUL 2>&1 | |||||
| if %ERRORLEVEL% equ 0 goto execute | |||||
| echo. 1>&2 | |||||
| echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 | |||||
| echo. 1>&2 | |||||
| echo Please set the JAVA_HOME variable in your environment to match the 1>&2 | |||||
| echo location of your Java installation. 1>&2 | |||||
| goto fail | |||||
| :findJavaFromJavaHome | |||||
| set JAVA_HOME=%JAVA_HOME:"=% | |||||
| set JAVA_EXE=%JAVA_HOME%/bin/java.exe | |||||
| if exist "%JAVA_EXE%" goto execute | |||||
| echo. 1>&2 | |||||
| echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 | |||||
| echo. 1>&2 | |||||
| echo Please set the JAVA_HOME variable in your environment to match the 1>&2 | |||||
| echo location of your Java installation. 1>&2 | |||||
| goto fail | |||||
| :execute | |||||
| @rem Setup the command line | |||||
| set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | |||||
| @rem Execute Gradle | |||||
| "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* | |||||
| :end | |||||
| @rem End local scope for the variables with windows NT shell | |||||
| if %ERRORLEVEL% equ 0 goto mainEnd | |||||
| :fail | |||||
| rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | |||||
| rem the _cmd.exe /c_ return code! | |||||
| set EXIT_CODE=%ERRORLEVEL% | |||||
| if %EXIT_CODE% equ 0 set EXIT_CODE=1 | |||||
| if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% | |||||
| exit /b %EXIT_CODE% | |||||
| :mainEnd | |||||
| if "%OS%"=="Windows_NT" endlocal | |||||
| :omega | |||||
| @ -0,0 +1,6 @@ | |||||
| applicationType: default | |||||
| defaultPackage: jumapacelaya.gob.mx | |||||
| testFramework: junit | |||||
| sourceLanguage: java | |||||
| buildTool: gradle | |||||
| features: [app-name, gradle, http-client-test, jackson-databind, java, java-application, jdbc-hikari, junit, logback, micronaut-aot, micronaut-build, micronaut-http-validation, netty-server, oracle, properties, readme, shade, static-resources, test-resources, validation] | |||||
| @ -0,0 +1,4 @@ | |||||
| rootProject.name="API_ePay_Micronaut" | |||||
| @ -0,0 +1,10 @@ | |||||
| package jumapacelaya.gob.mx; | |||||
| import io.micronaut.runtime.Micronaut; | |||||
| public class Application { | |||||
| public static void main(String[] args) { | |||||
| Micronaut.run(Application.class, args); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,12 @@ | |||||
| package jumapacelaya.gob.mx.controller; | |||||
| import io.micronaut.http.annotation.*; | |||||
| @Controller("/ping") | |||||
| public class PingController { | |||||
| @Get("/") | |||||
| public String ping() { | |||||
| return "pong"; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,47 @@ | |||||
| package jumapacelaya.gob.mx.predios.controlador; | |||||
| import java.util.Collections; | |||||
| import java.util.Map; | |||||
| import java.util.Optional; | |||||
| import io.micronaut.http.HttpResponse; | |||||
| import io.micronaut.http.annotation.Controller; | |||||
| import io.micronaut.http.annotation.Get; | |||||
| import io.micronaut.http.annotation.PathVariable; | |||||
| import jumapacelaya.gob.mx.predios.servicio.PredioServicio; | |||||
| import jumapacelaya.gob.mx.predios.dto.PredioDTO; | |||||
| @Controller("/predios") | |||||
| public class PredioControlador { | |||||
| private final PredioServicio predioServicio; | |||||
| public PredioControlador(PredioServicio predioServicio) { | |||||
| this.predioServicio = predioServicio; | |||||
| } | |||||
| @Get("/{id}") | |||||
| public PredioDTO obtenerPredio(Long id) { | |||||
| return predioServicio.obtenerPredio(id); | |||||
| } | |||||
| @Get("/var/{id}") | |||||
| public HttpResponse<?> obtenerPredioVar(@PathVariable Long id) { | |||||
| Optional<PredioDTO> predio = predioServicio.obtenerPredioVar(id); | |||||
| if (predio.isPresent()) { | |||||
| return HttpResponse.ok(predio.get()); | |||||
| } else { | |||||
| return HttpResponse.notFound(Collections.singletonMap("message", "Predio no encontrado")); | |||||
| } | |||||
| } | |||||
| @Get("/atm/{referencia}") | |||||
| public HttpResponse<?> getPredioATM(@PathVariable String referencia) { | |||||
| return predioServicio.obtenerPredioATM(referencia) | |||||
| .<HttpResponse<?>>map(HttpResponse::ok) | |||||
| .orElse(HttpResponse.notFound( | |||||
| Map.of("message", "Predio no encontrado para referencia: " + referencia) | |||||
| )); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| package jumapacelaya.gob.mx.predios.convertidor; | |||||
| import io.micronaut.core.convert.TypeConverter; | |||||
| import io.micronaut.core.convert.ConversionContext; | |||||
| import jakarta.inject.Singleton; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Optional; | |||||
| @Singleton | |||||
| public class BigDecimalToDoubleConverter implements TypeConverter<BigDecimal, Double> { | |||||
| @Override | |||||
| public Optional<Double> convert(BigDecimal object, Class<Double> targetType, ConversionContext context) { | |||||
| return Optional.ofNullable(object != null ? object.doubleValue() : null); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| package jumapacelaya.gob.mx.predios.convertidor; | |||||
| import io.micronaut.core.convert.TypeConverter; | |||||
| import io.micronaut.core.convert.ConversionContext; | |||||
| import jakarta.inject.Singleton; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Optional; | |||||
| @Singleton | |||||
| public class BigDecimalToIntegerConverter implements TypeConverter<BigDecimal, Integer> { | |||||
| @Override | |||||
| public Optional<Integer> convert(BigDecimal object, Class<Integer> targetType, ConversionContext context) { | |||||
| return Optional.ofNullable(object != null ? object.intValue() : null); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,16 @@ | |||||
| package jumapacelaya.gob.mx.predios.convertidor; | |||||
| import io.micronaut.core.convert.TypeConverter; | |||||
| import io.micronaut.core.convert.ConversionContext; | |||||
| import jakarta.inject.Singleton; | |||||
| import java.math.BigDecimal; | |||||
| import java.util.Optional; | |||||
| @Singleton | |||||
| public class BigDecimalToLongConverter implements TypeConverter<BigDecimal, Long> { | |||||
| @Override | |||||
| public Optional<Long> convert(BigDecimal object, Class<Long> targetType, ConversionContext context) { | |||||
| return Optional.ofNullable(object != null ? object.longValue() : null); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,135 @@ | |||||
| package jumapacelaya.gob.mx.predios.dto; | |||||
| import io.micronaut.core.annotation.Introspected; | |||||
| @Introspected | |||||
| public class PredioDTO { | |||||
| private Long predioId; | |||||
| private Long clienteId; | |||||
| private String contrato; | |||||
| private String nombreCliente; | |||||
| private String direccion; | |||||
| private String direccionMostrar; | |||||
| private String direccionCorta; | |||||
| private String telefono; | |||||
| private Double coordX; | |||||
| private Double coordY; | |||||
| private String zonaFactId; | |||||
| private String serialMedidor; | |||||
| private String marcaMedidor; | |||||
| private String modeloMedidor; | |||||
| private String estadoPredioId; | |||||
| private String estadoPredio; | |||||
| private String usoId; | |||||
| private String uso; | |||||
| private Integer actividadId; | |||||
| private String actividad; | |||||
| private Double adeudoCortes; | |||||
| // Constructor consulta predio | |||||
| public PredioDTO(Long predioId, Long clienteId, String contrato, String nombreCliente, | |||||
| String direccion, String direccionMostrar, String direccionCorta, String telefono, | |||||
| Double coordX, Double coordY, String zonaFactId, String serialMedidor, | |||||
| String marcaMedidor, String modeloMedidor, String estadoPredioId, | |||||
| String estadoPredio, String usoId, String uso, Integer actividadId, | |||||
| String actividad) { | |||||
| this(predioId, clienteId, contrato, nombreCliente, direccion, direccionMostrar, direccionCorta, | |||||
| telefono, coordX, coordY, zonaFactId, serialMedidor, marcaMedidor, modeloMedidor, | |||||
| estadoPredioId, estadoPredio, usoId, uso, actividadId, actividad, null); | |||||
| } | |||||
| // Constructor completo (para restPredioVar) | |||||
| public PredioDTO(Long predioId, Long clienteId, String contrato, String nombreCliente, | |||||
| String direccion, String direccionMostrar, String direccionCorta, String telefono, | |||||
| Double coordX, Double coordY, String zonaFactId, String serialMedidor, | |||||
| String marcaMedidor, String modeloMedidor, String estadoPredioId, | |||||
| String estadoPredio, String usoId, String uso, Integer actividadId, | |||||
| String actividad, Double adeudoCortes) { | |||||
| this.predioId = predioId; | |||||
| this.clienteId = clienteId; | |||||
| this.contrato = contrato; | |||||
| this.nombreCliente = nombreCliente; | |||||
| this.direccion = direccion; | |||||
| this.direccionMostrar = direccionMostrar; | |||||
| this.direccionCorta = direccionCorta; | |||||
| this.telefono = telefono; | |||||
| this.coordX = coordX; | |||||
| this.coordY = coordY; | |||||
| this.zonaFactId = zonaFactId; | |||||
| this.serialMedidor = serialMedidor; | |||||
| this.marcaMedidor = marcaMedidor; | |||||
| this.modeloMedidor = modeloMedidor; | |||||
| this.estadoPredioId = estadoPredioId; | |||||
| this.estadoPredio = estadoPredio; | |||||
| this.usoId = usoId; | |||||
| this.uso = uso; | |||||
| this.actividadId = actividadId; | |||||
| this.actividad = actividad; | |||||
| this.adeudoCortes = adeudoCortes; | |||||
| } | |||||
| // Getters y setters | |||||
| public Long getPredioId() { return predioId; } | |||||
| public void setPredioId(Long predioId) { this.predioId = predioId; } | |||||
| public Long getClienteId() { return clienteId; } | |||||
| public void setClienteId(Long clienteId) { this.clienteId = clienteId; } | |||||
| public String getContrato() { return contrato; } | |||||
| public void setContrato(String contrato) { this.contrato = contrato; } | |||||
| public String getNombreCliente() { return nombreCliente; } | |||||
| public void setNombreCliente(String nombreCliente) { this.nombreCliente = nombreCliente; } | |||||
| public String getDireccion() { return direccion; } | |||||
| public void setDireccion(String direccion) { this.direccion = direccion; } | |||||
| public String getDireccionMostrar() { return direccionMostrar; } | |||||
| public void setDireccionMostrar(String direccionMostrar) { this.direccionMostrar = direccionMostrar; } | |||||
| public String getDireccionCorta() { return direccionCorta; } | |||||
| public void setDireccionCorta(String direccionCorta) { this.direccionCorta = direccionCorta; } | |||||
| public String getTelefono() { return telefono; } | |||||
| public void setTelefono(String telefono) { this.telefono = telefono; } | |||||
| public Double getCoordX() { return coordX; } | |||||
| public void setCoordX(Double coordX) { this.coordX = coordX; } | |||||
| public Double getCoordY() { return coordY; } | |||||
| public void setCoordY(Double coordY) { this.coordY = coordY; } | |||||
| public String getZonaFactId() { return zonaFactId; } | |||||
| public void setZonaFactId(String zonaFactId) { this.zonaFactId = zonaFactId; } | |||||
| public String getSerialMedidor() { return serialMedidor; } | |||||
| public void setSerialMedidor(String serialMedidor) { this.serialMedidor = serialMedidor; } | |||||
| public String getMarcaMedidor() { return marcaMedidor; } | |||||
| public void setMarcaMedidor(String marcaMedidor) { this.marcaMedidor = marcaMedidor; } | |||||
| public String getModeloMedidor() { return modeloMedidor; } | |||||
| public void setModeloMedidor(String modeloMedidor) { this.modeloMedidor = modeloMedidor; } | |||||
| public String getEstadoPredioId() { return estadoPredioId; } | |||||
| public void setEstadoPredioId(String estadoPredioId) { this.estadoPredioId = estadoPredioId; } | |||||
| public String getEstadoPredio() { return estadoPredio; } | |||||
| public void setEstadoPredio(String estadoPredio) { this.estadoPredio = estadoPredio; } | |||||
| public String getUsoId() { return usoId; } | |||||
| public void setUsoId(String usoId) { this.usoId = usoId; } | |||||
| public String getUso() { return uso; } | |||||
| public void setUso(String uso) { this.uso = uso; } | |||||
| public Integer getActividadId() { return actividadId; } | |||||
| public void setActividadId(Integer actividadId) { this.actividadId = actividadId; } | |||||
| public String getActividad() { return actividad; } | |||||
| public void setActividad(String actividad) { this.actividad = actividad; } | |||||
| public Double getAdeudoCortes() { return adeudoCortes; } | |||||
| public void setAdeudoCortes(Double adeudoCortes) { this.adeudoCortes = adeudoCortes; } | |||||
| } | |||||
| @ -0,0 +1,133 @@ | |||||
| package jumapacelaya.gob.mx.predios.entidad; | |||||
| import io.micronaut.core.annotation.Introspected; | |||||
| import jakarta.persistence.*; | |||||
| @Introspected | |||||
| @Entity | |||||
| @Table(name = "PREDIOS") | |||||
| public class Predio { | |||||
| @Id | |||||
| @Column(name = "PREDIOID") | |||||
| private Long predioId; | |||||
| @Column(name = "CLIENTEID") | |||||
| private Long clienteId; | |||||
| @Column(name = "CONTRATO") | |||||
| private String contrato; | |||||
| @Column(name = "COORDX") | |||||
| private Double coordX; | |||||
| @Column(name = "COORDY") | |||||
| private Double coordY; | |||||
| @Column(name = "ZONAFACTID") | |||||
| private String zonaFactId; | |||||
| @Column(name = "SERIALMED") | |||||
| private String serialMed; | |||||
| @Column(name = "EDOPREDIOID") | |||||
| private String edoPredioId; | |||||
| @Column(name = "USOID") | |||||
| private String usoId; | |||||
| @Column(name = "ACTIVIDADID") | |||||
| private Integer actividadId; | |||||
| @Column(name = "DIRECID") | |||||
| private Long direcId; | |||||
| // Getters y setters | |||||
| public Long getPredioId() { | |||||
| return predioId; | |||||
| } | |||||
| public void setPredioId(Long predioId) { | |||||
| this.predioId = predioId; | |||||
| } | |||||
| public Long getClienteId() { | |||||
| return clienteId; | |||||
| } | |||||
| public void setClienteId(Long clienteId) { | |||||
| this.clienteId = clienteId; | |||||
| } | |||||
| public String getContrato() { | |||||
| return contrato; | |||||
| } | |||||
| public void setContrato(String contrato) { | |||||
| this.contrato = contrato; | |||||
| } | |||||
| public Double getCoordX() { | |||||
| return coordX; | |||||
| } | |||||
| public void setCoordX(Double coordX) { | |||||
| this.coordX = coordX; | |||||
| } | |||||
| public Double getCoordY() { | |||||
| return coordY; | |||||
| } | |||||
| public void setCoordY(Double coordY) { | |||||
| this.coordY = coordY; | |||||
| } | |||||
| public String getZonaFactId() { | |||||
| return zonaFactId; | |||||
| } | |||||
| public void setZonaFactId(String zonaFactId) { | |||||
| this.zonaFactId = zonaFactId; | |||||
| } | |||||
| public String getSerialMed() { | |||||
| return serialMed; | |||||
| } | |||||
| public void setSerialMed(String serialMed) { | |||||
| this.serialMed = serialMed; | |||||
| } | |||||
| public String getEdoPredioId() { | |||||
| return edoPredioId; | |||||
| } | |||||
| public void setEdoPredioId(String edoPredioId) { | |||||
| this.edoPredioId = edoPredioId; | |||||
| } | |||||
| public String getUsoId() { | |||||
| return usoId; | |||||
| } | |||||
| public void setUsoId(String usoId) { | |||||
| this.usoId = usoId; | |||||
| } | |||||
| public Integer getActividadId() { | |||||
| return actividadId; | |||||
| } | |||||
| public void setActividadId(Integer actividadId) { | |||||
| this.actividadId = actividadId; | |||||
| } | |||||
| public Long getDirecId() { | |||||
| return direcId; | |||||
| } | |||||
| public void setDirecId(Long direcId) { | |||||
| this.direcId = direcId; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,32 @@ | |||||
| package jumapacelaya.gob.mx.predios.repositorio; | |||||
| import io.micronaut.data.annotation.Repository; | |||||
| import io.micronaut.data.jdbc.annotation.JdbcRepository; | |||||
| import io.micronaut.data.model.query.builder.sql.Dialect; | |||||
| import io.micronaut.data.repository.CrudRepository; | |||||
| import jumapacelaya.gob.mx.predios.entidad.Predio; | |||||
| import jumapacelaya.gob.mx.predios.dto.PredioDTO; | |||||
| import java.util.List; | |||||
| import io.micronaut.data.annotation.Id; | |||||
| import io.micronaut.data.annotation.Query; | |||||
| @JdbcRepository(dialect = Dialect.ORACLE) | |||||
| public interface PredioRepositorio extends CrudRepository<Predio, Long> { | |||||
| /*@Query("Select predioid, clienteid, contrato, c.nombre nomcliente, " + | |||||
| "fn_getdomicilio(p.direcid) direccion, fn_get_direccion(p.direcid) direccionmostrar, fn_direccionshort(p.direcid) direccioncorta, " + | |||||
| "fn_gettelefono(clienteid) telefono, " + | |||||
| "p.coordx, p.coordy, p.zonafactid, p.serialmed, marcamedid||'-'||ma.descripcion marcamed, (decode(mo.descripcion,null,'Desconocido',modelomedid||'-'||mo.descripcion)) modelomed, " + | |||||
| "edopredioid, e.nombre edopredio, usoid, u.nombre uso, actividadid, a.nombre actividad " + | |||||
| "from predios p " + | |||||
| "left join clientes c using (clienteid) " + | |||||
| "left join estadospredio e using(edopredioid) " + | |||||
| "left join usos u using (usoid) " + | |||||
| "left join actividades a using (usoid, actividadid) " + | |||||
| "left join marcasmedidor ma using(marcamedid) " + | |||||
| "left join modelosmedidor mo using(marcamedid, modelomedid) " + | |||||
| "where predioid = :id") | |||||
| Object[] findPredioById(@Id Long id);*/ | |||||
| } | |||||
| @ -0,0 +1,243 @@ | |||||
| package jumapacelaya.gob.mx.predios.servicio; | |||||
| import io.micronaut.transaction.annotation.ReadOnly; | |||||
| import io.micronaut.transaction.annotation.Transactional; | |||||
| import jakarta.inject.Singleton; | |||||
| import javax.sql.DataSource; | |||||
| import java.sql.Connection; | |||||
| import java.sql.PreparedStatement; | |||||
| import java.sql.ResultSet; | |||||
| import java.sql.SQLException; | |||||
| import java.util.Optional; | |||||
| import jumapacelaya.gob.mx.predios.dto.PredioDTO; | |||||
| @Singleton | |||||
| public class PredioServicio { | |||||
| private final DataSource dataSource; | |||||
| public PredioServicio(DataSource dataSource) { | |||||
| this.dataSource = dataSource; | |||||
| } | |||||
| @ReadOnly | |||||
| public PredioDTO obtenerPredio(Long predioId) { | |||||
| String query = "SELECT predioid, clienteid, contrato, c.nombre nomcliente, " + | |||||
| "fn_getdomicilio(p.direcid) direccion, fn_get_direccion(p.direcid) direccionmostrar, " + | |||||
| "fn_direccionshort(p.direcid) direccioncorta, fn_gettelefono(clienteid) telefono, " + | |||||
| "p.coordx, p.coordy, p.zonafactid, p.serialmed, " + | |||||
| "marcamedid||'-'||ma.descripcion marcamed, " + | |||||
| "(decode(mo.descripcion,null,'Desconocido',modelomedid||'-'||mo.descripcion)) modelomed, " + | |||||
| "edopredioid, e.nombre edopredio, usoid, u.nombre uso, actividadid, a.nombre actividad " + | |||||
| "FROM predios p " + | |||||
| "LEFT JOIN clientes c USING (clienteid) " + | |||||
| "LEFT JOIN estadospredio e USING(edopredioid) " + | |||||
| "LEFT JOIN usos u USING (usoid) " + | |||||
| "LEFT JOIN actividades a USING (usoid, actividadid) " + | |||||
| "LEFT JOIN marcasmedidor ma USING(marcamedid) " + | |||||
| "LEFT JOIN modelosmedidor mo USING(marcamedid, modelomedid) " + | |||||
| "WHERE predioid = ?"; | |||||
| try (Connection connection = dataSource.getConnection(); | |||||
| PreparedStatement stmt = connection.prepareStatement(query)) { | |||||
| stmt.setLong(1, predioId); | |||||
| try (ResultSet rs = stmt.executeQuery()) { | |||||
| if (rs.next()) { | |||||
| return new PredioDTO( | |||||
| rs.getLong("predioid"), | |||||
| rs.getLong("clienteid"), | |||||
| rs.getString("contrato"), | |||||
| rs.getString("nomcliente"), | |||||
| rs.getString("direccion"), | |||||
| rs.getString("direccionmostrar"), | |||||
| rs.getString("direccioncorta"), | |||||
| rs.getString("telefono"), | |||||
| rs.getDouble("coordx"), | |||||
| rs.getDouble("coordy"), | |||||
| rs.getString("zonafactid"), | |||||
| rs.getString("serialmed"), | |||||
| rs.getString("marcamed"), | |||||
| rs.getString("modelomed"), | |||||
| rs.getString("edopredioid"), | |||||
| rs.getString("edopredio"), | |||||
| rs.getString("usoid"), | |||||
| rs.getString("uso"), | |||||
| rs.getInt("actividadid"), | |||||
| rs.getString("actividad") | |||||
| ); | |||||
| } else { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| } catch (SQLException e) { | |||||
| throw new RuntimeException("Error al consultar predio: " + e.getMessage(), e); | |||||
| } | |||||
| } | |||||
| @ReadOnly | |||||
| public Optional<PredioDTO> obtenerPredioVar(Long predioId) { | |||||
| String query = """ | |||||
| SELECT predioid, clienteid, contrato, c.nombre nomcliente, | |||||
| fn_getdomicilio(p.direcid) direccion, fn_get_direccion(p.direcid) direccionmostrar, fn_direccionshort(p.direcid) direccioncorta, | |||||
| fn_gettelefono(clienteid) telefono, | |||||
| p.coordx, p.coordy, p.zonafactid, p.serialmed, | |||||
| marcamedid || '-' || ma.descripcion marcamed, | |||||
| DECODE(mo.descripcion, NULL, 'Desconocido', modelomedid || '-' || mo.descripcion) modelomed, | |||||
| edopredioid, e.nombre edopredio, usoid, u.nombre uso, | |||||
| actividadid, a.nombre actividad, | |||||
| (SELECT SUM(total) FROM TABLE(cobranza.pk_carven.fn_getadeudocortes(predioid, TO_CHAR(SYSDATE, 'dd/mm/yyyy')))) adeudocortes | |||||
| FROM predios p | |||||
| LEFT JOIN clientes c USING (clienteid) | |||||
| LEFT JOIN estadospredio e USING (edopredioid) | |||||
| LEFT JOIN usos u USING (usoid) | |||||
| LEFT JOIN actividades a USING (usoid, actividadid) | |||||
| LEFT JOIN marcasmedidor ma USING (marcamedid) | |||||
| LEFT JOIN modelosmedidor mo USING (marcamedid, modelomedid) | |||||
| WHERE predioid = ? | |||||
| """; | |||||
| try (Connection connection = dataSource.getConnection(); | |||||
| PreparedStatement stmt = connection.prepareStatement(query)) { | |||||
| stmt.setLong(1, predioId); | |||||
| try (ResultSet rs = stmt.executeQuery()) { | |||||
| if (rs.next()) { | |||||
| PredioDTO dto = new PredioDTO( | |||||
| rs.getLong("predioid"), | |||||
| rs.getLong("clienteid"), | |||||
| rs.getString("contrato"), | |||||
| rs.getString("nomcliente"), | |||||
| rs.getString("direccion"), | |||||
| rs.getString("direccionmostrar"), | |||||
| rs.getString("direccioncorta"), | |||||
| rs.getString("telefono"), | |||||
| rs.getDouble("coordx"), | |||||
| rs.getDouble("coordy"), | |||||
| rs.getString("zonafactid"), | |||||
| rs.getString("serialmed"), | |||||
| rs.getString("marcamed"), | |||||
| rs.getString("modelomed"), | |||||
| rs.getString("edopredioid"), | |||||
| rs.getString("edopredio"), | |||||
| rs.getString("usoid"), | |||||
| rs.getString("uso"), | |||||
| rs.getInt("actividadid"), | |||||
| rs.getString("actividad"), | |||||
| rs.getDouble("adeudocortes") // asegúrate de haberlo agregado al DTO | |||||
| ); | |||||
| return Optional.of(dto); | |||||
| } else { | |||||
| return Optional.empty(); | |||||
| } | |||||
| } | |||||
| } catch (SQLException e) { | |||||
| throw new RuntimeException("Error al consultar predio var: " + e.getMessage(), e); | |||||
| } | |||||
| } | |||||
| @ReadOnly | |||||
| public Optional<PredioDTO> obtenerPredioATM(String valor) { | |||||
| if ("7777777".equals(valor)) { | |||||
| return Optional.of(new PredioDTO( | |||||
| 7777777L, 7777777L, "7777777", "Cliente de Prueba ATMs", | |||||
| "Dirección ficticia", "Dirección ficticia larga", "Dir. Falsa", | |||||
| null, 0.0, 0.0, "G7", "13166429", "NO-AUTOMATICO", "Desconocido", | |||||
| "NO", "NORMAL", "T", "TESTING", 7, "TESTING", 0.0 | |||||
| )); | |||||
| } | |||||
| String query; | |||||
| boolean isLong = valor.length() == 30; | |||||
| boolean isContract = valor.length() == 8; | |||||
| boolean isPredioId = valor.length() <= 6; | |||||
| if (isLong) { | |||||
| query = """ | |||||
| SELECT predioid, contrato, clienteid, c.nombre nomcliente, | |||||
| fn_getdomicilio(p.direcid) direccion, fn_get_direccion(p.direcid) direccionmostrar, | |||||
| fn_direccionshort(p.direcid) direccioncorta, p.coordx, p.coordy, p.zonafactid, | |||||
| p.serialmed, edopredioid, e.nombre edopredio, usoid, u.nombre uso, | |||||
| actividadid, a.nombre actividad | |||||
| FROM predios p | |||||
| LEFT JOIN clientes c USING (clienteid) | |||||
| LEFT JOIN estadospredio e USING (edopredioid) | |||||
| LEFT JOIN usos u USING (usoid) | |||||
| LEFT JOIN actividades a USING (usoid, actividadid) | |||||
| WHERE predioid = TO_NUMBER(SUBSTR(?, 24, 6)) | |||||
| """; | |||||
| } else if (isContract) { | |||||
| query = """ | |||||
| SELECT predioid, contrato, clienteid, c.nombre nomcliente, | |||||
| fn_getdomicilio(p.direcid) direccion, fn_get_direccion(p.direcid) direccionmostrar, | |||||
| fn_direccionshort(p.direcid) direccioncorta, p.coordx, p.coordy, p.zonafactid, | |||||
| p.serialmed, edopredioid, e.nombre edopredio, usoid, u.nombre uso, | |||||
| actividadid, a.nombre actividad | |||||
| FROM predios p | |||||
| LEFT JOIN clientes c USING (clienteid) | |||||
| LEFT JOIN estadospredio e USING (edopredioid) | |||||
| LEFT JOIN usos u USING (usoid) | |||||
| LEFT JOIN actividades a USING (usoid, actividadid) | |||||
| WHERE REGEXP_LIKE(contrato, ?) | |||||
| """; | |||||
| } else if (isPredioId) { | |||||
| query = """ | |||||
| SELECT predioid, contrato, clienteid, c.nombre nomcliente, | |||||
| fn_getdomicilio(p.direcid) direccion, fn_get_direccion(p.direcid) direccionmostrar, | |||||
| fn_direccionshort(p.direcid) direccioncorta, p.coordx, p.coordy, p.zonafactid, | |||||
| p.serialmed, edopredioid, e.nombre edopredio, usoid, u.nombre uso, | |||||
| actividadid, a.nombre actividad | |||||
| FROM predios p | |||||
| LEFT JOIN clientes c USING (clienteid) | |||||
| LEFT JOIN estadospredio e USING (edopredioid) | |||||
| LEFT JOIN usos u USING (usoid) | |||||
| LEFT JOIN actividades a USING (usoid, actividadid) | |||||
| WHERE predioid = TO_NUMBER(?) | |||||
| """; | |||||
| } else { | |||||
| return Optional.empty(); | |||||
| } | |||||
| try (Connection conn = dataSource.getConnection(); | |||||
| PreparedStatement stmt = conn.prepareStatement(query)) { | |||||
| stmt.setString(1, valor); | |||||
| try (ResultSet rs = stmt.executeQuery()) { | |||||
| if (rs.next()) { | |||||
| return Optional.of(new PredioDTO( | |||||
| rs.getLong("predioid"), | |||||
| rs.getLong("clienteid"), | |||||
| rs.getString("contrato"), | |||||
| rs.getString("nomcliente"), | |||||
| rs.getString("direccion"), | |||||
| rs.getString("direccionmostrar"), | |||||
| rs.getString("direccioncorta"), | |||||
| null, | |||||
| rs.getDouble("coordx"), | |||||
| rs.getDouble("coordy"), | |||||
| rs.getString("zonafactid"), | |||||
| rs.getString("serialmed"), | |||||
| null, | |||||
| null, | |||||
| rs.getString("edopredioid"), | |||||
| rs.getString("edopredio"), | |||||
| rs.getString("usoid"), | |||||
| rs.getString("uso"), | |||||
| rs.getInt("actividadid"), | |||||
| rs.getString("actividad"), | |||||
| null | |||||
| )); | |||||
| } | |||||
| } | |||||
| } catch (SQLException e) { | |||||
| throw new RuntimeException("Error al consultar predio ATM: " + e.getMessage(), e); | |||||
| } | |||||
| return Optional.empty(); | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,19 @@ | |||||
| micronaut: | |||||
| application: | |||||
| name: API_ePay_Micronaut | |||||
| datasources: | |||||
| default: | |||||
| url: jdbc:oracle:thin:@svrcomer:1521/comerpdb.JUMAPACELAYA.GOB.MX | |||||
| username: Comercial | |||||
| password: Comercial | |||||
| driverClassName: oracle.jdbc.OracleDriver | |||||
| dialect: ORACLE | |||||
| maximum-pool-size: 10 | |||||
| schema-generate: NONE | |||||
| autoCommit: true | |||||
| logger: | |||||
| levels: | |||||
| io.micronaut.data: DEBUG | |||||
| io.micronaut.jdbc: DEBUG | |||||
| @ -0,0 +1,14 @@ | |||||
| <configuration> | |||||
| <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | |||||
| <!-- encoders are assigned the type | |||||
| ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | |||||
| <encoder> | |||||
| <pattern>%cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n</pattern> | |||||
| </encoder> | |||||
| </appender> | |||||
| <root level="info"> | |||||
| <appender-ref ref="STDOUT" /> | |||||
| </root> | |||||
| </configuration> | |||||
| @ -0,0 +1,21 @@ | |||||
| package jumapacelaya.gob.mx; | |||||
| import io.micronaut.runtime.EmbeddedApplication; | |||||
| import io.micronaut.test.extensions.junit5.annotation.MicronautTest; | |||||
| import org.junit.jupiter.api.Test; | |||||
| import org.junit.jupiter.api.Assertions; | |||||
| import jakarta.inject.Inject; | |||||
| @MicronautTest | |||||
| class API_ePay_MicronautTest { | |||||
| @Inject | |||||
| EmbeddedApplication<?> application; | |||||
| @Test | |||||
| void testItWorks() { | |||||
| Assertions.assertTrue(application.isRunning()); | |||||
| } | |||||
| } | |||||