Commit 6df6ef3d by zhanghou

提交修改的errorcode

parent e246d27b
...@@ -165,7 +165,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField { ...@@ -165,7 +165,8 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
MapUtil.puts(maps, "id/othr/id", mtAccount.substring(4)); MapUtil.puts(maps, "id/othr/id", mtAccount.substring(4));
MapUtil.puts(maps, "id/othr/schmeNm/cd", "CUID"); MapUtil.puts(maps, "id/othr/schmeNm/cd", "CUID");
} else if (mtAccount.length() > 34) { } else if (mtAccount.length() > 34) {
buildSTErrorInfo(116, path, null); buildSTErrorInfo(116, path, mtAccount);
buildSTErrorInfo(12,path,mtAccount);
MapUtil.puts(maps, "id/othr/id", mtAccount.substring(0, 33) + "+"); MapUtil.puts(maps, "id/othr/id", mtAccount.substring(0, 33) + "+");
} else { } else {
if (SwiftTransferUtil.checkIbanAccount(mtAccount)) { if (SwiftTransferUtil.checkIbanAccount(mtAccount)) {
...@@ -982,7 +983,9 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField { ...@@ -982,7 +983,9 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
String mtIssuer = ""; String mtIssuer = "";
String mtId = ""; String mtId = "";
boolean flagOrgId = false; boolean flagOrgId = false;
boolean flagPrivID = false;
String mxOrgSchemeCode = ""; String mxOrgSchemeCode = "";
String mXPrivSchemeCode= "";
if ("CUST".equals(mtFATFCode) || "EMPL".equals(mtFATFCode) || "DRLC".equals(mtFATFCode)) { if ("CUST".equals(mtFATFCode) || "EMPL".equals(mtFATFCode) || "DRLC".equals(mtFATFCode)) {
mtCountry = mtFATFId.substring(0, 2); mtCountry = mtFATFId.substring(0, 2);
String regex = "(.*)/(.*)"; String regex = "(.*)/(.*)";
...@@ -1005,6 +1008,17 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField { ...@@ -1005,6 +1008,17 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
flagOrgId = true; flagOrgId = true;
} }
} }
if (mtIssuer.length() > 4 && "CUST".equals(mtFATFCode)) {
PersonIdentificationCode code = SwiftTransferUtil.getPersonIdentificationCodeByCode(mtIssuer.substring(0, 4));
if (code != null
&& !PersonIdentificationCode.CUST.equals(code)
&& !PersonIdentificationCode.TXID.equals(code)
&& !PersonIdentificationCode.EMPL.equals(code)) {
mXPrivSchemeCode = code.value();
mtIssuer = mtIssuer.substring(5);
flagPrivID = true;
}
}
} else { } else {
mtId = mtFATFId.substring(3); mtId = mtFATFId.substring(3);
} }
...@@ -1043,7 +1057,7 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField { ...@@ -1043,7 +1057,7 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
|| PersonIdentificationCode.NIDN.value().equals(mtFATFCode) || PersonIdentificationCode.NIDN.value().equals(mtFATFCode)
|| PersonIdentificationCode.SOSE.value().equals(mtFATFCode) || PersonIdentificationCode.SOSE.value().equals(mtFATFCode)
|| PersonIdentificationCode.TXID.value().equals(mtFATFCode) || PersonIdentificationCode.TXID.value().equals(mtFATFCode)
|| (PersonIdentificationCode.CUST.value().equals(mtFATFCode) && !flagOrgId)) { || (PersonIdentificationCode.CUST.value().equals(mtFATFCode) && !flagOrgId&&!flagPrivID)) {
Map<String, Object> othrMaps = new HashMap<String, Object>(); Map<String, Object> othrMaps = new HashMap<String, Object>();
MapUtil.adds(prvtIdMaps, "othr", othrMaps); MapUtil.adds(prvtIdMaps, "othr", othrMaps);
MapUtil.puts(othrMaps, "schmeNm/cd", mtFATFCode); MapUtil.puts(othrMaps, "schmeNm/cd", mtFATFCode);
...@@ -1055,6 +1069,12 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField { ...@@ -1055,6 +1069,12 @@ public abstract class AbstractMt2MxParseField implements Mt2MxParseField {
MapUtil.puts(othrMaps, "schmeNm/cd", mxOrgSchemeCode); MapUtil.puts(othrMaps, "schmeNm/cd", mxOrgSchemeCode);
othrMaps.put("id", mtId); othrMaps.put("id", mtId);
othrMaps.put("issr", mxIssuer); othrMaps.put("issr", mxIssuer);
}else if (PersonIdentificationCode.CUST.value().equals(mtFATFCode) && flagPrivID) {
Map<String, Object> othrMaps = new HashMap<String, Object>();
MapUtil.adds(prvtIdMaps, "othr", othrMaps);
MapUtil.puts(othrMaps, "schmeNm/cd", mXPrivSchemeCode);
othrMaps.put("id", mtId);
othrMaps.put("issr", mxIssuer);
} }
if (orgIdMaps.size() > 0) { if (orgIdMaps.size() > 0) {
maps.put("orgId", orgIdMaps); maps.put("orgId", orgIdMaps);
......
...@@ -8,6 +8,9 @@ import com.prowidesoftware.swift.model.Tag; ...@@ -8,6 +8,9 @@ import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field11S; import com.prowidesoftware.swift.model.field.Field11S;
import com.prowidesoftware.swift.model.mt.AbstractMT; import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
//这个域的作用就是将原始消息的名称和原始消息的创建时间存入map集合 //这个域的作用就是将原始消息的名称和原始消息的创建时间存入map集合
public class Camt056001Parse11SField extends AbstractMt2MxCamt056001ParseField { public class Camt056001Parse11SField extends AbstractMt2MxCamt056001ParseField {
...@@ -19,6 +22,13 @@ public class Camt056001Parse11SField extends AbstractMt2MxCamt056001ParseField { ...@@ -19,6 +22,13 @@ public class Camt056001Parse11SField extends AbstractMt2MxCamt056001ParseField {
Tag tag11S = swiftMessage.getBlock4().getTagByName(NAME); Tag tag11S = swiftMessage.getBlock4().getTagByName(NAME);
if (tag11S != null) { if (tag11S != null) {
Field11S field11S = (Field11S) tag11S.asField(); Field11S field11S = (Field11S) tag11S.asField();
String mtType = field11S.getMT();
Pattern r = Pattern.compile("[1,2]0[0-9]");
Matcher m = r.matcher(mtType);
if(!m.matches()){
buildSTErrorInfo(122,"Block4:11S:",mtType);
return;
}
//TR003 //TR003
MapUtil.puts(txInfMaps, "orgnlGrpInf/orgnlMsgNmId", getMxType(field11S.getMT())); MapUtil.puts(txInfMaps, "orgnlGrpInf/orgnlMsgNmId", getMxType(field11S.getMT()));
//TR001 //TR001
......
...@@ -51,8 +51,12 @@ public class Field71AGenerate extends AbstractMx2MtTagsGenerate { ...@@ -51,8 +51,12 @@ public class Field71AGenerate extends AbstractMx2MtTagsGenerate {
String intrBkSttlmAmtCcy = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.IntrBkSttlmAmt@Ccy"); String intrBkSttlmAmtCcy = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.IntrBkSttlmAmt@Ccy");
BigDecimal sumAmt = BigDecimal.ZERO; BigDecimal sumAmt = BigDecimal.ZERO;
for (int i=0; i<chrgsInfCount; i++) { for (int i=0; i<chrgsInfCount; i++) {
if (intrBkSttlmAmtCcy.equals(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Amt@Ccy"))) {
BigDecimal tmpAmt = new BigDecimal(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Amt")); BigDecimal tmpAmt = new BigDecimal(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Amt"));
if(tmpAmt.equals(BigDecimal.ZERO)){
buildSTErrorInfo(121, "Block4/:"+name_G+":", null);
return;
}
if (intrBkSttlmAmtCcy.equals(getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.ChrgsInf("+i+").Amt@Ccy"))) {
sumAmt = sumAmt.add(tmpAmt); sumAmt = sumAmt.add(tmpAmt);
} else { } else {
buildSTErrorInfo(39, "Block4/:"+name_G+":", null); buildSTErrorInfo(39, "Block4/:"+name_G+":", null);
......
...@@ -54,6 +54,9 @@ public class Field11SGenerate extends AbstractMx2MtTagsGenerate { ...@@ -54,6 +54,9 @@ public class Field11SGenerate extends AbstractMx2MtTagsGenerate {
throw new SwiftException(e.getMessage()); throw new SwiftException(e.getMessage());
} }
} }
if("991231".equals(mtDate)){
buildSTErrorInfo(119,"Block4/:11S:",mtDate);
}
if (StringUtil.isNotEmpty(mtNumber)) { if (StringUtil.isNotEmpty(mtNumber)) {
tags.add(new Tag(name, mtNumber + Mx2MtConstants.NEW_LINE + mtDate)); tags.add(new Tag(name, mtNumber + Mx2MtConstants.NEW_LINE + mtDate));
} }
......
...@@ -28,7 +28,7 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate { ...@@ -28,7 +28,7 @@ public class Field21Generate extends AbstractMx2MtTagsGenerate {
} }
} }
if (StringUtil.isEmpty(orgnlInstrId) || (orgnlInstrId.startsWith("/") || orgnlInstrId.endsWith("/") || orgnlInstrId.contains("//"))) { if (StringUtil.isEmpty(orgnlInstrId) || (orgnlInstrId.startsWith("/") || orgnlInstrId.endsWith("/") || orgnlInstrId.contains("//"))) {
buildSTErrorInfo(73, "Block4/:21:", orgnlInstrId); buildSTErrorInfo(42, "Block4/:21:", orgnlInstrId);
orgnlInstrId = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE; orgnlInstrId = Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
} }
tags.add(new Tag(name, orgnlInstrId)); tags.add(new Tag(name, orgnlInstrId));
......
...@@ -111,7 +111,7 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate { ...@@ -111,7 +111,7 @@ public class Field50aGenerate extends AbstractMx2MtTagsGenerate {
} }
tags.add(new Tag(name_K, value)); tags.add(new Tag(name_K, value));
} else { } else {
buildSTErrorInfo(113, "Block4/50a", null); buildSTErrorInfo(34, "Block4/50a", null);
if (StringUtil.isNotEmpty(account)) { if (StringUtil.isNotEmpty(account)) {
value = account + Mx2MtConstants.NEW_LINE + Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE; value = account + Mx2MtConstants.NEW_LINE + Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
} else { } else {
......
...@@ -162,15 +162,6 @@ Change Log ...@@ -162,15 +162,6 @@ Change Log
</Pty> </Pty>
</UltmtDbtr> </UltmtDbtr>
<Dbtr> <Dbtr>
<Pty>
<Nm>testName2</Nm>
<PstlAdr>
<Ctry>US</Ctry>
<AdrLine>line1</AdrLine>
<AdrLine>line2</AdrLine>
<AdrLine>line3</AdrLine>
</PstlAdr>
</Pty>
<Agt> <Agt>
<FinInstnId> <FinInstnId>
<BICFI>BOFSGB2L</BICFI> <BICFI>BOFSGB2L</BICFI>
...@@ -245,24 +236,6 @@ Change Log ...@@ -245,24 +236,6 @@ Change Log
</BrnchId> </BrnchId>
</CdtrAgt> </CdtrAgt>
<Cdtr> <Cdtr>
<Pty>
<Nm>test Nm</Nm>
<PstlAdr>
<Ctry>US</Ctry>
<AdrLine>line567</AdrLine>
<AdrLine>line568</AdrLine>
<AdrLine>line569</AdrLine>
</PstlAdr>
<Id>
<OrgId>
<AnyBIC>CHASUS33</AnyBIC>
<Othr>
<Id>TID</Id>
</Othr>
</OrgId>
</Id>
<CtryOfRes>US</CtryOfRes>
</Pty>
<Agt> <Agt>
<FinInstnId> <FinInstnId>
<BICFI>CLYDGB2S</BICFI> <BICFI>CLYDGB2S</BICFI>
......
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