Commit 3ba9ce87 authored by frank.xa.zhang's avatar frank.xa.zhang

add code for data preview module

parent 2aaba395
package pwc.taxtech.atms.dto.vatdto;
import java.util.Collection;
public class BalanceSubTotalDto {
private String begCreditBal ;
private String begDebitBal ;
private String endCreditBal ;
private String endDebitBal ;
private String yearCreditBal ;
private String yearDebitBal ;
private String debitBal ;
private String creditBal ;
public String getBegCreditBal() {
return begCreditBal;
}
public void setBegCreditBal(String begCreditBal) {
this.begCreditBal = begCreditBal;
}
public String getBegDebitBal() {
return begDebitBal;
}
public void setBegDebitBal(String begDebitBal) {
this.begDebitBal = begDebitBal;
}
public String getEndCreditBal() {
return endCreditBal;
}
public void setEndCreditBal(String endCreditBal) {
this.endCreditBal = endCreditBal;
}
public String getEndDebitBal() {
return endDebitBal;
}
public void setEndDebitBal(String endDebitBal) {
this.endDebitBal = endDebitBal;
}
public String getYearCreditBal() {
return yearCreditBal;
}
public void setYearCreditBal(String yearCreditBal) {
this.yearCreditBal = yearCreditBal;
}
public String getYearDebitBal() {
return yearDebitBal;
}
public void setYearDebitBal(String yearDebitBal) {
this.yearDebitBal = yearDebitBal;
}
public String getDebitBal() {
return debitBal;
}
public void setDebitBal(String debitBal) {
this.debitBal = debitBal;
}
public String getCreditBal() {
return creditBal;
}
public void setCreditBal(String creditBal) {
this.creditBal = creditBal;
}
}
package pwc.taxtech.atms.dto.vatdto;
import java.util.Collection;
public class BalanceWithSubTotalsResultDto<T> {
private Collection<T> list;
private BalanceSubTotalDto subTotals;
public Collection<T> getList() {
return list;
}
public void setList(Collection<T> list) {
this.list = list;
}
public BalanceSubTotalDto getSubTotals() {
return subTotals;
}
public void setSubTotals(BalanceSubTotalDto subTotals) {
this.subTotals = subTotals;
}
}
package pwc.taxtech.atms.dto.vatdto;
import java.util.List;
public class JsonTrialBalanceTreeNode {
private String balanceId;
private Integer periodId;
private String direction;
private String customerCode;
private String begDebitBal;
private String begCreditBal;
private String begBal;
private String endBal;
private String endDebitBal;
private String endCreditBal;
private Integer monthID;
private String debitBal;
private String creditBal;
private String accountName;
private String acctProp;
private String acctCode;
private String parentCode;
private List<JsonTrialBalanceTreeNode> children;
public String getBalanceId() {
return balanceId;
}
public void setBalanceId(String balanceId) {
this.balanceId = balanceId;
}
public Integer getPeriodId() {
return periodId;
}
public void setPeriodId(Integer periodId) {
this.periodId = periodId;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getCustomerCode() {
return customerCode;
}
public void setCustomerCode(String customerCode) {
this.customerCode = customerCode;
}
public String getBegDebitBal() {
return begDebitBal;
}
public void setBegDebitBal(String begDebitBal) {
this.begDebitBal = begDebitBal;
}
public String getBegCreditBal() {
return begCreditBal;
}
public void setBegCreditBal(String begCreditBal) {
this.begCreditBal = begCreditBal;
}
public String getBegBal() {
return begBal;
}
public void setBegBal(String begBal) {
this.begBal = begBal;
}
public String getEndBal() {
return endBal;
}
public void setEndBal(String endBal) {
this.endBal = endBal;
}
public String getEndDebitBal() {
return endDebitBal;
}
public void setEndDebitBal(String endDebitBal) {
this.endDebitBal = endDebitBal;
}
public String getEndCreditBal() {
return endCreditBal;
}
public void setEndCreditBal(String endCreditBal) {
this.endCreditBal = endCreditBal;
}
public Integer getMonthID() {
return monthID;
}
public void setMonthID(Integer monthID) {
this.monthID = monthID;
}
public String getDebitBal() {
return debitBal;
}
public void setDebitBal(String debitBal) {
this.debitBal = debitBal;
}
public String getCreditBal() {
return creditBal;
}
public void setCreditBal(String creditBal) {
this.creditBal = creditBal;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getAcctProp() {
return acctProp;
}
public void setAcctProp(String acctProp) {
this.acctProp = acctProp;
}
public String getAcctCode() {
return acctCode;
}
public int getAcctCodeLength() {
return acctCode.length();
}
public void setAcctCode(String acctCode) {
this.acctCode = acctCode;
}
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public List<JsonTrialBalanceTreeNode> getChildren() {
return children;
}
public void setChildren(List<JsonTrialBalanceTreeNode> children) {
this.children = children;
}
}
......@@ -31,7 +31,7 @@ public class TrialBalanceFilter {
@Nullable
private BigDecimal creditClosingBalanceTo ;
@Nullable
private boolean hideAllZeroRecords ;
private Boolean hideAllZeroRecords ;
public String getAccountCode() {
return accountCode;
......@@ -158,11 +158,11 @@ public class TrialBalanceFilter {
}
@Nullable
public boolean isHideAllZeroRecords() {
public Boolean isHideAllZeroRecords() {
return hideAllZeroRecords;
}
public void setHideAllZeroRecords(@Nullable boolean hideAllZeroRecords) {
public void setHideAllZeroRecords(@Nullable Boolean hideAllZeroRecords) {
this.hideAllZeroRecords = hideAllZeroRecords;
}
}
......@@ -27,15 +27,15 @@ public class TBDataImportServiceImpl extends VatAbstractService implements TBDat
TrialBalanceDto trialBalanceDto = new TrialBalanceDto();
trialBalanceDto.setAcctCode(item.getAcctCode());
trialBalanceDto.setCustomerCode(item.getCustomerCode());
trialBalanceDto.setBegDebitBal(item.getPeriodId().intValue() == fromPeriod ? item.getBegDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setBegCreditBal(item.getPeriodId().intValue() == fromPeriod ? item.getBegCreditBal() : BigDecimal.ZERO);
trialBalanceDto.setBegBal(item.getPeriodId().intValue() == fromPeriod ? item.getBegBal() : BigDecimal.ZERO);
trialBalanceDto.setEndBal(item.getPeriodId().intValue() == toPeriod ? item.getEndBal() : BigDecimal.ZERO);
trialBalanceDto.setEndDebitBal(item.getPeriodId().intValue() == toPeriod ? item.getEndDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setEndCreditBal(item.getPeriodId().intValue() == toPeriod ? item.getEndCreditBal() : BigDecimal.ZERO);
double summaryA = b.stream().mapToDouble(c -> c.getDebitBal().doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setBegDebitBal(item.getPeriodId() == fromPeriod ? item.getBegDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setBegCreditBal(item.getPeriodId() == fromPeriod ? item.getBegCreditBal() : BigDecimal.ZERO);
trialBalanceDto.setBegBal(item.getPeriodId() == fromPeriod ? item.getBegBal() : BigDecimal.ZERO);
trialBalanceDto.setEndBal(item.getPeriodId() == toPeriod ? item.getEndBal() : BigDecimal.ZERO);
trialBalanceDto.setEndDebitBal(item.getPeriodId() == toPeriod ? item.getEndDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setEndCreditBal(item.getPeriodId() == toPeriod ? item.getEndCreditBal() : BigDecimal.ZERO);
double summaryA = b.stream().mapToDouble(c -> Objects.requireNonNull(c.getDebitBal()).doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setDebitBal(BigDecimal.valueOf(summaryA));
double summaryB = b.stream().mapToDouble(c -> c.getCreditBal().doubleValue()).summaryStatistics().getSum();
double summaryB = b.stream().mapToDouble(c -> Objects.requireNonNull(c.getCreditBal()).doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setCreditBal(BigDecimal.valueOf(summaryB));
trialBalanceDto.setParentCode(item.getParentCode());
trialBalanceDto.setAccountName(item.getAccountName());
......@@ -60,15 +60,15 @@ public class TBDataImportServiceImpl extends VatAbstractService implements TBDat
TrialBalanceDto trialBalanceDto = new TrialBalanceDto();
trialBalanceDto.setAcctCode(item.getAcctCode());
trialBalanceDto.setCustomerCode(item.getCustomerCode());
trialBalanceDto.setBegDebitBal(item.getPeriodId().intValue() == fromPeriod ? item.getBegDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setBegCreditBal(item.getPeriodId().intValue() == fromPeriod ? item.getBegCreditBal() : BigDecimal.ZERO);
trialBalanceDto.setBegBal(item.getPeriodId().intValue() == fromPeriod ? item.getBegBal() : BigDecimal.ZERO);
trialBalanceDto.setEndBal(item.getPeriodId().intValue() == toPeriod ? item.getEndBal() : BigDecimal.ZERO);
trialBalanceDto.setEndDebitBal(item.getPeriodId().intValue() == toPeriod ? item.getEndDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setEndCreditBal(item.getPeriodId().intValue() == toPeriod ? item.getEndCreditBal() : BigDecimal.ZERO);
double summaryA = b.stream().mapToDouble(c -> c.getDebitBal().doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setBegDebitBal(item.getPeriodId() == fromPeriod ? item.getBegDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setBegCreditBal(item.getPeriodId() == fromPeriod ? item.getBegCreditBal() : BigDecimal.ZERO);
trialBalanceDto.setBegBal(item.getPeriodId() == fromPeriod ? item.getBegBal() : BigDecimal.ZERO);
trialBalanceDto.setEndBal(item.getPeriodId() == toPeriod ? item.getEndBal() : BigDecimal.ZERO);
trialBalanceDto.setEndDebitBal(item.getPeriodId() == toPeriod ? item.getEndDebitBal() : BigDecimal.ZERO);
trialBalanceDto.setEndCreditBal(item.getPeriodId() == toPeriod ? item.getEndCreditBal() : BigDecimal.ZERO);
double summaryA = b.stream().mapToDouble(c -> Objects.requireNonNull(c.getDebitBal()).doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setDebitBal(BigDecimal.valueOf(summaryA));
double summaryB = b.stream().mapToDouble(c -> c.getCreditBal().doubleValue()).summaryStatistics().getSum();
double summaryB = b.stream().mapToDouble(c -> Objects.requireNonNull(c.getCreditBal()).doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setCreditBal(BigDecimal.valueOf(summaryB));
trialBalanceDto.setParentCode(item.getParentCode());
trialBalanceDto.setAccountName(item.getAccountName());
......@@ -79,80 +79,81 @@ public class TBDataImportServiceImpl extends VatAbstractService implements TBDat
return result;
}
@Deprecated
private List<TrialBalanceDto> dealNullValue(List<TrialBalanceDto> dataList) {
int BegDebitBal = 0, BegCreditBal = 0, BegBal = 0, EndBal = 0;
int EndDebitBal = 0, EndCreditBal = 0, DebitBal = 0, CreditBal = 0, MonthId = 0, CustomerCode = 0;
int begDebitBal = 0, begCreditBal = 0, begBal = 0, endBal = 0;
int endDebitBal = 0, endCreditBal = 0, debitBal = 0, creditBal = 0, monthId = 0, customerCode = 0;
if (dataList != null && !dataList.isEmpty()) {
if (dataList.stream().anyMatch(a -> a.getMonthId() != null)) {
MonthId = 1;
monthId = 1;
}
if (dataList.stream().anyMatch(a -> StringUtils.isNotBlank(a.getCustomerCode()))) {
CustomerCode = 1;
customerCode = 1;
}
if (dataList.stream().anyMatch(p -> p.getBegDebitBal() != null)) {
BegDebitBal = 1;
begDebitBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getBegCreditBal() != null)) {
BegCreditBal = 1;
begCreditBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getBegBal() != null)) {
BegBal = 1;
begBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getEndBal() != null)) {
EndBal = 1;
endBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getEndDebitBal() != null)) {
EndDebitBal = 1;
endDebitBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getEndCreditBal() != null)) {
EndCreditBal = 1;
endCreditBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getDebitBal() != null)) {
DebitBal = 1;
debitBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getCreditBal() != null)) {
CreditBal = 1;
creditBal = 1;
}
for (TrialBalanceDto compbalance : dataList) {
if (compbalance.getMonthId() == null && MonthId == 1) {
if (compbalance.getMonthId() == null && monthId == 1) {
compbalance.setMonthId(0);
}
if (CustomerCode == 0) {
if (customerCode == 0) {
compbalance.setCustomerCode(null);
}
if (compbalance.getBegDebitBal() == null && BegDebitBal == 1) {
if (compbalance.getBegDebitBal() == null && begDebitBal == 1) {
compbalance.setBegDebitBal(BigDecimal.ZERO);
}
if (compbalance.getBegCreditBal() == null && BegCreditBal == 1) {
if (compbalance.getBegCreditBal() == null && begCreditBal == 1) {
compbalance.setBegCreditBal(BigDecimal.ZERO);
}
if (compbalance.getBegBal() == null && BegBal == 1) {
if (compbalance.getBegBal() == null && begBal == 1) {
compbalance.setBegBal(BigDecimal.ZERO);
}
if (compbalance.getEndBal() == null && EndBal == 1) {
if (compbalance.getEndBal() == null && endBal == 1) {
compbalance.setEndBal(BigDecimal.ZERO);
}
if (compbalance.getEndDebitBal() == null && EndDebitBal == 1) {
if (compbalance.getEndDebitBal() == null && endDebitBal == 1) {
compbalance.setEndDebitBal(BigDecimal.ZERO);
}
if (compbalance.getEndCreditBal() == null && EndCreditBal == 1) {
if (compbalance.getEndCreditBal() == null && endCreditBal == 1) {
compbalance.setEndCreditBal(BigDecimal.ZERO);
}
if (compbalance.getDebitBal() == null && DebitBal == 1) {
if (compbalance.getDebitBal() == null && debitBal == 1) {
compbalance.setDebitBal(BigDecimal.ZERO);
}
if (compbalance.getCreditBal() == null && CreditBal == 1) {
if (compbalance.getCreditBal() == null && creditBal == 1) {
compbalance.setCreditBal(BigDecimal.ZERO);
}
}
......
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