Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
soss
Overview
Overview
Details
Activity
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
hooloo
ms
soss
Commits
28bcd52d
Commit
28bcd52d
authored
Mar 12, 2023
by
caiyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加微信回调内容打印
parent
be82bb8a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
+9
-7
No files found.
soss-framework/src/main/java/com/soss/framework/web/service/WeixinServiceImpl.java
View file @
28bcd52d
...
@@ -355,12 +355,13 @@ public class WeixinServiceImpl {
...
@@ -355,12 +355,13 @@ public class WeixinServiceImpl {
}
}
public
String
wxNotify
(
HttpServletRequest
request
)
throws
Exception
{
@Transactional
public
synchronized
String
wxNotify
(
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
String
>
returnMap
=
new
HashMap
<>();
//应答对象
Map
<
String
,
String
>
returnMap
=
new
HashMap
<>();
//应答对象
//处理通知参数
//处理通知参数
String
body
=
this
.
readData
(
request
);
String
body
=
this
.
readData
(
request
);
log
.
info
(
"wx notify receive: \n{}"
,
body
);
log
.
info
(
"wx notify receive
origin
: \n{}"
,
body
);
//验签
//验签
if
(!
WXPayUtil
.
isSignatureValid
(
body
,
key
))
{
if
(!
WXPayUtil
.
isSignatureValid
(
body
,
key
))
{
...
@@ -374,6 +375,7 @@ public class WeixinServiceImpl {
...
@@ -374,6 +375,7 @@ public class WeixinServiceImpl {
//解析xml数据
//解析xml数据
Map
<
String
,
String
>
notifyMap
=
WXPayUtil
.
xmlToMap
(
body
);
Map
<
String
,
String
>
notifyMap
=
WXPayUtil
.
xmlToMap
(
body
);
log
.
info
(
"wx notify receive decode: \n{}"
,
JSONObject
.
toJSONString
(
notifyMap
));
//判断通信和业务是否成功
//判断通信和业务是否成功
if
(!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"return_code"
))
||
!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"result_code"
)))
{
if
(!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"return_code"
))
||
!
"SUCCESS"
.
equals
(
notifyMap
.
get
(
"result_code"
)))
{
log
.
error
(
"失败"
);
log
.
error
(
"失败"
);
...
@@ -397,7 +399,7 @@ public class WeixinServiceImpl {
...
@@ -397,7 +399,7 @@ public class WeixinServiceImpl {
// }
// }
//处理订单
//处理订单
if
(
lock
.
tryLock
())
{
//
if (lock.tryLock()) {
Order
order
=
new
Order
();
Order
order
=
new
Order
();
order
.
setOrderNo
(
orderNo
);
order
.
setOrderNo
(
orderNo
);
List
<
Order
>
orders
=
orderService
.
selectOrderList
(
order
);
List
<
Order
>
orders
=
orderService
.
selectOrderList
(
order
);
...
@@ -407,7 +409,7 @@ public class WeixinServiceImpl {
...
@@ -407,7 +409,7 @@ public class WeixinServiceImpl {
return
WXPayUtil
.
mapToXml
(
returnMap
);
return
WXPayUtil
.
mapToXml
(
returnMap
);
}
}
order
=
orders
.
get
(
0
);
order
=
orders
.
get
(
0
);
try
{
//
try {
//处理重复的通知
//处理重复的通知
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
//接口调用的幂等性:无论接口被调用多少次,产生的结果是一致的。
String
orderStatus
=
order
.
getState
();
String
orderStatus
=
order
.
getState
();
...
@@ -419,11 +421,11 @@ public class WeixinServiceImpl {
...
@@ -419,11 +421,11 @@ public class WeixinServiceImpl {
order
.
setPickCode
(
generatePickCode
(
order
));
order
.
setPickCode
(
generatePickCode
(
order
));
orderService
.
updateOrder
(
order
);
orderService
.
updateOrder
(
order
);
}
}
}
finally
{
/*
} finally {
//要主动释放锁
//要主动释放锁
lock.unlock();
lock.unlock();
}
}*/
}
//
}
returnMap
.
put
(
"return_code"
,
"SUCCESS"
);
returnMap
.
put
(
"return_code"
,
"SUCCESS"
);
returnMap
.
put
(
"return_msg"
,
"OK"
);
returnMap
.
put
(
"return_msg"
,
"OK"
);
String
returnXml
=
WXPayUtil
.
mapToXml
(
returnMap
);
String
returnXml
=
WXPayUtil
.
mapToXml
(
returnMap
);
...
...
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