Commit 3c5e89ee by zhanghou

210的修改提交

parent fb14b1af
......@@ -22,4 +22,6 @@ public class Mx2MtContextIdentifier {
public static final String MT_TYPE_940_FLAG = "mt.type.940.flag";
public static final String MT_TYPE_210_50_FLAG = "mt.type.210.50.flag";
}
......@@ -51,8 +51,8 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
List<Mx2MtTagsGenerate> fieldsGenerateList = new ArrayList<>();
fieldsGenerateList.add(new Field20Generate());
fieldsGenerateList.add(new Field21Generate());
fieldsGenerateList.add(new Field79Generate());
fieldsGenerateList.add(new Field11SGenerate());
fieldsGenerateList.add(new Field79Generate());
return fieldsGenerateList;
}
......@@ -60,7 +60,7 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
protected String getMtType() {
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true);
String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true);
String mtType = getXmlNodeValue(bodyParentPath, document, "FIToFIPmtCxlReq.Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String mtType = getXmlNodeValue(bodyParentPath, document, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String msgType = "";
if(StringUtil.isNotEmpty(mtType)){
if(mtType.startsWith("pacs.008")){
......
......@@ -85,7 +85,7 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator {
protected String getMtType() {
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true);
String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true);
String mtType = getXmlNodeValue(bodyParentPath, document, "RsltnOfInvstgtn.CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String mtType = getXmlNodeValue(bodyParentPath, document, "CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String msgType = "";
if(StringUtil.isNotEmpty(mtType)){
if(mtType.startsWith("pacs.008")){
......
package com.brilliance.swift.mx2mt.mt210;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtCreator;
import com.brilliance.swift.mx2mt.Mx2MtContextIdentifier;
import com.brilliance.swift.mx2mt.Mx2MtTagsGenerate;
import com.brilliance.swift.mx2mt.mt210.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import com.prowidesoftware.swift.model.SwiftBlock3;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.field.Field121;
import org.dom4j.Document;
import java.util.ArrayList;
......@@ -38,6 +43,18 @@ public class Mx2Mt210Creator extends AbstractMx2MtCreator {
return fieldsGenerateList;
}
@Override
public void withBlock3() throws SwiftException {
super.withBlock3();
SwiftBlock3 block3 = context.get(SwiftMessage.class).getBlock3();
Document document = (Document)context.get(Mx2MtContextIdentifier.MX_XMl_DOCUMENT, true);
String bodyParentPath = (String)context.get(Mx2MtContextIdentifier.BODY_PARENT_ELEMENT_NAME, true);
String uetr = getXmlNodeValue(bodyParentPath, document, "Ntfctn.Itm("+0+").UETR");
if (StringUtil.isNotEmpty(uetr)) {
Field121 field121 = new Field121(uetr);
block3.builder().setField121(field121);
}
}
@Override
protected String getMtType() {
......
......@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt210.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.mx2mt.Mx2MtContextIdentifier;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -29,6 +30,9 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
int counts2 = getXmlNodeCounts(bodyHdrParentElementName, document, "Ntfctn.Itm("+0+").Dbtr.Pty");
int counts3 = getXmlNodeCounts(bodyHdrParentElementName, document, "Ntfctn.Dbtr.Agt");
int counts4 = getXmlNodeCounts(bodyHdrParentElementName, document, "Ntfctn.Itm("+0+").Dbtr.Agt");
if(counts1>0||counts2>0||counts3>0||counts4>0){
context.set(Mx2MtContextIdentifier.MT_TYPE_210_50_FLAG, Mx2MtConstants.YES);
}
String partyPath = "";
String bicCode = "";
String country = "";
......
......@@ -3,6 +3,7 @@ package com.brilliance.swift.mx2mt.mt210.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.mx2mt.Mx2MtContextIdentifier;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -20,6 +21,10 @@ public class Field52aGenerate extends AbstractMx2MtTagsGenerate {
@Override
public void tagGenerate() throws SwiftException {
String s = (String)context.get(Mx2MtContextIdentifier.MT_TYPE_210_50_FLAG);
if(Mx2MtConstants.YES.equals(s)){
return;
}
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
int counts1 = getXmlNodeCounts(bodyHdrParentElementName, document, "Ntfctn.DbtrAgt");
......
......@@ -27,9 +27,34 @@ public class Test {
Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap);
maps.forEach((k, v) -> System.out.println(k + "=" + v));
}
private static void test196() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt02900108_196.xml"));
String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps);
}
private static void test940() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05300108_940.xml"));
String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps);
}
private static void test910() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05400108_CREDIT.xml"));
String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps);
}
private static void test192() throws IOException {
String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05600108_192.xml"));
String maps = SwiftTransfer.mx2Gson(xmlStr);
System.out.println(maps);
}
public static void main(String[] args) throws IOException {
test202();
//test202();
//test202Cov();
//test196();
//test910();
//test940();
test192();
}
}
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