Commit 8e3f2963 by chengzhuoshen

1.swiftDto增加属性version

parent 18c184ec
......@@ -30,6 +30,7 @@ public class Mt2SwiftDtoPCamt053001Creator extends AbstractMt2SwiftDtoCreator {
bankToCustomerStatement.setMessagePriority(swiftDto.getMessagePriority());
bankToCustomerStatement.setUetr(swiftDto.getUetr());
bankToCustomerStatement.setMessageType("camt.053.001");
bankToCustomerStatement.setVersion("08");
context.set(bankToCustomerStatement);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -31,6 +31,7 @@ public class Mt2SwiftDtoPCamt054001Creator extends AbstractMt2SwiftDtoCreator {
bankToCustomerDebitCreditNotification.setMessagePriority(swiftDto.getMessagePriority());
bankToCustomerDebitCreditNotification.setUetr(swiftDto.getUetr());
bankToCustomerDebitCreditNotification.setMessageType("camt.054.001");
bankToCustomerDebitCreditNotification.setVersion("08");
context.set(bankToCustomerDebitCreditNotification);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -29,6 +29,7 @@ public class Mt2SwiftDtoPacs008001Creator extends AbstractMt2SwiftDtoCreator {
customerCreditTransfer.setMessagePriority(swiftDto.getMessagePriority());
customerCreditTransfer.setUetr(swiftDto.getUetr());
customerCreditTransfer.setMessageType("pacs.008.001");
customerCreditTransfer.setVersion("09");
context.set(customerCreditTransfer);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -28,6 +28,7 @@ public class Mt2SwiftDtoPacs009001Creator extends AbstractMt2SwiftDtoCreator {
financialInstitutionCreditTransfer.setMessagePriority(swiftDto.getMessagePriority());
financialInstitutionCreditTransfer.setUetr(swiftDto.getUetr());
financialInstitutionCreditTransfer.setMessageType("pacs.009.001");
financialInstitutionCreditTransfer.setVersion("09");
context.set(financialInstitutionCreditTransfer);
} catch (Exception e) {
throw new SwiftException("ERROR", e.getMessage());
......
......@@ -6,6 +6,8 @@ public class Mx2SwiftDtoContextIdentifier {
public static final String MX_OBJ = "mx.obj";
public static final String MX_VERSION = "mx.version";
public static final String APPHDR_PARENT_ELEMENT_NAME = "apphdr.parent.element.name";
public static final String GRPHDR_PARENT_ELEMENT_NAME = "grphdr.parent.element.name";
......
......@@ -17,6 +17,8 @@ public class Mx2SwiftDtoCreatorManager {
private String msgType = "";
private String version = "";
private Object mxObj = null;
private String xmlStr = "";
......@@ -31,6 +33,7 @@ public class Mx2SwiftDtoCreatorManager {
.replace(".", "");
mxObj = abstractMX;
this.xmlStr = xmlStr;
version = abstractMX.getMxId().getVersion();
}
public SwiftDto convert(String xmlStr, String outPutFilePath, Map<String, Object> extraMap) throws SwiftException {
......@@ -42,6 +45,7 @@ public class Mx2SwiftDtoCreatorManager {
Document document = DocumentHelper.parseText(xmlStr);
context.set(Mx2SwiftDtoContextIdentifier.MX_XMl_DOCUMENT, document);
context.set(Mx2SwiftDtoContextIdentifier.MX_OBJ, mxObj);
context.set(Mx2SwiftDtoContextIdentifier.MX_VERSION, version);
AbstractMx2SwiftDtoCreator creator = getMx2SwiftDtoCreator(msgType);
creator.setContext(context);
creator.preProcess();
......
......@@ -35,6 +35,8 @@ public class Mx2SwiftDtoBTCDCNCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName = parentElementMaps.get("Ntfctn");
bankToCustomerDebitCreditNotification = new BankToCustomerDebitCreditNotification();
bankToCustomerDebitCreditNotification.setMessageType("camt.054.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
bankToCustomerDebitCreditNotification.setVersion(StringUtil.isEmpty(version)?"08":version);
}
@Override
......
......@@ -34,6 +34,8 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName = parentElementMaps.get("Stmt");
bankToCustomerStatement = new BankToCustomerStatement();
bankToCustomerStatement.setMessageType("camt.053.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
bankToCustomerStatement.setVersion(StringUtil.isEmpty(version)?"08":version);
}
@Override
......
......@@ -38,6 +38,8 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName = parentElementMaps.get("CdtTrfTxInf");
customerCreditTransfer = new VoCustomerCreditTransfer();
customerCreditTransfer.setMessageType("pacs.008.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
customerCreditTransfer.setVersion(StringUtil.isEmpty(version)?"09":version);
}
@Override
......
......@@ -34,6 +34,8 @@ public class Mx2SwiftDtoFICTCreator extends AbstractMx2SwiftDtoCreator {
bodyHdrParentElementName = parentElementMaps.get("CdtTrfTxInf");
financialInstitutionCreditTransfer = new VoFinancialInstitutionCreditTransfer();
financialInstitutionCreditTransfer.setMessageType("pacs.009.001");
String version = (String)context.get(Mx2SwiftDtoContextIdentifier.MX_VERSION, true);
financialInstitutionCreditTransfer.setVersion(StringUtil.isEmpty(version)?"09":version);
}
@Override
......
......@@ -13,6 +13,8 @@ public class SwiftDto implements Serializable {
private static final long serialVersionUID = 2296248553989810638L;
protected String messageType;
protected String version;
protected String senderBic;
protected String receiverBic;
......@@ -33,6 +35,14 @@ public class SwiftDto implements Serializable {
this.messageType = messageType;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getSenderBic() {
return senderBic;
}
......
......@@ -2,6 +2,8 @@
"account": {
"account": "15612345678012345"
},
"pgNb": "178",
"elctrncSeqNb": "200",
"openingBalance": {
"code": "ITBD",
"cdtDbtCode": "DBIT",
......
{
"cd": "",
"account": {
"account": "S15612345678012345"
"account": "15612345678012345"
},
"pgNb": "178",
"elctrncSeqNb": "200",
"openingBalance": {
"cd": "ITBD",
"CdtDbtInd": "DBIT",
"code": "ITBD",
"cdtDbtCode": "DBIT",
"date": "2022-03-30 00:00:00,000",
"ccy": "USD",
"amt": 120274.34
"amt": {
"ccy": "USD",
"amt": 120274.34
}
},
"statementLine": [
"reportEntries": [
{
"valueDate": "2022-03-30 00:00:00,000",
"BookDate": "2022-03-30 00:00:00,000",
"cdtDbtInd": "DBIT",
"rvslInd": "false",
"ccy": "USD",
"amt": 393.17,
"transactionType": "F",
"identificationCode": "CHK",
"bookDate": "2022-03-30 00:00:00,000",
"cdtDbtCode": "DBIT",
"amt": {
"ccy": "USD",
"amt": 393.17
},
"bankTransactionCodeStructure": {
"domianCode": "PMNT",
"familyCode": "ICHQ",
"subFamilyCode": "CCHQ"
},
"endToEndId": "S100000189-735",
"acctSvcrRef": "1309170100000390154395",
"addtlTxInf": "PLACI LOVECNAMENSKIH WUHAN"
},
{
"valueDate": "2022-03-30 00:00:00,000",
"BookDate": "2022-03-30 00:00:00,000",
"cdtDbtInd": "DBIT",
"rvslInd": "false",
"ccy": "USD",
"amt": 445,
"transactionType": "F",
"identificationCode": "CHK",
"bookDate": "2022-03-30 00:00:00,000",
"cdtDbtCode": "DBIT",
"amt": {
"ccy": "USD",
"amt": 445
},
"bankTransactionCodeStructure": {
"domianCode": "PMNT",
"familyCode": "ICHQ",
"subFamilyCode": "CCHQ"
},
"endToEndId": "S100000189-735",
"acctSvcrRef": "1309170100000390154395",
"addtlTxInf": "PLACI LOVECNAMENSKIH STORITEV"
}
],
"closingBalance": {
"cd": "ITBD",
"CdtDbtInd": "DBIT",
"code": "ITBD",
"cdtDbtCode": "DBIT",
"date": "2022-03-30 00:00:00,000",
"ccy": "USD",
"amt": 123456.29
"amt": {
"ccy": "USD",
"amt": 123456.29
}
},
"messageType": "camt.053.001",
"version": "08",
"senderBic": "SHWHQWER123",
"receiverBic": "BJWHS12X",
"createDate": "2022-04-28 10:24:00,960",
"createDate": "2022-05-07 11:39:42,601",
"messagePriority": "NORM",
"messageId": "00010013800002001234",
"uetr": "8a562c67-ca16-48ba-b074-65581be6f001"
}
}
\ No newline at end of file
{1:F01BJWHS12XAXXX7583545445}{2:O9401023220428SHWHQWERA12348676666142205051522N}{3:{108:2205051522140540}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:00010013800002001234
:25:S15612345678012345
:28:178/200
:28C:178/200
:60M:D220330USD120274,34
:61:220330220330CUSD393,17FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH WUHAN
......
{1:F01BJWHS12XAXXX3202321018}{2:O9401024220428SHWHQWERA12308503578012205051522N}{3:{108:2205051522260719}{121:8a562c67-ca16-48ba-b074-65581be6f001}}{4:
:20:00010013800002001234
:25:S15612345678012345
:28:178/200
:28C:178/200
:60M:D220330USD120274,34
:61:220330220330DUSD393,17FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH WUHAN
......
package com.brilliance.mt2swiftdto.pacs008001;
import com.brilliance.swift.SwiftTransfer;
import java.io.File;
public class TestPacs008001 {
public static void main(String[] args) throws Exception {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT103.txt");
//String xmlStr = new Mt2MxCreateManager().mt2mx(file, "d:/test/pacs008.xml", null);
//System.out.println(xmlStr);
//SwiftDto swiftDto = new Mt2MxCreateManager().mt2SwiftDto(file, "d:/test/pacs008.txt");
// SwiftDto swiftDto = new Mt2MxCreateManager().mt2SwiftDto(file, "D:/test/CustomerCreditTransfer.json");
//System.out.println(swiftDto.toString());
SwiftTransfer.mt2SwiftDto(file, "D:/test/CustomerCreditTransfer.json", null);
}
}
package com.brilliance.swiftdto2mt.mt940;
import com.brilliance.swift.SwiftTransfer;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Test {
public static void main(String[] args) {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftJson\\BankToCustomerStatement.json");
String mtStr = SwiftTransfer.swiftDto2Mt(file, "D:/SwiftToMt/MT940.txt", null);
System.out.println(mtStr);
public static void main(String[] args) throws IOException {
File file = new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\BankTransactionCode.Properties");
List<String> strings = FileUtils.readLines(file);
Map<String, String> maps = new HashMap<>();
for (String s : strings) {
if (!s.startsWith("#")) {
String[] arr = s.split("=");
if (arr.length == 2) {
maps.put(arr[0], arr[1]);
}
}
}
maps.forEach((k,v)->System.out.println(k + "=" + v));
}
}
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