Commit 59f3e49a by zhanghou

修改了枚举和字符串的比较,和修改了940和950报文的部分代码

parent c66ce0aa
......@@ -32,11 +32,11 @@ public class Field71AGenerate extends AbstractMx2MtFieldsGenerate {
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
String chrgBr = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.ChrgBr");
if (StringUtil.isNotEmpty(chrgBr)) {
if (ChargeBearerType1Code.valueOf(chrgBr).equals(ChargeBearerType1Code.CRED)) {
if (ChargeBearerType1Code.CRED.value().equals(chrgBr)) {
field71Option = "BEN";
} else if (ChargeBearerType1Code.valueOf(chrgBr).equals(ChargeBearerType1Code.DEBT)) {
} else if (ChargeBearerType1Code.DEBT.value().equals(chrgBr)) {
field71Option = "OUR";
} else if (ChargeBearerType1Code.valueOf(chrgBr).equals(ChargeBearerType1Code.SHAR)) {
} else if (ChargeBearerType1Code.SHAR.value().equals(chrgBr)) {
field71Option = "SHA";
}
String amt = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "CdtTrfTxInf.ChrgsInf");
......
......@@ -61,10 +61,10 @@ public class Field72Generate extends AbstractMx2MtFieldsGenerate {
if (instrForCdtrAgtCard == null && StringUtil.isNotEmpty(instrForCdtrAgtInstrInf)) {
String cdtrAgtCode = Mx2MtConstants.ACC + instrForCdtrAgtInstrInf;
field72TmpList.addAll(StringUtil.outStringList(cdtrAgtCode, 35, "//"));
} else if (Instruction5Code.PHOB.equals(Instruction5Code.valueOf(instrForCdtrAgtCard)) && StringUtil.isNotEmpty(instrForCdtrAgtInstrInf)) {
} else if (Instruction5Code.PHOB.value().equals(instrForCdtrAgtCard) && StringUtil.isNotEmpty(instrForCdtrAgtInstrInf)) {
String cdtrAgtCode = Mx2MtConstants.PHONBEN + instrForCdtrAgtInstrInf;
field72TmpList.addAll(StringUtil.outStringList(cdtrAgtCode, 35, "//"));
} else if (Instruction5Code.TELB.equals(Instruction5Code.valueOf(instrForCdtrAgtCard)) && StringUtil.isNotEmpty(instrForCdtrAgtInstrInf)) {
} else if (Instruction5Code.TELB.value().equals(instrForCdtrAgtCard) && StringUtil.isNotEmpty(instrForCdtrAgtInstrInf)) {
String cdtrAgtCode = Mx2MtConstants.PHONBEN + instrForCdtrAgtInstrInf;
field72TmpList.addAll(StringUtil.outStringList(cdtrAgtCode, 35, "//"));
}
......@@ -73,10 +73,10 @@ public class Field72Generate extends AbstractMx2MtFieldsGenerate {
if (StringUtil.isEmpty(instrForNxtAgtCard) && StringUtil.isNotEmpty(instrForNxtAgtInstrInf)) {
String nextAgentCode = Mx2MtConstants.REC + instrForNxtAgtInstrInf;
field72TmpList.addAll(StringUtil.outStringList(nextAgentCode, 35, "//"));
} else if (Instruction4Code.TELA.equals(Instruction4Code.valueOf(instrForNxtAgtCard)) && StringUtil.isNotEmpty(instrForNxtAgtInstrInf)) {
} else if (Instruction4Code.TELA.value().equals(instrForNxtAgtCard) && StringUtil.isNotEmpty(instrForNxtAgtInstrInf)) {
String nextAgentCode = Mx2MtConstants.TELE + instrForNxtAgtInstrInf;
field72TmpList.addAll(StringUtil.outStringList(nextAgentCode, 35, "//"));
} else if (Instruction4Code.PHOA.equals(Instruction4Code.valueOf(instrForNxtAgtCard)) && StringUtil.isNotEmpty(instrForNxtAgtInstrInf)) {
} else if (Instruction4Code.PHOA.value().equals(instrForNxtAgtCard) && StringUtil.isNotEmpty(instrForNxtAgtInstrInf)) {
String field56Option = (String)map.get("field56Option");
String nextAgentCode = "";
if (StringUtil.isEmpty(field56Option)) {
......
......@@ -30,12 +30,15 @@ public class Field60Generate extends AbstractMx2MtFieldsGenerate{
@Override
public void fieldsGenerate() throws SwiftException{
try {
map.put("field60", "");
String filed60Option = "";
String crdr = "";
String dt = "";
String ccy = "";
String amt = "";
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
int balCounts = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Stmt.Bal");
if(balCounts>0){
String cd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Stmt.Bal.Tp.CdOrPrtry.Cd");
if (BalanceType12Code.PRCD.value().equals(cd)) {
filed60Option = "F";
......@@ -65,6 +68,7 @@ public class Field60Generate extends AbstractMx2MtFieldsGenerate{
ccy = ccyStr;
}
map.put("field60", crdr+dt+ccy+amt);
}
} catch(Exception e) {
logger.error(e.getMessage());
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -32,12 +32,12 @@ public class Field62Generate extends AbstractMx2MtFieldsGenerate{
try {
Document document = (Document)map.get(Mx2MtConstants.MX_XML_DOCUMENT);
int balCounts = getXmlNodeCounts(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Stmt.Bal");
if(balCounts>=1){
if(balCounts>1){
String filed62Option = "";
String cd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Stmt.Bal(1).Tp.CdOrPrtry.Cd");
if (BalanceType12Code.CLBD.equals(BalanceType12Code.valueOf(cd))) {
if (BalanceType12Code.CLBD.value().equals(cd)) {
filed62Option = "F";
} else if (BalanceType12Code.ITBD.equals(BalanceType12Code.valueOf(cd))) {
} else if (BalanceType12Code.ITBD.value().equals(cd)) {
filed62Option = "M";
} else {
throw new SwiftException("ERROR", "cannot find filed62Option.");
......
......@@ -64,8 +64,6 @@ public class Field64Generate extends AbstractMx2MtFieldsGenerate{
map.put("field64", crdr+dateStr+ccy+amt);
}
}
}else{
map.put("field64", " ");
}
} catch(Exception e) {
logger.error(e.getMessage());
......
......@@ -37,7 +37,7 @@ public class Field65Generate extends AbstractMx2MtFieldsGenerate {
if(balCounts>0){
for (int i = 0; i < balCounts; i++) {
String cd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Stmt.Bal("+i+").Tp.CdOrPrtry.Cd");
if(BalanceType12Code.FWAV.equals(BalanceType12Code.valueOf(cd))){
if(BalanceType12Code.FWAV.value().equals(cd)){
String cdtDbtInd = getXmlNodeValue(Mx2MtConstants.MAINBODY_PARENT_ELEMENT_NAME, document, "Stmt.Bal("+i+").CdtDbtInd");
String crdr = "";
if (CreditDebitCode.CRDT.value().equals(cdtDbtInd)) {
......@@ -64,8 +64,6 @@ public class Field65Generate extends AbstractMx2MtFieldsGenerate {
map.put("field65", crdr+dateStr+ccy+amt);
}
}
}else{
map.put("field65", "");
}
} catch(Exception e) {
logger.error(e.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