Commit a786c1a1 by s_guodong

增加sys011,sys012报文解析成map

parent 8213c119
......@@ -12,6 +12,8 @@ import com.brilliance.swift.mx2element.pacs002001.Mx2ElementPacs002001Creator;
import com.brilliance.swift.mx2element.pacs004001.Mx2ElementPacs004001Creator;
import com.brilliance.swift.mx2element.pacs008001.Mx2ElementPacs008001Creator;
import com.brilliance.swift.mx2element.pacs009001.Mx2ElementPacs009001Creator;
import com.brilliance.swift.mx2element.xsys011001.Mx2ElementXsys011001Creator;
import com.brilliance.swift.mx2element.xsys01200101.Mx2ElementXsys012001Creator;
import com.brilliance.swift.util.XmlUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
......@@ -33,9 +35,9 @@ public class Mx2ElementCreatorManager {
xmlStr = XmlUtil.handlingXml(xmlStr);
MxId mxId = XmlUtil.getMxMessageType(xmlStr);
String messageType = mxId.getBusinessProcess().name()
+ mxId.getFunctionality()
+ mxId.getVariant()
+ mxId.getVersion();
+ mxId.getFunctionality()
+ mxId.getVariant()
+ mxId.getVersion();
if (mxId == null) {
throw new SwiftException("找不到MX报文类型");
}
......@@ -69,9 +71,13 @@ public class Mx2ElementCreatorManager {
return new Mx2ElementCamt057001Creator();
} else if (messageType.matches("camt060001[0-9]{2}")) {
return new Mx2ElementCamt060001Creator();
}else if (messageType.matches("camt052001[0-9]{2}")) {
} else if (messageType.matches("camt052001[0-9]{2}")) {
return new Mx2ElementCamt052001Creator();
}else {
} else if (messageType.matches("xsys011001[0-9]{2}")) {
return new Mx2ElementXsys011001Creator();
} else if (messageType.matches("xsys012001[0-9]{2}")) {
return new Mx2ElementXsys012001Creator();
} else {
throw new SwiftException("无效的MX报文类型");
}
}
......
package com.brilliance.swift.mx2element.xsys011001;
import com.brilliance.swift.mx2element.AbstractMx2ElementCreator;
import java.util.Map;
public class Mx2ElementXsys011001Creator extends AbstractMx2ElementCreator {
@Override
public Map<String, Object> buildElement() {
return super.buildElement();
}
}
package com.brilliance.swift.mx2element.xsys01200101;
import com.brilliance.swift.mx2element.AbstractMx2ElementCreator;
import java.util.Map;
public class Mx2ElementXsys012001Creator extends AbstractMx2ElementCreator {
@Override
public Map<String, Object> buildElement() {
return super.buildElement();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<SwInt:HandleRequest xmlns:Sw="urn:swift:snl:ns.Sw"
xmlns:SwInt="urn:swift:snl:ns.SwInt">
<SwInt:RequestHandle>
<SwInt:RequestDescriptor>
<SwInt:SwiftRequestRef>SNL00110-2010-05-04T15:31:37.3172.000004Z
</SwInt:SwiftRequestRef>
<SwInt:SwiftRef>swi00001-2010-05-04T15:31:37.22284.11144096Z
</SwInt:SwiftRef>
<Sw:SnFOutputInfo>
<Sw:SnFSessionId>simxbebb_generic:p:000047</Sw:SnFSessionId>
<Sw:SnFOutputSeq>2337174</Sw:SnFOutputSeq>
<Sw:DeliveryTime>2010-05-04T15:31:43Z</Sw:DeliveryTime>
<Sw:SnFInputTime>0105:2010-05-04T15:31:41</Sw:SnFInputTime>
</Sw:SnFOutputInfo>
<SwInt:MRRResult>
<SwInt:SNLId>snl00110</SwInt:SNLId>
<SwInt:SNLEP>spark_ap2</SwInt:SNLEP>
</SwInt:MRRResult>
</SwInt:RequestDescriptor>
<SwInt:RequestHeader>
<SwInt:Requestor>cn=system,o=swift,o=swift</SwInt:Requestor>
<SwInt:Responder>cn=requestor,o=simxbebb,o=swift</SwInt:Responder>
<SwInt:Service>swift.snf.system</SwInt:Service>
<SwInt:RequestType>xsys.011.001.01</SwInt:RequestType>
<SwInt:Priority>Normal</SwInt:Priority>
</SwInt:RequestHeader>
<SwInt:RequestPayload>
<Ah:AppHdr xmlns:Ah="urn:swift:xsd:$ahV10">
<Ah:MsgRef>2010-05-04T15:31:41Z</Ah:MsgRef>
<Ah:CrDate>2010-05-04T15:31:41Z</Ah:CrDate>
</Ah:AppHdr>
<Doc:Document xmlns:Doc="urn:swift:xsd:xsys.011.001.01"
xmlns:Sw="urn:swift:snl:ns.Sw"
xmlns:SwInt="urn:swift:snl:ns.SwInt"
>
<Doc:xsys.011.001.01>
<Doc:DlvryNtfctn>
<Sw:SnFRef>swi00001-2010-05-04T15:31:37.22284.11144096Z</Sw:SnFRef>
<Sw:SnFRefType>InterAct</Sw:SnFRefType>
<Sw:AcceptStatus>Accepted</Sw:AcceptStatus>
<Sw:AckSwiftTime>2010-05-04T15:31:41Z</Sw:AckSwiftTime>
<SwInt:RequestHeader>
<SwInt:Requestor>cn=requestor,o=simxbebb,o=swift</SwInt:Requestor>
<SwInt:Responder>cn=responder,o=simxus33,o=swift</SwInt:Responder>
<SwInt:Service>mnop.cop</SwInt:Service>
<SwInt:RequestType>pain.002.002.01</SwInt:RequestType>
<SwInt:Priority>Normal</SwInt:Priority>
<SwInt:RequestRef>Ref-3992</SwInt:RequestRef>
</SwInt:RequestHeader>
</Doc:DlvryNtfctn>
</Doc:xsys.011.001.01>
</Doc:Document>
</SwInt:RequestPayload>
</SwInt:RequestHandle>
</SwInt:HandleRequest>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<SwInt:HandleRequest xmlns:Sw="urn:swift:snl:ns.Sw"
xmlns:SwInt="urn:swift:snl:ns.SwInt">
<SwInt:RequestHandle>
<SwInt:RequestDescriptor>
<SwInt:SwiftRequestRef>SNL00110-2010-05-04T15:32:59.3912.000004Z</SwInt:SwiftRequestRef>
<SwInt:SwiftRef>swi00001-2010-05-04T15:32:59.21582.11198379Z</SwInt:SwiftRef>
<SwInt:NonRep>
<SwInt:NRType>SVCOPT</SwInt:NRType>
</SwInt:NonRep>
<Sw:SnFOutputInfo>
<Sw:SnFSessionId>simxbebb_generic:p:000047</Sw:SnFSessionId>
<Sw:SnFOutputSeq>2337176</Sw:SnFOutputSeq>
<Sw:DeliveryTime>2010-05-04T15:33:14Z</Sw:DeliveryTime>
<Sw:SnFInputTime>0105:2010-05-04T15:33:12</Sw:SnFInputTime>
</Sw:SnFOutputInfo>
<SwInt:MRRResult>
<SwInt:SNLId>snl00110</SwInt:SNLId>
<SwInt:SNLEP>spark_ap2</SwInt:SNLEP>
</SwInt:MRRResult>
</SwInt:RequestDescriptor>
<SwInt:RequestHeader>
<SwInt:Requestor>cn=system,o=swift,o=swift</SwInt:Requestor>
<SwInt:Responder>cn=requestor,o=simxbebb,o=swift</SwInt:Responder>
<SwInt:Service>swift.snf.system</SwInt:Service>
<SwInt:RequestType>xsys.012.001.01</SwInt:RequestType>
<SwInt:Priority>Normal</SwInt:Priority>
</SwInt:RequestHeader>
<SwInt:RequestPayload>
<Ah:AppHdr xmlns:Ah="urn:swift:xsd:$ahV10">
<Ah:MsgRef>2010-05-04T15:33:12Z</Ah:MsgRef>
<Ah:CrDate>2010-05-04T15:33:12Z</Ah:CrDate>
</Ah:AppHdr>
<Doc:Document xmlns:Doc="urn:swift:xsd:xsys.012.001.01"
xmlns:Sw="urn:swift:snl:ns.Sw"
xmlns:SwInt="urn:swift:snl:ns.SwInt"
>
<Doc:xsys.012.001.01>
<Doc:DlvryNtfctn>
<Sw:SnFRef>swi00001-2010-05-04T15:32:59.21582.11198379Z</Sw:SnFRef>
<Sw:SnFRefType>InterAct</Sw:SnFRefType>
<Sw:AcceptStatus>Failed</Sw:AcceptStatus>
<Sw:AckSwiftTime>2010-05-04T15:33:12Z</Sw:AckSwiftTime>
<Sw:AckDescription>Message delivery attempts exceeded system threshold</Sw:AckDescription>
<Sw:AckInfo>SwRejectcode=SwGbl.MaxRetryExceeded</Sw:AckInfo>
<SwInt:RequestHeader>
<SwInt:Requestor>cn=requestor,o=simxbebb,o=swift</SwInt:Requestor>
<SwInt:Responder>cn=responder,o=simxus33,o=swift</SwInt:Responder>
<SwInt:Service>mnop.cop</SwInt:Service>
<SwInt:RequestType>pain.001.002.04</SwInt:RequestType>
<SwInt:Priority>Normal</SwInt:Priority>
<SwInt:RequestRef>Ref-84884</SwInt:RequestRef>
</SwInt:RequestHeader>
</Doc:DlvryNtfctn>
</Doc:xsys.012.001.01>
</Doc:Document>
</SwInt:RequestPayload>
</SwInt:RequestHandle>
</SwInt:HandleRequest>
\ No newline at end of file
# ??????? ?origSnFRef????origSnFRef????snFRef
snFRef=xsys01100101.dlvryNtfctn.snFRef
origSnFRef=xsys01100101.dlvryNtfctn.origSnFRef
snFRefType=xsys01100101.dlvryNtfctn.snFRefType
acceptStatus=xsys01100101.dlvryNtfctn.acceptStatus
ackSwiftTime=xsys01100101.dlvryNtfctn.ackSwiftTime
requestor=xsys01100101.dlvryNtfctn.requestHeader.requestor
responder=xsys01100101.dlvryNtfctn.requestHeader.responder
service=xsys01100101.dlvryNtfctn.requestHeader.service
requestType=xsys01100101.dlvryNtfctn.requestHeader.requestType
priority=xsys01100101.dlvryNtfctn.requestHeader.priority
requestRef=xsys01100101.dlvryNtfctn.requestHeader.requestRef
# ??????? ?origSnFRef????origSnFRef????snFRef
snFRef=xsys01200101.dlvryNtfctn.snFRef
origSnFRef=xsys01200101.dlvryNtfctn.origSnFRef
snFRefType=xsys01200101.dlvryNtfctn.snFRefType
acceptStatus=xsys01200101.dlvryNtfctn.acceptStatus
ackSwiftTime=xsys01200101.dlvryNtfctn.ackSwiftTime
requestor=xsys01200101.dlvryNtfctn.requestHeader.requestor
responder=xsys01200101.dlvryNtfctn.requestHeader.responder
service=xsys01200101.dlvryNtfctn.requestHeader.service
requestType=xsys01200101.dlvryNtfctn.requestHeader.requestType
priority=xsys01200101.dlvryNtfctn.requestHeader.priority
requestRef=xsys01200101.dlvryNtfctn.requestHeader.requestRef
package com.brilliance;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.Map;
/**
* @Description
* @Author s_guodong
* @Date 2023/12/22
*/
public class Mx2MapTest {
/**
* ack报文
*
* @throws IOException
*/
@Test
public void test_xsys011() throws IOException {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/xsys01100101.xml"));
String xmlStr = FileUtils.readFileToString(file);
Map<String, Object> elementMaps = SwiftTransfer.mx2ElementMaps(xmlStr);
System.out.println(elementMaps);
}
/**
* nck报文
*
* @throws IOException
*/
@Test
public void test_xsys012() throws IOException {
File file = FileUtils.toFile(Mx2MtTest.class.getResource("/swiftXml/xsys01200101.xml"));
String xmlStr = FileUtils.readFileToString(file);
Map<String, Object> elementMaps = SwiftTransfer.mx2ElementMaps(xmlStr);
System.out.println(elementMaps);
}
}
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