记得上下班打卡 | 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
4a5227f6
Commit
4a5227f6
authored
Jul 14, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`提交支付宝 退款回调`
parent
00a50615
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
19 deletions
+33
-19
PayChannelStrategyAlipayImpl.java
...n/channel/strategy/impl/PayChannelStrategyAlipayImpl.java
+7
-1
PayNotifyController.java
...uidnet/service/dragon/controller/PayNotifyController.java
+1
-0
DragonOrderRefundsServiceImpl.java
...ce/dragon/service/impl/DragonOrderRefundsServiceImpl.java
+25
-18
No files found.
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/strategy/impl/PayChannelStrategyAlipayImpl.java
View file @
4a5227f6
...
...
@@ -18,6 +18,7 @@ import com.liquidnet.service.dragon.dto.DragonOrdersDto;
import
com.liquidnet.service.dragon.dto.DragonPayBaseReqDto
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseRespDto
;
import
com.liquidnet.service.dragon.dto.DragonPayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.service.impl.DragonOrderRefundsServiceImpl
;
import
com.liquidnet.service.dragon.utils.DataUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -52,6 +53,9 @@ public class PayChannelStrategyAlipayImpl implements IPayChannelStrategy {
@Autowired
private
AlipayBiz
alipayBiz
;
@Autowired
private
DragonOrderRefundsServiceImpl
dragonOrderRefundsService
;
@Value
(
"${liquidnet.dragon.wepay.partnerKey}"
)
private
String
partnerKey
;
...
...
@@ -66,7 +70,9 @@ public class PayChannelStrategyAlipayImpl implements IPayChannelStrategy {
Map
<
String
,
String
>
notifyMap
=
new
HashMap
<
String
,
String
>();
notifyMap
=
alipayBiz
.
parseNotifyMsg
(
requestParams
);
log
.
info
(
"dragonNotify-->alipay json : {}"
,
JSON
.
toJSONString
(
notifyMap
));
if
(
notifyMap
.
containsKey
(
"refund_fee"
)
||
notifyMap
.
containsKey
(
"gmt_refund"
)
||
notifyMap
.
containsKey
(
"out_biz_no"
))
{
dragonOrderRefundsService
.
aliPayRefundCallBack
(
JSON
.
toJSONString
(
notifyMap
));
}
log
.
info
(
"接收到{}支付结果{}"
,
payType
,
notifyMap
);
String
returnStr
=
null
;
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/controller/PayNotifyController.java
View file @
4a5227f6
package
com
.
liquidnet
.
service
.
dragon
.
controller
;
import
com.liquidnet.service.dragon.service.IDragonOrderRefundsService
;
import
com.liquidnet.service.dragon.service.IDragonOrdersService
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrderRefundsServiceImpl.java
View file @
4a5227f6
package
com
.
liquidnet
.
service
.
dragon
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alipay.api.request.AlipayTradeFastpayRefundQueryRequest
;
import
com.alipay.api.request.AlipayTradeRefundRequest
;
import
com.alipay.api.response.AlipayTradeFastpayRefundQueryResponse
;
import
com.alipay.api.response.AlipayTradeRefundResponse
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
...
...
@@ -28,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.http.HttpEntity
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.client.utils.DateUtils
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -411,46 +414,50 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
try
{
AliPayRefundReturnCallBackDto
callBackDto
=
JsonUtils
.
fromJson
(
jsonStr
,
AliPayRefundReturnCallBackDto
.
class
);
log
.
debug
(
"DATA = "
+
callBackDto
);
if
(
callBackDto
.
getNotifyType
().
equalsIgnoreCase
(
"SUCCESS"
))
{
String
outRefundNo
=
callBackDto
.
getOutBizNo
();
String
refundAt
=
callBackDto
.
getGmtRefund
();
String
outTradeNo
=
callBackDto
.
getOutTradeNo
();
String
refundFee
=
callBackDto
.
getRefundFee
();
AlipayTradeFastpayRefundQueryRequest
request
=
new
AlipayTradeFastpayRefundQueryRequest
();
//创建API对应的request类
log
.
debug
(
"AlipayTradeFastpayRefundQueryRequest -> data = "
+
JSON
.
toJSONString
(
request
));
request
.
setBizContent
(
"{"
+
"\"out_trade_no\":\""
+
callBackDto
.
getOutTradeNo
()
+
"\","
+
"\"trade_no\":\""
+
callBackDto
.
getTradeNo
()
+
"\","
+
"\"out_request_no\":\""
+
callBackDto
.
getOutBizNo
()
+
"\"}"
);
//设置业务参数
AlipayTradeFastpayRefundQueryResponse
response
=
PayAlipayUtils
.
getInstance
().
getHttpClient
().
execute
(
request
);
if
(
response
.
getRefundChannelStatus
().
equalsIgnoreCase
(
"SUCCESS"
))
{
try
{
sendMySqlRedis
(
SqlMapping
.
get
(
"dragon_order_refund_log.insert"
),
new
Object
[]{
outRefundNo
,
"退款原因"
,
jsonStr
,
nowTime
,
nowTime
}
new
Object
[]{
response
.
getOutRequestNo
(),
response
.
getRefundReason
()
,
jsonStr
,
nowTime
,
nowTime
}
);
sendMySqlRedis
(
SqlMapping
.
get
(
"dragon_order_refund_success.update"
),
new
Object
[]{
nowTime
,
re
fundAt
,
DragonConstant
.
RefundStatusEnum
.
STATUS_REFUNDED
.
getCode
(),
outRefundNo
}
new
Object
[]{
nowTime
,
re
sponse
.
getGmtRefundPay
(),
DragonConstant
.
RefundStatusEnum
.
STATUS_REFUNDED
.
getCode
(),
response
.
getOutRequestNo
()
}
);
NotifyUrlDto
dto
=
new
NotifyUrlDto
();
if
(
callBackDto
.
getNotifyType
().
equalsIgnoreCase
(
"SUCCESS"
))
{
if
(
response
.
getRefundChannelStatus
().
equalsIgnoreCase
(
"SUCCESS"
))
{
dto
.
setStatus
(
1
);
}
else
{
dto
.
setStatus
(
0
);
}
dto
.
setOrderRefundCode
(
outRefundNo
);
dto
.
setRefundCode
(
outTradeNo
);
dto
.
setRefundPrice
(
refundFee
);
dto
.
setRefundAt
(
refundAt
);
dto
.
setRefundError
(
"退款失败"
);
dto
.
setOrderRefundCode
(
response
.
getOutRequestNo
());
dto
.
setRefundCode
(
response
.
getOutTradeNo
());
dto
.
setRefundPrice
(
response
.
getRefundAmount
());
dto
.
setRefundAt
(
DateUtil
.
format
(
response
.
getGmtRefundPay
(),
DateUtil
.
Formatter
.
yyyyMMddHHmmss
));
dto
.
setRefundPrice
(
response
.
getRefundAmount
());
dto
.
setRefundError
(
response
.
getSubMsg
());
sendNotifyUrl
(
dto
);
return
"
<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>
"
;
return
"
success
"
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
""
);
return
"
<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>
"
;
return
"
fail
"
;
}
}
else
{
return
"
<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>
"
;
return
"
fail
"
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
""
);
return
"
<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[ERROR]]></return_msg></xml>
"
;
return
"
fail
"
;
}
}
...
...
@@ -497,7 +504,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
params
.
add
(
"refundCode"
,
notifyUrlDto
.
getRefundCode
());
params
.
add
(
"refundError"
,
notifyUrlDto
.
getRefundError
());
// params.add("refundId", notifyUrlDto.getRefundId());
params
.
add
(
"refundPrice"
,
notifyUrlDto
.
getRefundPrice
());
//
params.add("refundPrice", notifyUrlDto.getRefundPrice());
params
.
add
(
"status"
,
notifyUrlDto
.
getStatus
().
toString
());
String
response
=
HttpUtil
.
post
((
String
)
redisUtil
.
get
(
DragonConstant
.
REFUND_REDIS_KET
+
notifyUrlDto
.
getOrderRefundCode
()),
params
);
log
.
debug
(
"RETURN RESPONSE="
+
response
);
...
...
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