Commit adafc165 by chengzhuoshen

修改MX报文53域展示逻辑

parent 6d83f025
......@@ -5,6 +5,10 @@ import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.util.MessageUtil;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.common.CdtDbtCode;
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.mt.AbstractMT;
import java.util.LinkedHashMap;
import java.util.Map;
......@@ -182,4 +186,36 @@ public abstract class AbstractMx2MapCreator implements Mx2MapCreator{
}
return null;
}
/**
* 53域 特殊处理
* @param targetMaps
* @param abstractMT
*/
protected void buildInstgRmbrsmntAgtInfo(Map<String, Object> targetMaps, AbstractMT abstractMT) {
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("53A");
if (tag != null) {
Map<String, Object> newMaps = new LinkedHashMap<>();
targetMaps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("instgRmbrsmntAgtInfo"), newMaps);
Field53A field53A = (Field53A)tag.asField();
String bicCode = field53A.getBIC();
if (StringUtil.isNotEmpty(bicCode)) {
newMaps.put(getPropertyValue("bicfi"), bicCode);
}
String account = field53A.getComponent2();
if (StringUtil.isNotEmpty(account)) {
newMaps.put(getPropertyValue("acctId"), account);
}
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("53B");
if (tag != null) {
Map<String, Object> newMaps = new LinkedHashMap<>();
targetMaps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("instgRmbrsmntAgtInfo"), newMaps);
Field53B field53B = (Field53B)tag.asField();
String account = field53B.getComponent2();
if (StringUtil.isNotEmpty(account)) {
newMaps.put(getPropertyValue("acctId"), account);
}
}
}
}
......@@ -4,7 +4,7 @@ import com.brilliance.swift.SwiftTransfer;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.AbstractMx2MapCreator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.common.SettlementMethodCode;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
......@@ -80,7 +80,19 @@ public class Mx2MapPacs008Creator extends AbstractMx2MapCreator {
}
buildPartyInfo(maps,"dbtr", elementMaps);
buildAgentInfo(maps, "dbtrAgt", elementMaps);
buildAgentInfo(maps, "instgRmbrsmntAgt", elementMaps);
AbstractMT abstractMT = null;
try {
String mtMessage = SwiftTransfer.mx2Mt(xmlStr, null, null);
abstractMT = AbstractMT.parse(mtMessage);
} catch (IOException e) {
throw new SwiftException(e.getMessage());
}
if (SettlementMethodCode.INGA.value().equals(elementMaps.get("sttlmMtd"))
|| SettlementMethodCode.INDA.value().equals(elementMaps.get("sttlmMtd"))) {
buildInstgRmbrsmntAgtInfo(maps, abstractMT);
} else {
buildAgentInfo(maps, "instgRmbrsmntAgt", elementMaps);
}
buildAgentInfo(maps, "instdRmbrsmntAgt", elementMaps);
buildAgentInfo(maps, "thrdRmbrsmntAgt", elementMaps);
buildAgentInfo(maps, "intrmyAgt1", elementMaps);
......@@ -101,25 +113,17 @@ public class Mx2MapPacs008Creator extends AbstractMx2MapCreator {
}
}
}
try {
String mtMessage = SwiftTransfer.mx2Mt(xmlStr, null, null);
if (StringUtil.isNotEmpty(mtMessage)) {
AbstractMT abstractMT = AbstractMT.parse(mtMessage);
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("70");
if (tag != null) {
maps.put(getPropertyValue("remittanceInformation"), tag.getValue());
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("72");
if (tag != null) {
maps.put(getPropertyValue("txnRemark"), tag.getValue());
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("77B");
if (tag != null) {
maps.put(getPropertyValue("regulatoryReporting"), tag.getValue());
}
}
} catch (IOException e) {
throw new SwiftException(e.getMessage());
Tag tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("70");
if (tag != null) {
maps.put(getPropertyValue("remittanceInformation"), tag.getValue());
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("72");
if (tag != null) {
maps.put(getPropertyValue("txnRemark"), tag.getValue());
}
tag = abstractMT.getSwiftMessage().getBlock4().getTagByName("77B");
if (tag != null) {
maps.put(getPropertyValue("regulatoryReporting"), tag.getValue());
}
return maps;
}
......
......@@ -5,15 +5,14 @@ import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2map.AbstractMx2MapCreator;
import com.brilliance.swift.util.StringUtil;
import com.brilliance.swift.vo.common.SettlementMethodCode;
import com.prowidesoftware.swift.model.SwiftTagListBlock;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class Mx2MapPacs009Creator extends AbstractMx2MapCreator {
......@@ -69,11 +68,6 @@ public class Mx2MapPacs009Creator extends AbstractMx2MapCreator {
}
}
buildAgentInfo(maps,"dbtr", elementMaps, "dbtrAgtInfo");
buildAgentInfo(maps,"instgRmbrsmntAgt", elementMaps);
buildAgentInfo(maps,"instdRmbrsmntAgt", elementMaps);
buildAgentInfo(maps,"intrmyAgt1", elementMaps);
buildAgentInfo(maps,"cdtrAgt", elementMaps, "cdtrAgtAcctInfo");
buildAgentInfo(maps,"cdtr", elementMaps, "cdtrAgtInfo");
AbstractMT abstractMT = null;
try {
String mtMessage = SwiftTransfer.mx2Mt(xmlStr, null, null);
......@@ -83,6 +77,16 @@ public class Mx2MapPacs009Creator extends AbstractMx2MapCreator {
} catch (IOException e) {
throw new SwiftException(e.getMessage());
}
if (SettlementMethodCode.INGA.value().equals(elementMaps.get("sttlmMtd"))
|| SettlementMethodCode.INDA.value().equals(elementMaps.get("sttlmMtd"))) {
buildInstgRmbrsmntAgtInfo(maps, abstractMT);
} else {
buildAgentInfo(maps, "instgRmbrsmntAgt", elementMaps);
}
buildAgentInfo(maps,"instdRmbrsmntAgt", elementMaps);
buildAgentInfo(maps,"intrmyAgt1", elementMaps);
buildAgentInfo(maps,"cdtrAgt", elementMaps, "cdtrAgtAcctInfo");
buildAgentInfo(maps,"cdtr", elementMaps, "cdtrAgtInfo");
Tag tag = getTagByName(abstractMT, "72", "A");
if (tag != null) {
maps.put(Mx2MtConstants.NEW_LINE + getPropertyValue("txnRemark"), tag.getValue());
......
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