From 1acd22f334394215c155dca68fe1dd2ac53b58cc Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Mon, 24 Feb 2025 18:05:40 +0100 Subject: [PATCH] update businesspartner workflow --- Dockerfile | 3 +- doc/BUSINESSPARTNER.md | 10 + doc/METRICS.md | 35 ++ .../AGLAnalyticControllerDebitor.java | 10 +- .../BusinessPartnerController.java | 67 ++- .../api/BusinessPartnerRestService.java | 104 ----- .../xml/BusinessPartnerImportService.java | 2 +- .../src/main/webapp/layout/css/custom.css | 26 ++ .../forms/alexander/section_bp_dunnings.xhtml | 49 ++ .../alexander/section_bp_invoices_in.xhtml | 49 ++ .../alexander/section_bp_invoices_out.xhtml | 51 +++ pom.xml | 4 +- workflow/businesspartner-de-1.0.0.bpmn | 422 ++++++++++++++---- 13 files changed, 630 insertions(+), 202 deletions(-) create mode 100644 doc/METRICS.md delete mode 100644 office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/BusinessPartnerRestService.java create mode 100644 office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_dunnings.xhtml create mode 100644 office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_in.xhtml create mode 100644 office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_out.xhtml diff --git a/Dockerfile b/Dockerfile index f09b0f9..fcc2d39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM imixs/imixs-office-workflow:5.0.3-SNAPSHOT +FROM imixs/imixs-office-workflow:5.1.1-SNAPSHOT +#FROM imixs/imixs-office-workflow:5.0.3-SNAPSHOT # Setup debug configuration diff --git a/doc/BUSINESSPARTNER.md b/doc/BUSINESSPARTNER.md index 7a9b900..b6c7613 100644 --- a/doc/BUSINESSPARTNER.md +++ b/doc/BUSINESSPARTNER.md @@ -37,3 +37,13 @@ Alternativ kann im Backend über die EJB BusinessPartnerService nach bpid gesuch // oder ItemCollection bp= businessPartnerService.getBusinessPartnerByID("BP0001"); ``` + +# Daten Migration + +\_vendor_zip_code + +\_vendor_fax + + (type:cargosoftkreditor) AND ($modified:[20010101 TO 20250215]) + +Wir müssen gundsätzlich erstmal über all $nosnapshot = true eintragen! diff --git a/doc/METRICS.md b/doc/METRICS.md new file mode 100644 index 0000000..1b790d3 --- /dev/null +++ b/doc/METRICS.md @@ -0,0 +1,35 @@ +Curl + + $ curl -s http://localhost:9990/metrics + + + $ curl -s http://localhost:9990/metrics | grep BP4218 + +``` + +application_dbtr_balance{country="", currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 60911.28 +application_dbtr_balance{country="US",currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 257955.41 + + +application_dbtr_sales{country="", currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 60911.28 +application_dbtr_sales{country="US", currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 279028.91 + + +``` + +Rayonier Advanced Materials + +Debitor 74218 + +293.535,19 EUR + +Metric saldo: 318866.69 + +# Jetzt berechnen wir neu... + +https://alexander-logistics.office-workflow.de/api/metrics/dbtr/rebuild + +application_dbtr_balance{country="", currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 60911.28 +application_dbtr_balance{country="US",currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 364457.85 +application_dbtr_sales{country="", currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 60911.28 +application_dbtr_sales{country="US", currency="EUR",department="Import Zellulose/Holz",id="BP4218",name="Rayonier Advanced Materials",type="dbtr"} 364457.85 diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerDebitor.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerDebitor.java index 81c382b..d879912 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerDebitor.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/AGLAnalyticControllerDebitor.java @@ -84,11 +84,17 @@ public class AGLAnalyticControllerDebitor implements Serializable { String chartData = ""; public void onEvent(@Observes AnalyticEvent event) { - if (!"workitem".equals(event.getWorkitem().getType()) - || !event.getWorkitem().getModelVersion().startsWith("analyse-debitor")) { + if (!"workitem".equals(event.getWorkitem().getType())) { // no op return; } + + if (!event.getWorkitem().getModelVersion().startsWith("businesspartner") + && !event.getWorkitem().getModelVersion().startsWith("analyse-debitor")) { + // no op + return; + } + String dbtrNumber = event.getWorkitem().getItemValueString("dbtr.number"); String dbtrNumberLast = event.getWorkitem().getItemValueString("dbtr.number.last"); diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java index 614f694..c1d3b9a 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerController.java @@ -36,6 +36,7 @@ import java.util.regex.Pattern; import org.imixs.workflow.ItemCollection; import org.imixs.workflow.engine.DocumentService; import org.imixs.workflow.exceptions.AccessDeniedException; +import org.imixs.workflow.exceptions.QueryException; import org.imixs.workflow.faces.data.WorkflowEvent; import jakarta.enterprise.context.ConversationScoped; @@ -62,6 +63,9 @@ public class BusinessPartnerController implements Serializable { private static final long serialVersionUID = 1L; protected List ibanList = null; + protected List invoicesOut = null; + protected List invoicesIn = null; + protected List dunnings = null; @Inject DocumentService documentService; @@ -73,6 +77,27 @@ public class BusinessPartnerController implements Serializable { private static Logger logger = Logger.getLogger(BusinessPartnerController.class.getName()); + public List getInvoicesOut() { + if (invoicesOut == null) { + invoicesOut = new ArrayList<>(); + } + return invoicesOut; + } + + public List getInvoicesIn() { + if (invoicesIn == null) { + invoicesIn = new ArrayList<>(); + } + return invoicesIn; + } + + public List getDunnings() { + if (dunnings == null) { + dunnings = new ArrayList<>(); + } + return dunnings; + } + /** * This method searches a text phrase within the list of DATEV kreditoren *

