neue modelle - minor fixes
This commit is contained in:
parent
00e2dde892
commit
ac2bc4bfe8
4 changed files with 4294 additions and 6 deletions
|
|
@ -35,6 +35,7 @@ import java.text.ParseException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
|
|
@ -47,6 +48,7 @@ import javax.xml.xpath.XPathExpression;
|
|||
import javax.xml.xpath.XPathExpressionException;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.imixs.marty.team.TeamService;
|
||||
import org.imixs.workflow.FileData;
|
||||
import org.imixs.workflow.ItemCollection;
|
||||
import org.imixs.workflow.engine.DocumentService;
|
||||
|
|
@ -62,12 +64,14 @@ import org.xml.sax.InputSource;
|
|||
import org.xml.sax.SAXException;
|
||||
|
||||
import com.alexanderlogistics.InvoiceUtil;
|
||||
import com.alexanderlogistics.mahnlauf.MahnlaufService;
|
||||
import com.alexanderlogistics.xml.CargosoftXMLInvoiceImportService;
|
||||
|
||||
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.core.MediaType;
|
||||
|
||||
|
|
@ -102,12 +106,175 @@ public class CargosoftMigrationRestService implements Serializable {
|
|||
@Inject
|
||||
WorkflowService workflowService;
|
||||
|
||||
@Inject
|
||||
MahnlaufService mahnlaufService;
|
||||
|
||||
@Inject
|
||||
TeamService teamService;
|
||||
|
||||
private static Logger logger = Logger.getLogger(CargosoftMigrationRestService.class.getName());
|
||||
|
||||
public CargosoftMigrationRestService() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dieser Endpunkt akutalisiert alle ausgehenden noch offenen Rechnungen in
|
||||
* Bezug auf die Abteilungszugehörigkeit.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @throws QueryException
|
||||
* @throws AccessDeniedException
|
||||
* @throws ProcessingErrorException
|
||||
* @throws PluginException
|
||||
* @throws ModelException
|
||||
*/
|
||||
@GET
|
||||
@Path("/invoices/fix/spaces")
|
||||
@Produces({ MediaType.TEXT_PLAIN })
|
||||
public String updateInvoiceSpacesAssignment()
|
||||
throws QueryException, AccessDeniedException, ProcessingErrorException, PluginException, ModelException {
|
||||
count = 0;
|
||||
String query = "($modelversion:rechnungsausgang-de-1.0) AND (type:workitem)";
|
||||
// "AND $taskid:[20240604 TO 20240701]";
|
||||
logger.info("query=" + query);
|
||||
log = "Update Space Assignment in Outgoing Invoices\n\n" + query;
|
||||
|
||||
List<ItemCollection> result = documentService.find(query, 9999, 0);
|
||||
log = log + " " + new Date() + "\n\n";
|
||||
log = log + "\n\nFound " + result.size() + " open invoices.";
|
||||
|
||||
// load spaces Pos Expressions
|
||||
Map<String, List<String>> spacePosMappings = mahnlaufService.loadSpacePosMappings();
|
||||
|
||||
for (ItemCollection invoice : result) {
|
||||
|
||||
String oldSpaceRef = invoice.getItemValueString("space.ref");
|
||||
mahnlaufService.mapInvoiceTextToSpace(invoice, spacePosMappings);
|
||||
String newSpaceRef = invoice.getItemValueString("space.ref");
|
||||
if (newSpaceRef.isEmpty()) {
|
||||
// wir dürfen die space.ref nicht löschen!
|
||||
continue;
|
||||
}
|
||||
// change?
|
||||
if (!oldSpaceRef.equals(newSpaceRef)) {
|
||||
count++;
|
||||
logger.info("...fix invoice: " + invoice.getUniqueID());
|
||||
// lookup space
|
||||
ItemCollection space = documentService.load(newSpaceRef);
|
||||
invoice.setItemValue("space.name", space.getItemValueString("name"));
|
||||
invoice.setItemValue("migration.space.ref", oldSpaceRef);
|
||||
documentService.save(invoice);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log = log + "\n\n=== Completed! " + count + " fixes! ===\n\n";
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dieser Endpunkt akutalisiert alle ausgehenden noch offenen Rechnungen in
|
||||
* Bezug auf die Abteilungszugehörigkeit.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @throws QueryException
|
||||
* @throws AccessDeniedException
|
||||
* @throws ProcessingErrorException
|
||||
* @throws PluginException
|
||||
* @throws ModelException
|
||||
*/
|
||||
@GET
|
||||
@Path("/invoices/fix/index/{page}")
|
||||
@Produces({ MediaType.TEXT_PLAIN })
|
||||
public String updateInvoiceIndex(@PathParam("page") int page)
|
||||
throws QueryException, AccessDeniedException, ProcessingErrorException, PluginException, ModelException {
|
||||
count = 0;
|
||||
String query = "($modelversion:rechnungsausgang-de-1.0) AND (type:workitem)";
|
||||
|
||||
logger.info("query=" + query);
|
||||
log = "Update index Invoices\n\n" + query;
|
||||
|
||||
List<ItemCollection> result = documentService.find(query, 100, page);
|
||||
log = log + " " + new Date() + "\n\n";
|
||||
log = log + " size= 500 page=" + page + "\n\n";
|
||||
log = log + "\n\nFound " + result.size() + " open invoices.";
|
||||
|
||||
logger.info("Found " + result.size() + " open invoices.");
|
||||
for (ItemCollection invoice : result) {
|
||||
|
||||
documentService.save(invoice);
|
||||
|
||||
count++;
|
||||
logger.info("... update index " + invoice.getUniqueID());
|
||||
|
||||
}
|
||||
|
||||
log = log + "\n\n=== Completed! " + count + " fixes! ===\n\n";
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dieser Endpunkt akutalisiert alle ausgehenden noch offenen Rechnungen in
|
||||
* Bezug auf die Abteilungszugehörigkeit.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
* @throws QueryException
|
||||
* @throws AccessDeniedException
|
||||
* @throws ProcessingErrorException
|
||||
* @throws PluginException
|
||||
* @throws ModelException
|
||||
*/
|
||||
@GET
|
||||
@Path("/steuerbescheide/fix/spaces")
|
||||
@Produces({ MediaType.TEXT_PLAIN })
|
||||
public String updateSteuerbescheideSpacesAssignment()
|
||||
throws QueryException, AccessDeniedException, ProcessingErrorException, PluginException, ModelException {
|
||||
count = 0;
|
||||
String query = "($modelversion:steuerbescheid-de-1.0) AND (type:workitem)";
|
||||
// "AND $taskid:[20240604 TO 20240701]";
|
||||
logger.info("query=" + query);
|
||||
log = "Update Space Assignment in Steuerbescheide\n\n" + query;
|
||||
|
||||
List<ItemCollection> result = documentService.find(query, 9999, 0);
|
||||
|
||||
log = log + " " + new Date() + "\n\n";
|
||||
log = log + "\n\nFound " + result.size() + " open steuerbescheide.";
|
||||
|
||||
// load spaces Pos Expressions
|
||||
Map<String, List<String>> spacePosMappings = mahnlaufService.loadSpacePosMappings();
|
||||
|
||||
for (ItemCollection invoice : result) {
|
||||
|
||||
String oldSpaceRef = invoice.getItemValueString("space.ref");
|
||||
mahnlaufService.mapInvoiceTextToSpace(invoice, spacePosMappings);
|
||||
String newSpaceRef = invoice.getItemValueString("space.ref");
|
||||
if (newSpaceRef.isEmpty()) {
|
||||
// wir dürfen die space.ref nicht löschen!
|
||||
continue;
|
||||
}
|
||||
// change?
|
||||
if (!oldSpaceRef.equals(newSpaceRef)) {
|
||||
count++;
|
||||
logger.info("...fix invoice: " + invoice.getUniqueID());
|
||||
// lookup space
|
||||
ItemCollection space = documentService.load(newSpaceRef);
|
||||
invoice.setItemValue("space.name", space.getItemValueString("name"));
|
||||
invoice.setItemValue("migration.space.ref", oldSpaceRef);
|
||||
documentService.save(invoice);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
log = log + "\n\n=== Completed! " + count + " fixes! ===\n\n";
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method loads taxonomy data for a workflow group within a given process
|
||||
* and builds a ChartJS data structure in JSON format
|
||||
|
|
|
|||
|
|
@ -138,6 +138,10 @@ public class MahnlaufService {
|
|||
for (Map.Entry<String, List<String>> entry : spacePosMappings.entrySet()) {
|
||||
List<String> expressionsList = entry.getValue();
|
||||
for (String expr : expressionsList) {
|
||||
if (expr == null || expr.trim().isEmpty()) {
|
||||
// skip wenn keine Regex definiert wurde.
|
||||
continue;
|
||||
}
|
||||
Pattern p = Pattern.compile(expr);
|
||||
Matcher m = p.matcher(text);
|
||||
if (m.find()) {
|
||||
|
|
|
|||
|
|
@ -615,7 +615,7 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
|
|||
<imixs:value><![CDATA[<imixs-ai name="PROMPT">
|
||||
<endpoint>https://llama.cpp.imixs.com/</endpoint>
|
||||
<result-event>XML</result-event>
|
||||
<debug>true</debug>
|
||||
<debug>false</debug>
|
||||
</imixs-ai>
|
||||
<imixs-ai name="SUGGEST">
|
||||
<items>cdtr.name,invoice.number,invoice.date,invoice.total,payment.date,cdtr.iban,cdtr.bic,total</items>
|
||||
|
|
@ -1002,7 +1002,7 @@ Note: Do not generate any other information instead of the XML object. Do not ge
|
|||
<imixs:value><![CDATA[<imixs-ai name="PROMPT">
|
||||
<endpoint>https://llama.cpp.imixs.com/</endpoint>
|
||||
<result-item>invoice.summary</result-item>
|
||||
<debug>true</debug>
|
||||
<debug>false</debug>
|
||||
</imixs-ai>
|
||||
<validation name="required">false</validation>
|
||||
]]></imixs:value>
|
||||
|
|
@ -1393,7 +1393,7 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
|
|||
<bpmndi:BPMNShape bpmnElement="BoundaryEvent_1" id="BPMNShape_BoundaryEvent_1">
|
||||
<dc:Bounds height="36.0" width="36.0" x="437.0" y="497.0"/>
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_11" labelStyle="BPMNLabelStyle_1">
|
||||
<dc:Bounds height="20.0" width="100.0" x="406.0" y="534.0"/>
|
||||
<dc:Bounds height="20.0" width="100.0" x="405.0" y="536.0"/>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="TextAnnotation_1" id="BPMNShape_TextAnnotation_1">
|
||||
|
|
@ -1626,13 +1626,13 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
|
|||
<bpmndi:BPMNShape bpmnElement="event_88sCAA" id="BPMNShape_0FB0cg">
|
||||
<dc:Bounds height="36.0" width="36.0" x="787.0" y="497.0"/>
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_OSIhZg">
|
||||
<dc:Bounds height="20.0" width="100.0" x="755.0" y="480.0"/>
|
||||
<dc:Bounds height="20.0" width="100.0" x="755.0" y="536.0"/>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="event_T901Jg" id="BPMNShape_Jc5h4g">
|
||||
<dc:Bounds height="36.0" width="36.0" x="1147.0" y="497.0"/>
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_Y0hU4w">
|
||||
<dc:Bounds height="20.0" width="100.0" x="1115.0" y="480.0"/>
|
||||
<dc:Bounds height="20.0" width="100.0" x="1115.0" y="536.0"/>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_PgyOMw" id="BPMNEdge_kptDVQ" sourceElement="BPMNShape_0FB0cg" targetElement="BPMNShape_g0M0zg">
|
||||
|
|
@ -1650,7 +1650,7 @@ Betrag: <itemvalue>_amount</itemvalue> (Brutto € <itemvalue>_amount_brutto</it
|
|||
<bpmndi:BPMNShape bpmnElement="event_7rbeVA" id="BPMNShape_ShOR1w">
|
||||
<dc:Bounds height="36.0" width="36.0" x="1407.0" y="497.0"/>
|
||||
<bpmndi:BPMNLabel id="BPMNLabel_8q5sXA">
|
||||
<dc:Bounds height="20.0" width="100.0" x="1375.0" y="480.0"/>
|
||||
<dc:Bounds height="20.0" width="100.0" x="1375.0" y="536.0"/>
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_PWXjog" id="BPMNEdge_0u97cA" sourceElement="BPMNShape_ShOR1w" targetElement="BPMNShape_sGRa6w">
|
||||
|
|
|
|||
4117
workflow/rechnungsausgang-de-1.0.12.bpmn
Normal file
4117
workflow/rechnungsausgang-de-1.0.12.bpmn
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue