From: Vásáry Dániel Date: Wed, 6 Mar 2024 13:21:56 +0000 (+0100) Subject: Resolving project problems X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=e8958850e62d6adc5fcfa3680fe0732b90867d00;p=sly-crm.git Resolving project problems --- diff --git a/deploy/application.yaml b/deploy/application.yaml new file mode 100644 index 0000000..fbb63df --- /dev/null +++ b/deploy/application.yaml @@ -0,0 +1,79 @@ +server: + port: 80 + servlet: + context-path: / +zk: + homepage: index + zul-view-resolver-enabled: true +spring: + jpa: + show-sql: false + properties: + hibernate: + format_sql: true + main: + banner-mode: off + output: + ansi: + enabled: always + datasource: + type: com.zaxxer.hikari.HikariDataSource + url: jdbc:db2://localhost:50000/lis + username: db2admin + password: Salabakt3r +camunda.bpm: + generic-properties.properties: + telemetry-reporter-activate: false + job-executor-acquire-by-priority: true + job-execution: + core-pool-size: 10 + #lock-time-in-millis: 600000 + database: + type: db2 + schema-update: false + table-prefix: CAMUNDA. + schema-name: CAMUNDA + webapp: + enabled: true + index-redirect-enabled: false + admin-user: + id: kermit + password: password + firstName: Kermit + filter: + create: All tasks + job-execution.enabled: true +logging: + config: logback-prod.xml + level: + org.hibernate.engine.jdbc.spi.SqlExceptionHelper: ERROR + org.springframework.web.clientRestTemplate: ERROR + logging.level.org.apache.http: ERROR + logging.level.httpclient.wire: ERROR +application: + ui: + user-name: + password: + export-temp-path: /tmp + disable-profile-save: false + workflow: + import-invoice: + input-path: /temp/invoice-import + project-id-pattern: \d{4}-\d{4} + old-project-id-pattern: \d{8} +service: + nav: + trust: + store: classpath:keystore/lis-keystore.jks + store.password: password + api: + url: https://api.onlineszamla.nav.gov.hu/invoiceService/v3 + user: dufwfvhquolizk4 + password: Pbd6Mnkt9g + sign-key: 05-967b-0e5227e11ca44GF1ZEUBSX8F + exchange-key: a5c24GF1ZEUBUGIK + sender-tax-number: 13799504 + sender-company: USER RENDSZERHÁZ Informatikai Korlátolt Felelősségű Társaság + sender-country: HU + sender-contact: Kovács Géza + days-range: 34 \ No newline at end of file diff --git a/deploy/logback-prod.xml b/deploy/logback-prod.xml new file mode 100644 index 0000000..db740ef --- /dev/null +++ b/deploy/logback-prod.xml @@ -0,0 +1,45 @@ + + + + + + + + + %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable + + + + + + ${LOGS}/sly-crm.log + + %d %p %C{1.} [%t] %m%n + + + + + ${LOGS}/archived/sly-crm-app-%d{yyyy-MM-dd}.%i.log + + + 10MB + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deploy/start.sh b/deploy/start.sh index ce89895..a78c752 100644 --- a/deploy/start.sh +++ b/deploy/start.sh @@ -1,2 +1,2 @@ #!/bin/bash -java -DSLY-CRM-APPLICATION -jar /opt/slycrm/sly-crm-app.jar +java -DSLY-CRM-APPLICATION -Dspring.profiles.active=prod -jar /opt/slycrm/sly-crm-app.jar diff --git a/sly-crm-app/src/main/resources/application-test.yaml b/sly-crm-app/src/main/resources/application-test.yaml index 8206eec..7398ac4 100644 --- a/sly-crm-app/src/main/resources/application-test.yaml +++ b/sly-crm-app/src/main/resources/application-test.yaml @@ -22,7 +22,7 @@ spring: type: com.zaxxer.hikari.HikariDataSource url: jdbc:db2://dvdev.in.useribm.hu:50000/lis username: db2admin - password: password + password: Salabakt3r camunda.bpm: generic-properties.properties: telemetry-reporter-activate: false @@ -66,9 +66,13 @@ service: store: classpath:keystore/lis-keystore.jks store.password: password api: - url: https://api-test.onlineszamla.nav.gov.hu/invoiceService/v3 - user: vkvyibj5xgqpbp0 - password: Salabakt3r - sign-key: fe-9d8b-971c878376204BQEWTHH2HI6 - exchange-key: 3af24BQEWTHH4TSX - sender-tax-number: 13364937 + url: https://api.onlineszamla.nav.gov.hu/invoiceService/v3 + user: dufwfvhquolizk4 + password: Pbd6Mnkt9g + sign-key: 05-967b-0e5227e11ca44GF1ZEUBSX8F + exchange-key: a5c24GF1ZEUBUGIK + sender-tax-number: 13799504 + sender-company: USER RENDSZERHÁZ Informatikai Korlátolt Felel?sség? Társaság + sender-country: HU + sender-contact: Kovács Géza + days-range: 34 \ No newline at end of file diff --git a/sly-crm-app/src/main/resources/keystore/lis-keystore.jks b/sly-crm-app/src/main/resources/keystore/lis-keystore.jks index 5c8c335..d53b743 100644 Binary files a/sly-crm-app/src/main/resources/keystore/lis-keystore.jks and b/sly-crm-app/src/main/resources/keystore/lis-keystore.jks differ diff --git a/sly-crm-app/src/test/java/hu/user/lis/RepositoryIT.java b/sly-crm-app/src/test/java/hu/user/lis/RepositoryIT.java index 6475371..8644512 100644 --- a/sly-crm-app/src/test/java/hu/user/lis/RepositoryIT.java +++ b/sly-crm-app/src/test/java/hu/user/lis/RepositoryIT.java @@ -5,8 +5,18 @@ package hu.user.lis; -import hu.user.lis.db.*; -import hu.user.lis.db.repository.*; +import hu.user.lis.db.Currency; +import hu.user.lis.db.IncomingInvoice; +import hu.user.lis.db.Invoice; +import hu.user.lis.db.InvoiceImport; +import hu.user.lis.db.Project; +import hu.user.lis.db.ServiceRecord; +import hu.user.lis.db.Treasury; +import hu.user.lis.db.repository.InvoiceImportRepository; +import hu.user.lis.db.repository.InvoiceRepository; +import hu.user.lis.db.repository.ProjectRepository; +import hu.user.lis.db.repository.ServiceRecordRepository; +import hu.user.lis.db.repository.TreasuryRepository; import hu.user.lis.service.data.ProjectService; import hu.user.lis.service.data.TreasuryService; import lombok.extern.log4j.Log4j2; @@ -22,6 +32,7 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.persistence.EntityNotFoundException; import java.util.Arrays; import java.util.List; +import java.util.Optional; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -53,6 +64,7 @@ public class RepositoryIT { @Autowired private InvoiceRepository invoiceRepository; + @Test public void testRepositoryCapabilities() { List allItems = serviceRecordRepository.findAll(); @@ -128,4 +140,10 @@ public class RepositoryIT { invoiceImportRepository.delete(invoiceImport); } + + @Test + public void testImportInvoiceInvoiceCreateDate() { + Optional importDate = invoiceImportRepository.findTopByOrderByInvoiceCreateDateDesc(); + log.info(importDate); + } } diff --git a/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java b/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java index 34753ed..06d8742 100644 --- a/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java +++ b/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java @@ -7,7 +7,11 @@ package hu.user.lis.workflow; import hu.gov.nav.schemas.ntca._1_0.common.BasicResultType; import hu.gov.nav.schemas.ntca._1_0.common.FunctionCodeType; -import hu.gov.nav.schemas.osa._3_0.api.*; +import hu.gov.nav.schemas.osa._3_0.api.InvoiceDigestResultType; +import hu.gov.nav.schemas.osa._3_0.api.InvoiceDigestType; +import hu.gov.nav.schemas.osa._3_0.api.InvoiceDirectionType; +import hu.gov.nav.schemas.osa._3_0.api.QueryInvoiceDigestRequest; +import hu.gov.nav.schemas.osa._3_0.api.QueryInvoiceDigestResponse; import hu.gov.nav.schemas.osa._3_0.data.InvoiceData; import hu.user.lis.db.IncomingInvoice; import hu.user.lis.service.nav.TaxOfficeInvoiceService; @@ -48,7 +52,7 @@ import java.util.concurrent.TimeUnit; @Log4j2 @SpringBootTest @RunWith(SpringRunner.class) -@ActiveProfiles("test") +@ActiveProfiles("dev") @ComponentScan("hu.user.lis") //@TestPropertySource("classpath:application-test.yaml") public class TaxOfficeInvoiceApiIT { @@ -157,7 +161,7 @@ public class TaxOfficeInvoiceApiIT { int availablePages = 1; int currentPage = 1; while (currentPage <= availablePages) { - Optional response = taxOfficeInvoiceService.queryInboundInvoices(currentPage, 5, 34); + Optional response = taxOfficeInvoiceService.queryInboundInvoices(currentPage, 0, 5); if (!response.isPresent()) { break; } diff --git a/sly-crm-db/migrations/environments/test.properties b/sly-crm-db/migrations/environments/test.properties index c5d02a9..8618bd6 100644 --- a/sly-crm-db/migrations/environments/test.properties +++ b/sly-crm-db/migrations/environments/test.properties @@ -6,7 +6,7 @@ script_char_set=UTF-8 driver=com.ibm.db2.jcc.DB2Driver url=jdbc:db2://dvdev.in.useribm.hu:50000/lis username=db2admin -password=password +password=Salabakt3r # # A NOTE ON STORED PROCEDURES AND DELIMITERS # diff --git a/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java b/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java index 67c434e..2a13a8e 100644 --- a/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java +++ b/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java @@ -1,9 +1,11 @@ package hu.user.lis.service.nav; +import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; +import org.apache.http.ssl.TrustStrategy; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -32,17 +34,9 @@ public class RestTemplateSSLConfiguration { public RestTemplate restTemplate() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException { + SSLContext sslContext = new SSLContextBuilder() .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build(); - -// TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true; -// SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom() -// .loadTrustMaterial(null, acceptingTrustStrategy) -// .build(); - -// SSLConnectionSocketFactory sslConFactory = new SSLConnectionSocketFactory(sslContext, -// new String[]{"TLSv1.2", "TLSv1.1"}, null, -// (hostname, session) -> true); SSLConnectionSocketFactory sslConFactory = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslConFactory).build(); @@ -50,4 +44,16 @@ public class RestTemplateSSLConfiguration { return new RestTemplate(requestFactory); } + + @Bean + public RestTemplate restTemplate2() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, + CertificateException, IOException { + TrustStrategy acceptingTrustStrategy = (x509Certificates, s) -> true; + SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); + SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); + CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); + requestFactory.setHttpClient(httpClient); + return new RestTemplate(requestFactory); + } } \ No newline at end of file diff --git a/sly-crm-ui/src/main/java/hu/user/lis/ui/config/WebSecurityConfig.java b/sly-crm-ui/src/main/java/hu/user/lis/ui/config/WebSecurityConfig.java index 7b3f801..bfbadba 100644 --- a/sly-crm-ui/src/main/java/hu/user/lis/ui/config/WebSecurityConfig.java +++ b/sly-crm-ui/src/main/java/hu/user/lis/ui/config/WebSecurityConfig.java @@ -22,7 +22,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public static final String REMOVE_DESKTOP_REGEX = "/zkau\\?dtid=.*&cmd_0=rmDesktop&.*"; - public static final String[] ZK_RESOURCES = {"/zkau/web/**/js/**", "/zkau/web/**/zul/css/**", "/zkau/web/**/zul/less/**", "/zkau/web/**/img/**", "/zkau/web/**/static/**"}; + public static final String[] ZK_RESOURCES = {"/zkau/web/**/js/**", "/zkau/web/**/zul/css/**", "/zkau/web/**/zul/less/**", "/zkau/web/**/img/**", "/zkau/web/**/static/**", "/engine-rest/**"}; @Autowired LocalAuthProvider localAuthProvider; diff --git a/sly-crm-workflow/src/main/java/hu/user/lis/workflow/invoice/service/WorkflowManagerService.java b/sly-crm-workflow/src/main/java/hu/user/lis/workflow/invoice/service/WorkflowManagerService.java index 00e1cf5..afcac63 100644 --- a/sly-crm-workflow/src/main/java/hu/user/lis/workflow/invoice/service/WorkflowManagerService.java +++ b/sly-crm-workflow/src/main/java/hu/user/lis/workflow/invoice/service/WorkflowManagerService.java @@ -77,16 +77,16 @@ public class WorkflowManagerService { } public void cancelInvoiceImportProcess(boolean onlyImport) { - List processInstances = runtimeService.createProcessInstanceQuery().list(); + List processInstances; + if (onlyImport) { + processInstances = runtimeService.createProcessInstanceQuery().processDefinitionKey(IMPORT_INCOMING_INVOICES).active().list(); + } else { + processInstances = runtimeService.createProcessInstanceQuery().active().list(); + } + log.info("Found process instance count {}", (long) processInstances.size()); processInstances.forEach(p -> { log.info("Found process instance {} {} {}", p.getProcessInstanceId(), p.getProcessDefinitionId(), p.isSuspended()); - if (onlyImport) { - if (IMPORT_INCOMING_INVOICES.equals(p.getProcessDefinitionId())) { - killProcess(p); - } - } else { - killProcess(p); - } + killProcess(p); }); }