Commit 96fde8fb by zhanghou

修改Mx2Mt900910Creator类中的方法

parent 182bca3f
......@@ -43,13 +43,7 @@ public class Mx2Mt900910Creator extends AbstractMx2MtCreator {
}
@Override
public String generateMtMsg() {
validate();
String outPutFilePath = (String)map.get(Mx2MtConstants.OUT_PUT_FILE_PATH);
return TemplateUtil.makeFileByTemplate("swift_mt_900_910.vm", map, outPutFilePath, "utf-8");
}
public void validate() {
public void postProcess() {
String mtType = (String)map.get(Mx2MtConstants.MT_TYPE);
if (Mx2MtConstants.MT_TYPE_910.equals(mtType)) {
String field50a = (String)map.get("field50a");
......@@ -59,35 +53,23 @@ public class Mx2Mt900910Creator extends AbstractMx2MtCreator {
}
}
}
@Override
protected String getMtType() {
try {
String mtType = "";
MxCamt05400102 mxCamt05400102 = (MxCamt05400102)map.get(Mx2MtConstants.MX_OBJECT);
if (mxCamt05400102 == null || mxCamt05400102.getBkToCstmrDbtCdtNtfctn() == null) {
return mtType;
}
BankToCustomerDebitCreditNotificationV02 bkToCstmrDbtCdtNtfctn = mxCamt05400102.getBkToCstmrDbtCdtNtfctn();
List<AccountNotification2> ntfctnList = bkToCstmrDbtCdtNtfctn.getNtfctn();
if (ntfctnList != null && ntfctnList.size() > 0) {
AccountNotification2 ntfctn = ntfctnList.get(0);
List<ReportEntry2> ntryList = ntfctn.getNtry();
if (ntryList != null && ntryList.size() > 0) {
ReportEntry2 ntry = ntryList.get(0);
//judge 900 or 910
if (CreditDebitCode.DBIT.equals(ntry.getCdtDbtInd())) {
mtType = Mx2MtConstants.MT_TYPE_900;
} else if (CreditDebitCode.CRDT.equals(ntry.getCdtDbtInd())) {
mtType = Mx2MtConstants.MT_TYPE_910;
}
map.put(Mx2MtConstants.MT_TYPE, mtType);
}
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String cdtDbtInd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.CdtDbtInd");
//judge 900 or 910
if (CreditDebitCode.DBIT.equals(CreditDebitCode.valueOf(cdtDbtInd))) {
mtType = Mx2MtConstants.MT_TYPE_900;
} else if (CreditDebitCode.CRDT.equals(CreditDebitCode.valueOf(cdtDbtInd))) {
mtType = Mx2MtConstants.MT_TYPE_910;
}
map.put(Mx2MtConstants.MT_TYPE, mtType);
return mtType;
} catch (Exception e) {
logger.error(e.getMessage());
throw new SwiftException("ERROR", "getMtType error.");
throw new SwiftException("ERROR", e.getMessage());
}
}
}
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