Zprovozněna sestava objednávky. Umožněn upload souboru s razítkem, které
se zobrazuje na sestavě objednávky (Globalní nastavení - Požadavky - Razítko). closes #136
This commit is contained in:
@@ -21,6 +21,7 @@ public class SettingsData {
|
||||
private String bankCode;
|
||||
private List<Vehicle> vehicles;
|
||||
private Map<Integer, BigDecimal[]> refunds;
|
||||
private String stampFile;
|
||||
|
||||
public SettingsData() {
|
||||
newReqTemplate = new MailMessage();
|
||||
@@ -131,4 +132,12 @@ public class SettingsData {
|
||||
this.refunds = refunds;
|
||||
}
|
||||
|
||||
public String getStampFile() {
|
||||
return stampFile;
|
||||
}
|
||||
|
||||
public void setStampFile(String stampFile) {
|
||||
this.stampFile = stampFile;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package info.bukova.isspst.reporting;
|
||||
|
||||
import info.bukova.isspst.data.AuthItem;
|
||||
import info.bukova.isspst.data.Order;
|
||||
import info.bukova.isspst.data.TripBill;
|
||||
import info.bukova.isspst.data.User;
|
||||
import info.bukova.isspst.data.UserSettingsData;
|
||||
import info.bukova.isspst.services.requirement.TripRequirementService;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
import info.bukova.isspst.services.users.UserService;
|
||||
import info.bukova.isspst.storage.FileStorage;
|
||||
|
||||
@@ -20,12 +22,16 @@ public class ParamFiller {
|
||||
private FileStorage storage;
|
||||
@Autowired
|
||||
private TripRequirementService tripReqService;
|
||||
@Autowired
|
||||
private GlobalSettingsService settingService;
|
||||
|
||||
public void fill() {
|
||||
if (definition.getDataSet() == null || definition.getDataSet().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
definition.getParams().clear();
|
||||
|
||||
if ((definition.getDataSet().get(0) instanceof TripBill)
|
||||
&& definition.getReport().isSingleRecord()) {
|
||||
if (userService.getUserSettings().getSignatureFile() != null
|
||||
@@ -49,6 +55,14 @@ public class ParamFiller {
|
||||
definition.setParam("P_APPROVER_SIGNATURE", storage.serverPath(approverSettings.getSignatureFile()));
|
||||
}
|
||||
}
|
||||
|
||||
if ((definition.getDataSet().get(0) instanceof Order)
|
||||
&& definition.getReport().isSingleRecord()) {
|
||||
if (settingService.getSettings().getStampFile() != null
|
||||
&& !settingService.getSettings().getStampFile().isEmpty()) {
|
||||
definition.setParam("P_STAMP", storage.serverPath(settingService.getSettings().getStampFile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,18 +8,26 @@ import info.bukova.isspst.data.Vehicle;
|
||||
import info.bukova.isspst.mail.MailMessage;
|
||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||
import info.bukova.isspst.sort.ReflectionTools;
|
||||
import info.bukova.isspst.storage.FileStorage;
|
||||
import info.bukova.isspst.ui.LocaleConverter;
|
||||
import info.bukova.isspst.ui.SecurityHelper;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.zkoss.bind.annotation.BindingParam;
|
||||
import org.zkoss.bind.annotation.Command;
|
||||
import org.zkoss.bind.annotation.ContextParam;
|
||||
import org.zkoss.bind.annotation.ContextType;
|
||||
import org.zkoss.bind.annotation.Init;
|
||||
import org.zkoss.bind.annotation.NotifyChange;
|
||||
import org.zkoss.zk.ui.event.UploadEvent;
|
||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||
import org.zkoss.zul.Window;
|
||||
|
||||
@@ -31,7 +39,9 @@ public class GlobalSettingsVM {
|
||||
private LocaleConverter locConverter;
|
||||
private Address selAddress;
|
||||
private List<Integer> refundsHours;
|
||||
|
||||
@WireVariable
|
||||
private FileStorage storage;
|
||||
|
||||
@Init
|
||||
public void init() {
|
||||
settings = settingsService.getSettings();
|
||||
@@ -49,6 +59,23 @@ public class GlobalSettingsVM {
|
||||
window.detach();
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange({"settings", "stampImg"})
|
||||
public void uploadStamp(@ContextParam(ContextType.TRIGGER_EVENT) UploadEvent upEvent) {
|
||||
int i = upEvent.getMedia().getName().lastIndexOf(".");
|
||||
String fileName = "StampImageFile" + upEvent.getMedia().getName().substring(i);
|
||||
|
||||
storage.saveFile(upEvent.getMedia().getByteData(), fileName);
|
||||
settings.setStampFile(fileName);
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange("stampImg")
|
||||
public void removeStamp() {
|
||||
storage.removeFile(settings.getStampFile());
|
||||
settings.setStampFile(null);
|
||||
}
|
||||
|
||||
public List<String> getRequirementFields() {
|
||||
return ReflectionTools.getEntityFields(Requirement.class);
|
||||
}
|
||||
@@ -107,5 +134,17 @@ public class GlobalSettingsVM {
|
||||
this.refundsHours = new ArrayList<Integer>(settings.getRefunds().keySet());
|
||||
Collections.sort(this.refundsHours);
|
||||
}
|
||||
|
||||
public RenderedImage getStampImg() {
|
||||
if (settings.getStampFile() == null || settings.getStampFile().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return ImageIO.read(storage.file(settings.getStampFile()));
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user