Commit 7dfa62f2 authored by frank.xa.zhang's avatar frank.xa.zhang

add preview java code

parent 11fdae9a
......@@ -25,7 +25,7 @@ public class CorsFilter extends OncePerRequestFilter {
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
response.setHeader("Access-Control-Allow-Headers",
"origin, content-type, accept, x-requested-with, authorization, x-xsrf-token, X-HTTP-Method-Override, withcredentials, access-control-allow-origin");
"origin, content-type, accept, x-requested-with, authorization, x-xsrf-token, X-HTTP-Method-Override, withcredentials, access-control-allow-origin,from");
response.setHeader("Access-Control-Allow-Credentials", "true");
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
return;
......
......@@ -3,4 +3,5 @@ package pwc.taxtech.atms.constant;
public final class Constant {
public static final String Comma = ",";
public static final String Other = "其他";
public static final int WholeYear = -1;
}
package pwc.taxtech.atms.controller;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceFilter;
import pwc.taxtech.atms.vatService.TBDataImportService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@RequestMapping(value = "api/v1/DataImport")
@RestController
public class TBDataImportController {
private final String CIT_CATEGORY = "CIT";
@Autowired
TBDataImportService tbDataImportService;
@RequestMapping(value = "GetBalanceDataForDisplay", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String GetBalanceDataForDisplay(@RequestBody JSONObject param) {
String category = param.get("category").toString();
int fromPeriod = Integer.parseInt(param.get("fromPeriod").toString());
int toPeriod = Integer.parseInt(param.get("toPeriod").toString());
String criteria = param.get("criteria").toString();
TrialBalanceFilter filter = new TrialBalanceFilter();
if (StringUtils.isBlank(criteria) && !criteria.equals("null")) {
JSONObject jsonObject = new JSONObject();
filter = jsonObject.getObject(criteria, TrialBalanceFilter.class);
} else {
filter = null;
}
// String passResponse =
return "";
}
private String ConvertBalanceDataToUiGridTree(int fromPeriod, int toPeriod, TrialBalanceFilter filter, String category) {
String result = "";
List<TrialBalanceDto> balanceList = new ArrayList<>();
if (category.equals(CIT_CATEGORY)) {
balanceList = tbDataImportService.getTrialBalanceData(fromPeriod, toPeriod);
} else {
balanceList = tbDataImportService.getTrialBalanceStdData(fromPeriod, toPeriod);
}
if (filter != null && !balanceList.isEmpty()) {
}
if (!balanceList.isEmpty()) {
balanceList = balanceList.stream().sorted(Comparator.comparing(TrialBalanceDto::getAcctCode).thenComparing(TrialBalanceDto::getAccotCodeLength)).collect(Collectors.toList());
}
BigDecimal subTotalBegCreditBal = BigDecimal.ZERO;
BigDecimal subTotalBegDebitBal = BigDecimal.ZERO;
BigDecimal subTotalEndCreditBal = BigDecimal.ZERO;
BigDecimal subTotalEndDebitBal = BigDecimal.ZERO;
BigDecimal subTotalCreditBal = BigDecimal.ZERO;
BigDecimal subTotalDebitBal = BigDecimal.ZERO;
List<TrialBalanceDto> subTotalList = new ArrayList<>(balanceList);
boolean isFilterEmpty = true;
if (filter != null &&
(StringUtils.isNotBlank(filter.getAccountCode())
|| StringUtils.isNotBlank(filter.getAccountName())
|| filter.getAccumulatedCreditAmountFrom() != null
|| filter.getAccumulatedCreditAmountTo() != null
|| filter.getAccumulatedDebitAmountFrom() != null
|| filter.getAccumulatedDebitAmountTo() != null
|| filter.getCreditClosingBalanceFrom() != null
|| filter.getCreditClosingBalanceTo() != null
|| filter.getCreditOpeningBalanceFrom() != null
|| filter.getCreditOpeningBalanceTo() != null
|| filter.getDebitClosingBalanceFrom() != null
|| filter.getDebitClosingBalanceTo() != null
|| filter.getDebitOpeningBalanceFrom() != null
|| filter.getDebitOpeningBalanceTo() != null
|| filter.getDebitClosingBalanceFrom() != null)) {
isFilterEmpty = false;
List<String> primaryList = subTotalList.stream().filter(x -> x.getParentCode().equals("0")).map(TrialBalanceDto::getAcctCode).collect(Collectors.toList());
if (!primaryList.isEmpty()) {
for (String parent : primaryList) {
int parentSize = parent.length();
subTotalList.removeAll(
subTotalList.stream().filter(x -> x.getAcctCode().length() != parentSize
&& x.getAcctCode().length() >= parentSize
&& x.getAcctCode().substring(0, parentSize).equals(parent)).collect(Collectors.toList()));
}
if (!subTotalList.isEmpty()) {
subTotalBegCreditBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getBegCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalBegDebitBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getBegDebitBal().doubleValue()).summaryStatistics().getSum());
subTotalEndCreditBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getEndCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalEndDebitBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getEndDebitBal().doubleValue()).summaryStatistics().getSum());
subTotalCreditBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalDebitBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getDebitBal().doubleValue()).summaryStatistics().getSum());
}
} else {
subTotalBegCreditBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getBegCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalBegDebitBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getBegDebitBal().doubleValue()).summaryStatistics().getSum());
subTotalEndCreditBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getEndCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalEndDebitBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getEndDebitBal().doubleValue()).summaryStatistics().getSum());
subTotalCreditBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalDebitBal = BigDecimal.valueOf(subTotalList.stream().mapToDouble(y -> y.getDebitBal().doubleValue()).summaryStatistics().getSum());
}
} else {
isFilterEmpty = true;
subTotalBegCreditBal = BigDecimal.valueOf(subTotalList.stream().filter(x -> x.getParentCode().equals("0")).mapToDouble(y -> y.getBegCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalBegDebitBal = BigDecimal.valueOf(subTotalList.stream().filter(x -> x.getParentCode().equals("0")).mapToDouble(y -> y.getBegDebitBal().doubleValue()).summaryStatistics().getSum());
subTotalEndCreditBal = BigDecimal.valueOf(subTotalList.stream().filter(x -> x.getParentCode().equals("0")).mapToDouble(y -> y.getEndCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalEndDebitBal = BigDecimal.valueOf(subTotalList.stream().filter(x -> x.getParentCode().equals("0")).mapToDouble(y -> y.getEndDebitBal().doubleValue()).summaryStatistics().getSum());
subTotalCreditBal = BigDecimal.valueOf(subTotalList.stream().filter(x -> x.getParentCode().equals("0")).mapToDouble(y -> y.getCreditBal().doubleValue()).summaryStatistics().getSum());
subTotalDebitBal = BigDecimal.valueOf(subTotalList.stream().filter(x -> x.getParentCode().equals("0")).mapToDouble(y -> y.getDebitBal().doubleValue()).summaryStatistics().getSum());
}
//todo: add the code below here
return result;
}
}
package pwc.taxtech.atms.dto.vatdto;
import javax.annotation.Nullable;
import java.math.BigDecimal;
public class TrialBalanceDto {
private String balanceId;
private Integer periodId;
private String acctCode;
private String customerCode;
@Nullable
private BigDecimal begDebitBal;
@Nullable
private BigDecimal begCreditBal;
@Nullable
private BigDecimal begBal;
@Nullable
private BigDecimal endBal;
@Nullable
private BigDecimal endDebitBal;
@Nullable
private BigDecimal endCreditBal;
@Nullable
private BigDecimal debitBal;
@Nullable
private BigDecimal creditBal;
private Integer monthId;
@Nullable
private BigDecimal yearDebitBal;
@Nullable
private BigDecimal yearCreditBal;
private String parentCode;
private String accountName;
private boolean isDuplicate;
private Integer acctProp;
private int direction;
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 getAcctCode() {
return acctCode;
}
public int getAccotCodeLength(){
return acctCode.length();
}
public void setAcctCode(String acctCode) {
this.acctCode = acctCode;
}
public String getCustomerCode() {
return customerCode;
}
public void setCustomerCode(String customerCode) {
this.customerCode = customerCode;
}
@Nullable
public BigDecimal getBegDebitBal() {
return begDebitBal;
}
public void setBegDebitBal(@Nullable BigDecimal begDebitBal) {
this.begDebitBal = begDebitBal;
}
@Nullable
public BigDecimal getBegCreditBal() {
return begCreditBal;
}
public void setBegCreditBal(@Nullable BigDecimal begCreditBal) {
this.begCreditBal = begCreditBal;
}
@Nullable
public BigDecimal getBegBal() {
return begBal;
}
public void setBegBal(@Nullable BigDecimal begBal) {
this.begBal = begBal;
}
@Nullable
public BigDecimal getEndBal() {
return endBal;
}
public void setEndBal(@Nullable BigDecimal endBal) {
this.endBal = endBal;
}
@Nullable
public BigDecimal getEndDebitBal() {
return endDebitBal;
}
public void setEndDebitBal(@Nullable BigDecimal endDebitBal) {
this.endDebitBal = endDebitBal;
}
@Nullable
public BigDecimal getEndCreditBal() {
return endCreditBal;
}
public void setEndCreditBal(@Nullable BigDecimal endCreditBal) {
this.endCreditBal = endCreditBal;
}
@Nullable
public BigDecimal getDebitBal() {
return debitBal;
}
public void setDebitBal(@Nullable BigDecimal debitBal) {
this.debitBal = debitBal;
}
@Nullable
public BigDecimal getCreditBal() {
return creditBal;
}
public void setCreditBal(@Nullable BigDecimal creditBal) {
this.creditBal = creditBal;
}
public Integer getMonthId() {
return monthId;
}
public void setMonthId(Integer monthId) {
this.monthId = monthId;
}
@Nullable
public BigDecimal getYearCreditBal() {
return yearCreditBal;
}
public void setYearCreditBal(@Nullable BigDecimal yearCreditBal) {
this.yearCreditBal = yearCreditBal;
}
public String getParentCode() {
return parentCode;
}
public void setParentCode(String parentCode) {
this.parentCode = parentCode;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public boolean isDuplicate() {
return isDuplicate;
}
public void setDuplicate(boolean duplicate) {
isDuplicate = duplicate;
}
public Integer getAcctProp() {
return acctProp;
}
public void setAcctProp(Integer acctProp) {
this.acctProp = acctProp;
}
public int getDirection() {
return direction;
}
public void setDirection(int direction) {
this.direction = direction;
}
@Nullable
public BigDecimal getYearDebitBal() {
return yearDebitBal;
}
public void setYearDebitBal(@Nullable BigDecimal yearDebitBal) {
this.yearDebitBal = yearDebitBal;
}
}
package pwc.taxtech.atms.dto.vatdto;
import javax.annotation.Nullable;
import java.math.BigDecimal;
public class TrialBalanceFilter {
private String accountCode ;
private String accountName ;
@Nullable
private BigDecimal debitOpeningBalanceFrom ;
@Nullable
private BigDecimal debitOpeningBalanceTo ;
@Nullable
private BigDecimal creditOpeningBalanceFrom ;
@Nullable
private BigDecimal creditOpeningBalanceTo ;
@Nullable
private BigDecimal accumulatedDebitAmountFrom ;
@Nullable
private BigDecimal accumulatedDebitAmountTo ;
@Nullable
private BigDecimal accumulatedCreditAmountFrom ;
@Nullable
private BigDecimal accumulatedCreditAmountTo ;
@Nullable
private BigDecimal debitClosingBalanceFrom ;
@Nullable
private BigDecimal debitClosingBalanceTo ;
@Nullable
private BigDecimal creditClosingBalanceFrom ;
@Nullable
private BigDecimal creditClosingBalanceTo ;
@Nullable
private boolean hideAllZeroRecords ;
public String getAccountCode() {
return accountCode;
}
public void setAccountCode(String accountCode) {
this.accountCode = accountCode;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
@Nullable
public BigDecimal getDebitOpeningBalanceFrom() {
return debitOpeningBalanceFrom;
}
public void setDebitOpeningBalanceFrom(@Nullable BigDecimal debitOpeningBalanceFrom) {
this.debitOpeningBalanceFrom = debitOpeningBalanceFrom;
}
@Nullable
public BigDecimal getDebitOpeningBalanceTo() {
return debitOpeningBalanceTo;
}
public void setDebitOpeningBalanceTo(@Nullable BigDecimal debitOpeningBalanceTo) {
this.debitOpeningBalanceTo = debitOpeningBalanceTo;
}
@Nullable
public BigDecimal getCreditOpeningBalanceFrom() {
return creditOpeningBalanceFrom;
}
public void setCreditOpeningBalanceFrom(@Nullable BigDecimal creditOpeningBalanceFrom) {
this.creditOpeningBalanceFrom = creditOpeningBalanceFrom;
}
@Nullable
public BigDecimal getCreditOpeningBalanceTo() {
return creditOpeningBalanceTo;
}
public void setCreditOpeningBalanceTo(@Nullable BigDecimal creditOpeningBalanceTo) {
this.creditOpeningBalanceTo = creditOpeningBalanceTo;
}
@Nullable
public BigDecimal getAccumulatedDebitAmountFrom() {
return accumulatedDebitAmountFrom;
}
public void setAccumulatedDebitAmountFrom(@Nullable BigDecimal accumulatedDebitAmountFrom) {
this.accumulatedDebitAmountFrom = accumulatedDebitAmountFrom;
}
@Nullable
public BigDecimal getAccumulatedDebitAmountTo() {
return accumulatedDebitAmountTo;
}
public void setAccumulatedDebitAmountTo(@Nullable BigDecimal accumulatedDebitAmountTo) {
this.accumulatedDebitAmountTo = accumulatedDebitAmountTo;
}
@Nullable
public BigDecimal getAccumulatedCreditAmountFrom() {
return accumulatedCreditAmountFrom;
}
public void setAccumulatedCreditAmountFrom(@Nullable BigDecimal accumulatedCreditAmountFrom) {
this.accumulatedCreditAmountFrom = accumulatedCreditAmountFrom;
}
@Nullable
public BigDecimal getAccumulatedCreditAmountTo() {
return accumulatedCreditAmountTo;
}
public void setAccumulatedCreditAmountTo(@Nullable BigDecimal accumulatedCreditAmountTo) {
this.accumulatedCreditAmountTo = accumulatedCreditAmountTo;
}
@Nullable
public BigDecimal getDebitClosingBalanceFrom() {
return debitClosingBalanceFrom;
}
public void setDebitClosingBalanceFrom(@Nullable BigDecimal debitClosingBalanceFrom) {
this.debitClosingBalanceFrom = debitClosingBalanceFrom;
}
@Nullable
public BigDecimal getDebitClosingBalanceTo() {
return debitClosingBalanceTo;
}
public void setDebitClosingBalanceTo(@Nullable BigDecimal debitClosingBalanceTo) {
this.debitClosingBalanceTo = debitClosingBalanceTo;
}
@Nullable
public BigDecimal getCreditClosingBalanceFrom() {
return creditClosingBalanceFrom;
}
public void setCreditClosingBalanceFrom(@Nullable BigDecimal creditClosingBalanceFrom) {
this.creditClosingBalanceFrom = creditClosingBalanceFrom;
}
@Nullable
public BigDecimal getCreditClosingBalanceTo() {
return creditClosingBalanceTo;
}
public void setCreditClosingBalanceTo(@Nullable BigDecimal creditClosingBalanceTo) {
this.creditClosingBalanceTo = creditClosingBalanceTo;
}
@Nullable
public boolean isHideAllZeroRecords() {
return hideAllZeroRecords;
}
public void setHideAllZeroRecords(@Nullable boolean hideAllZeroRecords) {
this.hideAllZeroRecords = hideAllZeroRecords;
}
}
......@@ -32,7 +32,7 @@ import pwc.taxtech.atms.service.OperationLogService;
import pwc.taxtech.atms.service.OrganizationService;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\BusinessUnitService.cs
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\BusinessUnitService.cs
*/
@Service
public class BusinessUnitServiceImpl implements BusinessUnitService {
......
......@@ -17,7 +17,7 @@ import pwc.taxtech.atms.dto.epaccount.EnterpriseAccountSetOrgDto;
import pwc.taxtech.atms.entitiy.MailQueue;
import pwc.taxtech.atms.service.CommonService;
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\CommonService.cs */
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\CommonService.cs */
@Service
public class CommonServiceImpl implements CommonService {
......
......@@ -58,7 +58,7 @@ import pwc.taxtech.atms.service.DimensionService;
import pwc.taxtech.atms.service.StatisticAttributeService;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\DimensionService.cs
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\DimensionService.cs
*/
@Service
public class DimensionServiceImpl extends AbstractService implements DimensionService {
......
......@@ -21,7 +21,7 @@ import pwc.taxtech.atms.entitiy.MenuExample;
import pwc.taxtech.atms.service.MenuService;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\MenuService.cs
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\MenuService.cs
*/
@Service
public class MenuServiceImpl implements MenuService {
......
......@@ -39,7 +39,7 @@ import java.util.stream.Collectors;
@Service
public class ProjectServiceImpl implements ProjectService {
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\ProjectService.cs
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\ProjectService.cs
*/
private static final int FIRST_OR_DEFAULT = 0;
private static Logger LOGGER = LoggerFactory.getLogger(ProjectServiceImpl.class);
......
......@@ -90,7 +90,7 @@ import pwc.taxtech.atms.service.RoleService;
import pwc.taxtech.atms.service.UserRoleService;
import pwc.taxtech.atms.service.UserService;
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\RoleService.cs */
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\RoleService.cs */
@Service
public class RoleServiceImpl extends AbstractService implements RoleService {
......
......@@ -43,7 +43,7 @@ import pwc.taxtech.atms.service.DimensionService;
import pwc.taxtech.atms.service.StatisticAttributeService;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\StatisticAttributeService.cs
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\StatisticAttributeService.cs
*/
@Service
public class StatisticAttributeServiceImpl extends AbstractService implements StatisticAttributeService {
......
......@@ -48,7 +48,7 @@ import pwc.taxtech.atms.service.CommonService;
import pwc.taxtech.atms.service.UserAccountService;
import pwc.taxtech.atms.service.UserService;
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\UserService.cs */
/** @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\UserService.cs */
@Service
public class UserAccountServiceImpl extends AbstractService implements UserAccountService {
// TODO Move it to constants file
......
......@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList;
/**
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\Impl\UserService.cs
* @see PwC.Tax.Tech.Atms..Admin.Application\Services\impl\UserService.cs
*/
@Service
public class UserServiceImpl extends AbstractService implements UserService {
......
package pwc.taxtech.atms.vatDao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.vatEntitiy.CompanyBalance;
import pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample;
......@@ -105,4 +108,6 @@ public interface CompanyBalanceMapper extends MyVatMapper {
* @mbg.generated
*/
int updateByPrimaryKey(CompanyBalance record);
List<TrialBalanceDto> CompanyBalanceLeftJoinEnterpriseAccount(@Param("monthMap") Map<String,Long> fromMonth);
}
\ No newline at end of file
package pwc.taxtech.atms.vatDao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyVatMapper;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.vatEntitiy.VatStandardAccount;
import pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample;
......@@ -105,4 +108,6 @@ public interface VatStandardAccountMapper extends MyVatMapper {
* @mbg.generated
*/
int updateByPrimaryKey(VatStandardAccount record);
List<TrialBalanceDto> selectProjectStandardAccountLeftJoinBalanceStdManual(@Param("monthMap") Map<String,Long> fromMonth);
}
\ No newline at end of file
package pwc.taxtech.atms.vatService;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import java.util.List;
public interface TBDataImportService {
List<TrialBalanceDto> getTrialBalanceData(int fromPeriod, int toPeriod);
List<TrialBalanceDto> getTrialBalanceStdData(int fromPeriod, int toPeriod);
}
package pwc.taxtech.atms.vatService.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.dto.vatdto.TrialBalanceDto;
import pwc.taxtech.atms.vatService.TBDataImportService;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class TBDataImportServiceImpl extends VatAbstractService implements TBDataImportService {
@Override
public List<TrialBalanceDto> getTrialBalanceData(int fromPeriod, int toPeriod) {
long fromMonth = (long) fromPeriod;
long toMonth = (long) toPeriod;
Map<String, Long> monthMap = new HashMap<>();
monthMap.put("fromMonth", fromMonth);
monthMap.put("toMonth", toMonth);
List<TrialBalanceDto> queryList = companyBalanceMapper.CompanyBalanceLeftJoinEnterpriseAccount(monthMap);
List<TrialBalanceDto> result = new ArrayList<>();
queryList.stream().collect(Collectors.groupingBy(TrialBalanceDto::getAcctCode)).forEach((a, b) -> {
TrialBalanceDto item = b.get(0);
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.setDebitBal(BigDecimal.valueOf(summaryA));
double summaryB = b.stream().mapToDouble(c -> c.getCreditBal().doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setCreditBal(BigDecimal.valueOf(summaryB));
trialBalanceDto.setParentCode(item.getParentCode());
trialBalanceDto.setAccountName(item.getAccountName());
trialBalanceDto.setAcctProp(item.getAcctProp());
trialBalanceDto.setDirection(item.getDirection());
result.add(trialBalanceDto);
});
return result;
}
@Override
public List<TrialBalanceDto> getTrialBalanceStdData(int fromPeriod, int toPeriod) {
long fromMonth = (long) fromPeriod;
long toMonth = (long) toPeriod;
Map<String, Long> monthMap = new HashMap<>();
monthMap.put("fromMonth", fromMonth);
monthMap.put("toMonth", toMonth);
List<TrialBalanceDto> queryList = vatStandardAccountMapper.selectProjectStandardAccountLeftJoinBalanceStdManual(monthMap);
List<TrialBalanceDto> result = new ArrayList<>();
queryList.stream().collect(Collectors.groupingBy(TrialBalanceDto::getAcctCode)).forEach((a, b) -> {
TrialBalanceDto item = b.get(0);
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.setDebitBal(BigDecimal.valueOf(summaryA));
double summaryB = b.stream().mapToDouble(c -> c.getCreditBal().doubleValue()).summaryStatistics().getSum();
trialBalanceDto.setCreditBal(BigDecimal.valueOf(summaryB));
trialBalanceDto.setParentCode(item.getParentCode());
trialBalanceDto.setAccountName(item.getAccountName());
trialBalanceDto.setAcctProp(item.getAcctProp());
trialBalanceDto.setDirection(item.getDirection());
result.add(trialBalanceDto);
});
return result;
}
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;
if (dataList != null && !dataList.isEmpty()) {
if (dataList.stream().anyMatch(a -> a.getMonthId() != null)) {
MonthId = 1;
}
if (dataList.stream().anyMatch(a -> StringUtils.isNotBlank(a.getCustomerCode()))) {
CustomerCode = 1;
}
if (dataList.stream().anyMatch(p -> p.getBegDebitBal() != null)) {
BegDebitBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getBegCreditBal() != null)) {
BegCreditBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getBegBal() != null)) {
BegBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getEndBal() != null)) {
EndBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getEndDebitBal() != null)) {
EndDebitBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getEndCreditBal() != null)) {
EndCreditBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getDebitBal() != null)) {
DebitBal = 1;
}
if (dataList.stream().anyMatch(p -> p.getCreditBal() != null)) {
CreditBal = 1;
}
for (TrialBalanceDto compbalance : dataList) {
if (compbalance.getMonthId() == null && MonthId == 1) {
compbalance.setMonthId(0);
}
if (CustomerCode == 0) {
compbalance.setCustomerCode(null);
}
if (compbalance.getBegDebitBal() == null && BegDebitBal == 1) {
compbalance.setBegDebitBal(BigDecimal.ZERO);
}
if (compbalance.getBegCreditBal() == null && BegCreditBal == 1) {
compbalance.setBegCreditBal(BigDecimal.ZERO);
}
if (compbalance.getBegBal() == null && BegBal == 1) {
compbalance.setBegBal(BigDecimal.ZERO);
}
if (compbalance.getEndBal() == null && EndBal == 1) {
compbalance.setEndBal(BigDecimal.ZERO);
}
if (compbalance.getEndDebitBal() == null && EndDebitBal == 1) {
compbalance.setEndDebitBal(BigDecimal.ZERO);
}
if (compbalance.getEndCreditBal() == null && EndCreditBal == 1) {
compbalance.setEndCreditBal(BigDecimal.ZERO);
}
if (compbalance.getDebitBal() == null && DebitBal == 1) {
compbalance.setDebitBal(BigDecimal.ZERO);
}
if (compbalance.getCreditBal() == null && CreditBal == 1) {
compbalance.setCreditBal(BigDecimal.ZERO);
}
}
}
return dataList;
}
}
package pwc.taxtech.atms.vatService.impl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import pwc.taxtech.atms.vatDao.CompanyBalanceMapper;
import pwc.taxtech.atms.vatDao.VatEnterpriseAccountMapper;
import pwc.taxtech.atms.vatDao.VatStandardAccountMapper;
public class VatAbstractService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
CompanyBalanceMapper companyBalanceMapper;
@Autowired
VatEnterpriseAccountMapper vatEnterpriseAccountMapper;
@Autowired
VatStandardAccountMapper vatStandardAccountMapper;
}
......@@ -6,19 +6,19 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="BalanceId" jdbcType="VARCHAR" property="balanceId" />
<result column="PeriodId" jdbcType="INTEGER" property="periodId" />
<result column="AcctCode" jdbcType="VARCHAR" property="acctCode" />
<result column="CustomerCode" jdbcType="VARCHAR" property="customerCode" />
<result column="BegDebitBal" jdbcType="DECIMAL" property="begDebitBal" />
<result column="BegCreditBal" jdbcType="DECIMAL" property="begCreditBal" />
<result column="BegBal" jdbcType="DECIMAL" property="begBal" />
<result column="EndBal" jdbcType="DECIMAL" property="endBal" />
<result column="EndDebitBal" jdbcType="DECIMAL" property="endDebitBal" />
<result column="EndCreditBal" jdbcType="DECIMAL" property="endCreditBal" />
<result column="DebitBal" jdbcType="DECIMAL" property="debitBal" />
<result column="CreditBal" jdbcType="DECIMAL" property="creditBal" />
<result column="MonthId" jdbcType="INTEGER" property="monthId" />
<id column="BalanceId" jdbcType="VARCHAR" property="balanceId"/>
<result column="PeriodId" jdbcType="INTEGER" property="periodId"/>
<result column="AcctCode" jdbcType="VARCHAR" property="acctCode"/>
<result column="CustomerCode" jdbcType="VARCHAR" property="customerCode"/>
<result column="BegDebitBal" jdbcType="DECIMAL" property="begDebitBal"/>
<result column="BegCreditBal" jdbcType="DECIMAL" property="begCreditBal"/>
<result column="BegBal" jdbcType="DECIMAL" property="begBal"/>
<result column="EndBal" jdbcType="DECIMAL" property="endBal"/>
<result column="EndDebitBal" jdbcType="DECIMAL" property="endDebitBal"/>
<result column="EndCreditBal" jdbcType="DECIMAL" property="endCreditBal"/>
<result column="DebitBal" jdbcType="DECIMAL" property="debitBal"/>
<result column="CreditBal" jdbcType="DECIMAL" property="creditBal"/>
<result column="MonthId" jdbcType="INTEGER" property="monthId"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -42,7 +42,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -75,7 +76,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -94,7 +96,8 @@
BalanceId, PeriodId, AcctCode, CustomerCode, BegDebitBal, BegCreditBal, BegBal, EndBal,
EndDebitBal, EndCreditBal, DebitBal, CreditBal, MonthId
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -103,10 +106,10 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from CompanyBalance
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
......@@ -118,7 +121,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from CompanyBalance
where BalanceId = #{balanceId,jdbcType=VARCHAR}
</select>
......@@ -137,7 +140,7 @@
-->
delete from CompanyBalance
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalance">
......@@ -245,14 +248,15 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from CompanyBalance
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
......@@ -303,7 +307,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
......@@ -326,7 +330,7 @@
CreditBal = #{record.creditBal,jdbcType=DECIMAL},
MonthId = #{record.monthId,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalance">
......@@ -395,7 +399,8 @@
MonthId = #{monthId,jdbcType=INTEGER}
where BalanceId = #{balanceId,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample" resultMap="BaseResultMap">
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vatEntitiy.CompanyBalanceExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -404,13 +409,59 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from CompanyBalance
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<resultMap id="TrialBalanceDto" type="pwc.taxtech.atms.dto.vatdto.TrialBalanceDto">
<id column="BalanceId" jdbcType="VARCHAR" property="balanceId"/>
<result column="PeriodId" jdbcType="INTEGER" property="periodId"/>
<result column="AcctCode" jdbcType="VARCHAR" property="acctCode"/>
<result column="CustomerCode" jdbcType="VARCHAR" property="customerCode"/>
<result column="BegDebitBal" jdbcType="DECIMAL" property="begDebitBal"/>
<result column="BegCreditBal" jdbcType="DECIMAL" property="begCreditBal"/>
<result column="BegBal" jdbcType="DECIMAL" property="begBal"/>
<result column="EndBal" jdbcType="DECIMAL" property="endBal"/>
<result column="EndDebitBal" jdbcType="DECIMAL" property="endDebitBal"/>
<result column="EndCreditBal" jdbcType="DECIMAL" property="endCreditBal"/>
<result column="DebitBal" jdbcType="DECIMAL" property="debitBal"/>
<result column="CreditBal" jdbcType="DECIMAL" property="creditBal"/>
<result column="MonthId" jdbcType="INTEGER" property="monthId"/>
<result column="AccountName" jdbcType="VARCHAR" property="accountName"/>
</resultMap>
<select id="CompanyBalanceLeftJoinEnterpriseAccount" resultMap="TrialBalanceDto">
SELECT DISTINCT
b.BalanceId,
b.PeriodId,
b.AcctCode,
b.CustomerCode,
b.BegDebitBal,
b.BegCreditBal,
b.BegBal,
b.EndBal,
b.EndDebitBal,
b.EndCreditBal,
b.DebitBal,
b.CreditBal,
b.MonthId,
a.`Name` AS AccountName
FROM
CompanyBalance b
LEFT JOIN EnterpriseAccount a ON b.AcctCode = a.AcctCode
WHERE 1=1
<if test="fromMonth!=null">
AND b.PeriodID &gt;= #{fromMonth,jdbcType=VARCHAR}
</if>
<if test="toMonth!=null">
AND b.PeriodID &lt;= #{toMonth,jdbcType=VARCHAR}
</if>
ORDER BY
b.PeriodID
</select>
</mapper>
\ No newline at end of file
......@@ -6,20 +6,20 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="ID" jdbcType="VARCHAR" property="ID" />
<result column="Code" jdbcType="VARCHAR" property="code" />
<result column="Name" jdbcType="VARCHAR" property="name" />
<result column="ParentCode" jdbcType="VARCHAR" property="parentCode" />
<result column="FullName" jdbcType="VARCHAR" property="fullName" />
<result column="AcctProp" jdbcType="INTEGER" property="acctProp" />
<result column="SubProp" jdbcType="INTEGER" property="subProp" />
<result column="AcctLevel" jdbcType="INTEGER" property="acctLevel" />
<result column="Direction" jdbcType="INTEGER" property="direction" />
<result column="IsLeaf" jdbcType="SMALLINT" property="isLeaf" />
<result column="RuleType" jdbcType="INTEGER" property="ruleType" />
<result column="IsActive" jdbcType="SMALLINT" property="isActive" />
<result column="EnglishName" jdbcType="VARCHAR" property="englishName" />
<result column="IndustryID" jdbcType="VARCHAR" property="industryID" />
<id column="ID" jdbcType="VARCHAR" property="ID"/>
<result column="Code" jdbcType="VARCHAR" property="code"/>
<result column="Name" jdbcType="VARCHAR" property="name"/>
<result column="ParentCode" jdbcType="VARCHAR" property="parentCode"/>
<result column="FullName" jdbcType="VARCHAR" property="fullName"/>
<result column="AcctProp" jdbcType="INTEGER" property="acctProp"/>
<result column="SubProp" jdbcType="INTEGER" property="subProp"/>
<result column="AcctLevel" jdbcType="INTEGER" property="acctLevel"/>
<result column="Direction" jdbcType="INTEGER" property="direction"/>
<result column="IsLeaf" jdbcType="SMALLINT" property="isLeaf"/>
<result column="RuleType" jdbcType="INTEGER" property="ruleType"/>
<result column="IsActive" jdbcType="SMALLINT" property="isActive"/>
<result column="EnglishName" jdbcType="VARCHAR" property="englishName"/>
<result column="IndustryID" jdbcType="VARCHAR" property="industryID"/>
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -43,7 +43,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -76,7 +77,8 @@
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
<foreach close=")" collection="criterion.value" item="listItem" open="("
separator=",">
#{listItem}
</foreach>
</when>
......@@ -95,7 +97,8 @@
ID, Code, Name, ParentCode, FullName, AcctProp, SubProp, AcctLevel, Direction, IsLeaf,
RuleType, IsActive, EnglishName, IndustryID
</sql>
<select id="selectByExample" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -104,10 +107,10 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from StandardAccount
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
......@@ -119,7 +122,7 @@
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from StandardAccount
where ID = #{ID,jdbcType=VARCHAR}
</select>
......@@ -138,7 +141,7 @@
-->
delete from StandardAccount
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</delete>
<insert id="insert" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccount">
......@@ -252,14 +255,15 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample" resultType="java.lang.Long">
<select id="countByExample" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample"
resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from StandardAccount
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
......@@ -313,7 +317,7 @@
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByExample" parameterType="map">
......@@ -337,7 +341,7 @@
EnglishName = #{record.englishName,jdbcType=VARCHAR},
IndustryID = #{record.industryID,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
<include refid="Update_By_Example_Where_Clause"/>
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccount">
......@@ -410,7 +414,8 @@
IndustryID = #{industryID,jdbcType=VARCHAR}
where ID = #{ID,jdbcType=VARCHAR}
</update>
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample" resultMap="BaseResultMap">
<select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.vatEntitiy.VatStandardAccountExample"
resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
......@@ -419,13 +424,73 @@
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from StandardAccount
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
<include refid="Example_Where_Clause"/>
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<resultMap id="TrialBalanceDto" type="pwc.taxtech.atms.dto.vatdto.TrialBalanceDto">
<id column="BalanceId" jdbcType="VARCHAR" property="balanceId"/>
<result column="PeriodId" jdbcType="INTEGER" property="periodId"/>
<result column="AcctCode" jdbcType="VARCHAR" property="acctCode"/>
<result column="CustomerCode" jdbcType="VARCHAR" property="customerCode"/>
<result column="BegDebitBal" jdbcType="DECIMAL" property="begDebitBal"/>
<result column="BegBal" jdbcType="DECIMAL" property="begBal"/>
<result column="EndBal" jdbcType="DECIMAL" property="endBal"/>
<result column="EndDebitBal" jdbcType="DECIMAL" property="endDebitBal"/>
<result column="EndCreditBal" jdbcType="DECIMAL" property="endCreditBal"/>
<result column="DebitBal" jdbcType="DECIMAL" property="debitBal"/>
<result column="CreditBal" jdbcType="DECIMAL" property="creditBal"/>
<result column="MonthId" jdbcType="INTEGER" property="monthId"/>
<result column="YearDebitBal" jdbcType="DECIMAL" property="yearDebitBal"/>
<result column="ParentCode" jdbcType="VARCHAR" property="parentCode"/>
<result column="AccountName" jdbcType="VARCHAR" property="accountName"/>
<result column="IsDuplicate" jdbcType="SMALLINT" property="isDuplicate"/>
<result column="AcctProp" jdbcType="INTEGER" property="acctProp"/>
<result column="Direction" jdbcType="INTEGER" property="direction"/>
</resultMap>
<select id="selectProjectStandardAccountLeftJoinBalanceStdManual" resultMap="TrialBalanceDto" parameterType="map">
SELECT DISTINCT
b.PeriodID,
b.AcctCode,
'' AS CustomerCode,
b.BegDebitBal,
b.BegCreditBal,
b.BegBal,
b.EndBal,
b.EndDebitBal,
b.EndCreditBal,
b.DebitBal,
b.CreditBal,
b.PeriodID AS MonthId,
b.YearDebitBal,
b.YearCreditBal,
IF (
ISNULL(a.ParentCode) || a.ParentCode = '',
'0',
a.ParentCode
) AS ParentCode,
a.`Name` AS AccountName,
a.AcctProp,
a.Direction
FROM
StandardAccount a
JOIN BalanceStdManual b ON a.`Code` = b.AcctCode
WHERE 1=1
<if test="fromMonth!=null">
AND b.PeriodID &gt;= #{fromMonth,jdbcType=VARCHAR}
</if>
<if test="toMonth!=null">
AND b.PeriodID &lt;= #{toMonth,jdbcType=VARCHAR}
</if>
ORDER BY
b.PeriodID
</select>
</mapper>
\ No newline at end of file
......@@ -47,15 +47,15 @@
}
var setProperty = function (propertyName, propertyValue) {
cacheObj[propertyName] = propertyValue
cacheObj[propertyName] = propertyValue;
//$cookieStore.put('tesla-cache', JSON.stringify(apiTokenObj));
localStorageService.set('tesla-cache', cacheObj);
}
};
var getProperty = function (propertyName) {
//console.log($cookieStore.get('tesla-cache'));
return cacheObj[propertyName];
}
};
// 跳转到admin或者outputinvoice management 需要清空所选择的project,不然会影响权限
var clearSelectProject = function () {
......@@ -76,6 +76,6 @@
queryDto: queryDto,
setProperty: setProperty,
getProperty: getProperty,
clearSelectProject: clearSelectProject,
clearSelectProject: clearSelectProject
}
}]);
\ No newline at end of file
......@@ -169,11 +169,11 @@ webservices.factory('apiConfig', ['$log', 'vatSessionService',
cfg.isWebApiRequest = true;
if (config && config.dbName) {//TODO:from is not allowed ,future should open (neo)
// cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
}
else {
if (vatSessionService.project && vatSessionService.project.dbName) {
// cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
}
}
return cfg;
......@@ -189,10 +189,10 @@ webservices.factory('apiConfig', ['$log', 'vatSessionService',
cfg.isWebApiRequest = true;
if (config && config.dbName) {
// cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
}
else {
// cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
}
//$httpProvider.defaults.headers.common['from'] = vatSessionService.project.dbName + '@cn.pwc.com';
//cfg.headers.from = vatSessionService.project.dbName+'@cn.pwc.com';
......
......@@ -4398,15 +4398,15 @@ webservices.factory('vatSessionService', ['$log', 'localStorageService', functio
}
var setProperty = function (propertyName, propertyValue) {
cacheObj[propertyName] = propertyValue
cacheObj[propertyName] = propertyValue;
//$cookieStore.put('tesla-cache', JSON.stringify(apiTokenObj));
localStorageService.set('tesla-cache', cacheObj);
}
};
var getProperty = function (propertyName) {
//console.log($cookieStore.get('tesla-cache'));
return cacheObj[propertyName];
}
};
// 跳转到admin或者outputinvoice management 需要清空所选择的project,不然会影响权限
var clearSelectProject = function () {
......@@ -4427,7 +4427,7 @@ webservices.factory('vatSessionService', ['$log', 'localStorageService', functio
queryDto: queryDto,
setProperty: setProperty,
getProperty: getProperty,
clearSelectProject: clearSelectProject,
clearSelectProject: clearSelectProject
}
}]);
/// <reference path="../../app.js" />
......@@ -4601,11 +4601,11 @@ webservices.factory('apiConfig', ['$log', 'vatSessionService',
cfg.isWebApiRequest = true;
if (config && config.dbName) {//TODO:from is not allowed ,future should open (neo)
// cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
}
else {
if (vatSessionService.project && vatSessionService.project.dbName) {
// cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
}
}
return cfg;
......@@ -4621,10 +4621,10 @@ webservices.factory('apiConfig', ['$log', 'vatSessionService',
cfg.isWebApiRequest = true;
if (config && config.dbName) {
// cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': config.dbName + '@cn.pwc.com' };
}
else {
// cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
cfg.headers = { 'from': vatSessionService.project.dbName + '@cn.pwc.com' };
}
//$httpProvider.defaults.headers.common['from'] = vatSessionService.project.dbName + '@cn.pwc.com';
//cfg.headers.from = vatSessionService.project.dbName+'@cn.pwc.com';
......
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