记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
董敬伟
liquidnet-bus-v1
Commits
87e5680e
Commit
87e5680e
authored
Jun 24, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
快递
parent
c066a8d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
12 deletions
+19
-12
PerformancesExpressController.java
...troller/zhengzai/kylin/PerformancesExpressController.java
+6
-5
ShunfengSignUtils.java
.../client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
+13
-7
No files found.
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/java/com/liquidnet/client/admin/web/controller/zhengzai/kylin/PerformancesExpressController.java
View file @
87e5680e
...
...
@@ -9,7 +9,6 @@ import com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceOrderListAdm
import
com.liquidnet.service.kylin.dto.param.PerformanceExpressSearchAdminParam
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -31,16 +30,18 @@ public class PerformancesExpressController extends BaseController {
private
String
prefix
=
"zhengzai/kylin/performancesExpress"
;
@Value
(
"${liquidnet.shunfeng.url}"
)
p
rivate
String
url
;
/*
@Value("${liquidnet.shunfeng.url}")
p
ublic
String url;
@Value("${liquidnet.shunfeng.sk}")
private String sk;
@Value("${liquidnet.shunfeng.appid}")
private
String
appid
;
private String appid;
*/
@Autowired
private
PerformancesExpressServiceImpl
performancesExpressServiceImpl
;
private
ShunfengSignUtils
shunfengSignUtils
;
/**
* 查询演出列表
*/
...
...
@@ -90,7 +91,7 @@ public class PerformancesExpressController extends BaseController {
System
.
out
.
println
(
"时间戳:"
+
currentTimeMillis
);
// 生成签名并请求
String
result
=
ShunfengSignUtils
.
generateSignatureAndRequest
(
currentTimeMillis
+
""
,
body
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
currentTimeMillis
+
""
,
body
,
"/order/v1/placeOrder"
);
System
.
out
.
println
(
"响应:"
+
result
);
return
true
;
}
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
View file @
87e5680e
...
...
@@ -28,12 +28,17 @@ public class ShunfengSignUtils {
* appId
*/
@Value
(
"${liquidnet.shunfeng.appid}"
)
private
static
String
APP_ID
=
""
;
private
String
APP_ID
;
/**
* sk
*/
@Value
(
"${liquidnet.shunfeng.sk}"
)
private
static
String
SK
=
""
;
private
String
SK
;
/**
* url
*/
@Value
(
"${liquidnet.shunfeng.url}"
)
private
String
URL
;
/**
* 签名有效期(可根据实际业务设定)单位:毫秒
*/
...
...
@@ -45,14 +50,15 @@ public class ShunfengSignUtils {
* @param body 请求body
* @return
*/
public
static
String
generateSignatureAndRequest
(
String
timestamp
,
String
body
)
{
public
String
generateSignatureAndRequest
(
String
timestamp
,
String
body
,
String
url
)
{
// 生成签名
String
sign
=
genSign
(
timestamp
,
body
);
System
.
out
.
println
(
"签名:"
+
sign
);
CloseableHttpClient
client
=
HttpClients
.
createDefault
();
// 请求下单地址
HttpPost
httpPost
=
new
HttpPost
(
"https://butler-dev-ms.sf-express.com/public/order/v1/placeOrder"
);
HttpPost
httpPost
=
new
HttpPost
(
URL
+
url
);
System
.
out
.
println
(
"请求的url:"
+
URL
+
url
);
// sendAppId(sendAppId需赋值appId)
httpPost
.
addHeader
(
"sendAppId"
,
APP_ID
);
// 时间戳需和获取验签时一致!!!
...
...
@@ -99,7 +105,7 @@ public class ShunfengSignUtils {
* @param body 请求body
* @return
*/
private
static
String
genSign
(
String
timestamp
,
String
body
)
{
private
String
genSign
(
String
timestamp
,
String
body
)
{
if
(
StringUtils
.
isEmpty
(
body
))
{
body
=
""
;
}
...
...
@@ -121,7 +127,7 @@ public class ShunfengSignUtils {
* @param request 接收请求
* @return
*/
public
static
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
public
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
// 请求方APPID
String
sendAppId
=
request
.
getHeader
(
"sendAppId"
);
// 请求方时间戳
...
...
@@ -148,7 +154,7 @@ public class ShunfengSignUtils {
return
false
;
}
// 请求方参数+请求方时间戳+SK 生成签名
String
thisSign
=
ShunfengSignUtils
.
genSign
(
timestamp
,
params
);
String
thisSign
=
genSign
(
timestamp
,
params
);
// 获取的签名和请求方签名比较是否一致
if
(!
thisSign
.
equals
(
sign
))
{
System
.
out
.
println
(
"签名错误"
);
...
...
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