diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF02ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF02ObjectTag.java index 5b303458a..cf5d5f2de 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF02ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF02ObjectTag.java @@ -1,66 +1,52 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Objects; +import java.util.Optional; import ru.clearing.classes.statics.data.sdf.SDf02; public class DF02ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "CURR_CODE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String currCode; @JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String account; @JacksonXmlProperty(isAttribute = true, localName = "REMAINDER") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String remainder; @JacksonXmlProperty(isAttribute = true, localName = "DEAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String deal; @JacksonXmlProperty(isAttribute = true, localName = "ACC_CODE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accCode; @JacksonXmlProperty(isAttribute = true, localName = "DAT") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate dat; @JacksonXmlProperty(isAttribute = true, localName = "MARKET") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String market; @JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accName; @JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accType; @JacksonXmlProperty(isAttribute = true, localName = "SUMENGAGE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sumengage; @JacksonXmlProperty(isAttribute = true, localName = "SUMUNBLOK") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sumunblock; @JacksonXmlProperty(isAttribute = true, localName = "FILE_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String fileType; @JacksonXmlProperty(isAttribute = true, localName = "RESULT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String result; public DF02ObjectTag() { @@ -70,19 +56,19 @@ public class DF02ObjectTag extends ObjectTag { @Override public void setData(SDf02 entity) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy"); - this.currCode = entity.getCurr_code(); - this.account = entity.getAccount(); - this.remainder = entity.getRemainder(); - this.deal = entity.getDeal(); - this.accCode = entity.getAcc_code(); + this.currCode = Optional.ofNullable(entity.getCurr_code()).orElse(""); + this.account = Optional.ofNullable(entity.getAccount()).orElse(""); + this.remainder = Optional.ofNullable(entity.getRemainder()).orElse(""); + this.deal = Optional.ofNullable(entity.getDeal()).orElse(""); + this.accCode = Optional.ofNullable(entity.getAcc_code()).orElse(""); this.dat = LocalDate.parse(entity.getDat(), dtf); - this.market = entity.getMarket(); - this.accName = entity.getAcc_name(); - this.accType = entity.getAcc_type(); - this.sumengage = entity.getSumengage(); - this.sumunblock = entity.getSumunblock(); - this.fileType = entity.getFile_type(); - this.result = entity.getResult(); + this.market = Optional.ofNullable(entity.getMarket()).orElse(""); + this.accName = Optional.ofNullable(entity.getAcc_name()).orElse(""); + this.accType = Optional.ofNullable(entity.getAcc_type()).orElse(""); + this.sumengage = Optional.ofNullable(entity.getSumengage()).orElse(""); + this.sumunblock = Optional.ofNullable(entity.getSumunblock()).orElse(""); + this.fileType = Optional.ofNullable(entity.getFile_type()).orElse(""); + this.result = Optional.ofNullable(entity.getResult()).orElse(""); } @Override diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF03ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF03ObjectTag.java index 157fe2557..7deb30ae4 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF03ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF03ObjectTag.java @@ -2,37 +2,30 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Objects; +import java.util.Optional; import ru.clearing.classes.statics.data.sdf.SDf03; public class DF03ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String segType; @JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docType; @JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docnmRef; @JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docnmprev; @JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String cAccDeb; @JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sbanknam1; @JsonIgnore private String sbanknam2; @@ -44,11 +37,9 @@ public class DF03ObjectTag extends ObjectTag { private String sbanknam5; @JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String cAccCred; @JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String rbanknam1; @JsonIgnore private String rbanknam2; @@ -60,24 +51,19 @@ public class DF03ObjectTag extends ObjectTag { private String rbanknam5; @JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate payDate; @JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String payVal; @JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sumDeb; @JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String specif1; @JacksonXmlProperty(isAttribute = true, localName = "IMP_RESULT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String impResult; @@ -88,27 +74,27 @@ public class DF03ObjectTag extends ObjectTag { @Override public void setData(SDf03 entity) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy"); - this.segType = entity.getSeg_type(); - this.docType = entity.getDoc_type(); - this.docnmRef = entity.getDocnm_ref(); - this.docnmprev = entity.getDocnmprev(); - this.cAccDeb = entity.getC_acc_deb(); - this.sbanknam1 = entity.getSbanknam1(); - this.sbanknam2 = entity.getSbanknam2(); - this.sbanknam3 = entity.getSbanknam3(); - this.sbanknam4 = entity.getSbanknam4(); - this.sbanknam5 = entity.getSbanknam5(); - this.cAccCred = entity.getC_acc_cred(); - this.rbanknam1 = entity.getRbanknam1(); - this.rbanknam2 = entity.getRbanknam2(); - this.rbanknam3 = entity.getRbanknam3(); - this.rbanknam4 = entity.getRbanknam4(); - this.rbanknam5 = entity.getRbanknam5(); + this.segType = Optional.ofNullable(entity.getSeg_type()).orElse(""); + this.docType = Optional.ofNullable(entity.getDoc_type()).orElse(""); + this.docnmRef = Optional.ofNullable(entity.getDocnm_ref()).orElse(""); + this.docnmprev = Optional.ofNullable(entity.getDocnmprev()).orElse(""); + this.cAccDeb = Optional.ofNullable(entity.getC_acc_deb()).orElse(""); + this.sbanknam1 = Optional.ofNullable(entity.getSbanknam1()).orElse(""); + this.sbanknam2 = Optional.ofNullable(entity.getSbanknam2()).orElse(""); + this.sbanknam3 = Optional.ofNullable(entity.getSbanknam3()).orElse(""); + this.sbanknam4 = Optional.ofNullable(entity.getSbanknam4()).orElse(""); + this.sbanknam5 = Optional.ofNullable(entity.getSbanknam5()).orElse(""); + this.cAccCred = Optional.ofNullable(entity.getC_acc_cred()).orElse(""); + this.rbanknam1 = Optional.ofNullable(entity.getRbanknam1()).orElse(""); + this.rbanknam2 = Optional.ofNullable(entity.getRbanknam2()).orElse(""); + this.rbanknam3 = Optional.ofNullable(entity.getRbanknam3()).orElse(""); + this.rbanknam4 = Optional.ofNullable(entity.getRbanknam4()).orElse(""); + this.rbanknam5 = Optional.ofNullable(entity.getRbanknam5()).orElse(""); this.payDate = LocalDate.parse(entity.getPay_date(), dtf); - this.payVal = entity.getPay_val(); - this.sumDeb = entity.getSum_deb(); - this.specif1 = entity.getSpecif_1(); - this.impResult = entity.getImp_result(); + this.payVal = Optional.ofNullable(entity.getPay_val()).orElse(""); + this.sumDeb = Optional.ofNullable(entity.getSum_deb()).orElse(""); + this.specif1 = Optional.ofNullable(entity.getSpecif_1()).orElse(""); + this.impResult = Optional.ofNullable(entity.getImp_result()).orElse(""); } @Override diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF05ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF05ObjectTag.java index b7cb00c82..ded7ece25 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF05ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF05ObjectTag.java @@ -1,8 +1,6 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.math.BigDecimal; import java.time.LocalDate; @@ -13,21 +11,17 @@ import ru.clearing.classes.statics.data.sdf.SDf05; public class DF05ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "TP") - @JsonSetter(nulls = Nulls.AS_EMPTY) private BigDecimal tp; @JacksonXmlProperty(isAttribute = true, localName = "DT") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate dt; @JacksonXmlProperty(isAttribute = true, localName = "TM") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "hh:mm:ss") private LocalTime tm; @JacksonXmlProperty(isAttribute = true, localName = "PR") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String pr; public DF05ObjectTag() { diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF07ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF07ObjectTag.java index 1137ba91b..abde6d155 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF07ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF07ObjectTag.java @@ -1,71 +1,56 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Objects; +import java.util.Optional; import ru.clearing.classes.statics.data.sdf.SDf07; public class DF07ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String account; @JacksonXmlProperty(isAttribute = true, localName = "SUM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private BigDecimal sum; @JacksonXmlProperty(isAttribute = true, localName = "MARKET") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String market; @JacksonXmlProperty(isAttribute = true, localName = "TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String type; @JacksonXmlProperty(isAttribute = true, localName = "DEAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String deal; @JacksonXmlProperty(isAttribute = true, localName = "CLIENTN") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String clientN; @JacksonXmlProperty(isAttribute = true, localName = "INN") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String inn; @JacksonXmlProperty(isAttribute = true, localName = "BIC") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String bic; @JacksonXmlProperty(isAttribute = true, localName = "SPEC") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String spec; @JacksonXmlProperty(isAttribute = true, localName = "NUMBER") - @JsonSetter(nulls = Nulls.AS_EMPTY) private BigDecimal number; @JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docNum; @JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate docDate; @JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String payVal; @JacksonXmlProperty(isAttribute = true, localName = "RESULT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private BigDecimal result; @@ -76,20 +61,20 @@ public class DF07ObjectTag extends ObjectTag { @Override public void setData(SDf07 entity) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy"); - this.account = entity.getAccount(); + this.account = Optional.ofNullable(entity.getAccount()).orElse(""); this.sum = entity.getSum(); - this.market = entity.getMarket(); - this.type = entity.getType(); - this.deal = entity.getDeal(); - this.clientN = entity.getClientN(); - this.inn = entity.getInn(); - this.bic = entity.getBic(); - this.spec = entity.getSpec(); + this.market = Optional.ofNullable(entity.getMarket()).orElse(""); + this.type = Optional.ofNullable(entity.getType()).orElse(""); + this.deal = Optional.ofNullable(entity.getDeal()).orElse(""); + this.clientN = Optional.ofNullable(entity.getClientN()).orElse(""); + this.inn = Optional.ofNullable(entity.getInn()).orElse(""); + this.bic = Optional.ofNullable(entity.getBic()).orElse(""); + this.spec = Optional.ofNullable(entity.getSpec()).orElse(""); this.number = entity.getNumber(); this.result = entity.getResult(); - this.docNum = entity.getDoc_num(); + this.docNum = Optional.ofNullable(entity.getDoc_num()).orElse(""); this.docDate = LocalDate.parse(entity.getDoc_date(), dtf); - this.payVal = entity.getPay_val(); + this.payVal = Optional.ofNullable(entity.getPay_val()).orElse(""); } @Override diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF51ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF51ObjectTag.java index 7dd6d891c..fc028ad32 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF51ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF51ObjectTag.java @@ -2,8 +2,6 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.time.Instant; import java.time.LocalDateTime; @@ -14,15 +12,12 @@ import ru.clearing.classes.statics.data.sdf.SDf51; public class DF51ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "NUMBER") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String number; @JacksonXmlProperty(isAttribute = true, localName = "UNIXTIME") - @JsonSetter(nulls = Nulls.AS_EMPTY) private Long unixtime; @JacksonXmlProperty(isAttribute = true, localName = "DATETIME") - @JsonSetter(nulls = Nulls.AS_EMPTY) @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") private LocalDateTime datetime; diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF53ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF53ObjectTag.java index 0230ab567..8aa9683be 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF53ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF53ObjectTag.java @@ -1,45 +1,36 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Objects; +import java.util.Optional; import ru.clearing.classes.statics.data.sdf.SDf53; public class DF53ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String account; @JacksonXmlProperty(isAttribute = true, localName = "ACC_NAME") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accName; @JacksonXmlProperty(isAttribute = true, localName = "DEAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String deal; @JacksonXmlProperty(isAttribute = true, localName = "DATE") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate date; @JacksonXmlProperty(isAttribute = true, localName = "STATUS") - @JsonSetter(nulls = Nulls.AS_EMPTY) private Long status; @JacksonXmlProperty(isAttribute = true, localName = "ACC_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accType; @JacksonXmlProperty(isAttribute = true, localName = "RESULT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String result; - public DF53ObjectTag() { super(SDf53.class); } @@ -47,13 +38,13 @@ public class DF53ObjectTag extends ObjectTag { @Override public void setData(SDf53 entity) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy"); - this.account = entity.getAccount(); - this.accName = entity.getAccName(); - this.deal = entity.getDeal(); + this.account = Optional.ofNullable(entity.getAccount()).orElse(""); + this.accName = Optional.ofNullable(entity.getAccName()).orElse(""); + this.deal = Optional.ofNullable(entity.getDeal()).orElse(""); this.date = LocalDate.parse(entity.getDate(), dtf); this.status = entity.getStatus(); - this.accType = entity.getAccType(); - this.result = entity.getResult(); + this.accType = Optional.ofNullable(entity.getAccType()).orElse(""); + this.result = Optional.ofNullable(entity.getResult()).orElse(""); } @Override diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF54ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF54ObjectTag.java index c8b994fa4..cb3eb358a 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF54ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF54ObjectTag.java @@ -2,41 +2,33 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Objects; +import java.util.Optional; import ru.clearing.classes.statics.data.sdf.SDf54; public class DF54ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "SEG_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String segType; @JacksonXmlProperty(isAttribute = true, localName = "DOC_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docType; @JacksonXmlProperty(isAttribute = true, localName = "DOCNM_REF") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docnmRef; @JacksonXmlProperty(isAttribute = true, localName = "DOCNMPREV") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docnmprev; @JacksonXmlProperty(isAttribute = true, localName = "SBANKCODE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sbankcode; @JacksonXmlProperty(isAttribute = true, localName = "C_ACC_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String cAccDeb; @JacksonXmlProperty(isAttribute = true, localName = "SBANKNAM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sbanknam1; @JsonIgnore private String sbanknam2; @@ -48,15 +40,12 @@ public class DF54ObjectTag extends ObjectTag { private String sbanknam5; @JacksonXmlProperty(isAttribute = true, localName = "RBANKCODE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String rbankcode; @JacksonXmlProperty(isAttribute = true, localName = "C_ACC_CRED") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String cAccCred; @JacksonXmlProperty(isAttribute = true, localName = "RBANKNAM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String rbanknam1; @JsonIgnore private String rbanknam2; @@ -68,28 +57,22 @@ public class DF54ObjectTag extends ObjectTag { private String rbanknam5; @JacksonXmlProperty(isAttribute = true, localName = "OP_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String opType; @JacksonXmlProperty(isAttribute = true, localName = "OP_ORDER") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String opOrder; @JacksonXmlProperty(isAttribute = true, localName = "PAY_DATE") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate payDate; @JacksonXmlProperty(isAttribute = true, localName = "PAY_VAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String payVal; @JacksonXmlProperty(isAttribute = true, localName = "SUM_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sumDeb; @JacksonXmlProperty(isAttribute = true, localName = "SCLIENTN") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sclientn1; @JsonIgnore private String sclientn2; @@ -99,19 +82,15 @@ public class DF54ObjectTag extends ObjectTag { private String sclientn4; @JacksonXmlProperty(isAttribute = true, localName = "INN_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String innDeb; @JacksonXmlProperty(isAttribute = true, localName = "KPP_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String kppDeb; @JacksonXmlProperty(isAttribute = true, localName = "ACC_DEB") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accDeb; @JacksonXmlProperty(isAttribute = true, localName = "RCLIENTN") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String rclientn1; @JsonIgnore private String rclientn2; @@ -121,52 +100,40 @@ public class DF54ObjectTag extends ObjectTag { private String rclientn4; @JacksonXmlProperty(isAttribute = true, localName = "INN_CRED") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String innCred; @JacksonXmlProperty(isAttribute = true, localName = "KPP_CRED") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String kppCred; @JacksonXmlProperty(isAttribute = true, localName = "ACC_KR_1") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String accKr1; @JacksonXmlProperty(isAttribute = true, localName = "SPECIF_1") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String specif1; @JacksonXmlProperty(isAttribute = true, localName = "SEND_TYPE") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String sendType; @JacksonXmlProperty(isAttribute = true, localName = "DOC_RESULT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docResult; @JacksonXmlProperty(isAttribute = true, localName = "DOC_NUM") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String docNum; @JacksonXmlProperty(isAttribute = true, localName = "DOC_DATE") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate docDate; @JacksonXmlProperty(isAttribute = true, localName = "VALUE_DATE") - @JsonSetter(nulls = Nulls.AS_EMPTY) @JsonFormat(pattern = "yyyy-MM-dd") private LocalDate valueDate; @JacksonXmlProperty(isAttribute = true, localName = "SWIFT_BEN") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String swiftBen; @JacksonXmlProperty(isAttribute = true, localName = "SWIFT_INT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String swiftInt; - public DF54ObjectTag() { super(SDf54.class); } @@ -174,51 +141,51 @@ public class DF54ObjectTag extends ObjectTag { @Override public void setData(SDf54 entity) { final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd.MM.yy"); - this.segType = entity.getSeg_type(); - this.docType = entity.getDoc_type(); - this.docnmRef = entity.getDocnm_ref(); - this.docnmprev = entity.getDocnmprev(); - this.sbankcode = entity.getSbankcode(); - this.cAccDeb = entity.getC_acc_deb(); - this.sbanknam1 = entity.getSbanknam1(); - this.sbanknam2 = entity.getSbanknam2(); - this.sbanknam3 = entity.getSbanknam3(); - this.sbanknam4 = entity.getSbanknam4(); - this.sbanknam5 = entity.getSbanknam5(); - this.rbankcode = entity.getRbankcode(); - this.cAccCred = entity.getC_acc_cred(); - this.rbanknam1 = entity.getRbanknam1(); - this.rbanknam2 = entity.getRbanknam2(); - this.rbanknam3 = entity.getRbanknam3(); - this.rbanknam4 = entity.getRbanknam4(); - this.rbanknam5 = entity.getRbanknam5(); - this.opType = entity.getOp_type(); - this.opOrder = entity.getOp_order(); + this.segType = Optional.ofNullable(entity.getSeg_type()).orElse(""); + this.docType = Optional.ofNullable(entity.getDoc_type()).orElse(""); + this.docnmRef = Optional.ofNullable(entity.getDocnm_ref()).orElse(""); + this.docnmprev = Optional.ofNullable(entity.getDocnmprev()).orElse(""); + this.sbankcode = Optional.ofNullable(entity.getSbankcode()).orElse(""); + this.cAccDeb = Optional.ofNullable(entity.getC_acc_deb()).orElse(""); + this.sbanknam1 = Optional.ofNullable(entity.getSbanknam1()).orElse(""); + this.sbanknam2 = Optional.ofNullable(entity.getSbanknam2()).orElse(""); + this.sbanknam3 = Optional.ofNullable(entity.getSbanknam3()).orElse(""); + this.sbanknam4 = Optional.ofNullable(entity.getSbanknam4()).orElse(""); + this.sbanknam5 = Optional.ofNullable(entity.getSbanknam5()).orElse(""); + this.rbankcode = Optional.ofNullable(entity.getRbankcode()).orElse(""); + this.cAccCred = Optional.ofNullable(entity.getC_acc_cred()).orElse(""); + this.rbanknam1 = Optional.ofNullable(entity.getRbanknam1()).orElse(""); + this.rbanknam2 = Optional.ofNullable(entity.getRbanknam2()).orElse(""); + this.rbanknam3 = Optional.ofNullable(entity.getRbanknam3()).orElse(""); + this.rbanknam4 = Optional.ofNullable(entity.getRbanknam4()).orElse(""); + this.rbanknam5 = Optional.ofNullable(entity.getRbanknam5()).orElse(""); + this.opType = Optional.ofNullable(entity.getOp_type()).orElse(""); + this.opOrder = Optional.ofNullable(entity.getOp_order()).orElse(""); this.payDate = LocalDate.parse(entity.getPay_date(), dtf); - this.payVal = entity.getPay_val(); - this.sumDeb = entity.getSum_deb(); - this.sclientn1 = entity.getSclientn1(); - this.sclientn2 = entity.getSclientn2(); - this.sclientn3 = entity.getSclientn3(); - this.sclientn4 = entity.getSclientn4(); - this.innDeb = entity.getInn_deb(); - this.kppDeb = entity.getKpp_deb(); - this.accDeb = entity.getAcc_deb(); - this.rclientn1 = entity.getRclientn1(); - this.rclientn2 = entity.getRclientn2(); - this.rclientn3 = entity.getRclientn3(); - this.rclientn4 = entity.getRclientn4(); - this.innCred = entity.getInn_cred(); - this.kppCred = entity.getKpp_cred(); - this.accKr1 = entity.getAcc_kr_1(); - this.specif1 = entity.getSpecif_1(); - this.sendType = entity.getSend_type(); - this.docResult = entity.getDoc_result(); - this.docNum = entity.getDoc_num(); + this.payVal = Optional.ofNullable(entity.getPay_val()).orElse(""); + this.sumDeb = Optional.ofNullable(entity.getSum_deb()).orElse(""); + this.sclientn1 = Optional.ofNullable(entity.getSclientn1()).orElse(""); + this.sclientn2 = Optional.ofNullable(entity.getSclientn2()).orElse(""); + this.sclientn3 = Optional.ofNullable(entity.getSclientn3()).orElse(""); + this.sclientn4 = Optional.ofNullable(entity.getSclientn4()).orElse(""); + this.innDeb = Optional.ofNullable(entity.getInn_deb()).orElse(""); + this.kppDeb = Optional.ofNullable(entity.getKpp_deb()).orElse(""); + this.accDeb = Optional.ofNullable(entity.getAcc_deb()).orElse(""); + this.rclientn1 = Optional.ofNullable(entity.getRclientn1()).orElse(""); + this.rclientn2 = Optional.ofNullable(entity.getRclientn2()).orElse(""); + this.rclientn3 = Optional.ofNullable(entity.getRclientn3()).orElse(""); + this.rclientn4 = Optional.ofNullable(entity.getRclientn4()).orElse(""); + this.innCred = Optional.ofNullable(entity.getInn_cred()).orElse(""); + this.kppCred = Optional.ofNullable(entity.getKpp_cred()).orElse(""); + this.accKr1 = Optional.ofNullable(entity.getAcc_kr_1()).orElse(""); + this.specif1 = Optional.ofNullable(entity.getSpecif_1()).orElse(""); + this.sendType = Optional.ofNullable(entity.getSend_type()).orElse(""); + this.docResult = Optional.ofNullable(entity.getDoc_result()).orElse(""); + this.docNum = Optional.ofNullable(entity.getDoc_num()).orElse(""); this.docDate = LocalDate.parse(entity.getDoc_date(), dtf); this.valueDate = LocalDate.parse(entity.getValue_date(), dtf); - this.swiftBen = entity.getSwift_ben(); - this.swiftInt = entity.getSwift_int(); + this.swiftBen = Optional.ofNullable(entity.getSwift_ben()).orElse(""); + this.swiftInt = Optional.ofNullable(entity.getSwift_int()).orElse(""); } @Override diff --git a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF56ObjectTag.java b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF56ObjectTag.java index 8932df084..187482815 100644 --- a/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF56ObjectTag.java +++ b/clearing-parent/xml-exporter/src/main/java/ru/spcex/clearing/xml/exporter/logic/data/tags/objects/DF56ObjectTag.java @@ -1,50 +1,41 @@ package ru.spcex.clearing.xml.exporter.logic.data.tags.objects; import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Objects; +import java.util.Optional; import org.springframework.format.annotation.DateTimeFormat; import ru.clearing.classes.statics.data.sdf.SDf56; public class DF56ObjectTag extends ObjectTag { @JacksonXmlProperty(isAttribute = true, localName = "NUMBER") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String number; @JacksonXmlProperty(isAttribute = true, localName = "SUNIXTIME") - @JsonSetter(nulls = Nulls.AS_EMPTY) private Long startUnixtime; @JacksonXmlProperty(isAttribute = true, localName = "SDATETIME") - @JsonSetter(nulls = Nulls.AS_EMPTY) @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") private LocalDateTime startDatetime; @JacksonXmlProperty(isAttribute = true, localName = "EUNIXTIME") - @JsonSetter(nulls = Nulls.AS_EMPTY) private Long endUnixtime; @JacksonXmlProperty(isAttribute = true, localName = "EDATETIME") - @JsonSetter(nulls = Nulls.AS_EMPTY) @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm:ss") private LocalDateTime endDatetime; @JacksonXmlProperty(isAttribute = true, localName = "ACCOUNT") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String account; @JacksonXmlProperty(isAttribute = true, localName = "DEAL") - @JsonSetter(nulls = Nulls.AS_EMPTY) private String deal; - public DF56ObjectTag() { super(SDf56.class); } @@ -56,8 +47,8 @@ public class DF56ObjectTag extends ObjectTag { this.startDatetime = Instant.ofEpochMilli(this.startUnixtime).atZone(ZoneId.systemDefault()).toLocalDateTime(); this.endUnixtime = Long.valueOf(entity.getEnd_datetime()); this.endDatetime = Instant.ofEpochMilli(this.endUnixtime).atZone(ZoneId.systemDefault()).toLocalDateTime(); - this.account = entity.getAccount() == null ? "" : entity.getAccount(); - this.deal = entity.getDeal() == null ? "" : entity.getDeal(); + this.account = Optional.ofNullable(entity.getAccount()).orElse(""); + this.deal = Optional.ofNullable(entity.getDeal()).orElse(""); } @Override