Implementováno zadávání hlaviček Požadavků.

Implementována číselná řada.
Přidány metody pro porovnání String a Date pro filtry.
Upraveno logování aplikace - loguje se až úroveň warning.

refs #100
multitenant
František Přibyl 11 years ago
parent a074dd376d
commit 8bcfc04c15

@ -11,7 +11,7 @@ import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.reporting.ReportType;
import info.bukova.isspst.services.numberseries.NumberSeriesService;
import info.bukova.isspst.services.requirements.RequirementTypeService;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.PermissionService;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;

@ -8,9 +8,10 @@ import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.reporting.ReportMapping;
import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.buildings.BuildingService;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.material.MaterialService;
import info.bukova.isspst.services.requirements.RequirementTypeService;
import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
@ -68,7 +69,7 @@ public class Constants {
new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class),
new Module(MOD_MATERIAL, "Materiál", MaterialService.class),
new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class),
new Module(MOD_REQUIREMENTS, "Požadavky", null),
new Module(MOD_REQUIREMENTS, "Požadavky", RequirementService.class),
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class)
};

@ -0,0 +1,57 @@
package info.bukova.isspst;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang.time.DateUtils;
public class DateTimeUtils
{
public static Date getDate(Date value)
{
if (value == null)
{
return value;
}
// Keep date - truncate time
return DateUtils.truncate(value, Calendar.DAY_OF_MONTH);
}
public static boolean isEqualByDate(Date d1, Date d2)
{
if (d1 != null && d2 != null)
{
d1 = DateTimeUtils.getDate(d1);
d2 = DateTimeUtils.getDate(d2);
boolean equals = (d1.compareTo(d2) == 0);
return equals;
}
return false;
}
public static boolean isEqualByDateForFilter(Date value, Date search)
{
if (search == null)
{
return true;
}
else if (value != null)
{
return DateTimeUtils.isEqualByDate(value, search);
}
return false;
}
public static Date getCurrDateTime()
{
return new Date();
}
public static Date getCurrDate()
{
return DateTimeUtils.getDate(DateTimeUtils.getCurrDateTime());
}
}

@ -44,4 +44,10 @@ public class StringUtils {
return Labels.getLabel("Db" + key);
}
public static boolean isEqualForFilter(String value, String search)
{
value = StringUtils.nullStr(value).toLowerCase();
search = StringUtils.nullStr(search).toLowerCase();
return value.contains(search);
}
}

@ -1,6 +1,7 @@
package info.bukova.isspst.filters;
import static info.bukova.isspst.StringUtils.nullStr;
import info.bukova.isspst.DateTimeUtils;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.Requirement;
import org.hamcrest.Description;
@ -37,10 +38,11 @@ public class RequirementFilter implements Filter<Requirement>
@Override
public boolean matchesSafely(Requirement item)
{
return nullStr(item.getNumser()).toLowerCase().contains(nullStr(condition.getNumser()).toLowerCase())
&& item.getReqDate().equals(condition.getReqDate())
&& item.getDeliveryDate().equals(condition.getDeliveryDate())
&& nullStr(item.getDescription()).toLowerCase().contains(nullStr(condition.getDescription()).toLowerCase());
boolean foundNumser = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getReqDate(), condition.getReqDate());
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
return foundNumser && foundReqDate && foundDescription && foundDeliveryDate;
}
@Factory

@ -5,8 +5,10 @@ import info.bukova.isspst.Constants;
import info.bukova.isspst.Module;
import info.bukova.isspst.dao.BaseDao;
import info.bukova.isspst.data.DataModel;
import info.bukova.isspst.data.NumberSeries;
import info.bukova.isspst.filters.Filter;
import info.bukova.isspst.reporting.Report;
import info.bukova.isspst.services.numberseries.NumberSeriesService;
import java.util.Arrays;
import java.util.Date;
@ -26,6 +28,19 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
protected BaseDao<T> dao;
private Validator validator;
private NumberSeriesService numberSeriesService;
public NumberSeriesService getNumberSeriesService()
{
return numberSeriesService;
}
public void setNumberSeriesService(NumberSeriesService numberSeriesService)
{
this.numberSeriesService = numberSeriesService;
}
public void setDao(BaseDao<T> dao) {
this.dao = dao;
}
@ -150,4 +165,22 @@ public abstract class AbstractService<T extends DataModel> implements Service<T>
}
}
protected String getNumberSerie()
{
String currentNumber = "";
if (numberSeriesService != null)
{
String moduleName = this.getModule().getId();
NumberSeries ns = numberSeriesService.getNumberSerie(moduleName);
if (ns != null)
{
currentNumber = ns.getCurrentNumber();
numberSeriesService.increase(ns);
}
}
return currentNumber;
}
}

