Commit de0287c5 by chengzhuoshen

增加mx报文转要素的功能

parent 2c15fa67
......@@ -2,6 +2,7 @@ package com.brilliance.swift;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import com.brilliance.swift.mx2element.Mx2ElementCreatorManager;
import com.brilliance.swift.mx2map.Mx2MapCreatorManager;
import com.brilliance.swift.mx2mt.Mx2MtCreatorManager;
import com.brilliance.swift.util.StringUtil;
......@@ -207,4 +208,13 @@ public class SwiftTransfer {
}
return true;
}
/**
* MX 报文转json要素
* @param xmlStr
* @return
*/
public static String mx2Element(String xmlStr) {
return new Mx2ElementCreatorManager().mx2Element(xmlStr);
}
}
......@@ -17,7 +17,7 @@ public class MessageUtil {
if ("US".equals(localCode)) {
fileName = "/Messages_US.properties";
}
InputStream resourceAsStream = SwiftTransferUtil.class.getResourceAsStream(fileName);
InputStream resourceAsStream = MessageUtil.class.getResourceAsStream(fileName);
properties = new Properties();
properties.load(resourceAsStream);
}
......
......@@ -68,6 +68,9 @@ Change Log
<StrtNm>High Street</StrtNm>
<TwnNm>Epping</TwnNm>
<Ctry>GB</Ctry>
<AdrLine>123</AdrLine>
<AdrLine>456</AdrLine>
<AdrLine>789</AdrLine>
</PstlAdr>
</Dbtr>
<DbtrAgt>
......
package com.brilliance.mx2element;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
File file = new File("d:/test/MxPacs00800108.xml");
String xmlStr = FileUtils.readFileToString(file);
String jsonStr = SwiftTransfer.mx2Element(xmlStr);
System.out.println(jsonStr);
}
}
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