Commit c67a1648 authored by Ken you's avatar Ken you

add ebs sixth call api --Ken

parent b0658e9d
...@@ -215,9 +215,32 @@ public class EbsApiController { ...@@ -215,9 +215,32 @@ public class EbsApiController {
} }
} }
/**
* callback服务
* @param callBackDto
* @return
*/
@RequestMapping(value = "/callback", method = RequestMethod.POST)
public ApiResultDto callback(@RequestBody EbsCallBackDto callBackDto) {
logger.info("EBS callback 调用,taskId :{}",callBackDto.getTaskId());
ApiResultDto apiResultDto = new ApiResultDto();
try{
ebsApiService.changeCallBackStatus(callBackDto);
logger.debug("ebs callback taskId:{},status:{} end ",callBackDto.getTaskId(),callBackDto.getTaskStatus());
setApiResult(apiResultDto,EnumErrorCodeMsg.SUCCESS);
return apiResultDto;
}catch(Exception e){
logger.error("ebs callback error.", e);
setApiResult(apiResultDto,EnumErrorCodeMsg.APIERROR);
return apiResultDto;
}
}
private void setApiResult(ApiResultDto apiResultDto,EnumErrorCodeMsg error) { private void setApiResult(ApiResultDto apiResultDto,EnumErrorCodeMsg error) {
apiResultDto.setCode(error.getCode()); apiResultDto.setCode(error.getCode());
apiResultDto.setMessage(error.getMsg()); apiResultDto.setMessage(error.getMsg());
} }
} }
package pwc.taxtech.atms.dto.ebsdto;
public class EbsCallBackDto {
private Long taskId;
private String taskStatus;
private String taskDesc;
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
public String getTaskStatus() {
return taskStatus;
}
public void setTaskStatus(String taskStatus) {
this.taskStatus = taskStatus;
}
public String getTaskDesc() {
return taskDesc;
}
public void setTaskDesc(String taskDesc) {
this.taskDesc = taskDesc;
}
}
...@@ -68,4 +68,10 @@ public interface EbsApiService { ...@@ -68,4 +68,10 @@ public interface EbsApiService {
* @param items * @param items
*/ */
void queryRemoteServerThenUpdateOrg(Long id, List<OrganizationQueryDto> items); void queryRemoteServerThenUpdateOrg(Long id, List<OrganizationQueryDto> items);
/**
* ebs最后调用更新状态
* @param ebsCallBackDto
*/
void changeCallBackStatus(EbsCallBackDto ebsCallBackDto);
} }
...@@ -82,7 +82,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -82,7 +82,7 @@ public class EbsApiServiceImpl implements EbsApiService {
logger.debug("requestJEItems 日记账表条目:" + JSON.toJSONString(items)); logger.debug("requestJEItems 日记账表条目:" + JSON.toJSONString(items));
for (JournalEntryQueryDto a : items) { for (JournalEntryQueryDto a : items) {
try { try {
processJE(a); processJE(id,a);
} catch (Exception e) { } catch (Exception e) {
logger.error("break loop as catch:" + e, e); logger.error("break loop as catch:" + e, e);
} }
...@@ -238,8 +238,9 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -238,8 +238,9 @@ public class EbsApiServiceImpl implements EbsApiService {
logger.debug("end queryRemoteServerThenUpdateOAR 汇率表,took [{}] ms", System.currentTimeMillis() - start); logger.debug("end queryRemoteServerThenUpdateOAR 汇率表,took [{}] ms", System.currentTimeMillis() - start);
} }
private void processJE(JournalEntryQueryDto item) { private void processJE(Long id,JournalEntryQueryDto item) {
JournalEntryExample journalEntryExample = new JournalEntryExample(); JournalEntryExample journalEntryExample = new JournalEntryExample();
item.setTaskId(String.valueOf(id));
//日记账头ID和日记账行号 //日记账头ID和日记账行号
journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum()).andTaskIdNotEqualTo(item.getTaskId()); journalEntryExample.createCriteria().andHeaderIdEqualTo(item.getHeaderId()).andLineNumEqualTo(item.getLineNum()).andTaskIdNotEqualTo(item.getTaskId());
List<JournalEntry> journalEntryList = journalEntryMapper.selectByExample(journalEntryExample); List<JournalEntry> journalEntryList = journalEntryMapper.selectByExample(journalEntryExample);
...@@ -264,6 +265,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -264,6 +265,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processTB(Long id,TrialBalanceQueryDto item) { private void processTB(Long id,TrialBalanceQueryDto item) {
TrialBalanceExample example = new TrialBalanceExample(); TrialBalanceExample example = new TrialBalanceExample();
item.setTaskId(String.valueOf(id));
//机构编码和期间 //机构编码和期间
example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andSegment1EqualTo(item.getSegment1()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example); List<TrialBalance> itemList = trialBalanceMapper.selectByExample(example);
...@@ -283,6 +285,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -283,6 +285,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processCF(Long id,CashFlowQueryDto item) { private void processCF(Long id,CashFlowQueryDto item) {
CashFlowExample example = new CashFlowExample(); CashFlowExample example = new CashFlowExample();
item.setTaskId(String.valueOf(id));
//机构编码和期间 //机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<CashFlow> itemList = cashFlowMapper.selectByExample(example); List<CashFlow> itemList = cashFlowMapper.selectByExample(example);
...@@ -303,6 +306,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -303,6 +306,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processBS(Long id,BalanceSheetQueryDto item) { private void processBS(Long id,BalanceSheetQueryDto item) {
BalanceSheetExample example = new BalanceSheetExample(); BalanceSheetExample example = new BalanceSheetExample();
item.setTaskId(String.valueOf(id));
//机构编码和期间 //机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example); List<BalanceSheet> itemList = balanceSheetMapper.selectByExample(example);
...@@ -331,6 +335,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -331,6 +335,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processBSprc(Long id,BalanceSheetPrcQueryDto item) { private void processBSprc(Long id,BalanceSheetPrcQueryDto item) {
BalanceSheetPrcExample example = new BalanceSheetPrcExample(); BalanceSheetPrcExample example = new BalanceSheetPrcExample();
item.setTaskId(String.valueOf(id));
//机构编码和期间 //机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<BalanceSheetPrc> itemList = balanceSheetPrcMapper.selectByExample(example); List<BalanceSheetPrc> itemList = balanceSheetPrcMapper.selectByExample(example);
...@@ -358,6 +363,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -358,6 +363,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processPL(Long id,ProfitLossStatementQueryDto item) { private void processPL(Long id,ProfitLossStatementQueryDto item) {
ProfitLossStatementExample example = new ProfitLossStatementExample(); ProfitLossStatementExample example = new ProfitLossStatementExample();
item.setTaskId(String.valueOf(id));
//机构编码和期间 //机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example); List<ProfitLossStatement> itemList = profitLossStatementMapper.selectByExample(example);
...@@ -385,6 +391,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -385,6 +391,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processPLprc(Long id,ProfitLossStatementPrcQueryDto item) { private void processPLprc(Long id,ProfitLossStatementPrcQueryDto item) {
ProfitLossStatementPrcExample example = new ProfitLossStatementPrcExample(); ProfitLossStatementPrcExample example = new ProfitLossStatementPrcExample();
item.setTaskId(String.valueOf(id));
//机构编码和期间 //机构编码和期间
example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andEntityCodeEqualTo(item.getEntityCode()).andPeriodEqualTo(convertPeriodStr2Int(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<ProfitLossStatementPrc> itemList = profitLossStatementPrcMapper.selectByExample(example); List<ProfitLossStatementPrc> itemList = profitLossStatementPrcMapper.selectByExample(example);
...@@ -412,6 +419,7 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -412,6 +419,7 @@ public class EbsApiServiceImpl implements EbsApiService {
private void processOAR(Long id,OrganizationAccountingRateQueryDto item) { private void processOAR(Long id,OrganizationAccountingRateQueryDto item) {
OrganizationAccountingRateExample example = new OrganizationAccountingRateExample(); OrganizationAccountingRateExample example = new OrganizationAccountingRateExample();
item.setTaskId(String.valueOf(id));
//期间 //期间
example.createCriteria().andPeriodEqualTo(convertPeriod12(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId()); example.createCriteria().andPeriodEqualTo(convertPeriod12(item.getPeriod())).andTaskIdNotEqualTo(item.getTaskId());
List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example); List<OrganizationAccountingRate> itemList = organizationAccountingRateMapper.selectByExample(example);
...@@ -783,6 +791,19 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -783,6 +791,19 @@ public class EbsApiServiceImpl implements EbsApiService {
logger.debug("end queryRemoteServerThenUpdateOrg 机构表,took [{}] ms", System.currentTimeMillis() - start); logger.debug("end queryRemoteServerThenUpdateOrg 机构表,took [{}] ms", System.currentTimeMillis() - start);
} }
@Override
public void changeCallBackStatus(EbsCallBackDto ebsCallBackDto) {
DataImportLog dataImportLog = new DataImportLog();
dataImportLog.setId(ebsCallBackDto.getTaskId());
dataImportLog.setImportResult(ebsCallBackDto.getTaskStatus().equals("S")?true:false);
dataImportLog.setErrorMsg(ebsCallBackDto.getTaskDesc());
dataImportLog.setUpdateTime(new Date());
int res = dataImportLogMapper.updateByPrimaryKeySelective(dataImportLog);
if (res < 0) {
logger.warn(String.format("warn callBack end [%s]", ebsCallBackDto.getTaskId()));
}
}
private void processORG(OrganizationQueryDto a) { private void processORG(OrganizationQueryDto a) {
// 机构信息 // 机构信息
OrganizationExample organizationExample = new OrganizationExample(); OrganizationExample organizationExample = new OrganizationExample();
...@@ -833,8 +854,6 @@ public class EbsApiServiceImpl implements EbsApiService { ...@@ -833,8 +854,6 @@ public class EbsApiServiceImpl implements EbsApiService {
organizationEmployeeMapper.insertSelective(oe); organizationEmployeeMapper.insertSelective(oe);
} }
private void updateDataImportLog(Long id, int size) { private void updateDataImportLog(Long id, int size) {
DataImportLog dataImportLog = new DataImportLog(); DataImportLog dataImportLog = new DataImportLog();
dataImportLog.setId(id); dataImportLog.setId(id);
......
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