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
7d8e6adb
Commit
7d8e6adb
authored
May 20, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改读取文件路径代码
parent
247ac523
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
AbstractMx2SwiftDtoCreator.java
...lliance/swift/mx2swiftdto/AbstractMx2SwiftDtoCreator.java
+8
-1
Mx2SwiftDtoCCTCreator.java
...e/swift/mx2swiftdto/custcdttsf/Mx2SwiftDtoCCTCreator.java
+2
-1
Test.java
...ore/src/test/java/com/brilliance/mx2mtmap/mt103/Test.java
+8
-6
No files found.
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/AbstractMx2SwiftDtoCreator.java
View file @
7d8e6adb
...
@@ -15,6 +15,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
...
@@ -15,6 +15,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.net.URL
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.*
;
import
java.util.*
;
...
@@ -380,7 +381,13 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
...
@@ -380,7 +381,13 @@ public abstract class AbstractMx2SwiftDtoCreator implements Mx2SwiftDtoCreator{
*/
*/
protected
void
readPropertyFile
(
String
fileName
)
{
protected
void
readPropertyFile
(
String
fileName
)
{
try
{
try
{
File
propertyFile
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\template\\mx2swiftdto\\"
+
fileName
);
ClassLoader
contextClassLoader
=
Thread
.
currentThread
().
getContextClassLoader
();
URL
resource
=
contextClassLoader
.
getResource
(
"template/mx2swiftdto/"
+
fileName
);
if
(
resource
==
null
)
{
resource
=
AbstractMx2SwiftDtoCreator
.
class
.
getClassLoader
().
getResource
(
"template/mx2swiftdto/"
+
fileName
);
}
File
propertyFile
=
new
File
(
resource
.
getPath
());
List
<
String
>
properties
=
FileUtils
.
readLines
(
propertyFile
);
List
<
String
>
properties
=
FileUtils
.
readLines
(
propertyFile
);
if
(
properties
.
size
()
>
0
)
{
if
(
properties
.
size
()
>
0
)
{
for
(
String
property
:
properties
)
{
for
(
String
property
:
properties
)
{
...
...
swiftCore/src/main/java/com/brilliance/swift/mx2swiftdto/custcdttsf/Mx2SwiftDtoCCTCreator.java
View file @
7d8e6adb
...
@@ -13,6 +13,7 @@ import com.brilliance.swift.vo.common.ChargeInfo;
...
@@ -13,6 +13,7 @@ import com.brilliance.swift.vo.common.ChargeInfo;
import
org.dom4j.Document
;
import
org.dom4j.Document
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -89,7 +90,7 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
...
@@ -89,7 +90,7 @@ public class Mx2SwiftDtoCCTCreator extends AbstractMx2SwiftDtoCreator {
if
(
StringUtil
.
isNotEmpty
(
outputFilePath
))
{
if
(
StringUtil
.
isNotEmpty
(
outputFilePath
))
{
customerCreditTransfer
.
write
(
new
File
(
outputFilePath
));
customerCreditTransfer
.
write
(
new
File
(
outputFilePath
));
}
}
}
catch
(
Exception
e
)
{
}
catch
(
IO
Exception
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
}
}
}
}
...
...
swiftCore/src/test/java/com/brilliance/mx2mtmap/mt103/Test.java
View file @
7d8e6adb
...
@@ -19,16 +19,18 @@ public class Test {
...
@@ -19,16 +19,18 @@ public class Test {
public
static
void
main
(
String
[]
args
)
throws
IOException
{
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
xmlStr
=
FileUtils
.
readFileToString
(
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05400108_CREDIT.xml"
));
File
file
=
new
File
(
"D:\\test\\MxPacs00800102.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
//String xmlStr = FileUtils.readFileToString(new File(System.getProperty("user.dir")+"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05400108_CREDIT.xml"));
//Map<String, Object> extraMap = new HashMap<>();
//Map<String, Object> extraMap = new HashMap<>();
//extraMap.put("bnkBic", "BANKANC0XXX");//发报
//extraMap.put("bnkBic", "BANKANC0XXX");//发报
//
extraMap.put("bnkBic", "FOOBARC0");//收报
//
extraMap.put("bnkBic", "FOOBARC0");//收报
//Map<String, String> maps = SwiftTransfer.mx2MtMap(xmlStr, extraMap
);
Map
<
String
,
String
>
maps
=
SwiftTransfer
.
mx2MtMap
(
xmlStr
,
null
);
//
maps.forEach((k, v) -> System.out.println(k + "=" + v));
maps
.
forEach
((
k
,
v
)
->
System
.
out
.
println
(
k
+
"="
+
v
));
//String gson = SwiftTransfer.mx2Gson(xmlStr);
//String gson = SwiftTransfer.mx2Gson(xmlStr);
//System.out.println(gson);
//System.out.println(gson);
Map
<
String
,
String
>
maps
=
SwiftTransfer
.
mx2Map
(
xmlStr
);
//
Map<String, String> maps = SwiftTransfer.mx2Map(xmlStr);
maps
.
forEach
((
k
,
v
)
->
System
.
out
.
println
(
k
+
"="
+
v
));
//
maps.forEach((k, v) -> System.out.println(k + "=" + v));
}
}
}
}
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