Commit 3b51a6e4 by zhanghou

增加判断pacs00900108是不是adv的方法

parent 8f0e7250
......@@ -11,6 +11,8 @@ import com.brilliance.swift.util.*;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.MxId;
import com.prowidesoftware.swift.model.mx.AbstractMX;
import com.prowidesoftware.swift.model.mx.AppHdr;
import com.prowidesoftware.swift.model.mx.BusinessAppHdrV02;
import com.prowidesoftware.swift.model.mx.NamespaceReader;
import org.apache.commons.io.FileUtils;
import org.dom4j.Document;
......@@ -129,10 +131,14 @@ public class SwiftTransfer {
SwiftTranslationReport str = mx2MtPlus(xmlStr, null, extraMap);
Map<String, String> maps = MxMessageReader.getSwfMsgInfoViaMsg(str);
AbstractMX abstractMx = AbstractMX.parse(xmlStr);
String serviceName = abstractMx.getAppHdr().serviceName();
if (abstractMx != null) {
String messageType = abstractMx.getMxId().id();
maps.put("xty", messageType);//ISO20022类型
if (messageType.startsWith("pacs.008.001") || messageType.startsWith("pacs.009.001")) {
if(messageType.startsWith("pacs.009.001")&&StringUtil.isNotEmpty(serviceName)&&serviceName.contains("adv")){
maps.put("mty","202ADV");
}
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String bodyParentElementName = parentElementMaps.get("CdtTrfTxInf");
......
......@@ -30,7 +30,7 @@ Change Log
</To>
<BizMsgIdr>pacs9bizmsgidr02</BizMsgIdr>
<MsgDefIdr>pacs.009.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.cov.02</BizSvc>
<BizSvc>swift.cbprplus.adv.02</BizSvc>
<CreDt>2021-05-17T10:23:41.00+01:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.08">
......
......@@ -268,7 +268,7 @@ public class Mx2MtTest {
@Test
public void testMx2MtMap() throws IOException {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs004001_Pacs008.xml"));
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/MxPacs00900108_COV.xml"));
String xmlStr = FileUtils.readFileToString(file);
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, null);
for (String key : maps.keySet()) {
......
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