Commit 3e32e0af by zhanghou

mt192292的异常警告的定义

parent 8f9dedf7
......@@ -183,7 +183,7 @@ public class SwiftTransfer {
}
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00200110_Pacs009.xml");
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05700106.xml");
String xmlStr = FileUtils.readFileToString(file);
validateMx(xmlStr);
}
......
package com.brilliance.swift.mx2mt.mt192292;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtCreator;
......@@ -72,6 +73,8 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
mtType = Mx2MtConstants.MT_TYPE_192;
} else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_292;
}else {
buildSTErrorInfo(ERROR.T20092,null,null);
}
}
return mtType;
......
package com.brilliance.swift.mx2mt.mt192292.impl;
import com.brilliance.swift.constants.ERROR;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
......@@ -25,6 +26,24 @@ public class Field11SGenerate extends AbstractMx2MtTagsGenerate {
String dateStr = getXmlNodeValue(bodyHdrParentElementName, document, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlCreDtTm");
if (StringUtil.isNotEmpty(mtType)) {
orgnlMsgNmId = getMtMsg(mtType);
if(StringUtil.isNotEmpty(mtType)){
if(mtType.startsWith("pacs.008")){
orgnlMsgNmId = "103";
}else if(mtType.startsWith("pacs.003")){
orgnlMsgNmId = "104";
}else if(mtType.startsWith("pacs.009")){
orgnlMsgNmId = "202";
}else if(mtType.startsWith("pacs.010")){
orgnlMsgNmId = "204";
}else if(mtType.matches("MT10[0-9]{1}")){
orgnlMsgNmId = mtType.substring(2);
}else if(mtType.matches("MT20[0-9]{1}")){
orgnlMsgNmId = mtType.substring(2);
}else {
orgnlMsgNmId = "202";
buildSTErrorInfo(ERROR.T20083,null,null);
}
}
}
if(StringUtil.isNotEmpty(dateStr)){
date = mXToMTDate(dateStr);
......
package com.brilliance.swift.mx2mt.mt192292.impl;
import com.brilliance.swift.constants.ERROR;
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.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
......@@ -23,11 +28,13 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
String messageId = getXmlNodeValue(bodyHdrParentElementName, document, "Undrlyg.TxInf.Case.Id");
if (StringUtil.isNotEmpty(messageId)) {
if (messageId.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:20:", messageId);
messageId = messageId.substring(0, 15) + "+";
}
String value = messageId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
buildSTErrorInfo(ERROR.T20080, "BLOCK4/:20:", messageId);
}
tags.add(new Tag(name, value));
}
......
package com.brilliance.swift.mx2mt.mt192292.impl;
import com.brilliance.swift.constants.ERROR;
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;
......@@ -24,12 +26,16 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
if (StringUtil.isNotEmpty(orgnlInstrId)) {
if (orgnlInstrId.length() > 16) {
orgnlInstrId = orgnlInstrId.substring(0, 15) + "+";
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:21:", orgnlInstrId);
}
String value = orgnlInstrId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
buildSTErrorInfo(ERROR.T20081, "BLOCK4/:21:", orgnlInstrId);
}
tags.add(new Tag(name, value));
}else {
buildSTErrorInfo(ERROR.T20072, "BLOCK4/:21:", orgnlInstrId);
}
}
}
......@@ -73,6 +73,8 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator {
mtType = Mx2MtConstants.MT_TYPE_196;
} else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_296;
}else {
//TODO,填入location:(mt196|mt296)/block3/:11R:,errorcode:T20083
}
}
return mtType;
......
......@@ -28,6 +28,7 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
String value = messageId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
//TODO,填入location:(mt196|mt296)/block3/:20:,errorcode:T20090
}
tags.add(new Tag(name, value));
}
......
......@@ -28,6 +28,7 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
String value = orgnlInstrId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
//TODO,填入location:(mt196|mt296)/block3/:21:,errorcode:T20091
}
tags.add(new Tag(name, value));
}
......
......@@ -28,6 +28,7 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
String value = messageId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
//TODO,填入location:mt210/block3/:20:,errorcode:T20051
}
tags.add(new Tag(name, value));
}
......
......@@ -34,6 +34,7 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
String value = filed21;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
//TODO,填入location:mt210/block3/:21:,errorcode:T20055
}
tags.add(new Tag(name, value));
}
......
......@@ -20,6 +20,7 @@ public class Field30Generate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String mxDate = "";
String mtDate = "";
String valDt = getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.XpctdValDt");
if(StringUtil.isNotEmpty(valDt)){
mxDate = valDt;
......@@ -27,8 +28,11 @@ public class Field30Generate extends AbstractMx2MtTagsGenerate {
mxDate = getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.Itm("+0+").XpctdValDt");
}
if(StringUtil.isNotEmpty(mxDate)){
String mtDate = mXToMTDate(mxDate);
tags.add(new Tag(name, mtDate));
mtDate = mXToMTDate(mxDate);
}else {
mtDate = mXToMTDate("991231");
//TODO,填入location:mt210/block3/:30:,errorcode:T00062
}
tags.add(new Tag(name, mtDate));
}
}
......@@ -95,6 +95,8 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
String mtNameAddress = mx_to_mtFinancialInstitutionNameAndUnstructuredAddress(partyPath);
tags.add(new Tag(name_F, account + Mx2MtConstants.NEW_LINE + mtNameAddress));
}
}else {
//TODO,填入location:mt210/block3/:50a:,errorcode:T20102
}
if(counts3>0||counts4>0) {
if (StringUtil.isNotEmpty(bicCode)) {
......@@ -107,7 +109,10 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
tags.add(new Tag(name_, nameAddress));
} else if (StringUtil.isNotEmpty(clearSystemId)) {
tags.add(new Tag(name_, clearSystemId));
//TODO,填入location:mt210/block3/:50a:,errorcode:T20097
}
}else {
//TODO,填入location:mt210/block3/:50a:,errorcode:T20102
}
}
}
......@@ -28,6 +28,7 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
String value = messageId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
//TODO,填入location:mt942/block3/:20:,errorcode:T20115
}
tags.add(new Tag(name, value));
}
......
......@@ -77,6 +77,10 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
if (StringUtil.isNotEmpty(amt) && StringUtil.isNotEmpty(ccy)) {
value += NumberUtil.formatAmt(new BigDecimal(amt), ccy);
}
if(amt.length()>15){
//TODO,填入location:mt942/block3/:61:,errorcode:T20113
return;
}
value += "NTRF";
String endToEndId = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Ntry(" + i + ").NtryDtls.TxDtls.Refs.EndToEndId");
if (StringUtil.isNotEmpty(endToEndId)) {
......
......@@ -26,11 +26,15 @@ public class Field90CGenerate extends AbstractMx2MtTagsGenerate {
if(StringUtil.isNotEmpty(sum)&&StringUtil.isNotEmpty(nbOfNtries)) {
String currency = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Acct.Ccy");
String amt = NumberUtil.formatAmt(new BigDecimal(sum), currency);
if(amt.length()>15||nbOfNtries.length()>5){
if(amt.length()>15){
//TODO,填入location:mt942/block3/:90C:,errorcode:T20120
}else if(nbOfNtries.length()>5){
//TODO,填入location:mt942/block3/:90C:,errorcode:T20119
} else {
tags.add(new Tag(name,nbOfNtries+currency+amt));
}
}else {
//TODO,填入location:mt942/block3/:90C:,errorcode:T20122
}
}
}
......@@ -26,11 +26,15 @@ public class Field90DGenerate extends AbstractMx2MtTagsGenerate {
if(StringUtil.isNotEmpty(sum)&&StringUtil.isNotEmpty(nbOfNtries)) {
String currency = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Acct.Ccy");
String amt = NumberUtil.formatAmt(new BigDecimal(sum), currency);
if(amt.length()>15||nbOfNtries.length()>5){
if(amt.length()>15){
//TODO,填入location:mt942/block3/:90D:,errorcode:T20120
} else if(nbOfNtries.length()>5){
//TODO,填入location:mt942/block3/:90D:,errorcode:T20119
} else {
tags.add(new Tag(name,nbOfNtries+currency+amt));
}
}else {
//TODO,填入location:mt942/block3/:90D:,errorcode:T20121
}
}
}
......@@ -42,16 +42,6 @@ Change Log
<CreDtTm>2020-12-15T11:00:00-07:00</CreDtTm>
</GrpHdr>
<Rpt>
<TxsSummry>
<TtlCdtNtries>
<Sum Ccy="EUR">385700</Sum>
<NbOfNtries>87</NbOfNtries>
</TtlCdtNtries>
<TtlDbtNtries>
<Sum Ccy="EUR">210000</Sum>
<NbOfNtries>9</NbOfNtries>
</TtlDbtNtries>
</TxsSummry>
<Id>100-01</Id>
<RptPgntn>
<PgNb>1</PgNb>
......@@ -114,6 +104,16 @@ Change Log
<Dt>2020-12-15</Dt>
</Dt>
</Bal>
<TxsSummry>
<TtlCdtNtries>
<NbOfNtries>87</NbOfNtries>
<Sum>385700</Sum>
</TtlCdtNtries>
<TtlDbtNtries>
<NbOfNtries>9</NbOfNtries>
<Sum>210000</Sum>
</TtlDbtNtries>
</TxsSummry>
<Ntry>
<Amt Ccy="EUR">1000000</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
......
......@@ -42,16 +42,6 @@ Change Log
<CreDtTm>2020-12-15T11:00:00-07:00</CreDtTm>
</GrpHdr>
<Rpt>
<TxsSummry>
<TtlCdtNtries>
<Sum Ccy="EUR">385700</Sum>
<NbOfNtries>87</NbOfNtries>
</TtlCdtNtries>
<TtlDbtNtries>
<Sum Ccy="EUR">210000</Sum>
<NbOfNtries>9</NbOfNtries>
</TtlDbtNtries>
</TxsSummry>
<Id>100-01</Id>
<RptPgntn>
<PgNb>1</PgNb>
......@@ -66,6 +56,16 @@ Change Log
</Id>
<Ccy>EUR</Ccy>
</Acct>
<TxsSummry>
<TtlCdtNtries>
<NbOfNtries>87</NbOfNtries>
<Sum>385700</Sum>
</TtlCdtNtries>
<TtlDbtNtries>
<NbOfNtries>9</NbOfNtries>
<Sum>210000</Sum>
</TtlDbtNtries>
</TxsSummry>
<Ntry>
<Amt Ccy="EUR">1000000</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
......
......@@ -98,8 +98,6 @@ Change Log
<OrgnlEndToEndId>pacs008EndToEndId-001</OrgnlEndToEndId>
<OrgnlUETR>8a562c67-ca16-48ba-b074-65581be6f001</OrgnlUETR>
<CxlStsRsnInf>
<AddtlInf>HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.</AddtlInf>
<AddtlInf>NICE TO MEET YOU</AddtlInf>
<Orgtr>
<Nm>A Debiter</Nm>
<PstlAdr>
......@@ -110,7 +108,9 @@ Change Log
</Orgtr>
<Rsn>
<Cd>AGNT</Cd>
</Rsn>
</Rsn>
<AddtlInf>HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,W</AddtlInf>
<AddtlInf>NICE TO MEET YOU</AddtlInf>
</CxlStsRsnInf>
</TxInfAndSts>
</CxlDtls>
......
......@@ -114,7 +114,7 @@ Change Log
<Ntry>
<Amt Ccy="EUR">100.23</Amt>
<CdtDbtInd>DBIT</CdtDbtInd>
<RvslInd>True</RvslInd>
<RvslInd>true</RvslInd>
<Sts>
<Cd>BOOK</Cd>
</Sts>
......
......@@ -106,15 +106,6 @@ Change Log
<Purp>
<Cd>COMC</Cd>
</Purp>
<RltdRmtInf>
<RmtId>ID-1236654</RmtId>
</RltdRmtInf>
<RmtInf>
<Ustrd>Inv: AEG-69874/958</Ustrd>
</RmtInf>
<RltdDts>
<IntrBkSttlmDt>2020-09-08</IntrBkSttlmDt>
</RltdDts>
</TxDtls>
</NtryDtls>
</Ntry>
......
......@@ -92,9 +92,6 @@ Change Log
</Agt>
</Cdtr>
</RltdPties>
<RltdDts>
<IntrBkSttlmDt>2021-02-23</IntrBkSttlmDt>
</RltdDts>
</TxDtls>
</NtryDtls>
</Ntry>
......
......@@ -56,7 +56,7 @@ Change Log
<Undrlyg>
<TxInf>
<Case>
<Id>CSE-001</Id>
<Id>CSE-001</Id>
<Cretr>
<Agt>
<FinInstnId>
......@@ -67,10 +67,10 @@ Change Log
</Case>
<OrgnlGrpInf>
<OrgnlMsgId>pacs8bizmsgidr01</OrgnlMsgId>
<OrgnlMsgNmId>pacs.008.001.08</OrgnlMsgNmId>
<OrgnlMsgNmId>pacs.008.001.08</OrgnlMsgNmId>
<OrgnlCreDtTm>2021-02-17T08:30:00+01:00</OrgnlCreDtTm>
</OrgnlGrpInf>
<OrgnlInstrId>pacs8bizmsgidr01</OrgnlInstrId>
<OrgnlInstrId>pacs8bizmsgidr01</OrgnlInstrId>
<OrgnlEndToEndId>pacs008EndToEndId-001</OrgnlEndToEndId>
<OrgnlUETR>8a562c67-ca16-48ba-b074-65581be6f001</OrgnlUETR>
<OrgnlIntrBkSttlmAmt Ccy="EUR">1500000</OrgnlIntrBkSttlmAmt>
......
......@@ -76,8 +76,6 @@ Change Log
<OrgnlIntrBkSttlmAmt Ccy="EUR">1500000</OrgnlIntrBkSttlmAmt>
<OrgnlIntrBkSttlmDt>2021-02-17</OrgnlIntrBkSttlmDt>
<CxlRsnInf>
<AddtlInf>HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.</AddtlInf>
<AddtlInf>NICE TO MEET YOU</AddtlInf>
<Orgtr>
<Nm>A Debiter</Nm>
<PstlAdr>
......@@ -89,6 +87,8 @@ Change Log
<Rsn>
<Cd>AM09</Cd>
</Rsn>
<AddtlInf>HELLO,WORLD.HELLO,WORLD.HELLO,WORLD.HELLO,</AddtlInf>
<AddtlInf>NICE TO MEET YOU</AddtlInf>
</CxlRsnInf>
</TxInf>
</Undrlyg>
......
......@@ -13,10 +13,5 @@ public class Test196 {
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
......@@ -13,10 +13,5 @@ public class Test296 {
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
package com.brilliance.mt2mx.camt05600108;
package com.brilliance.mt2mx.camt056001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import org.apache.commons.io.FileUtils;
......@@ -13,10 +13,5 @@ public class Test192 {
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
package com.brilliance.mt2mx.camt05600108;
package com.brilliance.mt2mx.camt056001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import org.apache.commons.io.FileUtils;
......@@ -13,10 +13,5 @@ public class Test292 {
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
/*AbstractMT abstractMT = AbstractMT.parse(mtStr);
MT103 mt103 = (MT103)abstractMT;
Field53A field53A = mt103.getField53A();
System.out.println(field53A.getComponent(1) + field53A.getComponent2());
System.out.println(field53A.getBIC());*/
}
}
package com.brilliance.mx2mt.mt192;
import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.vo.SwiftTranslationErrorInfo;
import com.brilliance.swift.vo.SwiftTranslationReport;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.List;
public class TestMx2MtFor192 {
public static void main(String[] args) throws Exception {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\Mxcamt05600108_192.xml");
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05600108_192.xml");
String xmlStr = FileUtils.readFileToString(file);
String mt192 = SwiftTransfer.mx2Mt(xmlStr, null, null);
System.out.println(mt192);
SwiftTranslationReport str = SwiftTransfer.mx2MtPlus(xmlStr, null, null);
if (str != null) {
List<SwiftTranslationErrorInfo> errorInfos = str.getErrorInfos();
if (errorInfos != null && errorInfos.size() > 0) {
for (int i=0; i<errorInfos.size(); i++) {
SwiftTranslationErrorInfo errorInfo = errorInfos.get(i);
String location = errorInfo.getLocation();
String errorType = errorInfo.getErrorType();
String description = errorInfo.getDescription();
System.out.println(location + Mx2MtConstants.NEW_LINE + "-" + errorType + ":" + description);
}
}
System.out.println(str.getMessage());
}
}
}
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