Commit 7411a32a by zhanghou

完成mt192292,mt196296中文的报文要素展示

parent 87416a0f
package com.brilliance.swift.mx2map.camt029;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.AbstractMx2MapCreator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import com.brilliance.swift.vo.common.BalanceTypeCode;
import com.brilliance.swift.vo.common.CdtDbtCode;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Map;
public class Mx2MapCamt029Creator extends AbstractMx2MapCreator {
@Override
public Map<String, String> mx2Map() throws SwiftException {
try {
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String appHdrParentElementName = parentElementMaps.get("AppHdr");
String grpHdrParentElementName = parentElementMaps.get("GrpHdr");
String bodyParentElementName = parentElementMaps.get("CxlDtls");
String sendBic = abstractMX.getAppHdr().from();
maps.put(getPropertyValue("app.header.sendBic"), sendBic);
String receiverBic = abstractMX.getAppHdr().to();
maps.put(getPropertyValue("app.header.receiverBic"), receiverBic);
String uetr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.OrgnlUETR");
if(StringUtil.isNotEmpty(uetr)){
maps.put(getPropertyValue("uetr"), uetr);
}
String msgDefId = abstractMX.getAppHdr().messageName();
maps.put(getPropertyValue("app.header.msgDefId"), msgDefId);
String bizSvc = abstractMX.getAppHdr().serviceName();
maps.put(getPropertyValue("app.header.bizSvc"), bizSvc);
XMLGregorianCalendar creDt = abstractMX.getAppHdr().creationDate();
maps.put(getPropertyValue("app.header.creDt"), creDt.toXMLFormat());
String cxlStsId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.CxlStsId");
if(StringUtil.isNotEmpty(cxlStsId)){
maps.put(Mx2MtConstants.NEW_LINE+getPropertyValue("message.id"), cxlStsId);
}
String caseId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.RslvdCase.Id");
if(StringUtil.isNotEmpty(caseId)){
maps.put(getPropertyValue("endToEnd.id"), caseId);
}
String nameId = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String dateStr = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlCreDtTm");
if(StringUtil.isNotEmpty(nameId)){
maps.put(getPropertyValue("originalGroupInformation.orgnlMsgId"), nameId);
}
if(StringUtil.isNotEmpty(dateStr)){
maps.put(getPropertyValue("originalGroupInformation.orgnlCreDtTm"), dateStr);
}
String reason = XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.CxlStsRsnInf.Rsn.Cd");
if(StringUtil.isNotEmpty(reason)){
maps.put(getPropertyValue("cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.reason.cd"), reason);
}
int count = XmlUtil.getChildrenCount(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.CxlStsRsnInf.AddtlInf",null);
String information = "";
if(count>0){
for (int i = 0; i < count; i++) {
information = information + XmlUtil.getXmlNodeValue(document, bodyParentElementName + ".CxlDtls.TxInfAndSts.CxlStsRsnInf.AddtlInf("+i+")");
}
}
if(StringUtil.isNotEmpty(information)){
maps.put(getPropertyValue("cancellationDetails.transactionInformationAndStatus.cancellationStatusReasonInformation.addtlInf"), information);
}
} catch (DocumentException e) {
throw new SwiftException("ERROR", e.getMessage());
}
return maps;
}
}
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