记得上下班打卡 | 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
49372225
Commit
49372225
authored
Jun 24, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
5524de12
ab5b0019
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
189 additions
and
12 deletions
+189
-12
PerformancesExpressController.java
...troller/zhengzai/kylin/PerformancesExpressController.java
+20
-0
performanceOrderList.html
...ngzai/kylin/performancesExpress/performanceOrderList.html
+6
-8
ShunfengSignUtils.java
.../client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
+159
-0
PerformanceExpressPerformanceOrderListAdminDao.java
...n/dao/PerformanceExpressPerformanceOrderListAdminDao.java
+3
-3
KylinPerformancesServiceImpl.java
...vice/kylin/service/impl/KylinPerformancesServiceImpl.java
+1
-1
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 @
49372225
...
...
@@ -3,6 +3,7 @@ package com.liquidnet.client.admin.web.controller.zhengzai.kylin;
import
com.liquidnet.client.admin.common.core.controller.BaseController
;
import
com.liquidnet.client.admin.common.core.page.TableDataInfo
;
import
com.liquidnet.client.admin.zhengzai.kylin.service.impl.PerformancesExpressServiceImpl
;
import
com.liquidnet.client.admin.zhengzai.kylin.utils.ShunfengSignUtils
;
import
com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceListAdminDao
;
import
com.liquidnet.service.kylin.dao.PerformanceExpressPerformanceOrderListAdminDao
;
import
com.liquidnet.service.kylin.dto.param.PerformanceExpressSearchAdminParam
;
...
...
@@ -75,4 +76,23 @@ public class PerformancesExpressController extends BaseController {
return
getDataTable
(
result
);
}
/**
* 下单
*/
@RequiresPermissions
(
"kylin:performancesExpress:placeOrder"
)
@PostMapping
(
"/placeOrder"
)
@ResponseBody
public
boolean
placeOrder
()
{
// 请求body companyId参数值和APPID一致!!!
String
body
=
"{\"dContact\":\"王昆\",\"companyId\":{{APP_ID}},\"jContact\":\"顺丰\",\"jTel\":\"111\",\"jMobile\":null,\"jAddress\":\"马甸\",\"dTel\":\"064756935\",\"dMobile\":null,\"dAddress\":\"北京市朝阳区花家地金兴路1号院5号楼1单元202\",\"custid\":\"7551234567\",\"payMethod\":\"0\",\"expressType\":\"1\",\"packagesNo\":\"1\",\"depositumInfo\":\"TCL空调\",\"depositumNo\":\"1\",\"remark\":null,\"isCollection\":\"1\",\"collectionMoney\":\"10.00\",\"isReceipt\":\"0\",\"receipt\":null}"
;
// 时间戳
long
currentTimeMillis
=
System
.
currentTimeMillis
();
System
.
out
.
println
(
"时间戳:"
+
currentTimeMillis
);
// 生成签名并请求
String
result
=
ShunfengSignUtils
.
generateSignatureAndRequest
(
currentTimeMillis
+
""
,
body
);
System
.
out
.
println
(
"响应:"
+
result
);
return
true
;
}
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/resources/templates/zhengzai/kylin/performancesExpress/performanceOrderList.html
View file @
49372225
...
...
@@ -94,19 +94,17 @@
return
$
.
table
.
selectDictLabel
(
orderStatusDic
,
value
);
}
},
{
field
:
'priceExpress'
,
title
:
'快递费'
},
{
field
:
''
,
title
:
'快递
方式
'
,
title
:
'快递'
,
formatter
:
function
(
value
,
row
,
index
)
{
var
expressType
=
''
;
if
(
row
.
expressType
==
1
)
{
return
"寄付"
;
expressType
=
"寄付"
;
}
else
{
return
"到付"
;
expressType
=
"到付"
;
}
return
'快递方式:'
+
expressType
+
'<br>'
+
'快递费:'
+
row
.
priceExpress
;
}
},
{
...
...
@@ -127,7 +125,7 @@
var
expressContacts
=
row
.
expressContacts
;
var
expressAddress
=
row
.
expressAddress
;
var
expressPhone
=
row
.
expressPhone
;
return
'姓名:'
+
expressContacts
+
'<br>'
+
'手机号:'
+
expressPhone
+
'<br>'
+
'地址:'
+
express
Phone
;
return
'姓名:'
+
expressContacts
+
'<br>'
+
'手机号:'
+
expressPhone
+
'<br>'
+
'地址:'
+
express
Address
;
}
},
{
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
0 → 100644
View file @
49372225
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
/**
* <p>
* 顺丰
* </p>
*
* @author jiangxiulong
* @since 2021-06-24 8:00 下午
*/
public
class
ShunfengSignUtils
{
/**
* appId
*/
@Value
(
"${liquidnet.shunfeng.appid}"
)
private
static
String
APP_ID
=
""
;
/**
* sk
*/
@Value
(
"${liquidnet.shunfeng.sk}"
)
private
static
String
SK
=
""
;
/**
* 签名有效期(可根据实际业务设定)单位:毫秒
*/
private
final
static
Long
CHECK_TIME
=
600000L
;
/**
* 生成签名并请求
* @param timestamp 时间戳
* @param body 请求body
* @return
*/
public
static
String
generateSignatureAndRequest
(
String
timestamp
,
String
body
)
{
// 生成签名
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"
);
// sendAppId(sendAppId需赋值appId)
httpPost
.
addHeader
(
"sendAppId"
,
APP_ID
);
// 时间戳需和获取验签时一致!!!
httpPost
.
addHeader
(
"timestamp"
,
timestamp
);
// 签名
httpPost
.
addHeader
(
"sign"
,
sign
);
httpPost
.
addHeader
(
"Content-Type"
,
"application/json;charset=utf-8"
);
// 请求body体需和获取验签时一致且编码UTF8!!!
httpPost
.
setEntity
(
new
StringEntity
(
body
,
"utf-8"
));
CloseableHttpResponse
response
=
null
;
try
{
response
=
client
.
execute
(
httpPost
);
if
(
response
.
getStatusLine
().
getStatusCode
()
==
200
)
{
System
.
out
.
println
(
"发送请求成功"
);
HttpEntity
entity
=
response
.
getEntity
();
// 发送响应且编码UTF8!!!
return
EntityUtils
.
toString
(
entity
,
"utf-8"
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送请求失败"
);
e
.
printStackTrace
();
}
finally
{
if
(
client
!=
null
)
{
try
{
client
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
response
!=
null
)
{
try
{
response
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
null
;
}
/**
* 生成签名
* @param timestamp 时间戳
* @param body 请求body
* @return
*/
private
static
String
genSign
(
String
timestamp
,
String
body
)
{
if
(
StringUtils
.
isEmpty
(
body
))
{
body
=
""
;
}
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
body
);
sb
.
append
(
"&sk="
).
append
(
SK
);
sb
.
append
(
"×tamp="
).
append
(
timestamp
);
byte
[]
bytes
=
DigestUtils
.
sha512
(
sb
.
toString
());
return
Base64
.
encodeBase64URLSafeString
(
bytes
);
}
/**
* 接收请求且验签(可在控制层调用此方法)
* @param params 接收请求参数
* @param request 接收请求
* @return
*/
public
static
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
// 请求方APPID
String
sendAppId
=
request
.
getHeader
(
"sendAppId"
);
// 请求方时间戳
String
timestamp
=
request
.
getHeader
(
"timestamp"
);
// 请求方签名
String
sign
=
request
.
getHeader
(
"sign"
);
if
(
StringUtils
.
isBlank
(
sendAppId
))
{
System
.
out
.
println
(
"参数sendAppId不能为空"
);
return
false
;
}
if
(
StringUtils
.
isBlank
(
timestamp
))
{
System
.
out
.
println
(
"参数timestamp不能为空"
);
return
false
;
}
if
(
StringUtils
.
isBlank
(
sign
))
{
System
.
out
.
println
(
"参数sign不能为空"
);
return
false
;
}
// 校验签名是否过期
long
requestTime
=
Long
.
parseLong
(
timestamp
);
long
now
=
System
.
currentTimeMillis
();
if
(
Math
.
abs
(
now
-
requestTime
)
>
CHECK_TIME
)
{
System
.
out
.
println
(
"签名过期!"
);
return
false
;
}
// 请求方参数+请求方时间戳+SK 生成签名
String
thisSign
=
ShunfengSignUtils
.
genSign
(
timestamp
,
params
);
// 获取的签名和请求方签名比较是否一致
if
(!
thisSign
.
equals
(
sign
))
{
System
.
out
.
println
(
"签名错误"
);
return
false
;
}
return
true
;
}
}
liquidnet-bus-do/liquidnet-service-kylin-do/src/main/java/com/liquidnet/service/kylin/dao/PerformanceExpressPerformanceOrderListAdminDao.java
View file @
49372225
...
...
@@ -16,9 +16,9 @@ public class PerformanceExpressPerformanceOrderListAdminDao {
String
userName
;
String
userMobile
;
String
express
_c
ontacts
;
String
express
_a
ddress
;
String
express
_p
hone
;
String
express
C
ontacts
;
String
express
A
ddress
;
String
express
P
hone
;
Integer
expressType
;
...
...
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/service/impl/KylinPerformancesServiceImpl.java
View file @
49372225
...
...
@@ -302,7 +302,7 @@ public class KylinPerformancesServiceImpl extends ServiceImpl<KylinPerformancesM
query
.
fields
().
exclude
(
"noticeImage"
);
query
.
fields
().
exclude
(
"ticketTimeList"
);
Sort
sortName
=
Sort
.
by
(
Sort
.
Direction
.
A
SC
,
"timeStart"
);
Sort
sortName
=
Sort
.
by
(
Sort
.
Direction
.
DE
SC
,
"timeStart"
);
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
size
,
sortName
);
query
.
with
(
pageable
);
...
...
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