Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-support-rlwx
Project
Project
Details
Activity
Releases
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
rl
hls-support-rlwx
Commits
5a5b567c
Commit
5a5b567c
authored
Aug 13, 2021
by
5359
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
中登网开发
parent
cc9a602c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
132 additions
and
110 deletions
+132
-110
ZdwWsRequestsController.java
...pp/zhongDengWang/controllers/ZdwWsRequestsController.java
+1
-1
ZdwWsRequestsServiceImpl.java
.../zhongDengWang/service/impl/ZdwWsRequestsServiceImpl.java
+122
-103
ClientInitReg.java
.../java/com/hand/app/zhongDengWang/utils/ClientInitReg.java
+5
-5
ClientUtils.java
...in/java/com/hand/app/zhongDengWang/utils/ClientUtils.java
+1
-1
logback.xml
core/src/main/resources/logback.xml
+3
-0
No files found.
core/src/main/java/com/hand/app/zhongDengWang/controllers/ZdwWsRequestsController.java
View file @
5a5b567c
...
@@ -40,7 +40,7 @@ public class ZdwWsRequestsController extends BaseController {
...
@@ -40,7 +40,7 @@ public class ZdwWsRequestsController extends BaseController {
/**
/**
*
初始登记
*
中登网融资租赁-登记入口
**/
**/
@RequestMapping
(
value
=
"/zdw/service/register/init"
)
@RequestMapping
(
value
=
"/zdw/service/register/init"
)
@ResponseBody
@ResponseBody
...
...
core/src/main/java/com/hand/app/zhongDengWang/service/impl/ZdwWsRequestsServiceImpl.java
View file @
5a5b567c
...
@@ -27,9 +27,13 @@ import com.hand.app.zhongDengWang.dto.FndAtmAttachmentDto;
...
@@ -27,9 +27,13 @@ import com.hand.app.zhongDengWang.dto.FndAtmAttachmentDto;
import
com.hand.app.zhongDengWang.mapper.FndAtmAttachmentMapper
;
import
com.hand.app.zhongDengWang.mapper.FndAtmAttachmentMapper
;
import
com.hand.hap.core.IRequest
;
import
com.hand.hap.core.IRequest
;
import
com.hand.hap.lock.components.DatabaseLockProvider
;
import
com.hand.hap.lock.components.DatabaseLockProvider
;
import
com.hand.hap.system.dto.BaseDTO
;
import
com.hand.hap.system.dto.DTOStatus
;
import
com.hand.hap.system.dto.DTOStatus
;
import
com.hand.hap.system.service.impl.BaseServiceImpl
;
import
com.rfp.sm.utils.SM2Utils
;
import
com.rfp.sm.utils.SM2Utils
;
import
org.json.XML
;
import
org.json.XML
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -60,6 +64,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -60,6 +64,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
@Autowired
@Autowired
private
DatabaseLockProvider
databaseLockProvider
;
private
DatabaseLockProvider
databaseLockProvider
;
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
/**
/**
* Use private final lock objects to synchronize classes that may interact with untrusted code
* Use private final lock objects to synchronize classes that may interact with untrusted code
*/
*/
...
@@ -83,28 +89,37 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -83,28 +89,37 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
* 密码 String userPassword
* 密码 String userPassword
* 平台授权码 String platformAuthCode
* 平台授权码 String platformAuthCode
**/
**/
public
static
String
clintLogin
(
String
clientKey
,
String
userName
,
String
userPassword
,
String
platformAuthCode
)
{
public
String
clintLogin
(
String
clientKey
,
String
userName
,
String
userPassword
,
String
platformAuthCode
)
{
String
returnMsg
=
""
;
String
returnMsg
=
""
;
String
encryUserName
=
""
;
String
encryUserPassword
=
""
;
String
encryPlatformAuthCode
=
""
;
try
{
try
{
/*SM2算法加密*/
/*SM2算法加密*/
u
serName
=
SM2Utils
.
encryptByKeyStr
(
userName
,
clientKey
);
encryU
serName
=
SM2Utils
.
encryptByKeyStr
(
userName
,
clientKey
);
u
serPassword
=
SM2Utils
.
encryptByKeyStr
(
userPassword
,
clientKey
);
encryU
serPassword
=
SM2Utils
.
encryptByKeyStr
(
userPassword
,
clientKey
);
p
latformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
encryP
latformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
WSLoginServiceService
service
=
new
WSLoginServiceService
();
WSLoginServiceService
service
=
new
WSLoginServiceService
();
WSLoginService
login
=
service
.
getWSLoginServicePort
();
WSLoginService
login
=
service
.
getWSLoginServicePort
();
/*插入接口日志表*/
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
service
.
getWSDLDocumentLocation
().
toString
(),
"userName:"
+
userName
+
";userPassword:"
+
userPassword
+
";platformAuthCode:"
+
platformAuthCode
,
null
);
try
{
try
{
byte
[]
returns
=
login
.
login
(
userName
.
getBytes
(),
userPassword
.
getBytes
(),
platformAuthCode
.
getBytes
());
byte
[]
returns
=
login
.
login
(
encryUserName
.
getBytes
(),
encryUserPassword
.
getBytes
(),
encryPlatformAuthCode
.
getBytes
());
returnMsg
=
new
String
(
returns
);
returnMsg
=
new
String
(
returns
,
"UTF-8"
);
logger
.
info
(
"get token success token: {}"
,
returnMsg
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
returnMsg
=
"LoginError"
;
returnMsg
=
"LoginError"
;
logger
.
info
(
"get token fail message: {}"
,
e
.
getMessage
());
}
}
System
.
out
.
println
(
"token="
+
returnMsg
);
hlsWsRequestsMapper
.
updateByPrimaryKeySelective
(
hlsWsRequests
);
return
returnMsg
;
return
returnMsg
;
}
}
...
@@ -118,8 +133,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -118,8 +133,8 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
String
assesstoken
=
""
;
String
assesstoken
=
""
;
if
(
Objects
.
isNull
(
zdwLoginTokenInterface
))
{
if
(
Objects
.
isNull
(
zdwLoginTokenInterface
))
{
//
assesstoken = clintLogin(clientKey, userName, userPassword, platformAuthCode);
assesstoken
=
clintLogin
(
clientKey
,
userName
,
userPassword
,
platformAuthCode
);
assesstoken
=
"cs11111111"
;
//
assesstoken = "cs11111111";
if
(!
assesstoken
.
contains
(
"Error"
))
{
if
(!
assesstoken
.
contains
(
"Error"
))
{
zdwLoginTokenInterfaceMapper
.
updateToken
(
assesstoken
);
zdwLoginTokenInterfaceMapper
.
updateToken
(
assesstoken
);
}
}
...
@@ -147,24 +162,26 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -147,24 +162,26 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
/**
/**
* 设置错误信息
* 设置错误信息
* @param resultJson 返回给前端的结果集
*
* @param resultJson 返回给前端的结果集
* @param hlsWsRequests 储存给数据库的请求体
* @param hlsWsRequests 储存给数据库的请求体
* @param e 异常
* @param e
异常
*/
*/
public
void
setErrData
(
JSONObject
resultJson
,
HlsWsRequests
hlsWsRequests
,
Exception
e
){
public
void
setErrData
(
JSONObject
resultJson
,
HlsWsRequests
hlsWsRequests
,
Exception
e
)
{
resultJson
.
put
(
"code"
,
"-1"
);
resultJson
.
put
(
"code"
,
"-1"
);
resultJson
.
put
(
"info"
,
e
.
getMessage
());
resultJson
.
put
(
"info"
,
"请求失败:"
+
e
.
getMessage
());
hlsWsRequests
.
setReturnStatus
(
"E"
);
hlsWsRequests
.
setReturnStatus
(
"E"
);
hlsWsRequests
.
setResponsedDate
(
new
Date
());
hlsWsRequests
.
setResponsedDate
(
new
Date
());
}
}
/**
/**
* 设置返回信息
* 设置返回信息
* @param resultJson 返回给前端的结果集
*
* @param resultJson 返回给前端的结果集
* @param hlsWsRequests 储存给数据库的请求体
* @param hlsWsRequests 储存给数据库的请求体
* @param resData 返回字符串
* @param resData
返回字符串
*/
*/
public
void
setResData
(
JSONObject
resultJson
,
HlsWsRequests
hlsWsRequests
,
String
resData
){
public
void
setResData
(
JSONObject
resultJson
,
HlsWsRequests
hlsWsRequests
,
String
resData
)
{
resultJson
.
put
(
"code"
,
"0"
);
resultJson
.
put
(
"code"
,
"0"
);
resultJson
.
put
(
"info"
,
resData
);
resultJson
.
put
(
"info"
,
resData
);
hlsWsRequests
.
setReturnStatus
(
"S"
);
hlsWsRequests
.
setReturnStatus
(
"S"
);
...
@@ -172,43 +189,51 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -172,43 +189,51 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
hlsWsRequests
.
setResponsedDate
(
new
Date
());
hlsWsRequests
.
setResponsedDate
(
new
Date
());
}
}
public
JSONObject
registerInit
(
String
registerTypeBz
,
String
platformAuthCode
,
String
loginToken
,
String
xmlFileName
,
String
xmlFileContent
,
Long
lineId
)
{
/*初始登记*/
public
JSONObject
registerInit
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
)
{
JSONObject
resultJson
=
new
JSONObject
();
JSONObject
resultJson
=
new
JSONObject
();
String
encryXmlFileContent
=
""
;
String
encryLoginToken
=
""
;
//WS服务初始化
String
attachmentZipPath
=
""
;
WSInitRegisterServiceService
service
=
new
WSInitRegisterServiceService
();
String
encryPlatformAuthCode
=
""
;
WSInitRegisterService
reg
=
service
.
getWSInitRegisterServicePort
();
/*插入接口日志表*/
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
service
.
getWSDLDocumentLocation
().
toString
(),
xmlFileContent
,
line
.
getLineId
());
try
{
try
{
/*SM2算法加密*/
/*SM2算法加密*/
encryLoginToken
=
SM2Utils
.
encryptByKeyStr
(
loginToken
,
clientKey
);
String
encryXmlFileContent
=
SM2Utils
.
encryptByKeyStr
(
xmlFileContent
,
clientKey
);
encryXmlFileContent
=
SM2Utils
.
encryptByKeyStr
(
xmlFileContent
,
clientKey
);
String
encryLoginToken
=
SM2Utils
.
encryptByKeyStr
(
loginToken
,
clientKey
);
encryPlatformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
String
attachmentZipPath
=
""
;
String
encryPlatformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
// WSInitRegisterServiceService service = new WSInitRegisterServiceService();
// WSInitRegisterService reg = service.getWSInitRegisterServicePort();
/*插入接口日志表*/
// hlsWsRequests = createRequestLog(service.getWSDLDocumentLocation().toString(), xmlFileContent, lineId);
hlsWsRequests
=
createRequestLog
(
"https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/InitRegisterService?wsdl"
,
xmlFileContent
,
lineId
);
// byte[] returns = reg.initRegister(registerTypeBz.getBytes(), encryPlatformAuthCode.getBytes(), encryLoginToken.getBytes(), xmlFileName.getBytes(), encryXmlFileContent.getBytes(), ClientUtils.getAttachmentZip(attachmentZipPath));
byte
[]
returns
=
"<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>RegInfoError:100_001</error>\n</errors>\n</feedback>\n"
.
getBytes
();
setResData
(
resultJson
,
hlsWsRequests
,
new
String
(
returns
));
/*发送初始登记接口请求*/
byte
[]
returns
=
reg
.
initRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
(),
ClientUtils
.
getAttachmentZip
(
attachmentZipPath
));
System
.
out
.
println
(
"dddd"
+
new
String
(
returns
));
String
resData
=
new
String
(
returns
,
"UTF-8"
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
logger
.
info
(
"register init success line_id:{}, returns: {}"
,
line
.
getLineId
(),
resData
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
logger
.
info
(
"register init fail line_id:{},message: {}"
,
line
.
getLineId
(),
e
.
getMessage
());
}
}
hlsWsRequestsMapper
.
updateByPrimaryKeySelective
(
hlsWsRequests
);
hlsWsRequestsMapper
.
updateByPrimaryKeySelective
(
hlsWsRequests
);
return
resultJson
;
return
resultJson
;
}
}
public
JSONObject
registerAmend
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
String
attachmentZipPath
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
){
/*变更登记*/
public
JSONObject
registerAmend
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
)
{
JSONObject
resultJson
=
new
JSONObject
();
JSONObject
resultJson
=
new
JSONObject
();
//WS服务初始化
WSAmendRegisterServiceService
service
=
new
WSAmendRegisterServiceService
();
WSAmendRegisterService
amend
=
service
.
getWSAmendRegisterServicePort
();
//插入接口日志表
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
service
.
getWSDLDocumentLocation
().
toString
(),
xmlFileContent
,
line
.
getLineId
());
try
{
try
{
/*SM2算法加密*/
/*SM2算法加密*/
...
@@ -217,26 +242,23 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -217,26 +242,23 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
String
encryPlatformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
String
encryPlatformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
String
encryAuthorizationCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getAuthorizationCode
(),
clientKey
);
String
encryAuthorizationCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getAuthorizationCode
(),
clientKey
);
String
encryRegisterCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getRegisterNumber
(),
clientKey
);
String
encryRegisterCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getRegisterNumber
(),
clientKey
);
String
attachmentZipPath
=
""
;
//搭建服务
/*发送变更登记接口请求*/
WSAmendRegisterServiceService
service
=
new
WSAmendRegisterServiceService
();
byte
[]
returns
=
amend
.
amendRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
WSAmendRegisterService
amend
=
service
.
getWSAmendRegisterServicePort
();
//插入接口日志表
hlsWsRequests
=
createRequestLog
(
"https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/AmendRegisterService?wsdl"
,
xmlFileContent
,
line
.
getLineId
());
//获取数据
byte
[]
resBytes
=
amend
.
amendRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
encryRegisterCode
.
getBytes
(),
encryAuthorizationCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
encryRegisterCode
.
getBytes
(),
encryAuthorizationCode
.
getBytes
(),
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
(),
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
(),
ClientUtils
.
getAttachmentZip
(
attachmentZipPath
));
ClientUtils
.
getAttachmentZip
(
attachmentZipPath
));
String
resData
=
new
String
(
re
sBytes
);
String
resData
=
new
String
(
re
turns
,
"UTF-8"
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
logger
.
info
(
"register amend success line_id:{},returns: {}"
,
line
.
getLineId
(),
resData
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
logger
.
info
(
"register amend fail line_id:{},message: {}"
,
line
.
getLineId
(),
e
.
getMessage
());
}
}
//返回结果 给数据库和前端
//返回结果 给数据库和前端
...
@@ -244,9 +266,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -244,9 +266,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
return
resultJson
;
return
resultJson
;
}
}
public
JSONObject
registerExtend
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
String
attachmentZipPath
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
){
/*展期登记*/
public
JSONObject
registerExtend
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
)
{
JSONObject
resultJson
=
new
JSONObject
();
JSONObject
resultJson
=
new
JSONObject
();
//WS服务初始化
WSExtendRegisterServiceService
service
=
new
WSExtendRegisterServiceService
();
WSExtendRegisterService
extend
=
service
.
getWSExtendRegisterServicePort
();
//插入接口日志表
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
service
.
getWSDLDocumentLocation
().
toString
(),
xmlFileContent
,
line
.
getLineId
());
try
{
try
{
/*SM2算法加密*/
/*SM2算法加密*/
...
@@ -255,26 +284,21 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -255,26 +284,21 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
String
encryPlatformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
String
encryPlatformAuthCode
=
SM2Utils
.
encryptByKeyStr
(
platformAuthCode
,
clientKey
);
String
encryAuthorizationCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getAuthorizationCode
(),
clientKey
);
String
encryAuthorizationCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getAuthorizationCode
(),
clientKey
);
String
encryRegisterCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getRegisterNumber
(),
clientKey
);
String
encryRegisterCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getRegisterNumber
(),
clientKey
);
String
attachmentZipPath
=
""
;
//搭建服务
/*发送展期登记接口请求*/
WSExtendRegisterServiceService
service
=
new
WSExtendRegisterServiceService
();
byte
[]
returns
=
extend
.
extendRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
WSExtendRegisterService
extend
=
service
.
getWSExtendRegisterServicePort
();
//插入接口日志表
hlsWsRequests
=
createRequestLog
(
"https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/ExtendRegisterService?wsdl"
,
xmlFileContent
,
line
.
getLineId
());
//获取数据
byte
[]
resBytes
=
extend
.
extendRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
encryRegisterCode
.
getBytes
(),
encryAuthorizationCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
encryRegisterCode
.
getBytes
(),
encryAuthorizationCode
.
getBytes
(),
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
(),
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
(),
ClientUtils
.
getAttachmentZip
(
attachmentZipPath
));
ClientUtils
.
getAttachmentZip
(
attachmentZipPath
));
String
resData
=
new
String
(
re
sBytes
);
String
resData
=
new
String
(
re
turns
,
"UTF-8"
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
}
logger
.
info
(
"register extend success line_id:{},returns: {}"
,
line
.
getLineId
(),
resData
);
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
logger
.
info
(
"register extend fail line_id:{},message: {}"
,
line
.
getLineId
(),
e
.
getMessage
());
}
}
//返回结果 给数据库和前端
//返回结果 给数据库和前端
...
@@ -282,9 +306,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -282,9 +306,16 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
return
resultJson
;
return
resultJson
;
}
}
public
JSONObject
registerTerminate
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
){
/*注销登记*/
public
JSONObject
registerTerminate
(
String
platformAuthCode
,
String
loginToken
,
String
xmlFileContent
,
FndZhongDengLines
line
,
FndAtmAttachmentDto
attachmentDto
)
{
JSONObject
resultJson
=
new
JSONObject
();
JSONObject
resultJson
=
new
JSONObject
();
//WS服务初始化
WSTerminateRegisterServiceService
service
=
new
WSTerminateRegisterServiceService
();
WSTerminateRegisterService
terminate
=
service
.
getWSTerminateRegisterServicePort
();
//插入接口日志表
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
HlsWsRequests
hlsWsRequests
=
new
HlsWsRequests
();
hlsWsRequests
=
createRequestLog
(
service
.
getWSDLDocumentLocation
().
toString
(),
xmlFileContent
,
line
.
getLineId
());
try
{
try
{
/*SM2算法加密*/
/*SM2算法加密*/
...
@@ -294,24 +325,18 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -294,24 +325,18 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
String
encryAuthorizationCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getAuthorizationCode
(),
clientKey
);
String
encryAuthorizationCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getAuthorizationCode
(),
clientKey
);
String
encryRegisterCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getRegisterNumber
(),
clientKey
);
String
encryRegisterCode
=
SM2Utils
.
encryptByKeyStr
(
line
.
getRegisterNumber
(),
clientKey
);
//搭建服务
/*发送注销登记接口请求*/
WSTerminateRegisterServiceService
service
=
new
WSTerminateRegisterServiceService
();
byte
[]
returns
=
terminate
.
terminateRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
WSTerminateRegisterService
terminate
=
service
.
getWSTerminateRegisterServicePort
();
//插入接口日志表
hlsWsRequests
=
createRequestLog
(
"https://ws.zhongdengwang.org.cn/mfrs_ws_test/services/TerminateRegisterService?wsdl"
,
xmlFileContent
,
line
.
getLineId
());
//获取数据
byte
[]
resBytes
=
terminate
.
terminateRegister
(
line
.
getTypebz
().
getBytes
(),
encryPlatformAuthCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
encryRegisterCode
.
getBytes
(),
encryAuthorizationCode
.
getBytes
(),
encryLoginToken
.
getBytes
(),
encryRegisterCode
.
getBytes
(),
encryAuthorizationCode
.
getBytes
(),
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
());
attachmentDto
.
getFileName
().
getBytes
(),
encryXmlFileContent
.
getBytes
());
String
resData
=
new
String
(
re
sBytes
);
String
resData
=
new
String
(
re
turns
,
"UTF-8"
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
setResData
(
resultJson
,
hlsWsRequests
,
resData
);
}
logger
.
info
(
"register terminate success line_id:{},returns: {}"
,
line
.
getLineId
(),
resData
);
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
setErrData
(
resultJson
,
hlsWsRequests
,
e
);
logger
.
info
(
"register terminate fail line_id:{},message: {}"
,
line
.
getLineId
(),
e
.
getMessage
());
}
}
//返回结果 给数据库和前端
//返回结果 给数据库和前端
...
@@ -336,31 +361,25 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -336,31 +361,25 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
fndZhongDengLines
.
setLineId
(
batch
.
getLineId
());
fndZhongDengLines
.
setLineId
(
batch
.
getLineId
());
fndZhongDengLines
=
fndZhongDengLinesMapper
.
selectByPrimaryKey
(
fndZhongDengLines
);
fndZhongDengLines
=
fndZhongDengLinesMapper
.
selectByPrimaryKey
(
fndZhongDengLines
);
if
(
Objects
.
nonNull
(
fndZhongDengLines
)
&&
"UPING"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStatus
()))
{
if
(
Objects
.
nonNull
(
fndZhongDengLines
)
&&
"UPING"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStatus
())
&&
"NORMAL"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getDataClass
())
)
{
try
{
try
{
String
xmlFileContent
=
""
;
String
attachmentZipPath
=
""
;
/*获取xml报文文件所在路径*/
/*获取xml报文文件所在路径*/
FndAtmAttachmentDto
fndAtmAttachmentDto
=
new
FndAtmAttachmentDto
();
FndAtmAttachmentDto
fndAtmAttachmentDto
=
new
FndAtmAttachmentDto
();
fndAtmAttachmentDto
.
setAttachmentId
(
fndZhongDengLines
.
getAttachmentXmlId
());
fndAtmAttachmentDto
.
setAttachmentId
(
fndZhongDengLines
.
getAttachmentXmlId
());
fndAtmAttachmentDto
=
fndAtmAttachmentMapper
.
selectByPrimaryKey
(
fndAtmAttachmentDto
);
fndAtmAttachmentDto
=
fndAtmAttachmentMapper
.
selectByPrimaryKey
(
fndAtmAttachmentDto
);
/*解析xml文件内容*/
/*解析xml文件内容*/
xmlFileContent
=
new
String
(
Objects
.
requireNonNull
(
ClientUtils
.
getxmlFileContent
(
fndAtmAttachmentDto
.
getFilePath
()))
);
String
xmlFileContent
=
new
String
(
Objects
.
requireNonNull
(
ClientUtils
.
getxmlFileContent
(
fndAtmAttachmentDto
.
getFilePath
())),
"UTF-8"
);
/*初始登记*/
/*初始登记*/
if
(
"INIT"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
()))
{
if
(
"01"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
()))
{
resultJson
=
registerInit
(
fndZhongDengLines
.
getTypebz
(),
platformAuthCode
,
loginToken
,
fndAtmAttachmentDto
.
getFileName
(),
xmlFileContent
,
fndZhongDengLines
.
getLineId
());
resultJson
=
registerInit
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
}
}
else
if
(
"02"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
()))
{
else
if
(
"AMEND"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
())){
resultJson
=
registerAmend
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
resultJson
=
registerAmend
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
attachmentZipPath
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
}
else
if
(
"03"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
()))
{
}
resultJson
=
registerExtend
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
else
if
(
"EXTEND"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
())){
}
else
if
(
"05"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
()))
{
resultJson
=
registerExtend
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
attachmentZipPath
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
}
else
if
(
"TERMINATE"
.
equalsIgnoreCase
(
fndZhongDengLines
.
getUpStage
())){
resultJson
=
registerTerminate
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
resultJson
=
registerTerminate
(
platformAuthCode
,
loginToken
,
xmlFileContent
,
fndZhongDengLines
,
fndAtmAttachmentDto
);
}
}
...
@@ -368,36 +387,39 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -368,36 +387,39 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
if
(
"0"
.
equalsIgnoreCase
(
resultJson
.
getString
(
"code"
)))
{
if
(
"0"
.
equalsIgnoreCase
(
resultJson
.
getString
(
"code"
)))
{
returns
=
resultJson
.
getString
(
"info"
);
returns
=
resultJson
.
getString
(
"info"
);
}
else
{
}
else
{
returns
=
"<feedback>\n<registertype>LR</registertype>\n<registerresult>001</registerresult>\n<registernumber>I0000001</registernumber>\n<authorizationcode>A0000001</authorizationcode>\n<errors>\n<error>\n"
+
resultJson
.
getString
(
"info"
)
+
"</error>\n</errors>\n</feedback>\n"
;
returns
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+
"<feedback>\n"
+
"\t<registertype>"
+
fndZhongDengLines
.
getUpStage
()
+
"</registertype>\n"
+
"\t<registerresult>002</registerresult>\n"
+
"\t<errors>\n"
+
"\t\t<error>"
+
resultJson
.
getString
(
"info"
)
+
"</error>\n"
+
"\t</errors>\n"
+
"</feedback>"
;
}
}
System
.
out
.
println
(
"dddd"
+
returns
);
/*解析接口返回结果*/
/*解析接口返回结果*/
org
.
json
.
JSONObject
returnJson
;
org
.
json
.
JSONObject
returnJson
=
XML
.
toJSONObject
(
returns
);
returnJson
=
XML
.
toJSONObject
(
returns
);
String
registerResult
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"registerresult"
);
String
registerResult
=
""
;
String
registerNumber
=
""
;
String
authorizationCode
=
""
;
String
error
=
""
;
registerResult
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"registerresult"
);
registerNumber
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"registernumber"
);
authorizationCode
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"authorizationcode"
);
/*成功*/
/*成功*/
if
(
Objects
.
nonNull
(
registerResult
)
&&
"001"
.
equalsIgnoreCase
(
registerResult
))
{
if
(
Objects
.
nonNull
(
registerResult
)
&&
"001"
.
equalsIgnoreCase
(
registerResult
))
{
String
registerNumber
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"registernumber"
);
String
authorizationCode
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"authorizationcode"
);
fndZhongDengLines
.
setRegisterNumber
(
registerNumber
);
fndZhongDengLines
.
setRegisterNumber
(
registerNumber
);
fndZhongDengLines
.
setAuthorizationCode
(
authorizationCode
);
fndZhongDengLines
.
setAuthorizationCode
(
authorizationCode
);
fndZhongDengLines
.
setUpStatus
(
"SUCCESS"
);
fndZhongDengLines
.
setUpStatus
(
"SUCCESS"
);
fndZhongDengLines
.
setReturnMsg
(
"上报成功"
);
fndZhongDengLines
.
setReturnMsg
(
"上报成功"
);
/*失败*/
/*失败*/
}
else
{
}
else
{
error
=
returnJson
.
getJSONObject
(
"feedback"
).
getString
(
"errors"
);
String
error
=
returnJson
.
getJSONObject
(
"feedback"
).
getJSONObject
(
"errors"
).
toString
(
);
fndZhongDengLines
.
setUpStatus
(
"FAIL"
);
fndZhongDengLines
.
setUpStatus
(
"FAIL"
);
fndZhongDengLines
.
setReturnMsg
(
error
);
fndZhongDengLines
.
setReturnMsg
(
error
);
}
}
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
fndZhongDengLines
.
setUpStatus
(
"FAIL"
);
fndZhongDengLines
.
setReturnMsg
(
e
.
getMessage
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -500,7 +522,7 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -500,7 +522,7 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
// xmlFileContent = new String(ClientUtils.getxmlFileContent(fndAtmAttachmentDto.getFilePath()));
// xmlFileContent = new String(ClientUtils.getxmlFileContent(fndAtmAttachmentDto.getFilePath()));
//
//
// /*插入接口日志表*/
// /*插入接口日志表*/
// if ("
INIT
".equalsIgnoreCase(fndZhongDengLines.getUpStage())) {
// if ("
01
".equalsIgnoreCase(fndZhongDengLines.getUpStage())) {
// resultJson = registerInit(fndZhongDengLines.getTypebz(), platformAuthCode, loginToken, fndAtmAttachmentDto.getFileName(), xmlFileContent, fndZhongDengLines.getLineId());
// resultJson = registerInit(fndZhongDengLines.getTypebz(), platformAuthCode, loginToken, fndAtmAttachmentDto.getFileName(), xmlFileContent, fndZhongDengLines.getLineId());
// }
// }
// String returns = "";
// String returns = "";
...
@@ -556,7 +578,4 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
...
@@ -556,7 +578,4 @@ public class ZdwWsRequestsServiceImpl implements IZdwWsRequestsService {
}
}
}
}
\ No newline at end of file
core/src/main/java/com/hand/app/zhongDengWang/utils/ClientInitReg.java
View file @
5a5b567c
...
@@ -28,7 +28,7 @@ import com.rfp.sm.utils.SM2Utils;
...
@@ -28,7 +28,7 @@ import com.rfp.sm.utils.SM2Utils;
public
class
ClientInitReg
{
public
class
ClientInitReg
{
static
String
xmlPath
=
"
C://test//new//aaa
.xml"
;
static
String
xmlPath
=
"
F://L21LH00032-1-4
.xml"
;
static
String
attachmentZipPath
=
"C://test//new//aaa2.zip"
;
static
String
attachmentZipPath
=
"C://test//new//aaa2.zip"
;
/**
/**
...
@@ -101,13 +101,13 @@ public class ClientInitReg {
...
@@ -101,13 +101,13 @@ public class ClientInitReg {
public
static
byte
[]
getxmlFileContent
()
throws
TransformerFactoryConfigurationError
,
TransformerException
,
Exception
{
public
static
byte
[]
getxmlFileContent
()
throws
TransformerFactoryConfigurationError
,
TransformerException
,
Exception
{
InputStream
in
=
null
;
InputStream
in
=
null
;
InputStreamReader
reader
=
null
;
InputStreamReader
reader
=
null
;
Document
document
=
null
;
Document
document
=
null
;
File
file
=
new
File
(
xmlPath
);
File
file
=
new
File
(
xmlPath
);
in
=
new
FileInputStream
(
file
);
in
=
new
FileInputStream
(
file
);
reader
=
new
InputStreamReader
(
in
,
"
GBK
"
);
reader
=
new
InputStreamReader
(
in
,
"
UTF-8
"
);
//reader = new InputStreamReader(in);
//reader = new InputStreamReader(in);
SAXReader
saxReader
=
new
SAXReader
();
SAXReader
saxReader
=
new
SAXReader
();
try
{
try
{
...
@@ -116,8 +116,8 @@ public class ClientInitReg {
...
@@ -116,8 +116,8 @@ public class ClientInitReg {
e
.
printStackTrace
();
e
.
printStackTrace
();
return
null
;
return
null
;
}
}
javax
.
xml
.
transform
.
Transformer
transformer
=
TransformerFactory
.
newInstance
().
newTransformer
()
;
javax
.
xml
.
transform
.
Transformer
transformer
=
TransformerFactory
.
newInstance
().
newTransformer
()
;
//transformer.setOutputProperty(OutputKeys.ENCODING, "GBK") ;
//transformer.setOutputProperty(OutputKeys.ENCODING, "GBK") ;
transformer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
)
;
transformer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
)
;
...
...
core/src/main/java/com/hand/app/zhongDengWang/utils/ClientUtils.java
View file @
5a5b567c
...
@@ -90,7 +90,7 @@ public class ClientUtils {
...
@@ -90,7 +90,7 @@ public class ClientUtils {
javax
.
xml
.
transform
.
Transformer
transformer
=
TransformerFactory
.
newInstance
().
newTransformer
();
javax
.
xml
.
transform
.
Transformer
transformer
=
TransformerFactory
.
newInstance
().
newTransformer
();
//transformer.setOutputProperty(OutputKeys.ENCODING, "GBK
") ;
// transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8
") ;
transformer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
);
transformer
.
setOutputProperty
(
OutputKeys
.
INDENT
,
"yes"
);
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
StreamResult
streamResult
=
new
StreamResult
(
bos
);
StreamResult
streamResult
=
new
StreamResult
(
bos
);
...
...
core/src/main/resources/logback.xml
View file @
5a5b567c
...
@@ -88,6 +88,9 @@
...
@@ -88,6 +88,9 @@
<logger
name=
"com.hand.app.esignHclc.service.impl.SignInfoHclcFaceServiceImpl"
level=
"INFO"
additivity=
"false"
>
<logger
name=
"com.hand.app.esignHclc.service.impl.SignInfoHclcFaceServiceImpl"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"REQ"
/>
<appender-ref
ref=
"REQ"
/>
</logger>
</logger>
<logger
name=
"com.hand.app.zhongDengWang.service.impl.ZdwWsRequestsServiceImpl"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"REQ"
/>
</logger>
<logger
name=
"com.timevale"
level=
"INFO"
additivity=
"false"
>
<logger
name=
"com.timevale"
level=
"INFO"
additivity=
"false"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"STDOUT"
/>
</logger>
</logger>
...
...
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