Commit 2c57c3e5 authored by eddie.woo's avatar eddie.woo

decimal format

parent c64c1e24
package pwc.taxtech.atms.common.util;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import pwc.taxtech.atms.constant.Constant;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
public class PwCDecimalSerialize extends JsonSerializer<BigDecimal> {
private DecimalFormat df = new DecimalFormat(Constant.DECIMAL_FORMAT);
@Override
public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (null != value) {
gen.writeString(df.format(value));
}
}
}
package pwc.taxtech.atms.constant; package pwc.taxtech.atms.constant;
import java.io.File; import java.io.File;
import java.text.DecimalFormat;
import java.util.Locale; import java.util.Locale;
import java.util.UUID; import java.util.UUID;
...@@ -114,4 +115,7 @@ public final class Constant { ...@@ -114,4 +115,7 @@ public final class Constant {
public static final String YEAR_MONTH = "yyyy-MM"; public static final String YEAR_MONTH = "yyyy-MM";
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
} }
public static String DECIMAL_FORMAT = "#,##0.00";
public static String ZERO_STR = "0";
} }
\ No newline at end of file
package pwc.taxtech.atms.dto.vatdto; package pwc.taxtech.atms.dto.vatdto;
import javax.annotation.Nullable; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import pwc.taxtech.atms.common.util.PwCDecimalSerialize;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
...@@ -9,26 +11,26 @@ public class TrialBalanceDto { ...@@ -9,26 +11,26 @@ public class TrialBalanceDto {
private Integer periodId; private Integer periodId;
private String acctCode; private String acctCode;
private String customerCode; private String customerCode;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal begDebitBal; private BigDecimal begDebitBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal begCreditBal; private BigDecimal begCreditBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal begBal; private BigDecimal begBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal endBal; private BigDecimal endBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal endDebitBal; private BigDecimal endDebitBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal endCreditBal; private BigDecimal endCreditBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal debitBal; private BigDecimal debitBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal creditBal; private BigDecimal creditBal;
private Integer monthId; private Integer monthId;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal yearDebitBal; private BigDecimal yearDebitBal;
@Nullable @JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal yearCreditBal; private BigDecimal yearCreditBal;
private String parentCode; private String parentCode;
private String accountName; private String accountName;
...@@ -69,75 +71,75 @@ public class TrialBalanceDto { ...@@ -69,75 +71,75 @@ public class TrialBalanceDto {
this.customerCode = customerCode; this.customerCode = customerCode;
} }
@Nullable
public BigDecimal getBegDebitBal() { public BigDecimal getBegDebitBal() {
return this.begDebitBal; return this.begDebitBal;
} }
public void setBegDebitBal(@Nullable BigDecimal begDebitBal) { public void setBegDebitBal(BigDecimal begDebitBal) {
this.begDebitBal = begDebitBal; this.begDebitBal = begDebitBal;
} }
@Nullable
public BigDecimal getBegCreditBal() { public BigDecimal getBegCreditBal() {
return this.begCreditBal; return this.begCreditBal;
} }
public void setBegCreditBal(@Nullable BigDecimal begCreditBal) { public void setBegCreditBal(BigDecimal begCreditBal) {
this.begCreditBal = begCreditBal; this.begCreditBal = begCreditBal;
} }
@Nullable
public BigDecimal getBegBal() { public BigDecimal getBegBal() {
return this.begBal; return this.begBal;
} }
public void setBegBal(@Nullable BigDecimal begBal) { public void setBegBal(BigDecimal begBal) {
this.begBal = begBal; this.begBal = begBal;
} }
@Nullable
public BigDecimal getEndBal() { public BigDecimal getEndBal() {
return this.endBal; return this.endBal;
} }
public void setEndBal(@Nullable BigDecimal endBal) { public void setEndBal(BigDecimal endBal) {
this.endBal = endBal; this.endBal = endBal;
} }
@Nullable
public BigDecimal getEndDebitBal() { public BigDecimal getEndDebitBal() {
return this.endDebitBal; return this.endDebitBal;
} }
public void setEndDebitBal(@Nullable BigDecimal endDebitBal) { public void setEndDebitBal(BigDecimal endDebitBal) {
this.endDebitBal = endDebitBal; this.endDebitBal = endDebitBal;
} }
@Nullable
public BigDecimal getEndCreditBal() { public BigDecimal getEndCreditBal() {
return this.endCreditBal; return this.endCreditBal;
} }
public void setEndCreditBal(@Nullable BigDecimal endCreditBal) { public void setEndCreditBal(BigDecimal endCreditBal) {
this.endCreditBal = endCreditBal; this.endCreditBal = endCreditBal;
} }
@Nullable
public BigDecimal getDebitBal() { public BigDecimal getDebitBal() {
return this.debitBal; return this.debitBal;
} }
public void setDebitBal(@Nullable BigDecimal debitBal) { public void setDebitBal(BigDecimal debitBal) {
this.debitBal = debitBal; this.debitBal = debitBal;
} }
@Nullable
public BigDecimal getCreditBal() { public BigDecimal getCreditBal() {
return this.creditBal; return this.creditBal;
} }
public void setCreditBal(@Nullable BigDecimal creditBal) { public void setCreditBal(BigDecimal creditBal) {
this.creditBal = creditBal; this.creditBal = creditBal;
} }
...@@ -149,21 +151,21 @@ public class TrialBalanceDto { ...@@ -149,21 +151,21 @@ public class TrialBalanceDto {
this.monthId = monthId; this.monthId = monthId;
} }
@Nullable
public BigDecimal getYearDebitBal() { public BigDecimal getYearDebitBal() {
return this.yearDebitBal; return this.yearDebitBal;
} }
public void setYearDebitBal(@Nullable BigDecimal yearDebitBal) { public void setYearDebitBal(BigDecimal yearDebitBal) {
this.yearDebitBal = yearDebitBal; this.yearDebitBal = yearDebitBal;
} }
@Nullable
public BigDecimal getYearCreditBal() { public BigDecimal getYearCreditBal() {
return this.yearCreditBal; return this.yearCreditBal;
} }
public void setYearCreditBal(@Nullable BigDecimal yearCreditBal) { public void setYearCreditBal(BigDecimal yearCreditBal) {
this.yearCreditBal = yearCreditBal; this.yearCreditBal = yearCreditBal;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment