neue Report Funktion

This commit is contained in:
Ralph Soika 2021-11-25 19:22:36 +01:00
parent fbdf752a91
commit 86e9938bde
4 changed files with 328 additions and 1 deletions

View file

@ -0,0 +1,144 @@
package com.alexanderlogistics;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.imixs.workflow.ItemCollection;
import org.imixs.workflow.engine.DocumentService;
import org.imixs.workflow.engine.index.Category;
import org.imixs.workflow.engine.index.SearchService;
/**
* AnalyseSachpruefungController dient zur Auswertung der Sachprüfungs WOrklfow
* Schritte. Die Analyse Seite ist büer das Admin Menü erreichbar.
*
* @author rsoika
*
*/
@Named
@SessionScoped
public class AnalyseSachpruefungController implements Serializable {
private static final long serialVersionUID = 1L;
private static Logger logger = Logger.getLogger(AnalyseSachpruefungController.class.getName());
@Inject
protected DocumentService documentService;
@Inject
SearchService searchService;
Category sachpruefung;
Category verteilung;
private ItemCollection filter;
public ItemCollection getFilter() {
if (filter == null) {
filter = new ItemCollection();
}
return filter;
}
public void setFilter(ItemCollection filter) {
this.filter = filter;
}
public Category getSachpruefung() {
return sachpruefung;
}
public Category getVerteilung() {
return verteilung;
}
/**
* Fuert verschiedene Queries aus um eine Analyse der Sachprufung durchzuführen.
*/
public void analyse() {
logger.info("start analyse....");
verteilung=null;
sachpruefung=null;
Date start = filter.getItemValueDate("start");
Date stop = filter.getItemValueDate("stop");
logger.info("...daterange=" + start + " - "+stop);
// serach date range?
String sDateFrom = "191401070000"; // because * did not work here
String sDateTo = "211401070000";
SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMddHHmm");
if (start != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(start);
sDateFrom = dateformat.format(cal.getTime());
}
if (stop != null) {
Calendar cal = Calendar.getInstance();
cal.setTime(stop);
cal.add(Calendar.DATE, 1);
sDateTo = dateformat.format(cal.getTime());
}
String query = "(type:workitem OR type:workitemarchive) ";
if (start != null || stop != null) {
query += "AND ($created:[" + sDateFrom + " TO " + sDateTo + "]) ";
}
logger.info(query);
List<Category> taxResult = searchService.getTaxonomyByQuery(query, "taxonomy.verteilung.stop.by",
"taxonomy.sachpruefung.stop.by");
if (taxResult.size() > 0) {
for (Category cat : taxResult) {
logger.info("category: " + cat.getName() + " = " + cat.getCount());
if (cat.getName().contains("verteilung")) {
verteilung=cat;
}
if (cat.getName().contains("sachpruefung")) {
sachpruefung=cat;
}
Map<String, Integer> labelMap = cat.getLabels();
for (String id : labelMap.keySet()) {
logger.info(".....sub-category: " + id + " = " + labelMap.get(id));
}
}
}
}
/**
* This method reset the search and input state.
*/
public void reset() {
filter = new ItemCollection();
sachpruefung=null;
verteilung=null;
logger.fine("reset");
}
}

View file

@ -6,6 +6,7 @@
<ul>
<li><h:link outcome="/pages/admin/document_import">Dokument Import</h:link></li>
<li><h:link outcome="/pages/admin/sepa_config">SEPA</h:link></li>
<li><h:link outcome="/pages/admin/analyse_sachpruefung">Analyse Sachprüfung</h:link></li>
</ul>
</f:subview>

View file

@ -0,0 +1,182 @@
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:i="http://java.sun.com/jsf/composite/imixs"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
xmlns:fn="http://xmlns.jcp.org/jsp/jstl/functions"
xmlns:marty="http://java.sun.com/jsf/composite/marty"
template="/layout/template.xhtml">
<ui:define name="scripts">
<link
href="#{facesContext.externalContext.requestContextPath}/layout/css/office-theme-monitoring.css?build=#{app.application_build_timestamp}"
type="text/css" rel="stylesheet" />
<script type="text/javascript">
/*<![CDATA[*/
$(document).ready(function() {
});
/*]]>*/
</script>
</ui:define>
<ui:define name="content">
<f:view>
<h:form id="import_form_id">
<!-- ########## Error ########## -->
<ui:include src="/pages/error_message.xhtml" />
<div class="imixs-form">
<div class="imixs-header">
<h1>Analyse Verteilung / Sachprüfung</h1>
</div>
<h:panelGroup layout="block" styleClass="imixs-body"
id="analyse_panel">
<div class="imixs-form-panel">
<div class="imixs-form-section-3">
<dl>
<dt>
Von:<span class="imixs-required">*</span>
</dt>
<dd>
<h:inputText styleClass="imixs-date"
value="#{analyseSachpruefungController.filter.item['start']}">
<f:convertDateTime pattern="#{message.datePatternShort}"
timeZone="#{message.timeZone}" />
</h:inputText>
</dd>
</dl>
<dl>
<dt>
Bis:<span class="imixs-required">*</span>
</dt>
<dd>
<h:inputText styleClass="imixs-date"
value="#{analyseSachpruefungController.filter.item['stop']}">
<f:convertDateTime pattern="#{message.datePatternShort}"
timeZone="#{message.timeZone}" />
</h:inputText>
</dd>
</dl>
</div>
</div>
<h:panelGroup layout="block" styleClass="imixs-form-panel"
id="result_panel">
<hr />
<div class="row">
<div class="col-4" style="padding-left: 0;">
<ui:fragment
rendered="#{analyseSachpruefungController.verteilung!=null}">
<h2>Verteilung zur Prüfung</h2>
<table class="monitoring-datatable">
<tr>
<th>Mitarbeiter</th>
<th></th>
</tr>
<c:forEach
items="#{analyseSachpruefungController.verteilung.labels}"
var="entry">
<tr>
<td>#{entry.key}</td>
<td style="text-align: center;">#{entry.value}</td>
</tr>
</c:forEach>
</table>
</ui:fragment>
</div>
<div class="col-4">
<ui:fragment
rendered="#{analyseSachpruefungController.sachpruefung!=null}">
<h2>Sachprüfung</h2>
<table class="monitoring-datatable">
<tr>
<th>Mitarbeiter</th>
<th></th>
</tr>
<c:forEach
items="#{analyseSachpruefungController.sachpruefung.labels}"
var="entry">
<tr>
<td>#{entry.key}</td>
<td style="text-align: center;">#{entry.value}</td>
</tr>
</c:forEach>
</table>
</ui:fragment>
</div>
</div>
</h:panelGroup>
</h:panelGroup>
</div>
<div class="imixs-footer">
<h:commandButton
actionListener="#{analyseSachpruefungController.analyse()}"
action="/pages/admin/analyse_sachpruefung" value="Report starten">
<f:ajax render="result_panel" execute="@form" />
</h:commandButton>
<h:commandButton value="#{message.close}" action="notes" />
</div>
</h:form>
</f:view>
</ui:define>
</ui:composition>

View file

@ -335,7 +335,7 @@ Bei Fragen wenden Sie sich bitte an info@imixs.com
<imixs:value><![CDATA[<item name="action">home</item>
<taxonomy name="verteilung">
<type>start</type>
<anonymised>true</anonymised>
<anonymised>false</anonymised>
</taxonomy>]]></imixs:value>
</imixs:item>
<imixs:item name="txtname" type="xs:string">