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