diff --git b/.gitignore a/.gitignore new file mode 100644 index 0000000..549e00a --- /dev/null +++ a/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git b/.mvn/wrapper/maven-wrapper.jar a/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000..cb28b0e Binary files /dev/null and a/.mvn/wrapper/maven-wrapper.jar differ diff --git b/.mvn/wrapper/maven-wrapper.properties a/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000..b27a13f --- /dev/null +++ a/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.2/apache-maven-3.9.2-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git b/config/application.yml a/config/application.yml new file mode 100644 index 0000000..ad35ca1 --- /dev/null +++ a/config/application.yml @@ -0,0 +1,77 @@ +server: + port: 8097 + servlet: + contex-path: /api/v1.0/ +spring: + datasource: + url : "jdbc:oracle:thin:@192.168.100.108:1521/TLC" + username: "TLC" + password : "tlc" + driver: + class-name: Oracle.jdbc.OracleDriver + application: + name: cronDisparadorEventosFE + version: develop # production + name-log: "logCronfeEventos.log" +apigee: + url: https://colsubsidio-prod.apigee.net + path: + auth: /oauth/client_credential/accesstoken + logger: /api/v1/tecnologia/logger + token: + url: /oauth/client_credential/accesstoken + clienteId: 6LaRJinvCnyv5CRmyyu4CU4wR5L2g6wH + clienteSecreto: V2qPQ0xB2gqWXtRX + maxTimeInMillis: 300000 #300000 millis = 5 minutes + facturas: + url: /api/v1/tecnologia/local/facturas + email: + send: + path: /api/v2/tecnologia/notificaciones/correos + remitente: + correo: infofacturaelectronica@colsubsidio.com + responder: infofacturaelectronica@colsubsidio.com + dev: daniel.avila@bitsamericas.com + copia: jjonatan.rojas@colsubsidio.com + copia2: nestor.martinez@colsubsidio.com + copia3: pedro.jimenezca@colsubsidio.com + subject: Notificación Analisis Resoluciones FE(Facturación electrónica) +apigeeFacturas: + url: https://colsubsidio-prod.apigee.net + token: + url: /oauth/client_credential/accesstoken + clienteId: 6LaRJinvCnyv5CRmyyu4CU4wR5L2g6wH + clienteSecreto: V2qPQ0xB2gqWXtRX + maxTimeInMillis: 300000 #300000 millis = 5 minutes + invoice-manager: + url: /api/v1/tecnologia/local/clientes/facturas + facturas: + url: /api/v1/tecnologia/local/facturas +xmlservive: + facturas: + url: http://192.168.100.103:8080/invoicemanager/billing/invoicemanager/vouchers +comprobante: + tipo: 5 +api: + #cada minuto + #-0 5 * * * (Todos los dias 5AM) + cron: 0 */2 * ? * * #Media Noche 0 0,6 * * * (A las 12 AM y a las 6 AM) + constant: + resoluciones: + up: 1@Porciento + cp: 5 + dp: 10 + qp: 15 + base: 50000 + maximo: 1000000 +query: + selectResoluciones: "SELECT CENTRO, NOMBRE_BASE, RESOLUCION, FECHA_INICIO, FECHA_VENCIMIENTO, PREFIJO, NUMERO_INICIAL, NUMERO_FINAL, TIPO, DIRECCION, MESES, SECUENCIA_SIGUIENTE, ESTADO, FECHA_REGISTRO , TERMINAL_RES, TIENDA_RES FROM TS_RESOLUCIONES tr WHERE ESTADO = 1 ORDER BY FECHA_VENCIMIENTO DESC" + selectByTerminalAndResolucion: "SELECT tr.PREFIJO,tr.TERMINAL_RES,tr.TIENDA_RES FROM TS_RESOLUCIONES tr WHERE tr.ESTADO = 1 AND tr.TERMINAL_RES = ? AND tr.RESOLUCION = ?" +logging: + file: + name: "log/app.log" + level: + com: + colsubsidio: + api.fe.cronfeeventos: INFO + diff --git b/log/app.log a/log/app.log new file mode 100644 index 0000000..eddd46c --- /dev/null +++ a/log/app.log @@ -0,0 +1,205 @@ +2023-08-02 09:18:55.577 INFO 257210 --- [main] a.f.c.CronDisparadorEventosFeApplication : Starting CronDisparadorEventosFeApplication on ubuntu-vivobook with PID 257210 (/home/daniel/Documentos/desarrollo/develop_works/projects/cronfeeventos/target/classes started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/cronfeeventos) +2023-08-02 09:18:55.587 INFO 257210 --- [main] a.f.c.CronDisparadorEventosFeApplication : No active profile set, falling back to default profiles: default +2023-08-02 09:18:56.270 INFO 257210 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. +2023-08-02 09:18:56.290 INFO 257210 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 13ms. Found 0 JPA repository interfaces. +2023-08-02 09:18:57.070 INFO 257210 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8097 (http) +2023-08-02 09:18:57.079 INFO 257210 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2023-08-02 09:18:57.079 INFO 257210 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.36] +2023-08-02 09:18:57.134 INFO 257210 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2023-08-02 09:18:57.134 INFO 257210 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1503 ms +2023-08-02 09:18:57.518 INFO 257210 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2023-08-02 09:18:57.532 INFO 257210 --- [main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler' +2023-08-02 09:18:57.541 INFO 257210 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2023-08-02 09:19:28.687 ERROR 257210 --- [main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization. + +java.sql.SQLRecoverableException: Error de E/S: The Network Adapter could not establish the connection + at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:854) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:793) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:57) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:747) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:562) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar:na] + at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:na] + at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:na] + at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) [HikariCP-3.4.5.jar:na] + at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) [HikariCP-3.4.5.jar:na] + at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:115) [HikariCP-3.4.5.jar:na] + at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) [HikariCP-3.4.5.jar:na] + at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158) [spring-jdbc-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116) [spring-jdbc-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79) [spring-jdbc-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:324) [spring-jdbc-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.boot.jdbc.EmbeddedDatabaseConnection.isEmbedded(EmbeddedDatabaseConnection.java:120) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateDefaultDdlAutoProvider.getDefaultDdlAuto(HibernateDefaultDdlAutoProvider.java:42) [spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.lambda$getVendorProperties$1(HibernateJpaConfiguration.java:130) [spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings.getDdlAuto(HibernateSettings.java:41) ~[spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineDdlAuto(HibernateProperties.java:136) ~[spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.getAdditionalProperties(HibernateProperties.java:102) ~[spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineHibernateProperties(HibernateProperties.java:94) ~[spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.getVendorProperties(HibernateJpaConfiguration.java:132) [spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:133) ~[spring-boot-autoconfigure-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_352] + at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_352] + at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_352] + at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_352] + at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:635) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE] + at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE] + at com.colsubsidio.api.fe.cronfeeventos.CronDisparadorEventosFeApplication.main(CronDisparadorEventosFeApplication.java:17) ~[classes/:na] +Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection + at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:571) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:548) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:682) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.ns.NSProtocol.connect(NSProtocol.java:309) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1596) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:588) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + ... 50 common frames omitted +Caused by: java.io.IOException: Socket read timed out, socket connect lapse 30003 ms. /192.168.100.108 1521 30000 1 true + at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:233) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.nt.ConnOption.connect(ConnOption.java:174) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:510) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + ... 55 common frames omitted +Caused by: oracle.net.nt.TimeoutInterruptHandler$IOReadTimeoutException: Socket read timed out + at oracle.net.nt.TimeoutSocketChannel.handleInterrupt(TimeoutSocketChannel.java:254) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.nt.TimeoutSocketChannel.connect(TimeoutSocketChannel.java:103) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.nt.TimeoutSocketChannel.(TimeoutSocketChannel.java:77) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:192) ~[ojdbc8-19.3.0.0.jar:19.3.0.0.0] + ... 57 common frames omitted + +2023-08-02 09:19:28.734 INFO 257210 --- [task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2023-08-02 09:19:28.788 INFO 257210 --- [task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.17.Final +2023-08-02 09:19:29.010 INFO 257210 --- [task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} +2023-08-02 09:19:29.179 INFO 257210 --- [task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2023-08-02 09:22:50.905 INFO 259981 --- [main] a.f.c.CronDisparadorEventosFeApplication : Starting CronDisparadorEventosFeApplication on ubuntu-vivobook with PID 259981 (/home/daniel/Documentos/desarrollo/develop_works/projects/cronfeeventos/target/classes started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/cronfeeventos) +2023-08-02 09:22:50.909 INFO 259981 --- [main] a.f.c.CronDisparadorEventosFeApplication : No active profile set, falling back to default profiles: default +2023-08-02 09:22:51.608 INFO 259981 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. +2023-08-02 09:22:51.628 INFO 259981 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 12ms. Found 0 JPA repository interfaces. +2023-08-02 09:22:52.358 INFO 259981 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8097 (http) +2023-08-02 09:22:52.371 INFO 259981 --- [main] o.apache.catalina.core.StandardService : Starting service [Tomcat] +2023-08-02 09:22:52.371 INFO 259981 --- [main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.36] +2023-08-02 09:22:52.445 INFO 259981 --- [main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext +2023-08-02 09:22:52.446 INFO 259981 --- [main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1472 ms +2023-08-02 09:22:52.837 INFO 259981 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2023-08-02 09:22:52.852 INFO 259981 --- [main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler' +2023-08-02 09:22:52.860 INFO 259981 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2023-08-02 09:22:53.478 INFO 259981 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2023-08-02 09:22:53.528 INFO 259981 --- [task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2023-08-02 09:22:53.572 INFO 259981 --- [task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.17.Final +2023-08-02 09:22:53.693 INFO 259981 --- [task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} +2023-08-02 09:22:53.868 INFO 259981 --- [task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect +2023-08-02 09:22:55.019 INFO 259981 --- [task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2023-08-02 09:22:55.027 INFO 259981 --- [task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2023-08-02 09:22:55.502 WARN 259981 --- [main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2023-08-02 09:22:55.541 INFO 259981 --- [main] .s.s.UserDetailsServiceAutoConfiguration : + +Using generated security password: 0812acd1-21da-4bb7-b491-170301dc7651 + +2023-08-02 09:22:55.693 INFO 259981 --- [main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@245253d8, org.springframework.security.web.context.SecurityContextPersistenceFilter@202d9236, org.springframework.security.web.header.HeaderWriterFilter@41bfa9e9, org.springframework.security.web.csrf.CsrfFilter@316cda31, org.springframework.security.web.authentication.logout.LogoutFilter@5ba90d8a, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@1a950fdd, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@62aeddc8, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@12417468, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@623e0631, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6d6ac396, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@100ad67e, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@459003a0, org.springframework.security.web.session.SessionManagementFilter@7069f076, org.springframework.security.web.access.ExceptionTranslationFilter@721d5b74, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@778a1250] +2023-08-02 09:22:56.366 INFO 259981 --- [main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8097 (http) with context path '' +2023-08-02 09:22:56.367 INFO 259981 --- [main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories… +2023-08-02 09:22:56.368 INFO 259981 --- [main] DeferredRepositoryInitializationListener : Spring Data repositories initialized! +2023-08-02 09:22:56.382 INFO 259981 --- [main] a.f.c.CronDisparadorEventosFeApplication : Started CronDisparadorEventosFeApplication in 6.001 seconds (JVM running for 6.45) +2023-08-02 09:24:00.000 INFO 259981 --- [scheduling-1] a.f.c.CronDisparadorEventosFeApplication : Iniciando proceso [Validacion de resoluciones] [run] --> CronDisparadorEventosFeApplication() +2023-08-02 09:24:00.001 INFO 259981 --- [scheduling-1] c.c.a.f.c.util.LoggerFactory : Llamando proceso service --> resolutionProcesoActivo() []2023-08-02T09:24:00.001 +2023-08-02 09:24:00.001 INFO 259981 --- [scheduling-1] c.c.a.f.c.util.LoggerFactory : Entrando proceso -->[ResolutionServiceImpl] [resolutionProcesoActivo]: +2023-08-02 09:26:41.102 INFO 259981 --- [scheduling-1] c.c.a.f.c.util.LoggerFactory : No se encontraron resoluciones para notificar2023-08-02T09:26:41.102 +2023-08-02 09:26:41.102 WARN 259981 --- [HikariPool-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Thread starvation or clock leap detected (housekeeper delta=2m47s523ms71µs18ns). +2023-08-02 09:26:41.103 INFO 259981 --- [scheduling-1] c.c.a.f.c.util.LoggerFactory : Se termina proceso analisis resolucion [ResolutionServiceImpl] [resolutionProcesoActivo]2023-08-02T09:26:41.102 +2023-08-02 09:26:41.104 INFO 259981 --- [scheduling-1] a.f.c.CronDisparadorEventosFeApplication : Finaliza proceso validacion de resoluciones +2023-08-02 09:26:41.146 INFO 259981 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2023-08-02 09:26:41.149 INFO 259981 --- [SpringContextShutdownHook] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler' +2023-08-02 09:26:41.149 INFO 259981 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2023-08-02 09:26:41.150 INFO 259981 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2023-08-02 09:26:41.510 INFO 259981 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2023-08-02 09:29:28.975 WARN 264045 --- [main] ory$DuplicateJsonObjectContextCustomizer : + +Found multiple occurrences of org.json.JSONObject on the class path: + + jar:file:/home/daniel/.m2/repository/org/json/json/20210307/json-20210307.jar!/org/json/JSONObject.class + jar:file:/home/daniel/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class + +You may wish to exclude one of them to ensure predictable runtime behavior + +2023-08-02 09:29:28.986 INFO 264045 --- [main] .CronDisparadorEventosFeApplicationTests : Starting CronDisparadorEventosFeApplicationTests on ubuntu-vivobook with PID 264045 (started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/cronfeeventos) +2023-08-02 09:29:28.988 INFO 264045 --- [main] .CronDisparadorEventosFeApplicationTests : No active profile set, falling back to default profiles: default +2023-08-02 09:29:29.745 INFO 264045 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. +2023-08-02 09:29:29.767 INFO 264045 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 15ms. Found 0 JPA repository interfaces. +2023-08-02 09:29:30.538 INFO 264045 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2023-08-02 09:29:30.558 INFO 264045 --- [main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler' +2023-08-02 09:29:30.567 INFO 264045 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2023-08-02 09:29:31.122 INFO 264045 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2023-08-02 09:29:31.185 INFO 264045 --- [task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2023-08-02 09:29:31.240 INFO 264045 --- [task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.17.Final +2023-08-02 09:29:31.426 INFO 264045 --- [task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} +2023-08-02 09:29:31.643 INFO 264045 --- [task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect +2023-08-02 09:29:32.881 INFO 264045 --- [task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2023-08-02 09:29:32.892 INFO 264045 --- [task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2023-08-02 09:29:33.512 WARN 264045 --- [main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2023-08-02 09:29:33.568 INFO 264045 --- [main] .s.s.UserDetailsServiceAutoConfiguration : + +Using generated security password: 5ae40068-db2c-4428-9795-056f7ebdf357 + +2023-08-02 09:29:33.793 INFO 264045 --- [main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@31efacad, org.springframework.security.web.context.SecurityContextPersistenceFilter@67f9cb52, org.springframework.security.web.header.HeaderWriterFilter@480cbe2e, org.springframework.security.web.csrf.CsrfFilter@2744dcae, org.springframework.security.web.authentication.logout.LogoutFilter@79d7035, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@72557746, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@2eda2062, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@380ce5a3, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@4052b19f, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@59018eed, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@c4d2c44, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@38029686, org.springframework.security.web.session.SessionManagementFilter@110e9982, org.springframework.security.web.access.ExceptionTranslationFilter@3b78c683, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5e1a5f] +2023-08-02 09:29:34.542 INFO 264045 --- [main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories… +2023-08-02 09:29:34.543 INFO 264045 --- [main] DeferredRepositoryInitializationListener : Spring Data repositories initialized! +2023-08-02 09:29:34.555 INFO 264045 --- [main] .CronDisparadorEventosFeApplicationTests : Started CronDisparadorEventosFeApplicationTests in 5.895 seconds (JVM running for 6.621) +2023-08-02 09:29:34.673 INFO 264045 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2023-08-02 09:29:34.675 INFO 264045 --- [SpringContextShutdownHook] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler' +2023-08-02 09:29:34.676 INFO 264045 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2023-08-02 09:29:34.677 INFO 264045 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2023-08-02 09:29:35.064 INFO 264045 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. +2023-08-02 09:31:23.470 WARN 265706 --- [main] ory$DuplicateJsonObjectContextCustomizer : + +Found multiple occurrences of org.json.JSONObject on the class path: + + jar:file:/home/daniel/.m2/repository/org/json/json/20210307/json-20210307.jar!/org/json/JSONObject.class + jar:file:/home/daniel/.m2/repository/com/vaadin/external/google/android-json/0.0.20131108.vaadin1/android-json-0.0.20131108.vaadin1.jar!/org/json/JSONObject.class + +You may wish to exclude one of them to ensure predictable runtime behavior + +2023-08-02 09:31:23.482 INFO 265706 --- [main] .CronDisparadorEventosFeApplicationTests : Starting CronDisparadorEventosFeApplicationTests on ubuntu-vivobook with PID 265706 (started by daniel in /home/daniel/Documentos/desarrollo/develop_works/projects/cronfeeventos) +2023-08-02 09:31:23.483 INFO 265706 --- [main] .CronDisparadorEventosFeApplicationTests : No active profile set, falling back to default profiles: default +2023-08-02 09:31:23.991 INFO 265706 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode. +2023-08-02 09:31:24.009 INFO 265706 --- [main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 12ms. Found 0 JPA repository interfaces. +2023-08-02 09:31:24.673 INFO 265706 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' +2023-08-02 09:31:24.687 INFO 265706 --- [main] o.s.s.c.ThreadPoolTaskScheduler : Initializing ExecutorService 'taskScheduler' +2023-08-02 09:31:24.696 INFO 265706 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... +2023-08-02 09:31:25.391 INFO 265706 --- [main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. +2023-08-02 09:31:25.449 INFO 265706 --- [task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default] +2023-08-02 09:31:25.492 INFO 265706 --- [task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.17.Final +2023-08-02 09:31:25.595 INFO 265706 --- [task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final} +2023-08-02 09:31:25.695 INFO 265706 --- [task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect +2023-08-02 09:31:26.463 INFO 265706 --- [task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform] +2023-08-02 09:31:26.472 INFO 265706 --- [task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' +2023-08-02 09:31:26.857 WARN 265706 --- [main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning +2023-08-02 09:31:26.892 INFO 265706 --- [main] .s.s.UserDetailsServiceAutoConfiguration : + +Using generated security password: 93c01ec6-e7c6-4405-b656-507d2e62f4b2 + +2023-08-02 09:31:27.020 INFO 265706 --- [main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@380ce5a3, org.springframework.security.web.context.SecurityContextPersistenceFilter@2de9ca6, org.springframework.security.web.header.HeaderWriterFilter@6c3f1658, org.springframework.security.web.csrf.CsrfFilter@16d0e521, org.springframework.security.web.authentication.logout.LogoutFilter@372461a9, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@8c12524, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@1a9ec80e, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@38029686, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@3dc68586, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2ee39e73, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@13866329, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@7d9c45ee, org.springframework.security.web.session.SessionManagementFilter@5eb0a686, org.springframework.security.web.access.ExceptionTranslationFilter@7f5614f9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@31b0f02] +2023-08-02 09:31:27.644 INFO 265706 --- [main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories… +2023-08-02 09:31:27.645 INFO 265706 --- [main] DeferredRepositoryInitializationListener : Spring Data repositories initialized! +2023-08-02 09:31:27.656 INFO 265706 --- [main] .CronDisparadorEventosFeApplicationTests : Started CronDisparadorEventosFeApplicationTests in 4.435 seconds (JVM running for 5.062) +2023-08-02 09:31:27.750 INFO 265706 --- [SpringContextShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' +2023-08-02 09:31:27.752 INFO 265706 --- [SpringContextShutdownHook] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler' +2023-08-02 09:31:27.752 INFO 265706 --- [SpringContextShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' +2023-08-02 09:31:27.753 INFO 265706 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... +2023-08-02 09:31:28.093 INFO 265706 --- [SpringContextShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. diff --git b/log/app.log.2023-07-31.0.gz a/log/app.log.2023-07-31.0.gz new file mode 100644 index 0000000..0bc76de Binary files /dev/null and a/log/app.log.2023-07-31.0.gz differ diff --git b/mvnw a/mvnw new file mode 100755 index 0000000..66df285 --- /dev/null +++ a/mvnw @@ -0,0 +1,308 @@ +#!/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 +# +# 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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.2.0 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "$(uname)" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="$(/usr/libexec/java_home)"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=$(java-config --jre-home) + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --unix "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --unix "$CLASSPATH") +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && [ -d "$JAVA_HOME" ] && + JAVA_HOME="$(cd "$JAVA_HOME" || (echo "cannot cd into $JAVA_HOME."; exit 1); pwd)" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="$(which javac)" + if [ -n "$javaExecutable" ] && ! [ "$(expr "\"$javaExecutable\"" : '\([^ ]*\)')" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=$(which readlink) + if [ ! "$(expr "$readLink" : '\([^ ]*\)')" = "no" ]; then + if $darwin ; then + javaHome="$(dirname "\"$javaExecutable\"")" + javaExecutable="$(cd "\"$javaHome\"" && pwd -P)/javac" + else + javaExecutable="$(readlink -f "\"$javaExecutable\"")" + fi + javaHome="$(dirname "\"$javaExecutable\"")" + javaHome=$(expr "$javaHome" : '\(.*\)/bin') + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + 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 + else + JAVACMD="$(\unset -f command 2>/dev/null; \command -v java)" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=$(cd "$wdir/.." || exit 1; pwd) + fi + # end of workaround + done + printf '%s' "$(cd "$basedir" || exit 1; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + # Remove \r in case we run on Windows within Git Bash + # and check out the repository with auto CRLF management + # enabled. Otherwise, we may read lines that are delimited with + # \r\n and produce $'-Xarg\r' rather than -Xarg due to word + # splitting rules. + tr -s '\r\n' ' ' < "$1" + fi +} + +log() { + if [ "$MVNW_VERBOSE" = true ]; then + printf '%s\n' "$1" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname "$0")") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +log "$MAVEN_PROJECTBASEDIR" + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +wrapperJarPath="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" +if [ -r "$wrapperJarPath" ]; then + log "Found $wrapperJarPath" +else + log "Couldn't find $wrapperJarPath, downloading it ..." + + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + fi + while IFS="=" read -r key value; do + # Remove '\r' from value to allow usage on windows as IFS does not consider '\r' as a separator ( considers space, tab, new line ('\n'), and custom '=' ) + safeValue=$(echo "$value" | tr -d '\r') + case "$key" in (wrapperUrl) wrapperUrl="$safeValue"; break ;; + esac + done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" + log "Downloading from: $wrapperUrl" + + if $cygwin; then + wrapperJarPath=$(cygpath --path --windows "$wrapperJarPath") + fi + + if command -v wget > /dev/null; then + log "Found wget ... using wget" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--quiet" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + log "Found curl ... using curl" + [ "$MVNW_VERBOSE" = true ] && QUIET="" || QUIET="--silent" + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L || rm -f "$wrapperJarPath" + fi + else + log "Falling back to using Java to download" + javaSource="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$MAVEN_PROJECTBASEDIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=$(cygpath --path --windows "$javaSource") + javaClass=$(cygpath --path --windows "$javaClass") + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + log " - Compiling MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + log " - Running MavenWrapperDownloader.java ..." + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$wrapperUrl" "$wrapperJarPath") || rm -f "$wrapperJarPath" + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +# If specified, validate the SHA-256 sum of the Maven wrapper jar file +wrapperSha256Sum="" +while IFS="=" read -r key value; do + case "$key" in (wrapperSha256Sum) wrapperSha256Sum=$value; break ;; + esac +done < "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.properties" +if [ -n "$wrapperSha256Sum" ]; then + wrapperSha256Result=false + if command -v sha256sum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | sha256sum -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + elif command -v shasum > /dev/null; then + if echo "$wrapperSha256Sum $wrapperJarPath" | shasum -a 256 -c > /dev/null 2>&1; then + wrapperSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." + echo "Please install either command, or disable validation by removing 'wrapperSha256Sum' from your maven-wrapper.properties." + exit 1 + fi + if [ $wrapperSha256Result = false ]; then + echo "Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised." >&2 + echo "Investigate or delete $wrapperJarPath to attempt a clean download." >&2 + echo "If you updated your Maven version, you need to update the specified wrapperSha256Sum property." >&2 + exit 1 + fi +fi + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=$(cygpath --path --windows "$JAVA_HOME") + [ -n "$CLASSPATH" ] && + CLASSPATH=$(cygpath --path --windows "$CLASSPATH") + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=$(cygpath --path --windows "$MAVEN_PROJECTBASEDIR") +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $*" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +# shellcheck disable=SC2086 # safe args +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git b/mvnw.cmd a/mvnw.cmd new file mode 100644 index 0000000..95ba6f5 --- /dev/null +++ a/mvnw.cmd @@ -0,0 +1,205 @@ +@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 https://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.2.0 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM If specified, validate the SHA-256 sum of the Maven wrapper jar file +SET WRAPPER_SHA_256_SUM="" +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperSha256Sum" SET WRAPPER_SHA_256_SUM=%%B +) +IF NOT %WRAPPER_SHA_256_SUM%=="" ( + powershell -Command "&{"^ + "$hash = (Get-FileHash \"%WRAPPER_JAR%\" -Algorithm SHA256).Hash.ToLower();"^ + "If('%WRAPPER_SHA_256_SUM%' -ne $hash){"^ + " Write-Output 'Error: Failed to validate Maven wrapper SHA-256, your Maven wrapper might be compromised.';"^ + " Write-Output 'Investigate or delete %WRAPPER_JAR% to attempt a clean download.';"^ + " Write-Output 'If you updated your Maven version, you need to update the specified wrapperSha256Sum property.';"^ + " exit 1;"^ + "}"^ + "}" + if ERRORLEVEL 1 goto error +) + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git b/pom.xml a/pom.xml new file mode 100644 index 0000000..ade212e --- /dev/null +++ a/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.3.1.RELEASE + + + com.colsubsidio.api.fe + cronfeeventos + 0.0.1 + cronDisparadorEventosFE + Proyecto para generar eventos FE + + 1.8 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-web + + + com.google.code.gson + gson + jar + + + org.apache.httpcomponents + httpclient + 4.3.4 + + + org.json + json + 20210307 + + + com.oracle.database.jdbc + ojdbc8 + runtime + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.projectlombok + lombok + 1.18.22 + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/CronDisparadorEventosFeApplication.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/CronDisparadorEventosFeApplication.java new file mode 100644 index 0000000..f5edf3d --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/CronDisparadorEventosFeApplication.java @@ -0,0 +1,30 @@ +package com.colsubsidio.api.fe.cronfeeventos; + +import com.colsubsidio.api.fe.cronfeeventos.bussiness.CronEventosFeBussinessImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; + +@SpringBootApplication +@EnableScheduling +@Slf4j +public class CronDisparadorEventosFeApplication { + + public static void main(String[] args) { + SpringApplication.run(CronDisparadorEventosFeApplication.class, args); + } + + @Autowired + CronEventosFeBussinessImpl cronEventos; + + @Scheduled(cron = "${api.cron}") + public void run() { + log.info("Iniciando proceso [Validacion de resoluciones] [run] --> CronDisparadorEventosFeApplication()"); + cronEventos.cronEventoResolution(); + log.info("Finaliza proceso validacion de resoluciones"); + } + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/api/api.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/api/api.java new file mode 100644 index 0000000..9dcfa00 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/api/api.java @@ -0,0 +1,11 @@ +package com.colsubsidio.api.fe.cronfeeventos.api; + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("resolucion") +public class api { + + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/bussiness/CronEventosFeBussinessImpl.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/bussiness/CronEventosFeBussinessImpl.java new file mode 100644 index 0000000..e517d36 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/bussiness/CronEventosFeBussinessImpl.java @@ -0,0 +1,27 @@ +package com.colsubsidio.api.fe.cronfeeventos.bussiness; + +import com.colsubsidio.api.fe.cronfeeventos.services.ResolutionServiceImpl; +import com.colsubsidio.api.fe.cronfeeventos.util.LoggerFactory; +import org.springframework.stereotype.Component; + +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Date; + +@Component +public class CronEventosFeBussinessImpl { + + private LoggerFactory loggerFactory; + + private ResolutionServiceImpl service; + public CronEventosFeBussinessImpl(LoggerFactory loggerFactory, ResolutionServiceImpl service){ + this.loggerFactory = loggerFactory; + this.service = service; + } + + + public void cronEventoResolution(){ + loggerFactory.loggerInfo("Llamando proceso service --> resolutionProcesoActivo() []" + LocalDateTime.now()); + this.service.resolutionProcesoActivo(); + } +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/ConfigProperties.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/ConfigProperties.java new file mode 100644 index 0000000..8757673 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/ConfigProperties.java @@ -0,0 +1,55 @@ +package com.colsubsidio.api.fe.cronfeeventos.config; + +import lombok.Data; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +public class ConfigProperties { + + + @Value("${apigee.email.send.path}") + private String pathCorreo; + + @Value("${apigee.email.send.remitente.correo}") + private String remitente; + + @Value("${apigee.email.send.remitente.correo}") + private String remitente_responde; + + @Value("${apigee.email.send.subject}") + private String email_subject; + + @Value("${apigee.url}") + private String urlApigee; + + @Value("${apigee.email.send.copia}") + private String copia; + + @Value("${apigee.email.send.copia2}") + private String copia2; + + + @Value("${apigee.email.send.copia3}") + private String copia3; + + @Value("${apigee.email.send.dev}") + private String dev; + + @Value("${api.constant.base}") + private Integer porcentajeLimit; + + @Value("${api.constant.resoluciones.cp}") + private Integer valor5; + + @Value("${api.constant.resoluciones.dp}") + private Integer valor10; + + @Value("${api.constant.resoluciones.qp}") + private Integer valor15; + + @Value("${api.constant.maximo}") + private Integer resolucionesLimit; + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/QuerysProperties.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/QuerysProperties.java new file mode 100644 index 0000000..61e9c0b --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/QuerysProperties.java @@ -0,0 +1,35 @@ +package com.colsubsidio.api.fe.cronfeeventos.config; + + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConfigurationProperties(prefix = "query") +public class QuerysProperties { + + + private String selectResoluciones; + + private String selectByTerminalAndResolucion; + + public QuerysProperties() { + } + + + public String getSelectResoluciones() { + return selectResoluciones; + } + + public void setSelectResoluciones(String selectResoluciones) { + this.selectResoluciones = selectResoluciones; + } + + public String getSelectByTerminalAndResolucion() { + return selectByTerminalAndResolucion; + } + + public void setSelectByTerminalAndResolucion(String selectByTerminalAndResolucion) { + this.selectByTerminalAndResolucion = selectByTerminalAndResolucion; + } +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/WebSecurityConfig.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/WebSecurityConfig.java new file mode 100644 index 0000000..8f57c86 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/config/WebSecurityConfig.java @@ -0,0 +1,10 @@ +package com.colsubsidio.api.fe.cronfeeventos.config; + +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +@EnableWebSecurity +public class WebSecurityConfig { + + + +} \ No newline at end of file diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dao/ResolucionDao.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dao/ResolucionDao.java new file mode 100644 index 0000000..1e94e48 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dao/ResolucionDao.java @@ -0,0 +1,56 @@ +package com.colsubsidio.api.fe.cronfeeventos.dao; + +import com.colsubsidio.api.fe.cronfeeventos.config.QuerysProperties; +import com.colsubsidio.api.fe.cronfeeventos.dto.ResolucionDTO; +import com.colsubsidio.api.fe.cronfeeventos.util.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Repository +@Transactional +public class ResolucionDao { + + @Autowired + LoggerFactory loggerFactory; + + @Autowired + JdbcTemplate jdbcTemplate; + + + @Autowired + QuerysProperties querysProperties; + + /** + * Metodo que permite consultar todas las resoluciones que se manejan en el proceso de facturacion + * Tablas TS_RESOLUCIONES + * @return una lista de objetos ResolucionDTO con la información de las resoluciones y sus secuencias + */ + public List consultarResolucionesTLC(){ + String sql = querysProperties.getSelectResoluciones(); + return jdbcTemplate.query(sql, (rs, rowNum) -> { + ResolucionDTO resolution = new ResolucionDTO(); + resolution.setCentro(rs.getString("CENTRO")); + resolution.setNombre_base(rs.getString("NOMBRE_BASE")); + resolution.setResolucion(rs.getString("RESOLUCION")); + resolution.setFecha_inicio(rs.getDate("FECHA_INICIO")); + resolution.setFecha_vencimiento(rs.getDate("FECHA_VENCIMIENTO")); + resolution.setPrefijo(rs.getString("PREFIJO")); + resolution.setNumero_inicial(rs.getInt("NUMERO_INICIAL")); + resolution.setNumero_final(rs.getLong("NUMERO_FINAL")); + resolution.setTipo(rs.getString("TIPO")); + resolution.setDireccion(rs.getString("DIRECCION")); + resolution.setMeses(rs.getInt("MESES")); + resolution.setSecuencia_siguiente(rs.getLong("SECUENCIA_SIGUIENTE")); + resolution.setEstado(rs.getInt("ESTADO")); + resolution.setFecha_registro(rs.getDate("FECHA_REGISTRO")); + resolution.setTerminal_res(rs.getInt("TERMINAL_RES")); + resolution.setTienda_res(rs.getInt("TIENDA_RES")); + return resolution; + }); + } + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApiResponse.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApiResponse.java new file mode 100644 index 0000000..f2e3ae0 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApiResponse.java @@ -0,0 +1,56 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import javax.xml.ws.Response; + +public class ApiResponse { + + private boolean success; + private String status; + private String message; + + private T date; + + public ApiResponse(boolean success, String status, String message, T date) { + this.success = success; + this.status = status; + this.message = message; + this.date = date; + } + + public static ResponseEntity> success(T data){ + ApiResponse response = new ApiResponse<>(true, "200","Exito! Resultados Obtenidos", data); + return new ResponseEntity<>(response , HttpStatus.OK); + } + + public static ResponseEntity> sucess(String message,T data){ + ApiResponse response = new ApiResponse<>(true, "200",message, data); + return new ResponseEntity<>(response , HttpStatus.OK); + } + + public static ResponseEntity> error(String message){ + ApiResponse response = new ApiResponse<>(false, "400",message, null); + return new ResponseEntity<>(response , HttpStatus.BAD_REQUEST); + } + + + public boolean isSuccess() { + return success; + } + + public String getStatus() { + return status; + } + + public String getMessage() { + return message; + } + + public T getDate() { + return date; + } +} + + diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeLogDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeLogDTO.java new file mode 100644 index 0000000..b00c8d0 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeLogDTO.java @@ -0,0 +1,22 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import lombok.*; + +@Data +@Builder +public class ApigeeLogDTO { + + private String url; + private Object body; + private Object bodyResponse; + private HttpMethod method; + private HttpStatus status; + private long timeConn; + private HttpHeaders headers; + private String error; + private String tag; + +} \ No newline at end of file diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeTokenReqDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeTokenReqDTO.java new file mode 100644 index 0000000..43daff1 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeTokenReqDTO.java @@ -0,0 +1,15 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + +import lombok.*; + +@AllArgsConstructor +@NoArgsConstructor +@ToString +@Builder +@Data +public class ApigeeTokenReqDTO { + + private String clienteId; + private String clienteSecreto; + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeTokenResDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeTokenResDTO.java new file mode 100644 index 0000000..824706a --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ApigeeTokenResDTO.java @@ -0,0 +1,30 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.*; + +import java.util.List; + +@AllArgsConstructor +@NoArgsConstructor +@ToString +@Builder +@Data +public class ApigeeTokenResDTO { + + private String refresh_token_expires_in; + private String api_product_list; + private List api_product_list_json; + private String organization_name; + @JsonProperty("developer.email") + private String developer_email; + private String token_type; + private String issued_at; + private String client_id; + private String access_token; + private String application_name; + private String scope; + private String expires_in; + private String refresh_count; + private String status; +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/EmailRequestDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/EmailRequestDTO.java new file mode 100644 index 0000000..b8da09b --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/EmailRequestDTO.java @@ -0,0 +1,82 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + +import lombok.*; +import java.util.List; +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class EmailRequestDTO { + + public Remitente remitente; + public String asunto; + public String fechaEnvio; + public Plantilla plantilla; + public List parametro; + public List archivoAdjunto; + public List destinatario; + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + public static class ArchivoAdjunto { + private String ruta; + private String contrasenia; + private String nombre; + private String accion; + + } + + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Remitente { + public String correo; + public String responder; + public String enviado; + } + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Plantilla { + public String tipo; + public String contenido; + } + + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Parametro { + public String server; + public String percent; + public String detalle; + } + + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Destinatario { + + public String para; + public Remitente remitente; + public String asunto; + public String fechaEnvio; + public List parametro; + public List archivoAdjunto; + } + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/EmailResponseDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/EmailResponseDTO.java new file mode 100644 index 0000000..33249fd --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/EmailResponseDTO.java @@ -0,0 +1,40 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; +import lombok.*; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +@ToString +public class EmailResponseDTO { + + + + private List resultado; + private List envioCorreo; + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class Resultado { + private String codigo; + private String descripcion; + + } + + @Data + @Builder + @AllArgsConstructor + @NoArgsConstructor + @ToString + public static class EnvioCorreo { + private String codigo; + + + } + + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResolucionDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResolucionDTO.java new file mode 100644 index 0000000..2e3af88 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResolucionDTO.java @@ -0,0 +1,49 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.sql.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ResolucionDTO { + private String centro; + + private String nombre_base; + + private String resolucion; + + private Date fecha_inicio; + + private Date fecha_vencimiento; + + private String prefijo; + + private Integer numero_inicial; + + private Long numero_final; + + private String tipo; + + private String direccion; + + private Integer meses; + + private Long secuencia_siguiente; + + private Integer estado; + + private Date fecha_registro; + + private Integer terminal_res; + + private Integer tienda_res; + + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResolutionTemplate.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResolutionTemplate.java new file mode 100644 index 0000000..9e20fd8 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResolutionTemplate.java @@ -0,0 +1,23 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class ResolutionTemplate { + + private String numeroResolucion; + private String tienda; + private String terminal; + private String nombreBase; + private String fechaVencimiento; + private String secuenciaSiguiente; + private String diasCaducidad; + private String detalle; + private String criterio; +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResponseDTO.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResponseDTO.java new file mode 100644 index 0000000..f8f96dd --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/dto/ResponseDTO.java @@ -0,0 +1,19 @@ +package com.colsubsidio.api.fe.cronfeeventos.dto; + + + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class ResponseDTO { + + private String statusCode; + private String message; + private String response; +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/ApigeeService.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/ApigeeService.java new file mode 100644 index 0000000..31e8087 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/ApigeeService.java @@ -0,0 +1,79 @@ +package com.colsubsidio.api.fe.cronfeeventos.services; + +import com.colsubsidio.api.fe.cronfeeventos.dto.ApigeeTokenReqDTO; +import com.colsubsidio.api.fe.cronfeeventos.dto.ApigeeTokenResDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +import java.time.LocalDateTime; +import java.time.ZoneId; + +@Component +@Slf4j +public class ApigeeService { + + @Value("${apigee.url}") + private String urlApi; + + @Value("${apigee.token.clienteId}") + private String clienteId; + + @Value("${apigee.token.clienteSecreto}") + private String clienteSecreto; + + @Value("${apigee.token.maxTimeInMillis}") + private Long maxTimeInMillis; + + @Value("${apigee.token.url}") + private String auth; + + @Value("${apigee.path.logger}") + private String logger; + + private String token; + private LocalDateTime tokenDate; + + public String getToken() { + if (token == null) { + generateToken(); + } else { + long tokenMillis = tokenDate.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + long currMillis = LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().toEpochMilli(); + long timeLive = currMillis - tokenMillis; + if (timeLive > maxTimeInMillis) { + generateToken(); + } + } + return token; + } + + private void generateToken() { + ApigeeTokenReqDTO request = new ApigeeTokenReqDTO(); + request.setClienteId(clienteId); + request.setClienteSecreto(clienteSecreto); + token = postAccessToken(request).getAccess_token(); + tokenDate = LocalDateTime.now(); + } + + public ApigeeTokenResDTO postAccessToken(ApigeeTokenReqDTO request) { + RestTemplate restTemplate = new RestTemplate(); + UriComponentsBuilder uri = UriComponentsBuilder.fromHttpUrl(urlApi + auth); + + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + + HttpEntity entity = new HttpEntity<>(request, headers); + + ResponseEntity result + = restTemplate.exchange(uri.toUriString(), HttpMethod.POST, entity, ApigeeTokenResDTO.class); + + return result.getBody(); + } + +} + diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/EmailService.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/EmailService.java new file mode 100644 index 0000000..f9908cf --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/EmailService.java @@ -0,0 +1,117 @@ +package com.colsubsidio.api.fe.cronfeeventos.services; + +import com.colsubsidio.api.fe.cronfeeventos.config.ConfigProperties; +import com.colsubsidio.api.fe.cronfeeventos.dto.EmailRequestDTO; +import com.colsubsidio.api.fe.cronfeeventos.dto.EmailResponseDTO; +import com.colsubsidio.api.fe.cronfeeventos.dto.ResponseDTO; +import com.colsubsidio.api.fe.cronfeeventos.util.HandleDate; +import com.colsubsidio.api.fe.cronfeeventos.util.RestTemplateUtil; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.util.UriComponentsBuilder; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Component +@Slf4j +public class EmailService { + + @Autowired + private RestTemplateUtil restTemplateUtil; + + @Autowired + private HandleDate handleDate; + + @Autowired + ConfigProperties configProperties; + + /** + * clase encargada de crear el cuerpo y datos del email + * @throws IOException + */ + public EmailRequestDTO setTemplateEmailMessageContent(String template) throws IOException { + + try{ + log.info("Modelando datos [setTemplateEmailMessageContent] [EmailService] -> "); + + EmailRequestDTO emailRequestDTO = new EmailRequestDTO(); + List listaParametros = new ArrayList<>(); + + EmailRequestDTO.Remitente remitente = new EmailRequestDTO.Remitente(configProperties.getRemitente(), configProperties.getRemitente_responde(), ""); + emailRequestDTO.setRemitente(remitente); + emailRequestDTO.setPlantilla(new EmailRequestDTO.Plantilla("text/html", template)); + + emailRequestDTO.setAsunto(configProperties.getEmail_subject()); + emailRequestDTO.setDestinatario(new ArrayList<>()); + EmailRequestDTO.Destinatario destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(configProperties.getEmail_subject()); + destinatario.setPara(configProperties.getDev()); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + emailRequestDTO.setParametro(listaParametros); + + destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(configProperties.getEmail_subject()); + destinatario.setPara(configProperties.getCopia()); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + + destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(configProperties.getEmail_subject()); + destinatario.setPara(configProperties.getCopia2()); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + + + destinatario = new EmailRequestDTO.Destinatario(); + destinatario.setAsunto(configProperties.getEmail_subject()); + destinatario.setPara(configProperties.getCopia3()); + destinatario.setParametro(listaParametros); + emailRequestDTO.getDestinatario().add(destinatario); + + + return emailRequestDTO; + }catch (Exception e){ + log.error("Error modelando el DTO para envio del email:" + e); + } + + return null; + } + + + /** + * metodo encargado de enviar un email + * + * @param emailRequestDTO + */ + public ResponseDTO send(EmailRequestDTO emailRequestDTO) { + ResponseDTO responseDTO = new ResponseDTO(); + UriComponentsBuilder uriMail = UriComponentsBuilder.fromHttpUrl(configProperties.getUrlApigee() + configProperties.getPathCorreo()); + ResponseEntity res = restTemplateUtil.sendRequest(uriMail, HttpMethod.POST, emailRequestDTO, EmailResponseDTO.class, null, true, "Envio email"); + + if (res.getStatusCode().is2xxSuccessful()) { + log.info("email enviado de forma exitosa emailRequestDTO:" + emailRequestDTO); + log.info("email enviado de forma exitosa"); + responseDTO.setMessage("email enviado de forma exitosa emailRequestDTO:" + emailRequestDTO); + responseDTO.setResponse(Objects.requireNonNull(res.getBody()).toString()); + responseDTO.setStatusCode(res.getStatusCode().toString()); + } else { + log.error("Error enviando el email emailRequestDTO: "+ emailRequestDTO); + log.error("Error enviando el email response:" + res ); + + responseDTO.setMessage("Error enviando el email emailRequestDTO:" + emailRequestDTO); + responseDTO.setResponse(Objects.requireNonNull(res.getBody()).toString()); + responseDTO.setStatusCode(res.getStatusCode().toString()); + } + return responseDTO; + } + + +} \ No newline at end of file diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/ResolutionServiceImpl.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/ResolutionServiceImpl.java new file mode 100644 index 0000000..4f1cdec --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/services/ResolutionServiceImpl.java @@ -0,0 +1,165 @@ +package com.colsubsidio.api.fe.cronfeeventos.services; + +import com.colsubsidio.api.fe.cronfeeventos.config.ConfigProperties; +import com.colsubsidio.api.fe.cronfeeventos.config.QuerysProperties; +import com.colsubsidio.api.fe.cronfeeventos.dao.ResolucionDao; +import com.colsubsidio.api.fe.cronfeeventos.dto.ResolucionDTO; +import com.colsubsidio.api.fe.cronfeeventos.dto.ResolutionTemplate; +import com.colsubsidio.api.fe.cronfeeventos.dto.ResponseDTO; +import com.colsubsidio.api.fe.cronfeeventos.util.LoggerFactory; +import com.colsubsidio.api.fe.cronfeeventos.util.ValidateTemplateData; +import jdk.nashorn.internal.runtime.logging.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + + +@Service +public class ResolutionServiceImpl { + + @Autowired + ResolucionDao resolucionDao; + + @Autowired + LoggerFactory loggerFactory; + + @Autowired + ConfigProperties configProperties; + + @Autowired + EmailService emailService; + + private String templateFechaCaducidad ; + + private String templateResolutions ; + + private ResponseDTO responseDTO; + + private ValidateTemplateData validateTemplateData; + + public ResolutionServiceImpl( ValidateTemplateData validateTemplateData){ + this.validateTemplateData = validateTemplateData; + } + + + public void resolutionProcesoActivo(){ + loggerFactory.loggerInfo("Entrando proceso -->[ResolutionServiceImpl] [resolutionProcesoActivo]:"); + templateResolutions = ""; + templateFechaCaducidad = ""; + DecimalFormat format = new DecimalFormat("0.00"); + try { + List detalle = new ArrayList<>(0); + List detalleFechasCaducidad = new ArrayList<>(0); + + List resoluciones = resolucionDao.consultarResolucionesTLC(); + + resoluciones.forEach(resolucion -> { + + int secuenciaDisponible = validateTemplateData.secuenciaDisponibles(resolucion.getSecuencia_siguiente(), resolucion.getNumero_final()); + String cadena = validateTemplateData.validateResolutions(secuenciaDisponible, resolucion.getNumero_final(), resolucion); + String cadenaCaducidad = validateTemplateData.detalleFechasCaducidad(resolucion); + + if(!cadena.equals("")){detalle.add(cadena);} + if(!cadenaCaducidad.equals("")){detalleFechasCaducidad.add(cadenaCaducidad);} + + }); + int cantidad_analizada = detalle.size() + detalleFechasCaducidad.size(); + templateResolutions += "
" + + "

