Commit 6ac276fa by chengzhuoshen

提交公共函数截取地方的警告代码

parent 2d8c7b15
...@@ -153,7 +153,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -153,7 +153,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} }
list.add(tmpCode); list.add(tmpCode);
String remainTxt = instructionInformation.replace("/"+chqbCode+"/"+tmpCodeText, ""); String remainTxt = instructionInformation.replace("/"+chqbCode+"/"+tmpCodeText, "");
if (remainTxt.length() > 30) remainTxt = remainTxt.substring(0, 29) + "+"; if (remainTxt.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, remainTxt);
remainTxt = remainTxt.substring(0, 29) + "+";
}
if (chqbCode.equals(code)) { if (chqbCode.equals(code)) {
list.add(code); list.add(code);
} else { } else {
...@@ -176,9 +179,16 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -176,9 +179,16 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
tmpCodeText = instructionInformation.substring(firstIndexOf + 6, lastIndexOf); tmpCodeText = instructionInformation.substring(firstIndexOf + 6, lastIndexOf);
} }
String remainTxt = instructionInformation.replace("/"+holdCode+"/"+tmpCodeText, ""); String remainTxt = instructionInformation.replace("/"+holdCode+"/"+tmpCodeText, "");
if (tmpCodeText.length() > 30) tmpCodeText = tmpCodeText.substring(0, 29) + "+"; if (tmpCodeText.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, tmpCodeText);
tmpCodeText = tmpCodeText.substring(0, 29) + "+";
}
list.add(tmpCode+"/"+tmpCodeText); list.add(tmpCode+"/"+tmpCodeText);
if (remainTxt.length() > 30) remainTxt = remainTxt.substring(0, 29) + "+"; if (remainTxt.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, remainTxt);
remainTxt = remainTxt.substring(0, 29) + "+";
}
if (chqbCode.equals(code)) { if (chqbCode.equals(code)) {
list.add(code); list.add(code);
} else { } else {
...@@ -202,7 +212,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -202,7 +212,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} }
list.add(tmpCode); list.add(tmpCode);
String remainTxt = instructionInformation.replace("/"+phobCode+"/"+tmpCodeText, ""); String remainTxt = instructionInformation.replace("/"+phobCode+"/"+tmpCodeText, "");
if (remainTxt.length() > 30) remainTxt = remainTxt.substring(0, 29) + "+"; if (remainTxt.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, remainTxt);
remainTxt = remainTxt.substring(0, 29) + "+";
}
if (chqbCode.equals(code)) { if (chqbCode.equals(code)) {
list.add(code); list.add(code);
} else { } else {
...@@ -226,7 +239,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -226,7 +239,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} }
list.add(tmpCode); list.add(tmpCode);
String remainTxt = instructionInformation.replace("/"+telbCode+"/"+tmpCodeText, ""); String remainTxt = instructionInformation.replace("/"+telbCode+"/"+tmpCodeText, "");
if (remainTxt.length() > 30) remainTxt = remainTxt.substring(0, 29) + "+"; if (remainTxt.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, remainTxt);
remainTxt = remainTxt.substring(0, 29) + "+";
}
if (chqbCode.equals(code)) { if (chqbCode.equals(code)) {
list.add(code); list.add(code);
} else { } else {
...@@ -276,7 +292,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -276,7 +292,10 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} else { } else {
codeText = instructionInformation.substring(firstIndex, lastIndexOf); codeText = instructionInformation.substring(firstIndex, lastIndexOf);
} }
if (codeText.length() > 30) codeText = codeText.substring(0, 29) + "+"; if (codeText.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, codeText);
codeText = codeText.substring(0, 29) + "+";
}
list.add(holdCode + "/" + codeText); list.add(holdCode + "/" + codeText);
} }
int phobCodeIndex = instructionInformation.indexOf("/"+phobCode+"/"); int phobCodeIndex = instructionInformation.indexOf("/"+phobCode+"/");
...@@ -289,14 +308,20 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -289,14 +308,20 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} else { } else {
codeText = instructionInformation.substring(firstIndex, lastIndexOf); codeText = instructionInformation.substring(firstIndex, lastIndexOf);
} }
if (codeText.length() > 30) codeText = codeText.substring(0, 29) + "+"; if (codeText.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, codeText);
codeText = codeText.substring(0, 29) + "+";
}
list.add(phobCode + "/" + codeText); list.add(phobCode + "/" + codeText);
} }
int telbCodeIndex = instructionInformation.indexOf("/"+telbCode+"/"); int telbCodeIndex = instructionInformation.indexOf("/"+telbCode+"/");
if (telbCodeIndex > -1) { if (telbCodeIndex > -1) {
int firstIndex = phobCodeIndex + 6; int firstIndex = phobCodeIndex + 6;
String codeText = instructionInformation.substring(firstIndex); String codeText = instructionInformation.substring(firstIndex);
if (codeText.length() > 30) codeText = codeText.substring(0, 29) + "+"; if (codeText.length() > 30) {
buildSTErrorInfo(ERROR.T0000T, null, codeText);
codeText = codeText.substring(0, 29) + "+";
}
list.add(telbCode + "/" + codeText); list.add(telbCode + "/" + codeText);
} }
return list; return list;
...@@ -883,20 +908,27 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -883,20 +908,27 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
mtLei = leiPrefix + countryCode + "/LEIC" + mxLei; mtLei = leiPrefix + countryCode + "/LEIC" + mxLei;
} }
if (addressLineCount >= 3) { if (addressLineCount >= 3) {
if (mxName.length() > 33) mxName = "1/" + mxName.substring(0, 32) + "+"; if (mxName.length() > 33) {
buildSTErrorInfo(ERROR.T0000T, null, mxName);
mxName = "1/" + mxName.substring(0, 32) + "+";
}
mtNameAddress = mxName + Mx2MtConstants.NEW_LINE mtNameAddress = mxName + Mx2MtConstants.NEW_LINE
+ XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+0+")") + Mx2MtConstants.NEW_LINE + XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+0+")") + Mx2MtConstants.NEW_LINE
+ XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+1+")") + Mx2MtConstants.NEW_LINE + XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+1+")") + Mx2MtConstants.NEW_LINE
+ XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+2+")"); + XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+2+")");
} else if (addressLineCount == 2){ } else if (addressLineCount == 2){
if (StringUtil.isNotEmpty(mtLei)) { if (StringUtil.isNotEmpty(mtLei)) {
if (mxName.length() > 33) mxName = "1/" + mxName.substring(0, 32) + "+"; if (mxName.length() > 33) {
buildSTErrorInfo(ERROR.T0000T, null, mxName);
mxName = "1/" + mxName.substring(0, 32) + "+";
}
mtNameAddress = mxName + Mx2MtConstants.NEW_LINE mtNameAddress = mxName + Mx2MtConstants.NEW_LINE
+ XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+0+")") + Mx2MtConstants.NEW_LINE + XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+0+")") + Mx2MtConstants.NEW_LINE
+ XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+1+")") + Mx2MtConstants.NEW_LINE + XmlUtil.getXmlNodeValue(document, partyPath + ".PstlAdr.AdrLine("+1+")") + Mx2MtConstants.NEW_LINE
+ mtLei; + mtLei;
} else { } else {
if (mxName.length() > 66) { if (mxName.length() > 66) {
buildSTErrorInfo(ERROR.T0000T, null, mxName);
mxName = "1/" + mxName.substring(0, 33) + Mx2MtConstants.NEW_LINE mxName = "1/" + mxName.substring(0, 33) + Mx2MtConstants.NEW_LINE
+ "1/" + mxName.substring(33, 65) + "+"; + "1/" + mxName.substring(33, 65) + "+";
} else if (mxName.length() > 33) { } else if (mxName.length() > 33) {
...@@ -911,6 +943,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -911,6 +943,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} }
} else { //addressLineCount == 1 } else { //addressLineCount == 1
if (mxName.length() > 66) { if (mxName.length() > 66) {
buildSTErrorInfo(ERROR.T0000T, null, mxName);
mxName = "1/" + mxName.substring(0, 33) + Mx2MtConstants.NEW_LINE mxName = "1/" + mxName.substring(0, 33) + Mx2MtConstants.NEW_LINE
+ "1/" + mxName.substring(33, 65) + "+"; + "1/" + mxName.substring(33, 65) + "+";
} else if (mxName.length() > 33) { } else if (mxName.length() > 33) {
...@@ -1062,6 +1095,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -1062,6 +1095,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
int maxNameLength = 35 - mxCodeLength + 33; int maxNameLength = 35 - mxCodeLength + 33;
if (StringUtil.isNotEmpty(mxCountryCode)) { if (StringUtil.isNotEmpty(mxCountryCode)) {
if (mxName.length() > maxCCNameLength) { if (mxName.length() > maxCCNameLength) {
buildSTErrorInfo(ERROR.T0000T, null, mxName);
mtAgent = mxName.substring(0, maxCCNameLength-1) + "+"; mtAgent = mxName.substring(0, maxCCNameLength-1) + "+";
} else { } else {
if (StringUtil.isNotEmpty(mxTownName)) { if (StringUtil.isNotEmpty(mxTownName)) {
...@@ -1072,6 +1106,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -1072,6 +1106,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} }
} else { } else {
if (mxName.length() > maxNameLength) { if (mxName.length() > maxNameLength) {
buildSTErrorInfo(ERROR.T0000T, null, mxName);
mtAgent = mxName.substring(0, maxNameLength-1) + "+"; mtAgent = mxName.substring(0, maxNameLength-1) + "+";
} else { } else {
mtAgent = mxName; mtAgent = mxName;
...@@ -1111,6 +1146,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -1111,6 +1146,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
} }
if (StringUtil.isNotEmpty(mtAgent)) { if (StringUtil.isNotEmpty(mtAgent)) {
if (mtAgent.length() > maxLength) { if (mtAgent.length() > maxLength) {
buildSTErrorInfo(ERROR.T0000T, null, mtAgent);
mtAgent = mtAgent.substring(0, maxLength-1) + "+"; mtAgent = mtAgent.substring(0, maxLength-1) + "+";
} }
} }
...@@ -2017,6 +2053,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate { ...@@ -2017,6 +2053,7 @@ public abstract class AbstractMx2MtTagsGenerate implements Mx2MtTagsGenerate {
return Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE; return Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
} }
if (mxId.length() > 16) { if (mxId.length() > 16) {
buildSTErrorInfo(ERROR.T0000T, null, mxId);
mxId = mxId.substring(0, 15) + "+"; mxId = mxId.substring(0, 15) + "+";
} }
String mtId = mxId; String mtId = mxId;
......
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