记得上下班打卡 | 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
d2daec1f
Commit
d2daec1f
authored
Jul 07, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
b9375d4c
f5ef77ca
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
75 deletions
+38
-75
PerformancesExpressController.java
...troller/zhengzai/kylin/PerformancesExpressController.java
+1
-1
KylinRefundsStatusServiceImpl.java
...zai/kylin/service/impl/KylinRefundsStatusServiceImpl.java
+7
-0
PerformancesExpressServiceImpl.java
...ai/kylin/service/impl/PerformancesExpressServiceImpl.java
+15
-15
ShunfengSignUtils.java
.../client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
+15
-59
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 @
d2daec1f
...
@@ -75,7 +75,7 @@ public class PerformancesExpressController extends BaseController {
...
@@ -75,7 +75,7 @@ public class PerformancesExpressController extends BaseController {
@RequiresPermissions
(
"kylin:performancesExpress:placeOrder"
)
@RequiresPermissions
(
"kylin:performancesExpress:placeOrder"
)
@PostMapping
(
"/placeOrder"
)
@PostMapping
(
"/placeOrder"
)
@ResponseBody
@ResponseBody
public
AjaxResult
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
throws
Exception
{
public
AjaxResult
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
{
ResponseDto
res
=
performancesExpressServiceImpl
.
placeOrder
(
performanceExpressSearchAdminParam
);
ResponseDto
res
=
performancesExpressServiceImpl
.
placeOrder
(
performanceExpressSearchAdminParam
);
try
{
try
{
if
(
res
.
isSuccess
())
{
if
(
res
.
isSuccess
())
{
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/KylinRefundsStatusServiceImpl.java
View file @
d2daec1f
...
@@ -202,6 +202,13 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -202,6 +202,13 @@ public class KylinRefundsStatusServiceImpl {
mongoTemplate
.
insert
(
kylinOrderRefundEntitiesVo
,
KylinOrderRefundEntitiesVo
.
class
.
getSimpleName
());
mongoTemplate
.
insert
(
kylinOrderRefundEntitiesVo
,
KylinOrderRefundEntitiesVo
.
class
.
getSimpleName
());
}
}
List
<
String
>
orderRefundIds
=
new
ArrayList
<>();
orderRefundIds
.
add
(
orderRefundsId
);
List
<
String
>
orderIds
=
new
ArrayList
<>();
orderIds
.
add
(
orderTicketsId
);
dataUtils
.
delOrderRefundVo
(
orderRefundIds
);
dataUtils
.
delOrderRefundVoByOrderId
(
orderIds
);
return
true
;
return
true
;
}
}
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/PerformancesExpressServiceImpl.java
View file @
d2daec1f
...
@@ -121,7 +121,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -121,7 +121,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
return
voList
;
return
voList
;
}
}
public
ResponseDto
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
throws
Exception
{
public
ResponseDto
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
{
List
<
String
>
ids
=
performanceExpressSearchAdminParam
.
getIds
();
List
<
String
>
ids
=
performanceExpressSearchAdminParam
.
getIds
();
for
(
String
orderTicketsId
:
ids
)
{
for
(
String
orderTicketsId
:
ids
)
{
// 已经存在未取消的下单数据过滤掉
// 已经存在未取消的下单数据过滤掉
...
@@ -179,7 +179,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -179,7 +179,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
Test
(
hBody
,
"/public/order/v1/placeOrder"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/placeOrder"
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
HashMap
hashMap
=
new
HashMap
();
HashMap
hashMap
=
new
HashMap
();
try
{
try
{
...
@@ -283,11 +283,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -283,11 +283,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/cancelOrder"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/cancelOrder"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -329,12 +329,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -329,12 +329,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"searchType"
,
1
);
//查询类型:1,正向单查询,传入的orderid为正向定单号,2,退货单查询,传入的orderid为退货原始订单号
hBody
.
put
(
"searchType"
,
"1"
);
//查询类型:1,正向单查询,传入的orderid为正向定单号,2,退货单查询,传入的orderid为退货原始订单号
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/getResult"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/getResult"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -375,7 +375,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -375,7 +375,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
new
QueryWrapper
<
KylinOrderTickets
>().
eq
(
"order_tickets_id"
,
orderTicketsId
)
new
QueryWrapper
<
KylinOrderTickets
>().
eq
(
"order_tickets_id"
,
orderTicketsId
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"jProvince"
,
jProvince
);
hBody
.
put
(
"jProvince"
,
jProvince
);
hBody
.
put
(
"jCity"
,
jCity
);
hBody
.
put
(
"jCity"
,
jCity
);
hBody
.
put
(
"jAddress"
,
jAddress
);
hBody
.
put
(
"jAddress"
,
jAddress
);
...
@@ -383,12 +383,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -383,12 +383,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
hBody
.
put
(
"dProvince"
,
orderInfo
.
getProvince
());
hBody
.
put
(
"dProvince"
,
orderInfo
.
getProvince
());
hBody
.
put
(
"dCity"
,
orderInfo
.
getCity
());
hBody
.
put
(
"dCity"
,
orderInfo
.
getCity
());
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
hBody
.
put
(
"expressType"
,
expressType
);
hBody
.
put
(
"expressType"
,
expressType
.
toString
()
);
// hBody.put("parcelWeighs", 2.00);
// hBody.put("parcelWeighs", 2.00);
// hBody.put("volume", "10,10,20");
// hBody.put("volume", "10,10,20");
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/getFreight"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/getFreight"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -420,11 +420,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -420,11 +420,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/getListFreight"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/getListFreight"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -462,11 +462,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -462,11 +462,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/listOrderRoute"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/listOrderRoute"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -499,7 +499,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -499,7 +499,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
}
}
// @Async
// @Async
public
void
batchPlaceOrder
(
String
performanceId
)
throws
Exception
{
public
void
batchPlaceOrder
(
String
performanceId
)
{
int
count
;
int
count
;
int
limitNum
=
10
;
int
limitNum
=
10
;
int
mid
=
0
;
int
mid
=
0
;
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
View file @
d2daec1f
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.UserPathDto
;
import
com.liquidnet.service.base.UserPathDto
;
import
com.liquidnet.service.kylin.entity.KylinOrderExpress
;
import
com.liquidnet.service.kylin.mapper.KylinOrderExpressMapper
;
import
com.liquidnet.service.kylin.mapper.KylinOrderExpressMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.Base64
;
...
@@ -57,15 +55,12 @@ public class ShunfengSignUtils {
...
@@ -57,15 +55,12 @@ public class ShunfengSignUtils {
*/
*/
private
final
static
Long
CHECK_TIME
=
600000L
;
private
final
static
Long
CHECK_TIME
=
600000L
;
@Autowired
private
KylinOrderExpressMapper
kylinOrderExpressMapper
;
/**
/**
* 生成签名并请求
* 生成签名并请求
* @param hbody 请求body
* @param hbody 请求body
* @return
* @return
*/
*/
public
String
generateSignatureAndRequest
Test
(
Map
<
String
,
String
>
hbody
,
String
url
)
throws
Exception
{
public
String
generateSignatureAndRequest
New
(
Map
<
String
,
String
>
hbody
,
String
url
)
{
long
currentTimeMillis
=
System
.
currentTimeMillis
();
// 时间戳
long
currentTimeMillis
=
System
.
currentTimeMillis
();
// 时间戳
String
timestamp
=
currentTimeMillis
+
""
;
String
timestamp
=
currentTimeMillis
+
""
;
hbody
.
put
(
"companyId"
,
APP_ID
);
hbody
.
put
(
"companyId"
,
APP_ID
);
...
@@ -79,21 +74,25 @@ public class ShunfengSignUtils {
...
@@ -79,21 +74,25 @@ public class ShunfengSignUtils {
headers
.
put
(
"sign"
,
sign
);
headers
.
put
(
"sign"
,
sign
);
headers
.
put
(
"Content-Type"
,
"application/json;charset=utf-8"
);
headers
.
put
(
"Content-Type"
,
"application/json;charset=utf-8"
);
headers
.
put
(
"Accept"
,
"application/json"
);
headers
.
put
(
"Accept"
,
"application/json"
);
// CloseableHttpClient client = HttpClients.createDefault();
Map
<
String
,
String
>
querys
=
new
HashMap
<>();
Map
<
String
,
String
>
querys
=
new
HashMap
<>();
HttpResponse
httpResponse
=
HttpClientUtils
.
doPost
(
URL
,
url
,
""
,
headers
,
querys
,
hbody
);
try
{
System
.
out
.
println
(
httpResponse
);
HttpResponse
httpResponse
=
HttpClientUtils
.
doPost
(
URL
,
url
,
""
,
headers
,
querys
,
body
);
if
(
httpResponse
.
getStatusLine
().
getStatusCode
()
==
200
)
{
if
(
httpResponse
.
getStatusLine
().
getStatusCode
()
==
200
)
{
System
.
out
.
println
(
"发送请求成功"
);
System
.
out
.
println
(
"发送请求成功"
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
HttpEntity
entity
=
httpResponse
.
getEntity
();
// 发送响应且编码UTF8!!!
// 发送响应且编码UTF8!!!
return
EntityUtils
.
toString
(
entity
,
"utf-8"
);
return
EntityUtils
.
toString
(
entity
,
"utf-8"
);
}
}
return
"error"
;
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送请求失败"
);
e
.
printStackTrace
();
return
e
.
getMessage
();
}
return
null
;
}
}
/**
/**
* 生成签名并请求
* 生成签名并请求
线上Received fatal alert:handshake_failure 废弃
* @param hbody 请求body
* @param hbody 请求body
* @return
* @return
*/
*/
...
@@ -173,47 +172,4 @@ public class ShunfengSignUtils {
...
@@ -173,47 +172,4 @@ public class ShunfengSignUtils {
return
Base64
.
encodeBase64URLSafeString
(
bytes
);
return
Base64
.
encodeBase64URLSafeString
(
bytes
);
}
}
/**
* 接收请求且验签(可在控制层调用此方法)
* @param params 接收请求参数
* @param request 接收请求
* @return
*/
public
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
=
genSign
(
timestamp
,
params
);
// 获取的签名和请求方签名比较是否一致
if
(!
thisSign
.
equals
(
sign
))
{
System
.
out
.
println
(
"签名错误"
);
return
false
;
}
return
true
;
}
}
}
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