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
43ea2afb
Commit
43ea2afb
authored
Jul 08, 2022
by
chengzhuoshen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix code
parent
6d855680
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
16 deletions
+32
-16
SwiftTransfer.java
...ore/src/main/java/com/brilliance/swift/SwiftTransfer.java
+20
-15
ContextImpl.java
...c/main/java/com/brilliance/swift/context/ContextImpl.java
+1
-1
SwiftTranslationErrorInfo.java
...va/com/brilliance/swift/vo/SwiftTranslationErrorInfo.java
+11
-0
No files found.
swiftCore/src/main/java/com/brilliance/swift/SwiftTransfer.java
View file @
43ea2afb
package
com
.
brilliance
.
swift
;
import
com.brilliance.swift.exception.SwiftException
;
import
com.brilliance.swift.mt2
SwiftDto.Mt2SwiftDtoCreate
Manager
;
import
com.brilliance.swift.mt2
mx.Mt2MxCreator
Manager
;
import
com.brilliance.swift.mx2map.Mx2MapCreatorManager
;
import
com.brilliance.swift.mx2mt.Mx2MtCreatorManager
;
import
com.brilliance.swift.swiftdto2mx.SwiftDto2MxCreatorManager
;
import
com.brilliance.swift.util.StringUtil
;
import
com.brilliance.swift.util.SwiftTransferUtil
;
import
com.brilliance.swift.util.XmlUtil
;
import
com.brilliance.swift.vo.SwiftDto
;
import
com.brilliance.swift.vo.SwiftTranslationReport
;
import
com.prowidesoftware.swift.model.MxId
;
import
com.prowidesoftware.swift.model.mx.AbstractMX
;
...
...
@@ -65,16 +63,14 @@ public class SwiftTransfer {
public
static
String
mt2Mx
(
File
file
,
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
try
{
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
SwiftDto
swiftDto
=
new
Mt2SwiftDtoCreateManager
().
convert
(
mtStr
,
outPutFilePath
,
extraMap
);
return
new
SwiftDto2MxCreatorManager
().
swiftDto2Mx
(
swiftDto
,
outPutFilePath
);
return
mt2Mx
(
mtStr
,
outPutFilePath
,
extraMap
);
}
catch
(
IOException
e
)
{
throw
new
SwiftException
(
"ERROR"
,
e
.
getMessage
());
throw
new
SwiftException
(
e
.
getMessage
());
}
}
public
static
String
mt2Mx
(
String
mtStr
,
String
outPutFilePath
,
Map
<
String
,
Object
>
extraMap
)
throws
SwiftException
{
SwiftDto
swiftDto
=
new
Mt2SwiftDtoCreateManager
().
convert
(
mtStr
,
outPutFilePath
,
extraMap
);
return
new
SwiftDto2MxCreatorManager
().
swiftDto2Mx
(
swiftDto
,
outPutFilePath
);
return
new
Mt2MxCreatorManager
().
mt2mx
(
mtStr
,
outPutFilePath
,
extraMap
);
}
/**
...
...
@@ -110,6 +106,14 @@ public class SwiftTransfer {
}
public
static
String
mx2Gson
(
File
file
)
{
try
{
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
return
mx2Gson
(
mtStr
);
}
catch
(
IOException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
/**
* 将MX xml转换成gson 字符串
* @param xmlStr
...
...
@@ -132,6 +136,14 @@ public class SwiftTransfer {
return
new
Mx2MapCreatorManager
().
mx2Map
(
xmlStr
);
}
public
static
boolean
validateMx
(
File
file
)
{
try
{
String
mtStr
=
FileUtils
.
readFileToString
(
file
);
return
validateMx
(
mtStr
);
}
catch
(
IOException
e
)
{
throw
new
SwiftException
(
e
.
getMessage
());
}
}
/**
* 根据xml的内容获取对应的xsd文件并校验
* 失败则抛出异常
...
...
@@ -181,11 +193,4 @@ public class SwiftTransfer {
}
return
true
;
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\swiftCore\\src\\main\\resources\\swiftXml\\MxCamt05700106.xml"
);
String
xmlStr
=
FileUtils
.
readFileToString
(
file
);
validateMx
(
xmlStr
);
}
}
swiftCore/src/main/java/com/brilliance/swift/context/ContextImpl.java
View file @
43ea2afb
...
...
@@ -94,6 +94,6 @@ public class ContextImpl implements Context, Serializable {
if
(
null
==
paramMap
||
paramMap
.
isEmpty
())
{
return
;
}
paramMap
.
forEach
((
key
,
value
)
->
map
.
put
(
key
.
toString
(),
paramMap
.
get
(
value
)
));
paramMap
.
forEach
((
key
,
value
)
->
map
.
put
(
key
.
toString
(),
value
));
}
}
swiftCore/src/main/java/com/brilliance/swift/vo/SwiftTranslationErrorInfo.java
View file @
43ea2afb
...
...
@@ -51,4 +51,15 @@ public class SwiftTranslationErrorInfo {
public
void
setOriginalValue
(
String
originalValue
)
{
this
.
originalValue
=
originalValue
;
}
@Override
public
String
toString
()
{
return
"SwiftTranslationErrorInfo{"
+
"location='"
+
location
+
'\''
+
", errorCode='"
+
errorCode
+
'\''
+
", description='"
+
description
+
'\''
+
", errorType='"
+
errorType
+
'\''
+
", originalValue='"
+
originalValue
+
'\''
+
'}'
;
}
}
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