Einfache Client-Fähigkeiten am Beispiel Berechnen-Unfall hinzugefügt.
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
package com.kapdion.omdsclient;
|
||||
|
||||
import at.vvo.omds.types.omds2Types.v2_17.NATUERLICHEPERSONType;
|
||||
import at.vvo.omds.types.omds2Types.v2_17.PersArtCdType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.common.AdresseType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.common.ObjektIdType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.common.PersonType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
/**
|
||||
* Hilfsmethoden für die Erzeugung von Requests.
|
||||
*/
|
||||
public class BuildRequestHelper {
|
||||
|
||||
static Logger log = LoggerFactory.getLogger(BuildRequestHelper.class);
|
||||
/** Privater default Constructor versteckt den nicht benötigten Default-Constructor. */
|
||||
private BuildRequestHelper() {
|
||||
}
|
||||
|
||||
public static XMLGregorianCalendar omdsDatum(int year, int month, int day) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd");
|
||||
try {
|
||||
GregorianCalendar c = new GregorianCalendar();
|
||||
c.set(year, month, day);
|
||||
return DatatypeFactory.newInstance().newXMLGregorianCalendar(c.toZonedDateTime().format(formatter));
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
log.atError().log("Datum konnte nicht erzeugt werden");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static XMLGregorianCalendar aktuellesDatum() {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss");
|
||||
try {
|
||||
GregorianCalendar c = new GregorianCalendar();
|
||||
return DatatypeFactory.newInstance().newXMLGregorianCalendar(c.toZonedDateTime().format(formatter));
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
log.atError().log("Datum konnte nicht erzeugt werden");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static XMLGregorianCalendar zuXml(LocalDate localDate) {
|
||||
XMLGregorianCalendar xmlGregorianCalendar = null;
|
||||
try {
|
||||
xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(localDate.toString());
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
log.atError().log(String.format("DatatypeConfigurationException %s", e.getMessage()));
|
||||
}
|
||||
return xmlGregorianCalendar;
|
||||
}
|
||||
|
||||
public static XMLGregorianCalendar hauptfalligkeit(int monat) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss");
|
||||
try {
|
||||
GregorianCalendar c = new GregorianCalendar();
|
||||
c.set(Calendar.MONTH, monat);
|
||||
c.set(Calendar.DAY_OF_MONTH, 1);
|
||||
c.set(Calendar.HOUR_OF_DAY, 0);
|
||||
c.set(Calendar.MINUTE, 0);
|
||||
c.set(Calendar.SECOND, 0);
|
||||
c.set(Calendar.MILLISECOND, 0);
|
||||
return DatatypeFactory.newInstance().newXMLGregorianCalendar(c.toZonedDateTime().format(formatter));
|
||||
} catch (DatatypeConfigurationException e) {
|
||||
log.atError().log("Datum konnte nicht erzeugt werden");
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static PersonType createNatPerson(String vorname, String nachname, LocalDate gebDat, String strasse, String hausnr, int plz, String ort) {
|
||||
PersonType person = new PersonType();
|
||||
|
||||
person.setPersArtCd(PersArtCdType.N); //neu
|
||||
NATUERLICHEPERSONType natPerson = new NATUERLICHEPERSONType();
|
||||
natPerson.setFamilienname(nachname);
|
||||
natPerson.setVorname(vorname);
|
||||
natPerson.setGebdat(BuildRequestHelper.zuXml(gebDat));
|
||||
natPerson.setGeschlechtCd("1");
|
||||
natPerson.setFamilienstandCd("0"); // neu
|
||||
natPerson.setLandesCd("AUT"); // neu
|
||||
person.setNATUERLICHEPERSON(natPerson);
|
||||
AdresseType adresse = new AdresseType();
|
||||
person.setAdresse(adresse);
|
||||
adresse.setOrt(ort);
|
||||
adresse.setPLZ(Integer.toString(plz));
|
||||
adresse.setStrasse(strasse);
|
||||
adresse.setHausnr(hausnr);
|
||||
adresse.setLandesCd("AUT"); //neu
|
||||
ObjektIdType objektId = new ObjektIdType(); //neu
|
||||
objektId.setId("1"); //neu
|
||||
adresse.setObjektId(objektId); //neu
|
||||
return person;
|
||||
}
|
||||
|
||||
public static PersonType createNatPerson(String vorname, String nachname, int gebJahr, int gebMonat, int gebTag) {
|
||||
PersonType person = new PersonType();
|
||||
|
||||
person.setPersArtCd(PersArtCdType.N); //neu
|
||||
NATUERLICHEPERSONType natPerson = new NATUERLICHEPERSONType();
|
||||
natPerson.setFamilienname(nachname);
|
||||
natPerson.setVorname(vorname);
|
||||
natPerson.setGebdat(BuildRequestHelper.omdsDatum(gebJahr, gebMonat, gebTag));
|
||||
natPerson.setGeschlechtCd("1");
|
||||
natPerson.setFamilienstandCd("0"); // neu
|
||||
natPerson.setLandesCd("AUT"); // neu
|
||||
person.setNATUERLICHEPERSON(natPerson);
|
||||
AdresseType adresse = new AdresseType();
|
||||
person.setAdresse(adresse);
|
||||
adresse.setOrt("Wien");
|
||||
adresse.setPLZ("1020");
|
||||
adresse.setStrasse("Schüttelstraße");
|
||||
adresse.setHausnr("99");
|
||||
adresse.setZusatz("7");
|
||||
adresse.setLandesCd("AUT"); //neu
|
||||
ObjektIdType objektId = new ObjektIdType(); //neu
|
||||
objektId.setId("1"); //neu
|
||||
adresse.setObjektId(objektId); //neu
|
||||
|
||||
return person;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package at.vvo.omds.client;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.CalculateUnfallResponseType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class LogCalculateResponse {
|
||||
|
||||
public static void ausgabe(CalculateUnfallResponseType response) {
|
||||
Logger logger = LoggerFactory.getLogger(LogCalculateResponse.class);
|
||||
logger.info("Got Response As below ================================== : ");
|
||||
logger.info("Status : "+response.getStatus().getErgebnis().value());
|
||||
logger.info("KorrelationsId : "+response.getStatus().getKorrelationsId());
|
||||
logger.info("Personen =============================================== : ");
|
||||
logger.info("Anzahl-Personen : "+response.getBerechnungsantwort().getPersonen().size());
|
||||
for (int i=0; i<response.getBerechnungsantwort().getPersonen().size(); i++) {
|
||||
logger.info("Person-" + (i+1));
|
||||
if (response.getBerechnungsantwort().getPersonen().get(i).getPerson().getNATUERLICHEPERSON() != null) {
|
||||
logger.info("Natürliche Person : ");
|
||||
logger.info("Familienname : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getNATUERLICHEPERSON().getFamilienname());
|
||||
logger.info("Vorname : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getNATUERLICHEPERSON().getVorname());
|
||||
logger.info("Geburtsdatum : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getNATUERLICHEPERSON().getGebdat());
|
||||
}else {
|
||||
logger.info("Sonstige Person : ");
|
||||
logger.info("Name : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getSONSTIGEPERSON().getName());
|
||||
logger.info("Kurzname : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getSONSTIGEPERSON().getKurzname());
|
||||
logger.info("Kurzname : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getSONSTIGEPERSON().getSonstPersArtCd());
|
||||
}
|
||||
logger.info("Plz Ort : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getAdresse().getPLZ() + " " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getAdresse().getOrt());
|
||||
logger.info("Anschrift : " + response.getBerechnungsantwort().getPersonen().get(i).getPerson().getAdresse().getStrasse() + " " +
|
||||
response.getBerechnungsantwort().getPersonen().get(i).getPerson().getAdresse().getHausnr() + "/" +
|
||||
response.getBerechnungsantwort().getPersonen().get(i).getPerson().getAdresse().getZusatz());
|
||||
}
|
||||
logger.info("Verkaufsprodukt ======================================== : ");
|
||||
logger.info("Produktvariante : " + response.getBerechnungsantwort().getVerkaufsprodukt().getId());
|
||||
logger.info("Vertragsbeginn : " + response.getBerechnungsantwort().getVerkaufsprodukt().getVtgBeg());
|
||||
logger.info("Vertragsende : " + response.getBerechnungsantwort().getVerkaufsprodukt().getVtgEnde());
|
||||
logger.info("Vermittlernummer : " + response.getBerechnungsantwort().getVerkaufsprodukt().getVermittlernr());
|
||||
logger.info("Hauptfaelligkeit : " + response.getBerechnungsantwort().getVerkaufsprodukt().getHauptfaelligkeit());
|
||||
logger.info("Zahlrhythmus : " + response.getBerechnungsantwort().getVerkaufsprodukt().getZahlrhythmus());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package at.vvo.omds.client.api;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
|
||||
public class Product {
|
||||
|
||||
String vu;
|
||||
String name;
|
||||
long id;
|
||||
LocalDate from;
|
||||
LocalDate to;
|
||||
|
||||
public String getVu() {
|
||||
return vu;
|
||||
}
|
||||
|
||||
public void setVu(String vu) {
|
||||
this.vu = vu;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalDate getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setFrom(LocalDate from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public LocalDate getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
public void setTo(LocalDate to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
public Product(String vu, String name, long id, LocalDate from, LocalDate to) {
|
||||
this.vu = vu;
|
||||
this.name = name;
|
||||
this.id = id;
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package at.vvo.omds.client.api;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.CalculateUnfallRequestType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.CalculateUnfallResponseType;
|
||||
import jakarta.xml.bind.*;
|
||||
import jakarta.xml.soap.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class SOAPConnector {
|
||||
|
||||
static Logger logger = LoggerFactory.getLogger(SOAPConnector.class);
|
||||
|
||||
public CalculateUnfallResponseType callCalcUnfall(String url, JAXBElement<CalculateUnfallRequestType> request, String token) throws Exception {
|
||||
|
||||
logger.info("Url:" + url);
|
||||
logger.info("Request VUNr:" + request.getValue().getVUNr());
|
||||
|
||||
SOAPConnectionFactory connectionFactory = SOAPConnectionFactory.newInstance();
|
||||
SOAPConnection soapConnection = connectionFactory.createConnection();
|
||||
|
||||
//Weil es noch keine Klasse für Zusätzlicheverkaufsprodukte 2025 gibt
|
||||
request.getValue().getBerechnungsanfrage().getVerkaufsprodukt().getZusaetzlicheVerkaufproduktdaten().clear();
|
||||
|
||||
SOAPMessage req = createRequest(request, token);
|
||||
|
||||
|
||||
// printMessage(req);
|
||||
|
||||
SOAPMessage response = soapConnection.call(req, url);
|
||||
|
||||
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance("at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall");
|
||||
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();;
|
||||
|
||||
JAXBElement<CalculateUnfallResponseType> erg =
|
||||
(JAXBElement<CalculateUnfallResponseType>) unmarshaller.unmarshal(response.getSOAPBody().extractContentAsDocument());
|
||||
soapConnection.close();
|
||||
|
||||
return erg.getValue();
|
||||
}
|
||||
|
||||
private SOAPMessage createRequest(JAXBElement<CalculateUnfallRequestType> request, String token) throws SOAPException, JAXBException, ParserConfigurationException {
|
||||
MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
|
||||
SOAPMessage soapMessage = messageFactory.createMessage();
|
||||
createEnvelope(soapMessage, request, token);
|
||||
|
||||
MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
|
||||
mimeHeaders.addHeader("Content-Type", "application/soap+xml");
|
||||
|
||||
soapMessage.saveChanges();
|
||||
|
||||
return soapMessage;
|
||||
}
|
||||
|
||||
private void createEnvelope(SOAPMessage soapMessage, JAXBElement<CalculateUnfallRequestType> request, String token) throws SOAPException, JAXBException, ParserConfigurationException {
|
||||
SOAPPart soapPart = soapMessage.getSOAPPart();
|
||||
|
||||
String namespace = "CalculateUnfallRequestType";
|
||||
String namespaceUrl = "at.vvo.omds.types.omds3types.v1-4-0.on2antrag.unfall";
|
||||
|
||||
SOAPEnvelope envelope = soapPart.getEnvelope();
|
||||
// envelope.addNamespaceDeclaration(namespace, namespaceUrl);
|
||||
SOAPHeader soapHeader = envelope.getHeader();
|
||||
|
||||
Name headerElementName = envelope.createName(
|
||||
"Security",
|
||||
"wsse",
|
||||
"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
|
||||
);
|
||||
SOAPHeaderElement soapHeaderElement = soapHeader.addHeaderElement(headerElementName);
|
||||
|
||||
SOAPElement securityContextTokenSOAPElement = soapHeaderElement.addChildElement("SecurityContextToken", "wsc", "http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512");
|
||||
securityContextTokenSOAPElement.addNamespaceDeclaration("wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
|
||||
securityContextTokenSOAPElement.addAttribute(new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "Id", "wsu"), "authPolicy");
|
||||
SOAPElement identifierSOAPElement = securityContextTokenSOAPElement.addChildElement("Identifier", "wsc");
|
||||
identifierSOAPElement.addTextNode(token);
|
||||
|
||||
JAXBContext jaxbContext = JAXBContext.newInstance("at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall");
|
||||
|
||||
SOAPBody body = envelope.getBody();
|
||||
|
||||
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
|
||||
Marshaller marshaller = jaxbContext.createMarshaller();
|
||||
|
||||
marshaller.marshal(request,document);
|
||||
|
||||
body.addDocument(document);
|
||||
|
||||
soapMessage.saveChanges();
|
||||
|
||||
}
|
||||
|
||||
public static void printMessage(SOAPMessage soapMessage) throws Exception {
|
||||
TransformerFactory tff = TransformerFactory.newInstance();
|
||||
Transformer tf = tff.newTransformer();
|
||||
|
||||
tf.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
tf.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
|
||||
|
||||
Source sc = soapMessage.getSOAPPart().getContent();
|
||||
|
||||
ByteArrayOutputStream streamOut = new ByteArrayOutputStream();
|
||||
StreamResult result = new StreamResult(streamOut);
|
||||
tf.transform(sc, result);
|
||||
|
||||
String strMessage = streamOut.toString();
|
||||
|
||||
logger.atInfo().log("----- SOAPMessage -----");
|
||||
logger.atInfo().log(strMessage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package at.vvo.omds.client.api;
|
||||
|
||||
import at.vvo.omds.client.api.unfall.BuildUnfallRequest;
|
||||
import at.vvo.omds.client.api.unfall.VerkaufsproduktUnfall;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.CalculateUnfallRequestType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.CalculateUnfallResponseType;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class UnfallCalcService {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(UnfallCalcService.class);
|
||||
|
||||
private final SOAPConnector soapConnector;
|
||||
|
||||
public UnfallCalcService(SOAPConnector soapConnector) {
|
||||
this.soapConnector = soapConnector;
|
||||
}
|
||||
|
||||
public VerkaufsproduktUnfall calc(VerkaufsproduktUnfall verkaufsproduktUnfall) throws Exception {
|
||||
|
||||
String vuNr = "043";
|
||||
String token = "<KEY>";
|
||||
JAXBElement<CalculateUnfallRequestType> r = BuildUnfallRequest.unfall(vuNr, verkaufsproduktUnfall);
|
||||
CalculateUnfallResponseType response =
|
||||
soapConnector.callCalcUnfall(
|
||||
"http://localhost:9090/ws", r, token
|
||||
);
|
||||
log.info("Got Response As below ========= : ");
|
||||
log.info("Status : {}", response.getStatus().getErgebnis().value());
|
||||
|
||||
response.getBerechnungsantwort().getVerkaufsprodukt().getPraemie().stream().findFirst()
|
||||
.ifPresent(praemieType -> verkaufsproduktUnfall.setPraemie(praemieType.getPraemieBto()));
|
||||
|
||||
|
||||
return verkaufsproduktUnfall;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds2Types.v2_17.ELRahmenvereinbarungType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.common.BeteiligtePersonVertragType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.common.VersichertePersonType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.CalculateUnfallRequestType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.ProduktUnfallType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.SpezBerechnungUnfallType;
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.VerkaufsproduktUnfallType;
|
||||
import com.kapdion.omdsclient.BuildRequestHelper;
|
||||
import jakarta.xml.bind.JAXBElement;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class BuildUnfallRequest {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(BuildUnfallRequest.class);
|
||||
|
||||
private static final at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.ObjectFactory OUOF =
|
||||
new at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.ObjectFactory();
|
||||
|
||||
public static final String UNFALLVORSORGE = "unfallvorsorge";
|
||||
|
||||
/** Privater default Constructor versteckt den nicht benötigten Default-Constructor. */
|
||||
private BuildUnfallRequest() {
|
||||
}
|
||||
|
||||
static public JAXBElement<CalculateUnfallRequestType> unfall(String vuNr, VerkaufsproduktUnfall vkp) {
|
||||
LOG.info("VUNr = " + vuNr);
|
||||
|
||||
CalculateUnfallRequestType request = OUOF.createCalculateUnfallRequestType();
|
||||
request.setVUNr(vuNr);
|
||||
request.setRequestUpselling(false);
|
||||
request.setProduktmetadaten(false);
|
||||
request.setClientId("OMDS_TEST");
|
||||
request.setKorrelationsId("123456");
|
||||
request.setAenderungsgrund("NEU");
|
||||
request.setBerechnungsanfrage(createSpezBerechnungUnfall(vkp));
|
||||
return OUOF.createCalculateUnfallRequest(request);
|
||||
}
|
||||
|
||||
|
||||
private static SpezBerechnungUnfallType createSpezBerechnungUnfall(VerkaufsproduktUnfall vkp) {
|
||||
SpezBerechnungUnfallType berechnung = OUOF.createSpezBerechnungUnfallType();
|
||||
|
||||
// setze Daten der versicherten Personen in das Berechnungsobjekt
|
||||
for (VersichertePerson vp : vkp.getVersichertePersonen()) {
|
||||
int lfnr = berechnung.getPersonen().size() + 1;
|
||||
|
||||
// lege Person an
|
||||
BeteiligtePersonVertragType beteiligtePerson = new BeteiligtePersonVertragType();
|
||||
|
||||
beteiligtePerson.setLfnr(lfnr);
|
||||
beteiligtePerson.setPerson(vp.getPerson());
|
||||
berechnung.getPersonen().add(beteiligtePerson);
|
||||
vp.setLfnr(lfnr);
|
||||
|
||||
}
|
||||
// Configuriere
|
||||
berechnung.setVerkaufsprodukt(createVerkaufsprodukt(vkp));
|
||||
return berechnung;
|
||||
}
|
||||
|
||||
private static VerkaufsproduktUnfallType createVerkaufsprodukt(VerkaufsproduktUnfall vkp) {
|
||||
VerkaufsproduktUnfallType omdsVerkaufsproduktUnfall = OUOF.createVerkaufsproduktUnfallType();
|
||||
omdsVerkaufsproduktUnfall.setId(UNFALLVORSORGE);
|
||||
omdsVerkaufsproduktUnfall.setVtgBeg(BuildRequestHelper.zuXml(vkp.getVertragsbeginn()));
|
||||
omdsVerkaufsproduktUnfall.setZahlrhythmus(String.valueOf(vkp.getZahlrhythmus()));
|
||||
omdsVerkaufsproduktUnfall.setHauptfaelligkeit(BuildRequestHelper.hauptfalligkeit(vkp.getMonatHauptfaelligkeit()));
|
||||
omdsVerkaufsproduktUnfall.setVermittlernr(vkp.getVermittlerNr());
|
||||
omdsVerkaufsproduktUnfall.setELRahmenvereinbarung(createRahmenvereinbarung(vkp.getRahmenvertragsnummer())); // ist doppelt, siehe ZusaetzlicheVerkaufsproduktdaten
|
||||
// omdsVerkaufsproduktUnfall.getZusaetzlicheVerkaufproduktdaten().add(createZusaetzlicheVerkaufsproduktdaten(vkp));
|
||||
omdsVerkaufsproduktUnfall.setEingeschlossen(true);
|
||||
|
||||
|
||||
|
||||
// lege Produkt an
|
||||
for (VersichertePerson vp : vkp.getVersichertePersonen()) {
|
||||
|
||||
// lege Risikoinformation zur versicherten Person an
|
||||
VersichertePersonType versichertePersonType = new VersichertePersonType();
|
||||
versichertePersonType.setLfnr(vp.getLfnr());
|
||||
omdsVerkaufsproduktUnfall.getVersichertePersonen().add(versichertePersonType);
|
||||
|
||||
// lege Produkt zur versicherten Person an
|
||||
omdsVerkaufsproduktUnfall.getUnfallprodukte().add(legeVersichertePersonAn(vp));
|
||||
}
|
||||
return omdsVerkaufsproduktUnfall;
|
||||
}
|
||||
|
||||
private static ProduktUnfallType legeVersichertePersonAn(VersichertePerson vp) {
|
||||
ProduktUnfallType p = OUOF.createProduktUnfallType();
|
||||
|
||||
p.setEingeschlossen(true);
|
||||
p.setVersPersonenRefLfnr(vp.getLfnr());
|
||||
|
||||
// lege Leistungsarten an
|
||||
for (Leistungsart l : vp.getLeistungsarten()) {
|
||||
p.getLeistungsarten().add(l.produceRequestObject());
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
private static ELRahmenvereinbarungType createRahmenvereinbarung(String nr) {
|
||||
ELRahmenvereinbarungType r = new ELRahmenvereinbarungType();
|
||||
r.setRahmenVebnr(nr);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.Month;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class DefaultUnfallBuilder {
|
||||
|
||||
public static VerkaufsproduktUnfall createDefault() {
|
||||
|
||||
return new VerkaufsproduktUnfall(
|
||||
LocalDate.now().plusDays(3),
|
||||
2,
|
||||
Calendar.AUGUST,
|
||||
"6342342346",
|
||||
10,
|
||||
false
|
||||
).setRahmenvertrag("243234234", 0)
|
||||
.add(new VersichertePerson(
|
||||
"Ansgar", "Meyer", LocalDate.of(1955, Month.FEBRUARY, 20),
|
||||
"Schüttelstraße", "77", 1020, "Wien",
|
||||
"Angestellter", null
|
||||
)
|
||||
.add(new LeistungsartUnfalltod(10000))
|
||||
.add(new LeistungsartInvaliditaet(100000))
|
||||
.add(new LeistungsartUnfallrente(1900))
|
||||
.add(new LeistungsartSpitalgeld(20))
|
||||
.add(new LeistungsartUnfallkosten(1250))
|
||||
.add(new LaUnfallAssistance())
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
public class LaUnfallAssistance extends Leistungsart {
|
||||
|
||||
|
||||
public LaUnfallAssistance() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeistungsartUnfallType produceRequestObject() {
|
||||
LeistungsartUnfallType la = OUOF.createLeistungsartUnfallType();
|
||||
la.setEingeschlossen(true);
|
||||
return la;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public abstract class Leistungsart {
|
||||
|
||||
protected static final at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.ObjectFactory OUOF =
|
||||
new at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.ObjectFactory();
|
||||
|
||||
private BigDecimal versicherungssumme;
|
||||
|
||||
public Leistungsart() {
|
||||
}
|
||||
|
||||
protected Leistungsart(int versicherungssumme) {
|
||||
// etwas spezielle Art eine 2-stelligen Betrag zu erzeugen
|
||||
this.versicherungssumme = new BigDecimal(versicherungssumme + ".00");
|
||||
}
|
||||
|
||||
public BigDecimal getVersicherungssumme() {
|
||||
return versicherungssumme;
|
||||
}
|
||||
|
||||
public void setVersicherungssumme(BigDecimal versicherungssumme) {
|
||||
this.versicherungssumme = versicherungssumme;
|
||||
}
|
||||
|
||||
abstract public LeistungsartUnfallType produceRequestObject();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
public class LeistungsartInvaliditaet extends Leistungsart {
|
||||
|
||||
public LeistungsartInvaliditaet(
|
||||
Integer vs
|
||||
) {
|
||||
super( vs);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeistungsartUnfallType produceRequestObject() {
|
||||
LeistungsartUnfallType la = OUOF.createLeistungsartUnfallType();
|
||||
la.setEingeschlossen(true);
|
||||
la.setVersicherungssumme(getVersicherungssumme());
|
||||
return la;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
public class LeistungsartSpitalgeld extends Leistungsart {
|
||||
|
||||
|
||||
public LeistungsartSpitalgeld(Integer vs) {
|
||||
super(vs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeistungsartUnfallType produceRequestObject() {
|
||||
LeistungsartUnfallType la = OUOF.createLeistungsartUnfallType();
|
||||
la.setEingeschlossen(true);
|
||||
la.setVersicherungssumme(getVersicherungssumme());
|
||||
return la;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
public class LeistungsartUnfallkosten extends Leistungsart {
|
||||
|
||||
public LeistungsartUnfallkosten(Integer vs) {
|
||||
super(vs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeistungsartUnfallType produceRequestObject() {
|
||||
LeistungsartUnfallType la = OUOF.createLeistungsartUnfallType();
|
||||
la.setEingeschlossen(true);
|
||||
la.setVersicherungssumme(getVersicherungssumme());
|
||||
return la;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
public class LeistungsartUnfallrente extends Leistungsart {
|
||||
|
||||
public LeistungsartUnfallrente(Integer vs) {
|
||||
super(vs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeistungsartUnfallType produceRequestObject() {
|
||||
LeistungsartUnfallType la = OUOF.createLeistungsartUnfallType();
|
||||
la.setEingeschlossen(true);
|
||||
la.setVersicherungssumme(getVersicherungssumme());
|
||||
return la;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.on2antrag.unfall.LeistungsartUnfallType;
|
||||
|
||||
public class LeistungsartUnfalltod extends Leistungsart {
|
||||
public LeistungsartUnfalltod(Integer vs) {
|
||||
super(vs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LeistungsartUnfallType produceRequestObject() {
|
||||
LeistungsartUnfallType la = OUOF.createLeistungsartUnfallType();
|
||||
la.setEingeschlossen(true);
|
||||
la.setVersicherungssumme(getVersicherungssumme());
|
||||
return la;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VerkaufsproduktUnfall {
|
||||
|
||||
private LocalDate vertragsbeginn;
|
||||
private int zahlrhythmus;
|
||||
private int monatHauptfaelligkeit;
|
||||
private String vermittlerNr;
|
||||
private String rahmenvertragsnummer;
|
||||
private Integer rahmenvertragsRabatt;
|
||||
private int dauerInJahren;
|
||||
private boolean indexanpassung;
|
||||
private BigDecimal praemie;
|
||||
|
||||
// Unterelemente
|
||||
private List<VersichertePerson> versichertePersonen = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Fügt eine versicherte Person zum Verkaufsprodukt hinzu.
|
||||
* Versicherte Person ist die Kombination aus Partnerdaten, Risikodaten der Person, und
|
||||
* Deckung (Unfallprodukt).
|
||||
* @param vp die versicherte Person
|
||||
* @return dieses Verkaufsprodukt
|
||||
*/
|
||||
public VerkaufsproduktUnfall add(VersichertePerson vp) {
|
||||
versichertePersonen.add(vp);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(
|
||||
"VerkaufsproduktUnfall\n" +
|
||||
" ├─ Vertragsbeginn = " + vertragsbeginn + "\n" +
|
||||
" ├─ Zahlrhythmus = " + zahlrhythmus + "\n" +
|
||||
" ├─ Monat Hauptfaelligkeit = " + monatHauptfaelligkeit + "\n" +
|
||||
" ├─ Vermittlernummer = '" + vermittlerNr + '\'' + "\n" +
|
||||
" ├─ Rahmenvertragsnummer = '" + rahmenvertragsnummer + '\'' + "\n" +
|
||||
" ├─ RahmenvertragsRabatt = " + rahmenvertragsRabatt + "\n" +
|
||||
" ├─ Dauer In Jahren = " + dauerInJahren + "\n" +
|
||||
" ├─ Indexanpassung = " + indexanpassung + "\n");
|
||||
|
||||
if(praemie !=null)
|
||||
b.append(
|
||||
" ├─ PRAEMIE Bto = ( " + praemie + " EUR )\n");
|
||||
|
||||
b.append(
|
||||
" └─ Versicherte Personen \n" +
|
||||
" │\n");
|
||||
versichertePersonen.forEach(b::append);
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public VerkaufsproduktUnfall setRahmenvertrag(String number, int prozentRabatt) {
|
||||
this.rahmenvertragsnummer = number;
|
||||
this.rahmenvertragsRabatt = prozentRabatt;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LocalDate getVertragsbeginn() {
|
||||
return vertragsbeginn;
|
||||
}
|
||||
|
||||
public void setVertragsbeginn(LocalDate vertragsbeginn) {
|
||||
this.vertragsbeginn = vertragsbeginn;
|
||||
}
|
||||
|
||||
public int getZahlrhythmus() {
|
||||
return zahlrhythmus;
|
||||
}
|
||||
|
||||
public void setZahlrhythmus(int zahlrhythmus) {
|
||||
this.zahlrhythmus = zahlrhythmus;
|
||||
}
|
||||
|
||||
public int getMonatHauptfaelligkeit() {
|
||||
return monatHauptfaelligkeit;
|
||||
}
|
||||
|
||||
public void setMonatHauptfaelligkeit(int monatHauptfaelligkeit) {
|
||||
this.monatHauptfaelligkeit = monatHauptfaelligkeit;
|
||||
}
|
||||
|
||||
public String getVermittlerNr() {
|
||||
return vermittlerNr;
|
||||
}
|
||||
|
||||
public void setVermittlerNr(String vermittlerNr) {
|
||||
this.vermittlerNr = vermittlerNr;
|
||||
}
|
||||
|
||||
public String getRahmenvertragsnummer() {
|
||||
return rahmenvertragsnummer;
|
||||
}
|
||||
|
||||
public void setRahmenvertragsnummer(String rahmenvertragsnummer) {
|
||||
this.rahmenvertragsnummer = rahmenvertragsnummer;
|
||||
}
|
||||
|
||||
public Integer getRahmenvertragsRabatt() {
|
||||
return rahmenvertragsRabatt;
|
||||
}
|
||||
|
||||
public void setRahmenvertragsRabatt(Integer rahmenvertragsRabatt) {
|
||||
this.rahmenvertragsRabatt = rahmenvertragsRabatt;
|
||||
}
|
||||
|
||||
public int getDauerInJahren() {
|
||||
return dauerInJahren;
|
||||
}
|
||||
|
||||
public void setDauerInJahren(int dauerInJahren) {
|
||||
this.dauerInJahren = dauerInJahren;
|
||||
}
|
||||
|
||||
public boolean isIndexanpassung() {
|
||||
return indexanpassung;
|
||||
}
|
||||
|
||||
public void setIndexanpassung(boolean indexanpassung) {
|
||||
this.indexanpassung = indexanpassung;
|
||||
}
|
||||
|
||||
public BigDecimal getPraemie() {
|
||||
return praemie;
|
||||
}
|
||||
|
||||
public void setPraemie(BigDecimal praemie) {
|
||||
this.praemie = praemie;
|
||||
}
|
||||
|
||||
public List<VersichertePerson> getVersichertePersonen() {
|
||||
return versichertePersonen;
|
||||
}
|
||||
|
||||
public void setVersichertePersonen(List<VersichertePerson> versichertePersonen) {
|
||||
this.versichertePersonen = versichertePersonen;
|
||||
}
|
||||
|
||||
public VerkaufsproduktUnfall(
|
||||
LocalDate vertragsbeginn,
|
||||
int zahlrhythmus,
|
||||
int monatHauptfaelligkeit,
|
||||
String vermittlerNr,
|
||||
int dauerInJahren,
|
||||
boolean indexanpassung
|
||||
) {
|
||||
this.vertragsbeginn = vertragsbeginn;
|
||||
this.zahlrhythmus = zahlrhythmus;
|
||||
this.monatHauptfaelligkeit = monatHauptfaelligkeit;
|
||||
this.vermittlerNr = vermittlerNr;
|
||||
this.rahmenvertragsnummer = rahmenvertragsnummer;
|
||||
this.rahmenvertragsRabatt = rahmenvertragsRabatt;
|
||||
this.dauerInJahren = dauerInJahren;
|
||||
this.indexanpassung = indexanpassung;
|
||||
this.praemie = praemie;
|
||||
this.versichertePersonen = versichertePersonen;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package at.vvo.omds.client.api.unfall;
|
||||
|
||||
import at.vvo.omds.types.omds3Types.r2025_05.common.PersonType;
|
||||
import com.kapdion.omdsclient.BuildRequestHelper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VersichertePerson {
|
||||
|
||||
private PersonType person;
|
||||
private String hauptberuf;
|
||||
private String nebenberuf;
|
||||
|
||||
private List<Leistungsart> leistungsarten = new ArrayList<>();
|
||||
|
||||
private Integer lfnr;
|
||||
|
||||
public VersichertePerson(
|
||||
String vorname,
|
||||
String nachname,
|
||||
LocalDate gebDat,
|
||||
String adresse,
|
||||
String hausnummer,
|
||||
int plz,
|
||||
String ort,
|
||||
String hauptberuf,
|
||||
String nebenberuf
|
||||
) {
|
||||
this.person = BuildRequestHelper.createNatPerson(vorname, nachname, gebDat, adresse, hausnummer, plz, ort);
|
||||
this.hauptberuf = hauptberuf;
|
||||
this.nebenberuf = nebenberuf;
|
||||
}
|
||||
|
||||
public PersonType getPerson() {
|
||||
return person;
|
||||
}
|
||||
|
||||
public void setPerson(PersonType person) {
|
||||
this.person = person;
|
||||
}
|
||||
|
||||
public String getHauptberuf() {
|
||||
return hauptberuf;
|
||||
}
|
||||
|
||||
public void setHauptberuf(String hauptberuf) {
|
||||
this.hauptberuf = hauptberuf;
|
||||
}
|
||||
|
||||
public String getNebenberuf() {
|
||||
return nebenberuf;
|
||||
}
|
||||
|
||||
public void setNebenberuf(String nebenberuf) {
|
||||
this.nebenberuf = nebenberuf;
|
||||
}
|
||||
|
||||
public List<Leistungsart> getLeistungsarten() {
|
||||
return leistungsarten;
|
||||
}
|
||||
|
||||
public void setLeistungsarten(List<Leistungsart> leistungsarten) {
|
||||
this.leistungsarten = leistungsarten;
|
||||
}
|
||||
|
||||
public Integer getLfnr() {
|
||||
return lfnr;
|
||||
}
|
||||
|
||||
public void setLfnr(Integer lfnr) {
|
||||
this.lfnr = lfnr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fügt eine Leistungsart zur versicherten Person hinzu.
|
||||
* @param leistungsart die Leistungsart
|
||||
* @return diese versicherte Person
|
||||
*/
|
||||
public VersichertePerson add(Leistungsart leistungsart) {
|
||||
leistungsarten.add(leistungsart);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(
|
||||
" VersichertePerson \n" +
|
||||
" ├─ Person=" + person + "\n" +
|
||||
" ├─ Hauptberuf='" + hauptberuf + '\'' + "\n" +
|
||||
" ├─ Lfnr=" + lfnr + "\n" +
|
||||
" └─ Leistungsarten \n" +
|
||||
" │\n");
|
||||
return b.toString();
|
||||
}
|
||||
}
|
||||
15
OMDSServiceDefinition/src/main/resources/log4j.properties
Normal file
15
OMDSServiceDefinition/src/main/resources/log4j.properties
Normal file
@@ -0,0 +1,15 @@
|
||||
# Logging Properties fuer Produktion
|
||||
# Root logger
|
||||
log4j.rootLogger=INFO, stdout
|
||||
|
||||
# Define stdout Appender
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %-12c{1}:%-3L - %m%n
|
||||
|
||||
# Log-Level fuer Projekt
|
||||
log4j.logger.at.vvo=INFO
|
||||
|
||||
# Wenn gewünscht, z.B. ändern auf Debug
|
||||
#log4j.logger.at.vvo=DEBUG
|
||||
@@ -0,0 +1,27 @@
|
||||
package omdsclient;
|
||||
|
||||
import at.vvo.omds.client.api.SOAPConnector;
|
||||
import at.vvo.omds.client.api.UnfallCalcService;
|
||||
import at.vvo.omds.client.api.unfall.*;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class OmdsclientApplicationTests {
|
||||
|
||||
Logger log = Logger.getLogger(OmdsclientApplicationTests.class.getName());
|
||||
SOAPConnector soapConnector = new SOAPConnector();
|
||||
UnfallCalcService serviceWst = new UnfallCalcService(soapConnector);
|
||||
|
||||
@Test
|
||||
public void contextLoads() throws Exception {
|
||||
VerkaufsproduktUnfall input = DefaultUnfallBuilder.createDefault();
|
||||
log.info(input.toString());
|
||||
|
||||
// Berechnung
|
||||
VerkaufsproduktUnfall result = serviceWst.calc(input);
|
||||
|
||||
// zeige Ergebnis
|
||||
log.info(result.toString());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user