Reporte validación resoluciones (Facturación electrónica)

" + + "
Cantidad de resoluciones notificadas: "+ cantidad_analizada +"
" + + "

Resoluciones con alerta por cantidad de consecutivo

" + + "
De acuerdo al límite de consecutivo permitidos para una resolución, se valida la diferencia entre los consecutivos consumidos y los restantes.
" + + "" + + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + + for(String d : detalle){ + String[] vector = d.split("\\|"); + + //Aqui logica template + if(Integer.parseInt(vector[8]) < configProperties.getPorcentajeLimit()){ + templateResolutions += ""; + } else if(Integer.parseInt(vector[8]) == configProperties.getPorcentajeLimit()) { + templateResolutions += ""; + } else { + templateResolutions += ""; + } + double porcentaje = Double.parseDouble(vector[8]) / configProperties.getResolucionesLimit() * 100; + + templateResolutions += ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + } + + templateResolutions += "
ResoluciónNombre del PuntoCódigoTerminalPrefijoLimite consecutivoCantidad utilizadosDisponible %Cantidad disponible
"+ vector[1] +""+ vector[2] +""+ vector[3] +""+ vector[4] +""+ vector[5]+""+ vector[6] +""+ vector[7] +""+ String.valueOf(format.format(porcentaje)).concat("%") +""+vector[8] +"

