Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftISOEditor
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
swift
swiftISOEditor
Commits
8b1c110d
Commit
8b1c110d
authored
Mar 20, 2024
by
lixinyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增cips111、112报文界面,新增cips组报、检核功能
parent
4a54d03d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
647 additions
and
13 deletions
+647
-13
post.js
editor_vue/src/iso/Service/post.js
+34
-11
service.js
editor_vue/src/iso/Service/service.js
+2
-2
Date.vue
editor_vue/src/iso/components/Date.vue
+6
-0
index.js
editor_vue/src/iso/components/index.js
+2
-0
index.vue
editor_vue/src/iso/index.vue
+2
-0
MsgCode.js
editor_vue/src/iso/script/MsgCode.js
+97
-0
MsgComRender.js
editor_vue/src/iso/script/MsgComRender.js
+14
-0
index.js
editor_vue/src/iso/script/MsgJson/index.js
+6
-0
index.js
editor_vue/src/iso/script/MsgJsonRtgs/index.js
+4
-0
MsgValidator.js
editor_vue/src/iso/script/MsgValidator.js
+41
-0
index.js
editor_vue/src/router/index.js
+12
-0
CipsTransfer.java
...e/src/main/java/com/brilliance/mxeditor/CipsTransfer.java
+212
-0
CipsEditorController.java
.../brilliance/mxeditor/controller/CipsEditorController.java
+0
-0
CipsVo.java
...vice/src/main/java/com/brilliance/mxeditor/vo/CipsVo.java
+114
-0
pacs00800106.xsd
swift-service/src/main/resources/xsds/pacs00800106.xsd
+0
-0
pacs00900106.xsd
swift-service/src/main/resources/xsds/pacs00900106.xsd
+0
-0
TestCIPS.java
...rvice/src/test/java/com/brilliance/mxeditor/TestCIPS.java
+101
-0
No files found.
editor_vue/src/iso/Service/post.js
View file @
8b1c110d
...
...
@@ -2,77 +2,100 @@ import link from "./service"
export
default
{
sendSWiftMes
(
data
){
return
new
link
({
url
:
`/msgsend`
,
url
:
`/
swift/
msgsend`
,
method
:
"post"
,
data
:
data
})
},
saveSWiftMes
(
data
){
return
new
link
({
url
:
`/msgsave`
,
url
:
`/
swift/
msgsave`
,
method
:
"post"
,
data
:
data
})
},
validateSWiftMes
(
data
){
return
new
link
({
url
:
`/msgvalidate`
,
url
:
`/
swift/
msgvalidate`
,
method
:
"post"
,
data
:
data
})
},
mx2mt
(
data
){
return
new
link
({
url
:
`/mx2mt`
,
url
:
`/
swift/
mx2mt`
,
method
:
"post"
,
data
:
data
})
},
mxType
(
data
){
return
new
link
({
url
:
`/mxType`
,
url
:
`/
swift/
mxType`
,
method
:
"post"
,
data
:
data
})
},
mt2mx
(
data
){
return
new
link
({
url
:
`/mt2mx`
,
url
:
`/
swift/
mt2mx`
,
method
:
"post"
,
data
:
data
})
},
mx2Json
(
data
){
return
new
link
({
url
:
`/mx2Json`
,
url
:
`/
swift/
mx2Json`
,
method
:
"post"
,
data
:
data
})
},
saveTemplate
(
data
){
return
new
link
({
url
:
`/saveTemplate`
,
url
:
`/s
wift/s
aveTemplate`
,
method
:
"post"
,
data
:
data
})
},
getTemplate
(
data
){
return
new
link
({
url
:
`/getTemplate`
,
url
:
`/
swift/
getTemplate`
,
method
:
"post"
,
data
:
data
})
},
getCancelOriginalMsgInfos
(
data
){
return
new
link
({
url
:
`/getCancelOriginalMsgInfos`
,
url
:
`/
swift/
getCancelOriginalMsgInfos`
,
method
:
"post"
,
data
:
data
})
},
getFillElements
(
data
){
return
new
link
({
url
:
`/getFillElements`
,
url
:
`/swift/getFillElements`
,
method
:
"post"
,
data
:
data
})
},
sendCipsMes
(
data
){
return
new
link
({
url
:
`/cips/msgsend`
,
method
:
"post"
,
data
:
data
})
},
saveCipsMes
(
data
){
return
new
link
({
url
:
`/cips/msgsave`
,
method
:
"post"
,
data
:
data
})
},
validateCipsMes
(
data
){
return
new
link
({
url
:
`/cips/msgvalidate`
,
method
:
"post"
,
data
:
data
})
...
...
editor_vue/src/iso/Service/service.js
View file @
8b1c110d
...
...
@@ -2,8 +2,8 @@
import
axios
from
'axios'
const
service
=
axios
.
create
({
// baseURL: '/swift-editor-1.0.0
/swift
', //代理
baseURL
:
'/swift-editor
/swift
'
,
//本地用这个
// baseURL: '/swift-editor-1.0.0', //代理
baseURL
:
'/swift-editor'
,
//本地用这个
timeout
:
50000
// request timeout
})
...
...
editor_vue/src/iso/components/Date.vue
View file @
8b1c110d
...
...
@@ -20,6 +20,11 @@ export default {
this
.
$set
(
this
.
dataModel
,
'value'
,
this
.
$moment
(
new
Date
()).
format
(
"YYYY-MM-DDTHH:mm:ss.SSS+08:00"
));
console
.
log
(
this
.
dataModel
.
value
);
}
if
(
this
.
dateType
===
'date'
&&
this
.
dataModel
.
tag
===
'XpctdSttlmDt'
&&
this
.
dataModel
.
defaultValue
!=
'disabled'
)
{
this
.
$delete
(
this
.
dataModel
,
'value'
);
this
.
$set
(
this
.
dataModel
,
'value'
,
this
.
$moment
(
new
Date
()).
format
(
"YYYY-MM-DD"
));
console
.
log
(
this
.
dataModel
.
value
);
}
},
}
</
script
>
\ No newline at end of file
editor_vue/src/iso/components/index.js
View file @
8b1c110d
...
...
@@ -5,6 +5,7 @@ import Time from "./Time.vue";
import
Date
from
"./Date.vue"
;
import
List
from
"./List.vue"
;
import
Amount
from
"./Amount.vue"
;
import
AmountCIPS
from
"./AmountCIPS.vue"
;
import
HiddenInput
from
"./HiddenInput.vue"
;
import
MandatoryNode
from
"./MandatoryNode.vue"
;
import
OptionalNode
from
"./OptionalNode.vue"
;
...
...
@@ -22,6 +23,7 @@ export default {
"iso-date"
:
Date
,
"iso-list"
:
List
,
"iso-amount"
:
Amount
,
"iso-amountCIPS"
:
AmountCIPS
,
"iso-hidden-input"
:
HiddenInput
,
"node-mandatory"
:
MandatoryNode
,
"node-optional"
:
OptionalNode
,
...
...
editor_vue/src/iso/index.vue
View file @
8b1c110d
...
...
@@ -75,6 +75,8 @@ export default {
let
icp
=
this
.
inputCbprPlus
;
for
(
let
mess
of
this
.
messageTypeCodes
){
if
(
icp
!=
null
||
icp
!=
undefined
){
console
.
log
(
mess
.
value
.
indexOf
(
icp
));
console
.
log
(
mess
.
value
);
if
(
mess
.
value
.
indexOf
(
icp
)
!=
-
1
)
mess
.
isShow
=
true
;
else
...
...
editor_vue/src/iso/script/MsgCode.js
View file @
8b1c110d
...
...
@@ -13793,6 +13793,19 @@ const MsgCodes = {
label
:
"PO Box"
},
],
CIPSmessageTypeCode
:[
{
value
:
"cips.111.001.02"
,
label
:
"客户汇款报文"
,
label2
:
"客户汇款报文"
,
isShow
:
true
,
},{
value
:
"cips.112.001.02"
,
label
:
"金融机构汇款报文"
,
label2
:
"金融机构汇款报文"
,
isShow
:
true
,
},
],
messageTypeCode
:
[{
value
:
"pacs.008.001.08"
,
label
:
"FI To FI Customer Credit Transfer"
,
...
...
@@ -15469,6 +15482,90 @@ const MsgCodes = {
label
:
"Urgent"
},
],
BizPhaseTypeCode
:
[{
value
:
"DAYT"
,
label
:
"日间"
},
{
value
:
"NITT"
,
label
:
"夜间"
},
],
IDTypeCode
:
[{
value
:
"01"
,
label
:
"第一代居民身份证"
},
{
value
:
"02"
,
label
:
"第二代居民身份证"
},{
value
:
"03"
,
label
:
"临时身份证"
},
{
value
:
"04"
,
label
:
"中国护照"
},{
value
:
"05"
,
label
:
"户口薄"
},
{
value
:
"06"
,
label
:
"村民委员会证明"
},{
value
:
"07"
,
label
:
"学生证"
},
{
value
:
"08"
,
label
:
"军官证"
},{
value
:
"09"
,
label
:
"离休干部荣誉证"
},
{
value
:
"10"
,
label
:
"军官退休证"
},{
value
:
"11"
,
label
:
"文职干部退休证"
},
{
value
:
"12"
,
label
:
"军事学员证"
},{
value
:
"13"
,
label
:
"武警证"
},
{
value
:
"14"
,
label
:
"士兵证"
},{
value
:
"15"
,
label
:
"港澳居民来往内地通行证"
},
{
value
:
"16"
,
label
:
"台湾居民来往大陆通行证"
},{
value
:
"17"
,
label
:
"外国人永久居留证"
},
{
value
:
"18"
,
label
:
"边民出入境通行证"
},{
value
:
"19"
,
label
:
"外国护照"
},
{
value
:
"20"
,
label
:
"其他"
},{
value
:
"21"
,
label
:
"港澳台居民居住证"
},
],
externalDocumentLineType1Code
:
[{
value
:
"ADPI"
,
label
:
"AdditionalProductIdentificationAssignedByTheManufacturer"
,
...
...
editor_vue/src/iso/script/MsgComRender.js
View file @
8b1c110d
import
{
amountValidator
,
amountCIPSValidator
,
numberValidator
,
regExpValidator
,
emptyObjectValueValidator
,
...
...
@@ -86,6 +87,19 @@ export default function msgComRender(node) {
trigger
:
"blur"
,
};
break
;
case
"AmountCIPS"
:
const
sca1
=
partTwo
===
""
?
partTwo
.
split
(
","
)
:
[];
renderObj
.
is
=
"iso-amountCIPS"
;
renderObj
.
props
=
{
sca1
};
renderObj
.
contextValidator
=
{
validator
:
amountCIPSValidator
(
data
.
status
===
"M"
&&
!
data
.
unable
&&
!
data
.
disabled
,
data
.
name
,
sca1
),
trigger
:
"blur"
,
};
break
;
case
"HiddenInput"
:
renderObj
.
is
=
"iso-hidden-input"
;
break
;
...
...
editor_vue/src/iso/script/MsgJson/index.js
View file @
8b1c110d
...
...
@@ -17,6 +17,8 @@ import Head_010_001_03 from "./Head_010_001_03";
// import Head_057_001_06 from "./Head_057_001_06";
// import Head_060_001_05 from "./Head_060_001_05";
import
Pacs_008_001_08
from
"./Pacs_008_001_08"
;
import
cips_111_001_02
from
"./cips_111_001_02"
;
import
cips_112_001_02
from
"./cips_112_001_02"
;
import
Camt_053_001_08
from
"./Camt_053_001_08"
;
import
Camt_054_001_08
from
"./Camt_054_001_08"
;
import
Camt_056_001_08
from
"./Camt_056_001_08"
;
...
...
@@ -132,6 +134,10 @@ export default function MsgJsonMap(mty) {
// return msgClone(Head_060_001_05);
case
"pacs.008.001.08"
:
return
msgClone
(
Pacs_008_001_08
);
case
"cips.111.001.02"
:
return
msgClone
(
cips_111_001_02
);
case
"cips.112.001.02"
:
return
msgClone
(
cips_112_001_02
);
case
"camt.053.001.08"
:
return
msgClone
(
Camt_053_001_08
);
case
"Amount"
:
...
...
editor_vue/src/iso/script/MsgJsonRtgs/index.js
View file @
8b1c110d
...
...
@@ -86,6 +86,10 @@ export default function MsgJsonMap(mty) {
return
msgClone
(
Camt_029_001_09
);
case
"pacs.008.001.08"
:
return
msgClone
(
Pacs_008_001_08
);
case
"cips.111.001.02"
:
return
msgClone
(
cips_111_001_02
);
case
"cips.112.001.02"
:
return
msgClone
(
cips_112_001_02
);
case
"admi.002.001.01"
:
return
msgClone
(
Admi_002_001_01
);
case
"pacs.002.001.10"
:
...
...
editor_vue/src/iso/script/MsgValidator.js
View file @
8b1c110d
...
...
@@ -41,6 +41,47 @@ export function amountValidator(isM, desc, sca) {
};
}
export
function
amountCIPSValidator
(
isM
,
desc
,
sca
)
{
return
(
rule
,
value
,
callback
)
=>
{
const
amtValue
=
value
.
amount
+
""
;
const
amtCcy
=
value
.
ccy
;
if
(
amtValue
===
undefined
||
amtValue
===
null
||
amtValue
.
trim
()
===
""
)
{
if
(
isM
)
{
callback
(
new
Error
(
desc
+
" Cannot be null"
));
}
else
if
(
amtCcy
!=
''
){
callback
(
new
Error
(
"Amount Cannot be null"
));
}
else
{
callback
();
}
}
else
if
(
sca
.
length
===
2
)
{
const
totalDig
=
sca
[
0
];
const
fractionDig
=
sca
[
1
];
if
(
amtValue
.
indexOf
(
"."
)
==
-
1
)
{
//不包含小数点
if
(
amtValue
.
length
<=
totalDig
)
{
callback
();
}
else
{
callback
(
new
Error
(
"The total number of digits cannot exceed"
+
totalDig
));
}
}
else
{
//包含小数点
let
valueArray
=
amtValue
.
split
(
"."
);
let
integerNumber
=
valueArray
[
0
].
length
;
let
decimalNumber
=
valueArray
[
1
].
length
;
if
(
decimalNumber
>
fractionDig
)
{
callback
(
new
Error
(
"The decimal place cannot exceed"
+
fractionDig
));
}
else
if
(
integerNumber
+
decimalNumber
>
totalDig
)
{
callback
(
new
Error
(
"The total number of digits cannot exceed"
+
totalDig
));
}
else
{
callback
();
}
}
}
else
{
callback
();
}
};
}
export
function
numberValidator
(
totalDig
,
fractionDig
)
{
return
(
rule
,
value
,
callback
)
=>
{
value
=
value
+
""
;
...
...
editor_vue/src/router/index.js
View file @
8b1c110d
...
...
@@ -2,9 +2,11 @@ import VueRouter from "vue-router";
import
ISO
from
"../iso/pages/index.vue"
;
import
ISO2
from
"../iso/pages/indexrtgs.vue"
;
import
index
from
"../iso/index.vue"
;
import
indexcips
from
"../iso/indexcips.vue"
;
import
success
from
"../iso/pages/success.vue"
;
import
MX2MT
from
"../iso/pages/mx2mt.vue"
;
import
MT2MX
from
"../iso/pages/mt2mx.vue"
;
import
CIPS
from
"../iso/pages/indexcips.vue"
export
default
new
VueRouter
({
routes
:
[
...
...
@@ -14,6 +16,16 @@ export default new VueRouter({
props
:
true
,
},
{
path
:
"/cips/:mty/:loginUser"
,
component
:
CIPS
,
props
:
true
,
},
{
path
:
"/cips"
,
component
:
indexcips
,
props
:
true
,
},
{
path
:
"/rtgs/:mty/:loginUser"
,
component
:
ISO2
,
props
:
true
,
...
...
swift-service/src/main/java/com/brilliance/mxeditor/CipsTransfer.java
0 → 100644
View file @
8b1c110d
package
com
.
brilliance
.
mxeditor
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.cips.framework.Result
;
import
com.brilliance.cips.utils.MsgUtil
;
import
com.brilliance.mxeditor.exception.SwiftException
;
import
com.brilliance.mxeditor.util.MessageUtil
;
import
com.brilliance.mxeditor.util.StringUtil
;
import
org.apache.commons.io.FileUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
public
class
CipsTransfer
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
CipsTransfer
.
class
);
public
static
String
transfer
(
String
gsonStr
)
{
Map
<
String
,
Object
>
gsonMaps
=
JSON
.
parseObject
(
gsonStr
);
Date
date
=
new
Date
();
SimpleDateFormat
dateFormat1
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
dateFormat2
=
new
SimpleDateFormat
(
"HHmmss"
);
//改造map层级,使能转换成xml报文
//删除最外层FIToFICstmrCdtTrf
if
(
gsonMaps
.
get
(
"FIToFICstmrCdtTrf"
)
!=
null
)
{
JSONObject
jsonObject
=
(
JSONObject
)
gsonMaps
.
get
(
"FIToFICstmrCdtTrf"
);
for
(
String
key
:
jsonObject
.
keySet
())
{
gsonMaps
.
put
(
key
,
jsonObject
.
get
(
key
));
}
}
gsonMaps
.
remove
(
"FIToFICstmrCdtTrf"
);
//新增OrigSendDate
String
currentDate
=
dateFormat1
.
format
(
date
);
gsonMaps
.
put
(
"OrigSendDate"
,
currentDate
);
//新增OrigSendTime
String
currentTime
=
dateFormat2
.
format
(
date
);
gsonMaps
.
put
(
"OrigSendTime"
,
currentTime
);
//新增OrigReceiver
List
<
String
>
listOrigReceiver
=
new
ArrayList
<>(
Arrays
.
asList
(
"CdtTrfTxInf"
,
"InstdAgt"
,
"FinInstnId"
,
"ClrSysMmbId"
));
Map
resOrigReceiver
=
gsonMaps
;
for
(
String
s:
listOrigReceiver
)
{
if
(
resOrigReceiver
.
get
(
s
)
!=
null
)
resOrigReceiver
=
(
Map
)
resOrigReceiver
.
get
(
s
);
}
if
(
resOrigReceiver
.
get
(
"MmbId"
)
!=
null
)
gsonMaps
.
put
(
"OrigReceiver"
,
resOrigReceiver
.
get
(
"MmbId"
));
//新增OrigSender
List
<
String
>
listOrigSender
=
new
ArrayList
<>(
Arrays
.
asList
(
"CdtTrfTxInf"
,
"InstgAgt"
,
"FinInstnId"
,
"ClrSysMmbId"
));
Map
resOrigSender
=
gsonMaps
;
for
(
String
s:
listOrigSender
)
{
if
(
resOrigSender
.
get
(
s
)
!=
null
)
resOrigSender
=
(
Map
)
resOrigSender
.
get
(
s
);
}
if
(
resOrigSender
.
get
(
"MmbId"
)
!=
null
)
gsonMaps
.
put
(
"OrigSender"
,
resOrigSender
.
get
(
"MmbId"
));
//新增cipsEndToEndId
List
<
String
>
listcipsEndToEndId
=
new
ArrayList
<>(
Arrays
.
asList
(
"CdtTrfTxInf"
,
"PmtId"
));
Map
rescipsEndToEndId
=
gsonMaps
;
for
(
String
s:
listcipsEndToEndId
)
{
if
(
rescipsEndToEndId
.
get
(
s
)
!=
null
)
rescipsEndToEndId
=
(
Map
)
rescipsEndToEndId
.
get
(
s
);
}
if
(
rescipsEndToEndId
.
get
(
"EndToEndId"
)
!=
null
)
gsonMaps
.
put
(
"cipsEndToEndId"
,
rescipsEndToEndId
.
get
(
"EndToEndId"
));
//新增MesgRefID
List
<
String
>
list
=
new
ArrayList
<>(
Arrays
.
asList
(
"GrpHdr"
));
Map
res
=
gsonMaps
;
for
(
String
s:
list
)
{
if
(
res
.
get
(
s
)
!=
null
)
res
=
(
Map
)
res
.
get
(
s
);
}
if
(
res
.
get
(
"MsgId"
)
!=
null
)
gsonMaps
.
put
(
"MesgRefID"
,
res
.
get
(
"MsgId"
));
//新增MesgID、cipsMsgId、OrigSenderSID、OrigReceiverSID
gsonMaps
.
put
(
"MesgID"
,
gsonMaps
.
get
(
"MesgRefID"
));
gsonMaps
.
put
(
"cipsMsgId"
,
gsonMaps
.
get
(
"MesgRefID"
));
gsonMaps
.
put
(
"OrigSenderSID"
,
"CIPS"
);
gsonMaps
.
put
(
"OrigReceiverSID"
,
"CIPS"
);
String
swiftGsonStr
=
new
JSONObject
(
gsonMaps
).
toJSONString
();
System
.
out
.
println
(
"CIPSGsonStr------>:::"
+
swiftGsonStr
);
Result
result
=
MsgUtil
.
packMessage
(
swiftGsonStr
,
"UTF-8"
);
return
result
.
getMessage
();
}
//解析key的值,循环遍历,将value放进maps里面
public
static
void
putValue
(
Map
<
String
,
Object
>
maps
,
String
key
,
Object
value
){
String
[]
keys
=
key
.
split
(
"\\."
);
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++)
{
String
tmpKey
=
keys
[
i
];
if
(
i
==
(
keys
.
length
-
1
))
{
maps
.
put
(
tmpKey
,
value
);
}
else
{
boolean
jsonArrayFlag
=
false
;
if
(
tmpKey
.
endsWith
(
"*"
))
{
//表示此节点是JSONARRAY,
tmpKey
=
tmpKey
.
substring
(
0
,
tmpKey
.
indexOf
(
"*"
));
jsonArrayFlag
=
true
;
}
Object
obj
=
maps
.
get
(
tmpKey
);
if
(
obj
==
null
)
{
//如果目标maps没有值,则新建一个新的map,再循环遍历
if
(
jsonArrayFlag
)
{
JSONArray
jsonArray
=
new
JSONArray
();
maps
.
put
(
tmpKey
,
jsonArray
);
maps
=
new
HashMap
<>();
jsonArray
.
add
(
maps
);
}
else
{
Map
<
String
,
Object
>
tmpMaps
=
new
HashMap
<>();
maps
.
put
(
tmpKey
,
tmpMaps
);
maps
=
tmpMaps
;
}
}
else
{
if
(
jsonArrayFlag
)
{
JSONArray
jsonArray
=
(
JSONArray
)
obj
;
maps
=
(
Map
<
String
,
Object
>)
jsonArray
.
get
(
0
);
}
else
{
maps
=
(
Map
<
String
,
Object
>)
obj
;
}
}
}
}
}
public
static
Map
<
String
,
Object
>
transfer2
(
String
gsonStr
,
String
identifier
,
String
tp
)
{
Map
<
String
,
Object
>
gsonMaps
=
JSON
.
parseObject
(
gsonStr
);
InputStream
resourceAsStream
=
null
;
InputStream
resourceAsStream2
=
null
;
if
(
"rtgs"
.
equals
(
tp
))
{
resourceAsStream
=
MessageUtil
.
class
.
getResourceAsStream
(
"/templateOut/"
+
identifier
+
"_rtgs.properties"
);
resourceAsStream2
=
MessageUtil
.
class
.
getResourceAsStream
(
"/templateOut/head00100102_rtgs.properties"
);
}
else
{
resourceAsStream
=
MessageUtil
.
class
.
getResourceAsStream
(
"/templateOut/"
+
identifier
+
".properties"
);
}
if
(
resourceAsStream
==
null
)
{
throw
new
SwiftException
(
"没找到对应的配置文件"
+
identifier
);
}
List
<
String
>
properties
=
StringUtil
.
inputStreamToLines
(
resourceAsStream
);
if
(
resourceAsStream2
!=
null
)
{
List
<
String
>
properties2
=
StringUtil
.
inputStreamToLines
(
resourceAsStream2
);
properties
.
addAll
(
properties2
);
}
Map
<
String
,
Object
>
maps
=
new
HashMap
<>();
for
(
String
property
:
properties
)
{
if
(
property
.
startsWith
(
"#"
))
{
continue
;
//过滤注释
}
String
[]
strArr
=
property
.
split
(
"="
);
if
(
strArr
.
length
!=
2
)
{
continue
;
//过滤掉不符合规则的配置
}
String
key
=
strArr
[
0
].
trim
();
String
path
=
strArr
[
1
].
trim
();
if
(
path
.
indexOf
(
"@"
)
>
-
1
)
{
path
=
path
.
substring
(
0
,
path
.
indexOf
(
"@"
));
}
putValue2
(
gsonMaps
,
key
,
path
,
maps
,
tp
);
}
return
maps
;
}
public
static
Map
<
String
,
Object
>
putValue2
(
Map
<
String
,
Object
>
gsonMaps
,
String
key
,
String
path
,
Map
<
String
,
Object
>
maps
,
String
tp
)
{
String
[]
keys
=
key
.
split
(
"\\."
);
Map
<
String
,
Object
>
tmpMaps
=
null
;
tmpMaps
=
gsonMaps
;
Map
<
String
,
Object
>
appHdr
=
null
;
for
(
int
i
=
0
;
i
<
keys
.
length
;
i
++)
{
String
tmpKey
=
keys
[
i
];
if
(
i
==
(
keys
.
length
-
1
))
{
if
(
key
.
contains
(
"appHdr"
))
{
if
(!
Objects
.
isNull
(
maps
.
get
(
"appHdr"
)))
{
appHdr
=
(
Map
<
String
,
Object
>)
maps
.
get
(
"appHdr"
);
}
else
{
appHdr
=
new
HashMap
<>();
}
appHdr
.
put
(
path
,
tmpMaps
.
get
(
tmpKey
));
maps
.
put
(
"appHdr"
,
appHdr
);
}
else
{
maps
.
put
(
path
,
tmpMaps
.
get
(
tmpKey
));
}
}
else
{
if
(
tmpKey
.
endsWith
(
"*"
))
{
//表示此节点是JSONARRAY,
tmpKey
=
tmpKey
.
substring
(
0
,
tmpKey
.
indexOf
(
"*"
));
}
if
(
tmpMaps
.
get
(
tmpKey
)
instanceof
JSONArray
)
{
tmpMaps
=
(
JSONObject
)
((
JSONArray
)
tmpMaps
.
get
(
tmpKey
)).
get
(
0
);
}
else
if
(
tmpMaps
.
get
(
tmpKey
)
instanceof
JSONObject
)
{
tmpMaps
=
(
JSONObject
)
tmpMaps
.
get
(
tmpKey
);
}
else
{
if
(!
Objects
.
isNull
(
tmpMaps
.
get
(
tmpKey
)))
{
maps
.
put
(
path
,
tmpMaps
.
get
(
tmpKey
));
}
}
}
}
return
maps
;
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\src\\main\\resources\\json\\pacs00800108.json"
);
// File file = new File("d:/test/tst.json");
String
gsonStr
=
FileUtils
.
readFileToString
(
file
,
"UTF-8"
);
String
xml
=
transfer
(
gsonStr
);
System
.
out
.
println
(
xml
);
}
}
swift-service/src/main/java/com/brilliance/mxeditor/controller/CipsEditorController.java
0 → 100644
View file @
8b1c110d
This diff is collapsed.
Click to expand it.
swift-service/src/main/java/com/brilliance/mxeditor/vo/CipsVo.java
0 → 100644
View file @
8b1c110d
package
com
.
brilliance
.
mxeditor
.
vo
;
/**
* @author zh
* @create 2022-07-29 16:00
*/
public
class
CipsVo
{
private
String
json
;
private
String
xml
;
private
String
mtType
;
private
String
mty
;
private
String
smhinr
;
private
String
type
;
// 1-新增报文 2-更新报文
private
String
opeType
;
private
String
loginUser
;
//模板名称
private
String
name
;
//备注
private
String
text
;
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getMxminr
()
{
return
mxminr
;
}
public
void
setMxminr
(
String
mxminr
)
{
this
.
mxminr
=
mxminr
;
}
//模板inr
private
String
mxminr
;
public
String
getLoginUser
()
{
return
loginUser
;
}
public
void
setLoginUser
(
String
loginUser
)
{
this
.
loginUser
=
loginUser
;
}
public
String
getXml
()
{
return
xml
;
}
public
String
getOpeType
()
{
return
opeType
;
}
public
void
setOpeType
(
String
opeType
)
{
this
.
opeType
=
opeType
;
}
public
String
getJson
()
{
return
json
;
}
public
void
setJson
(
String
json
)
{
this
.
json
=
json
;
}
public
String
getMtType
()
{
return
mtType
;
}
public
String
getMty
()
{
return
mty
;
}
public
void
setMty
(
String
mty
)
{
this
.
mty
=
mty
;
}
public
String
getSmhinr
()
{
return
smhinr
;
}
public
void
setSmhinr
(
String
smhinr
)
{
this
.
smhinr
=
smhinr
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
swift-service/src/main/resources/xsds/pacs00800106.xsd
0 → 100644
View file @
8b1c110d
This diff is collapsed.
Click to expand it.
swift-service/src/main/resources/xsds/pacs00900106.xsd
0 → 100644
View file @
8b1c110d
This diff is collapsed.
Click to expand it.
swift-service/src/test/java/com/brilliance/mxeditor/TestCIPS.java
0 → 100644
View file @
8b1c110d
package
com
.
brilliance
.
mxeditor
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.cips.framework.Result
;
import
com.brilliance.cips.packet.model.Msg
;
import
com.brilliance.cips.utils.MsgUtil
;
import
org.apache.commons.io.FileUtils
;
import
org.junit.Test
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
public
class
TestCIPS
{
private
final
static
Logger
logger
=
LoggerFactory
.
getLogger
(
MxTransfer
.
class
);
@Test
public
void
testTrans
()
throws
IOException
{
// File file = new File(System.getProperty("user.dir")+"\\src\\main\\resources\\json\\111success.json");
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\src\\main\\resources\\json\\111.json"
);
String
gsonStr
=
FileUtils
.
readFileToString
(
file
,
"UTF-8"
);
Map
<
String
,
Object
>
gsonMaps
=
JSON
.
parseObject
(
gsonStr
);
Date
date
=
new
Date
();
SimpleDateFormat
dateFormat1
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
SimpleDateFormat
dateFormat2
=
new
SimpleDateFormat
(
"HHmmss"
);
//改造map层级,使能转换成xml报文
//删除最外层FIToFICstmrCdtTrf
if
(
gsonMaps
.
get
(
"FIToFICstmrCdtTrf"
)
!=
null
)
{
JSONObject
jsonObject
=
(
JSONObject
)
gsonMaps
.
get
(
"FIToFICstmrCdtTrf"
);
for
(
String
key
:
jsonObject
.
keySet
())
{
gsonMaps
.
put
(
key
,
jsonObject
.
get
(
key
));
}
}
gsonMaps
.
remove
(
"FIToFICstmrCdtTrf"
);
//新增OrigSendDate
String
currentDate
=
dateFormat1
.
format
(
date
);
gsonMaps
.
put
(
"OrigSendDate"
,
currentDate
);
//新增OrigSendTime
String
currentTime
=
dateFormat2
.
format
(
date
);
gsonMaps
.
put
(
"OrigSendTime"
,
currentTime
);
//新增OrigReceiver
List
<
String
>
listOrigReceiver
=
new
ArrayList
<>(
Arrays
.
asList
(
"CdtTrfTxInf"
,
"InstdAgt"
,
"FinInstnId"
,
"ClrSysMmbId"
));
Map
resOrigReceiver
=
gsonMaps
;
for
(
String
s:
listOrigReceiver
)
{
if
(
resOrigReceiver
.
get
(
s
)
!=
null
)
resOrigReceiver
=
(
Map
)
resOrigReceiver
.
get
(
s
);
}
if
(
resOrigReceiver
.
get
(
"MmbId"
)
!=
null
)
gsonMaps
.
put
(
"OrigReceiver"
,
resOrigReceiver
.
get
(
"MmbId"
));
//新增OrigSender
List
<
String
>
listOrigSender
=
new
ArrayList
<>(
Arrays
.
asList
(
"CdtTrfTxInf"
,
"InstgAgt"
,
"FinInstnId"
,
"ClrSysMmbId"
));
Map
resOrigSender
=
gsonMaps
;
for
(
String
s:
listOrigSender
)
{
if
(
resOrigSender
.
get
(
s
)
!=
null
)
resOrigSender
=
(
Map
)
resOrigSender
.
get
(
s
);
}
if
(
resOrigSender
.
get
(
"MmbId"
)
!=
null
)
gsonMaps
.
put
(
"OrigSender"
,
resOrigSender
.
get
(
"MmbId"
));
//新增cipsEndToEndId
List
<
String
>
listcipsEndToEndId
=
new
ArrayList
<>(
Arrays
.
asList
(
"CdtTrfTxInf"
,
"PmtId"
));
Map
rescipsEndToEndId
=
gsonMaps
;
for
(
String
s:
listcipsEndToEndId
)
{
if
(
rescipsEndToEndId
.
get
(
s
)
!=
null
)
rescipsEndToEndId
=
(
Map
)
rescipsEndToEndId
.
get
(
s
);
}
if
(
rescipsEndToEndId
.
get
(
"EndToEndId"
)
!=
null
)
gsonMaps
.
put
(
"cipsEndToEndId"
,
rescipsEndToEndId
.
get
(
"EndToEndId"
));
//新增MesgRefID
List
<
String
>
list
=
new
ArrayList
<>(
Arrays
.
asList
(
"GrpHdr"
));
Map
res
=
gsonMaps
;
for
(
String
s:
list
)
{
if
(
res
.
get
(
s
)
!=
null
)
res
=
(
Map
)
res
.
get
(
s
);
}
if
(
res
.
get
(
"MsgId"
)
!=
null
)
gsonMaps
.
put
(
"MesgRefID"
,
res
.
get
(
"MsgId"
));
//新增MesgID、cipsMsgId、OrigSenderSID、OrigReceiverSID
gsonMaps
.
put
(
"MesgID"
,
gsonMaps
.
get
(
"MesgRefID"
));
gsonMaps
.
put
(
"cipsMsgId"
,
gsonMaps
.
get
(
"MesgRefID"
));
gsonMaps
.
put
(
"OrigSenderSID"
,
"CIPS"
);
gsonMaps
.
put
(
"OrigReceiverSID"
,
"CIPS"
);
String
swiftGsonStr
=
new
JSONObject
(
gsonMaps
).
toJSONString
();
System
.
out
.
println
(
"CIPSGsonStr------>:::"
+
swiftGsonStr
);
Result
result
=
MsgUtil
.
packMessage
(
swiftGsonStr
,
"UTF-8"
);
System
.
out
.
println
(
result
.
getMessage
());
}
@Test
public
void
testcipsToMap
()
throws
IOException
{
File
file
=
new
File
(
System
.
getProperty
(
"user.dir"
)+
"\\src\\main\\resources\\json\\cips.111.001.02.xml"
);
String
gsonStr
=
FileUtils
.
readFileToString
(
file
,
"UTF-8"
);
Map
<
String
,
Object
>
gsonMaps
=
MsgUtil
.
cips2Map
(
file
);
String
swiftGsonStr
=
new
JSONObject
(
gsonMaps
).
toJSONString
();
System
.
out
.
println
(
"CIPSGsonStr------>:::"
+
swiftGsonStr
);
}
}
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