@@ -149,7 +174,7 @@ public class BusinessPartnerController implements Serializable { int eventType = workflowEvent.getEventType(); ItemCollection workitem = workflowEvent.getWorkitem(); - if (workitem == null) { + if (workitem == null || !workitem.getModelVersion().startsWith("businesspartner-")) { return; } @@ -157,6 +182,7 @@ public class BusinessPartnerController implements Serializable { if (WorkflowEvent.WORKITEM_CHANGED == eventType || WorkflowEvent.WORKITEM_CREATED == eventType) { // reset state ibanList = BusinessPartnerService.explodeBanks(workitem); + loadStats(workitem); } // before the workitem is saved we update the field txtOrderItems @@ -171,6 +197,45 @@ public class BusinessPartnerController implements Serializable { } + /** + * Hilfsmethode die die offenen Rechnungen läd. Wird von WorktiemChanged Event + * aufgerufen. + * + * @param workitem + */ + private void loadStats(ItemCollection workitem) { + + try { + // Ausgangsrechnungen + String dbtrNumber = workitem.getItemValueString("dbtr.number"); + if (!dbtrNumber.isEmpty()) { + if (dbtrNumber.startsWith("D")) { + dbtrNumber = dbtrNumber.substring(1); + } + String query = "(type:workitem) AND ($modelversion:rechnungsausgang-*) " + + " AND (dbtr.number:" + dbtrNumber + ")"; + invoicesOut = documentService.findStubs(query, 999, 0, "invoice.number", false); + + // Mahnungen + query = "(type:workitem) AND ($modelversion:mahnlauf-*) " + + " AND (dbtr.number:" + dbtrNumber + ")"; + dunnings = documentService.findStubs(query, 999, 0, "invoice.number", false); + } + + // Eingangsrechnungen + String cdtrNumber = workitem.getItemValueString("cdtr.number"); + if (!cdtrNumber.isEmpty()) { + String query = "(type:workitem) AND ($modelversion:rechnungseingang-*) " + + " AND (cdtr.number:" + cdtrNumber + ")"; + invoicesIn = documentService.findStubs(query, 999, 0, "invoice.number", false); + } + + } catch (QueryException e) { + logger.severe("failed to load stats: " + e.getMessage()); + } + + } + public List getIbanList() { return ibanList; } diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/BusinessPartnerRestService.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/BusinessPartnerRestService.java deleted file mode 100644 index bf0771c..0000000 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/BusinessPartnerRestService.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Imixs-Workflow - * - * Copyright (C) 2001-2020 Imixs Software Solutions GmbH, - * http://www.imixs.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You can receive a copy of the GNU General Public - * License at http://www.gnu.org/licenses/gpl.html - * - * Project: - * https://www.imixs.org - * https://github.com/imixs/imixs-workflow - * - * Contributors: - * Imixs Software Solutions GmbH - Project Management - * Ralph Soika - Software Developer - */ - -package com.alexanderlogistics.api; - -import java.util.logging.Logger; - -import org.imixs.workflow.ItemCollection; -import org.imixs.workflow.exceptions.QueryException; -import org.imixs.workflow.jaxrs.DocumentRestService; - -import com.alexanderlogistics.BusinessPartnerService; - -import jakarta.ejb.Stateless; -import jakarta.inject.Inject; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -/** - * BusinessPartnerRestService api endpoint '/businesspartner' provides methods - * to read and post business partner data - * - * @version 1.0 - * @author rsoika - * - */ -@Stateless -@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_XHTML_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, - MediaType.TEXT_XML }) -@Path("/businesspartner") -public class BusinessPartnerRestService { - - @Inject - DocumentRestService documentRestService; - - @Inject - BusinessPartnerService businessPartnerService; - - private static Logger logger = Logger.getLogger(BusinessPartnerRestService.class.getName()); - - @GET - @Path("/ping") - public String ping() { - logger.info("GET ping"); - return "ping: " + System.currentTimeMillis(); - } - - /** - * Test method - * - * @param workflowgroup - * @param task - * @return - * @throws QueryException - */ - @GET - @Path("/{bpid}") - @Produces({ MediaType.TEXT_HTML }) - public Response getBusinessPartnerByID(@PathParam("bpid") String bpid, - @QueryParam("items") String items, - @QueryParam("format") String format) - throws QueryException { - - ItemCollection workitem = businessPartnerService.getBusinessPartnerByID(bpid); - if (workitem == null) { - // document not found - return Response.status(Response.Status.NOT_FOUND).build(); - } - - return documentRestService.convertResult(workitem, items, format); - - } - -} diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java index 8c238b6..286076f 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java @@ -123,7 +123,7 @@ public class BusinessPartnerImportService { return; } - logger.info("Verify business partner object...."); + logger.fine("Verify business partner object...."); ItemCollection importDoc = event.getDocument(); String name = event.getDocument().getItemValueString("name"); diff --git a/office-alexander-logistics-app/src/main/webapp/layout/css/custom.css b/office-alexander-logistics-app/src/main/webapp/layout/css/custom.css index 47eb6c4..007f3b9 100644 --- a/office-alexander-logistics-app/src/main/webapp/layout/css/custom.css +++ b/office-alexander-logistics-app/src/main/webapp/layout/css/custom.css @@ -7,4 +7,30 @@ !important; background-position: 4px 6px, center !important; padding-left: 22px !important; +} +.tooltip-link { + position: relative; + display: inline-block; +} + +.tooltip-text { + visibility: hidden; + width: 300px; + background-color: black; + color: #fff; + text-align: center; + border-radius: 5px; + padding: 5px; + position: absolute; + z-index: 1; + bottom: 125%; /* Position above the link */ + left: 50%; + margin-left: -150px; /* Center the tooltip */ + opacity: 0; + transition: opacity 0.3s; +} + +.tooltip-link:hover .tooltip-text { + visibility: visible; + opacity: 1; } \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_dunnings.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_dunnings.xhtml new file mode 100644 index 0000000..2fe56af --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_dunnings.xhtml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MahnungStatus#{message.modified}
+ #{dunning.item['$workflowsummary']} + + #{dunning.item['$workflowstatus']} + + #{message.by} #{userController.getUserName(dunning.item['$editor'])}
+
+ + + + + +
\ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_in.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_in.xhtml new file mode 100644 index 0000000..c18ea6e --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_in.xhtml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RechnungStatus#{message.modified}
+ #{invoice.item['$workflowsummary']} + + #{invoice.item['$workflowstatus']} + + #{message.by} #{userController.getUserName(invoice.item['$editor'])}
+
+ + + + + +
\ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_out.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_out.xhtml new file mode 100644 index 0000000..5068d04 --- /dev/null +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_bp_invoices_out.xhtml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RechnungStatus#{message.modified}
+ #{invoice.item['$workflowsummary']} + + + + + + #{invoice.item['$workflowstatus']} + + #{message.by} #{userController.getUserName(invoice.item['$editor'])}
+
+ + + + + +
\ No newline at end of file diff --git a/pom.xml b/pom.xml index f634655..4fa2f62 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,9 @@ 5.0.4 6.0.9 5.0.0 - 3.0.2 + + + 3.1.1-SNAPSHOT 3.0.3 2.0.2 6.0 diff --git a/workflow/businesspartner-de-1.0.0.bpmn b/workflow/businesspartner-de-1.0.0.bpmn index 99777e7..226b47c 100644 --- a/workflow/businesspartner-de-1.0.0.bpmn +++ b/workflow/businesspartner-de-1.0.0.bpmn @@ -60,6 +60,13 @@ event_i7yQVw gateway_uK0c6g event_6250fg + event_VM0fEQ + gateway_s0J53g + task_NohgrQ + event_AMs05g + event_feLZFQ + event_GTXFMw + event_u8OBFg @@ -134,6 +141,8 @@ sequenceFlow_T5L9aQ sequenceFlow_b4BcVA sequenceFlow_8O1EtQ + sequenceFlow_ShuXXA + sequenceFlow_03b60w @@ -170,6 +179,9 @@ + + + sequenceFlow_1mXO8A @@ -201,11 +213,14 @@ + + home]]> + sequenceFlow_1mXO8A sequenceFlow_b0Bj3Q - sequenceFlow_T5L9aQ + sequenceFlow_neSsFQ @@ -214,37 +229,59 @@ - - - - - - + - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - + - - - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + ]]> @@ -352,22 +389,28 @@ - - - + + Partnermanagement]]> + - sequenceFlow_iwMsIg sequenceFlow_BHsRkQ + sequenceFlow_5pT4Tw - + + + + + + home]]> + sequenceFlow_pvIENQ @@ -384,9 +427,6 @@ - - - @@ -398,6 +438,14 @@ + + + Partnermanagement]]> + + + + + sequenceFlow_ofWWuw @@ -407,21 +455,18 @@ - + sequenceFlow_S9LVXg sequenceFlow_jAU3VA - sequenceFlow_iwMsIg + sequenceFlow_8BTEtw - - - @@ -438,6 +483,122 @@ + + + + Partnermanagement]]> + + + + + + + sequenceFlow_T5L9aQ + sequenceFlow_MPlPww + + sequenceFlow_rNZ3tw + + + + sequenceFlow_MPlPww + sequenceFlow_aH0vCQ + sequenceFlow_ShuXXA + + + + + + + + partner.name (partner.id)]]> + + + Adresse:
+partner.name
+partner.address
+partner.zip partner.city
+
+ +BPID: partner.id
+Kreditoren-Nr.: cdtr.number
+Debitoren-Nr.: dbtr.number
+]]>
+
+ + + + + + + + + + + + + + + + + + +
+ + sequenceFlow_9atLFA + sequenceFlow_8O1EtQ + sequenceFlow_aH0vCQ + sequenceFlow_neSsFQ + sequenceFlow_zd6RWA + sequenceFlow_rNZ3tw +
+ + + + + + + + + + + + + + + + + sequenceFlow_5pT4Tw + + + + + sequenceFlow_8BTEtw + + + + + + + + + + + sequenceFlow_03b60w + + + + + + + + sequenceFlow_zd6RWA + + + + + + + @@ -467,7 +628,7 @@ - + @@ -497,43 +658,43 @@ - + - + - + - + - - - + + + - - - - + + + + - + - + - - - + + + @@ -547,58 +708,58 @@ - + - + - + - + - + - - + + - - + + - + - + - - - + + + - + - + - - - + + + - + - - - + + + @@ -610,24 +771,19 @@ - - - - - - - + + - - - - + + + + - + @@ -640,6 +796,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +