Commit 844c8594 by zhanghou

修改了mt210,mt192292,mt196296,mt940的异常警告

parent 23175acb
......@@ -72,18 +72,18 @@ public class Mx2Mtn92Creator extends AbstractMx2MtCreator {
String orgMsgNameIdentification = getXmlNodeValue(bodyParentPath, document, "Undrlyg.TxInf.OrgnlGrpInf.OrgnlMsgNmId");
String mtType = Mx2MtConstants.MT_TYPE_292;
if (StringUtil.isNotEmpty(orgMsgNameIdentification)) {
if (orgMsgNameIdentification.startsWith("pacs.008")
|| orgMsgNameIdentification.startsWith("pacs.003")) {
if (orgMsgNameIdentification.contains("pacs.008")
|| orgMsgNameIdentification.contains("pacs.003")) {
mtType = Mx2MtConstants.MT_TYPE_192;
} else if (orgMsgNameIdentification.startsWith("pacs.009")
|| orgMsgNameIdentification.startsWith("pacs.010")) {
} else if (orgMsgNameIdentification.contains("pacs.009")
|| orgMsgNameIdentification.contains("pacs.010")) {
mtType = Mx2MtConstants.MT_TYPE_292;
} else if (orgMsgNameIdentification.matches("MT10[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_192;
} else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_292;
}else {
buildSTErrorInfo(ERROR.T20092,null,null);
buildSTErrorInfo(ERROR.T20092,"BLOCK2/:mtType:",orgMsgNameIdentification);
}
}
return mtType;
......
......@@ -40,7 +40,7 @@ public class Field11SGenerate extends AbstractMx2MtTagsGenerate {
orgnlMsgNmId = mtType.substring(2);
}else {
orgnlMsgNmId = "202";
buildSTErrorInfo(ERROR.T20083,null,null);
buildSTErrorInfo(ERROR.T20083,"BLOCK4/:11S:",null);
}
}
}
......
......@@ -27,14 +27,16 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
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));
return;
}
if (value.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:20:", value);
value = value.substring(0, 15) + "+";
}
tags.add(new Tag(name, value));
}
......
......@@ -24,14 +24,16 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
String orgnlInstrId = getXmlNodeValue(bodyHdrParentElementName, document, "Undrlyg.TxInf.OrgnlInstrId");
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));
return;
}
if (value.length() > 16) {
value = value.substring(0, 15) + "+";
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:21:", value);
}
tags.add(new Tag(name, value));
}else {
......
......@@ -72,18 +72,18 @@ public class Mx2Mtn96Creator extends AbstractMx2MtCreator {
String orgMsgNameIdentification = getXmlNodeValue(bodyParentPath, document, "CxlDtls.TxInfAndSts.OrgnlGrpInf.OrgnlMsgNmId");
String mtType = Mx2MtConstants.MT_TYPE_296;
if (StringUtil.isNotEmpty(orgMsgNameIdentification)) {
if (orgMsgNameIdentification.startsWith("pacs.008")
|| orgMsgNameIdentification.startsWith("pacs.003")) {
if (orgMsgNameIdentification.contains("pacs.008")
|| orgMsgNameIdentification.contains("pacs.003")) {
mtType = Mx2MtConstants.MT_TYPE_196;
} else if (orgMsgNameIdentification.startsWith("pacs.009")
|| orgMsgNameIdentification.startsWith("pacs.010")) {
} else if (orgMsgNameIdentification.contains("pacs.009")
|| orgMsgNameIdentification.contains("pacs.010")) {
mtType = Mx2MtConstants.MT_TYPE_296;
} else if (orgMsgNameIdentification.matches("MT10[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_196;
} else if (orgMsgNameIdentification.matches("MT20[0-9]{1}")) {
mtType = Mx2MtConstants.MT_TYPE_296;
}else {
buildSTErrorInfo(ERROR.T20092,null,null);
buildSTErrorInfo(ERROR.T20092,"BLOCK2/:mtType:",orgMsgNameIdentification);
}
}
return mtType;
......
......@@ -60,7 +60,7 @@ public class Field11RGenerate extends AbstractMx2MtTagsGenerate {
}else {
tags.add(new Tag(name, orgnlMsgNmId+Mx2MtConstants.NEW_LINE+date));
if(boolean1){
buildSTErrorInfo(ERROR.T20083,null,null);
buildSTErrorInfo(ERROR.T20083,"BLOCK4/:11R:",null);
}
}
......
......@@ -23,14 +23,16 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(bodyHdrParentElementName, document, "CxlDtls.TxInfAndSts.CxlStsId");
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.T20090, "BLOCK4/:20:", messageId);
buildSTErrorInfo(ERROR.T20090, "BLOCK4/:20:", value);
tags.add(new Tag(name, value));
return;
}
if (value.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:20:", value);
value = value.substring(0, 15) + "+";
}
tags.add(new Tag(name, value));
}
......
......@@ -23,14 +23,17 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
String orgnlInstrId = getXmlNodeValue(bodyHdrParentElementName, document, "CxlDtls.TxInfAndSts.RslvdCase.Id");
if (StringUtil.isNotEmpty(orgnlInstrId)) {
if (orgnlInstrId.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:21:", orgnlInstrId);
orgnlInstrId = orgnlInstrId.substring(0, 15) + "+";
}
String value = orgnlInstrId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
buildSTErrorInfo(ERROR.T20091, "BLOCK4/:21:", orgnlInstrId);
buildSTErrorInfo(ERROR.T20091, "BLOCK4/:21:", value);
tags.add(new Tag(name, value));
return;
}
if (value.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:21:", value);
value = value.substring(0, 15) + "+";
}
tags.add(new Tag(name, value));
}
......
......@@ -23,15 +23,15 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(grpHdrParentElementName, document, "GrpHdr.MsgId");
if (StringUtil.isNotEmpty(messageId)) {
if (messageId.length() > 16) {
messageId = messageId.substring(0, 15) + "+";
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:20:", messageId);
}
String value = messageId;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
buildSTErrorInfo(ERROR.T20051, "BLOCK4/:20:", messageId);
}
if (value.length() > 16) {
value = value.substring(0, 15) + "+";
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:20:", value);
}
tags.add(new Tag(name, value));
}
}
......
......@@ -29,14 +29,16 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
filed21 = getXmlNodeValue(bodyHdrParentElementName, document, "Ntfctn.Itm("+0+").Id");
}
if (StringUtil.isNotEmpty(filed21)) {
if (filed21.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:21:", endToEndId);
filed21 = filed21.substring(0, 15) + "+";
}
String value = filed21;
if (value.startsWith("/") || value.endsWith("/") || value.contains("//")) {
value = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
buildSTErrorInfo(ERROR.T20055, "BLOCK4/:21:", endToEndId);
buildSTErrorInfo(ERROR.T20055, "BLOCK4/:21:", value);
tags.add(new Tag(name, value));
return;
}
if (value.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:21:", value);
value = value.substring(0, 15) + "+";
}
tags.add(new Tag(name, value));
}
......
......@@ -31,7 +31,7 @@ public class Field30Generate extends AbstractMx2MtTagsGenerate {
if(StringUtil.isNotEmpty(mxDate)){
mtDate = mXToMTDate(mxDate);
}else {
mtDate = mXToMTDate("991231");
mtDate = "991231";
buildSTErrorInfo(ERROR.T20062, "BLOCK4/:30:","");
}
tags.add(new Tag(name, mtDate));
......
......@@ -97,10 +97,7 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
String mtNameAddress = mx_to_mtFinancialInstitutionNameAndUnstructuredAddress(partyPath);
tags.add(new Tag(name_F, account + Mx2MtConstants.NEW_LINE + mtNameAddress));
}
}else {
buildSTErrorInfo(ERROR.T20102, "BLOCK4/:50a:","");
}
if(counts3>0||counts4>0) {
} else if(counts3>0||counts4>0) {
if (StringUtil.isNotEmpty(bicCode)) {
tags.add(new Tag(name_C, bicCode));
} else if (StringUtil.isNotEmpty(country)) {
......@@ -110,11 +107,9 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
String nameAddress = mx_to_mtFinancialInstitutionNameAndUnstructuredAddress(partyPath);
tags.add(new Tag(name_, nameAddress));
} else if (StringUtil.isNotEmpty(clearSystemId)) {
buildSTErrorInfo(ERROR.T20097, "BLOCK4/:50K:","");
tags.add(new Tag(name_, clearSystemId));
buildSTErrorInfo(ERROR.T20097, "BLOCK4/:50a:","");
}
}else {
buildSTErrorInfo(ERROR.T20102, "BLOCK4/:50a:","");
}
}
}
package com.brilliance.swift.mx2mt.mt210.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;
......@@ -24,6 +25,7 @@ public class Field52aGenerate extends AbstractMx2MtTagsGenerate {
context.set(Mx2MtContextIdentifier.MX_TO_MT_ERROR_LOCATION, "Block4/52a");
String s = (String)context.get(Mx2MtContextIdentifier.MT_TYPE_210_50_FLAG);
if(Mx2MtConstants.YES.equals(s)){
buildSTErrorInfo(ERROR.T20102, "BLOCK4/:52a:","");
return;
}
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
......
......@@ -23,14 +23,16 @@ public class Field20Generate extends AbstractMx2MtTagsGenerate {
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.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.T20115, "BLOCK4/:20:", messageId);
buildSTErrorInfo(ERROR.T20115, "BLOCK4/:20:", value);
tags.add(new Tag(name, value));
return;
}
if (value.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, "BLOCK4/:20:", value);
value = value.substring(0, 15) + "+";
}
tags.add(new Tag(name, value));
}
......
......@@ -24,7 +24,7 @@ public class Field28CGenerate extends AbstractMx2MtTagsGenerate {
if(StringUtil.isEmpty(num)||num.length()>5){
num = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.ElctrncSeqNb");
if(StringUtil.isEmpty(num)||num.length()>5){
buildSTErrorInfo(ERROR.T20103, "BLOCK4/:28:", bodyHdrParentElementName+"Rpt.ElctrncSeqNb");
buildSTErrorInfo(ERROR.T20103, "BLOCK4/:28C:", bodyHdrParentElementName+"Rpt.ElctrncSeqNb");
return;
}
}
......
......@@ -19,7 +19,6 @@ public class Field34FGenerate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String currency = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Acct.Ccy");
tags.add(new Tag(name,currency+"D"+"0,"));
tags.add(new Tag(name,currency+"C"+"0,"));
tags.add(new Tag(name,currency+"0,"));
}
}
......@@ -37,7 +37,7 @@ public class Field61Generate extends AbstractMx2MtTagsGenerate {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
int entryCount = getXmlNodeCounts(bodyHdrParentElementName, document, "Rpt.Ntry");
if(entryCount>189){
if(entryCount>190){
buildSTErrorInfo(ERROR.T20110, "BLOCK4/:61:",entryCount+"");
return;
}
......
......@@ -27,15 +27,13 @@ public class Field90CGenerate extends AbstractMx2MtTagsGenerate {
if(StringUtil.isNotEmpty(sumc)&&StringUtil.isNotEmpty(nbOfNtries)) {
String currency = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Acct.Ccy");
String amt = NumberUtil.formatAmt(new BigDecimal(sumc), currency);
if(amt.length()>15){
buildSTErrorInfo(ERROR.T20120, "BLOCK4/:90C:", amt);
}else if(nbOfNtries.length()>5){
if(nbOfNtries.length()>5){
buildSTErrorInfo(ERROR.T20119, "BLOCK4/:90C:", nbOfNtries);
} else {
tags.add(new Tag(name,nbOfNtries+currency+amt));
}
}else {
buildSTErrorInfo(ERROR.T20122, "BLOCK4/:90D:","");
buildSTErrorInfo(ERROR.T20122, "BLOCK4/:90C:","");
}
}
}
......@@ -27,9 +27,7 @@ public class Field90DGenerate extends AbstractMx2MtTagsGenerate {
if(StringUtil.isNotEmpty(sumd)&&StringUtil.isNotEmpty(nbOfNtries)) {
String currency = getXmlNodeValue(bodyHdrParentElementName, document, "Rpt.Acct.Ccy");
String amt = NumberUtil.formatAmt(new BigDecimal(sumd), currency);
if(amt.length()>15){
buildSTErrorInfo(ERROR.T20120, "BLOCK4/:90D:", amt);
} else if(nbOfNtries.length()>5){
if(nbOfNtries.length()>5){
buildSTErrorInfo(ERROR.T20119, "BLOCK4/:90D:", nbOfNtries);
} else {
tags.add(new Tag(name,nbOfNtries+currency+amt));
......
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