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;
import java.io.File;
import java.text.DecimalFormat;
import java.util.Locale;
import java.util.UUID;
......@@ -114,4 +115,7 @@ public final class Constant {
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 String DECIMAL_FORMAT = "#,##0.00";
public static String ZERO_STR = "0";
}
\ No newline at end of file
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.util.List;
......@@ -9,26 +11,26 @@ public class TrialBalanceDto {
private Integer periodId;
private String acctCode;
private String customerCode;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal begDebitBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal begCreditBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal begBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal endBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal endDebitBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal endCreditBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal debitBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal creditBal;
private Integer monthId;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal yearDebitBal;
@Nullable
@JsonSerialize(using = PwCDecimalSerialize.class)
private BigDecimal yearCreditBal;
private String parentCode;
private String accountName;
......@@ -69,75 +71,75 @@ public class TrialBalanceDto {
this.customerCode = customerCode;
}
@Nullable
public BigDecimal getBegDebitBal() {
return this.begDebitBal;
}
public void setBegDebitBal(@Nullable BigDecimal begDebitBal) {
public void setBegDebitBal(BigDecimal begDebitBal) {
this.begDebitBal = begDebitBal;
}
@Nullable
public BigDecimal getBegCreditBal() {
return this.begCreditBal;
}
public void setBegCreditBal(@Nullable BigDecimal begCreditBal) {
public void setBegCreditBal(BigDecimal begCreditBal) {
this.begCreditBal = begCreditBal;
}
@Nullable
public BigDecimal getBegBal() {
return this.begBal;
}
public void setBegBal(@Nullable BigDecimal begBal) {
public void setBegBal(BigDecimal begBal) {
this.begBal = begBal;
}
@Nullable
public BigDecimal getEndBal() {
return this.endBal;
}
public void setEndBal(@Nullable BigDecimal endBal) {
public void setEndBal(BigDecimal endBal) {
this.endBal = endBal;
}
@Nullable
public BigDecimal getEndDebitBal() {
return this.endDebitBal;
}
public void setEndDebitBal(@Nullable BigDecimal endDebitBal) {
public void setEndDebitBal(BigDecimal endDebitBal) {
this.endDebitBal = endDebitBal;
}
@Nullable
public BigDecimal getEndCreditBal() {
return this.endCreditBal;
}
public void setEndCreditBal(@Nullable BigDecimal endCreditBal) {
public void setEndCreditBal(BigDecimal endCreditBal) {
this.endCreditBal = endCreditBal;
}
@Nullable
public BigDecimal getDebitBal() {
return this.debitBal;
}
public void setDebitBal(@Nullable BigDecimal debitBal) {
public void setDebitBal(BigDecimal debitBal) {
this.debitBal = debitBal;
}
@Nullable
public BigDecimal getCreditBal() {
return this.creditBal;
}
public void setCreditBal(@Nullable BigDecimal creditBal) {
public void setCreditBal(BigDecimal creditBal) {
this.creditBal = creditBal;
}
......@@ -149,21 +151,21 @@ public class TrialBalanceDto {
this.monthId = monthId;
}
@Nullable
public BigDecimal getYearDebitBal() {
return this.yearDebitBal;
}
public void setYearDebitBal(@Nullable BigDecimal yearDebitBal) {
public void setYearDebitBal(BigDecimal yearDebitBal) {
this.yearDebitBal = yearDebitBal;
}
@Nullable
public BigDecimal getYearCreditBal() {
return this.yearCreditBal;
}
public void setYearCreditBal(@Nullable BigDecimal yearCreditBal) {
public void setYearCreditBal(BigDecimal 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