@ -1,10 +1,10 @@
package info.bukova.isspst.services.numberseries;
import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.data.NumberSeries;
import info.bukova.isspst.services.AbstractService;
import org.springframework.transaction.annotation.Transactional;
public class NumberSeriesServiceImpl extends AbstractService<NumberSeries> implements NumberSeriesService
{
@Transactional

@ -1,9 +1,31 @@
package info.bukova.isspst.services.requirement;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.services.AbstractService;
import info.bukova.isspst.services.AbstractOwnedService;
public class RequirementServiceImpl extends AbstractService<Requirement> implements RequirementService
import java.util.Date;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
public class RequirementServiceImpl extends AbstractOwnedService<Requirement> implements RequirementService
{
@Override
protected Requirement createEntity()
{
Requirement entity = new Requirement();
entity.setReqDate(new Date());
return entity;
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void add(Requirement entity)
{
entity.setNumser(this.getNumberSerie());
super.add(entity);
}
}

@ -1,4 +1,4 @@
package info.bukova.isspst.services.requirements;
package info.bukova.isspst.services.requirement;
import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.services.Service;

@ -1,4 +1,4 @@
package info.bukova.isspst.services.requirements;
package info.bukova.isspst.services.requirement;
import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.services.AbstractOwnedService;

@ -1,15 +1,77 @@
package info.bukova.isspst.ui.requirement;
import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementSubject;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.requirement.RequirementService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.FormViewModel;
import java.util.List;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable;
public class RequirementForm extends FormViewModel<Requirement>
{
@WireVariable
private UserService userService;
@WireVariable
private WorkgroupService workgroupService;
public List<Workgroup> getCentres() {
return workgroupService.getUserCentres(userService.getCurrent());
}
@WireVariable
private RequirementService requirementService;
private RequirementSubject item;
private int selItemIndex;
@Init(superclass = true)
public void init()
{
this.setSelItemIndex(-1);
}
public RequirementSubject getItem()
{
return item;
}
public void setItem(RequirementSubject item)
{
this.item = item;
}
public int getSelItemIndex()
{
return selItemIndex;
}
public void setSelItemIndex(int selItemIndex)
{
this.selItemIndex = selItemIndex;
}
@Command
@NotifyChange({"dataBean", "selItemIndex"})
public void addItem() {
// RequirementSubject item = new Material();
// requirementService.addItem(getDataBean(), item);
// selItemIndex = getDataBean().getItems().indexOf(item);
}
/*
@Command
@NotifyChange({"dataBean", "selItemIndex"})
public void removeItem(@BindingParam("item") RequirementItem item) {
requirementService.removeItem(getDataBean(), item);
selItemIndex = -1;
}
*/
}

@ -1,10 +1,10 @@
package info.bukova.isspst.ui.requirements;
package info.bukova.isspst.ui.requirement;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.RequirementType;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workflow;
import info.bukova.isspst.services.requirements.RequirementTypeService;
import info.bukova.isspst.services.requirement.RequirementTypeService;
import info.bukova.isspst.services.users.RoleService;
import java.util.ArrayList;

@ -12,24 +12,28 @@
<!-- Application Loggers -->
<logger name="info.bukova.isspst">
<level value="info" />
<level value="warn" />
</logger>
<!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" />
<level value="warn" />
</logger>
<logger name="org.springframework.beans">
<level value="info" />
<level value="warn" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
<level value="warn" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
<level value="warn" />
</logger>
<logger name="org.hibernate">
<level value="warn" />
</logger>
<!-- Root Logger -->

@ -10,7 +10,17 @@ MenuUser=Uživatel
AgendaActRequirements=Aktuální požadavky
AgendaRequirementsHistory=Ukončené požadavky
RequirementsFormTitle="Požadavek"
RequirementsFormTitle=Požadavek
RequirementsFormNumberSerie=Číslo
RequirementsFormReqDate=Datum požadavku
RequirementsFormCenter=Středisko
RequirementsFormDescription=Popis
RequirementsFormDeliveryDate=Datum dodání
RequirementsGridNumberSerie=Číslo
RequirementsGridReqDate=Datum požadavku
RequirementsGridCenter=Středisko
RequirementsGridDescription=Popis
RequirementsGridDeliveryDate=Datum dodání
AgendaMyOrders=Aktuální
AgendaOrdersHistory=Ukončené
@ -142,3 +152,7 @@ DbValidationError=Chyba validace
true=Ano
false=Ne
DateFormat=dd. MM. yyyy
AddItem=Přidat položku...

@ -36,7 +36,7 @@
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
@ -202,7 +202,7 @@
<property name="validator" ref="validator"/>
</bean>
<bean id="reqTypeService" class="info.bukova.isspst.services.requirements.RequirementTypeServiceImpl">
<bean id="reqTypeService" class="info.bukova.isspst.services.requirement.RequirementTypeServiceImpl">
<property name="dao" ref="reqTypeDao"/>
<property name="validator" ref="validator"/>
</bean>
@ -210,6 +210,7 @@
<bean id="requirementService" class="info.bukova.isspst.services.requirement.RequirementServiceImpl">
<property name="dao" ref="requirementDao" />
<property name="validator" ref="validator" />
<property name="numberSeriesService" ref="numericSeriesService" />
</bean>
<bean id="numericSeriesService" class="info.bukova.isspst.services.numberseries.NumberSeriesServiceImpl">

@ -1,15 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE zk.xml>
<zk>
<!-- [Optional]
Uncomment if you want to defines the application's name
<preference>
<name>org.zkoss.zk.ui.WebApp.name</name>
<value>rsfaktura</value>
</preference>
-->
<!-- [Optional] Uncomment if you want to defines the application's name <preference> <name>org.zkoss.zk.ui.WebApp.name</name> <value>rsfaktura</value> </preference> -->
<client-config>
<debug-js>true</debug-js>
</client-config>
@ -17,27 +9,20 @@
<name>org.zkoss.web.classWebResource.cache</name>
<value>false</value>
</library-property>
<system-config>
<label-location>/WEB-INF/locales/zk-label.properties</label-location>
<label-location>/WEB-INF/locales/columns.properties</label-location>
<label-location>/WEB-INF/locales/validators.properties</label-location>
</system-config>
<language-config>
<addon-uri>/WEB-INF/lang-addons/mapa-lang-addon.xml</addon-uri>
<addon-uri>/WEB-INF/lang-addons/ckez-bind-lang-addon.xml</addon-uri>
<addon-uri>/WEB-INF/lang-addons/CzechSortListheader.xml</addon-uri>
</language-config>
<desktop-config>
<theme-uri>/css/zk-modify.css</theme-uri>
<theme-uri>/css/form.css</theme-uri>
<theme-uri>/css/page.css</theme-uri>
</desktop-config>
<!-- <library-property>
<name>org.zkoss.zul.progressbox.position</name>
<value>center</value>
</library-property> -->
<!-- <library-property> <name>org.zkoss.zul.progressbox.position</name> <value>center</value> </library-property> -->
</zk>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -1,22 +1,50 @@
<?page title="${labels.AgendaActRequirements}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window border="normal" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementList')">
<caption zclass="form-caption" label="${labels.AgendaActRequirements}" />
<window
border="normal"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementList')">
<caption
zclass="form-caption"
label="${labels.AgendaActRequirements}" />
<include src="/app/toolbar.zul" />
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)">
<listbox
model="@load(vm.dataList)"
selectedItem="@bind(vm.dataBean)">
<listhead menupopup="auto">
<listheader label="${labels.BuildingsGridColumnCode}" sort="czech(numser)" width="10%" />
<listheader label="${labels.BuildingsGridColumnName}" sort="auto(reqDate)" width="30%" />
<listheader label="${labels.BuildingsGridColumnDescription}" sort="czech(description)" width="60%" />
<listheader
label="${labels.RequirementsGridNumberSerie}"
sort="czech(numser)"
width="7%" />
<listheader
label="${labels.RequirementsGridReqDate}"
sort="auto(reqDate)"
width="13%" />
<listheader
label="${labels.RequirementsGridCenter}"
sort="czech(description)"
width="10%" />
<listheader
label="${labels.RequirementsGridDescription}"
sort="czech(description)"
width="70%" />
<listheader
label="${labels.RequirementsGridDeliveryDate}"
sort="auto(reqDate)"
width="13%" />
</listhead>
<auxhead sclass="category-center" visible="@load(vm.filter)">
<auxhead
sclass="category-center"
visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.numser)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
<textbox
value="@bind(vm.filterTemplate.numser)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
@ -26,7 +54,42 @@
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<datebox value="@bind(vm.filterTemplate.reqDate)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
<datebox
value="@bind(vm.filterTemplate.reqDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<combobox
readonly="true"
width="100%"
selectedItem="@bind(vm.filterTemplate.workgroup)">
<template name="modelW">
<comboitem label="@load(each.workgroup.fullName)" />
</template>
</combobox>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox
value="@bind(vm.filterTemplate.description)"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
@ -36,7 +99,13 @@
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.description)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
<datebox
value="@bind(vm.filterTemplate.deliveryDate)"
format="${labels.DateFormat}"
instant="true"
onChange="@command('doFilter')"
sclass="find-grid-textbox"
width="100%" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
@ -44,15 +113,15 @@
</div>
</auxheader>
</auxhead>
<template name="model">
<listitem>
<listcell label="@load(each.numser)" />
<listcell label="@load(each.reqDate)" />
<listcell label="@load(each.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
<listcell label="@load(each.workgroup.fullName)" />
<listcell label="@load(each.description)" />
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
</listitem>
</template>
</listbox>
</window>
</zk>

@ -1,34 +1,87 @@
<?page title="${labels.RequirementsFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementForm')">
<caption src="/img/reqact.png" zclass="form-caption" label="RequirementsFormTitle" />
<window
id="editWin"
closable="true"
border="normal"
position="center"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementForm')">
<caption
src="/img/reqact.png"
zclass="form-caption"
label="${labels.RequirementsFormTitle}" />
<vlayout>
<grid hflex="min">
<columns>
<column align="right" hflex="min" />
<column
align="right"
hflex="min" />
<column />
</columns>
<rows>
<row>
<cell sclass="row-title">${labels.BuildingsFormCode} :</cell>
<cell sclass="row-title">${labels.RequirementsFormNumberSerie} :</cell>
<cell>
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.numser)" />
<textbox
id="numser"
constraint="@load(vm.constriant)"
width="200px"
value="@bind(vm.dataBean.numser)"
readonly="true" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.BuildingsFormName} :</cell>
<cell sclass="row-title">${labels.RequirementsFormReqDate} :</cell>
<cell>
<datebox id="name" width="200px" value="@bind(vm.dataBean.reqDate)" />
<datebox
id="reqDate"
width="200px"
value="@bind(vm.dataBean.reqDate)"
format="${labels.DateFormat}" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.BuildingsFormDescription} :</cell>
<cell sclass="row-title">${labels.RequirementsFormCenter} :</cell>
<cell>
<textbox id="description" width="300px" value="@bind(vm.dataBean.description)" />
<combobox
model="@load(vm.centres)"
readonly="true"
selectedItem="@bind(vm.dataBean.workgroup)">
<template name="model">
<comboitem label="@load(each.fullName)" />
</template>
</combobox>
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormDescription} :</cell>
<cell>
<textbox
id="description"
width="300px"
value="@bind(vm.dataBean.description)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.RequirementsFormDeliveryDate} :</cell>
<cell>
<datebox
id="deliveryDate"
width="200px"
value="@bind(vm.dataBean.deliveryDate)"
format="${labels.DateFormat}" />
</cell>
</row>
</rows>
</grid>
<hbox>
<button
image="/img/item-add.png"
label="${labels.AddItem}"
onClick="@command('addItem')"
sclass="nicebutton" />
</hbox>
<include src="/app/formButtons.zul" />
</vlayout>
</window>

@ -1,7 +1,7 @@
<?page title="${labels.AgendaWorkflow}" contentType="text/html;charset=UTF-8"?>
<zk>
<window border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirements.RequirementTypesVM')">
viewModel="@id('vm') @init('info.bukova.isspst.ui.requirement.RequirementTypesVM')">
<caption zclass="form-caption" label="${labels.AgendaWorkflow}" />
<vbox>
<hbox>

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n" />
</layout>
</appender>
<!-- Application Loggers -->
<logger name="info.bukova.isspst">
<level value="info" />
</logger>
<!-- 3rdparty Loggers -->
<logger name="org.springframework.core">
<level value="info" />
</logger>
<logger name="org.springframework.beans">
<level value="info" />
</logger>
<logger name="org.springframework.context">
<level value="info" />
</logger>
<logger name="org.springframework.web">
<level value="info" />
</logger>
<!-- Root Logger -->
<root>
<priority value="info" />
<appender-ref ref="console" />
</root>
</log4j:configuration>
Loading…
Cancel
Save