Commit 88c65e7b authored by Ken you's avatar Ken you

add prc taskId ---Ken

parent 7bfe5b38
......@@ -4,7 +4,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.constant.CodeErrorConstant;
import pwc.taxtech.atms.constant.enums.EnumErrorCodeMsg;
import pwc.taxtech.atms.dto.ApiResultDto;
import pwc.taxtech.atms.dto.ebsdto.*;
......
......@@ -37,12 +37,20 @@ public class EbsApiServiceImpl implements EbsApiService {
@Resource
private BalanceSheetMapper balanceSheetMapper;
@Resource
private BalanceSheetPrcMapper balanceSheetPrcMapper;
@Resource
private BalanceSheetFinalMapper balanceSheetFinalMapper;
@Resource
private BalanceSheetPrcFinalMapper balanceSheetPrcFinalMapper;
@Resource
private ProfitLossStatementMapper profitLossStatementMapper;
@Resource
private ProfitLossStatementPrcMapper profitLossStatementPrcMapper;
@Resource
private ProfitLossStatementFinalMapper profitLossStatementFinalMapper;
@Resource
private ProfitLossStatementPrcFinalMapper profitLossStatementPrcFinalMapper;
@Resource
private OrganizationAccountingRateMapper organizationAccountingRateMapper;
@Resource
private OrganizationMapper organizationMapper;
......@@ -233,7 +241,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processJE(JournalEntryQueryDto item) {
JournalEntryExample journalEntryExample = new JournalEntryExample();
//日记账头ID和日记账行号
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum()).andTaskIdEqualTo(item.getTaskId());
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum()).andTaskIdNotEqualTo(item.getTaskId());
List<JournalEntry> journalEntryList = journalEntryMapper.selectByExample(journalEntryExample);
//唯一则更新否则插入
JournalEntry journalEntry = new JournalEntry();
......@@ -257,7 +265,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processTB(Long id,TrialBalanceQueryDto item) {
TrialBalanceExample example = new TrialBalanceExample();
//机构编码和期间
example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example);
//唯一则更新否则插入
TrialBalance result = new TrialBalance();
......@@ -276,7 +284,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processCF(Long id,CashFlowQueryDto item) {
CashFlowExample example = new CashFlowExample();
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<CashFlow> itemList = cashFlowMapper.selectByExample(example);
//唯一则更新否则插入
CashFlow result = new CashFlow();
......@@ -296,7 +304,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processBS(Long id,BalanceSheetQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample();
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
//唯一则更新否则插入
BalanceSheet result = new BalanceSheet();
......@@ -313,7 +321,7 @@ public class EbsApiServiceImpl implements EbsApiService {
logger.debug("start to insert balanceSheetFinal ");
// 1、写入最终表
BalanceSheetExample balanceSheetExample = new BalanceSheetExample();
balanceSheetExample.createCriteria().andOrganizationIdEqualTo(result.getOrganizationId()).andPeriodEqualTo(result.getPeriod());
balanceSheetExample.createCriteria().andOrganizationIdEqualTo(result.getOrganizationId()).andPeriodEqualTo(result.getPeriod()).andTaskIdNotEqualTo(item.getTaskId());
if (balanceSheetFinalMapper.countByExample(balanceSheetExample) > 0) {
balanceSheetFinalMapper.deleteByExample(balanceSheetExample);
}
......@@ -322,28 +330,36 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processBSprc(Long id,BalanceSheetPrcQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample();
BalanceSheetPrcExample example = new BalanceSheetPrcExample();
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<BalanceSheetPrc> itemList = balanceSheetPrcMapper.selectByExample(example);
//唯一则更新否则插入
BalanceSheet result = new BalanceSheet();
BalanceSheetPrc result = new BalanceSheetPrc();
if (itemList.size() >0) {
logger.debug("exit and delete BalanceSheetPrc EntityCode:{},Period:{},taskId:{}", item.getEntityCode(), item.getPeriod(),item.getTaskId());
balanceSheetMapper.deleteByExample(example);
balanceSheetPrcMapper.deleteByExample(example);
}
logger.debug("insert BalanceSheetPrc EntityCode:{},Period:{},taskId:{}", item.getEntityCode(), item.getPeriod(),item.getTaskId());
populateFieldsBSprc(item, result);
result.setId(distributedIdService.nextId());
result.setCreateBy(getCurrentOperatorName(id));
result.setCreateTime(new Date());
balanceSheetMapper.insertSelective(result);
balanceSheetPrcMapper.insertSelective(result);
// 1、写入最终表
logger.debug("start to insert BalanceSheetPrcFinal ");
BalanceSheetPrcExample balanceSheetPrcExample = new BalanceSheetPrcExample();
balanceSheetPrcExample.createCriteria().andOrganizationIdEqualTo(result.getOrganizationId()).andPeriodEqualTo(result.getPeriod()).andTaskIdNotEqualTo(item.getTaskId());
if (balanceSheetPrcFinalMapper.countByExample(balanceSheetPrcExample) > 0) {
balanceSheetPrcFinalMapper.deleteByExample(balanceSheetPrcExample);
}
balanceSheetPrcFinalMapper.insertSelective(result);
}
private void processPL(Long id,ProfitLossStatementQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample();
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
//唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement();
......@@ -360,7 +376,7 @@ public class EbsApiServiceImpl implements EbsApiService {
logger.debug("start to insert profitLossStatementFinal ");
// 1、写入最终表
ProfitLossStatementExample profitLossStatementExample = new ProfitLossStatementExample();
profitLossStatementExample.createCriteria().andOrganizationIdEqualTo(result.getOrganizationId()).andPeriodEqualTo(result.getPeriod());
profitLossStatementExample.createCriteria().andOrganizationIdEqualTo(result.getOrganizationId()).andPeriodEqualTo(result.getPeriod()).andTaskIdNotEqualTo(item.getTaskId());
if (profitLossStatementFinalMapper.countByExample(profitLossStatementExample) > 0) {
profitLossStatementFinalMapper.deleteByExample(profitLossStatementExample);
}
......@@ -368,28 +384,36 @@ public class EbsApiServiceImpl implements EbsApiService {
}
private void processPLprc(Long id,ProfitLossStatementPrcQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample();
ProfitLossStatementPrcExample example = new ProfitLossStatementPrcExample();
//机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<ProfitLossStatementPrc> itemList = profitLossStatementPrcMapper.selectByExample(example);
//唯一则更新否则插入
ProfitLossStatement result = new ProfitLossStatement();
ProfitLossStatementPrc result = new ProfitLossStatementPrc();
if (itemList.size() >0) {
logger.debug("exit and delete ProfitLossStatementPrc EntityCode:{},Period:{},taskId:{}", item.getEntityCode(), item.getPeriod(),item.getTaskId());
profitLossStatementMapper.deleteByExample(example);
profitLossStatementPrcMapper.deleteByExample(example);
}
logger.debug("insert ProfitLossStatementPrc EntityCode:{},Period:{},taskId:{}", item.getEntityCode(), item.getPeriod(),item.getTaskId());
populateFieldsPLSprc(item, result);
result.setId(distributedIdService.nextId());
result.setCreateTime(new Date());
result.setCreateBy(getCurrentOperatorName(id));
profitLossStatementMapper.insertSelective(result);
profitLossStatementPrcMapper.insertSelective(result);
logger.debug("start to insert profitLossStatementPrcFinal ");
// 1、写入最终表
ProfitLossStatementPrcExample profitLossStatementPrcExample = new ProfitLossStatementPrcExample();
profitLossStatementPrcExample.createCriteria().andOrganizationIdEqualTo(result.getOrganizationId()).andPeriodEqualTo(result.getPeriod()).andTaskIdNotEqualTo(item.getTaskId());
if (profitLossStatementPrcFinalMapper.countByExample(profitLossStatementPrcExample) > 0) {
profitLossStatementPrcFinalMapper.deleteByExample(profitLossStatementPrcExample);
}
profitLossStatementPrcFinalMapper.insertSelective(result);
}
private void processOAR(Long id,OrganizationAccountingRateQueryDto item) {
OrganizationAccountingRateExample example = new OrganizationAccountingRateExample();
//期间
example.createCriteria().andPeriodEqualTo(convertPeriod12(item.getPeriod())).andTaskIdEqualTo(item.getTaskId());
example.createCriteria().andPeriodEqualTo(convertPeriod12(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example);
//唯一则更新否则插入
OrganizationAccountingRate result = new OrganizationAccountingRate();
......@@ -640,7 +664,7 @@ public class EbsApiServiceImpl implements EbsApiService {
result.setTmsPeriod(convertPeriod);
}
private void populateFieldsBSprc(BalanceSheetPrcQueryDto item, BalanceSheet result) {
private void populateFieldsBSprc(BalanceSheetPrcQueryDto item, BalanceSheetPrc result) {
Integer originPeriod=convertPeriodStr2Int(item.getPeriod());
Integer convertPeriod=convertPeriod12(item.getPeriod());
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
......@@ -696,7 +720,7 @@ public class EbsApiServiceImpl implements EbsApiService {
result.setUpdateTime(new Date());
}
private void populateFieldsPLSprc(ProfitLossStatementPrcQueryDto item, ProfitLossStatement result) {
private void populateFieldsPLSprc(ProfitLossStatementPrcQueryDto item, ProfitLossStatementPrc result) {
Integer originPeriod=convertPeriodStr2Int(item.getPeriod());
Integer convertPeriod=convertPeriod12(item.getPeriod());
result.setOrganizationId(getOrganizationByEbsCode(item.getEntityCode()).getId());
......
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