|
@@ -6,7 +6,11 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
|
|
|
import com.tsystems.inwo.vgl.view.EinkommenZeile;
|
|
import com.tsystems.inwo.vgl.view.EinkommenZeile;
|
|
|
import com.tsystems.inwo.vgl.view.FreibetragZeile;
|
|
import com.tsystems.inwo.vgl.view.FreibetragZeile;
|
|
|
import com.tsystems.inwo.vgl.view.KitaZeile;
|
|
import com.tsystems.inwo.vgl.view.KitaZeile;
|
|
|
|
|
+import com.tsystems.inwo.vgl.view.MieteZeile;
|
|
|
|
|
+import com.tsystems.inwo.vgl.view.MitbewohnerZeile;
|
|
|
import com.tsystems.inwo.vgl.view.MitgliedRow;
|
|
import com.tsystems.inwo.vgl.view.MitgliedRow;
|
|
|
|
|
+import com.tsystems.inwo.vgl.view.UntermieterZeile;
|
|
|
|
|
+import com.tsystems.inwo.vgl.view.WohnungZeile;
|
|
|
import com.tsystems.inwo.vgl.view.SharedRecords.Pair;
|
|
import com.tsystems.inwo.vgl.view.SharedRecords.Pair;
|
|
|
import com.tsystems.inwo.vgl.util.FormatUtil;
|
|
import com.tsystems.inwo.vgl.util.FormatUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -428,4 +432,434 @@ public class VergleichDataExtractor {
|
|
|
|
|
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public WohnungZeile buildWohnungZeile(JsonNode rightZeitraum, JsonNode leftZeitraum) {
|
|
|
|
|
+ // Extract ausstattung from both zeitraums
|
|
|
|
|
+ JsonNode rightAusstattung = rightZeitraum != null ? rightZeitraum.path("ausstattung") : null;
|
|
|
|
|
+ JsonNode leftAusstattung = leftZeitraum != null ? leftZeitraum.path("ausstattung") : null;
|
|
|
|
|
+
|
|
|
|
|
+ // Determine status and detect changes
|
|
|
|
|
+ String symbol = "";
|
|
|
|
|
+ String symbolClass = "";
|
|
|
|
|
+ String rowClass = "";
|
|
|
|
|
+ boolean hasChanges = false;
|
|
|
|
|
+
|
|
|
|
|
+ if (rightAusstattung != null && !rightAusstattung.isMissingNode() &&
|
|
|
|
|
+ leftAusstattung != null && !leftAusstattung.isMissingNode()) {
|
|
|
|
|
+ // Both exist - check for changes
|
|
|
|
|
+ hasChanges = comparisonService.detectAusstattungChanges(rightAusstattung, leftAusstattung);
|
|
|
|
|
+ if (hasChanges) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("CHANGED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("CHANGED");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (rightAusstattung != null && !rightAusstattung.isMissingNode() &&
|
|
|
|
|
+ (leftAusstattung == null || leftAusstattung.isMissingNode())) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("ADDED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("ADDED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("ADDED");
|
|
|
|
|
+ } else if ((rightAusstattung == null || rightAusstattung.isMissingNode()) &&
|
|
|
|
|
+ leftAusstattung != null && !leftAusstattung.isMissingNode()) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("REMOVED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("REMOVED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("REMOVED");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Build HTML fields with change detection
|
|
|
|
|
+ String mietverhaeltnisHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("mietverhaeltnis").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String flaecheHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> String.format("%.2f", a.path("flaeche").asDouble(0.0)), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String badHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("bad").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String nameEigHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("nameEig").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String telefonEigHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("telefonEig").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String sozBauJnHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("sozBauJn").asBoolean(false) ? "☑" : "☐", hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String fertigDatHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> {
|
|
|
|
|
+ String fertigDat = a.path("fertigDat").asText("");
|
|
|
|
|
+ return !fertigDat.isEmpty() ? FormatUtil.date(fertigDat) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String heizungHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("heizung").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String adresseEigHtml = htmlService.buildAusstattungFieldHtml(rightAusstattung, leftAusstattung,
|
|
|
|
|
+ a -> a.path("adresseEig").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ return new WohnungZeile(
|
|
|
|
|
+ symbol, symbolClass, rowClass,
|
|
|
|
|
+ mietverhaeltnisHtml, flaecheHtml, badHtml, nameEigHtml,
|
|
|
|
|
+ telefonEigHtml, sozBauJnHtml, fertigDatHtml, heizungHtml, adresseEigHtml
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<UntermieterZeile> buildUntermieterZeilen(JsonNode rightZeitraum, JsonNode leftZeitraum) {
|
|
|
|
|
+ // Extract miete and then untermieter arrays from both zeitraums
|
|
|
|
|
+ JsonNode rightMiete = rightZeitraum != null ? rightZeitraum.path("miete") : null;
|
|
|
|
|
+ JsonNode leftMiete = leftZeitraum != null ? leftZeitraum.path("miete") : null;
|
|
|
|
|
+
|
|
|
|
|
+ ArrayNode rightUntermieter = rightMiete != null && rightMiete.has("untermieter") && rightMiete.get("untermieter").isArray()
|
|
|
|
|
+ ? (ArrayNode) rightMiete.get("untermieter")
|
|
|
|
|
+ : new ObjectMapper().createArrayNode();
|
|
|
|
|
+ ArrayNode leftUntermieter = leftMiete != null && leftMiete.has("untermieter") && leftMiete.get("untermieter").isArray()
|
|
|
|
|
+ ? (ArrayNode) leftMiete.get("untermieter")
|
|
|
|
|
+ : new ObjectMapper().createArrayNode();
|
|
|
|
|
+
|
|
|
|
|
+ // UNION über untermieter[].lfdnr (da lfdnr der eindeutige Identifier ist)
|
|
|
|
|
+ Map<String, Pair<JsonNode, JsonNode>> untermieterPairs = comparisonService.unionByKey(
|
|
|
|
|
+ rightUntermieter, leftUntermieter, n -> String.valueOf(n.path("lfdnr").asInt())
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ List<UntermieterZeile> result = new ArrayList<>();
|
|
|
|
|
+ for (Map.Entry<String, Pair<JsonNode, JsonNode>> entry : untermieterPairs.entrySet()) {
|
|
|
|
|
+ JsonNode rightItem = entry.getValue().right;
|
|
|
|
|
+ JsonNode leftItem = entry.getValue().left;
|
|
|
|
|
+
|
|
|
|
|
+ // Determine status and changes
|
|
|
|
|
+ String symbol = "";
|
|
|
|
|
+ String symbolClass = "";
|
|
|
|
|
+ String rowClass = "";
|
|
|
|
|
+ boolean hasChanges = false;
|
|
|
|
|
+
|
|
|
|
|
+ if (rightItem != null && leftItem != null) {
|
|
|
|
|
+ hasChanges = comparisonService.detectUntermieterChanges(rightItem, leftItem);
|
|
|
|
|
+ if (hasChanges) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("CHANGED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("CHANGED");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (rightItem != null && leftItem == null) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("ADDED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("ADDED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("ADDED");
|
|
|
|
|
+ } else if (rightItem == null && leftItem != null) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("REMOVED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("REMOVED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("REMOVED");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Use primary data (right first, then left)
|
|
|
|
|
+ JsonNode primaryItem = rightItem != null ? rightItem : leftItem;
|
|
|
|
|
+
|
|
|
|
|
+ if (primaryItem != null) {
|
|
|
|
|
+ String nameHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("name").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String vornameHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("vorname").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String mieteHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> String.format("%.2f €", i.path("miete").asDouble(0.0)), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String flaecheHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> String.format("%.2f m²", i.path("flaeche").asDouble(0.0)), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String sonstHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double sonst = i.path("sonst").asDouble(0.0);
|
|
|
|
|
+ return sonst > 0 ? String.format("%.2f €", sonst) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String heizungHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double heizung = i.path("heizung").asDouble(0.0);
|
|
|
|
|
+ return heizung > 0 ? String.format("%.2f €", heizung) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String heizungPHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("heizungP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String warmwasserHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double warmwasser = i.path("warmwasser").asDouble(0.0);
|
|
|
|
|
+ return warmwasser > 0 ? String.format("%.2f €", warmwasser) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String warmwasserPHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("warmwasserP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String moeblierungHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double moeblierung = i.path("moeblierung").asDouble(0.0);
|
|
|
|
|
+ return moeblierung > 0 ? String.format("%.2f €", moeblierung) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String moeblierungPHtml = htmlService.buildUntermieterFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("moeblierungP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ result.add(new UntermieterZeile(
|
|
|
|
|
+ symbol, symbolClass, rowClass,
|
|
|
|
|
+ nameHtml, vornameHtml, mieteHtml, flaecheHtml, sonstHtml,
|
|
|
|
|
+ heizungHtml, heizungPHtml, warmwasserHtml, warmwasserPHtml,
|
|
|
|
|
+ moeblierungHtml, moeblierungPHtml
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public List<MitbewohnerZeile> buildMitbewohnerZeilen(JsonNode rightZeitraum, JsonNode leftZeitraum) {
|
|
|
|
|
+ // Extract miete and then mitbewohner arrays from both zeitraums
|
|
|
|
|
+ JsonNode rightMiete = rightZeitraum != null ? rightZeitraum.path("miete") : null;
|
|
|
|
|
+ JsonNode leftMiete = leftZeitraum != null ? leftZeitraum.path("miete") : null;
|
|
|
|
|
+
|
|
|
|
|
+ ArrayNode rightMitbewohner = rightMiete != null && rightMiete.has("mitbewohner") && rightMiete.get("mitbewohner").isArray()
|
|
|
|
|
+ ? (ArrayNode) rightMiete.get("mitbewohner")
|
|
|
|
|
+ : new ObjectMapper().createArrayNode();
|
|
|
|
|
+ ArrayNode leftMitbewohner = leftMiete != null && leftMiete.has("mitbewohner") && leftMiete.get("mitbewohner").isArray()
|
|
|
|
|
+ ? (ArrayNode) leftMiete.get("mitbewohner")
|
|
|
|
|
+ : new ObjectMapper().createArrayNode();
|
|
|
|
|
+
|
|
|
|
|
+ // UNION über mitbewohner[].lfdnr (da lfdnr der eindeutige Identifier ist)
|
|
|
|
|
+ Map<String, Pair<JsonNode, JsonNode>> mitbewohnerPairs = comparisonService.unionByKey(
|
|
|
|
|
+ rightMitbewohner, leftMitbewohner, n -> String.valueOf(n.path("lfdnr").asInt())
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ List<MitbewohnerZeile> result = new ArrayList<>();
|
|
|
|
|
+ for (Map.Entry<String, Pair<JsonNode, JsonNode>> entry : mitbewohnerPairs.entrySet()) {
|
|
|
|
|
+ JsonNode rightItem = entry.getValue().right;
|
|
|
|
|
+ JsonNode leftItem = entry.getValue().left;
|
|
|
|
|
+
|
|
|
|
|
+ // Determine status and changes
|
|
|
|
|
+ String symbol = "";
|
|
|
|
|
+ String symbolClass = "";
|
|
|
|
|
+ String rowClass = "";
|
|
|
|
|
+ boolean hasChanges = false;
|
|
|
|
|
+
|
|
|
|
|
+ if (rightItem != null && leftItem != null) {
|
|
|
|
|
+ hasChanges = comparisonService.detectMitbewohnerChanges(rightItem, leftItem);
|
|
|
|
|
+ if (hasChanges) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("CHANGED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("CHANGED");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (rightItem != null && leftItem == null) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("ADDED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("ADDED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("ADDED");
|
|
|
|
|
+ } else if (rightItem == null && leftItem != null) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("REMOVED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("REMOVED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("REMOVED");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Use primary data (right first, then left)
|
|
|
|
|
+ JsonNode primaryItem = rightItem != null ? rightItem : leftItem;
|
|
|
|
|
+
|
|
|
|
|
+ if (primaryItem != null) {
|
|
|
|
|
+ String nameHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("name").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String vornameHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("vorname").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String entgeltHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> String.format("%.2f €", i.path("entgelt").asDouble(0.0)), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String sonstHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double sonst = i.path("sonst").asDouble(0.0);
|
|
|
|
|
+ return sonst > 0 ? String.format("%.2f €", sonst) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String heizungHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double heizung = i.path("heizung").asDouble(0.0);
|
|
|
|
|
+ return heizung > 0 ? String.format("%.2f €", heizung) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String heizungPHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("heizungP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String warmwasserHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> {
|
|
|
|
|
+ double warmwasser = i.path("warmwasser").asDouble(0.0);
|
|
|
|
|
+ return warmwasser > 0 ? String.format("%.2f €", warmwasser) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String warmwasserPHtml = htmlService.buildMitbewohnerFieldHtml(rightItem, leftItem,
|
|
|
|
|
+ i -> i.path("warmwasserP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ result.add(new MitbewohnerZeile(
|
|
|
|
|
+ symbol, symbolClass, rowClass,
|
|
|
|
|
+ nameHtml, vornameHtml, entgeltHtml, sonstHtml,
|
|
|
|
|
+ heizungHtml, heizungPHtml, warmwasserHtml, warmwasserPHtml
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public MieteZeile buildMieteZeile(JsonNode rightZeitraum, JsonNode leftZeitraum) {
|
|
|
|
|
+ // Extract miete from both zeitraums
|
|
|
|
|
+ JsonNode rightMiete = rightZeitraum != null ? rightZeitraum.path("miete") : null;
|
|
|
|
|
+ JsonNode leftMiete = leftZeitraum != null ? leftZeitraum.path("miete") : null;
|
|
|
|
|
+
|
|
|
|
|
+ // Determine status and detect changes
|
|
|
|
|
+ String symbol = "";
|
|
|
|
|
+ String symbolClass = "";
|
|
|
|
|
+ String rowClass = "";
|
|
|
|
|
+ boolean hasChanges = false;
|
|
|
|
|
+
|
|
|
|
|
+ if (rightMiete != null && !rightMiete.isMissingNode() &&
|
|
|
|
|
+ leftMiete != null && !leftMiete.isMissingNode()) {
|
|
|
|
|
+ // Both exist - check for changes
|
|
|
|
|
+ hasChanges = comparisonService.detectMieteChanges(rightMiete, leftMiete);
|
|
|
|
|
+ if (hasChanges) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("CHANGED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("CHANGED");
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (rightMiete != null && !rightMiete.isMissingNode() &&
|
|
|
|
|
+ (leftMiete == null || leftMiete.isMissingNode())) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("ADDED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("ADDED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("ADDED");
|
|
|
|
|
+ } else if ((rightMiete == null || rightMiete.isMissingNode()) &&
|
|
|
|
|
+ leftMiete != null && !leftMiete.isMissingNode()) {
|
|
|
|
|
+ symbol = comparisonService.getSymbolFor("REMOVED");
|
|
|
|
|
+ symbolClass = comparisonService.getSymbolClassFor("REMOVED");
|
|
|
|
|
+ rowClass = comparisonService.getRowClassFor("REMOVED");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Build HTML fields with change detection
|
|
|
|
|
+ // Linke Spalte - Allgemeine Daten
|
|
|
|
|
+ String gesamtmieteHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> String.format("%.2f €", m.path("miete").asDouble(0.0)), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String zuschlägeHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double sonstZuschlag = m.path("sonstZuschlag").asDouble(0.0);
|
|
|
|
|
+ double moeblierung = m.path("moeblierung").asDouble(0.0);
|
|
|
|
|
+ double gewerbeZuschlag = m.path("gewerbeZuschlag").asDouble(0.0);
|
|
|
|
|
+ double umietZuschlag = m.path("umietZuschlag").asDouble(0.0);
|
|
|
|
|
+ double total = sonstZuschlag + moeblierung + gewerbeZuschlag + umietZuschlag;
|
|
|
|
|
+ return total > 0 ? String.format("%.2f €", total) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String artZuschlagHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("sonstZuschlagBeschr").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String jhrlFernwaermeHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double jhrlFernwaerme = m.path("jhrlFernwaerme").asDouble(0.0);
|
|
|
|
|
+ return jhrlFernwaerme > 0 ? String.format("%.2f €", jhrlFernwaerme) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String jhrlFernwarmwasserHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double jhrlFernwarmw = m.path("jhrlFernwarmw").asDouble(0.0);
|
|
|
|
|
+ return jhrlFernwarmw > 0 ? String.format("%.2f €", jhrlFernwarmw) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String jhrlFernwUndWHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double jhrlFernWUndW = m.path("jhrlFernWUndW").asDouble(0.0);
|
|
|
|
|
+ return jhrlFernWUndW > 0 ? String.format("%.2f €", jhrlFernWUndW) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ // Mittlere Spalte - Abzüge
|
|
|
|
|
+ String heizungHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double heizung = m.path("heizung").asDouble(0.0);
|
|
|
|
|
+ return heizung > 0 ? String.format("%.2f €", heizung) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String warmwasserHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double warmwasser = m.path("warmwasser").asDouble(0.0);
|
|
|
|
|
+ return warmwasser > 0 ? String.format("%.2f €", warmwasser) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String kostenHhEnergieHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double energie = m.path("energie").asDouble(0.0);
|
|
|
|
|
+ return energie > 0 ? String.format("%.2f €", energie) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String stellplatzHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double stellplatz = m.path("stellplatz").asDouble(0.0);
|
|
|
|
|
+ return stellplatz > 0 ? String.format("%.2f €", stellplatz) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String moeblierungszuschlagHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double moeblierung = m.path("moeblierung").asDouble(0.0);
|
|
|
|
|
+ return moeblierung > 0 ? String.format("%.2f €", moeblierung) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String gewerbezuschlagHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double gewerbeZuschlag = m.path("gewerbeZuschlag").asDouble(0.0);
|
|
|
|
|
+ return gewerbeZuschlag > 0 ? String.format("%.2f €", gewerbeZuschlag) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String untermietzuschlagHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double umietZuschlag = m.path("umietZuschlag").asDouble(0.0);
|
|
|
|
|
+ return umietZuschlag > 0 ? String.format("%.2f €", umietZuschlag) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String sonstZuschlagHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double sonstZuschlag = m.path("sonstZuschlag").asDouble(0.0);
|
|
|
|
|
+ return sonstZuschlag > 0 ? String.format("%.2f €", sonstZuschlag) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String leistungenDritterHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double beitragDritter = m.path("beitragDritter").asDouble(0.0);
|
|
|
|
|
+ return beitragDritter > 0 ? String.format("%.2f €", beitragDritter) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ // Rechte Spalte - Pauschalen
|
|
|
|
|
+ String heizungPauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("heizungP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String warmwasserPauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("warmwasserP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String energiePauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("energieP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String stellplatzPauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("stellplatzP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String moeblierungPauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("moeblierungP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String gewerbePauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("gewerbeZuschlagP").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ String sonstPauschaleHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> m.path("sonstZuschlagBeschr").asText(""), hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ // 4. Spalte - Gewerbefläche
|
|
|
|
|
+ String gewerbeflaecheHtml = htmlService.buildMieteFieldHtml(rightMiete, leftMiete,
|
|
|
|
|
+ m -> {
|
|
|
|
|
+ double gewerbeFlaeche = m.path("gewerbeFlaeche").asDouble(0.0);
|
|
|
|
|
+ return gewerbeFlaeche > 0 ? String.format("%.2f m²", gewerbeFlaeche) : "";
|
|
|
|
|
+ }, hasChanges);
|
|
|
|
|
+
|
|
|
|
|
+ return new MieteZeile(
|
|
|
|
|
+ rowClass, symbol, symbolClass,
|
|
|
|
|
+ gesamtmieteHtml, zuschlägeHtml, artZuschlagHtml,
|
|
|
|
|
+ jhrlFernwaermeHtml, jhrlFernwarmwasserHtml, jhrlFernwUndWHtml,
|
|
|
|
|
+ heizungHtml, warmwasserHtml, kostenHhEnergieHtml, stellplatzHtml,
|
|
|
|
|
+ moeblierungszuschlagHtml, gewerbezuschlagHtml, untermietzuschlagHtml,
|
|
|
|
|
+ sonstZuschlagHtml, leistungenDritterHtml,
|
|
|
|
|
+ heizungPauschaleHtml, warmwasserPauschaleHtml, energiePauschaleHtml,
|
|
|
|
|
+ stellplatzPauschaleHtml, moeblierungPauschaleHtml, gewerbePauschaleHtml,
|
|
|
|
|
+ sonstPauschaleHtml, gewerbeflaecheHtml
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|