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
0380c934
Commit
0380c934
authored
Apr 29, 2024
by
lixinyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将组报和解析都迁移至接口平台
parent
78d0385b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
146 additions
and
71 deletions
+146
-71
pom.xml
swift-service/pom.xml
+4
-4
CipsTransfer.java
...e/src/main/java/com/brilliance/mxeditor/CipsTransfer.java
+25
-2
MxTransfer.java
...ice/src/main/java/com/brilliance/mxeditor/MxTransfer.java
+19
-19
CipsEditorController.java
.../brilliance/mxeditor/controller/CipsEditorController.java
+58
-16
MxEditorController.java
...om/brilliance/mxeditor/controller/MxEditorController.java
+17
-17
cips-config.properties
swift-service/src/main/resources/cfg/cips-config.properties
+23
-13
No files found.
swift-service/pom.xml
View file @
0380c934
...
...
@@ -28,10 +28,10 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-logging
</artifactId>
</exclusion>
<!-- <exclusion>--
>
<!-- <groupId>org.springframework.boot</groupId>--
>
<!-- <artifactId>spring-boot-starter-tomcat</artifactId>--
>
<!-- </exclusion>--
>
<exclusion
>
<groupId>
org.springframework.boot
</groupId
>
<artifactId>
spring-boot-starter-tomcat
</artifactId
>
</exclusion
>
</exclusions>
</dependency>
<dependency>
...
...
swift-service/src/main/java/com/brilliance/mxeditor/CipsTransfer.java
View file @
0380c934
...
...
@@ -6,6 +6,7 @@ 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.interf.CommonSend
;
import
com.brilliance.mxeditor.util.MessageUtil
;
import
com.brilliance.mxeditor.util.StringUtil
;
import
org.apache.commons.io.FileUtils
;
...
...
@@ -104,8 +105,30 @@ public class CipsTransfer {
String
swiftGsonStr
=
new
JSONObject
(
gsonMaps
).
toJSONString
();
System
.
out
.
println
(
"CIPSGsonStr------>:::"
+
swiftGsonStr
);
Result
result
=
MsgUtil
.
packMessage
(
swiftGsonStr
,
"UTF-8"
);
return
result
.
getMessage
();
//本地
// Result result = MsgUtil.packMessage(swiftGsonStr,"UTF-8");
// return result.getMessage();
//远程
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"interface"
,
"packMessage"
);
map
.
put
(
"transaction"
,
"packMessage"
);
map
.
put
(
"msg"
,
swiftGsonStr
);
Map
transres
=
(
Map
)
CommonSend
.
send
(
map
);
String
retcod
=
(
String
)
transres
.
get
(
"retcode"
);
logger
.
info
(
"packMessage结果:"
+
transres
.
toString
());
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
logger
.
info
(
"组报成功"
);
return
(
String
)
transres
.
get
(
"cipsContent"
);
}
else
{
logger
.
info
(
"组报失败"
);
return
null
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
return
"0"
;
}
}
//解析key的值,循环遍历,将value放进maps里面
...
...
swift-service/src/main/java/com/brilliance/mxeditor/MxTransfer.java
View file @
0380c934
...
...
@@ -98,26 +98,26 @@ public class MxTransfer {
logger
.
debug
(
"swiftGsonStr------>:::"
+
swiftGsonStr
);
//System.out.println("swiftGsonStr---->:" + swiftGsonStr);
//本地测试
AbstractMX
abstractMX
=
AbstractMX
.
fromJson
(
swiftGsonStr
);
return
abstractMX
.
message
();
//
AbstractMX abstractMX = AbstractMX.fromJson(swiftGsonStr);
//
return abstractMX.message();
//远程
//
try {
//
Map<String, Object> map = new HashMap();
//
map.put("interface", "mxTranslate");
//
map.put("transaction", "translate");
//
map.put("swiftGsonStr", swiftGsonStr);
//
Map res = (Map) CommonSend.send(map);
//
String retcod = (String) res.get("retcode");
//
if (retcod != null && retcod.endsWith("0000000")) {
//
return (String) res.get("xml");
//
}
//
else {
//
return null;
//
}
//
} catch (Exception e) {
//
logger.error(e.getMessage(), e);
//
return "0";
//
}
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"interface"
,
"mxTranslate"
);
map
.
put
(
"transaction"
,
"translate"
);
map
.
put
(
"swiftGsonStr"
,
swiftGsonStr
);
Map
res
=
(
Map
)
CommonSend
.
send
(
map
);
String
retcod
=
(
String
)
res
.
get
(
"retcode"
);
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
return
(
String
)
res
.
get
(
"xml"
);
}
else
{
return
null
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
return
"0"
;
}
}
//解析key的值,循环遍历,将value放进maps里面
...
...
swift-service/src/main/java/com/brilliance/mxeditor/controller/CipsEditorController.java
View file @
0380c934
...
...
@@ -3,7 +3,6 @@ package com.brilliance.mxeditor.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.brilliance.cips.utils.MsgUtil
;
import
com.brilliance.mxeditor.MxTransfer
;
import
com.brilliance.mxeditor.bo.Account
;
import
com.brilliance.mxeditor.config.EditorEnvConfig
;
...
...
@@ -64,25 +63,45 @@ public class CipsEditorController {
identifier
=
identifier
.
replace
(
"."
,
""
);
try
{
String
xml
=
transfer
(
cipsVo
.
getJson
());
Map
<
String
,
Object
>
xmlMaps
=
MsgUtil
.
cips2Map
(
xml
);
Map
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"interface"
,
"cipsEdit"
);
map
.
put
(
"transaction"
,
"save"
);
map
.
put
(
"xmlmsg"
,
xml
);
map
.
put
(
"xmlMaps"
,
xmlMaps
);
map
.
put
(
"user"
,
loginUser
);
// 1-新增报文 2-更新报文
map
.
put
(
"opeType"
,
StringUtil
.
isNotEmpty
(
opeType
)
?
opeType
:
"1"
);
map
.
put
(
"interface"
,
"cips2map"
);
map
.
put
(
"transaction"
,
"cips2map"
);
map
.
put
(
"cipsStr"
,
xml
);
Map
res
=
(
Map
)
CommonSend
.
send
(
map
);
String
retcod
=
(
String
)
res
.
get
(
"retcode"
);
String
retmsg
=
(
String
)
res
.
get
(
"retmsg"
);
logger
.
info
(
"发送结果:"
+
res
.
toString
());
logger
.
info
(
"cips2map结果:"
+
res
.
toString
());
Map
<
String
,
Object
>
xmlMaps
=
new
HashMap
<>();
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
return
"1"
+
identifier
+
".xml is saved successfully"
;
}
else
if
((
retcod
!=
null
&&
retcod
.
endsWith
(
"OBS0000111"
))){
xmlMaps
=
res
;
logger
.
info
(
"转map成功"
);
}
else
{
logger
.
info
(
"转map失败"
);
return
"原因:"
+
retmsg
;
}
else
{
return
"请联系管理员"
;
}
try
{
Map
<
String
,
Object
>
savemap
=
new
HashMap
();
savemap
.
put
(
"interface"
,
"cipsEdit"
);
savemap
.
put
(
"transaction"
,
"save"
);
savemap
.
put
(
"xmlmsg"
,
xml
);
savemap
.
put
(
"xmlMaps"
,
xmlMaps
);
savemap
.
put
(
"user"
,
loginUser
);
// 1-新增报文 2-更新报文
savemap
.
put
(
"opeType"
,
StringUtil
.
isNotEmpty
(
opeType
)
?
opeType
:
"1"
);
Map
saveres
=
(
Map
)
CommonSend
.
send
(
map
);
String
saveretcod
=
(
String
)
saveres
.
get
(
"retcode"
);
String
saveretmsg
=
(
String
)
saveres
.
get
(
"retmsg"
);
logger
.
info
(
"save结果:"
+
saveres
.
toString
());
if
(
saveretcod
!=
null
&&
saveretcod
.
endsWith
(
"0000000"
))
{
logger
.
info
(
"发送成功"
);
return
"1"
+
identifier
+
".xml is saved successfully"
;
}
else
{
logger
.
info
(
"发送失败"
);
return
"原因:"
+
saveretmsg
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
return
"0"
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -170,6 +189,7 @@ public class CipsEditorController {
Map
res
=
(
Map
)
CommonSend
.
send
(
map
);
String
retcod
=
(
String
)
res
.
get
(
"retcode"
);
String
xmlStr
=
""
;
logger
.
info
(
"save结果:"
+
res
.
toString
());
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
xmlStr
=
(
String
)
res
.
get
(
"xml"
);
}
...
...
@@ -182,7 +202,22 @@ public class CipsEditorController {
// }
// }
if
(
cipsVo
.
getType
()
!=
null
)
{
Map
<
String
,
Object
>
xmlMaps
=
MsgUtil
.
cips2Map
(
xmlStr
);
try
{
String
xml
=
transfer
(
cipsVo
.
getJson
());
Map
<
String
,
Object
>
transmap
=
new
HashMap
();
transmap
.
put
(
"interface"
,
"cips2map"
);
transmap
.
put
(
"transaction"
,
"cips2map"
);
transmap
.
put
(
"cipsStr"
,
xml
);
Map
transres
=
(
Map
)
CommonSend
.
send
(
transmap
);
String
transretcod
=
(
String
)
transres
.
get
(
"retcode"
);
String
transretmsg
=
(
String
)
transres
.
get
(
"retmsg"
);
logger
.
info
(
"cips2map结果:"
+
transres
.
toString
());
Map
<
String
,
Object
>
xmlMaps
=
new
HashMap
<>();
if
(
transretcod
!=
null
&&
transretcod
.
endsWith
(
"0000000"
))
{
xmlMaps
=
res
;
}
else
{
return
null
;
}
Map
<
String
,
Object
>
maps
=
new
HashMap
<>();
Map
<
String
,
Object
>
fIToFICstmrCdtTrf
=
new
HashMap
<>();
fIToFICstmrCdtTrf
.
put
(
"GrpHdr"
,
xmlMaps
.
get
(
"GrpHdr"
));
...
...
@@ -197,6 +232,10 @@ public class CipsEditorController {
// Map<String, Object> maps = MxTransfer.transfer2(s, messageType, cipsVo.getType());
JSONObject
json
=
new
JSONObject
(
maps
);
return
json
;
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
return
null
;
}
}
}
return
null
;
...
...
@@ -260,6 +299,7 @@ public class CipsEditorController {
}
map
.
put
(
"sf2temp"
,
swiftVo
.
getJson
());
Map
rs
=
(
Map
)
CommonSend
.
send
(
map
);
logger
.
info
(
"savmxm结果:"
+
rs
.
toString
());
String
retcod
=
(
String
)
rs
.
get
(
"retcode"
);
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
return
"ok"
;
...
...
@@ -285,6 +325,7 @@ public class CipsEditorController {
// 根据报文id获取报文内容
map
.
put
(
"inr"
,
mxminr
);
Map
res
=
(
Map
)
CommonSend
.
send
(
map
);
logger
.
info
(
"getmxm结果:"
+
res
.
toString
());
if
(
res
.
containsKey
(
"data"
))
{
Map
<
String
,
Object
>
data
=
(
Map
<
String
,
Object
>)
res
.
get
(
"data"
);
String
txt
=
(
String
)
data
.
get
(
"txt"
);
...
...
@@ -307,6 +348,7 @@ public class CipsEditorController {
map
.
put
(
"biccod"
,
account
.
getBiccod
());
map
.
put
(
"bicnam"
,
account
.
getBicnam
());
Map
rs
=
(
Map
)
CommonSend
.
send
(
map
);
logger
.
info
(
"getbic结果:"
+
rs
.
toString
());
String
retcod
=
(
String
)
rs
.
get
(
"retcode"
);
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
return
(
String
)
rs
.
get
(
"data"
);
...
...
@@ -326,7 +368,7 @@ public class CipsEditorController {
// Map<String,Object> rs = new HashMap<>();
// rs.put("retcode","0000000");
// rs.put("data","1111");
logger
.
info
(
"getMsgId结果:"
+
rs
.
toString
());
String
retcod
=
(
String
)
rs
.
get
(
"retcode"
);
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
String
msgId
=
(
String
)
rs
.
get
(
"data"
);
...
...
swift-service/src/main/java/com/brilliance/mxeditor/controller/MxEditorController.java
View file @
0380c934
...
...
@@ -378,24 +378,24 @@ public class MxEditorController {
map
.
put
(
"transaction"
,
"getbic"
);
map
.
put
(
"biccod"
,
account
.
getBiccod
());
map
.
put
(
"bicnam"
,
account
.
getBicnam
());
//
Map rs = (Map) CommonSend.send(map);
Map
rs
=
(
Map
)
CommonSend
.
send
(
map
);
//测试数据
Map
<
String
,
Object
>
rs
=
new
HashMap
<>();
rs
.
put
(
"retcode"
,
"0000000"
);
List
<
Map
<
String
,
Object
>>
ccdlst
=
new
ArrayList
<>();
Map
<
String
,
Object
>
tmpmap1
=
new
HashMap
<>();
tmpmap1
.
put
(
"BIC"
,
"CHBHHKHHXXX"
);
tmpmap1
.
put
(
"NAM1"
,
"1111"
);
Map
<
String
,
Object
>
tmpmap2
=
new
HashMap
<>();
tmpmap2
.
put
(
"BIC"
,
"CHBHHKHHXXX"
);
tmpmap2
.
put
(
"NAM1"
,
"2222"
);
ccdlst
.
add
(
tmpmap1
);
ccdlst
.
add
(
tmpmap2
);
ccdlst
.
add
(
tmpmap2
);
ccdlst
.
add
(
tmpmap2
);
ccdlst
.
add
(
tmpmap2
);
ccdlst
.
add
(
tmpmap2
);
rs
.
put
(
"data"
,
ccdlst
);
//
Map<String,Object> rs = new HashMap<>();
//
rs.put("retcode","0000000");
//
List<Map<String,Object>> ccdlst = new ArrayList<>();
//
Map<String,Object> tmpmap1 = new HashMap<>();
//
tmpmap1.put("BIC","CHBHHKHHXXX");
//
tmpmap1.put("NAM1","1111");
//
Map<String,Object> tmpmap2 = new HashMap<>();
//
tmpmap2.put("BIC","CHBHHKHHXXX");
//
tmpmap2.put("NAM1","2222");
//
ccdlst.add(tmpmap1);
//
ccdlst.add(tmpmap2);
//
ccdlst.add(tmpmap2);
//
ccdlst.add(tmpmap2);
//
ccdlst.add(tmpmap2);
//
ccdlst.add(tmpmap2);
//
rs.put("data",ccdlst);
String
retcod
=
(
String
)
rs
.
get
(
"retcode"
);
if
(
retcod
!=
null
&&
retcod
.
endsWith
(
"0000000"
))
{
...
...
swift-service/src/main/resources/cfg/cips-config.properties
View file @
0380c934
#############COMMON################
#
编码方式(必须设置一个,ELCS为UTF-8)
#
\u7F16\u7801\u65B9\u5F0F\uFF08\u5FC5\u987B\u8BBE\u7F6E\u4E00\u4E2A\uFF0CELCS\u4E3AUTF-8\uFF09
charset
=
UTF-8
bizphs
=
DAYT
#############\u7B7E\u540D\u76F8\u5173\u914D\u7F6E#############
#on:\u5F00\u542F\u52A0\u7B7E\u3001\u9A8C\u7B7E\uFF1Boff:\u5173\u95ED\u52A0\u7B7E\u3001\u9A8C\u7B7E\u3001\u52A0\u5BC6\u3001\u89E3\u5BC6
sign_switch
=
on
#\u7B7E\u540D\u81EA\u5B9A\u4E49\u5B9E\u73B0\u7C7B
#\u53D1\u62A5\u884Ccips\u884C\u53F7 \u751F\u4EA7 \uFF1ANYCBCNSHXXX \u6D4B\u8BD5 \uFF1AIDCTEST2XXX
#bankId=IDCTEST2XXX
#ip=10.38.100.9
#port=21081
bankId
=
NYCBCNSHXXX
ip
=
10.37.65.191
port
=
20081
#############签名相关配置#############
#on:开启加签、验签;off:关闭加签、验签、加密、解密
sign_switch
=
off
#签名自定义实现类
#发报行cips行号 生产 :NYCBCNSHXXX 测试 :NYCBCNS0XXX
bankId
=
NYCBCNS0XXX
ip
=
127.0.0.1
port
=
8889
pwd
=
signature_imp
=
com.brilliance.cips.framework.signature.NetSignSignature
#certDN=CN=041@7IDCTEST2XXX@IDCTEST2XXX@00000006,OU=Enterprises,OU=CIPSTEST,O=CFCA TEST CA,C=cn
certDN
=
CN=041@ZNYCBCNSHXXX@NYCBCNSHXXX@00000001,OU=Enterprises,OU=CIPSGUI,O=CFCA OCA1 SM2 TEST,C=cn
connectTimeOut
=
10
readTimeOut
=
120
logLevel
=
DEBUG
signature_imp
=
com.brilliance.ips.cips.framework.signature.CisdSignSignature
#signature_imp=com.brilliance.cips.framework.signature.NetSignSignature
#signature_imp=com.brilliance.cips.framework.signature.DefaultSignature
#############
自定义xsd文件所在目录的路径【相对路径或绝对路径】(默认在classpath的cfg/xsd/目录下
)#############
#############
\u81EA\u5B9A\u4E49xsd\u6587\u4EF6\u6240\u5728\u76EE\u5F55\u7684\u8DEF\u5F84\u3010\u76F8\u5BF9\u8DEF\u5F84\u6216\u7EDD\u5BF9\u8DEF\u5F84\u3011(\u9ED8\u8BA4\u5728classpath\u7684cfg/xsd/\u76EE\u5F55\u4E0B
)#############
#schema_location=cfg/xsd/
ownbic
=
NYCBCNS0
\ No newline at end of file
ownbic
=
NYCBCNSHXXX
\ No newline at end of file
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