Commit 1be338cb by jianglong

Merge branch 'ncbgjzf' of http://114.115.138.98:8900/swift/swiftMtMx into ncbgjzf

parents 2b86b5f4 a81d2957
......@@ -4,8 +4,8 @@ import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.mx2mt.AbstractMx2MtCreator;
import com.brilliance.swift.mx2mt.Mx2MtContextIdentifier;
import com.brilliance.swift.mx2mt.Mx2MtTagsGenerate;
import com.brilliance.swift.mx2mt.mt103.impl.*;
import com.brilliance.swift.mx2mt.mt204.impl.Field20Generate;
import com.brilliance.swift.mx2mt.mt204.impl.SeqAField19Generate;
import com.brilliance.swift.mx2mt.mt204.impl.SeqAField20Generate;
import com.brilliance.swift.util.XmlUtil;
import org.dom4j.Document;
......@@ -29,8 +29,8 @@ public class Mx2Mt204Creator extends AbstractMx2MtCreator {
@Override
public List<Mx2MtTagsGenerate> getGenerateTagList() {
List<Mx2MtTagsGenerate> fieldsGenerateList = new ArrayList<>();
fieldsGenerateList.add(new Field20Generate());
fieldsGenerateList.add(new SeqAField20Generate());
fieldsGenerateList.add(new SeqAField19Generate());
return fieldsGenerateList;
}
......
package com.brilliance.swift.mx2mt.mt204.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.util.NumberUtil;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.Tag;
import java.math.BigDecimal;
import java.util.List;
public class SeqAField19Generate extends AbstractMx2MtTagsGenerate {
private static final String NAME = "19";
@Override
public void tagGenerate() throws SwiftException {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String intrBkSttlmAmt = "";
String settleAmount = getXmlNodeValue(bodyHdrParentElementName, document, "CdtInstr.DrctDbtTxInf.IntrBkSttlmAmt");
String settleCcy = getXmlNodeValue(bodyHdrParentElementName, document, "CdtInstr.DrctDbtTxInf.IntrBkSttlmAmt@Ccy");
if (StringUtil.isNotEmpty(settleAmount) && StringUtil.isNotEmpty(settleCcy)) {
intrBkSttlmAmt = NumberUtil.formatAmt(new BigDecimal(settleAmount), settleCcy);
}
if (StringUtil.isNotEmpty(intrBkSttlmAmt)) {
tags.add(new Tag(NAME, intrBkSttlmAmt));
}
}
}
package com.brilliance.swift.mx2mt.mt204.impl;
import com.brilliance.swift.constants.Mx2MtConstants;
import com.brilliance.swift.exception.SwiftException;
import com.brilliance.swift.mx2mt.AbstractMx2MtTagsGenerate;
import com.brilliance.swift.util.StringUtil;
import com.prowidesoftware.swift.model.SwiftMessage;
import com.prowidesoftware.swift.model.SwiftTagListBlock;
import com.prowidesoftware.swift.model.Tag;
import com.prowidesoftware.swift.model.mt.AbstractMT;
import java.util.List;
public class Field20Generate extends AbstractMx2MtTagsGenerate {
public class SeqAField20Generate extends AbstractMx2MtTagsGenerate {
private static final String NAME = "20";
@Override
public void tagGenerate() throws SwiftException {
SwiftMessage swiftMessage = context.get(SwiftMessage.class);
// AbstractMT abstractMT = context.get(AbstractMT.class);
//SwiftTagListBlock blockA=new SwiftTagListBlock();
//swiftMessage.getBlock4().append(blockA);
List<Tag> tags = swiftMessage.getBlock4().getTags();
String messageId = getXmlNodeValue(bodyHdrParentElementName, document, "CdtInstr.CdtId");
String orgMessageId = getXmlNodeValue(bodyHdrParentElementName, document, "CdtInstr.CdtId");
String messageId=orgMessageId;
if (StringUtil.isNotEmpty(messageId)) {
if(messageId.matches("(/.*)|(.*/)|(.*//.*)")){
messageId= Mx2MtConstants.MX_TO_MT_DEFAULT_VALUE;
buildSTErrorInfo(42,"Block4/:20",orgMessageId);
}
if (messageId.length() > 16) {
buildSTErrorInfo(13, "Block4/:20:", messageId);
messageId = messageId.substring(0, 15) + "+";
......
......@@ -47,7 +47,7 @@
<NbOfTxs>1</NbOfTxs>
</GrpHdr>
<CdtInstr>
<CdtId>2023020815114929</CdtId>
<CdtId>2023020815114921</CdtId>
<InstgAgt>
<FinInstnId>
<BICFI>HSBCHKHHUSI</BICFI>
......@@ -89,7 +89,7 @@
<Prtry>SI Direct Debit or Credit</Prtry>
</CtgyPurp>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="USD">1000</IntrBkSttlmAmt>
<IntrBkSttlmAmt Ccy="USD">1000.78</IntrBkSttlmAmt>
<IntrBkSttlmDt>2023-02-08</IntrBkSttlmDt>
<Dbtr>
<FinInstnId>
......
......@@ -195,15 +195,15 @@ public class Mx2MtTest {
@Test
//Invalid message type
public void test204() {
//test("/swiftXml/pacs.010.xml",null);
MT204 mt204=new MT204();
test("/swiftXml/pacs.010.xml",null);
/* MT204 mt204=new MT204();
MT204.SequenceA sequenceA=MT204.SequenceA.newInstance(new Tag("20","SA123"),new Tag("19","123"),new Tag("30","240820"));
mt204.append(sequenceA);
MT204.SequenceB sequenceB=MT204.SequenceB.newInstance(new Tag("20","SB123"),new Tag("53A","PSBCCNBJXXX"));
mt204.append(sequenceB);
System.out.println(mt204.message());
System.out.println(mt204.message());*/
}
......
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