Deferred Process service development
The deferred process service must be developed as a Bxm Service, and bxm.deferred.data.io.DeferredExecIO must be used for the input and output of the service.
The deferred process service logic should be implemented according to the business requirements.
The figure below shows the input and output of the deferred process service.
The table below describes the column names of the DTO.
| Column (physical name) | Column (logical name) | Type |
|---|---|---|
domainId |
Domain ID |
String |
deferredId |
Deferred process ID |
String |
bizDt |
the operating date |
String |
nodeNo |
Node number |
Integer |
deferredProcCd |
Deferred execution process code |
String |
parllProcSeq |
Parallel Processing serial number |
Integer |
targetTableNm |
Target table name |
String |
targetTableColumn |
Target table column name |
String |
startSeq |
Start serial number |
Long |
endSeq |
End serial number |
Long |
procSeq |
Current serial number |
Long |
The following example is a sample of deferred process service development.
@BxmServiceOperation("transferDef")
public DeferredExecIO transferDef(DeferredExecIO in) throws DefaultApplicationException
{
DeferredExecIO out = new DeferredExecIO();
/**
* Check the operating date
*/
if ( !isValidBizDt(in.getBizDt()))
{
logger.error("Not valid bizDt : [{}]", in.getBizDt());
throw new IllegalArgumentException("Not valid bizDt");
}
/**
* Get job log data.
*/
BxmLogTrx01IO logTrx01IO = getLogTrx(in);
/**
* Check input items
*/
if ( !inputValidation(logTrx01IO))
{
logger.error("InputValidation is failed.");
return null;
}
/**
* Inquiry of general account ledger
*/
PocAccMst02IO pocAccMstIO = getOpBrchInfo(Integer.parseInt(logTrx01IO.getOpenBranchNo()));
/**
* Check the account-opening branch
*/
if (pocAccMstIO == null)
{
// The corresponding account-opening branch does not exist.
logger.error("The corresponding account-opening branch does not exist.");
throw new DefaultApplicationException("CMFWE0023", new Object [] {});
}
/**
* After checking the transaction type, calculate the processing amount
*/
checkTrxType(logTrx01IO);
return out;
}
@BxmCategory(logicalName = "Input Item Validation", description = "Input Item Validation")
private boolean inputValidation(BxmLogTrx01IO in) throws DefaultApplicationException
{
/**
* Check for null input value
*/
if (in == null)
{
/**
* Input value is null
*/
logger.error("in is null.");
return false;
}
/**
* Check transaction type
*/
if (in.getTrxTypeCd() == null || StringUtils.isEmpty(in.getTrxTypeCd()))
{
/**
* Missing transaction type item
*/
logger.error("in.getTrxTypeCd() is null.");
return false;
}
/**
* Check amount
*/
if (in.getTrxAmt() == null || in.getTrxAmt().compareTo(BigDecimal.ZERO) <= 0)
{
/**
* Amount is empty or less than or equal to 0
*/
logger.error("in.getTrxAmt() is null");
return false;
}
if (in.getOpenBranchNo() == null || StringUtils.isEmpty(in.getOpenBranchNo()))
{
logger.error("in.getOpenBranchNo is null");
return false;
}
return true;
}
@BxmCategory(logicalName = "General Account Information Inquiry", description = "General Account Information Inquiry")
private PocAccMst02IO getOpBrchInfo(int opBrch) throws DefaultApplicationException
{
if (pocAccMstDBIO == null)
pocAccMstDBIO = LApplicationContext.getBean(PocAccMstDBIO.class);
PocAccMst02IO pocAccMstIO = pocAccMstDBIO.selectAccMst01(opBrch);
return pocAccMstIO;
}
@BxmCategory(logicalName = "Processing Amount Calculation by Transaction Type", description = "Add or subtract amount according to transaction type")
private void checkTrxType(BxmLogTrx01IO in) throws DefaultApplicationException
{
PocAccMst02IO pocAccMstIO = new PocAccMst02IO();
pocAccMstIO.setOpBrch(Integer.parseInt(in.getOpenBranchNo()));
pocAccMstIO.setAmt(in.getTrxAmt());
// Deposit 1, Withdrawal 2
/**
* In case of deposit (processing amount = balance + transaction amount)
* In case of withdrawal (processing amount = balance - transaction amount)
*/
// if (CommonCodeConstants.TRX_TYPE_DEP == in.getTrxType()) {
if (CommonCodeConstants.TRX_TYPE_DEP.equals(in.getTrxTypeCd()))
{
pocAccMstDBIO.updateAccMst01(pocAccMstIO);
}
else if (CommonCodeConstants.TRX_TYPE_PAY.equals(in.getTrxTypeCd()))
{
pocAccMstDBIO.updateAccMst02(pocAccMstIO);
}
}
private BxmLogTrx01IO getLogTrx(DeferredExecIO in)
{
if (bxmLogTrxDBIO == null)
bxmLogTrxDBIO = LApplicationContext.getBean(BxmLogTrxDBIO.class);
BxmLogTrx01IO bxmLogTrx01IO = new BxmLogTrx01IO();
bxmLogTrx01IO.setBizDt(in.getBizDt());
bxmLogTrx01IO.setNodeNo(in.getNodeNo());
bxmLogTrx01IO.setLogSeq(in.getProcSeq());
bxmLogTrx01IO.setDay(NumberingUtil.getBizDay(in.getBizDt()));
BxmLogTrx01IO logTrxOut = bxmLogTrxDBIO.selectListLogTrx02(bxmLogTrx01IO);
return logTrxOut;
}
private boolean isValidBizDt(String bizDt)
{
return !(StringUtils.isEmpty(bizDt)) && (bizDt.length() == 8);
}