Commit 5b1a38f4 by chengzhuoshen

mt2mx,mt202,mt202cov转pacs00900108

parent 0da79133
......@@ -3,6 +3,7 @@ package com.brilliance.swift.mt2mx;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.camt029001.Mt2MxCamt029001Creator;
import com.brilliance.swift.mt2mx.pacs008001.Mt2MxPacs008001Creator;
import com.brilliance.swift.mt2mx.pacs009001.Mt2MxPacs009001Creator;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.List;
......@@ -43,7 +44,9 @@ public class Mt2MxCreatorManager {
String messageType = abstractMT.getMessageType();
if ("103".equals(messageType)) {
return new Mt2MxPacs008001Creator();
}else if("196".equals(messageType)||"296".equals(messageType)) {
} else if ("202".equals(messageType) || "205".equals(messageType)) {
return new Mt2MxPacs009001Creator();
} else if("196".equals(messageType) || "296".equals(messageType)) {
return new Mt2MxCamt029001Creator();
} else {
throw new SwiftException("ERROR", "Invalid message type");
......
......@@ -82,7 +82,7 @@ public class Pacs00801Parse50Field extends AbstractMt2MxPacs008001ParseField {
}
}
if (partyIdentifier.startsWith("/")) {
mt_to_mxPartyAccount(partyIdentifier.substring(1), dbtrAcctMaps);
mt_to_mxPartyAccount(partyIdentifier, dbtrAcctMaps);
} else {
Map<String, Object> idMaps = null;
if (dbtrMaps.containsKey("id")) {
......
......@@ -6,6 +6,9 @@ import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field72;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
import java.util.List;
public class Pacs00801Parse72Field extends AbstractMt2MxPacs008001ParseField {
private static final String NAME = "72";
......@@ -17,8 +20,15 @@ public class Pacs00801Parse72Field extends AbstractMt2MxPacs008001ParseField {
if (tag != null) {
Field72 field72 = (Field72)tag.asField();
mt72ins_to_mxAgent(field72.getValue(), cdtTrfTxInfMaps);
mt72_to_mxNextAgent(field72.getValue(), cdtTrfTxInfMaps);
mt_to_mxField72NewCodeWords(field72.getValue(), cdtTrfTxInfMaps);
List<String> excludeCodeList = new ArrayList<>();
excludeCodeList.add("/ACC/");
excludeCodeList.add("/INS/");
excludeCodeList.add("/INTA/");
excludeCodeList.add("/SVCLVL/");
excludeCodeList.add("/LOCINS/");
excludeCodeList.add("/CATPURP/");
mt72_to_mxNextAgent(field72.getValue(), excludeCodeList, cdtTrfTxInfMaps);
mt_to_mxField72NewCodeWords(field72.getValue(), false, cdtTrfTxInfMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.mt2mx.AbstractMt2MxParseField;
import com.prowidesoftware.swift.model.SwiftTagListBlock;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.Map;
public abstract class AbstractMt2MxPacs009001ParseField extends AbstractMt2MxParseField {
protected Map<String, Object> appHdrMaps = null;
protected Map<String, Object> grpHdrMaps = null;
protected Map<String, Object> cdtTrfTxInfMaps = null;
protected Map<String, Object> undrlygCstmrCdtTrfMaps = null;
@Override
public void initJsonMaps() {
super.initJsonMaps();
appHdrMaps = (Map<String, Object>)jsonMaps.get("appHdr");
Map<String, Object> fiCdtTrfMaps = (Map<String, Object>)jsonMaps.get("fiCdtTrf");
grpHdrMaps = (Map<String, Object>)fiCdtTrfMaps.get("grpHdr");
JSONArray cdtTrfTxInfJsonArray = (JSONArray) fiCdtTrfMaps.get("cdtTrfTxInf");
cdtTrfTxInfMaps = (Map<String, Object>)cdtTrfTxInfJsonArray.get(0);
undrlygCstmrCdtTrfMaps = (Map<String, Object>)cdtTrfTxInfMaps.get("undrlygCstmrCdtTrf");
}
/**
* 用于获取报文tag
* 解决mt报文中SequenceA,SequenceB都存在相同的tag
* @param tagName
* @param sequence
* @return
*/
protected Tag getTagByName(String tagName, String sequence) {
AbstractMT abstractMT = context.get(AbstractMT.class);
boolean isCov = abstractMT.getSwiftMessage().isCOV();
if (isCov) {
SwiftTagListBlock swiftTagListBlock = abstractMT.getSequence(sequence);
if (swiftTagListBlock != null) {
return swiftTagListBlock.getTagByName(tagName);
}
} else {
return abstractMT.getSwiftMessage().getBlock4().getTagByName(tagName);
}
return null;
}
}
package com.brilliance.swift.mt2mx.pacs009001;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.mt2mx.AbstractMt2MxCreator;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.Mt2MxParseField;
import com.brilliance.swift.mt2mx.pacs009001.impl.*;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Mt2MxPacs009001Creator extends AbstractMt2MxCreator {
@Override
public void preProcess() {
super.preProcess();
jsonMaps.put("identifier", "pacs.009.001.08");
Map<String, Object> appHdrMaps = (Map<String, Object>)jsonMaps.get("appHdr");
appHdrMaps.put("msgDefIdr", "pacs.009.001.08");
AbstractMT abstractMT = context.get(AbstractMT.class);
//初始化转换和不需要BLOCK4的转换
Map<String, Object> fiCdtTrfMaps = new HashMap<>();
jsonMaps.put("fiCdtTrf", fiCdtTrfMaps);
Map<String, Object> grpHdrMaps = new HashMap<>();
fiCdtTrfMaps.put("grpHdr", grpHdrMaps);
grpHdrMaps.put("creDtTm", "9999-12-31T00:00:00+00:00");
grpHdrMaps.put("nbOfTxs", "1");
Map<String, Object> cdtTrfTxInfMaps = new HashMap<>();
JSONArray cdtTrfTxInfJsonArray = new JSONArray();
cdtTrfTxInfJsonArray.add(cdtTrfTxInfMaps);
fiCdtTrfMaps.put("cdtTrfTxInf", cdtTrfTxInfJsonArray);
//设置 Payment Identification
Map<String, Object> pmtIdMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtId", pmtIdMaps);
String uetr = abstractMT.getSwiftMessage().getUETR();
if (StringUtil.isNotEmpty(uetr)) {
pmtIdMaps.put("uetr", uetr);
}
//设置InstructingAgent InstructedAgent 取值从sendbic receivebic
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
if (StringUtil.isNotEmpty(sendBic)) {
Map<String, Object> instgAgtMaps = new HashMap<>();
cdtTrfTxInfMaps.put("instgAgt", instgAgtMaps);
mt_to_mxBICFI(sendBic, instgAgtMaps);
}
String receiverBic = (String) context.get(Mt2MxContextIdentifier.MT_RECEIVE_BIC, true);
if (StringUtil.isNotEmpty(receiverBic)) {
Map<String, Object> instdAgtMaps = new HashMap<>();
cdtTrfTxInfMaps.put("instdAgt", instdAgtMaps);
mt_to_mxBICFI(receiverBic, instdAgtMaps);
}
//设置Service Level 取值从block3 {111:00[0-9]}
Tag tag111 = abstractMT.getSwiftMessage().getBlock3().getTagByName("111");
if (tag111 != null) {
String svcLvlCode = "";
String value = tag111.getValue();
if (value.matches("00[0-9]{1}")) {
svcLvlCode = value;
}
if (StringUtil.isNotEmpty(svcLvlCode)) {
Map<String, Object> pmtTpInfMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtTpInf", pmtTpInfMaps);
JSONArray svcLvlJsonArray = new JSONArray();
pmtTpInfMaps.put("svcLvl", svcLvlJsonArray);
Map<String, Object> svcLvlMaps = new HashMap<>();
svcLvlJsonArray.add(svcLvlMaps);
svcLvlMaps.put("cd", "G" + svcLvlCode);
}
}
//如果是cov,初始化Underlying Customer Credit Transfer map
if (abstractMT.getSwiftMessage().isCOV()) {
Map<String, Object> undrlygCstmrCdtTrfMaps = new HashMap<>();
cdtTrfTxInfMaps.put("undrlygCstmrCdtTrf", undrlygCstmrCdtTrfMaps);
}
}
@Override
public List<Mt2MxParseField> getParseFieldList() {
List<Mt2MxParseField> list = new ArrayList<>();
list.add(new Pacs009001Parse20Field());
list.add(new Pacs009001Parse21Field());
list.add(new Pacs009001Parse13CField());
list.add(new Pacs009001Parse32AField());
list.add(new Pacs009001Parse52Field());
list.add(new Pacs009001ParseSetlMtdField());
list.add(new Pacs009001ParseSetlAcctField());
list.add(new Pacs009001Parse53Field());
list.add(new Pacs009001Parse54Field());
list.add(new Pacs009001Parse56Field());
list.add(new Pacs009001Parse57Field());
list.add(new Pacs009001Parse58Field());
list.add(new Pacs009001Parse72Field());
list.add(new Pacs009001ParseSeqB50Field());
list.add(new Pacs009001ParseSeqB52Field());
list.add(new Pacs009001ParseSeqB56Field());
list.add(new Pacs009001ParseSeqB57Field());
list.add(new Pacs009001ParseSeqB59Field());
list.add(new Pacs009001ParseSeqB70Field());
list.add(new Pacs009001ParseSeqB72Field());
list.add(new Pacs009001ParseSeqB33BField());
return list;
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field13C;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse13CField extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "13C";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag[] tags = abstractMT.getSwiftMessage().getBlock4().getTagsByName(NAME);
if (tags != null && tags.length > 0) {
Map<String,Object> sttlmTmIndctnMaps = null;
if (cdtTrfTxInfMaps.containsKey("sttlmTmIndctn")) {
sttlmTmIndctnMaps = (Map<String,Object>)cdtTrfTxInfMaps.get("sttlmTmIndctn");
} else {
sttlmTmIndctnMaps = new HashMap<>();
cdtTrfTxInfMaps.put("sttlmTmIndctn", sttlmTmIndctnMaps);
}
Map<String,Object> sttlmTmReqMaps = null;
if (cdtTrfTxInfMaps.containsKey("sttlmTmReq")) {
sttlmTmReqMaps = (Map<String,Object>)cdtTrfTxInfMaps.get("sttlmTmReq");
} else {
sttlmTmReqMaps = new HashMap<>();
cdtTrfTxInfMaps.put("sttlmTmReq", sttlmTmReqMaps);
}
for (int i=0; i<tags.length; i++) {
Field13C field13C = (Field13C)tags[i].asField();
String dateTimeStr = "0001-01-01T"
+ field13C.getTime().substring(0,2)
+ ":" + field13C.getTime().substring(2,4)
+ ":00"
+ field13C.getSign()
+ field13C.getOffset().substring(0, 2)
+ ":" + field13C.getOffset().substring(2, 4);
String timeStr = field13C.getTime().substring(0,2)
+ ":" + field13C.getTime().substring(2,4)
+ ":00"
+ field13C.getSign()
+ field13C.getOffset().substring(0, 2)
+ ":" + field13C.getOffset().substring(2, 4);
if ("SNDTIME".equals(field13C.getCode())) {
sttlmTmIndctnMaps.put("dbtDtTm", dateTimeStr);
} else if ("RNCTIME".equals(field13C.getCode())) {
sttlmTmIndctnMaps.put("cdtDtTm", dateTimeStr);
} else if ("CLSTIME".equals(field13C.getCode())) {
sttlmTmReqMaps.put("clsTm", timeStr);
} else if ("TILTIME".equals(field13C.getCode())) {
sttlmTmReqMaps.put("tillTm", timeStr);
} else if ("FROTIME".equals(field13C.getCode())) {
sttlmTmReqMaps.put("frTm", timeStr);
} else if ("REJTIME".equals(field13C.getCode())) {
sttlmTmReqMaps.put("rjctTm", timeStr);
}
}
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse20Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "20";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag20 = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag20 != null) {
appHdrMaps.put("bizMsgIdr", tag20.getValue());
grpHdrMaps.put("msgId", tag20.getValue());
Map<String, Object> pmtIdMaps = null;
if (cdtTrfTxInfMaps.containsKey("pmtId")) {
pmtIdMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("pmtId");
} else {
pmtIdMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtId", pmtIdMaps);
}
pmtIdMaps.put("instrId", tag20.getValue());
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse21Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "21";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag21 = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag21 != null) {
Map<String, Object> pmtIdMaps = null;
if (cdtTrfTxInfMaps.containsKey("pmtId")) {
pmtIdMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("pmtId");
} else {
pmtIdMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtId", pmtIdMaps);
}
pmtIdMaps.put("endToEndId", tag21.getValue());
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.DateUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field32A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse32AField extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "32A";
@Override
public void parseField() throws SwiftException {
try {
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag != null) {
Field32A field32A = (Field32A)tag.asField();
Date date = DateUtil.parseDate("20"+field32A.getDate(), "yyyyMMdd");
String dateStr = DateUtil.format(date, "yyyy-MM-dd");
cdtTrfTxInfMaps.put("intrBkSttlmDt", dateStr);
Map<String, Object> intrBkSttlmAmtMaps = new HashMap<>();
intrBkSttlmAmtMaps.put("value", field32A.amount());
intrBkSttlmAmtMaps.put("ccy", field32A.getCurrency());
cdtTrfTxInfMaps.put("intrBkSttlmAmt", intrBkSttlmAmtMaps);
}
} catch (ParseException e) {
throw new SwiftException("ERROR", e.getMessage());
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field52A;
import com.prowidesoftware.swift.model.field.Field52D;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse52Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "52A";
private static final String NAME_D = "52D";
private static final String SEQUENCE_A = "A";
@Override
public void parseField() throws SwiftException {
Field52A field52A = null;
Field52D field52D = null;
Tag tag = getTagByName(NAME_A, SEQUENCE_A);
if (tag != null) {
field52A = (Field52A)tag.asField();
}
tag = getTagByName(NAME_D, SEQUENCE_A);
if (tag != null) {
field52D = (Field52D)tag.asField();
}
Map<String, Object> dbtrMaps = null;
if (cdtTrfTxInfMaps.containsKey("dbtr")) {
dbtrMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("dbtr");
} else {
dbtrMaps = new HashMap<>();
}
Map<String, Object> dbtrAcctMaps = null;
if (cdtTrfTxInfMaps.containsKey("dbtrAcct")) {
dbtrAcctMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("dbtrAcct");
} else {
dbtrAcctMaps = new HashMap<>();
}
String account = "";
if (field52A != null) {
String bicCode = field52A.getBIC();
mt_to_mxBICFI(bicCode, dbtrMaps);
if (StringUtil.isNotEmpty(field52A.getComponent1())) {
account = "/" + field52A.getComponent1();
}
if (StringUtil.isNotEmpty(field52A.getComponent2())) {
account = "/" + field52A.getComponent2();
}
} else if (field52D != null) {
if (StringUtil.isNotEmpty(field52D.getComponent1())) {
account = "/" + field52D.getComponent1();
}
if (StringUtil.isNotEmpty(field52D.getComponent2())) {
account = "/" + field52D.getComponent2();
}
String nameAddress = field52D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, dbtrMaps);
} else {
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
mt_to_mxBICFI(sendBic, dbtrMaps);
}
if (StringUtil.isNotEmpty(account)) {
if (account.startsWith("//") && !account.startsWith("//CH")) {
Map<String, Object> finInstnIdMaps = null;
if (dbtrMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)dbtrMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
dbtrMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, dbtrAcctMaps);
}
}
if (dbtrMaps.size() > 0) {
cdtTrfTxInfMaps.put("dbtr", dbtrMaps);
}
if (dbtrAcctMaps.size() > 0) {
cdtTrfTxInfMaps.put("dbtrAcct", dbtrAcctMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field53A;
import com.prowidesoftware.swift.model.field.Field53D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse53Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "53A";
//private static final String NAME_B = "53B";
private static final String NAME_D = "53D";
@Override
public void parseField() throws SwiftException {
VoSettlementMethodHelper setlMtdHelper = context.get(VoSettlementMethodHelper.class);
if (setlMtdHelper.isTranslate53Flag()) {
//53B 只能翻译成 Group Header -> Settlement Information -> Settlement Account/Settlement Method
Field53A field53A = null;
Field53D field53D = null;
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_A);
if (tag != null) {
field53A = (Field53A)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_D);
if (tag != null) {
field53D = (Field53D)tag.asField();
}
Map<String, Object> sttlmInfMaps = null;
if (grpHdrMaps.containsKey("sttlmInf")) {
sttlmInfMaps = (Map<String, Object>) grpHdrMaps.get("sttlmInf");
} else {
sttlmInfMaps = new HashMap<>();
grpHdrMaps.put("sttlmInf", sttlmInfMaps);
}
Map<String, Object> instgRmbrsmntAgtMaps = null;
if (sttlmInfMaps.containsKey("instgRmbrsmntAgt")) {
instgRmbrsmntAgtMaps = (Map<String, Object>) sttlmInfMaps.get("instgRmbrsmntAgt");
} else {
instgRmbrsmntAgtMaps = new HashMap<>();
sttlmInfMaps.put("instgRmbrsmntAgt", instgRmbrsmntAgtMaps);
}
String account = "";
if (field53A != null) {
String bicCode = field53A.getBIC();
mt_to_mxBICFI(bicCode, instgRmbrsmntAgtMaps);
if (StringUtil.isNotEmpty(field53A.getComponent1())) {
account += "/" + field53A.getComponent1();
}
if (StringUtil.isNotEmpty(field53A.getComponent2())) {
account += "/" + field53A.getComponent2();
}
} else if (field53D != null) {
String nameAddress = field53D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, instgRmbrsmntAgtMaps);
if (StringUtil.isNotEmpty(field53D.getComponent1())) {
account += "/" + field53D.getComponent1();
}
if (StringUtil.isNotEmpty(field53D.getComponent2())) {
account += "/" + field53D.getComponent2();
}
}
if (StringUtil.isNotEmpty(account)) {
Map<String, Object> instgRmbrsmntAgtAcctMaps = null;
if (sttlmInfMaps.containsKey("instgRmbrsmntAgtAcct")) {
instgRmbrsmntAgtAcctMaps = (Map<String, Object>) sttlmInfMaps.get("instgRmbrsmntAgtAcct");
} else {
instgRmbrsmntAgtAcctMaps = new HashMap<>();
sttlmInfMaps.put("instgRmbrsmntAgtAcct", instgRmbrsmntAgtAcctMaps);
}
if (account.startsWith("//") && !account.startsWith("//CH")) {
Map<String, Object> finInstnIdMaps = null;
if (instgRmbrsmntAgtMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)instgRmbrsmntAgtMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
instgRmbrsmntAgtMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else {
mt_to_mxFinancialInstitutionAccount(account, instgRmbrsmntAgtAcctMaps);
}
}
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field56A;
import com.prowidesoftware.swift.model.field.Field56D;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse56Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "56A";
//private static final String NAME_C = "56C";
private static final String NAME_D = "56D";
private static final String SEQUENCE_A = "A";
@Override
public void parseField() throws SwiftException {
Field56A field56A = null;
Field56D field56D = null;
Tag tag = getTagByName(NAME_A, SEQUENCE_A);
if (tag != null) {
field56A = (Field56A)tag.asField();
}
tag = getTagByName(NAME_D, SEQUENCE_A);
if (tag != null) {
field56D = (Field56D)tag.asField();
}
Map<String, Object> intrmyAgt1Maps = null;
if (cdtTrfTxInfMaps.containsKey("intrmyAgt1")) {
intrmyAgt1Maps = (Map<String, Object>) cdtTrfTxInfMaps.get("intrmyAgt1");
} else {
intrmyAgt1Maps = new HashMap<>();
}
Map<String, Object> intrmyAgt1AcctMaps = null;
if (cdtTrfTxInfMaps.containsKey("intrmyAgt1Acct")) {
intrmyAgt1AcctMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("intrmyAgt1Acct");
} else {
intrmyAgt1AcctMaps = new HashMap<>();
}
boolean clearingChannelRTGSFlag = false;
String account = "";
if (field56A != null) {
String bicCode = field56A.getBIC();
mt_to_mxBICFI(bicCode, intrmyAgt1Maps);
if (StringUtil.isNotEmpty(field56A.getComponent1())) {
account = "/" + field56A.getComponent1();
}
if (StringUtil.isNotEmpty(field56A.getComponent2())) {
account = "/" + field56A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW") && !account.startsWith("//RT")) {
Map<String, Object> finInstnIdMaps = null;
if (intrmyAgt1Maps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)intrmyAgt1Maps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
intrmyAgt1Maps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
}
} else if (field56D != null) {
if (StringUtil.isNotEmpty(field56D.getComponent1())) {
account = "/" + field56D.getComponent1();
}
if (StringUtil.isNotEmpty(field56D.getComponent2())) {
account = "/" + field56D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
}
String nameAddress = field56D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, intrmyAgt1Maps);
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
Map<String, Object> finInstnIdMaps = null;
if (intrmyAgt1Maps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)intrmyAgt1Maps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
intrmyAgt1Maps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
}
}
if (intrmyAgt1Maps.size() > 0) {
cdtTrfTxInfMaps.put("intrmyAgt1", intrmyAgt1Maps);
}
if (intrmyAgt1AcctMaps.size() > 0) {
cdtTrfTxInfMaps.put("intrmyAgt1Acct", intrmyAgt1AcctMaps);
}
if (clearingChannelRTGSFlag) {
Map<String, Object> pmtTpInfMaps = null;
if (cdtTrfTxInfMaps.containsKey("pmtTpInf")) {
pmtTpInfMaps = (Map<String, Object>)cdtTrfTxInfMaps.get("pmtTpInf");
} else {
pmtTpInfMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtTpInf", pmtTpInfMaps);
}
pmtTpInfMaps.put("clrChanl", "RTGS");
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field57A;
import com.prowidesoftware.swift.model.field.Field57B;
import com.prowidesoftware.swift.model.field.Field57D;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Pacs009001Parse57Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "57A";
private static final String NAME_B = "57B";
//private static final String NAME_C = "57C";
private static final String NAME_D = "57D";
private static final String SEQUENCE_A = "A";
@Override
public void parseField() throws SwiftException {
Field57A field57A = null;
Field57B field57B = null;
Field57D field57D = null;
Tag tag = getTagByName(NAME_A, SEQUENCE_A);
if (tag != null) {
field57A = (Field57A)tag.asField();
}
tag = getTagByName(NAME_B, SEQUENCE_A);
if (tag != null) {
field57B = (Field57B)tag.asField();
}
tag = getTagByName(NAME_D, SEQUENCE_A);
if (tag != null) {
field57D = (Field57D)tag.asField();
}
Map<String, Object> cdtrAgtMaps = null;
if (cdtTrfTxInfMaps.containsKey("cdtrAgt")) {
cdtrAgtMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("cdtrAgt");
} else {
cdtrAgtMaps = new HashMap<>();
}
Map<String, Object> cdtrAgtAcctMaps = null;
if (cdtTrfTxInfMaps.containsKey("cdtrAgtAcct")) {
cdtrAgtAcctMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("cdtrAgtAcct");
} else {
cdtrAgtAcctMaps = new HashMap<>();
}
boolean clearingChannelRTGSFlag = false;
String account = "";
if (field57A != null) {
String bicCode = field57A.getBIC();
mt_to_mxBICFI(bicCode, cdtrAgtMaps);
if (StringUtil.isNotEmpty(field57A.getComponent1())) {
account = "/" + field57A.getComponent1();
}
if (StringUtil.isNotEmpty(field57A.getComponent2())) {
account = "/" + field57A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW") && !account.startsWith("//RT")) {
Map<String, Object> finInstnIdMaps = null;
if (cdtrAgtMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)cdtrAgtMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
cdtrAgtMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
}
} else if (field57B != null) {
if (StringUtil.isNotEmpty(field57B.getComponent1())) {
account = "/" + field57B.getComponent1();
}
if (StringUtil.isNotEmpty(field57B.getComponent2())) {
account = "/" + field57B.getComponent2();
}
String location = field57B.getLocation();
Map<String, Object> finInstnIdMaps = null;
if (cdtrAgtMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)cdtrAgtMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
cdtrAgtMaps.put("finInstnId", finInstnIdMaps);
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
if (isMTClearingSystemCodeInList(account)) {
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
if (finInstnIdMaps.containsKey("pstlAdr")) {
pstlAdrMaps = (Map<String, Object>)finInstnIdMaps.get("pstlAdr");
} else {
pstlAdrMaps = new HashMap<>();
finInstnIdMaps.put("pstlAdr", pstlAdrMaps);
}
List<String> adrLineList = new ArrayList<>();
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, location, finInstnIdMaps);
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
if (finInstnIdMaps.containsKey("pstlAdr")) {
pstlAdrMaps = (Map<String, Object>)finInstnIdMaps.get("pstlAdr");
} else {
pstlAdrMaps = new HashMap<>();
finInstnIdMaps.put("pstlAdr", pstlAdrMaps);
}
List<String> adrLineList = new ArrayList<>();
adrLineList.add(StringUtil.isEmpty(location)?Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE:location);
pstlAdrMaps.put("adrLine", adrLineList);
}
} else if (field57D != null) {
if (StringUtil.isNotEmpty(field57D.getComponent1())) {
account = "/" + field57D.getComponent1();
}
if (StringUtil.isNotEmpty(field57D.getComponent2())) {
account = "/" + field57D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
}
String nameAddress = field57D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, cdtrAgtMaps);
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
Map<String, Object> finInstnIdMaps = null;
if (cdtrAgtMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)cdtrAgtMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
cdtrAgtMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAgtAcctMaps);
}
}
if (cdtrAgtMaps.size() > 0) {
cdtTrfTxInfMaps.put("cdtrAgt", cdtrAgtMaps);
}
if (cdtrAgtAcctMaps.size() > 0) {
cdtTrfTxInfMaps.put("cdtrAgtAcct", cdtrAgtAcctMaps);
}
if (clearingChannelRTGSFlag) {
Map<String, Object> pmtTpInfMaps = null;
if (cdtTrfTxInfMaps.containsKey("pmtTpInf")) {
pmtTpInfMaps = (Map<String, Object>)cdtTrfTxInfMaps.get("pmtTpInf");
} else {
pmtTpInfMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtTpInf", pmtTpInfMaps);
}
pmtTpInfMaps.put("clrChanl", "RTGS");
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field58A;
import com.prowidesoftware.swift.model.field.Field58D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001Parse58Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "58A";
private static final String NAME_D = "58D";
@Override
public void parseField() throws SwiftException {
Field58A field58A = null;
Field58D field58D = null;
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_A);
if (tag != null) {
field58A = (Field58A)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_D);
if (tag != null) {
field58D = (Field58D)tag.asField();
}
Map<String, Object> cdtrMaps = null;
if (cdtTrfTxInfMaps.containsKey("cdtr")) {
cdtrMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("cdtr");
} else {
cdtrMaps = new HashMap<>();
}
Map<String, Object> cdtrAcctMaps = null;
if (cdtTrfTxInfMaps.containsKey("cdtrAcct")) {
cdtrAcctMaps = (Map<String, Object>) cdtTrfTxInfMaps.get("cdtrAcct");
} else {
cdtrAcctMaps = new HashMap<>();
}
boolean clearingChannelRTGSFlag = false;
String account = "";
if (field58A != null) {
String bicCode = field58A.getBIC();
mt_to_mxBICFI(bicCode, cdtrMaps);
if (StringUtil.isNotEmpty(field58A.getComponent1())) {
account = "/" + field58A.getComponent1();
}
if (StringUtil.isNotEmpty(field58A.getComponent2())) {
account = "/" + field58A.getComponent2();
}
if (account.startsWith("//RT") || account.startsWith("//FW")) {
clearingChannelRTGSFlag = true;
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW") && !account.startsWith("//RT")) {
Map<String, Object> finInstnIdMaps = null;
if (cdtrMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)cdtrMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
cdtrMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAcctMaps);
}
} else if (field58D != null) {
if (StringUtil.isNotEmpty(field58D.getComponent1())) {
account = "/" + field58D.getComponent1();
}
if (StringUtil.isNotEmpty(field58D.getComponent2())) {
account = "/" + field58D.getComponent2();
}
if (account.startsWith("//RT")) {
clearingChannelRTGSFlag = true;
}
String nameAddress = field58D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, cdtrMaps);
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
Map<String, Object> finInstnIdMaps = null;
if (cdtrMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)cdtrMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
cdtrMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, cdtrAcctMaps);
}
}
if (cdtrMaps.size() > 0) {
cdtTrfTxInfMaps.put("cdtr", cdtrMaps);
}
if (cdtrAcctMaps.size() > 0) {
cdtTrfTxInfMaps.put("cdtrAcct", cdtrAcctMaps);
}
if (clearingChannelRTGSFlag) {
Map<String, Object> pmtTpInfMaps = null;
if (cdtTrfTxInfMaps.containsKey("pmtTpInf")) {
pmtTpInfMaps = (Map<String, Object>)cdtTrfTxInfMaps.get("pmtTpInf");
} else {
pmtTpInfMaps = new HashMap<>();
cdtTrfTxInfMaps.put("pmtTpInf", pmtTpInfMaps);
}
pmtTpInfMaps.put("clrChanl", "RTGS");
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field72;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
import java.util.List;
public class Pacs009001Parse72Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "72";
private static final String SEQUENCE_A = "A";
@Override
public void parseField() throws SwiftException {
Tag tag = getTagByName(NAME, SEQUENCE_A);
if (tag != null) {
Field72 field72 = (Field72)tag.asField();
mt_to_mxInstructionForCreditorAgent2(field72.getValue(), cdtTrfTxInfMaps);
mt72ins_to_mxAgent(field72.getValue(), cdtTrfTxInfMaps);
mt_to_mxBNF_TSU_RI(field72.getValue(), cdtTrfTxInfMaps);
List<String> excludeCodeList = new ArrayList<>();
excludeCodeList.add("/ACC/");
excludeCodeList.add("/UDLC/");
excludeCodeList.add("/INS/");
excludeCodeList.add("/BNF/");
excludeCodeList.add("/TSU/");
excludeCodeList.add("/PHONBEN/");
excludeCodeList.add("/TELEBEN/");
excludeCodeList.add("/INTA/");
excludeCodeList.add("/SVCLVL/");
excludeCodeList.add("/LOCINS/");
excludeCodeList.add("/CATPURP/");
excludeCodeList.add("/PURP/");
mt72_to_mxNextAgent(field72.getValue(), excludeCodeList, cdtTrfTxInfMaps);
mt_to_mxField72NewCodeWords(field72.getValue(), true, cdtTrfTxInfMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field33B;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001ParseSeqB33BField extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "33B";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag != null) {
Field33B field33B = (Field33B)tag.asField();
Map<String, Object> instdAmtMaps = new HashMap<>();
instdAmtMaps.put("value", field33B.amount());
instdAmtMaps.put("ccy", field33B.getCurrency());
undrlygCstmrCdtTrfMaps.put("instdAmt", instdAmtMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.common.OrganisationIdentificationCode;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field50A;
import com.prowidesoftware.swift.model.field.Field50F;
import com.prowidesoftware.swift.model.field.Field50K;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Pacs009001ParseSeqB50Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "50A";
private static final String NAME_F = "50F";
private static final String NAME_K = "50K";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Field50A field50A = null;
Field50F field50F = null;
Field50K field50K = null;
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_A);
if (tag != null) {
field50A = (Field50A)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_F);
if (tag != null) {
field50F = (Field50F)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_K);
if (tag != null) {
field50K = (Field50K)tag.asField();
}
Map<String, Object> dbtrMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("dbtr")) {
dbtrMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("dbtr");
} else {
dbtrMaps = new HashMap<>();
}
Map<String, Object> dbtrAcctMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("dbtrAcct")) {
dbtrAcctMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("dbtrAcct");
} else {
dbtrAcctMaps = new HashMap<>();
}
String account = "";
if (field50A != null) {
String bicCode = field50A.getBIC();
if (StringUtil.isNotEmpty(field50A.getComponent1())) {
account += "/" + field50A.getComponent1();
}
mt_to_mxAnyBIC(bicCode, dbtrMaps);
if (StringUtil.isEmpty(account)) {
buildDefaultValue(dbtrMaps);
} else {
mt_to_mxPartyAccount(account, dbtrAcctMaps);
}
}
if (field50F != null) {
String partyIdentifier = field50F.getPartyIdentifier();
String nameAddress = "";
List<String> lines = field50F.getLines();
for (int i=0; i<lines.size(); i++) {
if (i == 0) {
continue;
}
if (i == lines.size()-1) {
nameAddress += lines.get(i);
} else {
nameAddress += lines.get(i) + Mx2MtConstants.NEW_LINE;
}
}
if (partyIdentifier.startsWith("/")) {
mt_to_mxPartyAccount(partyIdentifier, dbtrAcctMaps);
} else {
Map<String, Object> idMaps = null;
if (dbtrMaps.containsKey("id")) {
idMaps = (Map<String, Object>) dbtrMaps.get("id");
} else {
idMaps = new HashMap<>();
dbtrMaps.put("id", idMaps);
}
mt_to_mxFATFIdentification(partyIdentifier, nameAddress, idMaps);
}
mt_to_mxFATFNameAndAddress(partyIdentifier, nameAddress, dbtrMaps);
}
if (field50K != null) {
String nameAddress = field50K.getNameAndAddress();
if (StringUtil.isNotEmpty(field50K.getComponent1())) {
account += "/" + field50K.getComponent1();
}
mt_to_mxPartyNameAndAddress(nameAddress, dbtrMaps);
if (StringUtil.isEmpty(account)) {
buildDefaultValue(dbtrMaps);
} else {
mt_to_mxPartyAccount(account, dbtrAcctMaps);
}
}
if (dbtrMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("dbtr", dbtrMaps);
}
if (dbtrAcctMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("dbtrAcct", dbtrAcctMaps);
}
}
/**
* IF 50A/Account 50K/Account IsAbsent
* THEN Copy "NOTPROVIDED" to Debtor/Id/OrgID/Other/ID
* and "TXID" to SchemeName/Code
* @param dbtrMaps
*/
private void buildDefaultValue(Map<String, Object> dbtrMaps) {
Map<String, Object> idMaps = null;
if (dbtrMaps.containsKey("id")) {
idMaps = (Map<String, Object>)dbtrMaps.get("id");
} else {
idMaps = new HashMap<>();
dbtrMaps.put("id", idMaps);
}
Map<String, Object> idOrgMaps = null;
if (idMaps.containsKey("orgId")) {
idOrgMaps = (Map<String, Object>)idMaps.get("orgId");
} else {
idOrgMaps = new HashMap<>();
idMaps.put("orgId", idOrgMaps);
}
JSONArray othrJsonArray = null;
if (idOrgMaps.containsKey("othr")) {
othrJsonArray = (JSONArray) idOrgMaps.get("othr");
} else {
othrJsonArray = new JSONArray();
idOrgMaps.put("othr", othrJsonArray);
}
Map<String, Object> othrMaps = new HashMap<>();
othrJsonArray.add(othrMaps);
othrMaps.put("id", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> schmeNmMaps = null;
if (othrMaps.containsKey("schmeNm")) {
schmeNmMaps = (Map<String, Object>) othrMaps.get("schmeNm");
} else {
schmeNmMaps = new HashMap<>();
othrMaps.put("schmeNm", schmeNmMaps);
}
schmeNmMaps.put("cd", OrganisationIdentificationCode.TXID.value());
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.Mt2MxContextIdentifier;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field52A;
import com.prowidesoftware.swift.model.field.Field52D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001ParseSeqB52Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "52A";
private static final String NAME_D = "52D";
private static final String SEQUENCE_A = "A";
private static final String SEQUENCE_B = "B";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Field52A field52A = null;
Field52D field52D = null;
Tag tag = getTagByName(NAME_A, SEQUENCE_B);
if (tag != null) {
field52A = (Field52A)tag.asField();
}
tag = getTagByName(NAME_D, SEQUENCE_B);
if (tag != null) {
field52D = (Field52D)tag.asField();
}
if (field52A == null && field52D == null) {
tag = getTagByName(NAME_A, SEQUENCE_A);
if (tag != null) {
field52A = (Field52A)tag.asField();
}
tag = getTagByName(NAME_D, SEQUENCE_A);
if (tag != null) {
field52D = (Field52D)tag.asField();
}
}
Map<String, Object> dbtrAgtMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("dbtrAgt")) {
dbtrAgtMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("dbtrAgt");
} else {
dbtrAgtMaps = new HashMap<>();
}
Map<String, Object> dbtrAgtAcctMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("dbtrAgtAcct")) {
dbtrAgtAcctMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("dbtrAgtAcct");
} else {
dbtrAgtAcctMaps = new HashMap<>();
}
String account = "";
if (field52A != null) {
String bicCode = field52A.getBIC();
mt_to_mxBICFI(bicCode, dbtrAgtMaps);
if (StringUtil.isNotEmpty(field52A.getComponent1())) {
account = "/" + field52A.getComponent1();
}
if (StringUtil.isNotEmpty(field52A.getComponent2())) {
account = "/" + field52A.getComponent2();
}
} else if (field52D != null) {
if (StringUtil.isNotEmpty(field52D.getComponent1())) {
account = "/" + field52D.getComponent1();
}
if (StringUtil.isNotEmpty(field52D.getComponent2())) {
account = "/" + field52D.getComponent2();
}
String nameAddress = field52D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, dbtrAgtMaps);
} else {
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
mt_to_mxBICFI(sendBic, dbtrAgtMaps);
}
if (StringUtil.isNotEmpty(account)) {
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
Map<String, Object> finInstnIdMaps = null;
if (dbtrAgtMaps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)dbtrAgtMaps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
dbtrAgtMaps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, dbtrAgtAcctMaps);
}
}
if (dbtrAgtMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("dbtrAgt", dbtrAgtMaps);
}
if (dbtrAgtAcctMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("dbtrAgtAcct", dbtrAgtAcctMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field56A;
import com.prowidesoftware.swift.model.field.Field56C;
import com.prowidesoftware.swift.model.field.Field56D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Pacs009001ParseSeqB56Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "56A";
private static final String NAME_C = "56C";
private static final String NAME_D = "56D";
private static final String SEQUENCE_B = "B";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Field56A field56A = null;
Field56C field56C = null;
Field56D field56D = null;
Tag tag = getTagByName(NAME_A, SEQUENCE_B);
if (tag != null) {
field56A = (Field56A)tag.asField();
}
tag = getTagByName(NAME_C, SEQUENCE_B);
if (tag != null) {
field56C = (Field56C)tag.asField();
}
tag = getTagByName(NAME_D, SEQUENCE_B);
if (tag != null) {
field56D = (Field56D)tag.asField();
}
Map<String, Object> intrmyAgt1Maps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("intrmyAgt1")) {
intrmyAgt1Maps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("intrmyAgt1");
} else {
intrmyAgt1Maps = new HashMap<>();
}
Map<String, Object> intrmyAgt1AcctMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("intrmyAgt1Acct")) {
intrmyAgt1AcctMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("intrmyAgt1Acct");
} else {
intrmyAgt1AcctMaps = new HashMap<>();
}
String account = "";
if (field56A != null) {
String bicCode = field56A.getBIC();
mt_to_mxBICFI(bicCode, intrmyAgt1Maps);
if (StringUtil.isNotEmpty(field56A.getComponent1())) {
account = "/" + field56A.getComponent1();
}
if (StringUtil.isNotEmpty(field56A.getComponent2())) {
account = "/" + field56A.getComponent2();
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW") && !account.startsWith("//RT")) {
Map<String, Object> finInstnIdMaps = null;
if (intrmyAgt1Maps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)intrmyAgt1Maps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
intrmyAgt1Maps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
}
} else if (field56C != null) {
account = field56C.getValue();
Map<String, Object> finInstnIdMaps = null;
if (intrmyAgt1Maps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)intrmyAgt1Maps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
intrmyAgt1Maps.put("finInstnId", finInstnIdMaps);
}
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
if (isMTClearingSystemCodeInList(account)) {
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
if (finInstnIdMaps.containsKey("pstlAdr")) {
pstlAdrMaps = (Map<String, Object>)finInstnIdMaps.get("pstlAdr");
} else {
pstlAdrMaps = new HashMap<>();
finInstnIdMaps.put("pstlAdr", pstlAdrMaps);
}
List<String> adrLineList = new ArrayList<>();
adrLineList.add(Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
pstlAdrMaps.put("adrLine", adrLineList);
} else {
mt_to_mxClearingSystemToNameAndAddressLine(account, null, finInstnIdMaps);
}
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
//name address 设置NOTPROVIDED
finInstnIdMaps.put("nm", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
Map<String, Object> pstlAdrMaps = null;
if (finInstnIdMaps.containsKey("pstlAdr")) {
pstlAdrMaps = (Map<String, Object>)finInstnIdMaps.get("pstlAdr");
} else {
pstlAdrMaps = new HashMap<>();
finInstnIdMaps.put("pstlAdr", pstlAdrMaps);
}
List<String> adrLineList = new ArrayList<>();
adrLineList.add(Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
pstlAdrMaps.put("adrLine", adrLineList);
}
} else if (field56D != null) {
if (StringUtil.isNotEmpty(field56D.getComponent1())) {
account = "/" + field56D.getComponent1();
}
if (StringUtil.isNotEmpty(field56D.getComponent2())) {
account = "/" + field56D.getComponent2();
}
String nameAddress = field56D.getNameAndAddress();
mt_to_mxFinancialInstitutionNameAndUnstructuredAddress(nameAddress, intrmyAgt1Maps);
if (account.startsWith("//") && !account.startsWith("//CH") && !account.startsWith("//FW")) {
Map<String, Object> finInstnIdMaps = null;
if (intrmyAgt1Maps.containsKey("finInstnId")) {
finInstnIdMaps = (Map<String, Object>)intrmyAgt1Maps.get("finInstnId");
} else {
finInstnIdMaps = new HashMap<>();
intrmyAgt1Maps.put("finInstnId", finInstnIdMaps);
}
Map<String, Object> clrSysMmbIdMaps = null;
if (finInstnIdMaps.containsKey("clrSysMmbId")) {
clrSysMmbIdMaps = (Map<String, Object>)finInstnIdMaps.get("clrSysMmbId");
} else {
clrSysMmbIdMaps = new HashMap<>();
finInstnIdMaps.put("clrSysMmbId", clrSysMmbIdMaps);
}
mt_to_mxClearingIdentifier(account, clrSysMmbIdMaps);
} else if (!account.startsWith("//") || account.startsWith("//CH")) {
mt_to_mxFinancialInstitutionAccount(account, intrmyAgt1AcctMaps);
}
}
if (intrmyAgt1Maps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("intrmyAgt1", intrmyAgt1Maps);
}
if (intrmyAgt1AcctMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("intrmyAgt1Acct", intrmyAgt1AcctMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.alibaba.fastjson.JSONArray;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field59;
import com.prowidesoftware.swift.model.field.Field59A;
import com.prowidesoftware.swift.model.field.Field59F;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Pacs009001ParseSeqB59Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "59";
private static final String NAME_A = "59A";
private static final String NAME_F = "59F";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Field59 field59 = null;
Field59A field59A = null;
Field59F field59F = null;
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag != null) {
field59 = (Field59)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_A);
if (tag != null) {
field59A = (Field59A)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_F);
if (tag != null) {
field59F = (Field59F)tag.asField();
}
Map<String, Object> cdtrMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("cdtr")) {
cdtrMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("cdtr");
} else {
cdtrMaps = new HashMap<>();
}
Map<String, Object> cdtrAcctMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("cdtrAcct")) {
cdtrAcctMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("cdtrAcct");
} else {
cdtrAcctMaps = new HashMap<>();
}
String account = "";
if (field59A != null) {
String bicCode = field59A.getBIC();
if (StringUtil.isNotEmpty(field59A.getComponent1())) {
account += "/" + field59A.getComponent1();
}
mt_to_mxAnyBIC(bicCode, cdtrMaps);
if (StringUtil.isEmpty(account)) {
buildDefaultValue(cdtrMaps);
} else {
mt_to_mxPartyAccount(account, cdtrAcctMaps);
}
}
if (field59F != null) {
if (StringUtil.isNotEmpty(field59F.getComponent1())) {
account += "/" + field59F.getComponent1();
}
if (StringUtil.isEmpty(account)) {
buildDefaultValue(cdtrMaps);
} else {
mt_to_mxPartyAccount(account, cdtrAcctMaps);
}
String nameAddress = "";
List<String> lines = field59F.getLines();
for (int i=0; i<lines.size(); i++) {
if (i == 0 && StringUtil.isNotEmpty(account)) {
continue;
}
if (i == lines.size()-1) {
nameAddress += lines.get(i);
} else {
nameAddress += lines.get(i) + Mx2MtConstants.NEW_LINE;
}
}
mt_to_mxPartyNameAndStructuredAddress(nameAddress, cdtrMaps);
}
if (field59 != null) {
String nameAddress = field59.getNameAndAddress(Mx2MtConstants.NEW_LINE);
if (StringUtil.isNotEmpty(field59.getComponent1())) {
account += "/" + field59.getComponent1();
}
mt_to_mxPartyNameAndAddress(nameAddress, cdtrMaps);
if (StringUtil.isEmpty(account)) {
buildDefaultValue(cdtrMaps);
} else {
mt_to_mxPartyAccount(account, cdtrAcctMaps);
}
}
if (cdtrMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("cdtr", cdtrMaps);
}
if (cdtrAcctMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("cdtrAcct", cdtrAcctMaps);
}
}
/**
* IF 59A/Account 59/Account IsAbsent
* THEN Copy "NOTPROVIDED" to Debtor/Id/OrgID/Other/ID
* and "TXID" to SchemeName/Code
* @param dbtrMaps
*/
private void buildDefaultValue(Map<String, Object> dbtrMaps) {
Map<String, Object> idMaps = null;
if (dbtrMaps.containsKey("id")) {
idMaps = (Map<String, Object>)dbtrMaps.get("id");
} else {
idMaps = new HashMap<>();
dbtrMaps.put("id", idMaps);
}
Map<String, Object> idOrgMaps = null;
if (idMaps.containsKey("orgId")) {
idOrgMaps = (Map<String, Object>)idMaps.get("orgId");
} else {
idOrgMaps = new HashMap<>();
idMaps.put("orgId", idOrgMaps);
}
JSONArray othrJsonArray = null;
if (idOrgMaps.containsKey("othr")) {
othrJsonArray = (JSONArray) idOrgMaps.get("othr");
} else {
othrJsonArray = new JSONArray();
idOrgMaps.put("othr", othrJsonArray);
}
Map<String, Object> othrMaps = new HashMap<>();
othrJsonArray.add(othrMaps);
othrMaps.put("id", Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE);
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field70;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
public class Pacs009001ParseSeqB70Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "70";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME);
if (tag != null) {
Field70 field70 = (Field70)tag.asField();
String mt70 = field70.getValue();
Map<String, Object> rmtInfMaps = null;
if (undrlygCstmrCdtTrfMaps.containsKey("rmtInf")) {
rmtInfMaps = (Map<String, Object>) undrlygCstmrCdtTrfMaps.get("rmtInf");
} else {
rmtInfMaps = new HashMap<>();
}
mt_to_mxRemittanceInformation(mt70, rmtInfMaps);
if (rmtInfMaps.size() > 0) {
undrlygCstmrCdtTrfMaps.put("rmtInf", rmtInfMaps);
}
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field72;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.ArrayList;
import java.util.List;
public class Pacs009001ParseSeqB72Field extends AbstractMt2MxPacs009001ParseField {
private static final String NAME = "72";
private static final String SEQUENCE_B = "B";
@Override
public void parseField() throws SwiftException {
AbstractMT abstractMT = context.get(AbstractMT.class);
if (!abstractMT.getSwiftMessage().isCOV()) {
return;
}
Tag tag = getTagByName(NAME, SEQUENCE_B);
if (tag != null) {
Field72 field72 = (Field72)tag.asField();
mt72ins_to_mxAgent(field72.getValue(), undrlygCstmrCdtTrfMaps);
List<String> excludeCodeList = new ArrayList<>();
excludeCodeList.add("/ACC/");
excludeCodeList.add("/INS/");
excludeCodeList.add("/INTA/");
mt72_to_mxNextAgent(field72.getValue(), excludeCodeList, undrlygCstmrCdtTrfMaps);
mt_to_mxField72NewCodeWords(field72.getValue(), false, undrlygCstmrCdtTrfMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.field.Field53A;
import com.prowidesoftware.swift.model.field.Field53B;
import com.prowidesoftware.swift.model.field.Field53D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.HashMap;
import java.util.Map;
/**
* Group Header -> Settlement Information -> Settlement Account
*/
public class Pacs009001ParseSetlAcctField extends AbstractMt2MxPacs009001ParseField {
private static final String NAME_A = "53A";
private static final String NAME_B = "53B";
private static final String NAME_D = "53D";
@Override
public void parseField() throws SwiftException {
//值来源于 Pacs00801ParseSetlMtdField
VoSettlementMethodHelper setlMtdHelper = context.get(VoSettlementMethodHelper.class);
if (setlMtdHelper.isTranslateSetlAcctFlag()) {
Field53A field53A = null;
Field53B field53B = null;
Field53D field53D = null;
AbstractMT abstractMT = context.get(AbstractMT.class);
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_A);
if (tag != null) {
field53A = (Field53A)tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_B);
if (tag != null) {
field53B = (Field53B) tag.asField();
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName(NAME_D);
if (tag != null) {
field53D = (Field53D)tag.asField();
}
String account = "";
if (field53A != null) {
if (StringUtil.isNotEmpty(field53A.getComponent1())) {
account += "/" + field53A.getComponent1();
}
if (StringUtil.isNotEmpty(field53A.getComponent2())) {
account += "/" + field53A.getComponent2();
}
} else if (field53B != null) {
if (StringUtil.isNotEmpty(field53B.getComponent1())) {
account += "/" + field53B.getComponent1();
}
if (StringUtil.isNotEmpty(field53B.getComponent2())) {
account += "/" + field53B.getComponent2();
}
} else if (field53D != null) {
if (StringUtil.isNotEmpty(field53D.getComponent1())) {
account += "/" + field53D.getComponent1();
}
if (StringUtil.isNotEmpty(field53D.getComponent2())) {
account += "/" + field53D.getComponent2();
}
}
if (StringUtil.isEmpty(account)) return;
Map<String, Object> sttlmInfMaps = null;
if (grpHdrMaps.containsKey("sttlmInf")) {
sttlmInfMaps = (Map<String, Object>) grpHdrMaps.get("sttlmInf");
} else {
sttlmInfMaps = new HashMap<>();
grpHdrMaps.put("sttlmInf", sttlmInfMaps);
}
Map<String, Object> sttlmAcctMaps = null;
if (sttlmInfMaps.containsKey("sttlmAcct")) {
sttlmAcctMaps = (Map<String, Object>)sttlmInfMaps.get("sttlmAcct");
} else {
sttlmAcctMaps = new HashMap<>();
sttlmInfMaps.put("sttlmAcct", sttlmAcctMaps);
}
mt_to_mxFinancialInstitutionAccount(account, sttlmAcctMaps);
}
}
}
package com.brilliance.swift.mt2mx.pacs009001.impl;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mt2mx.pacs009001.AbstractMt2MxPacs009001ParseField;
import com.brilliance.swift.mt2mx.setlmtd.SettlementMethodAnalyzerFactory;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import java.util.HashMap;
import java.util.Map;
/**
* Group Header -> Settlement Information -> Settlement Method
*/
public class Pacs009001ParseSetlMtdField extends AbstractMt2MxPacs009001ParseField {
@Override
public void parseField() throws SwiftException {
VoSettlementMethodHelper setlMtdHelper = SettlementMethodAnalyzerFactory.find(context).analyse();
String settlementMethod = setlMtdHelper.getSettlementMethod();
Map<String, Object> sttlmInfMaps = null;
if (grpHdrMaps.containsKey("sttlmInf")) {
sttlmInfMaps = (Map<String, Object>) grpHdrMaps.get("sttlmInf");
} else {
sttlmInfMaps = new HashMap<>();
grpHdrMaps.put("sttlmInf", sttlmInfMaps);
}
sttlmInfMaps.put("sttlmMtd", settlementMethod);
context.set(setlMtdHelper);
}
}
......@@ -7,6 +7,7 @@ import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.field.Field53A;
import com.prowidesoftware.swift.model.field.Field54A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class Field53A54AAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
......@@ -14,6 +15,9 @@ public class Field53A54AAnalyzer extends AbstractSettlementMethodAnalyzer {
VoSettlementMethodHelper seltMtdHelper = new VoSettlementMethodHelper();
Field53A field53A = (Field53A)field53;
String field53BicCode = field53A.getBIC();
if (field53BicCode.length() == 8) {
field53BicCode += "XXX";
}
String account = "";
if (StringUtil.isNotEmpty(field53A.getComponent1())) {
account += "/" + field53A.getComponent1();
......@@ -23,6 +27,9 @@ public class Field53A54AAnalyzer extends AbstractSettlementMethodAnalyzer {
}
Field54A field54A = (Field54A)field54;
String field54BicCode = field54A.getBIC();
if (field54BicCode.length() == 8) {
field54BicCode += "XXX";
}
String sendBic = (String) context.get(Mt2MxContextIdentifier.MT_SEND_BIC, true);
String receiveBic = (String) context.get(Mt2MxContextIdentifier.MT_RECEIVE_BIC, true);
if (field53BicCode.equals(sendBic) && field54BicCode.equals(receiveBic)) {
......@@ -37,10 +44,15 @@ public class Field53A54AAnalyzer extends AbstractSettlementMethodAnalyzer {
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
}
}
return seltMtdHelper;
}
......
......@@ -6,6 +6,7 @@ import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.field.Field53A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class Field53A54BAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
......@@ -31,10 +32,15 @@ public class Field53A54BAnalyzer extends AbstractSettlementMethodAnalyzer {
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
}
}
return seltMtdHelper;
}
......
......@@ -6,6 +6,7 @@ import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.field.Field53A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class Field53A54DAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
......@@ -31,10 +32,15 @@ public class Field53A54DAnalyzer extends AbstractSettlementMethodAnalyzer {
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
}
}
return seltMtdHelper;
}
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.field.Field53D;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class Field53D54aAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
......@@ -26,10 +27,15 @@ public class Field53D54aAnalyzer extends AbstractSettlementMethodAnalyzer {
}
seltMtdHelper.setTranslateSetlAcctFlag(true);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
seltMtdHelper.setTranslate54Flag(true);
seltMtdHelper.setTranslate55Flag(true);
}
}
return seltMtdHelper;
}
......
......@@ -6,6 +6,7 @@ import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.SwiftTransferUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.field.Field53A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class FieldOnly53AAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
......@@ -36,8 +37,13 @@ public class FieldOnly53AAnalyzer extends AbstractSettlementMethodAnalyzer {
seltMtdHelper.setSettlementMethod("INDA");
seltMtdHelper.setInstructionForNextAgent("/FIN53/"+bicCode);
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate53Flag(true);
}
}
}
return seltMtdHelper;
......
......@@ -5,6 +5,7 @@ import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.field.Field54A;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class FieldOnly54AAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
......@@ -18,8 +19,13 @@ public class FieldOnly54AAnalyzer extends AbstractSettlementMethodAnalyzer {
|| (StringUtil.isNotEmpty(receiveBic) && bicCode.substring(0, 8).equals(receiveBic.substring(0, 8)))) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
}
}
return seltMtdHelper;
}
......
......@@ -2,13 +2,19 @@ package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class FieldOnly54BAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
public VoSettlementMethodHelper analyse() {
VoSettlementMethodHelper seltMtdHelper = new VoSettlementMethodHelper();
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
}
return seltMtdHelper;
}
}
......@@ -2,13 +2,19 @@ package com.brilliance.swift.mt2mx.setlmtd.impl;
import com.brilliance.swift.mt2mx.setlmtd.AbstractSettlementMethodAnalyzer;
import com.brilliance.swift.vo.VoSettlementMethodHelper;
import com.prowidesoftware.swift.model.mt.AbstractMT;
public class FieldOnly54DAnalyzer extends AbstractSettlementMethodAnalyzer {
@Override
public VoSettlementMethodHelper analyse() {
VoSettlementMethodHelper seltMtdHelper = new VoSettlementMethodHelper();
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
AbstractMT abstractMT = context.get(AbstractMT.class);
if (abstractMT.getSwiftMessage().isCOV()) {
seltMtdHelper.setSettlementMethod("INDA");
} else {
seltMtdHelper.setSettlementMethod("COVE");
seltMtdHelper.setTranslate54Flag(true);
}
return seltMtdHelper;
}
}
package com.brilliance.swift.mx2map.pacs008;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.AbstractMx2MapCreator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.util.XmlUtil;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import javax.xml.datatype.XMLGregorianCalendar;
import java.util.Map;
public class Mx2MapPacs008Creator extends AbstractMx2MapCreator {
@Override
public Map<String, String> mx2Map() throws SwiftException {
try {
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> parentElementMaps = XmlUtil.getParentElementMaps(document);
String appHdrParentElementName = parentElementMaps.get("AppHdr");
String grpHdrParentElementName = parentElementMaps.get("GrpHdr");
String cdtTrfTxInfParentElementName = parentElementMaps.get("cdtTrfTxInf");
String sendBic = abstractMX.getAppHdr().from();
maps.put(getPropertyValue("app.header.sendBic"), sendBic);
String receiverBic = abstractMX.getAppHdr().to();
maps.put(getPropertyValue("app.header.receiverBic"), receiverBic);
String bizMsgId = abstractMX.getAppHdr().reference();
maps.put(getPropertyValue("app.header.bizMsgId"), bizMsgId);
String msgDefId = abstractMX.getAppHdr().messageName();
maps.put(getPropertyValue("app.header.msgDefId"), msgDefId);
String bizSvc = abstractMX.getAppHdr().serviceName();
maps.put(getPropertyValue("app.header.bizSvc"), bizSvc);
XMLGregorianCalendar creDt = abstractMX.getAppHdr().creationDate();
maps.put(getPropertyValue("app.header.creDt"), creDt.toXMLFormat());
String messageId = XmlUtil.getXmlNodeValue(document, cdtTrfTxInfParentElementName + ".CdtTrfTxInf.PmtId.InstrId");
if (StringUtil.isEmpty(messageId)) {
messageId = XmlUtil.getXmlNodeValue(document, grpHdrParentElementName + ".GrpHdr.MsgId");
}
if (StringUtil.isEmpty(messageId)) {
messageId = abstractMX.getAppHdr().reference();
}
maps.put(getPropertyValue("message.id"), messageId);
String endToEndId = XmlUtil.getXmlNodeValue(document, cdtTrfTxInfParentElementName + ".CdtTrfTxInf.PmtId.EndToEndId");
maps.put(getPropertyValue("endToEnd.id"), endToEndId);
String uetr = XmlUtil.getXmlNodeValue(document, cdtTrfTxInfParentElementName + ".CdtTrfTxInf.PmtId.uetr");
if (StringUtil.isNotEmpty(uetr)) {
maps.put(getPropertyValue("uetr"), uetr);
}
} catch (DocumentException e) {
throw new SwiftException("ERROR", e.getMessage());
}
return maps;
}
}
......@@ -19,19 +19,17 @@ public class Field26TGenerate extends AbstractMx2MtTagsGenerate {
public void tagGenerate() throws SwiftException {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String code = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.Purp.Cd");
String proprietary = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.Purp.Prtry");
if (StringUtil.isNotEmpty(proprietary)) {
String regex = ".*:26T:(.*).*";
if (StringUtil.isEmpty(code) && StringUtil.isNotEmpty(proprietary)) {
String regex = ":26T:([A-Z0-9]{3})";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(proprietary);
if (m.find()) {
/**
* group(0)就是指的整个串,group(1)指的是第一个括号里的东西,group(2)指的第二个括号里的东西
*/
String code = m.group(1);
if (code.matches("[A-Z0-9]{3}")) {
tags.add(new Tag(name, code));
}
tags.add(new Tag(name, m.group(1)));
}
}
}
......
......@@ -58,30 +58,24 @@ public class Field70Generate extends AbstractMx2MtTagsGenerate {
mt70FullString += "//" + str;
}
}
String mxPurposeCode = getXmlNodeValue(bodyHdrParentElementName, document, ".CdtTrfTxInf.Purp.Cd");
String mxPurposeProprietary = getXmlNodeValue(bodyHdrParentElementName, document, ".CdtTrfTxInf.Purp.Prtry");
boolean mxPurposeFlag = true;
if (StringUtil.isEmpty(mxPurposeCode)) {
mxPurposeFlag = false;
String mxPurposeCode = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.Purp.Cd");
String mxPurposeProprietary = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.Purp.Prtry");
String mtPurposeCode = "";
if (StringUtil.isNotEmpty(mxPurposeCode)) {
mtPurposeCode = mxPurposeCode;
} else if (StringUtil.isNotEmpty(mxPurposeProprietary)) {
String regex = ".*:26T:(.*).*";
String regex = ":26T:([A-Z0-9]{3})";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(mxPurposeProprietary);
if (m.find()) {
/**
* group(0)就是指的整个串,group(1)指的是第一个括号里的东西,group(2)指的第二个括号里的东西
*/
String code = m.group(1);
if (code.matches("[A-Z0-9]{3}")) {
mxPurposeFlag = false;
}
if (!m.find()) {
mtPurposeCode = mxPurposeProprietary;
}
}
if (mxPurposeFlag) {
if (StringUtil.isNotEmpty(mtPurposeCode)) {
if (StringUtil.isEmpty(mt70FullString)) {
mt70FullString += "/PURP/" + mxPurposeCode;
mt70FullString += "/PURP/" + mtPurposeCode;
} else {
mt70FullString += "///PURP/" + mxPurposeCode;
mt70FullString += "///PURP/" + mtPurposeCode;
}
}
String endToEndIdentification = getXmlNodeValue(bodyHdrParentElementName, document, "CdtTrfTxInf.PmtId.EndToEndId");
......
......@@ -556,6 +556,18 @@ public class SwiftTransferUtil {
return false;
}
public static PurposeCode getPurposeByValue(String value) {
PurposeCode code = null;
PurposeCode[] values = PurposeCode.values();
for (PurposeCode tmpCode : values) {
if (tmpCode.value().equals(value)) {
code = tmpCode;
break;
}
}
return code;
}
public static CategoryPurposeCode getCategoryPurposeByValue(String value) {
CategoryPurposeCode code = null;
CategoryPurposeCode[] values = CategoryPurposeCode.values();
......
package com.brilliance.swift.util;
import org.apache.commons.io.FileUtils;
import org.dom4j.*;
import org.dom4j.io.SAXReader;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class XmlUtil {
......@@ -183,38 +183,4 @@ public class XmlUtil {
}
}
public static void main(String[] args) throws IOException, DocumentException {
// File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml");
/* File file = new File("d:/test/test.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
String value = getXmlNodeValue(document, "Document.BkToCstmrStmt.GrpHdr.MsgId");
System.out.println(value);*/
/*File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
String value = getXmlNodeValue(document, "Document.FIToFICstmrCdtTrf.CdtTrfTxInf.SttlmTmIndctn.DbtDtTm");
System.out.println(value);*/
File file = new File(System.getProperty("user.dir") + "\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml");
String xmlStr = FileUtils.readFileToString(file);
Document document = DocumentHelper.parseText(xmlStr);
Map<String, String> maps = getParentElementMaps(document);
Set<String> sets = maps.keySet();
Iterator<String> keys = sets.iterator();
boolean flag = false;
for (; keys.hasNext(); ) {
String key = keys.next();
String value = maps.get(key);
String fullPath = value + "." + key;
if (fullPath.indexOf("UndrlygCstmrCdtTrf") > -1
&& StringUtil.isNotEmpty(getXmlNodeValue(document, fullPath))){
flag = true;
break;
}
}
System.out.println(flag);
}
}
......@@ -24,4 +24,9 @@ statement.entry.valueDate=\u5bf9\u8d26\u5355\u8d77\u606f\u65e5
statement.entry.crdr=\u5bf9\u8d26\u5355\u501f\u8d37\u6807\u8bc6
statement.entry.ccy=\u5bf9\u8d26\u5355\u5e01\u79cd
statement.entry.amt=\u5bf9\u8d26\u5355\u91d1\u989d
statement.entry.endToEndId=\u5bf9\u8d26\u5355\u76f8\u5173\u4ea4\u6613\u6807\u8bc6
\ No newline at end of file
statement.entry.endToEndId=\u5bf9\u8d26\u5355\u76f8\u5173\u4ea4\u6613\u6807\u8bc6
#
message.id=\u4e1a\u52a1\u7f16\u53f7
endToEnd.id=\u7aef\u5230\u7aef\u6807\u8bc6
uetr=UETR\u6807\u8bc6
......@@ -4,7 +4,7 @@
:13C:/SNDTIME/1935+0800
:13C:/RNCTIME/2035+0800
:13C:/CLSTIME/2135+0800
:32A:220402USD120274,34
:32A:220402USD21874,50
:52A:/S15612345678012345
ZASXCDFV
:53A:DEUTNL2A
......@@ -16,7 +16,7 @@ QWERFDSA
ASDFEDRF
:58A:/S15612345678012345
ZXCVDEWS
:72:/INS/QWERFDSA
:72:/INS/QWERFDSA123345
/PHONBEN/456
/TELE/ins123
-}
\ No newline at end of file
{1:F01DEUTNL2AAXXX1250744501}{2:O2021010200908DEUTDEFFAXXX05825258281728220418N}{3:{121:8a562c67-ca16-48ba-b074-65581be6f001}{119:COV}}{4:
:20:00010013800002001234
:21:end456
:13C:/SNDTIME/1235+0800
:13C:/RNCTIME/1335+0800
:13C:/CLSTIME/1435+0800
:32A:220402USD120274,34
:52D:/S15612345678012345
QWER
12
234
123
:53A:DEUTNL2A
:54A:/S15612345678012345
DEUTDEFF
:56A:/S15612345678012345
AQWSFRED
:57A:AQWSDERF
:58A:ZXCDQWER
:72:/INS/5555555
/PHONBEN/456
/TELE/ins123
:50A:/S15612345678012345
ANYBIC01
:52A:/S123
QWERTYUI
:56C://CH789465123132165
:57A:/S15612345678012345
ASDFRTEW
:59:/S15612345678012345
33333333
11
22
33
:70:1111
:33B:USD120274,34
{1:F01HELSFIHHXXXX0000000000}{2:O2020000991231NDEAFIHHXXXX00000000009912310000N}{3:{119:COV}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:pacs9bizmsgidr02
:21:pacs8bizmsgidr01
:32A:210517EUR1500000,
:52A:RBOSGB2L
:57A:HELSFIHH
:58A:OKOYFIHH
:72:/BNF/Invoice: 456-9663
:50F:/123456789
1/A Debiter
2/280 Bishopsgate
3/GB/London
:52A:RBOSGB2L
:56A:HELSFIHH
:57A:OKOYFIHH
:59F:1/Z Krediter
2/Antinkatu 11
3/FI/Pori
-}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--<?xml version="1.0" encoding="UTF-8"?>-->
<!--
THE MESSAGE WILL WORK “AS IS” IN THE READINESS PORTAL. IT IS ESSENTIAL THAT USERS REMOVE THE ENVELOPE AND REPLACE IT WITH THEIR OWN TRANSPORT HEADER (FOR EXAMPLE FOR ALLIANCE ACCESS YOU WOULD USE THE XML V2 HEADERS).
=========================================================================================================================================================================================
......@@ -12,7 +12,7 @@ Change Log
2020-10-16 - Original version
=============================
-->
<Envelope xmlns="urn:swift:xsd:envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:swift:xsd:envelope ../../../../March21Schemas/Translator_envelope.xsd">
<!--<Envelope xmlns="urn:swift:xsd:envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Fr>
<FIId>
......@@ -32,7 +32,7 @@ Change Log
<MsgDefIdr>pacs.008.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2021-04-09T09:00:00+01:00</CreDt>
</AppHdr>
</AppHdr>-->
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">
<FIToFICstmrCdtTrf>
<GrpHdr>
......@@ -88,10 +88,14 @@ Change Log
<Ctry>BG</Ctry>
</PstlAdr>
</Cdtr>
<Purp>
<Cd>CDDP</Cd>
<!--<Prtry>:26T:AA1</Prtry>-->
</Purp>
<RmtInf>
<Ustrd>SWEEP 454-9663</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</FIToFICstmrCdtTrf>
</Document>
</Envelope>
<!--</Envelope>-->
<?xml version="1.0" encoding="UTF-8"?>
<!--
THE MESSAGE WILL WORK “AS IS” IN THE READINESS PORTAL. IT IS ESSENTIAL THAT USERS REMOVE THE ENVELOPE AND REPLACE IT WITH THEIR OWN TRANSPORT HEADER (FOR EXAMPLE FOR ALLIANCE ACCESS YOU WOULD USE THE XML V2 HEADERS).
=========================================================================================================================================================================================
Legal Disclaimer:
=================
SWIFT © 2020. All rights reserved.
This publication contains SWIFT or third-party confidential information. Do not disclose this publication outside your organisation without SWIFT’s prior written consent.
The use of this document is governed by the legal notices appearing at the end of this document. By using this document, you will be deemed to have accepted those legal notices.
=================================================================================================================================================================================
Use Case p.9.1.2 Toronto Dominion US provides a notification to Creditor Agent (E) NatWest using a pacs.009 advice
========================================================================================================================
Change Log
2021-06-30 - Original version
=============================
-->
<Envelope xmlns="urn:swift:xsd:envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:swift:xsd:envelope ../../../../March21Schemas_ADV/Translator_envelope.xsd">
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02">
<Fr>
<FIId>
<FinInstnId>
<BICFI>TDOMUS33</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>NWBKGB2L</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>pacs9bizmsgidr01</BizMsgIdr>
<MsgDefIdr>pacs.009.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.adv.02</BizSvc>
<CreDt>2021-04-27T10:00:47-04:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.08">
<FICdtTrf>
<GrpHdr>
<MsgId>pacs9bizmsgidr01</MsgId>
<CreDtTm>2021-04-27T10:00:47-04:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<SttlmInf>
<SttlmMtd>COVE</SttlmMtd>
<InstgRmbrsmntAgt>
<FinInstnId>
<BICFI>TDOMCATT</BICFI>
</FinInstnId>
</InstgRmbrsmntAgt>
<InstdRmbrsmntAgt>
<FinInstnId>
<BICFI>ROYCCAT2</BICFI>
</FinInstnId>
</InstdRmbrsmntAgt>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>pacs9bizmsgidr01</InstrId>
<EndToEndId>pacs009EndToEndId-001</EndToEndId>
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</PmtId>
<IntrBkSttlmAmt Ccy="CAD">2565972</IntrBkSttlmAmt>
<IntrBkSttlmDt>2021-04-27</IntrBkSttlmDt>
<InstgAgt>
<FinInstnId>
<BICFI>TDOMUS33</BICFI>
</FinInstnId>
</InstgAgt>
<InstdAgt>
<FinInstnId>
<BICFI>NWBKGB2L</BICFI>
</FinInstnId>
</InstdAgt>
<Dbtr>
<FinInstnId>
<BICFI>CWBKCA61</BICFI>
</FinInstnId>
</Dbtr>
<Cdtr>
<FinInstnId>
<BICFI>RBOSGB2L</BICFI>
</FinInstnId>
</Cdtr>
</CdtTrfTxInf>
</FICdtTrf>
</Document>
</Envelope>
......@@ -6,7 +6,7 @@ SWIFT © 2020. All rights reserved.
This publication contains SWIFT or third-party confidential information. Do not disclose this publication outside your organisation without SWIFT’s prior written consent.
The use of this document is governed by the legal notices appearing at the end of this document. By using this document, you will be deemed to have accepted those legal notices.
====================================================================================================================================================================
Use Case p.9.2.1 Agent A RBS plc sends a pacs.009 to Agent B Nordea Finland
Use Case p.9.2.1 Agent B Nordea Finland sends a pacs.009 to Agent C Danske Bank
========================================================================================================================
Change Log
2020-10-16 - Original version
......@@ -17,27 +17,27 @@ Change Log
<Fr>
<FIId>
<FinInstnId>
<BICFI>RBOSGB2L</BICFI>
<BICFI>NDEAFIHH</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>NDEAFIHH</BICFI>
<BICFI>HELSFIHH</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>pacs9bizmsgidr01</BizMsgIdr>
<BizMsgIdr>pacs9bizmsgidr02</BizMsgIdr>
<MsgDefIdr>pacs.009.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.cov.02</BizSvc>
<CreDt>2021-05-17T10:13:41.00+00:00</CreDt>
<CreDt>2021-05-17T10:23:41.00+01:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.08">
<FICdtTrf>
<GrpHdr>
<MsgId>pacs9bizmsgidr01</MsgId>
<CreDtTm>2021-05-17T10:13:41.00+00:00</CreDtTm>
<MsgId>pacs9bizmsgidr02</MsgId>
<CreDtTm>2021-05-17T10:23:41.00+01:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<SttlmInf>
<SttlmMtd>INDA</SttlmMtd>
......@@ -45,7 +45,7 @@ Change Log
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>pacs9bizmsgidr01</InstrId>
<InstrId>pacs9bizmsgidr02</InstrId>
<EndToEndId>pacs8bizmsgidr01</EndToEndId>
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</PmtId>
......@@ -53,12 +53,12 @@ Change Log
<IntrBkSttlmDt>2021-05-17</IntrBkSttlmDt>
<InstgAgt>
<FinInstnId>
<BICFI>RBOSGB2L</BICFI>
<BICFI>NDEAFIHH</BICFI>
</FinInstnId>
</InstgAgt>
<InstdAgt>
<FinInstnId>
<BICFI>NDEAFIHH</BICFI>
<BICFI>HELSFIHH</BICFI>
</FinInstnId>
</InstdAgt>
<Dbtr>
......@@ -66,11 +66,6 @@ Change Log
<BICFI>RBOSGB2L</BICFI>
</FinInstnId>
</Dbtr>
<DbtrAgt>
<FinInstnId>
<BICFI>NDEAFIHH</BICFI>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BICFI>HELSFIHH</BICFI>
......
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Envelope xmlns="urn:swift:xsd:envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:swift:xsd:envelope ../../../../Schemas/Translator_envelope.xsd">
<AppHdr xmlns="urn:iso:std:iso:20022:tech:xsd:head.001.001.02">
<Fr>
<FIId>
<FinInstnId>
<BICFI>DEUTDEFF</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>DEUTNL2A</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>pacs8bizmsgidr02</BizMsgIdr>
<MsgDefIdr>pacs.009.001.02</MsgDefIdr>
<BizSvc>swift.cbprplus.02</BizSvc>
<CreDt>2020-09-08T10:10:47+08:00</CreDt>
</AppHdr>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pacs.009.001.09">
<FinInstnCdtTrf>
<GrpHdr>
<MsgId>00010013800002001234</MsgId>
<CreDtTm>2022-04-02T13:35:04.807+08:00</CreDtTm>
<NbOfTxs>EODY</NbOfTxs>
<SttlmInf>
<InstgRmbrsmntAgt>
<FinInstnId>
<BIC>DEUTNL2A</BIC>
<Nm>NUM123</Nm>
</FinInstnId>
</InstgRmbrsmntAgt>
<InstdRmbrsmntAgt>
<FinInstnId>
<BIC>DEUTDEFF</BIC>
<Nm>NUM123</Nm>
</FinInstnId>
</InstdRmbrsmntAgt>
<InstdRmbrsmntAgtAcct>
<Id>
<IBAN>S15612345678012345</IBAN>
<Othr>
<Id>789465123132165</Id>
<SchmeNm>
<Cd>BBAN</Cd>
</SchmeNm>
</Othr>
</Id>
</InstdRmbrsmntAgtAcct>
</SttlmInf>
<InstgAgt>
<FinInstnId>
<BIC>DEUTNL2A</BIC>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
<AdrLine>55</AdrLine>
</PstlAdr>
</FinInstnId>
</InstgAgt>
<InstdAgt>
<FinInstnId>
<BIC>DEUTDEFF</BIC>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
<AdrLine>55</AdrLine>
</PstlAdr>
</FinInstnId>
</InstdAgt>
</GrpHdr>
<CdtTrfTxInf>
<CdtrAgtAcct>
<Id>
<IBAN>S15612345678012345</IBAN>
<Othr>
<Id>789465123132165</Id>
<SchmeNm>
<Cd>BBAN</Cd>
</SchmeNm>
</Othr>
</Id>
</CdtrAgtAcct>
<CdtrAcct>
<Id>
<IBAN>S15612345678012345</IBAN>
<Othr>
<Id>789465123132165</Id>
<SchmeNm>
<Cd>BBAN</Cd>
</SchmeNm>
</Othr>
</Id>
</CdtrAcct>
<PrvsInstgAgt>
<FinInstnId>
<BIC>QWERFDSA</BIC>
<Nm>33333333</Nm>
</FinInstnId>
</PrvsInstgAgt>
<Cdtr>
<FinInstnId>
<BICFI>ZXCVDEWS</BICFI>
<Nm>33333333</Nm>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
</PstlAdr>
</FinInstnId>
</Cdtr>
<CdtrAgt>
<FinInstnId>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
<AdrLine>55</AdrLine>
</PstlAdr>
<BIC>ASDFEDRF</BIC>
<Nm>uiopp</Nm>
</FinInstnId>
</CdtrAgt>
<PmtId>
<EndToEndId>pacs009EndToEndId-001</EndToEndId>
<UETR>8a562c67-ca16-48ba-b074-65581be6f001</UETR>
</PmtId>
<IntrBkSttlmAmt Ccy="USD">120274.34</IntrBkSttlmAmt>
<IntrBkSttlmDt>2022-04-02+08:00</IntrBkSttlmDt>
<SttlmTmIndctn>
<DbtDtTm>2022-04-02T12:35:04.807+01:00</DbtDtTm>
<CdtDtTm>2022-04-02T13:35:04.807+01:00</CdtDtTm>
</SttlmTmIndctn>
<SttlmTmReq>
<CLSTm>14:35:04.807+01:00</CLSTm>
</SttlmTmReq>
<IntrmyAgt1>
<FinInstnId>
<BIC>QWERFDSA</BIC>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
<AdrLine>55</AdrLine>
</PstlAdr>
</FinInstnId>
<ClrSysMmbId>
<MmbId>mmbid01</MmbId>
<ClrSysId>
<Cd>cd02</Cd>
<Prtry>prtry01</Prtry>
</ClrSysId>
</ClrSysMmbId>
</IntrmyAgt1>
<IntrmyAgt1Acct>
<Id>
<IBAN>S15612345678012345</IBAN>
<Othr>
<Id>789465123132165</Id>
<SchmeNm>
<Cd>BBAN</Cd>
</SchmeNm>
</Othr>
</Id>
</IntrmyAgt1Acct>
<Dbtr>
<FinInstnId>
<BIC>ZASXCDFV</BIC>
<Nm>uiopp</Nm>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
<AdrLine>55</AdrLine>
</PstlAdr>
</FinInstnId>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>S15612345678012345</IBAN>
<Othr>
<Id>789465123132165</Id>
<SchmeNm>
<Cd>BBAN</Cd>
</SchmeNm>
</Othr>
</Id>
</DbtrAcct>
<DbtrAgt>
<FinInstnId>
<BIC>ZXCVBVCX</BIC>
<PstlAdr>
<AdrLine>11</AdrLine>
<AdrLine>22</AdrLine>
<AdrLine>33</AdrLine>
<AdrLine>44</AdrLine>
<AdrLine>55</AdrLine>
</PstlAdr>
</FinInstnId>
</DbtrAgt>
<DbtrAgtAcct>
<Id>
<IBAN>S15612345678012345</IBAN>
<Othr>
<Id>789465123132165</Id>
<SchmeNm>
<Cd>BBAN</Cd>
</SchmeNm>
</Othr>
</Id>
</DbtrAgtAcct>
<InstrForCdtrAgt>
<Cd>PHOB</Cd>
<InstrInf>456</InstrInf>
</InstrForCdtrAgt>
<InstrForNxtAgt>
<Cd>TELA</Cd>
<InstrInf>ins123</InstrInf>
</InstrForNxtAgt>
<RmtInf>
<Ustrd>1111</Ustrd>
</RmtInf>
</CdtTrfTxInf>
</FinInstnCdtTrf>
</Document>
</Envelope>
\ No newline at end of file
package com.brilliance.mt2mx.pacs009001;
import com.brilliance.swift.mt2mx.Mt2MxCreatorManager;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public class Test {
private static void test202() throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt202.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
}
private static void test202Cov() throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt202_COV.txt");
String mtStr = FileUtils.readFileToString(file);
String mxXml = new Mt2MxCreatorManager().mt2mx(mtStr, null, null);
System.out.println(mxXml);
}
public static void main(String[] args) throws IOException {
//test202();
test202Cov();
}
}
......@@ -7,7 +7,7 @@ import java.io.File;
public class TestMx2MtFor103 {
public static void main(String[] args) throws Exception {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800109.xml");
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00800108.xml");
String xmlStr = FileUtils.readFileToString(file);
String mt103 = new Mx2MtCreatorManager().mx2Mt(xmlStr, null, null);
System.out.println(mt103);
......
......@@ -7,7 +7,7 @@ import java.io.File;
public class TestMx2MtFor202 {
public static void main(String[] args) throws Exception {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109.xml");
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900108.xml");
String xmlStr = FileUtils.readFileToString(file);
String mt202 = new Mx2MtCreatorManager().mx2Mt(xmlStr, null, null);
System.out.println(mt202);
......
......@@ -7,7 +7,7 @@ import java.io.File;
public class TestMx2MtFor202COV {
public static void main(String[] args) throws Exception {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900109_COV.xml");
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900108_COV.xml");
String xmlStr = FileUtils.readFileToString(file);
String mt202 = new Mx2MtCreatorManager().mx2Mt(xmlStr, null, null);
System.out.println(mt202);
......
......@@ -93,6 +93,6 @@ public class AmountResolver {
log.warning("getComponentAs(" + (component) + ", Number.class) returned null for field " + f);
return null;
}
return new BigDecimal(n.toString());
return new BigDecimal(n.toString()).stripTrailingZeros();
}
}
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