Commit e3047353 authored by neo's avatar neo

[bugfix] skip some validation and status check

parent 3588c4d9
...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.SqlSession; ...@@ -7,6 +7,7 @@ import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.datasource.ShardingContextHolder;
import pwc.taxtech.atms.constant.enums.EnumServiceType; import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.constant.enums.EnumTbImportType; import pwc.taxtech.atms.constant.enums.EnumTbImportType;
import pwc.taxtech.atms.constant.enums.EnumValidationType; import pwc.taxtech.atms.constant.enums.EnumValidationType;
...@@ -52,7 +53,6 @@ import java.util.stream.Collectors; ...@@ -52,7 +53,6 @@ import java.util.stream.Collectors;
@Service @Service
public class DataImportServiceImpl { public class DataImportServiceImpl {
private static final String PROJECT_DB_NAME = "test_db";//TODO:fixed use init db
private static final String _companyBalancetable = "CompanyBalance"; private static final String _companyBalancetable = "CompanyBalance";
private static final String _balancetable = "Balance"; private static final String _balancetable = "Balance";
private static final String _validationtable = "ValidationInfo"; private static final String _validationtable = "ValidationInfo";
...@@ -87,12 +87,12 @@ public class DataImportServiceImpl { ...@@ -87,12 +87,12 @@ public class DataImportServiceImpl {
OperationResultDto result = new OperationResultDto(); OperationResultDto result = new OperationResultDto();
if (serviceTypeId == ServiceType.VAT.getCode().intValue()) { if (serviceTypeId == ServiceType.VAT.getCode().intValue()) {
int period = balanceList.get(0).getPeriodId().intValue(); int period = balanceList.get(0).getPeriodId().intValue();
DataImportedStatusDto dataImportedStatus = new DataImportedStatusDto(); // DataImportedStatusDto dataImportedStatus = new DataImportedStatusDto();
//
dataImportedStatus.setPeriod(period); // dataImportedStatus.setPeriod(period);
dataImportedStatus.setDbName(PROJECT_DB_NAME); // dataImportedStatus.setDbName(PROJECT_DB_NAME);
dataImportedStatus.setDataType(ProjectImportDataType.TrialBalance.getCode()); // dataImportedStatus.setDataType(ProjectImportDataType.TrialBalance.getCode());
dataImportedStatus.setStartTime(new Date()); // dataImportedStatus.setStartTime(new Date());
//覆盖导入之前删除数据 //覆盖导入之前删除数据
if (importType == EnumTbImportType.CoverImport.getCode()) { if (importType == EnumTbImportType.CoverImport.getCode()) {
...@@ -110,11 +110,11 @@ public class DataImportServiceImpl { ...@@ -110,11 +110,11 @@ public class DataImportServiceImpl {
validationInfoExample.createCriteria().andImportTypeIdEqualTo(0).andPeriodIdEqualTo(period).andErrorLevelIsNotNull(); validationInfoExample.createCriteria().andImportTypeIdEqualTo(0).andPeriodIdEqualTo(period).andErrorLevelIsNotNull();
Long exceptionCount = validationInfoMapper.countByExample(validationInfoExample); Long exceptionCount = validationInfoMapper.countByExample(validationInfoExample);
dataImportedStatus.setTotalCount(balanceList.size()); // dataImportedStatus.setTotalCount(balanceList.size());
dataImportedStatus.setExceptionCount(exceptionCount.intValue()); // dataImportedStatus.setExceptionCount(exceptionCount.intValue());
dataImportedStatus.setSuccessedCount(dataImportedStatus.getTotalCount() - dataImportedStatus.getExceptionCount()); // dataImportedStatus.setSuccessedCount(dataImportedStatus.getTotalCount() - dataImportedStatus.getExceptionCount());
dataImportedStatus.setEndTime(new Date()); // dataImportedStatus.setEndTime(new Date());
UpdateDataImportedStatu(Lists.newArrayList(dataImportedStatus)); // UpdateDataImportedStatu(Lists.newArrayList(dataImportedStatus));
} else if (serviceTypeId == ServiceType.CIT.getCode()) {//TODO import cit (neo) } else if (serviceTypeId == ServiceType.CIT.getCode()) {//TODO import cit (neo)
...@@ -142,10 +142,12 @@ public class DataImportServiceImpl { ...@@ -142,10 +142,12 @@ public class DataImportServiceImpl {
//先删除数据 //先删除数据
clearTableData(period, _balancetable); clearTableData(period, _balancetable);
mapper.deleteTbValidation(period, EnumValidationType.TrialBalance.getCode()); mapper.deleteTbValidation(period, EnumValidationType.TrialBalance.getCode());
CompanyBalanceExample example = new CompanyBalanceExample(); CompanyBalanceExample example = new CompanyBalanceExample();
example.createCriteria().andPeriodIdEqualTo(period); example.createCriteria().andPeriodIdEqualTo(period);
List<CompanyBalance> companyBalanceList = companyBalanceMapper.selectByExample(example); List<CompanyBalance> companyBalanceList = companyBalanceMapper.selectByExample(example);
validationAcctCode(period, userID);
// validationAcctCode(period, userID);//todo:[validation] to be open future(neo)
initBalance(companyBalanceList, period, serviceTypeId); initBalance(companyBalanceList, period, serviceTypeId);
calculateYearColumn(); calculateYearColumn();
// duplicatedValidation(period, userID);//todo:[validation] to be open future(neo) // duplicatedValidation(period, userID);//todo:[validation] to be open future(neo)
...@@ -491,10 +493,12 @@ public class DataImportServiceImpl { ...@@ -491,10 +493,12 @@ public class DataImportServiceImpl {
List<String> accCode = new ArrayList<>(); List<String> accCode = new ArrayList<>();
addlist.forEach(m -> accCode.add(m.getAcctCode())); addlist.forEach(m -> accCode.add(m.getAcctCode()));
example.createCriteria().andAcctCodeNotIn(accCode); example.createCriteria().andAcctCodeNotIn(accCode);
List<VatEnterpriseAccount> reult = vatEnterpriseAccountMapper.selectByExample(example); List<VatEnterpriseAccount> reult = vatEnterpriseAccountMapper.selectByExample(example);
Set<String> accts = new HashSet<>(); Set<String> accts = new HashSet<>();
reult.forEach(m -> accts.add(m.getAcctCode())); reult.forEach(m -> accts.add(m.getAcctCode()));
accts.forEach(m -> addList(addlist, m, period)); accts.forEach(m -> addList(addlist, m, period));
DealCodeNotInBalance(addlist, period); DealCodeNotInBalance(addlist, period);
} }
...@@ -695,7 +699,7 @@ public class DataImportServiceImpl { ...@@ -695,7 +699,7 @@ public class DataImportServiceImpl {
private void synAccountFromTaxAdmin(int period, String userID) { private void synAccountFromTaxAdmin(int period, String userID) {
ProjectExample example = new ProjectExample(); ProjectExample example = new ProjectExample();
example.createCriteria().andDbNameEqualTo(PROJECT_DB_NAME); example.createCriteria().andDbNameEqualTo(ShardingContextHolder.getDataSourceKey());
List<Project> plist = projectMapper.selectByExample(example); List<Project> plist = projectMapper.selectByExample(example);
if (plist != null && !plist.isEmpty()) { if (plist != null && !plist.isEmpty()) {
Project pFirst = plist.get(FIRST_OR_DEFAULT); Project pFirst = plist.get(FIRST_OR_DEFAULT);
...@@ -705,6 +709,7 @@ public class DataImportServiceImpl { ...@@ -705,6 +709,7 @@ public class DataImportServiceImpl {
EnterpriseAccountExample accountExample = new EnterpriseAccountExample(); EnterpriseAccountExample accountExample = new EnterpriseAccountExample();
accountExample.createCriteria().andEnterpriseAccountSetIDEqualTo(easId); accountExample.createCriteria().andEnterpriseAccountSetIDEqualTo(easId);
List<EnterpriseAccount> taxList = enterpriseAccountMapper.selectByExample(accountExample); List<EnterpriseAccount> taxList = enterpriseAccountMapper.selectByExample(accountExample);
taxList.stream().sorted(Comparator.comparing(EnterpriseAccount::getUpdateTime)); taxList.stream().sorted(Comparator.comparing(EnterpriseAccount::getUpdateTime));
List<VatEnterpriseAccount> proList = vatEnterpriseAccountMapper.selectByExample(null); List<VatEnterpriseAccount> proList = vatEnterpriseAccountMapper.selectByExample(null);
......
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