Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftMtMx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
isc-v3.1-tmp
swiftMtMx
Commits
18c184ec
Commit
18c184ec
authored
May 07, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.完成MX2MT 202<>pacs009001相互转换
2.优化MX2MT 940/950
parent
392516f6
Show whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
1462 additions
and
1030 deletions
+1462
-1030
Camt053001Parse20Field.java
...t/mt2SwiftDto/camt053001/impl/Camt053001Parse20Field.java
+13
-13
Camt053001Parse25aField.java
.../mt2SwiftDto/camt053001/impl/Camt053001Parse25aField.java
+14
-22
Camt053001Parse28CField.java
.../mt2SwiftDto/camt053001/impl/Camt053001Parse28CField.java
+13
-12
Camt053001Parse60aField.java
.../mt2SwiftDto/camt053001/impl/Camt053001Parse60aField.java
+46
-42
Camt053001Parse61Field.java
...t/mt2SwiftDto/camt053001/impl/Camt053001Parse61Field.java
+93
-61
Camt053001Parse62aField.java
.../mt2SwiftDto/camt053001/impl/Camt053001Parse62aField.java
+49
-41
Camt053001Parse64Field.java
...t/mt2SwiftDto/camt053001/impl/Camt053001Parse64Field.java
+26
-39
Camt053001Parse65Field.java
...t/mt2SwiftDto/camt053001/impl/Camt053001Parse65Field.java
+14
-19
Camt053001Parse86Field.java
...t/mt2SwiftDto/camt053001/impl/Camt053001Parse86Field.java
+9
-7
Field61ListGenerate.java
...liance/swift/mx2mt/mt940950/impl/Field61ListGenerate.java
+2
-0
AbstractMx2SwiftDtoCreator.java
...lliance/swift/mx2swiftdto/AbstractMx2SwiftDtoCreator.java
+93
-23
Mx2SwiftDtoBTCSCreator.java
...e/swift/mx2swiftdto/bankcusta/Mx2SwiftDtoBTCSCreator.java
+67
-158
Mx2SwiftDtoFICTCreator.java
...ift/mx2swiftdto/fininstcdttsf/Mx2SwiftDtoFICTCreator.java
+214
-4
Tag21Generate.java
...rilliance/swift/swiftdto2mt/mt202/impl/Tag21Generate.java
+2
-0
SwiftDto2Mt940950Creator.java
.../swift/swiftdto2mt/mt940950/SwiftDto2Mt940950Creator.java
+16
-8
Tag25aGenerate.java
...iance/swift/swiftdto2mt/mt940950/impl/Tag25aGenerate.java
+4
-2
Tag60aGenerate.java
...iance/swift/swiftdto2mt/mt940950/impl/Tag60aGenerate.java
+23
-22
Tag61Generate.java
...liance/swift/swiftdto2mt/mt940950/impl/Tag61Generate.java
+91
-54
Tag62aGenerate.java
...iance/swift/swiftdto2mt/mt940950/impl/Tag62aGenerate.java
+23
-21
Tag64Generate.java
...liance/swift/swiftdto2mt/mt940950/impl/Tag64Generate.java
+19
-16
Tag65Generate.java
...liance/swift/swiftdto2mt/mt940950/impl/Tag65Generate.java
+21
-26
Tag86Generate.java
...liance/swift/swiftdto2mt/mt940950/impl/Tag86Generate.java
+3
-7
AbstractSwiftDto2MxCreator.java
...lliance/swift/swiftdto2mx/AbstractSwiftDto2MxCreator.java
+51
-0
SwiftDto2MxCamt053001Creator.java
...ftdto2mx/camt053001/v08/SwiftDto2MxCamt053001Creator.java
+100
-164
BankToCustomerStatement.java
...java/com/brilliance/swift/vo/BankToCustomerStatement.java
+51
-56
BalDto.java
.../src/main/java/com/brilliance/swift/vo/common/BalDto.java
+0
-61
BalTypeEnum.java
...main/java/com/brilliance/swift/vo/common/BalTypeEnum.java
+0
-26
BalanceTypeCode.java
.../java/com/brilliance/swift/vo/common/BalanceTypeCode.java
+20
-0
BankTransactionCodeStructure.java
...lliance/swift/vo/common/BankTransactionCodeStructure.java
+88
-0
CashBalance.java
...main/java/com/brilliance/swift/vo/common/CashBalance.java
+52
-0
CdtDbtCode.java
.../main/java/com/brilliance/swift/vo/common/CdtDbtCode.java
+24
-0
ReportEntry.java
...main/java/com/brilliance/swift/vo/common/ReportEntry.java
+22
-57
BankTransactionCode.Properties
swiftCore/src/main/resources/BankTransactionCode.Properties
+36
-0
BankToCustomerStatement.json
...src/main/resources/swiftJson/BankToCustomerStatement.json
+43
-31
MT940.txt
swiftCore/src/main/resources/swiftTxt/MT940.txt
+12
-6
MT950.txt
swiftCore/src/main/resources/swiftTxt/MT950.txt
+4
-3
MxPacs00900102.xml
swiftCore/src/main/resources/swiftXml/MxPacs00900102.xml
+6
-6
MxPacs00900102_COV.xml
swiftCore/src/main/resources/swiftXml/MxPacs00900102_COV.xml
+11
-11
Test940Camt053001.java
...va/com/brilliance/mt2mx/camt053001/Test940Camt053001.java
+26
-0
Test.java
...e/src/test/java/com/brilliance/mt2mx/pacs009001/Test.java
+27
-0
Test940Camt053001.java
.../brilliance/mt2swiftdto/camt053001/Test940Camt053001.java
+1
-1
Test950Camt053001.java
.../brilliance/mt2swiftdto/camt053001/Test950Camt053001.java
+1
-1
TestMx2MtFor202.java
...test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202.java
+3
-4
TestMx2MtFor202COV.java
...t/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202COV.java
+4
-5
Test.java
...t/java/com/brilliance/mx2swiftdto/fininstcdttsf/Test.java
+24
-0
Text940camt053001.java
.../brilliance/swiftdto2mx/camt053001/Text940camt053001.java
+1
-1
No files found.
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse20Field.java
View file @
18c184ec
...
@@ -17,23 +17,23 @@ public class Camt053001Parse20Field extends AbstractMt2SwiftDtoParseFields {
...
@@ -17,23 +17,23 @@ public class Camt053001Parse20Field extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
Field20
field20
=
getField20
();
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
if
(
field20
!=
null
)
{
Field20
field20
=
mt940
.
getField20
();
if
(
field20
!=
null
){
bankToCustomerStatement
.
setMessageId
(
field20
.
getValue
());
bankToCustomerStatement
.
setMessageId
(
field20
.
getValue
());
bankToCustomerStatement
.
setCd
(
"FWAV"
);
}
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
Field20
field20
=
mt950
.
getField20
();
if
(
field20
!=
null
){
bankToCustomerStatement
.
setMessageId
(
field20
.
getValue
());
bankToCustomerStatement
.
setCd
(
""
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
private
Field20
getField20
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField20
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField20
();
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse25aField.java
View file @
18c184ec
...
@@ -2,9 +2,7 @@ package com.brilliance.swift.mt2SwiftDto.camt053001.impl;
...
@@ -2,9 +2,7 @@ package com.brilliance.swift.mt2SwiftDto.camt053001.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.PartyAccount
;
import
com.prowidesoftware.swift.model.field.Field25
;
import
com.prowidesoftware.swift.model.field.Field25
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
...
@@ -19,29 +17,23 @@ public class Camt053001Parse25aField extends AbstractMt2SwiftDtoParseFields {
...
@@ -19,29 +17,23 @@ public class Camt053001Parse25aField extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
Field25
field25
=
getField25
();
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
if
(
field25
!=
null
)
{
Field25
field25
=
mt940
.
getField25
();
bankToCustomerStatement
.
setAccount
(
buildPartyAccount
(
field25
.
getValue
()));
if
(
field25
!=
null
){
PartyAccount
account
=
new
PartyAccount
();
if
(
SwiftTransferUtil
.
checkIbanAccount
(
field25
.
getValue
()))
{
account
.
setIbanAcct
(
field25
.
getValue
());
}
else
{
account
.
setAccount
(
field25
.
getValue
());
}
bankToCustomerStatement
.
setAccount
(
account
);
}
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
Field25
field25
=
mt950
.
getField25
();
if
(
field25
!=
null
){
PartyAccount
account
=
new
PartyAccount
();
account
.
setAccount
(
field25
.
getValue
());
bankToCustomerStatement
.
setAccount
(
account
);
}
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
private
Field25
getField25
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField25
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField25
();
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse28CField.java
View file @
18c184ec
...
@@ -17,24 +17,25 @@ public class Camt053001Parse28CField extends AbstractMt2SwiftDtoParseFields {
...
@@ -17,24 +17,25 @@ public class Camt053001Parse28CField extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
Field28C
field28C
=
getField28C
();
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
if
(
field28C
!=
null
){
Field28C
field28C
=
mt940
.
getField28C
();
if
(
field28C
!=
null
){
bankToCustomerStatement
.
setPgNb
(
field28C
.
getStatementNumber
());
bankToCustomerStatement
.
setElctrncSeqNb
(
field28C
.
getSequenceNumber
());
}
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
Field28C
field28C
=
mt950
.
getField28C
();
if
(
field28C
!=
null
){
bankToCustomerStatement
.
setPgNb
(
field28C
.
getStatementNumber
());
bankToCustomerStatement
.
setPgNb
(
field28C
.
getStatementNumber
());
bankToCustomerStatement
.
setElctrncSeqNb
(
field28C
.
getSequenceNumber
());
bankToCustomerStatement
.
setElctrncSeqNb
(
field28C
.
getSequenceNumber
());
}
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
private
Field28C
getField28C
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField28C
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField28C
();
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse60aField.java
View file @
18c184ec
...
@@ -4,8 +4,8 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -4,8 +4,8 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.
BalDto
;
import
com.brilliance.swift.vo.common.
*
;
import
com.prowidesoftware.swift.model.field.
DateContainer
;
import
com.prowidesoftware.swift.model.field.
Field60F
;
import
com.prowidesoftware.swift.model.field.Field60M
;
import
com.prowidesoftware.swift.model.field.Field60M
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
...
@@ -20,51 +20,55 @@ public class Camt053001Parse60aField extends AbstractMt2SwiftDtoParseFields {
...
@@ -20,51 +20,55 @@ public class Camt053001Parse60aField extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
Field60F
field60F
=
getField60F
();
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
if
(
field60F
!=
null
)
{
if
(
mt940
.
getField60F
()!=
null
){
CashBalance
cashBalance
=
new
CashBalance
();
cashBalance
.
setCode
(
BalanceTypeCode
.
PRCD
);
}
else
if
(
mt940
.
getField60M
()!=
null
){
cashBalance
.
setCdtDbtCode
(
"D"
.
equals
(
field60F
.
getDCMark
())?
CdtDbtCode
.
DBIT
:
CdtDbtCode
.
CRDT
);
Field60M
field60M
=
mt940
.
getField60M
();
cashBalance
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field60F
.
getDate
(),
"yyyyMMdd"
));
BalDto
balDto
=
new
BalDto
();
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
balDto
.
setCd
(
"ITBD"
);
ccyFormatAmount
.
setCcy
(
field60F
.
getCurrency
());
String
dcMark
=
field60M
.
getDCMark
();
ccyFormatAmount
.
setAmt
(
field60F
.
amount
());
if
(
"D"
.
equals
(
dcMark
)){
cashBalance
.
setAmt
(
ccyFormatAmount
);
balDto
.
setCdtDbtInd
(
"DBIT"
);
bankToCustomerStatement
.
setOpeningBalance
(
cashBalance
);
}
else
if
(
"C"
.
equals
(
dcMark
))
{
}
else
{
balDto
.
setCdtDbtInd
(
"CRDT"
);
Field60M
field60M
=
getField60M
();
}
else
{
if
(
field60M
!=
null
)
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
CashBalance
cashBalance
=
new
CashBalance
();
cashBalance
.
setCode
(
BalanceTypeCode
.
ITBD
);
cashBalance
.
setCdtDbtCode
(
"D"
.
equals
(
field60M
.
getDCMark
())?
CdtDbtCode
.
DBIT
:
CdtDbtCode
.
CRDT
);
cashBalance
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field60M
.
getDate
(),
"yyyyMMdd"
));
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
ccyFormatAmount
.
setCcy
(
field60M
.
getCurrency
());
ccyFormatAmount
.
setAmt
(
field60M
.
amount
());
cashBalance
.
setAmt
(
ccyFormatAmount
);
bankToCustomerStatement
.
setOpeningBalance
(
cashBalance
);
}
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field60M
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field60M
.
getCurrency
());
balDto
.
setAmt
(
field60M
.
amount
());
bankToCustomerStatement
.
setOpenBalance
(
balDto
);
}
}
}
else
{
}
catch
(
Exception
e
){
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
if
(
mt950
.
getField60F
()!=
null
){
}
else
if
(
mt950
.
getField60M
()!=
null
){
Field60M
field60M
=
mt950
.
getField60M
();
BalDto
balDto
=
new
BalDto
();
balDto
.
setCd
(
"ITBD"
);
String
dcMark
=
field60M
.
getDCMark
();
if
(
"D"
.
equals
(
dcMark
)){
balDto
.
setCdtDbtInd
(
"DBIT"
);
}
else
if
(
"C"
.
equals
(
dcMark
))
{
balDto
.
setCdtDbtInd
(
"CRDT"
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field60M
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field60M
.
getCurrency
());
balDto
.
setAmt
(
field60M
.
amount
());
bankToCustomerStatement
.
setOpenBalance
(
balDto
);
}
}
private
Field60F
getField60F
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField60F
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField60F
();
}
}
}
catch
(
Exception
e
){
}
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
private
Field60M
getField60M
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField60M
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField60M
();
}
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse61Field.java
View file @
18c184ec
...
@@ -3,94 +3,126 @@ package com.brilliance.swift.mt2SwiftDto.camt053001.impl;
...
@@ -3,94 +3,126 @@ package com.brilliance.swift.mt2SwiftDto.camt053001.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.statementBreakdown
;
import
com.brilliance.swift.vo.common.BankTransactionCodeStructure
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.brilliance.swift.vo.common.ReportEntry
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field61
;
import
com.prowidesoftware.swift.model.field.Field61
;
import
com.prowidesoftware.swift.model.field.Field86
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
org.apache.commons.io.FileUtils
;
import
com.prowidesoftware.swift.model.mt9xx.MT950
;
import
java.util.ArrayList
;
import
java.io.File
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* @author zh
* @author zh
* @create 2022-04-24 14:59
* @create 2022-04-24 14:59
*/
*/
public
class
Camt053001Parse61Field
extends
AbstractMt2SwiftDtoParseFields
{
public
class
Camt053001Parse61Field
extends
AbstractMt2SwiftDtoParseFields
{
private
String
name_61
=
"61"
;
private
String
name_86
=
"86"
;
@Override
@Override
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
List
<
Tag
>
tags
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTags
();
List
<
Field61
>
field61List
=
mt940
.
getField61
();
if
(
tags
.
size
()
>
0
)
{
List
<
String
>
Message86List
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
List
<
Tag
>
tags
=
mt940
.
getSwiftMessage
().
getBlock4
().
getTags
();
Tag
tag
=
tags
.
get
(
i
);
for
(
int
i
=
0
;
i
<
tags
.
size
();
i
++)
{
if
(
name_61
.
equals
(
tag
.
getName
()))
{
if
(
tags
.
get
(
i
).
getName
().
equals
(
"61"
)){
Field61
field61
=
new
Field61
(
tag
.
getValue
());
if
(
tags
.
get
(
i
+
1
).
getName
().
equals
(
"86"
)){
ReportEntry
reportEntry
=
new
ReportEntry
();
Message86List
.
add
(
tags
.
get
(
i
+
1
).
getValue
());
reportEntry
.
setValueDate
(
DateUtil
.
parseDate
(
"20"
+
field61
.
getValueDate
(),
"yyyyMMdd"
));
}
else
{
reportEntry
.
setBookDate
(
DateUtil
.
parseDate
(
"20"
+
field61
.
getEntryDate
(),
"yyyyMMdd"
));
Message86List
.
add
(
"no"
);
String
dcMark
=
field61
.
getDCMark
();
if
(
"C"
.
equals
(
dcMark
))
{
reportEntry
.
setCdtDbtCode
(
CdtDbtCode
.
CRDT
);
}
else
if
(
"RC"
.
equals
(
dcMark
))
{
reportEntry
.
setCdtDbtCode
(
CdtDbtCode
.
CRDT
);
reportEntry
.
setReversalIndicator
(
true
);
}
else
if
(
"D"
.
equals
(
dcMark
))
{
reportEntry
.
setCdtDbtCode
(
CdtDbtCode
.
DBIT
);
}
else
if
(
"RD"
.
equals
(
dcMark
))
{
reportEntry
.
setCdtDbtCode
(
CdtDbtCode
.
DBIT
);
reportEntry
.
setReversalIndicator
(
true
);
}
}
String
ccy
=
field61
.
getFundsCode
();
BigDecimal
amt
=
field61
.
amount
();
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
ccyFormatAmount
.
setCcy
(
ccy
);
ccyFormatAmount
.
setAmt
(
amt
);
reportEntry
.
setAmt
(
ccyFormatAmount
);
String
txnType
=
field61
.
getTransactionType
();
String
identificationCode
=
field61
.
getIdentificationCode
();
String
mxCode
=
getDomainCodeByIdentyCode
(
identificationCode
);
if
(
StringUtil
.
isNotEmpty
(
mxCode
))
{
BankTransactionCodeStructure
bankTransactionCodeStructure
=
new
BankTransactionCodeStructure
();
String
[]
mxCodes
=
mxCode
.
split
(
"_"
);
bankTransactionCodeStructure
.
setDomianCode
(
mxCodes
[
0
]);
bankTransactionCodeStructure
.
setFamilyCode
(
mxCodes
[
1
]);
bankTransactionCodeStructure
.
setSubFamilyCode
(
mxCodes
[
2
]);
reportEntry
.
setBankTransactionCodeStructure
(
bankTransactionCodeStructure
);
}
else
{
BankTransactionCodeStructure
bankTransactionCodeStructure
=
new
BankTransactionCodeStructure
();
bankTransactionCodeStructure
.
setCode
(
txnType
+
identificationCode
);
reportEntry
.
setBankTransactionCodeStructure
(
bankTransactionCodeStructure
);
}
}
reportEntry
.
setEndToEndId
(
field61
.
getReferenceForTheAccountOwner
());
reportEntry
.
setAcctSvcrRef
(
field61
.
getReferenceOfTheAccountServicingInstitution
());
reportEntry
.
setAddtlTxInf
(
field61
.
getSupplementaryDetails
());
if
(
name_86
.
equals
(
tags
.
get
(
i
+
1
).
getName
()))
{
Field86
field86
=
new
Field86
(
tags
.
get
(
i
+
1
).
getValue
());
reportEntry
.
setAddtlNtryInf
(
field86
.
getValue
().
replace
(
"\r\n"
,
""
));
}
}
if
(
field61List
.
size
()>
0
)
{
bankToCustomerStatement
.
addReportEntry
(
reportEntry
);
for
(
int
i
=
0
;
i
<
field61List
.
size
();
i
++)
{
statementBreakdown
statementBreakdown
=
new
statementBreakdown
();
statementBreakdown
.
setValueDate
(
DateUtil
.
parseDate
(
"20"
+
field61List
.
get
(
i
).
getValueDate
(),
"yyyyMMdd"
));
statementBreakdown
.
setBookDate
(
DateUtil
.
parseDate
(
"20"
+
field61List
.
get
(
i
).
getEntryDate
(),
"yyyyMMdd"
));
String
dcMark
=
field61List
.
get
(
i
).
getDCMark
();
if
(
"D"
.
equals
(
dcMark
)||
"RC"
.
equals
(
dcMark
)){
statementBreakdown
.
setCdtDbtInd
(
"DBIT"
);
}
else
if
(
"C"
.
equals
(
dcMark
)||
"RD"
.
equals
(
dcMark
))
{
statementBreakdown
.
setCdtDbtInd
(
"CRDT"
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
statementBreakdown
.
setCcy
(
field61List
.
get
(
i
).
getFundsCode
());
statementBreakdown
.
setAmt
(
field61List
.
get
(
i
).
amount
());
statementBreakdown
.
setTransactionType
(
field61List
.
get
(
i
).
getTransactionType
());
statementBreakdown
.
setIdentificationCode
(
field61List
.
get
(
i
).
getIdentificationCode
());
statementBreakdown
.
setEndToEndId
(
field61List
.
get
(
i
).
getReferenceForTheAccountOwner
());
statementBreakdown
.
setAcctSvcrRef
(
field61List
.
get
(
i
).
getReferenceOfTheAccountServicingInstitution
());
statementBreakdown
.
setAddtlTxInf
(
field61List
.
get
(
i
).
getSupplementaryDetails
());
if
(!
Message86List
.
get
(
i
).
equals
(
"no"
)){
statementBreakdown
.
setAddtlNtryInf
(
Message86List
.
get
(
i
));
}
}
bankToCustomerStatement
.
addStatementLine
(
statementBreakdown
);
}
}
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
List
<
Field61
>
field61List
=
mt950
.
getField61
();
if
(
field61List
.
size
()>
0
)
{
for
(
int
i
=
0
;
i
<
field61List
.
size
();
i
++)
{
statementBreakdown
statementBreakdown
=
new
statementBreakdown
();
statementBreakdown
.
setValueDate
(
DateUtil
.
parseDate
(
"20"
+
field61List
.
get
(
i
).
getValueDate
(),
"yyyyMMdd"
));
statementBreakdown
.
setBookDate
(
DateUtil
.
parseDate
(
"20"
+
field61List
.
get
(
i
).
getEntryDate
(),
"yyyyMMdd"
));
String
dcMark
=
field61List
.
get
(
i
).
getDCMark
();
if
(
"D"
.
equals
(
dcMark
)||
"RC"
.
equals
(
dcMark
)){
statementBreakdown
.
setCdtDbtInd
(
"DBIT"
);
}
else
if
(
"C"
.
equals
(
dcMark
)||
"RD"
.
equals
(
dcMark
))
{
statementBreakdown
.
setCdtDbtInd
(
"CRDT"
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
statementBreakdown
.
setCcy
(
field61List
.
get
(
i
).
getFundsCode
());
statementBreakdown
.
setAmt
(
field61List
.
get
(
i
).
amount
());
statementBreakdown
.
setTransactionType
(
field61List
.
get
(
i
).
getTransactionType
());
/**
statementBreakdown
.
setIdentificationCode
(
field61List
.
get
(
i
).
getIdentificationCode
());
* 得到Domain FamilyCode SubFamilyCode,从BankTransactionCode.Properties文件获取
statementBreakdown
.
setEndToEndId
(
field61List
.
get
(
i
).
getReferenceForTheAccountOwner
());
* @return
statementBreakdown
.
setAcctSvcrRef
(
field61List
.
get
(
i
).
getReferenceOfTheAccountServicingInstitution
());
*/
statementBreakdown
.
setAddtlTxInf
(
field61List
.
get
(
i
).
getSupplementaryDetails
());
private
String
getDomainCodeByIdentyCode
(
String
identyCode
)
{
bankToCustomerStatement
.
addStatementLine
(
statementBreakdown
);
try
{
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
].
trim
(),
arr
[
1
].
trim
());
}
}
}
}
}
}
}
catch
(
Exception
e
)
{
String
mxCode
=
""
;
for
(
String
key
:
maps
.
keySet
())
{
if
(
maps
.
get
(
key
).
equals
(
identyCode
))
{
mxCode
=
key
;
break
;
}
}
return
mxCode
;
}
catch
(
IOException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse62aField.java
View file @
18c184ec
...
@@ -4,7 +4,11 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -4,7 +4,11 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CashBalance
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.field.Field62F
;
import
com.prowidesoftware.swift.model.field.Field62M
;
import
com.prowidesoftware.swift.model.field.Field62M
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
...
@@ -19,51 +23,55 @@ public class Camt053001Parse62aField extends AbstractMt2SwiftDtoParseFields {
...
@@ -19,51 +23,55 @@ public class Camt053001Parse62aField extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
Field62F
field62F
=
getField62F
();
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
if
(
field62F
!=
null
)
{
if
(
mt940
.
getField62F
()!=
null
){
CashBalance
cashBalance
=
new
CashBalance
();
cashBalance
.
setCode
(
BalanceTypeCode
.
CLBD
);
}
else
if
(
mt940
.
getField62M
()!=
null
){
cashBalance
.
setCdtDbtCode
(
"D"
.
equals
(
field62F
.
getDCMark
())?
CdtDbtCode
.
DBIT
:
CdtDbtCode
.
CRDT
);
Field62M
field62M
=
mt940
.
getField62M
();
cashBalance
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field62F
.
getDate
(),
"yyyyMMdd"
));
BalDto
balDto
=
new
BalDto
();
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
balDto
.
setCd
(
"ITBD"
);
ccyFormatAmount
.
setCcy
(
field62F
.
getCurrency
());
String
dcMark
=
field62M
.
getDCMark
();
ccyFormatAmount
.
setAmt
(
field62F
.
amount
());
if
(
"D"
.
equals
(
dcMark
)){
cashBalance
.
setAmt
(
ccyFormatAmount
);
balDto
.
setCdtDbtInd
(
"DBIT"
);
bankToCustomerStatement
.
setClosingBalance
(
cashBalance
);
}
else
if
(
"C"
.
equals
(
dcMark
))
{
}
else
{
balDto
.
setCdtDbtInd
(
"CRDT"
);
Field62M
field62M
=
getField62M
();
}
else
{
if
(
field62M
!=
null
)
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
CashBalance
cashBalance
=
new
CashBalance
();
cashBalance
.
setCode
(
BalanceTypeCode
.
ITBD
);
cashBalance
.
setCdtDbtCode
(
"D"
.
equals
(
field62M
.
getDCMark
())?
CdtDbtCode
.
DBIT
:
CdtDbtCode
.
CRDT
);
cashBalance
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field62M
.
getDate
(),
"yyyyMMdd"
));
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
ccyFormatAmount
.
setCcy
(
field62M
.
getCurrency
());
ccyFormatAmount
.
setAmt
(
field62M
.
amount
());
cashBalance
.
setAmt
(
ccyFormatAmount
);
bankToCustomerStatement
.
setClosingBalance
(
cashBalance
);
}
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field62M
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field62M
.
getCurrency
());
balDto
.
setAmt
(
field62M
.
amount
());
bankToCustomerStatement
.
setClosingBalance
(
balDto
);
}
}
}
else
{
}
catch
(
Exception
e
){
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
if
(
mt950
.
getField62F
()!=
null
){
}
else
if
(
mt950
.
getField62M
()!=
null
){
Field62M
field62M
=
mt950
.
getField62M
();
BalDto
balDto
=
new
BalDto
();
balDto
.
setCd
(
"ITBD"
);
String
dcMark
=
field62M
.
getDCMark
();
if
(
"D"
.
equals
(
dcMark
)){
balDto
.
setCdtDbtInd
(
"DBIT"
);
}
else
if
(
"C"
.
equals
(
dcMark
))
{
balDto
.
setCdtDbtInd
(
"CRDT"
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field62M
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field62M
.
getCurrency
());
balDto
.
setAmt
(
field62M
.
amount
());
bankToCustomerStatement
.
setClosingBalance
(
balDto
);
}
}
private
Field62F
getField62F
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField62F
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField62F
();
}
}
}
catch
(
Exception
e
){
}
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
private
Field62M
getField62M
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField62M
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField62M
();
}
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse64Field.java
View file @
18c184ec
...
@@ -4,7 +4,10 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -4,7 +4,10 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CashBalance
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.field.Field64
;
import
com.prowidesoftware.swift.model.field.Field64
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
...
@@ -19,47 +22,31 @@ public class Camt053001Parse64Field extends AbstractMt2SwiftDtoParseFields {
...
@@ -19,47 +22,31 @@ public class Camt053001Parse64Field extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
Field64
field64
=
getField64
();
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
if
(
field64
!=
null
)
{
Field64
field64
=
mt940
.
getField64
();
CashBalance
cashBalance
=
new
CashBalance
();
if
(
field64
!=
null
)
{
cashBalance
.
setCode
(
BalanceTypeCode
.
CLAV
);
BalDto
balDto
=
new
BalDto
();
cashBalance
.
setCdtDbtCode
(
"D"
.
equals
(
field64
.
getDCMark
())?
CdtDbtCode
.
DBIT
:
CdtDbtCode
.
CRDT
);
balDto
.
setCd
(
"CLAV"
);
cashBalance
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field64
.
getDate
(),
"yyyyMMdd"
));
String
dcMark
=
field64
.
getDCMark
();
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
if
(
"D"
.
equals
(
dcMark
)){
ccyFormatAmount
.
setCcy
(
field64
.
getCurrency
());
balDto
.
setCdtDbtInd
(
"DBIT"
);
ccyFormatAmount
.
setAmt
(
field64
.
amount
());
}
else
if
(
"C"
.
equals
(
dcMark
))
{
cashBalance
.
setAmt
(
ccyFormatAmount
);
balDto
.
setCdtDbtInd
(
"CRDT"
);
bankToCustomerStatement
.
setClosingAvailableBalance
(
cashBalance
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field64
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field64
.
getCurrency
());
balDto
.
setAmt
(
field64
.
amount
());
bankToCustomerStatement
.
setClosingAvailableBalance
(
balDto
);
}
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
Field64
field64
=
mt950
.
getField64
();
if
(
field64
!=
null
)
{
BalDto
balDto
=
new
BalDto
();
balDto
.
setCd
(
"CLAV"
);
String
dcMark
=
field64
.
getDCMark
();
if
(
"D"
.
equals
(
dcMark
)){
balDto
.
setCdtDbtInd
(
"DBIT"
);
}
else
if
(
"C"
.
equals
(
dcMark
))
{
balDto
.
setCdtDbtInd
(
"CRDT"
);
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field64
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field64
.
getCurrency
());
balDto
.
setAmt
(
field64
.
amount
());
bankToCustomerStatement
.
setClosingAvailableBalance
(
balDto
);
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
private
Field64
getField64
()
{
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(
"940"
.
equals
(
abstractMT
.
getMessageType
()))
{
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
return
mt940
.
getField64
();
}
else
{
MT950
mt950
=
(
MT950
)
context
.
get
(
AbstractMT
.
class
);
return
mt950
.
getField64
();
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse65Field.java
View file @
18c184ec
...
@@ -4,7 +4,7 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -4,7 +4,7 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.mt2SwiftDto.AbstractMt2SwiftDtoParseFields
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.
BalDto
;
import
com.brilliance.swift.vo.common.
*
;
import
com.prowidesoftware.swift.model.field.Field65
;
import
com.prowidesoftware.swift.model.field.Field65
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
...
@@ -20,26 +20,21 @@ public class Camt053001Parse65Field extends AbstractMt2SwiftDtoParseFields {
...
@@ -20,26 +20,21 @@ public class Camt053001Parse65Field extends AbstractMt2SwiftDtoParseFields {
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
if
(!
"940"
.
equals
(
abstractMT
.
getMessageType
()))
return
;
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
List
<
Field65
>
field65List
=
mt940
.
getField65
();
List
<
Field65
>
field65List
=
mt940
.
getField65
();
if
(
field65List
.
size
()>
0
){
if
(
field65List
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
field65List
.
size
();
i
++)
{
for
(
Field65
field65
:
field65List
)
{
BalDto
balDto
=
new
BalDto
();
CashBalance
cashBalance
=
new
CashBalance
();
balDto
.
setCd
(
"FWAV"
);
cashBalance
.
setCode
(
BalanceTypeCode
.
FWAV
);
String
dcMark
=
field65List
.
get
(
i
).
getDCMark
();
cashBalance
.
setCdtDbtCode
(
"D"
.
equals
(
field65
.
getDCMark
())?
CdtDbtCode
.
DBIT
:
CdtDbtCode
.
CRDT
);
if
(
"D"
.
equals
(
dcMark
)){
cashBalance
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field65
.
getDate
(),
"yyyyMMdd"
));
balDto
.
setCdtDbtInd
(
"DBIT"
);
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
}
else
if
(
"C"
.
equals
(
dcMark
))
{
ccyFormatAmount
.
setCcy
(
field65
.
getCurrency
());
balDto
.
setCdtDbtInd
(
"CRDT"
);
ccyFormatAmount
.
setAmt
(
field65
.
amount
());
}
else
{
cashBalance
.
setAmt
(
ccyFormatAmount
);
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
bankToCustomerStatement
.
addForwardAvailableBalance
(
cashBalance
);
}
balDto
.
setDate
(
DateUtil
.
parseDate
(
"20"
+
field65List
.
get
(
i
).
getDate
(),
"yyyyMMdd"
));
balDto
.
setCcy
(
field65List
.
get
(
i
).
getCurrency
());
balDto
.
setAmt
(
field65List
.
get
(
i
).
amount
());
bankToCustomerStatement
.
addForwardAvailableBalance
(
balDto
);
}
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mt2SwiftDto/camt053001/impl/Camt053001Parse86Field.java
View file @
18c184ec
...
@@ -6,9 +6,7 @@ import com.brilliance.swift.vo.BankToCustomerStatement;
...
@@ -6,9 +6,7 @@ import com.brilliance.swift.vo.BankToCustomerStatement;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field86
;
import
com.prowidesoftware.swift.model.field.Field86
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
com.prowidesoftware.swift.model.mt9xx.MT940
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -16,15 +14,19 @@ import java.util.List;
...
@@ -16,15 +14,19 @@ import java.util.List;
* @create 2022-04-24 14:59
* @create 2022-04-24 14:59
*/
*/
public
class
Camt053001Parse86Field
extends
AbstractMt2SwiftDtoParseFields
{
public
class
Camt053001Parse86Field
extends
AbstractMt2SwiftDtoParseFields
{
private
String
name
=
"86"
;
@Override
@Override
public
void
parseFields
()
throws
SwiftException
{
public
void
parseFields
()
throws
SwiftException
{
try
{
try
{
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
BankToCustomerStatement
bankToCustomerStatement
=
context
.
get
(
BankToCustomerStatement
.
class
);
if
(
context
.
get
(
AbstractMT
.
class
).
getMessageType
().
equals
(
"940"
)){
AbstractMT
abstractMT
=
context
.
get
(
AbstractMT
.
class
);
MT940
mt940
=
(
MT940
)
context
.
get
(
AbstractMT
.
class
);
List
<
Tag
>
tags
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
mt940
.
getSwiftMessage
().
getBlock4
().
getTags
();
if
(
tags
.
size
()
>
0
)
{
if
(
tags
.
get
(
tags
.
size
()-
1
).
getName
().
equals
(
"86"
)){
if
(
name
.
equals
(
tags
.
get
(
tags
.
size
()-
1
).
getName
()))
{
bankToCustomerStatement
.
addAddtlStmtInf
(
tags
.
get
(
tags
.
size
()-
1
).
getValue
());
Field86
field86
=
new
Field86
(
tags
.
get
(
tags
.
size
()-
1
).
getValue
());
bankToCustomerStatement
.
setAdditionalStatementInformation
(
field86
.
getValue
().
replace
(
"\r\n"
,
""
));
}
}
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2mt/mt940950/impl/Field61ListGenerate.java
View file @
18c184ec
...
@@ -112,4 +112,6 @@ public class Field61ListGenerate extends AbstractMx2MtFieldsGenerate{
...
@@ -112,4 +112,6 @@ public class Field61ListGenerate extends AbstractMx2MtFieldsGenerate{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/AbstractMx2SwiftDtoCreator.java
View file @
18c184ec
package
com
.
brilliance
.
swift
.
mx2swiftdto
;
package
com
.
brilliance
.
swift
.
mx2swiftdto
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.vo.common.*
;
import
com.brilliance.swift.vo.common.*
;
import
com.prowidesoftware.swift.model.mx.dic.*
;
import
org.dom4j.Document
;
import
org.dom4j.Document
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
abstract
class
AbstractMx2SwiftDtoCreator
implements
Mx2SwiftDtoCreator
{
public
abstract
class
AbstractMx2SwiftDtoCreator
implements
Mx2SwiftDtoCreator
{
...
@@ -25,6 +29,10 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
...
@@ -25,6 +29,10 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
protected
String
bodyHdrParentElementName
;
protected
String
bodyHdrParentElementName
;
protected
String
defaultFormate
=
"yyyy-MM-dd HH:mm:ss,SSS"
;
protected
String
defaultDateFormate
=
"yyyy-MM-dd"
;
protected
String
getXmlNodeValue
(
String
parentPath
,
Document
document
,
String
path
)
{
protected
String
getXmlNodeValue
(
String
parentPath
,
Document
document
,
String
path
)
{
if
(
StringUtil
.
isNotEmpty
(
parentPath
))
{
if
(
StringUtil
.
isNotEmpty
(
parentPath
))
{
...
@@ -143,6 +151,13 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
...
@@ -143,6 +151,13 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
return
partyDto
;
return
partyDto
;
}
}
/**
* CashAccount38
* @param type
* @param document
* @param agtAcctPath
* @return
*/
protected
PartyAccount
acctConvertPartyAcct
(
String
type
,
Document
document
,
String
agtAcctPath
)
{
protected
PartyAccount
acctConvertPartyAcct
(
String
type
,
Document
document
,
String
agtAcctPath
)
{
String
account
=
getXmlNodeValue
(
type
,
document
,
agtAcctPath
+
".Id.Othr.Id"
);
String
account
=
getXmlNodeValue
(
type
,
document
,
agtAcctPath
+
".Id.Othr.Id"
);
String
ibanAcct
=
getXmlNodeValue
(
type
,
document
,
agtAcctPath
+
".Id.IBAN"
);
String
ibanAcct
=
getXmlNodeValue
(
type
,
document
,
agtAcctPath
+
".Id.IBAN"
);
...
@@ -175,33 +190,88 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
...
@@ -175,33 +190,88 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
return
partyAccount
;
return
partyAccount
;
}
}
protected
PartyDto
convertPartyDto
(
BranchAndFinancialInstitutionIdentification6
agt
,
CashAccount38
agtAcct
)
{
/**
if
(
agt
==
null
&&
agtAcct
==
null
)
{
* 根据下标转BalanceCash
return
null
;
* @param parentPath
}
* @param document
PartyDto
partyDto
=
new
PartyDto
();
* @param balancePath
if
(
agt
!=
null
)
{
* @param index
FinancialInstitutionIdentification18
finInstnId
=
agt
.
getFinInstnId
();
* @return
if
(
finInstnId
!=
null
)
{
*/
partyDto
.
setPartyBic
(
finInstnId
.
getBICFI
());
protected
CashBalance
convertCashBalanceByIndex
(
String
parentPath
,
Document
document
,
String
balancePath
,
int
index
)
{
partyDto
.
setPartyName
(
finInstnId
.
getNm
());
try
{
if
(
finInstnId
.
getPstlAdr
()
!=
null
)
{
CashBalance
cashBalance
=
null
;
partyDto
.
getAddressList
().
addAll
(
finInstnId
.
getPstlAdr
().
getAdrLine
());
int
cashBalanceCount
=
getXmlNodeCounts
(
parentPath
,
document
,
balancePath
);
if
(
cashBalanceCount
>
index
)
{
int
i
=
index
-
1
;
cashBalance
=
new
CashBalance
();
String
code
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Tp.CdOrPrtry.Cd"
);
String
proprietary
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Tp.CdOrPrtry.Prtry"
);
String
cdtDbtCode
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".CdtDbtInd"
);
String
dateStr
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Dt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
Date
date
=
DateUtil
.
parseDate
(
dateStr
,
defaultDateFormate
);
cashBalance
.
setDate
(
date
);
}
}
ClearingSystemMemberIdentification2
clrSysMmbId
=
finInstnId
.
getClrSysMmbId
(
);
String
ccy
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Amt@Ccy"
);
if
(
clrSysMmbId
!=
null
)
{
String
amtStr
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Amt"
);
ClearingSystemMember
clrSysMmb
=
new
ClearingSystemMember
();
if
(
StringUtil
.
isNotEmpty
(
ccy
)
&&
StringUtil
.
isNotEmpty
(
amtStr
))
{
C
learingSystemIdentification2Choice
clrSysId
=
clrSysMmbId
.
getClrSysId
();
C
cyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
if
(
clrSysId
!=
null
)
{
ccyFormatAmount
.
setCcy
(
ccy
);
clrSysMmb
.
setCode
(
clrSysId
.
getCd
(
));
ccyFormatAmount
.
setAmt
(
new
BigDecimal
(
amtStr
));
clrSysMmb
.
setProprietary
(
clrSysId
.
getPrtry
()
);
cashBalance
.
setAmt
(
ccyFormatAmount
);
}
}
clrSysMmb
.
setId
(
clrSysMmbId
.
getMmbId
());
cashBalance
.
setCode
(
BalanceTypeCode
.
valueOf
(
code
));
partyDto
.
setClrSysMmb
(
clrSysMmb
);
cashBalance
.
setProprietary
(
proprietary
);
cashBalance
.
setCdtDbtCode
(
CdtDbtCode
.
valueOf
(
cdtDbtCode
));
}
}
return
cashBalance
;
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
return
partyDto
;
/**
* 根据类型转BalanceCash
* @param parentPath
* @param document
* @param balancePath
* @param balanceType
* @return
*/
protected
List
<
CashBalance
>
convertCashBalanceByType
(
String
parentPath
,
Document
document
,
String
balancePath
,
BalanceTypeCode
balanceTypeCode
)
{
try
{
List
<
CashBalance
>
cashBalances
=
new
ArrayList
<>();
int
cashBalanceCount
=
getXmlNodeCounts
(
parentPath
,
document
,
balancePath
);
if
(
cashBalanceCount
>
0
)
{
for
(
int
i
=
0
;
i
<
cashBalanceCount
;
i
++)
{
String
code
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Tp.CdOrPrtry.Cd"
);
if
(
balanceTypeCode
.
value
().
equals
(
code
))
{
CashBalance
cashBalance
=
new
CashBalance
();
String
proprietary
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Tp.CdOrPrtry.Prtry"
);
String
cdtDbtCode
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".CdtDbtInd"
);
String
dateStr
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Dt.Dt"
);
Date
date
=
DateUtil
.
parseDate
(
dateStr
,
defaultDateFormate
);
String
ccy
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Amt@Ccy"
);
String
amtStr
=
getXmlNodeValue
(
parentPath
,
document
,
balancePath
+
"("
+
i
+
")"
+
".Amt"
);
if
(
StringUtil
.
isNotEmpty
(
ccy
)
&&
StringUtil
.
isNotEmpty
(
amtStr
))
{
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
ccyFormatAmount
.
setCcy
(
ccy
);
ccyFormatAmount
.
setAmt
(
new
BigDecimal
(
amtStr
));
cashBalance
.
setAmt
(
ccyFormatAmount
);
}
cashBalance
.
setCode
(
BalanceTypeCode
.
valueOf
(
code
));
cashBalance
.
setProprietary
(
proprietary
);
cashBalance
.
setCdtDbtCode
(
CdtDbtCode
.
valueOf
(
cdtDbtCode
));
cashBalance
.
setDate
(
date
);
cashBalances
.
add
(
cashBalance
);
}
}
}
return
cashBalances
;
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/bankcusta/Mx2SwiftDtoBTCSCreator.java
View file @
18c184ec
...
@@ -6,10 +6,8 @@ import com.brilliance.swift.mx2swiftdto.Mx2SwiftDtoContextIdentifier;
...
@@ -6,10 +6,8 @@ import com.brilliance.swift.mx2swiftdto.Mx2SwiftDtoContextIdentifier;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.vo.BankToCustomerDebitCreditNotification
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.*
;
import
com.brilliance.swift.vo.common.*
;
import
com.prowidesoftware.swift.model.mx.dic.Value
;
import
org.dom4j.Document
;
import
org.dom4j.Document
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeConfigurationException
;
...
@@ -19,6 +17,7 @@ import java.io.File;
...
@@ -19,6 +17,7 @@ import java.io.File;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -26,8 +25,6 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
...
@@ -26,8 +25,6 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
private
BankToCustomerStatement
bankToCustomerStatement
=
null
;
private
BankToCustomerStatement
bankToCustomerStatement
=
null
;
private
String
defaultFormate
=
"yyyy-MM-dd HH:mm:ss,SSS"
;
@Override
@Override
public
void
preProcess
()
throws
SwiftException
{
public
void
preProcess
()
throws
SwiftException
{
document
=
(
Document
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_XMl_DOCUMENT
,
true
);
document
=
(
Document
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_XMl_DOCUMENT
,
true
);
...
@@ -67,7 +64,8 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
...
@@ -67,7 +64,8 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
@Override
@Override
public
void
groupHeader
()
throws
SwiftException
{
public
void
groupHeader
()
throws
SwiftException
{
String
pgNb
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"GrpHdr.MsgPgntn.PgNb"
);
bankToCustomerStatement
.
setPgNb
(
pgNb
);
}
}
@Override
@Override
...
@@ -75,165 +73,76 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
...
@@ -75,165 +73,76 @@ public class Mx2SwiftDtoBTCSCreator extends AbstractMx2SwiftDtoCreator {
try
{
try
{
//UETR
//UETR
String
uetr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry.NtryDtls.TxDtls.Refs.UETR"
);
String
uetr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry.NtryDtls.TxDtls.Refs.UETR"
);
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
bankToCustomerStatement
.
setUetr
(
uetr
);
bankToCustomerStatement
.
setUetr
(
uetr
);
}
//EndToEndId
bankToCustomerStatement
.
setCd
(
""
);
//String endToEndId = getXmlNodeValue(bodyHdrParentElementName, document, "Stmt.Ntry.NtryDtls.TxDtls.Refs.EndToEndId");
//<Stmt><Acct><Id><IBAN>
//bankToCustomerStatement.setEndToEndId(endToEndId);
//<Stmt><Acct><Id><Othr><Id>
PartyAccount
account
=
acctConvertPartyAcct
(
bodyHdrParentElementName
,
document
,
"Stmt.Acct"
);
String
iban
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Acct.Id.IBAN"
);
bankToCustomerStatement
.
setAccount
(
account
);
String
id
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Acct.Id.Othr.Id"
);
PartyAccount
partyAccount
=
new
PartyAccount
();
if
(
StringUtil
.
isNotEmpty
(
iban
)){
partyAccount
.
setIbanAcct
(
iban
);
}
else
{
partyAccount
.
setAccount
(
id
);
}
bankToCustomerStatement
.
setAccount
(
partyAccount
);
//<GrpHdr><MsgPgntn><PgNb>
//<Stmt><ElctrncSeqNb>
String
pgNb
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"GrpHdr.MsgPgntn.PgNb"
);
String
elctrncSeqNb
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.ElctrncSeqNb"
);
String
elctrncSeqNb
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.ElctrncSeqNb"
);
if
(
StringUtil
.
isNotEmpty
(
pgNb
)&&
StringUtil
.
isNotEmpty
(
elctrncSeqNb
)){
bankToCustomerStatement
.
setPgNb
(
pgNb
);
bankToCustomerStatement
.
setElctrncSeqNb
(
elctrncSeqNb
);
bankToCustomerStatement
.
setElctrncSeqNb
(
elctrncSeqNb
);
}
//<Stmt><Bal>[i]<Tp><CdOrPrtry><Cd>
CashBalance
openingBalance
=
convertCashBalanceByIndex
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal"
,
1
);
//<Stmt><Bal>[i]<CdtDbtInd>
bankToCustomerStatement
.
setOpeningBalance
(
openingBalance
);
//<Stmt><Bal>[i]<Dt><Dt>
//<Stmt><Bal>[i]<Amt Ccy=“XXX”>
CashBalance
closingBalance
=
convertCashBalanceByIndex
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal"
,
2
);
String
cd1
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
1
+
").Tp.CdOrPrtry.Cd"
);
if
(
"PRCD"
.
equals
(
cd1
)||
"ITBD"
.
equals
(
cd1
)){
BalDto
openBalance
=
new
BalDto
();
openBalance
.
setCd
(
cd1
);
String
cdtDbtInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
1
+
").CdtDbtInd"
);
openBalance
.
setCdtDbtInd
(
cdtDbtInd
);
String
dateStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
1
+
").Dt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
XMLGregorianCalendar
dt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dateStr
);
Date
date
=
DateUtil
.
formatAndParseDate
(
dt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
openBalance
.
setDate
(
date
);
}
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
1
+
").Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
1
+
").Amt@Ccy"
);
openBalance
.
setCcy
(
ccy
);
openBalance
.
setAmt
(
new
BigDecimal
(
amt
));
bankToCustomerStatement
.
setOpenBalance
(
openBalance
);
}
//<Stmt><Ntry>[j]<ValDt><Dt>
//<Stmt><Ntry>[j]<BookgDt><Dt>
//<Stmt><Ntry>[j]<CdtDbtInd>
//<Stmt><Ntry>[j]<RvslInd>
//<Stmt><Ntry>[j]<Sts>
//<Stmt><Ntry>[j]<Amt Ccy=“XXX”>
//<Stmt><Ntry>[j]<BkTxCd><Prtry><Cd>
//<Stmt><Ntry>[j]<NtryDtls><TxDtls><Refs><EndToEndId>
//<Stmt><Ntry>[j]<AcctSvcrRef>
//<Stmt><Ntry>[j]<NtryDtls><TxDtls><AddtlTxInf>
//<Stmt><Ntry>[j]<AddtlNtryInf>
int
ntryCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry"
);
if
(
ntryCount
>
1
){
for
(
int
i
=
1
;
i
<
ntryCount
;
i
++)
{
statementBreakdown
statementBreakdown
=
new
statementBreakdown
();
String
dateStr1
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").ValDt.Dt"
);
String
dateStr2
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").BookgDt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr1
))
{
XMLGregorianCalendar
dt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dateStr1
);
Date
date
=
DateUtil
.
formatAndParseDate
(
dt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
statementBreakdown
.
setValueDate
(
date
);
}
if
(
StringUtil
.
isNotEmpty
(
dateStr2
))
{
XMLGregorianCalendar
dt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dateStr2
);
Date
date
=
DateUtil
.
formatAndParseDate
(
dt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
statementBreakdown
.
setBookDate
(
date
);
}
String
cdtDbtInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").CdtDbtInd"
);
statementBreakdown
.
setCdtDbtInd
(
cdtDbtInd
);
String
rvslInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").RvslInd"
);
statementBreakdown
.
setRvslInd
(
rvslInd
);
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").Amt@Ccy"
);
statementBreakdown
.
setAmt
(
new
BigDecimal
(
amt
));
statementBreakdown
.
setCcy
(
ccy
);
String
cd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").BkTxCd.Prtry.Cd"
);
statementBreakdown
.
setTransactionType
(
cd
.
substring
(
0
,
1
));
statementBreakdown
.
setIdentificationCode
(
cd
.
substring
(
1
));
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").NtryDtls.TxDtls.Refs.EndToEndId"
);
statementBreakdown
.
setEndToEndId
(
endToEndId
);
String
acctSvcrRef
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").AcctSvcrRef"
);
statementBreakdown
.
setAcctSvcrRef
(
acctSvcrRef
);
String
addtlTxInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").NtryDtls.TxDtls.AddtlTxInf"
);
statementBreakdown
.
setAddtlTxInf
(
addtlTxInf
);
String
addtlNtryInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").AddtlNtryInf"
);
statementBreakdown
.
setAddtlNtryInf
(
addtlNtryInf
);
bankToCustomerStatement
.
addStatementLine
(
statementBreakdown
);
}
}
//<Stmt><Bal>[i]<Tp><CdOrPrtry><Cd>
//<Stmt><Bal>[i]<CdtDbtInd>
//<Stmt><Bal>[i]<Dt><Dt>
//<Stmt><Bal>[i]<Amt Ccy=“XXX”>
String
cd2
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
2
+
").Tp.CdOrPrtry.Cd"
);
if
(
"CLBD"
.
equals
(
cd2
)||
"ITBD"
.
equals
(
cd2
)){
BalDto
closingBalance
=
new
BalDto
();
closingBalance
.
setCd
(
cd2
);
String
cdtDbtInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
2
+
").CdtDbtInd"
);
closingBalance
.
setCdtDbtInd
(
cdtDbtInd
);
String
dateStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
2
+
").Dt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
XMLGregorianCalendar
dt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dateStr
);
Date
date
=
DateUtil
.
formatAndParseDate
(
dt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
closingBalance
.
setDate
(
date
);
}
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
2
+
").Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
2
+
").Amt@Ccy"
);
closingBalance
.
setCcy
(
ccy
);
closingBalance
.
setAmt
(
new
BigDecimal
(
amt
));
bankToCustomerStatement
.
setClosingBalance
(
closingBalance
);
bankToCustomerStatement
.
setClosingBalance
(
closingBalance
);
List
<
CashBalance
>
cashBalanceList1
=
convertCashBalanceByType
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal"
,
BalanceTypeCode
.
CLAV
);
if
(
cashBalanceList1
.
size
()
>
0
)
{
bankToCustomerStatement
.
setClosingAvailableBalance
(
cashBalanceList1
.
get
(
0
));
}
List
<
CashBalance
>
cashBalanceList2
=
convertCashBalanceByType
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal"
,
BalanceTypeCode
.
FWAV
);
if
(
cashBalanceList2
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
cashBalanceList2
.
size
();
i
++)
{
bankToCustomerStatement
.
addForwardAvailableBalance
(
cashBalanceList2
.
get
(
i
));
}
}
}
int
balCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal"
);
if
(
balCount
>
0
){
for
(
int
i
=
0
;
i
<
balCount
;
i
++)
{
String
cd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Tp.CdOrPrtry.Cd"
);
if
(
"CLAV"
.
equals
(
cd
)){
BalDto
closingAvailableBalance
=
new
BalDto
();
closingAvailableBalance
.
setCd
(
cd
);
String
cdtDbtInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").CdtDbtInd"
);
closingAvailableBalance
.
setCdtDbtInd
(
cdtDbtInd
);
String
dateStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Dt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
XMLGregorianCalendar
dt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dateStr
);
Date
date
=
DateUtil
.
formatAndParseDate
(
dt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
closingAvailableBalance
.
setDate
(
date
);
}
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Amt@Ccy"
);
closingAvailableBalance
.
setCcy
(
ccy
);
closingAvailableBalance
.
setAmt
(
new
BigDecimal
(
amt
));
bankToCustomerStatement
.
setClosingAvailableBalance
(
closingAvailableBalance
);
}
else
if
(
"FWAV"
.
equals
(
cd
)){
bankToCustomerStatement
.
setCd
(
"FWAV"
);
BalDto
forwardAvailableBalance
=
new
BalDto
();
forwardAvailableBalance
.
setCd
(
cd
);
String
cdtDbtInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").CdtDbtInd"
);
forwardAvailableBalance
.
setCdtDbtInd
(
cdtDbtInd
);
String
dateStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Dt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
dateStr
))
{
XMLGregorianCalendar
dt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dateStr
);
Date
date
=
DateUtil
.
formatAndParseDate
(
dt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
forwardAvailableBalance
.
setDate
(
date
);
}
String
amt
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Amt"
);
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Bal("
+
i
+
").Amt@Ccy"
);
forwardAvailableBalance
.
setAmt
(
new
BigDecimal
(
amt
));
forwardAvailableBalance
.
setCcy
(
ccy
);
bankToCustomerStatement
.
addForwardAvailableBalance
(
forwardAvailableBalance
);
}
}
}
//<Stmt><AddtlStmtInf>
String
addtlStmtInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.AddtlStmtInf"
);
String
addtlStmtInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.AddtlStmtInf"
);
bankToCustomerStatement
.
addAddtlStmtInf
(
addtlStmtInf
);
bankToCustomerStatement
.
setAdditionalStatementInformation
(
addtlStmtInf
);
int
entryCount
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry"
);
if
(
entryCount
>
0
)
{
for
(
int
i
=
0
;
i
<
entryCount
;
i
++)
{
ReportEntry
reportEntry
=
new
ReportEntry
();
String
valueDateStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").ValDt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
valueDateStr
))
{
reportEntry
.
setValueDate
(
DateUtil
.
parseDate
(
valueDateStr
,
defaultDateFormate
));
}
String
bookDateStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").BookgDt.Dt"
);
if
(
StringUtil
.
isNotEmpty
(
bookDateStr
))
{
reportEntry
.
setBookDate
(
DateUtil
.
parseDate
(
bookDateStr
,
defaultDateFormate
));
}
String
cdtDbtIndCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").CdtDbtInd"
);
if
(
StringUtil
.
isNotEmpty
(
cdtDbtIndCode
))
{
reportEntry
.
setCdtDbtCode
(
CdtDbtCode
.
valueOf
(
cdtDbtIndCode
));
}
String
rvslInd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").RvslInd"
);
if
(
StringUtil
.
isNotEmpty
(
rvslInd
))
{
reportEntry
.
setReversalIndicator
(
Boolean
.
valueOf
(
rvslInd
));
}
String
ccy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").Amt@Ccy"
);
String
amtStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").Amt"
);
if
(
StringUtil
.
isNotEmpty
(
ccy
)
&&
StringUtil
.
isNotEmpty
(
amtStr
))
{
CcyFormatAmount
ccyFormatAmount
=
new
CcyFormatAmount
();
ccyFormatAmount
.
setCcy
(
ccy
);
ccyFormatAmount
.
setAmt
(
new
BigDecimal
(
amtStr
));
reportEntry
.
setAmt
(
ccyFormatAmount
);
}
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").NtryDtls.TxDtls.Refs.EndToEndId"
);
reportEntry
.
setEndToEndId
(
endToEndId
);
String
acctSvcrRef
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").NtryDtls.TxDtls.Refs.AcctSvcrRef"
);
reportEntry
.
setAcctSvcrRef
(
acctSvcrRef
);
String
addtlTxInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").NtryDtls.TxDtls.AddtlTxInf"
);
reportEntry
.
setAddtlTxInf
(
addtlTxInf
);
String
addtlNtryInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"Stmt.Ntry("
+
i
+
").AddtlNtryInf"
);
reportEntry
.
setAddtlNtryInf
(
addtlNtryInf
);
bankToCustomerStatement
.
addReportEntry
(
reportEntry
);
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/fininstcdttsf/Mx2SwiftDtoFICTCreator.java
View file @
18c184ec
...
@@ -2,30 +2,239 @@ package com.brilliance.swift.mx2swiftdto.fininstcdttsf;
...
@@ -2,30 +2,239 @@ package com.brilliance.swift.mx2swiftdto.fininstcdttsf;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mx2swiftdto.AbstractMx2SwiftDtoCreator
;
import
com.brilliance.swift.mx2swiftdto.AbstractMx2SwiftDtoCreator
;
import
com.brilliance.swift.mx2swiftdto.Mx2SwiftDtoContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.vo.VoCustomerCreditTransfer
;
import
com.brilliance.swift.vo.VoFinancialInstitutionCreditTransfer
;
import
com.brilliance.swift.vo.common.*
;
import
com.prowidesoftware.swift.model.mx.dic.Instruction4Code
;
import
org.dom4j.Document
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
javax.xml.datatype.DatatypeFactory
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.Map
;
public
class
Mx2SwiftDtoFICTCreator
extends
AbstractMx2SwiftDtoCreator
{
public
class
Mx2SwiftDtoFICTCreator
extends
AbstractMx2SwiftDtoCreator
{
VoFinancialInstitutionCreditTransfer
financialInstitutionCreditTransfer
=
null
;
@Override
@Override
public
void
preProcess
()
throws
SwiftException
{
public
void
preProcess
()
throws
SwiftException
{
document
=
(
Document
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_XMl_DOCUMENT
,
true
);
Map
<
String
,
String
>
parentElementMaps
=
XmlUtil
.
getParentElementMaps
(
document
);
appHdrParentElementName
=
parentElementMaps
.
get
(
"AppHdr"
);
grpHdrParentElementName
=
parentElementMaps
.
get
(
"GrpHdr"
);
bodyHdrParentElementName
=
parentElementMaps
.
get
(
"CdtTrfTxInf"
);
financialInstitutionCreditTransfer
=
new
VoFinancialInstitutionCreditTransfer
();
financialInstitutionCreditTransfer
.
setMessageType
(
"pacs.009.001"
);
}
}
@Override
@Override
public
void
appHeader
()
throws
SwiftException
{
public
void
appHeader
()
throws
SwiftException
{
try
{
String
sendBicCode
=
getBicCode
(
appHdrParentElementName
,
document
,
"AppHdr.Fr.FIId.FinInstnId"
);
String
receiverBicCode
=
getBicCode
(
appHdrParentElementName
,
document
,
"AppHdr.To.FIId.FinInstnId"
);
String
createDateStr
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.CreDt"
);
if
(
StringUtil
.
isNotEmpty
(
createDateStr
))
{
XMLGregorianCalendar
createDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
createDateStr
);
Date
createDate
=
DateUtil
.
formatAndParseDate
(
createDt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
financialInstitutionCreditTransfer
.
setCreateDate
(
createDate
);
}
String
messageId
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.BizMsgIdr"
);
String
priority
=
getXmlNodeValue
(
appHdrParentElementName
,
document
,
"AppHdr.Prty"
);
if
(
StringUtil
.
isNotEmpty
(
priority
))
{
financialInstitutionCreditTransfer
.
setMessagePriority
(
MessagePriority
.
fromValue
(
priority
));
}
financialInstitutionCreditTransfer
.
setMessageId
(
messageId
);
financialInstitutionCreditTransfer
.
setSenderBic
(
sendBicCode
);
financialInstitutionCreditTransfer
.
setReceiverBic
(
receiverBicCode
);
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
@Override
@Override
public
void
groupHeader
()
throws
SwiftException
{
public
void
groupHeader
()
throws
SwiftException
{
PartyDto
instgAgtParty
=
agtConvertPartyDto
(
grpHdrParentElementName
,
document
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgt"
,
"GrpHdr.SttlmInf.InstgRmbrsmntAgtAcct"
);
PartyDto
instdAgtParty
=
agtConvertPartyDto
(
grpHdrParentElementName
,
document
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgt"
,
"GrpHdr.SttlmInf.InstdRmbrsmntAgtAcct"
);
PartyAccount
settleAccount
=
acctConvertPartyAcct
(
grpHdrParentElementName
,
document
,
"GrpHdr.SttlmInf.SttlmAcct"
);
financialInstitutionCreditTransfer
.
setInstgAgtParty
(
instgAgtParty
);
financialInstitutionCreditTransfer
.
setInstdAgtParty
(
instdAgtParty
);
financialInstitutionCreditTransfer
.
setSettleAccount
(
settleAccount
);
}
}
@Override
@Override
public
void
messageBody
()
throws
SwiftException
{
public
void
messageBody
()
throws
SwiftException
{
try
{
//UETR
String
uetr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtId.UETR"
);
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
financialInstitutionCreditTransfer
.
setUetr
(
uetr
);
}
//EndToEndId
String
endToEndId
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PmtId.EndToEndId"
);
if
(
StringUtil
.
isNotEmpty
(
uetr
))
{
financialInstitutionCreditTransfer
.
setEndToEndId
(
endToEndId
);
}
//party
PartyDto
debitParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Dbtr"
,
"CdtTrfTxInf.DbtrAcct"
);
PartyDto
intrmyAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrmyAgt1"
,
"CdtTrfTxInf.IntrmyAgt1Acct"
);
PartyDto
creditAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.CdtrAgt"
,
"CdtTrfTxInf.CdtrAgtAcct"
);
PartyDto
creditParty
=
convertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.Cdtr"
,
"CdtTrfTxInf.CdtrAcct"
);
PartyDto
preInstgAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.PrvsInstgAgt1"
,
"CdtTrfTxInf.PrvsInstgAgt1Acct"
);
financialInstitutionCreditTransfer
.
setDebitParty
(
debitParty
);
financialInstitutionCreditTransfer
.
setIntrmyAgtParty
(
intrmyAgtParty
);
financialInstitutionCreditTransfer
.
setCreditAgtParty
(
creditAgtParty
);
financialInstitutionCreditTransfer
.
setCreditParty
(
creditParty
);
financialInstitutionCreditTransfer
.
setPreInstgAgtParty
(
preInstgAgtParty
);
//debitDate
String
dbtDtTmStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.SttlmTmIndctn.DbtDtTm"
);
if
(
StringUtil
.
isNotEmpty
(
dbtDtTmStr
))
{
XMLGregorianCalendar
dbtDtTm
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
dbtDtTmStr
);
Date
debitDate
=
DateUtil
.
formatAndParseDate
(
dbtDtTm
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
financialInstitutionCreditTransfer
.
setDebitDate
(
debitDate
);
}
//creditDate
String
cdtDtTmStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.SttlmTmIndctn.CdtDtTm"
);
if
(
StringUtil
.
isNotEmpty
(
cdtDtTmStr
))
{
XMLGregorianCalendar
cdtDtTm
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
cdtDtTmStr
);
Date
creditDate
=
DateUtil
.
formatAndParseDate
(
cdtDtTm
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
financialInstitutionCreditTransfer
.
setCreditDate
(
creditDate
);
}
//clsDate
String
clsDtTmStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.SttlmTmReq.CLSTm"
);
if
(
StringUtil
.
isNotEmpty
(
clsDtTmStr
))
{
XMLGregorianCalendar
clsDtTm
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
clsDtTmStr
);
Date
clsDate
=
DateUtil
.
formatAndParseDate
(
clsDtTm
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
financialInstitutionCreditTransfer
.
setClsDate
(
clsDate
);
}
//settledDate settledCcyFormatAmount
String
intrBkSttlmDtStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrBkSttlmDt"
);
if
(
StringUtil
.
isNotEmpty
(
intrBkSttlmDtStr
))
{
XMLGregorianCalendar
intrBkSttlmDt
=
DatatypeFactory
.
newInstance
().
newXMLGregorianCalendar
(
intrBkSttlmDtStr
);
Date
settledDate
=
DateUtil
.
formatAndParseDate
(
intrBkSttlmDt
.
toGregorianCalendar
().
getTime
(),
defaultFormate
);
financialInstitutionCreditTransfer
.
setSettledDate
(
settledDate
);
}
String
intrBkSttlmCcy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt@Ccy"
);
String
intrBkSttlmAmtStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.IntrBkSttlmAmt"
);
if
(
StringUtil
.
isNotEmpty
(
intrBkSttlmCcy
)
&&
StringUtil
.
isNotEmpty
(
intrBkSttlmAmtStr
))
{
CcyFormatAmount
settledCfa
=
new
CcyFormatAmount
();
settledCfa
.
setCcy
(
intrBkSttlmCcy
);
settledCfa
.
setAmt
(
new
BigDecimal
(
intrBkSttlmAmtStr
));
financialInstitutionCreditTransfer
.
setSettledCcyFormatAmount
(
settledCfa
);
}
//InstructionForCreditAgent
String
instForCdtAgentCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.InstrForCdtrAgt.Cd"
);
String
instForCdtAgentInstrInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.InstrForCdtrAgt.InstrInf"
);
if
(
StringUtil
.
isNotEmpty
(
instForCdtAgentCode
)
||
StringUtil
.
isNotEmpty
(
instForCdtAgentInstrInf
))
{
InstructionForCreditAgent
instForCdtAgt
=
new
InstructionForCreditAgent
();
if
(
StringUtil
.
isNotEmpty
(
instForCdtAgentCode
))
{
instForCdtAgt
.
setCode
(
ExternalCreditorAgentInstructionCode
.
valueOf
(
instForCdtAgentCode
));
}
instForCdtAgt
.
setInstrInf
(
instForCdtAgentInstrInf
);
financialInstitutionCreditTransfer
.
setInstForCrdAgt
(
instForCdtAgt
);
}
//InstructionForNextAgent
String
instForNxtAgentCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.InstrForNxtAgt.Cd"
);
String
instForNxtAgentInstrInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.InstrForNxtAgt.InstrInf"
);
if
(
StringUtil
.
isNotEmpty
(
instForNxtAgentCode
)
||
StringUtil
.
isNotEmpty
(
instForNxtAgentInstrInf
))
{
InstructionForNextAgent
instForNxtAgt
=
new
InstructionForNextAgent
();
if
(
StringUtil
.
isNotEmpty
(
instForNxtAgentCode
))
{
instForNxtAgt
.
setCode
(
Instruction4Code
.
valueOf
(
instForNxtAgentCode
));
}
instForNxtAgt
.
setInstrInf
(
instForNxtAgentInstrInf
);
financialInstitutionCreditTransfer
.
setInstForNxtAgt
(
instForNxtAgt
);
}
coverMessageBody
();
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
public
void
coverMessageBody
()
throws
SwiftException
{
//party
PartyDto
debitParty
=
convertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Dbtr"
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAcct"
);
if
(
debitParty
==
null
)
return
;
VoCustomerCreditTransfer
customerCreditTransfer
=
new
VoCustomerCreditTransfer
();
PartyDto
debitAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgt"
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.DbtrAgtAcct"
);
PartyDto
intrmyAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1"
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.IntrmyAgt1Acct"
);
PartyDto
creditAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgt"
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAgtAcct"
);
PartyDto
creditParty
=
convertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.Cdtr"
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.CdtrAcct"
);
PartyDto
preInstgAgtParty
=
agtConvertPartyDto
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.PrvsInstgAgt1"
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.PrvsInstgAgt1Acct"
);
customerCreditTransfer
.
setDebitParty
(
debitParty
);
customerCreditTransfer
.
setDebitAgtParty
(
debitAgtParty
);
customerCreditTransfer
.
setIntrmyAgtParty
(
intrmyAgtParty
);
customerCreditTransfer
.
setCreditAgtParty
(
creditAgtParty
);
customerCreditTransfer
.
setCreditParty
(
creditParty
);
customerCreditTransfer
.
setPreInstgAgtParty
(
preInstgAgtParty
);
//InstructedCcyFormatAmount
String
instdAmtCcy
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt@Ccy"
);
String
instdAmtStr
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstdAmt"
);
if
(
StringUtil
.
isNotEmpty
(
instdAmtCcy
)
&&
StringUtil
.
isNotEmpty
(
instdAmtStr
))
{
CcyFormatAmount
instdCfa
=
new
CcyFormatAmount
();
instdCfa
.
setCcy
(
instdAmtCcy
);
instdCfa
.
setAmt
(
new
BigDecimal
(
instdAmtStr
));
customerCreditTransfer
.
setInstructedCcyFormatAmount
(
instdCfa
);
}
//RemittanceInformation
int
ustrdCounts
=
getXmlNodeCounts
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.RmtInf.Ustrd"
);
if
(
ustrdCounts
>
0
)
{
RemittanceInformation
remittanceInformation
=
new
RemittanceInformation
();
for
(
int
i
=
0
;
i
<
ustrdCounts
;
i
++)
{
String
ustrd
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.RmtInf.Ustrd("
+
i
+
")"
);
remittanceInformation
.
addUnstructured
(
ustrd
);
}
customerCreditTransfer
.
setRemittanceInfo
(
remittanceInformation
);
}
//InstructionForCreditAgent
String
instForCdtAgentCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstrForCdtrAgt.Cd"
);
String
instForCdtAgentInstrInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstrForCdtrAgt.InstrInf"
);
if
(
StringUtil
.
isNotEmpty
(
instForCdtAgentCode
)
||
StringUtil
.
isNotEmpty
(
instForCdtAgentInstrInf
))
{
InstructionForCreditAgent
instForCdtAgt
=
new
InstructionForCreditAgent
();
if
(
StringUtil
.
isNotEmpty
(
instForCdtAgentCode
))
{
instForCdtAgt
.
setCode
(
ExternalCreditorAgentInstructionCode
.
valueOf
(
instForCdtAgentCode
));
}
instForCdtAgt
.
setInstrInf
(
instForCdtAgentInstrInf
);
customerCreditTransfer
.
setInstForCrdAgt
(
instForCdtAgt
);
}
//InstructionForNextAgent
String
instForNxtAgentCode
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstrForNxtAgt.Cd"
);
String
instForNxtAgentInstrInf
=
getXmlNodeValue
(
bodyHdrParentElementName
,
document
,
"CdtTrfTxInf.UndrlygCstmrCdtTrf.InstrForNxtAgt.InstrInf"
);
if
(
StringUtil
.
isNotEmpty
(
instForNxtAgentCode
)
||
StringUtil
.
isNotEmpty
(
instForNxtAgentInstrInf
))
{
InstructionForNextAgent
instForNxtAgt
=
new
InstructionForNextAgent
();
if
(
StringUtil
.
isNotEmpty
(
instForNxtAgentCode
))
{
instForNxtAgt
.
setCode
(
Instruction4Code
.
valueOf
(
instForNxtAgentCode
));
}
instForNxtAgt
.
setInstrInf
(
instForNxtAgentInstrInf
);
customerCreditTransfer
.
setInstForNxtAgt
(
instForNxtAgt
);
}
financialInstitutionCreditTransfer
.
setUnderCustomerCreditTransfer
(
customerCreditTransfer
);
}
}
@Override
@Override
public
void
postProcess
()
throws
SwiftException
{
public
void
postProcess
()
throws
SwiftException
{
try
{
context
.
set
(
Mx2SwiftDtoContextIdentifier
.
MX_TO_SWIFTDTO_OBJ
,
financialInstitutionCreditTransfer
);
String
outputFilePath
=
(
String
)
context
.
get
(
Mx2SwiftDtoContextIdentifier
.
MX_TO_SWIFTDTO_OUTPUT_FILE_PATH
,
true
);
if
(
StringUtil
.
isNotEmpty
(
outputFilePath
))
{
financialInstitutionCreditTransfer
.
write
(
new
File
(
outputFilePath
));
}
}
catch
(
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
}
\ No newline at end of file
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt202/impl/Tag21Generate.java
View file @
18c184ec
...
@@ -22,6 +22,8 @@ public class Tag21Generate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -22,6 +22,8 @@ public class Tag21Generate extends AbstractSwiftDto2MtTagGenerate {
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
if
(
StringUtil
.
isNotEmpty
(
financialInstitutionCreditTransfer
.
getEndToEndId
()))
{
if
(
StringUtil
.
isNotEmpty
(
financialInstitutionCreditTransfer
.
getEndToEndId
()))
{
tags
.
add
(
new
Tag
(
name
,
financialInstitutionCreditTransfer
.
getEndToEndId
()));
tags
.
add
(
new
Tag
(
name
,
financialInstitutionCreditTransfer
.
getEndToEndId
()));
}
else
{
tags
.
add
(
new
Tag
(
name
,
"NONREF"
));
}
}
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/SwiftDto2Mt940950Creator.java
View file @
18c184ec
...
@@ -4,14 +4,13 @@ import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtCreator;
...
@@ -4,14 +4,13 @@ import com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtCreator;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.mt940950.impl.*
;
import
com.brilliance.swift.swiftdto2mt.mt940950.impl.*
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.ReportEntry
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
MT_TYPE_940
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
MT_TYPE_950
;
public
class
SwiftDto2Mt940950Creator
extends
AbstractSwiftDto2MtCreator
{
public
class
SwiftDto2Mt940950Creator
extends
AbstractSwiftDto2MtCreator
{
@Override
@Override
public
List
<
SwiftDto2MtTagGenerate
>
getGenerateTagList
()
{
public
List
<
SwiftDto2MtTagGenerate
>
getGenerateTagList
()
{
...
@@ -32,11 +31,20 @@ public class SwiftDto2Mt940950Creator extends AbstractSwiftDto2MtCreator {
...
@@ -32,11 +31,20 @@ public class SwiftDto2Mt940950Creator extends AbstractSwiftDto2MtCreator {
@Override
@Override
protected
String
getMtType
()
{
protected
String
getMtType
()
{
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
if
(
"FWAV"
.
equals
(
bankToCustomerStatement
.
getCd
())||
bankToCustomerStatement
.
getAddtlStmtInf
()!=
null
){
if
(
bankToCustomerStatement
.
getForwardAvailableBalances
().
size
()
>
0
)
{
return
MT_TYPE_940
;
return
"940"
;
}
else
{
return
MT_TYPE_950
;
}
}
if
(
StringUtil
.
isNotEmpty
(
bankToCustomerStatement
.
getAdditionalStatementInformation
()))
{
return
"940"
;
}
List
<
ReportEntry
>
reportEntries
=
bankToCustomerStatement
.
getReportEntries
();
if
(
reportEntries
.
size
()
>
0
)
{
for
(
ReportEntry
reportEntry
:
reportEntries
)
{
if
(
StringUtil
.
isNotEmpty
(
reportEntry
.
getAddtlNtryInf
()))
{
return
"940"
;
}
}
}
return
"950"
;
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag25aGenerate.java
View file @
18c184ec
...
@@ -3,8 +3,8 @@ package com.brilliance.swift.swiftdto2mt.mt940950.impl;
...
@@ -3,8 +3,8 @@ package com.brilliance.swift.swiftdto2mt.mt940950.impl;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.PartyDto
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
...
@@ -22,7 +22,9 @@ public class Tag25aGenerate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -22,7 +22,9 @@ public class Tag25aGenerate extends AbstractSwiftDto2MtTagGenerate {
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
if
(
bankToCustomerStatement
.
getAccount
()!=
null
){
if
(
bankToCustomerStatement
.
getAccount
()!=
null
){
tags
.
add
(
new
Tag
(
name
,
bankToCustomerStatement
.
getAccount
().
getAccount
()));
PartyDto
partyDto
=
new
PartyDto
();
partyDto
.
setPartyAcct
(
bankToCustomerStatement
.
getAccount
());
tags
.
add
(
new
Tag
(
name
,
getAccount
(
partyDto
)));
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag60aGenerate.java
View file @
18c184ec
...
@@ -5,20 +5,20 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -5,20 +5,20 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CashBalance
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
import
static
com
.
brilliance
.
swift
.
swiftdto2mt
.
SwiftDto2MtContextIdentifier
.
CD_60F
;
import
static
com
.
brilliance
.
swift
.
swiftdto2mt
.
SwiftDto2MtContextIdentifier
.
CD_60M
;
public
class
Tag60aGenerate
extends
AbstractSwiftDto2MtTagGenerate
{
public
class
Tag60aGenerate
extends
AbstractSwiftDto2MtTagGenerate
{
...
@@ -32,32 +32,33 @@ public class Tag60aGenerate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -32,32 +32,33 @@ public class Tag60aGenerate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
BalDto
openBalance
=
bankToCustomerStatement
.
getOpen
Balance
();
CashBalance
openingBalance
=
bankToCustomerStatement
.
getOpening
Balance
();
if
(
open
Balance
!=
null
){
if
(
open
ingBalance
!=
null
){
String
value
=
""
;
String
value
=
""
;
String
dcMark
=
""
;
String
dcMark
=
""
;
if
(
CD_60F
.
equals
(
openBalance
.
getCd
())){
if
(
CdtDbtCode
.
CRDT
.
equals
(
openingBalance
.
getCdtDbtCode
())){
tags
.
add
(
new
Tag
(
name_F
,
""
));
}
else
if
(
CD_60M
.
equals
(
openBalance
.
getCd
())){
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
openBalance
.
getCdtDbtInd
())){
dcMark
=
DRCRMARK_C
;
dcMark
=
DRCRMARK_C
;
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
openBalance
.
getCdtDbtInd
())){
}
else
if
(
CreditDebitCode
.
DBIT
.
equals
(
openingBalance
.
getCdtDbtCode
())){
dcMark
=
DRCRMARK_D
;
dcMark
=
DRCRMARK_D
;
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
Date
date
=
openBalance
.
getDate
();
String
dateStr
=
""
;
String
ccy
=
openBalance
.
getCcy
();
if
(
openingBalance
.
getDate
()
!=
null
)
{
BigDecimal
amt
=
openBalance
.
getAmt
();
dateStr
=
DateUtil
.
format
(
openingBalance
.
getDate
(),
"yyMMdd"
);
if
(
date
!=
null
&&
ccy
!=
null
){
String
dateStr
=
DateUtil
.
format
(
date
,
"yyMMdd"
);
value
=
dcMark
+
dateStr
+
ccy
+
amt
;
}
}
}
else
{
CcyFormatAmount
ccyFormatAmount
=
openingBalance
.
getAmt
();
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60Option."
);
String
ccy
=
""
;
String
amtStr
=
""
;
if
(
ccyFormatAmount
!=
null
)
{
ccy
=
ccyFormatAmount
.
getCcy
();
amtStr
=
NumberUtil
.
formatAmt
(
ccyFormatAmount
.
getAmt
(),
ccyFormatAmount
.
getCcy
());
}
}
value
=
dcMark
+
dateStr
+
ccy
+
amtStr
;
if
(
BalanceTypeCode
.
PRCD
.
equals
(
openingBalance
.
getCode
()))
{
tags
.
add
(
new
Tag
(
name_F
,
value
));
}
else
if
(
BalanceTypeCode
.
ITBD
.
equals
(
openingBalance
.
getCode
()))
{
tags
.
add
(
new
Tag
(
name_M
,
value
));
tags
.
add
(
new
Tag
(
name_M
,
value
));
}
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag61Generate.java
View file @
18c184ec
...
@@ -5,23 +5,28 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -5,23 +5,28 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.statementBreakdown
;
import
com.brilliance.swift.vo.common.BankTransactionCodeStructure
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.brilliance.swift.vo.common.ReportEntry
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
org.apache.commons.io.FileUtils
;
import
java.math.BigDecimal
;
import
java.io.File
;
import
java.util.Date
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.*;
public
class
Tag61Generate
extends
AbstractSwiftDto2MtTagGenerate
{
public
class
Tag61Generate
extends
AbstractSwiftDto2MtTagGenerate
{
private
String
name
=
"61"
;
private
String
name_61
=
"61"
;
private
String
name_86
=
"86"
;
@Override
@Override
public
void
tagGenerate
()
throws
SwiftException
{
public
void
tagGenerate
()
throws
SwiftException
{
...
@@ -29,55 +34,49 @@ public class Tag61Generate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -29,55 +34,49 @@ public class Tag61Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
statementBreakdown
>
statementLineList
=
bankToCustomerStatement
.
getStatementLine
();
List
<
ReportEntry
>
reportEntries
=
bankToCustomerStatement
.
getReportEntries
();
StringBuilder
sb
=
new
StringBuilder
();
if
(
reportEntries
.
size
()
>
0
){
if
(
statementLineList
.
size
()
>
0
){
for
(
ReportEntry
reportEntry
:
reportEntries
)
{
int
count
=
0
;
for
(
statementBreakdown
statementBreakdown
:
statementLineList
)
{
if
(
count
>=
1
){
sb
.
append
(
Mx2MtConstants
.
NEW_LINE
).
append
(
":61:"
);
}
String
valueDateStr
=
""
;
String
valueDateStr
=
""
;
String
bookDateStr
=
""
;
String
bookDateStr
=
""
;
String
d
c
Mark
=
""
;
String
d
rCr
Mark
=
""
;
Date
valueDate
=
statementBreakdown
.
getValueDate
()
;
String
amt
=
""
;
Date
bookDate
=
statementBreakdown
.
getBookDate
()
;
String
ccy
=
""
;
if
(
valueDate
!=
null
){
String
txnCode
=
getTxnCode
(
reportEntry
.
getBankTransactionCodeStructure
());
valueDateStr
=
DateUtil
.
format
(
valueDate
,
"yyMMdd"
);
String
endToEndId
=
reportEntry
.
getEndToEndId
(
);
}
String
addtlTxInf
=
reportEntry
.
getAddtlTxInf
();
if
(
bookDate
!=
null
){
String
acctSvcrRef
=
reportEntry
.
getAcctSvcrRef
();
bookDateStr
=
DateUtil
.
format
(
valueDate
,
"yyMMdd"
);
if
(
reportEntry
.
getValueDate
()
!=
null
)
{
}
valueDateStr
=
DateUtil
.
format
(
reportEntry
.
getValueDate
(),
"yyMMdd"
);
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
statementBreakdown
.
getCdtDbtInd
())){
}
if
(
"true"
.
equals
(
statementBreakdown
.
getCdtDbtInd
()))
{
if
(
reportEntry
.
getBookDate
()
!=
null
)
{
dcMark
=
DRCRMARK_RD
;
bookDateStr
=
DateUtil
.
format
(
reportEntry
.
getBookDate
(),
"yyMMdd"
)
;
}
else
{
}
dcMark
=
DRCRMARK_C
;
if
(
CdtDbtCode
.
CRDT
.
equals
(
reportEntry
.
getCdtDbtCode
()))
{
}
if
(
Boolean
.
TRUE
.
equals
(
reportEntry
.
getReversalIndicator
()))
{
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
statementBreakdown
.
getCdtDbtInd
())){
drCrMark
=
Mx2MtConstants
.
DRCRMARK_RD
;
if
(
"true"
.
equals
(
statementBreakdown
.
getCdtDbtInd
()))
{
}
else
{
d
cMark
=
DRCRMARK_R
C
;
d
rCrMark
=
Mx2MtConstants
.
DRCRMARK_
C
;
}
else
{
}
dcMark
=
DRCRMARK_D
;
}
else
if
(
CdtDbtCode
.
DBIT
.
equals
(
reportEntry
.
getCdtDbtCode
()))
{
}
if
(
Boolean
.
TRUE
.
equals
(
reportEntry
.
getReversalIndicator
()))
{
}
else
{
drCrMark
=
Mx2MtConstants
.
DRCRMARK_RC
;
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed61 D/C Mark."
);
}
else
{
}
drCrMark
=
Mx2MtConstants
.
DRCRMARK_D
;
String
ccy
=
statementBreakdown
.
getCcy
();
}
BigDecimal
amt
=
statementBreakdown
.
getAmt
();
}
String
transactionType
=
statementBreakdown
.
getTransactionType
();
CcyFormatAmount
ccyFormatAmount
=
reportEntry
.
getAmt
();
String
identificationCode
=
statementBreakdown
.
getIdentificationCode
();
if
(
ccyFormatAmount
!=
null
)
{
String
endToEndId
=
statementBreakdown
.
getEndToEndId
(
);
amt
=
NumberUtil
.
formatAmt
(
ccyFormatAmount
.
getAmt
(),
ccyFormatAmount
.
getCcy
()
);
String
acctSvcrRef
=
statementBreakdown
.
getAcctSvcrRef
();
ccy
=
ccyFormatAmount
.
getCcy
();
String
addtlTxInf
=
statementBreakdown
.
getAddtlTxInf
();
}
String
addtlNtryInf
=
statementBreakdown
.
getAddtlNtryInf
();
String
Builder
sb
=
new
StringBuilder
();
sb
.
append
(
valueDateStr
)
sb
.
append
(
valueDateStr
)
.
append
(
bookDateStr
)
.
append
(
bookDateStr
)
.
append
(
d
c
Mark
)
.
append
(
d
rCr
Mark
)
.
append
(
ccy
)
.
append
(
ccy
)
.
append
(
amt
)
.
append
(
amt
)
.
append
(
transactionType
)
.
append
(
txnCode
)
.
append
(
identificationCode
)
.
append
(
endToEndId
);
.
append
(
endToEndId
);
if
(
StringUtil
.
isNotEmpty
(
acctSvcrRef
))
{
if
(
StringUtil
.
isNotEmpty
(
acctSvcrRef
))
{
sb
.
append
(
"//"
+
acctSvcrRef
);
sb
.
append
(
"//"
+
acctSvcrRef
);
...
@@ -85,15 +84,53 @@ public class Tag61Generate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -85,15 +84,53 @@ public class Tag61Generate extends AbstractSwiftDto2MtTagGenerate {
if
(
StringUtil
.
isNotEmpty
(
addtlTxInf
))
{
if
(
StringUtil
.
isNotEmpty
(
addtlTxInf
))
{
sb
.
append
(
Mx2MtConstants
.
NEW_LINE
+
addtlTxInf
);
sb
.
append
(
Mx2MtConstants
.
NEW_LINE
+
addtlTxInf
);
}
}
if
(
StringUtil
.
isNotEmpty
(
addtlNtryInf
)){
tags
.
add
(
new
Tag
(
name_61
,
sb
.
toString
()));
sb
.
append
(
Mx2MtConstants
.
NEW_LINE
).
append
(
":86:"
).
append
(
StringUtil
.
getStringByEnter
(
addtlNtryInf
,
35
,
6
));
String
addtlNtryInf
=
reportEntry
.
getAddtlNtryInf
();
if
(
StringUtil
.
isNotEmpty
(
addtlNtryInf
))
{
tags
.
add
(
new
Tag
(
name_86
,
addtlNtryInf
));
}
}
count
++;
}
}
}
}
tags
.
add
(
new
Tag
(
name
,
sb
.
toString
()));
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
/**
* 得到txntype+txnCode,从BankTransactionCode.Properties文件获取
* @return
*/
private
String
getTxnCode
(
BankTransactionCodeStructure
bankTransactionCodeStructure
)
{
try
{
if
(
bankTransactionCodeStructure
==
null
)
return
""
;
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
].
trim
(),
arr
[
1
].
trim
());
}
}
}
String
txnCode
=
maps
.
get
(
bankTransactionCodeStructure
.
getDomianCode
()
+
"_"
+
bankTransactionCodeStructure
.
getFamilyCode
()
+
"_"
+
bankTransactionCodeStructure
.
getSubFamilyCode
());
if
(
StringUtil
.
isNotEmpty
(
txnCode
))
{
return
"F"
+
txnCode
;
}
else
{
String
code
=
bankTransactionCodeStructure
.
getCode
();
if
(
StringUtil
.
isNotEmpty
(
code
)
&&
code
.
length
()
>
4
)
{
return
code
.
substring
(
0
,
4
);
}
//TODO
return
"S940"
;
}
}
catch
(
IOException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag62aGenerate.java
View file @
18c184ec
...
@@ -4,19 +4,20 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -4,19 +4,20 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.BalanceTypeCode
;
import
com.brilliance.swift.vo.common.CashBalance
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
import
static
com
.
brilliance
.
swift
.
swiftdto2mt
.
SwiftDto2MtContextIdentifier
.*;
public
class
Tag62aGenerate
extends
AbstractSwiftDto2MtTagGenerate
{
public
class
Tag62aGenerate
extends
AbstractSwiftDto2MtTagGenerate
{
...
@@ -31,32 +32,33 @@ public class Tag62aGenerate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -31,32 +32,33 @@ public class Tag62aGenerate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
BalDto
closingBalance
=
bankToCustomerStatement
.
getClosingBalance
();
CashBalance
closingBalance
=
bankToCustomerStatement
.
getClosingBalance
();
if
(
closingBalance
!=
null
){
if
(
closingBalance
!=
null
){
String
value
=
""
;
String
value
=
""
;
String
dcMark
=
""
;
String
dcMark
=
""
;
if
(
CD_62F
.
equals
(
closingBalance
.
getCd
())){
if
(
CdtDbtCode
.
CRDT
.
equals
(
closingBalance
.
getCdtDbtCode
())){
tags
.
add
(
new
Tag
(
name_F
,
""
));
}
else
if
(
CD_62M
.
equals
(
closingBalance
.
getCd
())){
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
closingBalance
.
getCdtDbtInd
())){
dcMark
=
DRCRMARK_C
;
dcMark
=
DRCRMARK_C
;
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
closingBalance
.
getCdtDbtInd
())){
}
else
if
(
CreditDebitCode
.
DBIT
.
equals
(
closingBalance
.
getCdtDbtCode
())){
dcMark
=
DRCRMARK_D
;
dcMark
=
DRCRMARK_D
;
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
Date
date
=
closingBalance
.
getDate
();
String
dateStr
=
""
;
String
ccy
=
closingBalance
.
getCcy
();
if
(
closingBalance
.
getDate
()
!=
null
)
{
BigDecimal
amt
=
closingBalance
.
getAmt
();
dateStr
=
DateUtil
.
format
(
closingBalance
.
getDate
(),
"yyMMdd"
);
if
(
date
!=
null
&&
ccy
!=
null
){
String
dateStr
=
DateUtil
.
format
(
date
,
"yyMMdd"
);
value
=
dcMark
+
dateStr
+
ccy
+
amt
;
}
}
}
else
{
CcyFormatAmount
ccyFormatAmount
=
closingBalance
.
getAmt
();
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60Option."
);
String
ccy
=
""
;
String
amtStr
=
""
;
if
(
ccyFormatAmount
!=
null
)
{
ccy
=
ccyFormatAmount
.
getCcy
();
amtStr
=
NumberUtil
.
formatAmt
(
ccyFormatAmount
.
getAmt
(),
ccyFormatAmount
.
getCcy
());
}
}
value
=
dcMark
+
dateStr
+
ccy
+
amtStr
;
if
(
BalanceTypeCode
.
CLBD
.
equals
(
closingBalance
.
getCode
()))
{
tags
.
add
(
new
Tag
(
name_F
,
value
));
}
else
if
(
BalanceTypeCode
.
ITBD
.
equals
(
closingBalance
.
getCode
()))
{
tags
.
add
(
new
Tag
(
name_M
,
value
));
tags
.
add
(
new
Tag
(
name_M
,
value
));
}
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
...
...
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag64Generate.java
View file @
18c184ec
...
@@ -4,17 +4,17 @@ import com.brilliance.swift.exception.SwiftException;
...
@@ -4,17 +4,17 @@ import com.brilliance.swift.exception.SwiftException;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.CashBalance
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
brilliance
.
swift
.
swiftdto2mt
.
SwiftDto2MtContextIdentifier
.*;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
...
@@ -28,24 +28,27 @@ public class Tag64Generate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -28,24 +28,27 @@ public class Tag64Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
BalDto
closingAvailableBalance
=
bankToCustomerStatement
.
getClosingAvailableBalance
();
CashBalance
closingAvailableBalance
=
bankToCustomerStatement
.
getClosingAvailableBalance
();
if
(
closingAvailableBalance
!=
null
&&
CD_64
.
equals
(
closingAvailableBalance
.
getCd
())
){
if
(
closingAvailableBalance
!=
null
){
String
value
=
""
;
String
value
=
""
;
String
dcMark
=
""
;
String
dcMark
=
""
;
if
(
C
reditDebitCode
.
CRDT
.
value
().
equals
(
closingAvailableBalance
.
getCdtDbtInd
())){
if
(
C
dtDbtCode
.
CRDT
.
equals
(
closingAvailableBalance
.
getCdtDbtCode
())){
dcMark
=
DRCRMARK_C
;
dcMark
=
DRCRMARK_C
;
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
closingAvailableBalance
.
getCdtDbtInd
())){
}
else
if
(
CreditDebitCode
.
DBIT
.
equals
(
closingAvailableBalance
.
getCdtDbtCode
())){
dcMark
=
DRCRMARK_D
;
dcMark
=
DRCRMARK_D
;
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
Date
date
=
closingAvailableBalance
.
getDate
();
String
dateStr
=
""
;
String
ccy
=
closingAvailableBalance
.
getCcy
();
if
(
closingAvailableBalance
.
getDate
()
!=
null
)
{
BigDecimal
amt
=
closingAvailableBalance
.
getAmt
();
dateStr
=
DateUtil
.
format
(
closingAvailableBalance
.
getDate
(),
"yyMMdd"
);
if
(
date
!=
null
&&
ccy
!=
null
){
String
dateStr
=
DateUtil
.
format
(
date
,
"yyMMdd"
);
value
=
dcMark
+
dateStr
+
ccy
+
amt
;
}
}
CcyFormatAmount
ccyFormatAmount
=
closingAvailableBalance
.
getAmt
();
String
ccy
=
""
;
String
amtStr
=
""
;
if
(
ccyFormatAmount
!=
null
)
{
ccy
=
ccyFormatAmount
.
getCcy
();
amtStr
=
NumberUtil
.
formatAmt
(
ccyFormatAmount
.
getAmt
(),
ccyFormatAmount
.
getCcy
());
}
value
=
dcMark
+
dateStr
+
ccy
+
amtStr
;
tags
.
add
(
new
Tag
(
name
,
value
));
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
...
...
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag65Generate.java
View file @
18c184ec
package
com
.
brilliance
.
swift
.
swiftdto2mt
.
mt940950
.
impl
;
package
com
.
brilliance
.
swift
.
swiftdto2mt
.
mt940950
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.NumberUtil
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.CashBalance
;
import
com.brilliance.swift.vo.common.CcyFormatAmount
;
import
com.brilliance.swift.vo.common.CdtDbtCode
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.SwiftMessage
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
com.prowidesoftware.swift.model.mx.dic.CreditDebitCode
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
brilliance
.
swift
.
swiftdto2mt
.
SwiftDto2MtContextIdentifier
.*;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_C
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
import
static
com
.
brilliance
.
swift
.
constants
.
Mx2MtConstants
.
DRCRMARK_D
;
...
@@ -29,34 +28,30 @@ public class Tag65Generate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -29,34 +28,30 @@ public class Tag65Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
BalDto
>
forwardAvailableBalanceList
=
bankToCustomerStatement
.
getForwardAvailableBalance
();
List
<
CashBalance
>
forwardAvailableBalances
=
bankToCustomerStatement
.
getForwardAvailableBalances
();
StringBuilder
sb
=
new
StringBuilder
();
if
(
forwardAvailableBalances
.
size
()
>
0
){
if
(
forwardAvailableBalanceList
.
size
()>
0
){
for
(
CashBalance
cashBalance
:
forwardAvailableBalances
)
{
int
count
=
0
;
String
value
=
""
;
for
(
BalDto
forwardAvailableBalance
:
forwardAvailableBalanceList
)
{
if
(
count
>=
1
){
sb
.
append
(
Mx2MtConstants
.
NEW_LINE
).
append
(
":65:"
);
}
if
(
forwardAvailableBalance
!=
null
&&
CD_65
.
equals
(
forwardAvailableBalance
.
getCd
())){
String
dcMark
=
""
;
String
dcMark
=
""
;
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
forwardAvailableBalance
.
getCdtDbtInd
())){
if
(
CdtDbtCode
.
CRDT
.
equals
(
cashBalance
.
getCdtDbtCode
())){
dcMark
=
DRCRMARK_C
;
dcMark
=
DRCRMARK_C
;
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
forwardAvailableBalance
.
getCdtDbtInd
())){
}
else
if
(
CreditDebitCode
.
DBIT
.
equals
(
cashBalance
.
getCdtDbtCode
())){
dcMark
=
DRCRMARK_D
;
dcMark
=
DRCRMARK_D
;
}
else
{
throw
new
SwiftException
(
"ERROR"
,
"cannot find filed60 D/C Mark."
);
}
}
Date
date
=
forwardAvailableBalance
.
getDate
();
String
dateStr
=
""
;
String
ccy
=
forwardAvailableBalance
.
getCcy
();
if
(
cashBalance
.
getDate
()
!=
null
)
{
BigDecimal
amt
=
forwardAvailableBalance
.
getAmt
();
dateStr
=
DateUtil
.
format
(
cashBalance
.
getDate
(),
"yyMMdd"
);
if
(
date
!=
null
&&
ccy
!=
null
){
String
dateStr
=
DateUtil
.
format
(
date
,
"yyMMdd"
);
sb
.
append
(
dcMark
).
append
(
dateStr
).
append
(
ccy
).
append
(
amt
);
}
}
CcyFormatAmount
ccyFormatAmount
=
cashBalance
.
getAmt
();
String
ccy
=
""
;
String
amtStr
=
""
;
if
(
ccyFormatAmount
!=
null
)
{
ccy
=
ccyFormatAmount
.
getCcy
();
amtStr
=
NumberUtil
.
formatAmt
(
ccyFormatAmount
.
getAmt
(),
ccyFormatAmount
.
getCcy
());
}
}
count
++;
value
=
dcMark
+
dateStr
+
ccy
+
amtStr
;
tags
.
add
(
new
Tag
(
name
,
value
));
}
}
tags
.
add
(
new
Tag
(
name
,
sb
.
toString
()));
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mt/mt940950/impl/Tag86Generate.java
View file @
18c184ec
package
com
.
brilliance
.
swift
.
swiftdto2mt
.
mt940950
.
impl
;
package
com
.
brilliance
.
swift
.
swiftdto2mt
.
mt940950
.
impl
;
import
com.brilliance.swift.constants.Mx2MtConstants
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.AbstractSwiftDto2MtTagGenerate
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
import
com.brilliance.swift.swiftdto2mt.SwiftDto2MtContextIdentifier
;
...
@@ -22,12 +21,9 @@ public class Tag86Generate extends AbstractSwiftDto2MtTagGenerate {
...
@@ -22,12 +21,9 @@ public class Tag86Generate extends AbstractSwiftDto2MtTagGenerate {
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
BankToCustomerStatement
bankToCustomerStatement
=
(
BankToCustomerStatement
)
context
.
get
(
SwiftDto2MtContextIdentifier
.
SWIFT_DTO_OBJ
,
true
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
SwiftMessage
swiftMessage
=
context
.
get
(
SwiftMessage
.
class
);
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
Tag
>
tags
=
swiftMessage
.
getBlock4
().
getTags
();
List
<
String
>
addtlStmtInfList
=
bankToCustomerStatement
.
getAddtlStmtInf
();
String
additionalStatementInformation
=
bankToCustomerStatement
.
getAdditionalStatementInformation
();
StringBuilder
sb
=
new
StringBuilder
();
if
(
StringUtil
.
isNotEmpty
(
additionalStatementInformation
)){
if
(
addtlStmtInfList
.
size
()>
0
){
tags
.
add
(
new
Tag
(
name
,
StringUtil
.
getStringByEnter
(
additionalStatementInformation
,
35
,
6
)));
String
addtlStmtInf
=
addtlStmtInfList
.
get
(
0
);
sb
.
append
(
StringUtil
.
getStringByEnter
(
addtlStmtInf
,
35
,
6
));
tags
.
add
(
new
Tag
(
name
,
sb
.
toString
()));
}
}
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
...
...
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mx/AbstractSwiftDto2MxCreator.java
View file @
18c184ec
package
com
.
brilliance
.
swift
.
swiftdto2mx
;
package
com
.
brilliance
.
swift
.
swiftdto2mx
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.common.*
;
import
com.brilliance.swift.vo.common.*
;
import
com.prowidesoftware.swift.model.mx.dic.*
;
import
com.prowidesoftware.swift.model.mx.dic.*
;
import
javax.xml.datatype.DatatypeConfigurationException
;
import
java.text.ParseException
;
import
java.util.Date
;
public
abstract
class
AbstractSwiftDto2MxCreator
implements
SwiftDto2MxCreator
{
public
abstract
class
AbstractSwiftDto2MxCreator
implements
SwiftDto2MxCreator
{
protected
SwiftDto2MxContext
context
;
protected
SwiftDto2MxContext
context
;
...
@@ -102,4 +108,49 @@ public abstract class AbstractSwiftDto2MxCreator implements SwiftDto2MxCreator{
...
@@ -102,4 +108,49 @@ public abstract class AbstractSwiftDto2MxCreator implements SwiftDto2MxCreator{
}
}
return
tr
;
return
tr
;
}
}
/**
* 将自定义对象CashBalance转Mx CashBalance8
*/
protected
CashBalance8
convertCashBalance8
(
CashBalance
cashBalance
)
{
try
{
if
(
cashBalance
==
null
)
return
null
;
CashBalance8
cashBalance8
=
new
CashBalance8
();
BalanceTypeCode
balanceTypeCode
=
cashBalance
.
getCode
();
String
proprietary
=
cashBalance
.
getProprietary
();
CdtDbtCode
cdtDbtCode
=
cashBalance
.
getCdtDbtCode
();
Date
date
=
cashBalance
.
getDate
();
CcyFormatAmount
ccyFormatAmount
=
cashBalance
.
getAmt
();
if
(
balanceTypeCode
!=
null
||
StringUtil
.
isNotEmpty
(
proprietary
))
{
BalanceType13
tp
=
new
BalanceType13
();
BalanceType10Choice
cdOrPrtry
=
new
BalanceType10Choice
();
if
(
balanceTypeCode
!=
null
)
{
cdOrPrtry
.
setCd
(
balanceTypeCode
.
value
());
}
cdOrPrtry
.
setPrtry
(
proprietary
);
tp
.
setCdOrPrtry
(
cdOrPrtry
);
cashBalance8
.
setTp
(
tp
);
}
if
(
cdtDbtCode
!=
null
)
{
cashBalance8
.
setCdtDbtInd
(
CreditDebitCode
.
valueOf
(
cdtDbtCode
.
value
()));
}
if
(
ccyFormatAmount
!=
null
)
{
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
amt
.
setCcy
(
ccyFormatAmount
.
getCcy
());
amt
.
setValue
(
ccyFormatAmount
.
getAmt
());
cashBalance8
.
setAmt
(
amt
);
}
if
(
date
!=
null
)
{
DateAndDateTime2Choice
dt
=
new
DateAndDateTime2Choice
();
dt
.
setDt
(
DateUtil
.
parseXMLGregorianCalendar
(
date
));
cashBalance8
.
setDt
(
dt
);
}
return
cashBalance8
;
}
catch
(
DatatypeConfigurationException
e
)
{
throw
new
SwiftException
(
"Error"
,
e
.
getMessage
());
}
catch
(
ParseException
e
)
{
throw
new
SwiftException
(
"Error"
,
e
.
getMessage
());
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/swiftdto2mx/camt053001/v08/SwiftDto2MxCamt053001Creator.java
View file @
18c184ec
...
@@ -5,18 +5,15 @@ import com.brilliance.swift.swiftdto2mx.AbstractSwiftDto2MxCreator;
...
@@ -5,18 +5,15 @@ import com.brilliance.swift.swiftdto2mx.AbstractSwiftDto2MxCreator;
import
com.brilliance.swift.swiftdto2mx.SwiftDto2MxContextIdentifier
;
import
com.brilliance.swift.swiftdto2mx.SwiftDto2MxContextIdentifier
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.DateUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.vo.BankToCustomerDebitCreditNotification
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.BankToCustomerStatement
;
import
com.brilliance.swift.vo.common.*
;
import
com.brilliance.swift.vo.common.*
;
import
com.prowidesoftware.swift.model.mx.BusinessAppHdrV02
;
import
com.prowidesoftware.swift.model.mx.BusinessAppHdrV02
;
import
com.prowidesoftware.swift.model.mx.MxCamt05300108
;
import
com.prowidesoftware.swift.model.mx.MxCamt05300108
;
import
com.prowidesoftware.swift.model.mx.MxCamt05400108
;
import
com.prowidesoftware.swift.model.mx.dic.*
;
import
com.prowidesoftware.swift.model.mx.dic.*
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
javax.xml.datatype.XMLGregorianCalendar
;
import
java.io.File
;
import
java.io.File
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -68,203 +65,142 @@ public class SwiftDto2MxCamt053001Creator extends AbstractSwiftDto2MxCreator {
...
@@ -68,203 +65,142 @@ public class SwiftDto2MxCamt053001Creator extends AbstractSwiftDto2MxCreator {
GroupHeader81
grpHdr
=
new
GroupHeader81
();
GroupHeader81
grpHdr
=
new
GroupHeader81
();
grpHdr
.
setMsgId
(
bankToCustomerStatement
.
getMessageId
());
grpHdr
.
setMsgId
(
bankToCustomerStatement
.
getMessageId
());
grpHdr
.
setCreDtTm
(
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getCreateDate
()));
grpHdr
.
setCreDtTm
(
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getCreateDate
()));
grpHdr
.
setAddtlInf
(
""
);
bkToCstmrStmt
.
setGrpHdr
(
grpHdr
);
bkToCstmrStmt
.
setGrpHdr
(
grpHdr
);
//AccountStatement
AccountStatement9
stmt
=
new
AccountStatement9
();
AccountStatement9
stmt
=
new
AccountStatement9
();
bkToCstmrStmt
.
addStmt
(
stmt
);
bkToCstmrStmt
.
addStmt
(
stmt
);
String
uetr
=
bankToCustomerStatement
.
getUetr
();
String
account
=
bankToCustomerStatement
.
getAccount
().
getAccount
();
//25
PartyAccount
partyAccount
=
bankToCustomerStatement
.
getAccount
();
String
ibanAcct
=
bankToCustomerStatement
.
getAccount
().
getIbanAcct
();
//25
String
pgNb
=
bankToCustomerStatement
.
getPgNb
();
String
pgNb
=
bankToCustomerStatement
.
getPgNb
();
//28C
String
elctrncSeqNb
=
bankToCustomerStatement
.
getElctrncSeqNb
();
String
elctrncSeqNb
=
bankToCustomerStatement
.
getElctrncSeqNb
();
//28C
CashBalance
openingBalance
=
bankToCustomerStatement
.
getOpeningBalance
();
BalDto
openingBalance
=
bankToCustomerStatement
.
getOpenBalance
();
//60
if
(
openingBalance
!=
null
)
{
List
<
statementBreakdown
>
statementLine
=
bankToCustomerStatement
.
getStatementLine
();
//61
stmt
.
addBal
(
convertCashBalance8
(
openingBalance
));
BalDto
closingBalance
=
bankToCustomerStatement
.
getClosingBalance
();
//62a
}
BalDto
closingAvailableBalance
=
bankToCustomerStatement
.
getClosingAvailableBalance
();
//64
CashBalance
closingBalance
=
bankToCustomerStatement
.
getClosingBalance
();
List
<
BalDto
>
forwardAvailableBalance
=
bankToCustomerStatement
.
getForwardAvailableBalance
();
//65
if
(
closingBalance
!=
null
)
{
List
<
String
>
addtlStmtInf
=
bankToCustomerStatement
.
getAddtlStmtInf
();
//86
stmt
.
addBal
(
convertCashBalance8
(
closingBalance
));
//<Stmt><Acct><Id><IBAN>
}
//<Stmt><Acct><Id><Othr><Id>
CashBalance
closingAvailableBalance
=
bankToCustomerStatement
.
getClosingAvailableBalance
();
if
(
account
!=
null
||
ibanAcct
!=
null
){
if
(
closingAvailableBalance
!=
null
)
{
CashAccount39
acct
=
new
CashAccount39
();
stmt
.
addBal
(
convertCashBalance8
(
closingAvailableBalance
));
stmt
.
setAcct
(
acct
);
}
List
<
CashBalance
>
forwardAvailableBalances
=
bankToCustomerStatement
.
getForwardAvailableBalances
();
if
(
forwardAvailableBalances
.
size
()
>
0
)
{
for
(
CashBalance
forwardAvailableBalance
:
forwardAvailableBalances
)
{
stmt
.
addBal
(
convertCashBalance8
(
forwardAvailableBalance
));
}
}
if
(
partyAccount
!=
null
){
String
ibanAcct
=
partyAccount
.
getIbanAcct
();
String
account
=
partyAccount
.
getAccount
();
if
(
StringUtil
.
isNotEmpty
(
ibanAcct
)
||
StringUtil
.
isNotEmpty
(
account
))
{
CashAccount39
cashAccount39
=
new
CashAccount39
();
cashAccount39
.
setCcy
(
partyAccount
.
getAcctCcy
());
cashAccount39
.
setNm
(
partyAccount
.
getAcctName
());
AccountIdentification4Choice
id
=
new
AccountIdentification4Choice
();
AccountIdentification4Choice
id
=
new
AccountIdentification4Choice
();
if
(
ibanAcct
!=
null
){
if
(
StringUtil
.
isNotEmpty
(
account
))
{
id
.
setIBAN
(
account
);
}
else
{
GenericAccountIdentification1
othr
=
new
GenericAccountIdentification1
();
GenericAccountIdentification1
othr
=
new
GenericAccountIdentification1
();
othr
.
setId
(
account
);
othr
.
setId
(
account
);
AcctSchemeType
acctSehemeType
=
partyAccount
.
getAcctSehemeType
();
if
(
acctSehemeType
!=
null
)
{
AccountSchemeName1Choice
schmeNm
=
new
AccountSchemeName1Choice
();
if
(
acctSehemeType
.
getCode
()
!=
null
)
{
schmeNm
.
setCd
(
acctSehemeType
.
getCode
().
value
());
}
schmeNm
.
setPrtry
(
acctSehemeType
.
getProprietary
());
othr
.
setSchmeNm
(
schmeNm
);
}
id
.
setOthr
(
othr
);
id
.
setOthr
(
othr
);
}
}
acct
.
setId
(
id
);
if
(
StringUtil
.
isNotEmpty
(
ibanAcct
))
{
id
.
setIBAN
(
ibanAcct
);
}
cashAccount39
.
setId
(
id
);
AcctType
acctType
=
partyAccount
.
getAcctType
();
if
(
acctType
!=
null
)
{
CashAccountType2Choice
tp
=
new
CashAccountType2Choice
();
if
(
acctType
.
getCode
()
!=
null
)
{
tp
.
setCd
(
acctType
.
getCode
().
value
());
}
tp
.
setPrtry
(
acctType
.
getProprietary
());
cashAccount39
.
setTp
(
tp
);
}
stmt
.
setAcct
(
cashAccount39
);
}
}
}
//<GrpHdr><MsgPgntn><PgNb>
if
(
StringUtil
.
isNotEmpty
(
pgNb
)){
//<Stmt><ElctrncSeqNb>
if
(
pgNb
!=
null
&&
elctrncSeqNb
!=
null
){
Pagination1
msgPgntn
=
new
Pagination1
();
Pagination1
msgPgntn
=
new
Pagination1
();
grpHdr
.
setMsgPgntn
(
msgPgntn
);
grpHdr
.
setMsgPgntn
(
msgPgntn
);
msgPgntn
.
setPgNb
(
pgNb
);
msgPgntn
.
setPgNb
(
pgNb
);
stmt
.
setElctrncSeqNb
(
new
BigDecimal
(
elctrncSeqNb
));
}
//<Stmt><Bal>[i]<Tp><CdOrPrtry><Cd>
//<Stmt><Bal>[i]<CdtDbtInd>
//<Stmt><Bal>[i]<Dt><Dt>
//<Stmt><Bal>[i]<Amt Ccy=“XXX”>
CashBalance8
bal0
=
new
CashBalance8
();
stmt
.
addBal
(
bal0
);
if
(
openingBalance
!=
null
){
CashBalance8
bal1
=
new
CashBalance8
();
stmt
.
addBal
(
bal1
);
BalanceType13
tp
=
new
BalanceType13
();
bal1
.
setTp
(
tp
);
BalanceType10Choice
cdOrPrtry
=
new
BalanceType10Choice
();
tp
.
setCdOrPrtry
(
cdOrPrtry
);
cdOrPrtry
.
setCd
(
bankToCustomerStatement
.
getOpenBalance
().
getCd
());
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
bankToCustomerStatement
.
getOpenBalance
().
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
CRDT
);
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
bankToCustomerStatement
.
getOpenBalance
().
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
DBIT
);
}
}
DateAndDateTime2Choice
dt1
=
new
DateAndDateTime2Choice
();
if
(
StringUtil
.
isNotEmpty
(
elctrncSeqNb
)){
bal1
.
setDt
(
dt1
);
stmt
.
setElctrncSeqNb
(
new
BigDecimal
(
elctrncSeqNb
));
XMLGregorianCalendar
dt2
=
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getOpenBalance
().
getDate
());
dt1
.
setDt
(
dt2
);
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
bal1
.
setAmt
(
amt
);
amt
.
setValue
(
bankToCustomerStatement
.
getOpenBalance
().
getAmt
());
amt
.
setCcy
(
bankToCustomerStatement
.
getOpenBalance
().
getCcy
());
}
}
//<Stmt><Ntry>[j]<ValDt><Dt>
List
<
ReportEntry
>
reportEntries
=
bankToCustomerStatement
.
getReportEntries
();
//<Stmt><Ntry>[j]<BookgDt><Dt>
if
(
reportEntries
.
size
()>
0
){
//<Stmt><Ntry>[j]<CdtDbtInd>
for
(
int
i
=
0
;
i
<
reportEntries
.
size
();
i
++)
{
//<Stmt><Ntry>[j]<RvslInd>
ReportEntry
reportEntry
=
reportEntries
.
get
(
i
);
//<Stmt><Ntry>[j]<Sts>
//<Stmt><Ntry>[j]<Amt Ccy=“XXX”>
//<Stmt><Ntry>[j]<BkTxCd><Prtry><Cd>
//<Stmt><Ntry>[j]<NtryDtls><TxDtls><Refs><EndToEndId>
//<Stmt><Ntry>[j]<AcctSvcrRef>
//<Stmt><Ntry>[j]<NtryDtls><TxDtls><AddtlTxInf>
//<Stmt><Ntry>[j]<AddtlNtryInf>
ReportEntry10
ntry0
=
new
ReportEntry10
();
stmt
.
addNtry
(
ntry0
);
if
(
statementLine
.
size
()>
0
){
for
(
int
i
=
0
;
i
<
statementLine
.
size
();
i
++)
{
ReportEntry10
ntry
=
new
ReportEntry10
();
ReportEntry10
ntry
=
new
ReportEntry10
();
stmt
.
addNtry
(
ntry
);
stmt
.
addNtry
(
ntry
);
DateAndDateTime2Choice
valDt
=
new
DateAndDateTime2Choice
();
DateAndDateTime2Choice
valDt
=
new
DateAndDateTime2Choice
();
ntry
.
setValDt
(
valDt
);
ntry
.
setValDt
(
valDt
);
XMLGregorianCalendar
dt1
=
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
)
.
getValueDate
());
XMLGregorianCalendar
dt1
=
DateUtil
.
parseXMLGregorianCalendar
(
reportEntry
.
getValueDate
());
valDt
.
setDt
(
dt1
);
valDt
.
setDt
(
dt1
);
DateAndDateTime2Choice
bookgDt
=
new
DateAndDateTime2Choice
();
DateAndDateTime2Choice
bookgDt
=
new
DateAndDateTime2Choice
();
ntry
.
setBookgDt
(
bookgDt
);
ntry
.
setBookgDt
(
bookgDt
);
XMLGregorianCalendar
dt2
=
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
)
.
getBookDate
());
XMLGregorianCalendar
dt2
=
DateUtil
.
parseXMLGregorianCalendar
(
reportEntry
.
getBookDate
());
bookgDt
.
setDt
(
dt2
);
bookgDt
.
setDt
(
dt2
);
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getCdtDbtInd
())){
if
(
reportEntry
.
getCdtDbtCode
()
!=
null
)
{
ntry
.
setCdtDbtInd
(
CreditDebitCode
.
CRDT
);
ntry
.
setCdtDbtInd
(
CreditDebitCode
.
valueOf
(
reportEntry
.
getCdtDbtCode
().
value
()));
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getCdtDbtInd
())){
ntry
.
setCdtDbtInd
(
CreditDebitCode
.
DBIT
);
}
if
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getRvslInd
().
equals
(
"true"
)){
ntry
.
setRvslInd
(
true
);
}
}
System
.
out
.
println
(
reportEntry
.
getReversalIndicator
());
ntry
.
setRvslInd
(
reportEntry
.
getReversalIndicator
());
CcyFormatAmount
ccyFormatAmount
=
reportEntry
.
getAmt
();
if
(
ccyFormatAmount
!=
null
)
{
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
amt
.
setValue
(
ccyFormatAmount
.
getAmt
());
amt
.
setCcy
(
ccyFormatAmount
.
getCcy
());
ntry
.
setAmt
(
amt
);
ntry
.
setAmt
(
amt
);
amt
.
setValue
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getAmt
());
}
amt
.
setCcy
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getCcy
());
BankTransactionCodeStructure
bankTransactionCodeStructure
=
reportEntry
.
getBankTransactionCodeStructure
();
String
transactionType
=
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getTransactionType
();
if
(
bankTransactionCodeStructure
!=
null
)
{
String
identificationCode
=
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getIdentificationCode
();
String
cd
=
transactionType
+
identificationCode
;
BankTransactionCodeStructure4
bkTxCd
=
new
BankTransactionCodeStructure4
();
BankTransactionCodeStructure4
bkTxCd
=
new
BankTransactionCodeStructure4
();
ntry
.
setBkTxCd
(
bkTxCd
);
if
(
StringUtil
.
isNotEmpty
(
bankTransactionCodeStructure
.
getDomianCode
())
&&
StringUtil
.
isNotEmpty
(
bankTransactionCodeStructure
.
getFamilyCode
())
&&
StringUtil
.
isNotEmpty
(
bankTransactionCodeStructure
.
getSubFamilyCode
())){
BankTransactionCodeStructure5
domn
=
new
BankTransactionCodeStructure5
();
domn
.
setCd
(
bankTransactionCodeStructure
.
getDomianCode
());
BankTransactionCodeStructure6
fmly
=
new
BankTransactionCodeStructure6
();
fmly
.
setCd
(
bankTransactionCodeStructure
.
getFamilyCode
());
fmly
.
setSubFmlyCd
(
bankTransactionCodeStructure
.
getSubFamilyCode
());
domn
.
setFmly
(
fmly
);
bkTxCd
.
setDomn
(
domn
);
}
if
(
StringUtil
.
isNotEmpty
(
bankTransactionCodeStructure
.
getCode
())
||
StringUtil
.
isNotEmpty
(
bankTransactionCodeStructure
.
getIssuer
())){
ProprietaryBankTransactionCodeStructure1
prtry
=
new
ProprietaryBankTransactionCodeStructure1
();
ProprietaryBankTransactionCodeStructure1
prtry
=
new
ProprietaryBankTransactionCodeStructure1
();
prtry
.
setCd
(
bankTransactionCodeStructure
.
getCode
());
prtry
.
setIssr
(
bankTransactionCodeStructure
.
getIssuer
());
bkTxCd
.
setPrtry
(
prtry
);
bkTxCd
.
setPrtry
(
prtry
);
prtry
.
setCd
(
cd
);
}
ntry
.
setBkTxCd
(
bkTxCd
);
}
EntryDetails9
ntryDtls
=
new
EntryDetails9
();
EntryDetails9
ntryDtls
=
new
EntryDetails9
();
ntry
.
addNtryDtls
(
ntryDtls
);
ntry
.
addNtryDtls
(
ntryDtls
);
EntryTransaction10
txDtls
=
new
EntryTransaction10
();
EntryTransaction10
txDtls
=
new
EntryTransaction10
();
ntryDtls
.
addTxDtls
(
txDtls
);
ntryDtls
.
addTxDtls
(
txDtls
);
TransactionReferences6
refs
=
new
TransactionReferences6
();
TransactionReferences6
refs
=
new
TransactionReferences6
();
refs
.
setUETR
(
uetr
);
refs
.
setUETR
(
bankToCustomerStatement
.
getUetr
()
);
txDtls
.
setRefs
(
refs
);
txDtls
.
setRefs
(
refs
);
refs
.
setEndToEndId
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getEndToEndId
());
refs
.
setEndToEndId
(
reportEntry
.
getEndToEndId
());
ntry
.
setAcctSvcrRef
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getAcctSvcrRef
());
ntry
.
setAcctSvcrRef
(
reportEntry
.
getAcctSvcrRef
());
txDtls
.
setAddtlTxInf
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getAddtlTxInf
());
txDtls
.
setAddtlTxInf
(
reportEntry
.
getAddtlTxInf
());
ntry
.
setAddtlNtryInf
(
bankToCustomerStatement
.
getStatementLine
().
get
(
i
).
getAddtlNtryInf
());
ntry
.
setAddtlNtryInf
(
reportEntry
.
getAddtlNtryInf
());
}
}
//<Stmt><Bal>[i]<Tp><CdOrPrtry><Cd>
//<Stmt><Bal>[i]<CdtDbtInd>
//<Stmt><Bal>[i]<Dt><Dt>
//<Stmt><Bal>[i]<Amt Ccy=“XXX”>
if
(
closingBalance
!=
null
){
CashBalance8
bal1
=
new
CashBalance8
();
stmt
.
addBal
(
bal1
);
BalanceType13
tp
=
new
BalanceType13
();
bal1
.
setTp
(
tp
);
BalanceType10Choice
cdOrPrtry
=
new
BalanceType10Choice
();
tp
.
setCdOrPrtry
(
cdOrPrtry
);
cdOrPrtry
.
setCd
(
bankToCustomerStatement
.
getClosingBalance
().
getCd
());
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
bankToCustomerStatement
.
getClosingBalance
().
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
CRDT
);
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
bankToCustomerStatement
.
getClosingBalance
().
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
DBIT
);
}
DateAndDateTime2Choice
dt1
=
new
DateAndDateTime2Choice
();
bal1
.
setDt
(
dt1
);
XMLGregorianCalendar
dt2
=
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getClosingBalance
().
getDate
());
dt1
.
setDt
(
dt2
);
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
bal1
.
setAmt
(
amt
);
amt
.
setValue
(
bankToCustomerStatement
.
getClosingBalance
().
getAmt
());
amt
.
setCcy
(
bankToCustomerStatement
.
getClosingBalance
().
getCcy
());
}
}
if
(
closingAvailableBalance
!=
null
){
CashBalance8
bal1
=
new
CashBalance8
();
stmt
.
addBal
(
bal1
);
BalanceType13
tp
=
new
BalanceType13
();
bal1
.
setTp
(
tp
);
BalanceType10Choice
cdOrPrtry
=
new
BalanceType10Choice
();
tp
.
setCdOrPrtry
(
cdOrPrtry
);
cdOrPrtry
.
setCd
(
bankToCustomerStatement
.
getClosingAvailableBalance
().
getCd
());
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
bankToCustomerStatement
.
getClosingAvailableBalance
().
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
CRDT
);
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
bankToCustomerStatement
.
getClosingAvailableBalance
().
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
DBIT
);
}
DateAndDateTime2Choice
dt1
=
new
DateAndDateTime2Choice
();
bal1
.
setDt
(
dt1
);
XMLGregorianCalendar
dt2
=
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getClosingAvailableBalance
().
getDate
());
dt1
.
setDt
(
dt2
);
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
bal1
.
setAmt
(
amt
);
amt
.
setValue
(
bankToCustomerStatement
.
getClosingAvailableBalance
().
getAmt
());
amt
.
setCcy
(
bankToCustomerStatement
.
getClosingAvailableBalance
().
getCcy
());
}
if
(
forwardAvailableBalance
.
size
()>
0
){
CashBalance8
bal1
=
new
CashBalance8
();
stmt
.
addBal
(
bal1
);
BalanceType13
tp
=
new
BalanceType13
();
bal1
.
setTp
(
tp
);
BalanceType10Choice
cdOrPrtry
=
new
BalanceType10Choice
();
tp
.
setCdOrPrtry
(
cdOrPrtry
);
cdOrPrtry
.
setCd
(
bankToCustomerStatement
.
getForwardAvailableBalance
().
get
(
0
).
getCd
());
if
(
CreditDebitCode
.
CRDT
.
value
().
equals
(
bankToCustomerStatement
.
getForwardAvailableBalance
().
get
(
0
).
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
CRDT
);
}
else
if
(
CreditDebitCode
.
DBIT
.
value
().
equals
(
bankToCustomerStatement
.
getForwardAvailableBalance
().
get
(
0
).
getCdtDbtInd
())){
bal1
.
setCdtDbtInd
(
CreditDebitCode
.
DBIT
);
}
DateAndDateTime2Choice
dt1
=
new
DateAndDateTime2Choice
();
bal1
.
setDt
(
dt1
);
XMLGregorianCalendar
dt2
=
DateUtil
.
parseXMLGregorianCalendar
(
bankToCustomerStatement
.
getForwardAvailableBalance
().
get
(
0
).
getDate
());
dt1
.
setDt
(
dt2
);
ActiveOrHistoricCurrencyAndAmount
amt
=
new
ActiveOrHistoricCurrencyAndAmount
();
bal1
.
setAmt
(
amt
);
amt
.
setValue
(
bankToCustomerStatement
.
getForwardAvailableBalance
().
get
(
0
).
getAmt
());
amt
.
setCcy
(
bankToCustomerStatement
.
getForwardAvailableBalance
().
get
(
0
).
getCcy
());
}
if
(
addtlStmtInf
.
size
()>
0
){
stmt
.
setAddtlStmtInf
(
bankToCustomerStatement
.
getAddtlStmtInf
().
get
(
0
));
}
}
stmt
.
setAddtlStmtInf
(
bankToCustomerStatement
.
getAdditionalStatementInformation
());
String
xmlStr
=
mxCamt05300108
.
message
();
String
xmlStr
=
mxCamt05300108
.
message
();
context
.
set
(
SwiftDto2MxContextIdentifier
.
MX_XML
,
xmlStr
);
context
.
set
(
SwiftDto2MxContextIdentifier
.
MX_XML
,
xmlStr
);
String
outputFilePath
=
(
String
)
context
.
get
(
SwiftDto2MxContextIdentifier
.
MX_OUTPUT_FILE_PATH
,
true
);
String
outputFilePath
=
(
String
)
context
.
get
(
SwiftDto2MxContextIdentifier
.
MX_OUTPUT_FILE_PATH
,
true
);
...
...
swiftCore/src/main/java/com/brilliance/swift/vo/BankToCustomerStatement.java
View file @
18c184ec
package
com
.
brilliance
.
swift
.
vo
;
package
com
.
brilliance
.
swift
.
vo
;
import
com.brilliance.swift.vo.common.BalDto
;
import
com.brilliance.swift.vo.common.*
;
import
com.brilliance.swift.vo.common.PartyAccount
;
import
com.brilliance.swift.vo.common.statementBreakdown
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -13,7 +11,7 @@ import java.util.List;
...
@@ -13,7 +11,7 @@ import java.util.List;
*/
*/
public
class
BankToCustomerStatement
extends
SwiftDto
{
public
class
BankToCustomerStatement
extends
SwiftDto
{
protected
String
c
d
;
protected
String
endToEndI
d
;
protected
PartyAccount
account
;
protected
PartyAccount
account
;
...
@@ -21,24 +19,48 @@ public class BankToCustomerStatement extends SwiftDto{
...
@@ -21,24 +19,48 @@ public class BankToCustomerStatement extends SwiftDto{
protected
String
elctrncSeqNb
;
protected
String
elctrncSeqNb
;
protected
BalDto
openingBalance
;
protected
CashBalance
openingBalance
;
protected
List
<
statementBreakdown
>
statementLine
;
protected
List
<
ReportEntry
>
reportEntries
;
protected
BalDto
closingBalance
;
protected
CashBalance
closingBalance
;
protected
BalDto
closingAvailableBalance
;
protected
CashBalance
closingAvailableBalance
;
protected
List
<
BalDto
>
forwardAvailableBalance
;
protected
List
<
CashBalance
>
forwardAvailableBalances
;
protected
List
<
String
>
addtlStmtInf
;
protected
String
additionalStatementInformation
;
public
String
getCd
()
{
public
List
<
ReportEntry
>
getReportEntries
()
{
return
cd
;
if
(
reportEntries
==
null
){
reportEntries
=
new
ArrayList
<>();
}
return
reportEntries
;
}
}
public
void
setCd
(
String
cd
)
{
public
BankToCustomerStatement
addReportEntry
(
ReportEntry
reportEntry
)
{
this
.
cd
=
cd
;
getReportEntries
().
add
(
reportEntry
);
return
this
;
}
public
List
<
CashBalance
>
getForwardAvailableBalances
()
{
if
(
forwardAvailableBalances
==
null
){
forwardAvailableBalances
=
new
ArrayList
<>();
}
return
forwardAvailableBalances
;
}
public
BankToCustomerStatement
addForwardAvailableBalance
(
CashBalance
cashBalance
)
{
getForwardAvailableBalances
().
add
(
cashBalance
);
return
this
;
}
public
String
getEndToEndId
()
{
return
endToEndId
;
}
public
void
setEndToEndId
(
String
endToEndId
)
{
this
.
endToEndId
=
endToEndId
;
}
}
public
PartyAccount
getAccount
()
{
public
PartyAccount
getAccount
()
{
...
@@ -65,62 +87,35 @@ public class BankToCustomerStatement extends SwiftDto{
...
@@ -65,62 +87,35 @@ public class BankToCustomerStatement extends SwiftDto{
this
.
elctrncSeqNb
=
elctrncSeqNb
;
this
.
elctrncSeqNb
=
elctrncSeqNb
;
}
}
public
BalDto
getOpen
Balance
()
{
public
CashBalance
getOpening
Balance
()
{
return
openingBalance
;
return
openingBalance
;
}
}
public
void
setOpenBalance
(
BalDto
openBalance
)
{
public
void
setOpeningBalance
(
CashBalance
openingBalance
)
{
this
.
openingBalance
=
openBalance
;
this
.
openingBalance
=
openingBalance
;
}
public
BalDto
getClosingAvailableBalance
()
{
return
closingAvailableBalance
;
}
}
public
void
setClosingAvailableBalance
(
BalDto
closingAvailableBalance
)
{
public
CashBalance
getClosingBalance
()
{
this
.
closingAvailableBalance
=
closingAvailableBalance
;
return
closingBalance
;
}
public
List
<
BalDto
>
getForwardAvailableBalance
()
{
if
(
forwardAvailableBalance
==
null
){
forwardAvailableBalance
=
new
ArrayList
<>();
}
return
forwardAvailableBalance
;
}
public
BankToCustomerStatement
addForwardAvailableBalance
(
BalDto
forwardAvailableBalance
)
{
getForwardAvailableBalance
().
add
(
forwardAvailableBalance
);
return
this
;
}
}
public
List
<
String
>
getAddtlStmtInf
()
{
public
void
setClosingBalance
(
CashBalance
closingBalance
)
{
if
(
addtlStmtInf
==
null
){
this
.
closingBalance
=
closingBalance
;
addtlStmtInf
=
new
ArrayList
<>();
}
return
addtlStmtInf
;
}
}
public
BankToCustomerStatement
addAddtlStmtInf
(
String
addtlStmtInf
)
{
public
CashBalance
getClosingAvailableBalance
()
{
getAddtlStmtInf
().
add
(
addtlStmtInf
);
return
closingAvailableBalance
;
return
this
;
}
}
public
BankToCustomerStatement
addStatementLine
(
statementBreakdown
statementBreakdown
){
public
void
setClosingAvailableBalance
(
CashBalance
closingAvailableBalance
)
{
getStatementLine
().
add
(
statementBreakdown
);
this
.
closingAvailableBalance
=
closingAvailableBalance
;
return
this
;
}
public
List
<
statementBreakdown
>
getStatementLine
()
{
if
(
statementLine
==
null
){
statementLine
=
new
ArrayList
<>();
}
return
statementLine
;
}
}
public
BalDto
getClosingBalance
()
{
public
String
getAdditionalStatementInformation
()
{
return
closingBalance
;
return
additionalStatementInformation
;
}
}
public
void
set
ClosingBalance
(
BalDto
closingBalance
)
{
public
void
set
AdditionalStatementInformation
(
String
additionalStatementInformation
)
{
this
.
closingBalance
=
closingBalance
;
this
.
additionalStatementInformation
=
additionalStatementInformation
;
}
}
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/BalDto.java
deleted
100644 → 0
View file @
392516f6
package
com
.
brilliance
.
swift
.
vo
.
common
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* @author zh
* @create 2022-04-21 16:59
*/
public
class
BalDto
{
private
String
cd
;
private
String
CdtDbtInd
;
private
Date
date
;
private
String
ccy
;
private
BigDecimal
amt
=
BigDecimal
.
ZERO
;
public
String
getCd
()
{
return
cd
;
}
public
void
setCd
(
String
cd
)
{
this
.
cd
=
cd
;
}
public
String
getCdtDbtInd
()
{
return
CdtDbtInd
;
}
public
void
setCdtDbtInd
(
String
cdtDbtInd
)
{
this
.
CdtDbtInd
=
cdtDbtInd
;
}
public
Date
getDate
()
{
return
date
;
}
public
void
setDate
(
Date
date
)
{
this
.
date
=
date
;
}
public
String
getCcy
()
{
return
ccy
;
}
public
void
setCcy
(
String
ccy
)
{
this
.
ccy
=
ccy
;
}
public
BigDecimal
getAmt
()
{
return
amt
;
}
public
void
setAmt
(
BigDecimal
amt
)
{
this
.
amt
=
amt
;
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/BalTypeEnum.java
deleted
100644 → 0
View file @
392516f6
package
com
.
brilliance
.
swift
.
vo
.
common
;
/**
* @author zh
* @create 2022-04-21 17:05
*/
public
enum
BalTypeEnum
{
OB
(
"Opening Balance"
),
CB
(
"Closing Balance"
),
CAB
(
"Closing Available Balance"
),
FAB
(
"Forward Available Balance"
);
BalTypeEnum
(
String
s
)
{}
public
String
value
()
{
return
name
();
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/BalanceTypeCode.java
0 → 100644
View file @
18c184ec
package
com
.
brilliance
.
swift
.
vo
.
common
;
public
enum
BalanceTypeCode
{
CLAV
(
"ClosingAvailable"
),
CLBD
(
"ClosingBooked"
),
FWAV
(
"ForwardAvailable"
),
INFO
(
"Information"
),
ITAV
(
"InterimAvailable"
),
ITBD
(
"InterimBooked"
),
OPAV
(
"OpeningAvailable"
),
OPBD
(
"OpeningBooked"
),
PRCD
(
"PreviouslyClosedBooked"
),
XPCD
(
"Expected"
);
BalanceTypeCode
(
String
s
)
{}
public
String
value
()
{
return
name
();
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/BankTransactionCodeStructure.java
0 → 100644
View file @
18c184ec
package
com
.
brilliance
.
swift
.
vo
.
common
;
/**
* BNK = SECU CASH BKFE
* BRF = SECU CASH BROK
* CAR =
* CAS = SECU CORP CSLI
* CHK = PMNT ICHQ CCHQ
* CLR = PMNT RCHQ CASH
* CMP = SECU CASH CLAI
* CMS = CAMT ACCB SWEP
* CMT = CAMT ACCB TOPG
* CMZ = CAMT ACCB ZABA
* DIS = SECU CUST CAPG
* DIV = SECU CUST DVCA
* EXT = SECU NSET OWNE
* MAR = SECU COLL MARG
* MAT = SECU CORP REDM
* MGT = SECU CASH MNFE
* ODC = SECU CASH OVCH
* PRN = SECU NSET PRUD
* REC = SECU CORP TREC
* RED = ECU CASH GEN1
* RIG = SECU CORP RHTS
* SAL = SECU CORP ODLT
* SLE =
* STO = PMNT ICDT STDO
* STP = SECU CASH STAM
* SUB = SECU NSET SUBS
* SWP = SECU CASH SWAP
* TAX = SECU CASH WITH
* TCK = PMNT CNTR TCDP
* TCK = PMNT CNTR TCWD
* TRA = SECU SETT OWNI
* TRA = SECU NSET OWNI
* TRN = SECU CASH TRFE
* UWC = SECU CASH UNCO
* WAR = SECU CORP EXWA
* WAR = SECU CUST EXWA
*/
public
class
BankTransactionCodeStructure
{
private
String
domianCode
;
private
String
familyCode
;
private
String
subFamilyCode
;
private
String
code
;
private
String
issuer
;
public
String
getDomianCode
()
{
return
domianCode
;
}
public
void
setDomianCode
(
String
domianCode
)
{
this
.
domianCode
=
domianCode
;
}
public
String
getFamilyCode
()
{
return
familyCode
;
}
public
void
setFamilyCode
(
String
familyCode
)
{
this
.
familyCode
=
familyCode
;
}
public
String
getSubFamilyCode
()
{
return
subFamilyCode
;
}
public
void
setSubFamilyCode
(
String
subFamilyCode
)
{
this
.
subFamilyCode
=
subFamilyCode
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getIssuer
()
{
return
issuer
;
}
public
void
setIssuer
(
String
issuer
)
{
this
.
issuer
=
issuer
;
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/CashBalance.java
0 → 100644
View file @
18c184ec
package
com
.
brilliance
.
swift
.
vo
.
common
;
import
java.util.Date
;
public
class
CashBalance
{
private
BalanceTypeCode
code
;
private
String
proprietary
;
private
CdtDbtCode
cdtDbtCode
;
private
Date
date
;
private
CcyFormatAmount
amt
;
public
BalanceTypeCode
getCode
()
{
return
code
;
}
public
void
setCode
(
BalanceTypeCode
code
)
{
this
.
code
=
code
;
}
public
String
getProprietary
()
{
return
proprietary
;
}
public
void
setProprietary
(
String
proprietary
)
{
this
.
proprietary
=
proprietary
;
}
public
CdtDbtCode
getCdtDbtCode
()
{
return
cdtDbtCode
;
}
public
void
setCdtDbtCode
(
CdtDbtCode
cdtDbtCode
)
{
this
.
cdtDbtCode
=
cdtDbtCode
;
}
public
Date
getDate
()
{
return
date
;
}
public
void
setDate
(
Date
date
)
{
this
.
date
=
date
;
}
public
CcyFormatAmount
getAmt
()
{
return
amt
;
}
public
void
setAmt
(
CcyFormatAmount
amt
)
{
this
.
amt
=
amt
;
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/CdtDbtCode.java
0 → 100644
View file @
18c184ec
package
com
.
brilliance
.
swift
.
vo
.
common
;
public
enum
CdtDbtCode
{
/**
* Operation is an increase.
*
*/
CRDT
,
/**
* Operation is a decrease.
*
*/
DBIT
;
public
String
value
()
{
return
name
();
}
public
static
CdtDbtCode
fromValue
(
String
v
)
{
return
valueOf
(
v
);
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/common/
statementBreakdown
.java
→
swiftCore/src/main/java/com/brilliance/swift/vo/common/
ReportEntry
.java
View file @
18c184ec
package
com
.
brilliance
.
swift
.
vo
.
common
;
package
com
.
brilliance
.
swift
.
vo
.
common
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Date
;
/**
public
class
ReportEntry
{
* @author zh
* @create 2022-04-21 14:08
*/
public
class
statementBreakdown
{
private
Date
valueDate
;
private
Date
valueDate
;
private
Date
bookDate
;
private
Date
BookDate
;
private
CdtDbtCode
cdtDbtCode
;
private
Boolean
reversalIndicator
;
private
String
cdtDbtInd
;
private
CcyFormatAmount
amt
;
private
BankTransactionCodeStructure
bankTransactionCodeStructure
;
private
String
rvslInd
;
private
String
ccy
;
private
BigDecimal
amt
=
BigDecimal
.
ZERO
;
private
String
transactionType
;
private
String
identificationCode
;
private
String
endToEndId
;
private
String
endToEndId
;
private
String
acctSvcrRef
;
private
String
acctSvcrRef
;
private
String
addtlTxInf
;
private
String
addtlTxInf
;
private
String
addtlNtryInf
;
private
String
addtlNtryInf
;
public
Date
getValueDate
()
{
public
Date
getValueDate
()
{
...
@@ -42,59 +24,43 @@ public class statementBreakdown {
...
@@ -42,59 +24,43 @@ public class statementBreakdown {
}
}
public
Date
getBookDate
()
{
public
Date
getBookDate
()
{
return
B
ookDate
;
return
b
ookDate
;
}
}
public
void
setBookDate
(
Date
bookDate
)
{
public
void
setBookDate
(
Date
bookDate
)
{
BookDate
=
bookDate
;
this
.
bookDate
=
bookDate
;
}
public
String
getCdtDbtInd
()
{
return
cdtDbtInd
;
}
public
void
setCdtDbtInd
(
String
cdtDbtInd
)
{
this
.
cdtDbtInd
=
cdtDbtInd
;
}
}
public
String
getRvslInd
()
{
public
CdtDbtCode
getCdtDbtCode
()
{
return
rvslInd
;
return
cdtDbtCode
;
}
}
public
void
set
RvslInd
(
String
rvslInd
)
{
public
void
set
CdtDbtCode
(
CdtDbtCode
cdtDbtCode
)
{
this
.
rvslInd
=
rvslInd
;
this
.
cdtDbtCode
=
cdtDbtCode
;
}
}
public
String
getCcy
()
{
public
Boolean
getReversalIndicator
()
{
return
ccy
;
return
reversalIndicator
;
}
}
public
void
set
Ccy
(
String
ccy
)
{
public
void
set
ReversalIndicator
(
Boolean
reversalIndicator
)
{
this
.
ccy
=
ccy
;
this
.
reversalIndicator
=
reversalIndicator
;
}
}
public
BigDecimal
getAmt
()
{
public
CcyFormatAmount
getAmt
()
{
return
amt
;
return
amt
;
}
}
public
void
setAmt
(
BigDecimal
amt
)
{
public
void
setAmt
(
CcyFormatAmount
amt
)
{
this
.
amt
=
amt
;
this
.
amt
=
amt
;
}
}
public
String
getTransactionTyp
e
()
{
public
BankTransactionCodeStructure
getBankTransactionCodeStructur
e
()
{
return
transactionTyp
e
;
return
bankTransactionCodeStructur
e
;
}
}
public
void
setTransactionType
(
String
transactionType
)
{
public
void
setBankTransactionCodeStructure
(
BankTransactionCodeStructure
bankTransactionCodeStructure
)
{
this
.
transactionType
=
transactionType
;
this
.
bankTransactionCodeStructure
=
bankTransactionCodeStructure
;
}
public
String
getIdentificationCode
()
{
return
identificationCode
;
}
public
void
setIdentificationCode
(
String
identificationCode
)
{
this
.
identificationCode
=
identificationCode
;
}
}
public
String
getEndToEndId
()
{
public
String
getEndToEndId
()
{
...
@@ -128,5 +94,4 @@ public class statementBreakdown {
...
@@ -128,5 +94,4 @@ public class statementBreakdown {
public
void
setAddtlNtryInf
(
String
addtlNtryInf
)
{
public
void
setAddtlNtryInf
(
String
addtlNtryInf
)
{
this
.
addtlNtryInf
=
addtlNtryInf
;
this
.
addtlNtryInf
=
addtlNtryInf
;
}
}
}
}
swiftCore/src/main/resources/BankTransactionCode.Properties
0 → 100644
View file @
18c184ec
#DOMIANCODE_FAMILYCODE_SUBFAMILYCODE = MT TRANSACTION CODE
SECU_CASH_BKFE
=
BNK
SECU_CASH_BROK
=
BRF
SECU_CORP_CSLI
=
CAS
PMNT_ICHQ_CCHQ
=
CHK
PMNT_RCHQ_CASH
=
CLR
SECU_CASH_CLAI
=
CMP
CAMT_ACCB_SWEP
=
CMS
CAMT_ACCB_TOPG
=
CMT
CAMT_ACCB_ZABA
=
CMZ
SECU_CUST_CAPG
=
DIS
SECU_CUST_DVCA
=
DIV
SECU_NSET_OWNE
=
EXT
SECU_COLL_MARG
=
MAR
SECU_CORP_REDM
=
MAT
SECU_CASH_MNFE
=
MGT
SECU_CASH_OVCH
=
ODC
SECU_NSET_PRUD
=
PRN
SECU_CORP_TREC
=
REC
SECU_CASH_GEN1
=
RED
SECU_CORP_RHTS
=
RIG
SECU_CORP_ODLT
=
SAL
PMNT_ICDT_STDO
=
STO
SECU_CASH_STAM
=
STP
SECU_NSET_SUBS
=
SUB
SECU_CASH_SWAP
=
SWP
SECU_CASH_WITH
=
TAX
PMNT_CNTR_TCDP
=
TCK
PMNT_CNTR_TCWD
=
TCK
SECU_SETT_OWNI
=
TRA
SECU_NSET_OWNI
=
TRA
SECU_CASH_TRFE
=
TRN
SECU_CASH_UNCO
=
UWC
SECU_CORP_EXWA
=
WAR
SECU_CUST_EXWA
=
WAR
\ No newline at end of file
swiftCore/src/main/resources/swiftJson/BankToCustomerStatement.json
View file @
18c184ec
{
{
"cd"
:
"FWAV"
,
"account"
:
{
"account"
:
{
"account"
:
"
S
15612345678012345"
"account"
:
"15612345678012345"
},
},
"pgNb"
:
"178"
,
"elctrncSeqNb"
:
"200"
,
"openingBalance"
:
{
"openingBalance"
:
{
"c
d
"
:
"ITBD"
,
"c
ode
"
:
"ITBD"
,
"
CdtDbtInd
"
:
"DBIT"
,
"
cdtDbtCode
"
:
"DBIT"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"amt"
:
{
"ccy"
:
"USD"
,
"ccy"
:
"USD"
,
"amt"
:
120274.34
"amt"
:
120274.34
}
},
},
"
statementLine
"
:
[
"
reportEntries
"
:
[
{
{
"valueDate"
:
"2022-03-30 00:00:00,000"
,
"valueDate"
:
"2022-03-30 00:00:00,000"
,
"
B
ookDate"
:
"2022-03-30 00:00:00,000"
,
"
b
ookDate"
:
"2022-03-30 00:00:00,000"
,
"cdtDbt
Ind"
:
"DBI
T"
,
"cdtDbt
Code"
:
"CRD
T"
,
"
rvslInd"
:
"false"
,
"
amt"
:
{
"ccy"
:
"USD"
,
"ccy"
:
"USD"
,
"amt"
:
393.17
,
"amt"
:
393.17
"transactionType"
:
"F"
,
},
"identificationCode"
:
"CHK"
,
"bankTransactionCodeStructure"
:
{
"domianCode"
:
"PMNT"
,
"familyCode"
:
"ICHQ"
,
"subFamilyCode"
:
"CCHQ"
},
"endToEndId"
:
"S100000189-735"
,
"endToEndId"
:
"S100000189-735"
,
"acctSvcrRef"
:
"1309170100000390154395"
,
"acctSvcrRef"
:
"1309170100000390154395"
,
"addtlTxInf"
:
"PLACI LOVECNAMENSKIH WUHAN"
,
"addtlTxInf"
:
"PLACI LOVECNAMENSKIH WUHAN"
,
"addtlNtryInf"
:
"CHINESE BEIJING"
"addtlNtryInf"
:
"CHINESE BEIJING
CHINESE SHANGHAICHINESE WUHANCHINESE GUANGZHOUCHINESE HANGZHOUCHINESE SHENZHEN
"
},
},
{
{
"valueDate"
:
"2022-03-30 00:00:00,000"
,
"valueDate"
:
"2022-03-30 00:00:00,000"
,
"BookDate"
:
"2022-03-30 00:00:00,000"
,
"bookDate"
:
"2022-03-30 00:00:00,000"
,
"cdtDbtInd"
:
"DBIT"
,
"cdtDbtCode"
:
"DBIT"
,
"rvslInd"
:
"false"
,
"reversalIndicator"
:
true
,
"amt"
:
{
"ccy"
:
"USD"
,
"ccy"
:
"USD"
,
"amt"
:
445
,
"amt"
:
445
"transactionType"
:
"F"
,
},
"identificationCode"
:
"CHK"
,
"bankTransactionCodeStructure"
:
{
"domianCode"
:
"PMNT"
,
"familyCode"
:
"ICHQ"
,
"subFamilyCode"
:
"CCHQ"
},
"endToEndId"
:
"S100000189-735"
,
"endToEndId"
:
"S100000189-735"
,
"acctSvcrRef"
:
"1309170100000390154395"
,
"acctSvcrRef"
:
"1309170100000390154395"
,
"addtlTxInf"
:
"PLACI LOVECNAMENSKIH STORITEV"
"addtlTxInf"
:
"PLACI LOVECNAMENSKIH STORITEV"
}
}
],
],
"closingBalance"
:
{
"closingBalance"
:
{
"c
d
"
:
"ITBD"
,
"c
ode
"
:
"ITBD"
,
"
CdtDbtInd
"
:
"DBIT"
,
"
cdtDbtCode
"
:
"DBIT"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"amt"
:
{
"ccy"
:
"USD"
,
"ccy"
:
"USD"
,
"amt"
:
123456.29
"amt"
:
123456.29
}
},
},
"closingAvailableBalance"
:
{
"closingAvailableBalance"
:
{
"c
d
"
:
"CLAV"
,
"c
ode
"
:
"CLAV"
,
"
CdtDbtInd
"
:
"DBIT"
,
"
cdtDbtCode
"
:
"DBIT"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"amt"
:
{
"ccy"
:
"USD"
,
"ccy"
:
"USD"
,
"amt"
:
119609.29
"amt"
:
119609.29
}
},
},
"forwardAvailableBalance"
:
[
"forwardAvailableBalance
s
"
:
[
{
{
"c
d
"
:
"FWAV"
,
"c
ode
"
:
"FWAV"
,
"
CdtDbtInd
"
:
"DBIT"
,
"
cdtDbtCode
"
:
"DBIT"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"date"
:
"2022-03-30 00:00:00,000"
,
"amt"
:
{
"ccy"
:
"USD"
,
"ccy"
:
"USD"
,
"amt"
:
120274.34
"amt"
:
120274.34
}
}
}
],
],
"addtlStmtInf"
:
[
"additionalStatementInformation"
:
"HELLO WORLD"
,
"HELLO WORLD"
],
"messageType"
:
"camt.053.001"
,
"messageType"
:
"camt.053.001"
,
"senderBic"
:
"SHWHQWER123"
,
"senderBic"
:
"SHWHQWER123"
,
"receiverBic"
:
"BJWHS12X"
,
"receiverBic"
:
"BJWHS12X"
,
"createDate"
:
"2022-0
4-28 10:23:46,048
"
,
"createDate"
:
"2022-0
5-07 10:54:53,581
"
,
"messagePriority"
:
"NORM"
,
"messagePriority"
:
"NORM"
,
"messageId"
:
"00010013800002001234"
,
"messageId"
:
"00010013800002001234"
,
"uetr"
:
"8a562c67-ca16-48ba-b074-65581be6f001"
"uetr"
:
"8a562c67-ca16-48ba-b074-65581be6f001"
...
...
swiftCore/src/main/resources/swiftTxt/MT940.txt
View file @
18c184ec
...
@@ -2,14 +2,19 @@
...
@@ -2,14 +2,19 @@
:20:00010013800002001234
:20:00010013800002001234
:25:S15612345678012345
:25:S15612345678012345
:28:178/200
:28:178/200
:60M:D220330USD120274
.
34
:60M:D220330USD120274
,
34
:61:220330220330
DUSD393.
17FCHKS100000189-735//1309170100000390154395
:61:220330220330
CUSD393,
17FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH WUHAN
PLACI LOVECNAMENSKIH WUHAN
:86:CHINESE BEIJING
:86:CHINESE BEIJING
:61:220330220330DUSD445FCHKS100000189-735//1309170100000390154395
CHINESE SHANGHAI
CHINESE WUHAN
CHINESE GUANGZHOU
CHINESE HANGZHOU
CHINESE SHENZHEN
:61:220330220330RDUSD445,FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH STORITEV
PLACI LOVECNAMENSKIH STORITEV
:62M:D220330USD123456
.
29
:62M:D220330USD123456
,
29
:64:D220330USD119609
.
29
:64:D220330USD119609
,
29
:65:D220330USD120274
.
34
:65:D220330USD120274
,
34
:86:HELLO WORLD
:86:HELLO WORLD
-}
-}
\ No newline at end of file
swiftCore/src/main/resources/swiftTxt/MT950.txt
View file @
18c184ec
...
@@ -2,10 +2,10 @@
...
@@ -2,10 +2,10 @@
:20:00010013800002001234
:20:00010013800002001234
:25:S15612345678012345
:25:S15612345678012345
:28:178/200
:28:178/200
:60M:D220330USD120274
.
34
:60M:D220330USD120274
,
34
:61:220330220330DUSD393
.
17FCHKS100000189-735//1309170100000390154395
:61:220330220330DUSD393
,
17FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH WUHAN
PLACI LOVECNAMENSKIH WUHAN
:61:220330220330DUSD445FCHKS100000189-735//1309170100000390154395
:61:220330220330DUSD445FCHKS100000189-735//1309170100000390154395
PLACI LOVECNAMENSKIH STORITEV
PLACI LOVECNAMENSKIH STORITEV
:62M:D220330USD123456
.
29
:62M:D220330USD123456
,
29
-}
-}
\ No newline at end of file
swiftCore/src/main/resources/swiftXml/MxPacs00900102.xml
View file @
18c184ec
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -94,7 +94,7 @@
...
@@ -94,7 +94,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -172,7 +172,7 @@
...
@@ -172,7 +172,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -196,7 +196,7 @@
...
@@ -196,7 +196,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -219,7 +219,7 @@
...
@@ -219,7 +219,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
...
swiftCore/src/main/resources/swiftXml/MxPacs00900102_COV.xml
View file @
18c184ec
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -95,7 +95,7 @@
...
@@ -95,7 +95,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -115,7 +115,7 @@
...
@@ -115,7 +115,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -146,7 +146,7 @@
...
@@ -146,7 +146,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -157,7 +157,7 @@
...
@@ -157,7 +157,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -202,7 +202,7 @@
...
@@ -202,7 +202,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -212,11 +212,11 @@
...
@@ -212,11 +212,11 @@
</RmtInf>
</RmtInf>
<InstdAmt
Ccy=
"USD"
>
393.17
</InstdAmt>
<InstdAmt
Ccy=
"USD"
>
393.17
</InstdAmt>
<InstrForCdtrAgt>
<InstrForCdtrAgt>
<Cd>
GHJK
</Cd>
<Cd>
PHOB
</Cd>
<InstrInf>
789556
</InstrInf>
<InstrInf>
789556
</InstrInf>
</InstrForCdtrAgt>
</InstrForCdtrAgt>
<InstrForNxtAgt>
<InstrForNxtAgt>
<Cd>
QWDF
</Cd>
<Cd>
PHOA
</Cd>
<InstrInf>
823456
</InstrInf>
<InstrInf>
823456
</InstrInf>
</InstrForNxtAgt>
</InstrForNxtAgt>
</UndrlygCstmrCdtTrf>
</UndrlygCstmrCdtTrf>
...
@@ -294,7 +294,7 @@
...
@@ -294,7 +294,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -318,7 +318,7 @@
...
@@ -318,7 +318,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
@@ -341,7 +341,7 @@
...
@@ -341,7 +341,7 @@
<Othr>
<Othr>
<Id>
789465123132165
</Id>
<Id>
789465123132165
</Id>
<SchmeNm>
<SchmeNm>
<Cd>
741852
</Cd>
<Cd>
BBAN
</Cd>
</SchmeNm>
</SchmeNm>
</Othr>
</Othr>
</Id>
</Id>
...
...
swiftCore/src/test/java/com/brilliance/mt2mx/camt053001/Test940Camt053001.java
View file @
18c184ec
package
com
.
brilliance
.
mt2mx
.
camt053001
;
package
com
.
brilliance
.
mt2mx
.
camt053001
;
import
com.prowidesoftware.swift.model.Tag
;
import
com.prowidesoftware.swift.model.field.Field61
;
import
com.prowidesoftware.swift.model.field.Field86
;
import
com.prowidesoftware.swift.model.mt.AbstractMT
;
import
java.io.File
;
import
java.util.List
;
public
class
Test940Camt053001
{
public
class
Test940Camt053001
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
@@ -9,5 +17,23 @@ public class Test940Camt053001 {
...
@@ -9,5 +17,23 @@ public class Test940Camt053001 {
//SwiftDto swiftDto = new Mt2SwiftDtoCreateManager().mt2SwiftDto(file, "d:/test/940camt0530.txt", null);
//SwiftDto swiftDto = new Mt2SwiftDtoCreateManager().mt2SwiftDto(file, "d:/test/940camt0530.txt", null);
//System.out.println(swiftDto.toString());
//System.out.println(swiftDto.toString());
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT940.txt"
);
AbstractMT
abstractMT
=
AbstractMT
.
parse
(
file
);
List
<
Tag
>
tagsList
=
abstractMT
.
getSwiftMessage
().
getBlock4
().
getTags
();
for
(
int
i
=
0
;
i
<
tagsList
.
size
();
i
++)
{
Tag
tag
=
tagsList
.
get
(
i
);
if
(
"61"
.
equals
(
tag
.
getName
()))
{
Field61
field61
=
new
Field61
(
tag
.
getValue
());
System
.
out
.
println
(
field61
.
getDCMark
());
System
.
out
.
println
(
field61
.
getFundsCode
());
System
.
out
.
println
(
field61
.
getReferenceForTheAccountOwner
());
System
.
out
.
println
(
field61
.
getReferenceOfTheAccountServicingInstitution
());
System
.
out
.
println
(
field61
.
getSupplementaryDetails
());
if
(
"86"
.
equals
(
tagsList
.
get
(
i
+
1
).
getName
()))
{
Field86
field86
=
new
Field86
(
tagsList
.
get
(
i
+
1
).
getValue
());
System
.
out
.
println
(
field86
.
getValue
().
replace
(
"\r\n"
,
""
));
}
}
}
}
}
}
}
swiftCore/src/test/java/com/brilliance/mt2mx/pacs009001/Test.java
0 → 100644
View file @
18c184ec
package
com
.
brilliance
.
mt2mx
.
pacs009001
;
import
com.brilliance.swift.SwiftTransfer
;
import
java.io.File
;
public
class
Test
{
private
static
void
test202
()
{
String
mx
=
SwiftTransfer
.
mt2Mx
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt202.txt"
),
"d:/test/pacs00900109.xml"
,
null
);
System
.
out
.
println
(
mx
);
}
private
static
void
test202Cov
()
{
String
mx
=
SwiftTransfer
.
mt2Mx
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\Mt202_COV.txt"
),
"d:/test/pacs00900109.xml"
,
null
);
System
.
out
.
println
(
mx
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
//test202();
test202Cov
();
}
}
swiftCore/src/test/java/com/brilliance/mt2swiftdto/camt053001/Test940Camt053001.java
View file @
18c184ec
...
@@ -9,7 +9,7 @@ public class Test940Camt053001 {
...
@@ -9,7 +9,7 @@ public class Test940Camt053001 {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT940.txt"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT940.txt"
);
SwiftDto
swiftDto
=
new
SwiftTransfer
().
mt2SwiftDto
(
file
,
"D:/
MtToSwif
t/BankToCustomerStatement.json"
,
null
);
SwiftDto
swiftDto
=
new
SwiftTransfer
().
mt2SwiftDto
(
file
,
"D:/
tes
t/BankToCustomerStatement.json"
,
null
);
System
.
out
.
println
(
swiftDto
.
toString
());
System
.
out
.
println
(
swiftDto
.
toString
());
}
}
}
}
swiftCore/src/test/java/com/brilliance/mt2swiftdto/camt053001/Test950Camt053001.java
View file @
18c184ec
...
@@ -9,7 +9,7 @@ public class Test950Camt053001 {
...
@@ -9,7 +9,7 @@ public class Test950Camt053001 {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT950.txt"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftTxt\\MT950.txt"
);
SwiftDto
swiftDto
=
new
SwiftTransfer
().
mt2SwiftDto
(
file
,
"D:/
MtToSwif
t/BankToStatement.json"
,
null
);
SwiftDto
swiftDto
=
new
SwiftTransfer
().
mt2SwiftDto
(
file
,
"D:/
tes
t/BankToStatement.json"
,
null
);
System
.
out
.
println
(
swiftDto
.
toString
());
System
.
out
.
println
(
swiftDto
.
toString
());
}
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202.java
View file @
18c184ec
package
com
.
brilliance
.
mx2mt
.
mt202
;
package
com
.
brilliance
.
mx2mt
.
mt202
;
import
com.brilliance.swift.
mx2mt.Mx2MtCreateManag
er
;
import
com.brilliance.swift.
SwiftTransf
er
;
import
java.io.File
;
import
java.io.File
;
public
class
TestMx2MtFor202
{
public
class
TestMx2MtFor202
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Mx2MtCreateManager
mx2MtCreateManager
=
new
Mx2MtCreateManager
();
String
mt202
=
SwiftTransfer
.
mx2Mt
(
String
mt202
=
mx2MtCreateManager
.
mx2mt
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml"
),
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml"
),
"d:/test/MT202.txt"
);
"d:/test/MT202.txt"
,
null
);
System
.
out
.
println
(
mt202
);
System
.
out
.
println
(
mt202
);
}
}
}
}
swiftCore/src/test/java/com/brilliance/mx2mt/mt202/TestMx2MtFor202COV.java
View file @
18c184ec
package
com
.
brilliance
.
mx2mt
.
mt202
;
package
com
.
brilliance
.
mx2mt
.
mt202
;
import
com.brilliance.swift.
mx2mt.Mx2MtCreateManag
er
;
import
com.brilliance.swift.
SwiftTransf
er
;
import
java.io.File
;
import
java.io.File
;
public
class
TestMx2MtFor202COV
{
public
class
TestMx2MtFor202COV
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Mx2MtCreateManager
mx2MtCreateManager
=
new
Mx2MtCreateManager
();
String
mt202Cov
=
SwiftTransfer
.
mx2Mt
(
String
mt202
=
mx2MtCreateManager
.
mx2mt
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102_COV.xml"
),
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102_COV.xml"
),
"d:/test/MT202
_COV.txt"
);
"d:/test/MT202
Cov.txt"
,
null
);
System
.
out
.
println
(
mt202
);
System
.
out
.
println
(
mt202
Cov
);
}
}
}
}
swiftCore/src/test/java/com/brilliance/mx2swiftdto/fininstcdttsf/Test.java
0 → 100644
View file @
18c184ec
package
com
.
brilliance
.
mx2swiftdto
.
fininstcdttsf
;
import
com.brilliance.swift.SwiftTransfer
;
import
com.brilliance.swift.vo.SwiftDto
;
import
java.io.File
;
public
class
Test
{
private
static
void
test202
()
{
SwiftDto
swiftDto
=
SwiftTransfer
.
mx2SwiftDto
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102.xml"
),
"d:/test/FinancialInstitutionCreditTransfer.json"
,
null
);
System
.
out
.
println
(
swiftDto
);
}
private
static
void
test202Cov
()
{
SwiftDto
swiftDto
=
SwiftTransfer
.
mx2SwiftDto
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxPacs00900102_COV.xml"
),
"d:/test/FinancialInstitutionCreditTransfer.json"
,
null
);
System
.
out
.
println
(
swiftDto
);
}
public
static
void
main
(
String
[]
args
)
{
//test202();
test202Cov
();
}
}
swiftCore/src/test/java/com/brilliance/swiftdto2mx/camt053001/Text940camt053001.java
View file @
18c184ec
...
@@ -11,7 +11,7 @@ import java.io.File;
...
@@ -11,7 +11,7 @@ import java.io.File;
public
class
Text940camt053001
{
public
class
Text940camt053001
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftJson\\BankToCustomerStatement.json"
);
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftJson\\BankToCustomerStatement.json"
);
String
mtStr
=
SwiftTransfer
.
swiftDto2Mx
(
file
,
"D:/
SwiftToMx
/MxCamt05300108_940.xml"
);
String
mtStr
=
SwiftTransfer
.
swiftDto2Mx
(
file
,
"D:/
test
/MxCamt05300108_940.xml"
);
System
.
out
.
println
(
mtStr
);
System
.
out
.
println
(
mtStr
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment