Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
windows
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
zhanhai
windows
Commits
b9322924
Commit
b9322924
authored
Oct 24, 2023
by
BlackJokerCJ
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
732c613c
5d42dad4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
13 deletions
+88
-13
ZyHttpBaseResponse.java
.../com/jqtx/windows/component/model/ZyHttpBaseResponse.java
+2
-2
ZyJsonResult.java
...n/java/com/jqtx/windows/component/model/ZyJsonResult.java
+68
-0
AbcHttpClient.java
src/main/java/com/jqtx/windows/utils/AbcHttpClient.java
+18
-11
No files found.
src/main/java/com/jqtx/windows/component/model/ZyHttpBaseResponse.java
View file @
b9322924
...
@@ -5,9 +5,9 @@ import lombok.Data;
...
@@ -5,9 +5,9 @@ import lombok.Data;
@Data
@Data
public
class
ZyHttpBaseResponse
{
public
class
ZyHttpBaseResponse
{
private
String
client
l
d
;
private
String
client
I
d
;
private
String
service
l
d
;
private
String
service
I
d
;
private
String
segNo
;
private
String
segNo
;
...
...
src/main/java/com/jqtx/windows/component/model/ZyJsonResult.java
0 → 100644
View file @
b9322924
package
com
.
jqtx
.
windows
.
component
.
model
;
import
com.jqtx.windows.common.exception.BizException
;
import
com.jqtx.windows.infrastructure.enums.ExceptionCodeEnum
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.ToString
;
import
java.io.Serializable
;
@ApiModel
(
value
=
"ZyJsonResult"
,
description
=
"通用返回结果模型"
)
@ToString
public
class
ZyJsonResult
<
T
>
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1475348231900998033L
;
@ApiModelProperty
(
"状态码"
)
private
String
code
;
@ApiModelProperty
(
"请求成功与否,true:成功,false:失败"
)
private
Boolean
success
;
@ApiModelProperty
(
"提示信息"
)
private
String
message
;
@ApiModelProperty
(
"返回业务数据"
)
private
T
result
;
public
ZyJsonResult
()
{
}
public
ZyJsonResult
(
boolean
isSuccess
,
String
code
,
String
message
)
{
this
.
success
=
isSuccess
;
this
.
code
=
code
;
this
.
message
=
message
;
}
public
String
getCode
()
{
return
this
.
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
boolean
isSuccess
()
{
return
this
.
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
getMessage
()
{
return
this
.
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
T
getResult
()
{
return
this
.
result
;
}
public
void
setResult
(
T
result
)
{
this
.
result
=
result
;
}
}
src/main/java/com/jqtx/windows/utils/AbcHttpClient.java
View file @
b9322924
...
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
...
@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jqtx.windows.component.model.ZyHttpBaseResponse
;
import
com.jqtx.windows.component.model.ZyHttpBaseResponse
;
import
com.jqtx.windows.component.model.ZyHttpBaseRquest
;
import
com.jqtx.windows.component.model.ZyHttpBaseRquest
;
import
com.jqtx.windows.component.model.ZyJsonResult
;
import
com.jqtx.windows.web.request.AbcRequest
;
import
com.jqtx.windows.web.request.AbcRequest
;
import
com.jqtx.windows.web.response.JsonResult
;
import
com.jqtx.windows.web.response.JsonResult
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -39,7 +40,7 @@ public class AbcHttpClient {
...
@@ -39,7 +40,7 @@ public class AbcHttpClient {
private
String
clientId
;
private
String
clientId
;
public
Zy
HttpBaseResponse
postRequest
(
String
paramJson
,
String
method
)
{
public
Zy
JsonResult
postRequest
(
String
paramJson
,
String
method
)
{
try
{
try
{
final
String
url
=
posetUrl
;
final
String
url
=
posetUrl
;
ZyHttpBaseRquest
zyHttpBaseRquest
=
new
ZyHttpBaseRquest
();
ZyHttpBaseRquest
zyHttpBaseRquest
=
new
ZyHttpBaseRquest
();
...
@@ -60,16 +61,22 @@ public class AbcHttpClient {
...
@@ -60,16 +61,22 @@ public class AbcHttpClient {
.
setConnectionTimeout
(
5000
).
execute
();
.
setConnectionTimeout
(
5000
).
execute
();
log
.
info
(
"请求浙农加密返回数据:{}"
,
JSON
.
toJSONString
(
response
.
body
()));
log
.
info
(
"请求浙农加密返回数据:{}"
,
JSON
.
toJSONString
(
response
.
body
()));
String
body
=
response
.
body
();
String
body
=
response
.
body
();
JSONObject
responseJson
=
JSONObject
.
parseObject
(
body
);
ZyHttpBaseResponse
zyHttpBaseResponse
=
JSONObject
.
parseObject
(
body
,
ZyHttpBaseResponse
.
class
);
String
data
=
responseJson
.
getString
(
"data"
);
//成功
String
sign
=
responseJson
.
getString
(
"sign"
);
if
(
zyHttpBaseResponse
.
getReturnCode
().
equals
(
"0000"
))
{
boolean
f
=
SignUtil
.
veriSign
(
data
,
sign
,
AbcRsaUtil
.
getPublicKey
(
ypdPublicKey
));
String
data
=
zyHttpBaseResponse
.
getData
();
if
(
f
)
{
String
sign
=
zyHttpBaseResponse
.
getSign
();
String
dec
=
EncryptUtil
.
decrypt
(
data
,
AbcRsaUtil
.
getPrivateKey
(
privateKey
));
boolean
f
=
SignUtil
.
veriSign
(
data
,
sign
,
AbcRsaUtil
.
getPublicKey
(
ypdPublicKey
));
log
.
info
(
"请求浙农解密返回数据:{}"
,
JSON
.
toJSONString
(
dec
));
if
(
f
)
{
return
JSONObject
.
parseObject
(
dec
,
ZyHttpBaseResponse
.
class
);
String
dec
=
EncryptUtil
.
decrypt
(
data
,
AbcRsaUtil
.
getPrivateKey
(
privateKey
));
log
.
info
(
"请求浙农解密返回数据:{}"
,
JSON
.
toJSONString
(
dec
));
return
JSONObject
.
parseObject
(
dec
,
ZyJsonResult
.
class
);
}
else
{
log
.
info
(
"验签异常"
);
}
}
else
{
}
else
{
log
.
info
(
"验签异常"
);
log
.
error
(
"请求浙农异常"
);
return
null
;
}
}
}
catch
(
}
catch
(
Exception
e
)
{
Exception
e
)
{
...
@@ -94,7 +101,7 @@ public class AbcHttpClient {
...
@@ -94,7 +101,7 @@ public class AbcHttpClient {
/*验签*/
/*验签*/
boolean
f
=
SignUtil
.
veriSign
(
data
,
sign
,
AbcRsaUtil
.
getPublicKey
(
ypdPublicKey
));
boolean
f
=
SignUtil
.
veriSign
(
data
,
sign
,
AbcRsaUtil
.
getPublicKey
(
ypdPublicKey
));
if
(
f
)
{
if
(
f
)
{
data
=
"LbfVKZfHTWm0S6h81XLAgv8zRmUwljGCznpVln1be2oiuXH1vw00sPW2uA5iOJND0d+5KtCzT8O3xD4avg4qEHvwlUWDZ7nFCqs5y5X470MCSwyxrH1UbBGLNlrfiq8yWmz5eKcxlyjyhLy46IuVqpJlxZ8hP3yU2gObcACuT8YmiVgzPvzefomyF+YalaFf9l7kObTvmfayVfugC1vCvYDyIWlNs9BUeHpPboo8KUUMi7E7e/jIpunCSSd7fF7Sh3rziwa+170cZfE5wrkJ/m4cvHzK86kCzDrIOABbhuvTFIpaUs8SFNujV2E6YP6jxYJ2FR8IlgMS/W/B4fX7dQ=="
;
//
data = "LbfVKZfHTWm0S6h81XLAgv8zRmUwljGCznpVln1be2oiuXH1vw00sPW2uA5iOJND0d+5KtCzT8O3xD4avg4qEHvwlUWDZ7nFCqs5y5X470MCSwyxrH1UbBGLNlrfiq8yWmz5eKcxlyjyhLy46IuVqpJlxZ8hP3yU2gObcACuT8YmiVgzPvzefomyF+YalaFf9l7kObTvmfayVfugC1vCvYDyIWlNs9BUeHpPboo8KUUMi7E7e/jIpunCSSd7fF7Sh3rziwa+170cZfE5wrkJ/m4cvHzK86kCzDrIOABbhuvTFIpaUs8SFNujV2E6YP6jxYJ2FR8IlgMS/W/B4fX7dQ==";
String
dec
=
EncryptUtil
.
decrypt
(
data
,
AbcRsaUtil
.
getPrivateKey
(
privateKey
));
String
dec
=
EncryptUtil
.
decrypt
(
data
,
AbcRsaUtil
.
getPrivateKey
(
privateKey
));
System
.
out
.
println
(
"解密后返回数据:"
+
dec
);
System
.
out
.
println
(
"解密后返回数据:"
+
dec
);
}
else
{
}
else
{
...
...
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