Commit 6ac276fa by chengzhuoshen

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

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