-----------------------------------------------------------------------------------------------------------" + + "--------------------------------

"; + + templateFechaCaducidad += "

Resoluciones con ALERTA por vencimiento.

"+ + "

De acuerdo a la fecha máxima de vigencia de la resolución, se compara con la fecha actual y se extraen los días de vigencia que aun tiene la resolución

"+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + + for(String d : detalleFechasCaducidad){ + String[] vector = d.split("\\|"); + + if(vector[7].equals("5")){ + templateFechaCaducidad += ""; + } else if(vector[7].equals("1") || vector[7].equals("0")){ + templateFechaCaducidad += ""; + } else if (Integer.parseInt(vector[7]) < 0 ){ + templateFechaCaducidad += ""; + } + + templateFechaCaducidad += ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + } + templateResolutions += templateFechaCaducidad + "
ResolucionNombre tiendaCodigoTerminalFecha InicioFecha VencimientoDias
"+ vector[1] +""+vector[2] +""+vector[3] +""+vector[4] +""+vector[5] +""+vector[6] +""+vector[7]+ "
"; + + + if(detalleFechasCaducidad.size() > 0 || detalle.size() > 0){ + loggerFactory.loggerInfo("Inicia proceso envio analisis resoluciones email -->" + LocalDateTime.now()); + emailService.send(emailService.setTemplateEmailMessageContent(templateResolutions)); + } else { + loggerFactory.loggerInfo("No se encontraron resoluciones para notificar" + LocalDateTime.now()); + } + loggerFactory.loggerInfo("Se termina proceso analisis resolucion [ResolutionServiceImpl] [resolutionProcesoActivo]" + LocalDateTime.now()); + + }catch (Exception exception){ + loggerFactory.loggerError("ERROR! Entrando proceso [resolutionProcesoActivo]" + exception.getMessage()); + } + } + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/FormatDate.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/FormatDate.java new file mode 100644 index 0000000..755b9b0 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/FormatDate.java @@ -0,0 +1,87 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +public class FormatDate { + + //2021-10-28 + public static String getDateSimple(String fecha){ + + SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null ; + try { + date = dateFormatter.parse(fecha); + } catch (ParseException e) { + e.printStackTrace(); + } + + //System.out.println("Format 1: " + dateFormatter.format( date )); + + return dateFormatter.format( date ); + } + + //2021-10-28T14:22:25.670Z + public static String getDateEspecialFormato(String fecha){ + //SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ"); + SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.0Z"); + Date date = null ; + try { + date = new SimpleDateFormat("yyyy-MM-dd").parse(fecha); + + } catch (ParseException e) { + e.printStackTrace(); + } + + //System.out.println("Format 2: " + dateFormatter.format( date )); + + return dateFormatter.format( date ); + } + + public static String convertFecha(String fechaLlegada){ + + String[] arrays_numeros = fechaLlegada.split(""); + + String nuevaFecha = ""; + for (int j = 0; j < arrays_numeros.length; j++){ + if (j == 4 || j == 6 ) { + nuevaFecha = nuevaFecha.concat( "-" ); + } + nuevaFecha = nuevaFecha.concat( arrays_numeros[j] ); + } + + //System.out.println("nuevaFecha: " + nuevaFecha); + return nuevaFecha; + } + + public static String getDiferenciaFechasMesOrDias(String fechaInicial, String fechaFinal){ + SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd"); + Date fecha1 = null ; + Date fecha2 = null ; + try { + fecha1 = dateFormatter.parse(fechaInicial); + fecha2 = dateFormatter.parse(fechaFinal); + + } catch (ParseException e) { + e.printStackTrace(); + } + + int milisecondsByDay = 86400000; + int dias = (int) ((fecha2.getTime()-fecha1.getTime()) / milisecondsByDay); + + String salida; + + if (dias < 30 ){ + salida = dias + " dias"; + } + else{ + int cantidadMeses = Math.round( ( dias / 30 ) ) ; + salida = (cantidadMeses > 1) ? cantidadMeses + " meses" : cantidadMeses + " mes"; + } + + return salida; + } + + +} \ No newline at end of file diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/GsonUtils.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/GsonUtils.java new file mode 100644 index 0000000..b7e733a --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/GsonUtils.java @@ -0,0 +1,43 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import com.google.gson.Gson; + +public class GsonUtils { + + /** + * Convierte de un objecto a un string + * @param src + * @return + */ + public static String serialize(Object src) { + Gson gson = new Gson(); + return gson.toJson(src); + } + + /** + * Convierte de string a un objecto + * @param + * @param json + * @param dClass + * @return + */ + public static D toObject(String json, Class dClass) { + Gson gson = new Gson(); + return gson.fromJson(json, dClass); + } + + /** + * Convierte de un objecto a otro objecto + * @param + * @param src + * @param dClass + * @return + */ + public static D toObject(Object src, Class dClass) { + + Gson gson = new Gson(); + String srcJson = gson.toJson(src); + return gson.fromJson(srcJson, dClass); + } + +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/HandleDate.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/HandleDate.java new file mode 100644 index 0000000..c30a6d8 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/HandleDate.java @@ -0,0 +1,90 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import java.text.SimpleDateFormat; +import java.time.DateTimeException; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.*; + +import org.springframework.stereotype.Component; + +@Component +public class HandleDate { + + private static TimeZone timeZone = TimeZone.getTimeZone("America/Bogota"); + + public Date retornDateNow() { + Date date = null; + try { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(timeZone); + date = Calendar.getInstance().getTime(); + } catch (Exception e) {} + return date; + } + + public String retornDateNowSimpleDateFormat() { + String date = null; + try { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(timeZone); + SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); + date = formatter.format(calendar.getTime()); + } catch (Exception e) {} + return date; + } + + public static Date retornDateByDay(int day) { + Date date = null; + try { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeZone(timeZone); + calendar.add(Calendar.DAY_OF_YEAR, -day); + date = calendar.getTime(); + } catch (Exception e) {} + return date; + } + + public static String retornDateTimeFormat(String date){ + String str = null; + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date d = sdf.parse(date); + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + str= sdf2.format(d); + } catch (Exception e) {} + return str; + } + + public Date retornDateToString(String d) { + Date date = null; + try { + Calendar calendar = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); + calendar.setTime(sdf.parse(d)); + calendar.setTimeZone(timeZone); + date = calendar.getTime(); + } catch (Exception e) {} + return date; + } + + public Long getMillisecondsFromStartDate(Date startdate) { + LocalDateTime startDateCast = startdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); + return startDateCast.until(LocalDateTime.now(), ChronoUnit.MILLIS); + } + + + public String getMonthInPhraseFromInt(int month ){ + String month_string = null; + String result = null; + try { + Locale locale = new Locale("es","ES"); + Calendar calendarInicio = Calendar.getInstance(); + calendarInicio.set(Calendar.MONTH, month-1); + month_string = calendarInicio.getDisplayName(Calendar.MONTH, Calendar.LONG, locale); + result = month_string.toUpperCase().charAt(0) + month_string.substring(1, month_string.length()).toLowerCase(); + }catch (DateTimeException e){} + return result; + } +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/LoggerFactory.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/LoggerFactory.java new file mode 100644 index 0000000..3f94421 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/LoggerFactory.java @@ -0,0 +1,29 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import org.slf4j.Logger; +import org.springframework.stereotype.Component; + +@Component +public class LoggerFactory { + private static final Logger logger = org.slf4j.LoggerFactory.getLogger(LoggerFactory.class); + + public void loggerTrace(String message, Object...objects){ + logger.trace(message, objects); + } + + public void loggerDebug(String message, Object...objects){ + logger.debug(message, objects); + } + + public void loggerError(String message, Object...objects){ + logger.error(message, objects); + } + + public void loggerInfo(String message, Object...objects){ + logger.info(message, objects); + } + + public void loggerWarn(String message, Object...objects){ + logger.warn(message, objects); + } +} diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/LoggerUtil.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/LoggerUtil.java new file mode 100644 index 0000000..3c4512d --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/LoggerUtil.java @@ -0,0 +1,58 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.log4j.Log4j2; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +@Component +@Log4j2 +@AllArgsConstructor +@NoArgsConstructor +public class LoggerUtil { + + @Value("${spring.application.name}") + private String app; + + @Value("${spring.application.version}") + private String version; + + @Value("${spring.application.name-log}") + private String nombreLog; + + @Async + public void logInfo(String message,Object...objects) { + log.info(message,objects); + + } + + @Async + public void logError(String message,Object...objects) { + log.error(message,objects); + } + + @Async + public void logError(Exception e) { + log.error(e); + + } + + @Async + public void logTrace(String message,Object...objects) { + log.info(message,objects); + + } + + @Data + public static class MessageObject { + + private Object message; + private String idProceso; + private String app; + private String type = "info"; + } + +} \ No newline at end of file diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/RestTemplateUtil.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/RestTemplateUtil.java new file mode 100644 index 0000000..49af1d5 --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/RestTemplateUtil.java @@ -0,0 +1,120 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import com.colsubsidio.api.fe.cronfeeventos.dto.ApigeeLogDTO; +import com.colsubsidio.api.fe.cronfeeventos.services.ApigeeService; +import com.google.gson.Gson; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestClientException; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +@Component +public class RestTemplateUtil { + + private static final String BEARER = "Bearer "; + + @Autowired + private ApigeeService tokenService; + @Autowired + private RestTemplate restTemplate; + @Autowired + private LoggerUtil logUtils; + + + @Bean + public RestTemplate restTemplate(RestTemplateBuilder builder) { + // Do any additional configuration here + return builder.build(); + } + + + public ResponseEntitysendRequest(UriComponentsBuilder uri,HttpMethod method ,Object body,Class classOfT,HttpHeaders headersAdd,boolean apigeeToken,String tag){ + long startTimeTry = System.currentTimeMillis(); + ResponseEntity resp = null; + ResponseEntity result = null; + HttpHeaders headers = headersAdd!= null ? headersAdd : new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + if(apigeeToken) + headers.add(HttpHeaders.AUTHORIZATION, BEARER + tokenService.getToken()); + + ApigeeLogDTO logServices = ApigeeLogDTO.builder() + .url(uri.toUriString()) + .body(body) + .method(method) + .headers(headers) + .error("") + .tag(tag) + .build(); + try { + HttpEntity entity = null; + entity = (body != null)?new HttpEntity<>(body,headers):new HttpEntity<>(headers); + resp = restTemplate.exchange(uri.toUriString(), method, entity, String.class); + + logUtils.logInfo("info: [RestTemplateUtil][sendRequest] el servicio responde: ", resp); + + T respClassOfT = new Gson().fromJson(resp.getBody(), classOfT); + result = new ResponseEntity<>(respClassOfT,resp.getHeaders(),resp.getStatusCode()); + long endTimeConn = System.currentTimeMillis() - startTimeTry; + logServices.setBodyResponse(result.getBody()); + logServices.setStatus((HttpStatus) result.getStatusCode()); + logServices.setTimeConn(endTimeConn); + logUtils.logInfo("apigee api ws response: ",logServices); + }catch (Exception e) { + logUtils.logError("Error: [RestTemplateUtil][sendRequest] excepcion: ",e.getMessage()); + buildLog(startTimeTry, resp, logServices, e); + } + return result; + } + + private void buildLog(long startTimeTry, ResponseEntity resp, ApigeeLogDTO logServices, Exception e) { + long endTimeConn = System.currentTimeMillis() - startTimeTry; + logServices.setBodyResponse(resp != null?resp.getBody():e.getMessage()); + logServices.setStatus(resp != null? (HttpStatus) resp.getStatusCode() : HttpStatus.INTERNAL_SERVER_ERROR); + logServices.setTimeConn(endTimeConn); + logServices.setError(e.getMessage()); + logUtils.logError(e.getMessage(),logServices); + } + + public ResponseEntitysendRequest(UriComponentsBuilder uri,HttpMethod method ,Object body,Class classOfT,HttpHeaders headersAdd,boolean apigeeToken,boolean isBodyJson){ + long startTimeTry = System.currentTimeMillis(); + ResponseEntity resp = null; + ResponseEntity result = null; + HttpHeaders headers = headersAdd!= null ? headersAdd : new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_JSON); + if(apigeeToken) + headers.add(HttpHeaders.AUTHORIZATION, BEARER + tokenService.getToken()); + + ApigeeLogDTO logServices = ApigeeLogDTO.builder() + .url(uri.toUriString()) + .body(body) + .method(method) + .headers(headers) + .error("") + .build(); + try { + HttpEntity entity = null; + entity = (body != null)?new HttpEntity<>(body,headers):new HttpEntity<>(headers); + resp = restTemplate.exchange(uri.toUriString(), method, entity, String.class); + if (classOfT != String.class) { + T respClassOfT = new Gson().fromJson(resp.getBody(), classOfT); + result = new ResponseEntity<>(respClassOfT,resp.getHeaders(),resp.getStatusCode()); + }else { + T respClassOfT = (T) resp; + result = new ResponseEntity<>(respClassOfT,resp.getHeaders(),resp.getStatusCode()); + } + + long endTimeConn = System.currentTimeMillis() - startTimeTry; + logServices.setBodyResponse(result.getBody()); + logServices.setStatus((HttpStatus) result.getStatusCode()); + logServices.setTimeConn(endTimeConn); + logUtils.logInfo("apigee api ws response: ",logServices); + }catch (Exception e) { + buildLog(startTimeTry, resp, logServices, e); + } + return result; + } +} \ No newline at end of file diff --git b/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/ValidateTemplateData.java a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/ValidateTemplateData.java new file mode 100644 index 0000000..43ba7ec --- /dev/null +++ a/src/main/java/com/colsubsidio/api/fe/cronfeeventos/util/ValidateTemplateData.java @@ -0,0 +1,229 @@ +package com.colsubsidio.api.fe.cronfeeventos.util; + +import com.colsubsidio.api.fe.cronfeeventos.config.ConfigProperties; +import com.colsubsidio.api.fe.cronfeeventos.dto.ResolucionDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.stereotype.Component; + +import java.sql.Date; +import java.time.LocalDate; +import java.time.chrono.ChronoLocalDate; +import java.time.temporal.ChronoUnit; + +@Component +public class ValidateTemplateData { + + + @Autowired + ConfigProperties configProperties; + public int secuenciaDisponibles (Long secuenciaSiguiente, Long numeroFinal){ + return Integer.parseInt(String.valueOf(numeroFinal)) - Integer.parseInt(String.valueOf(secuenciaSiguiente)); + } + + public String validateResolutions(int secuenciaDisponible, long numero_final, ResolucionDTO resolucionDTO){ + StringBuilder detalle = new StringBuilder(); + int valorQuincePorciento = 0, valorDiezPorciento = 0, valorCincoPorciento = 0; + + valorCincoPorciento = (Integer.parseInt(String.valueOf(numero_final)) * configProperties.getValor5()) / 100; + valorDiezPorciento = (Integer.parseInt(String.valueOf(numero_final)) * configProperties.getValor10()) / 100; + valorQuincePorciento = (Integer.parseInt(String.valueOf(numero_final)) * configProperties.getValor15()) / 100; + if(secuenciaDisponible == 0) { + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getPrefijo()) + .append("|") + .append(resolucionDTO.getNumero_final()) + .append("|") + .append(resolucionDTO.getSecuencia_siguiente()) + .append("|") + .append(secuenciaDisponible) + .append("|") + .append("0%"); + } else if(secuenciaDisponible <= valorCincoPorciento && secuenciaDisponible != 0){ + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getPrefijo()) + .append("|") + .append(resolucionDTO.getNumero_final()) + .append("|") + .append(resolucionDTO.getSecuencia_siguiente()) + .append("|") + .append(secuenciaDisponible) + .append("|") + .append("5%"); + } else if(secuenciaDisponible == valorDiezPorciento && secuenciaDisponible != 0) { + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getPrefijo()) + .append("|") + .append(resolucionDTO.getNumero_final()) + .append("|") + .append(resolucionDTO.getSecuencia_siguiente()) + .append("|") + .append(secuenciaDisponible) + .append("|") + .append("10%"); + } else if(secuenciaDisponible == valorQuincePorciento && secuenciaDisponible != 0){ + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getPrefijo()) + .append("|") + .append(resolucionDTO.getNumero_final()) + .append("|") + .append(resolucionDTO.getSecuencia_siguiente()) + .append("|") + .append(secuenciaDisponible) + .append("|") + .append("15%"); + } + return detalle.toString(); + } + public String validateFechaCaducidad(Date fecha_inicio, Date fecha_vencimiento){ + + String daysRemaining = "00"; + Date startDate = Date.valueOf(fecha_inicio.toString()); + Date expirationDate = Date.valueOf(fecha_vencimiento.toString()); + LocalDate startDateLocalDate = startDate.toLocalDate(); + LocalDate expirationLocalDate = expirationDate.toLocalDate(); + + if(LocalDate.now().getMonth().getValue() == expirationLocalDate.getMonth().getValue()){ + daysRemaining = String.valueOf(ChronoUnit.DAYS.between(startDateLocalDate, expirationLocalDate)); + } if(expirationLocalDate.isBefore(LocalDate.now())){ + daysRemaining = "-"+String.valueOf(ChronoUnit.DAYS.between(startDateLocalDate, expirationLocalDate)); + } + + return daysRemaining; + } + + public String detalleFechasCaducidad(ResolucionDTO resolucionDTO){ + StringBuilder detalle = new StringBuilder(); + String dias = validateFechaCaducidad(resolucionDTO.getFecha_inicio(), resolucionDTO.getFecha_vencimiento()); + + if(!dias.equals("00")){ + if(dias.equals("0")){ + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getFecha_inicio()) + .append("|") + .append(resolucionDTO.getFecha_vencimiento()) + .append("|") + .append(dias); + } else if(dias.equals("1")){ + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getFecha_inicio()) + .append("|") + .append(resolucionDTO.getFecha_vencimiento()) + .append("|") + .append(dias); + }else if(dias.equals("5")){ + + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getFecha_inicio()) + .append("|") + .append(resolucionDTO.getFecha_vencimiento()) + .append("|") + .append(dias); + }else if(dias.equals("10")){ + + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getFecha_inicio()) + .append("|") + .append(resolucionDTO.getFecha_vencimiento()) + .append("|") + .append(dias); + } else if(dias.equals("15")){ + + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getFecha_inicio()) + .append("|") + .append(resolucionDTO.getFecha_vencimiento()) + .append("|") + .append(dias); + } else if ( Integer.parseInt(dias) < 0 ){ + detalle.append("|") + .append(resolucionDTO.getResolucion()) + .append("|") + .append(resolucionDTO.getNombre_base()) + .append("|") + .append(resolucionDTO.getTienda_res()) + .append("|") + .append(resolucionDTO.getTerminal_res()) + .append("|") + .append(resolucionDTO.getFecha_inicio()) + .append("|") + .append(resolucionDTO.getFecha_vencimiento()) + .append("|") + .append(dias); + } + } + return detalle.toString(); + } +} diff --git b/src/main/resources/application.yml a/src/main/resources/application.yml new file mode 100644 index 0000000..5908ad0 --- /dev/null +++ a/src/main/resources/application.yml @@ -0,0 +1,3 @@ +spring: + config: + import: "file:./config/application.yml" diff --git b/src/test/java/com/colsubsidio/api/fe/cronfeeventos/CronDisparadorEventosFeApplicationTests.java a/src/test/java/com/colsubsidio/api/fe/cronfeeventos/CronDisparadorEventosFeApplicationTests.java new file mode 100644 index 0000000..adcf587 --- /dev/null +++ a/src/test/java/com/colsubsidio/api/fe/cronfeeventos/CronDisparadorEventosFeApplicationTests.java @@ -0,0 +1,13 @@ +package com.colsubsidio.api.fe.cronfeeventos; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class CronDisparadorEventosFeApplicationTests { + + @Test + void contextLoads() { + } + +}