Commit 7f1ddaab by chengzhuoshen

1.fixed 900/910 code

parent 96fde8fb
...@@ -28,6 +28,17 @@ public class Mx2Mt900910Creator extends AbstractMx2MtCreator { ...@@ -28,6 +28,17 @@ public class Mx2Mt900910Creator extends AbstractMx2MtCreator {
} }
@Override @Override
public void generateHead3() {
String head3 = "";
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String uetr = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.Refs.UETR");
if (StringUtil.isNotEmpty(uetr)) {
head3 += "{121:"+uetr+"}";
}
map.put("head3", head3);
}
@Override
public List<Mx2MtFieldsGenerate> getFieldsGenerateList() { public List<Mx2MtFieldsGenerate> getFieldsGenerateList() {
List<Mx2MtFieldsGenerate> fieldsGenerateList = new ArrayList<>(); List<Mx2MtFieldsGenerate> fieldsGenerateList = new ArrayList<>();
fieldsGenerateList.add(new Field13DGenerate()); fieldsGenerateList.add(new Field13DGenerate());
......
package com.prowidesoftware.brilliance.mx2mt.mt900910.impl; package com.prowidesoftware.brilliance.mx2mt.mt900910.impl;
import com.prowidesoftware.brilliance.constants.Mx2MtConstants; import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import com.prowidesoftware.brilliance.exception.SwiftException; import com.prowidesoftware.brilliance.exception.SwiftException;
import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import com.prowidesoftware.brilliance.util.StringUtil; import com.prowidesoftware.brilliance.util.StringUtil;
import com.prowidesoftware.swift.model.mx.MxCamt05400102;
import com.prowidesoftware.swift.model.mx.dic.*;
import org.dom4j.Document; import org.dom4j.Document;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
/** /**
* 50A * 50A
* <Ntfctn><Ntry><NtryDtls><TxDtls><RltdPties><Dbtr><Pty><Id><OrgId><AnyBIC> * <Ntfctn><Ntry><NtryDtls><TxDtls><RltdPties><Dbtr><Pty><Id><OrgId><AnyBIC>
...@@ -36,43 +32,36 @@ public class Field50aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -36,43 +32,36 @@ public class Field50aGenerate extends AbstractMx2MtFieldsGenerate {
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT); Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String field50aOption = ""; String field50aOption = "";
String field50a = ""; String field50a = "";
String bicCode = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Id.OrgId.BICOrBEI"); String bicCode = getBicCode(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Id.OrgId");
String Nm = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Nm"); String name = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.Nm");
String account = getAccount();
if(StringUtil.isNotEmpty(bicCode)){ if(StringUtil.isNotEmpty(bicCode)){
field50aOption = "A"; field50aOption = "A";
String account = getMtFormatAccount2();
if (StringUtil.isNotEmpty(account)) { if (StringUtil.isNotEmpty(account)) {
field50a = account + Mx2MtConstants.NEW_LINE + bicCode; field50a = account + Mx2MtConstants.NEW_LINE + bicCode;
} else { } else {
field50a = bicCode; field50a = bicCode;
} }
}else if(StringUtil.isNotEmpty(Nm)){ }else if(StringUtil.isNotEmpty(name)){
field50aOption = "K"; field50aOption = "K";
String nameAddr = ""; if (name.length() > 35) name = name.substring(0, 35);
if (StringUtil.isNotEmpty(account)) {
field50a = account + Mx2MtConstants.NEW_LINE + name;
} else {
field50a = name;
}
int adrLineCounts = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.PstlAdr.AdrLine"); int adrLineCounts = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.PstlAdr.AdrLine");
if(adrLineCounts>0){ if(adrLineCounts>0){
for (int i=0; i<adrLineCounts; i++) { for (int i=0; i<adrLineCounts; i++) {
if (i == 4) { if (i == 3) {
break; break;
} }
String adrLine = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.PstlAdr.AdrLine("+i+")"); String adrLine = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdPties.Dbtr.PstlAdr.AdrLine("+i+")");
if (adrLine.length() > 35) { if (adrLine.length() > 35) adrLine = adrLine.substring(0, 35);
adrLine = adrLine.substring(0, 35); field50a += Mx2MtConstants.NEW_LINE + adrLine;
}
if (i == 0) {
nameAddr += adrLine;
} else {
nameAddr += Mx2MtConstants.NEW_LINE+adrLine;
}
} }
} }
String account = getMtFormatAccount2();
if (StringUtil.isNotEmpty(account)) {
field50a = account + Mx2MtConstants.NEW_LINE + nameAddr;;
} else {
field50a = nameAddr;
}
} }
if (StringUtil.isNotEmpty(field50aOption) && StringUtil.isNotEmpty(field50a)) { if (StringUtil.isNotEmpty(field50aOption) && StringUtil.isNotEmpty(field50a)) {
map.put("field50aOption", field50aOption); map.put("field50aOption", field50aOption);
...@@ -82,7 +71,7 @@ public class Field50aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -82,7 +71,7 @@ public class Field50aGenerate extends AbstractMx2MtFieldsGenerate {
throw new SwiftException("ERROR", e.getMessage()); throw new SwiftException("ERROR", e.getMessage());
} }
} }
private String getMtFormatAccount2(){ private String getAccount(){
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT); Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String account = ""; String account = "";
String otherId = ""; String otherId = "";
...@@ -98,6 +87,9 @@ public class Field50aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -98,6 +87,9 @@ public class Field50aGenerate extends AbstractMx2MtFieldsGenerate {
} else if (StringUtil.isNotEmpty(otherId)) { } else if (StringUtil.isNotEmpty(otherId)) {
account = "//CH"+otherId; account = "//CH"+otherId;
} }
if (StringUtil.isNotEmpty(account) && account.length() > 35) {
account = account.substring(0, 35);
}
return account; return account;
} }
} }
package com.prowidesoftware.brilliance.mx2mt.mt900910.impl; package com.prowidesoftware.brilliance.mx2mt.mt900910.impl;
import com.prowidesoftware.brilliance.constants.Mx2MtConstants; import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import com.prowidesoftware.brilliance.exception.SwiftException; import com.prowidesoftware.brilliance.exception.SwiftException;
import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import com.prowidesoftware.brilliance.util.StringUtil; import com.prowidesoftware.brilliance.util.StringUtil;
import com.prowidesoftware.swift.model.mx.MxCamt05400102;
import com.prowidesoftware.swift.model.mx.dic.*;
import org.dom4j.Document; import org.dom4j.Document;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
public class Field52aGenerate extends AbstractMx2MtFieldsGenerate { public class Field52aGenerate extends AbstractMx2MtFieldsGenerate {
private static final Logger logger = LoggerFactory.getLogger(Field52aGenerate.class); private static final Logger logger = LoggerFactory.getLogger(Field52aGenerate.class);
...@@ -22,9 +18,9 @@ public class Field52aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -22,9 +18,9 @@ public class Field52aGenerate extends AbstractMx2MtFieldsGenerate {
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT); Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String field52aOption = ""; String field52aOption = "";
String field52a = ""; String field52a = "";
String bicCode = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.BIC"); String bicCode = getBicCode(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId");
String memberId = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.ClrSysMmbId.MmbId"); String memberId = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.ClrSysMmbId.MmbId");
String nm = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.Nm"); String name = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.Nm");
if (StringUtil.isNotEmpty(bicCode)) { if (StringUtil.isNotEmpty(bicCode)) {
field52aOption = "A"; field52aOption = "A";
if (StringUtil.isNotEmpty(memberId)) { if (StringUtil.isNotEmpty(memberId)) {
...@@ -32,26 +28,20 @@ public class Field52aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -32,26 +28,20 @@ public class Field52aGenerate extends AbstractMx2MtFieldsGenerate {
} else { } else {
field52a = bicCode; field52a = bicCode;
} }
}else if(StringUtil.isNotEmpty(nm)){ }else if(StringUtil.isNotEmpty(name)){
field52aOption = "D"; field52aOption = "D";
if (StringUtil.isNotEmpty(memberId)) { if (StringUtil.isNotEmpty(memberId)) {
field52a = "/" + memberId; field52a = "/" + memberId + Mx2MtConstants.NEW_LINE + name;
} }
int adrLineCount = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.PstlAdr.AdrLine"); int adrLineCount = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.PstlAdr.AdrLine");
if(adrLineCount>0){ if(adrLineCount>0){
for (int i=0; i<adrLineCount; i++) { for (int i=0; i<adrLineCount; i++) {
if (i == 4) { if (i == 3) {
break; break;
} }
String adrLine = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.PstlAdr.AdrLine("+i+")"); String adrLine = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.DbtrAgt.FinInstnId.PstlAdr.AdrLine("+i+")");
if (adrLine.length() > 35) { if (adrLine.length() > 35) adrLine = adrLine.substring(0, 35);
adrLine = adrLine.substring(0, 35); field52a += Mx2MtConstants.NEW_LINE + adrLine;
}
if (i==0 && StringUtil.isEmpty(field52a)) {
field52a += adrLine;
} else {
field52a += Mx2MtConstants.NEW_LINE+adrLine;
}
} }
} }
} }
......
package com.prowidesoftware.brilliance.mx2mt.mt900910.impl; package com.prowidesoftware.brilliance.mx2mt.mt900910.impl;
import com.prowidesoftware.brilliance.constants.Mx2MtConstants; import com.prowidesoftware.brilliance.constants.Mx2MtConstants;
import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import com.prowidesoftware.brilliance.exception.SwiftException; import com.prowidesoftware.brilliance.exception.SwiftException;
import com.prowidesoftware.brilliance.mx2mt.AbstractMx2MtFieldsGenerate;
import com.prowidesoftware.brilliance.util.StringUtil; import com.prowidesoftware.brilliance.util.StringUtil;
import com.prowidesoftware.swift.model.mx.MxCamt05400102;
import com.prowidesoftware.swift.model.mx.dic.*;
import org.dom4j.Document; import org.dom4j.Document;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
public class Field56aGenerate extends AbstractMx2MtFieldsGenerate { public class Field56aGenerate extends AbstractMx2MtFieldsGenerate {
private static final Logger logger = LoggerFactory.getLogger(Field56aGenerate.class); private static final Logger logger = LoggerFactory.getLogger(Field56aGenerate.class);
...@@ -26,9 +22,9 @@ public class Field56aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -26,9 +22,9 @@ public class Field56aGenerate extends AbstractMx2MtFieldsGenerate {
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT); Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String field56aOption = ""; String field56aOption = "";
String field56a = ""; String field56a = "";
String bicCode = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.BIC"); String bicCode = getBicCode(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId");
String memberId = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.ClrSysMmbId.MmbId"); String memberId = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.ClrSysMmbId.MmbId");
String nm = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.Nm"); String name = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.Nm");
if (StringUtil.isNotEmpty(bicCode)) { if (StringUtil.isNotEmpty(bicCode)) {
field56aOption = "A"; field56aOption = "A";
if (StringUtil.isNotEmpty(memberId)) { if (StringUtil.isNotEmpty(memberId)) {
...@@ -36,26 +32,20 @@ public class Field56aGenerate extends AbstractMx2MtFieldsGenerate { ...@@ -36,26 +32,20 @@ public class Field56aGenerate extends AbstractMx2MtFieldsGenerate {
} else { } else {
field56a = bicCode; field56a = bicCode;
} }
}else if(StringUtil.isNotEmpty(nm)){ }else if(StringUtil.isNotEmpty(name)){
field56aOption = "D"; field56aOption = "D";
if (StringUtil.isNotEmpty(memberId)) { if (StringUtil.isNotEmpty(memberId)) {
field56a = "/" + memberId; field56a = "/" + memberId + Mx2MtConstants.NEW_LINE + name;;
} }
int adrLineCount = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine"); int adrLineCount = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine");
if(adrLineCount>0){ if(adrLineCount>0){
for (int i=0; i<adrLineCount; i++) { for (int i=0; i<adrLineCount; i++) {
if (i == 4) { if (i == 3) {
break; break;
} }
String adrLine = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine("+i+")"); String adrLine = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Ntfctn.Ntry.NtryDtls.TxDtls.RltdAgts.IntrmyAgt1.FinInstnId.PstlAdr.AdrLine("+i+")");
if (adrLine.length() > 35) { if (adrLine.length() > 35) adrLine = adrLine.substring(0, 35);
adrLine = adrLine.substring(0, 35); field56a += Mx2MtConstants.NEW_LINE + adrLine;
}
if (i==0 && StringUtil.isEmpty(field56a)) {
field56a += adrLine;
} else {
field56a += Mx2MtConstants.NEW_LINE+adrLine;
}
} }
} }
} }
......
...@@ -152,7 +152,8 @@ ...@@ -152,7 +152,8 @@
<AcctSvcrRef>FRDA00000343</AcctSvcrRef> <AcctSvcrRef>FRDA00000343</AcctSvcrRef>
<EndToEndId>E2E1201</EndToEndId> <EndToEndId>E2E1201</EndToEndId>
<TxId>FRDA00003343</TxId> <TxId>FRDA00003343</TxId>
<MndtId>MANFRST1COR1201003</MndtId> <MndtId>MANFRST1COR1201003</MndtId>
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</Refs> </Refs>
<AmtDtls/> <AmtDtls/>
<RltdPties> <RltdPties>
......
...@@ -153,6 +153,7 @@ ...@@ -153,6 +153,7 @@
<EndToEndId>E2E1201</EndToEndId> <EndToEndId>E2E1201</EndToEndId>
<TxId>FRDA00003343</TxId> <TxId>FRDA00003343</TxId>
<MndtId>MANFRST1COR1201003</MndtId> <MndtId>MANFRST1COR1201003</MndtId>
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</Refs> </Refs>
<AmtDtls/> <AmtDtls/>
<RltdPties> <RltdPties>
......
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