记得上下班打卡 | 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
0762d4f3
Commit
0762d4f3
authored
Jul 19, 2021
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支付通知逻辑
parent
8bb6aaa3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
17 deletions
+35
-17
DragonErrorCodeEnum.java
...iquidnet/service/dragon/constant/DragonErrorCodeEnum.java
+3
-1
PayChannelStrategyAlipayImpl.java
...n/channel/strategy/impl/PayChannelStrategyAlipayImpl.java
+2
-1
WepayBiz.java
.../liquidnet/service/dragon/channel/wepay/biz/WepayBiz.java
+6
-5
AbstractWepayStrategy.java
...on/channel/wepay/strategy/impl/AbstractWepayStrategy.java
+24
-10
No files found.
liquidnet-bus-api/liquidnet-service-dragon-api/src/main/java/com/liquidnet/service/dragon/constant/DragonErrorCodeEnum.java
View file @
0762d4f3
...
...
@@ -27,7 +27,9 @@ public enum DragonErrorCodeEnum {
TRADE_ALIPAY_QUERY_ERROR
(
"PAY0010010"
,
"支付宝订单查询失败!"
),
TRADE_WEPAY_SIGN_ERROR
(
"PAY0020001"
,
"微信签名异常!"
);
TRADE_WEPAY_SIGN_ERROR
(
"PAY0020001"
,
"微信签名异常!"
),
TRADE_WEPAY_QUERY_ERROR
(
"PAY0020002"
,
"微信订单查询失败!"
);
private
String
code
;
private
String
message
;
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/strategy/impl/PayChannelStrategyAlipayImpl.java
View file @
0762d4f3
...
...
@@ -152,7 +152,8 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_ALIPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ALIPAY_QUERY_ERROR
.
getMessage
());
}
// 当返回状态为“TRADE_FINISHED”交易成功结束和“TRADE_SUCCESS”支付成功时更新交易状态
if
(
"TRADE_SUCCESS"
.
equals
(
resultMap
.
get
(
"tradeStatus"
))
||
"TRADE_FINISHED"
.
equals
(
resultMap
.
get
(
"tradeStatus"
)))
{
if
(
AlipayConstant
.
AlipayTradeStateEnum
.
TRADE_SUCCESS
.
getCode
().
equals
(
resultMap
.
get
(
"tradeStatus"
))
||
AlipayConstant
.
AlipayTradeStateEnum
.
TRADE_FINISHED
.
getCode
().
equals
(
resultMap
.
get
(
"tradeStatus"
)))
{
respDto
.
setStatus
(
Integer
.
valueOf
(
DragonConstant
.
PayStatusEnum
.
STATUS_PAID
.
getCode
()));
}
return
respDto
;
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/wepay/biz/WepayBiz.java
View file @
0762d4f3
package
com
.
liquidnet
.
service
.
dragon
.
channel
.
wepay
.
biz
;
import
com.liquidnet.service.dragon.channel.wepay.resp.WepayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.utils.PayWepayUtils
;
import
com.liquidnet.service.dragon.utils.XmlUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -12,6 +11,8 @@ import org.apache.http.util.EntityUtils;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
...
...
@@ -35,9 +36,9 @@ public class WepayBiz{
*
* @return
*/
public
WepayOrderQueryRespDto
tradeQuery
(
String
outTradeNo
,
String
appid
)
{
public
Map
<
String
,
Object
>
tradeQuery
(
String
outTradeNo
,
String
appid
)
{
Map
<
String
,
Object
>
respMap
=
new
HashMap
<>();
log
.
info
(
"======>支付宝交易查询"
);
WepayOrderQueryRespDto
respDto
=
null
;
SortedMap
<
String
,
Object
>
paramMap
=
new
TreeMap
<>();
paramMap
.
put
(
"appid"
,
appid
);
paramMap
.
put
(
"mch_id"
,
merchantId
);
...
...
@@ -57,11 +58,11 @@ public class WepayBiz{
String
xmlStr
=
EntityUtils
.
toString
(
response
.
getEntity
(),
"UTF-8"
);
EntityUtils
.
consume
(
entity
);
log
.
info
(
"dragonPay:wepay:wap response xmlStr: {} "
,
xmlStr
);
resp
Dto
=
XmlUtil
.
toBean
(
xmlStr
,
WepayOrderQueryRespDto
.
class
);
resp
Map
=
XmlUtil
.
xmlToMap
(
xmlStr
);
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
());
}
return
resp
Dto
;
return
resp
Map
;
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/wepay/strategy/impl/AbstractWepayStrategy.java
View file @
0762d4f3
...
...
@@ -4,15 +4,18 @@ import com.liquidnet.common.exception.LiquidnetServiceException;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.dragon.biz.DragonServiceCommonBiz
;
import
com.liquidnet.service.dragon.channel.strategy.biz.DragonPayBiz
;
import
com.liquidnet.service.dragon.channel.wepay.biz.WepayBiz
;
import
com.liquidnet.service.dragon.channel.wepay.constant.WepayConstant
;
import
com.liquidnet.service.dragon.channel.wepay.resp.WepayOrderQueryRespDto
;
import
com.liquidnet.service.dragon.channel.wepay.resp.WepayPayRespDto
;
import
com.liquidnet.service.dragon.channel.wepay.strategy.IWepayStrategy
;
import
com.liquidnet.service.dragon.constant.DragonConstant
;
import
com.liquidnet.service.dragon.constant.DragonErrorCodeEnum
;
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.utils.DataUtils
;
import
com.liquidnet.service.dragon.utils.PayWepayUtils
;
import
com.liquidnet.service.dragon.utils.XmlUtil
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -26,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
java.math.BigDecimal
;
import
java.time.LocalDateTime
;
import
java.time.ZoneOffset
;
import
java.util.Map
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
...
...
@@ -43,9 +47,15 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
@Autowired
private
WepayBiz
wepayBiz
;
@Autowired
private
DataUtils
dataUtils
;
@Autowired
private
DragonServiceCommonBiz
dragonServiceCommonBiz
;
@Autowired
private
DragonPayBiz
dragonPayBiz
;
@Override
public
ResponseDto
<
DragonPayBaseRespDto
>
dragonPay
(
DragonPayBaseReqDto
dragonPayBaseReqDto
)
{
...
...
@@ -159,15 +169,19 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
@Override
public
DragonPayOrderQueryRespDto
checkOrderStatus
(
String
code
)
{
WepayOrderQueryRespDto
result
=
wepayBiz
.
tradeQuery
(
code
,
this
.
getAppid
());
DragonPayOrderQueryRespDto
respDto
=
new
DragonPayOrderQueryRespDto
();
respDto
.
setCode
(
code
);
// respDto.setOrderCode("");
// respDto.setStatus("");
// respDto.setType();
// respDto.setPaymentId();
// respDto.setPrice();
// respDto.setPaymentType();
DragonOrdersDto
ordersDto
=
dataUtils
.
getPayOrderByCode
(
code
);
Map
<
String
,
Object
>
resultMap
=
wepayBiz
.
tradeQuery
(
code
,
this
.
getAppid
());
DragonPayOrderQueryRespDto
respDto
=
dragonPayBiz
.
buildPayOrderQueryRespDto
(
ordersDto
);
Object
returnCode
=
resultMap
.
get
(
"return_code"
);
// 查询失败
if
(
null
==
returnCode
||
"FAIL"
.
equals
(
returnCode
))
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_WEPAY_QUERY_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_WEPAY_QUERY_ERROR
.
getMessage
());
}
// 当trade_state为SUCCESS时才返回result_code
if
(
"SUCCESS"
.
equals
(
resultMap
.
get
(
"trade_state"
)))
{
respDto
.
setStatus
(
Integer
.
valueOf
(
DragonConstant
.
PayStatusEnum
.
STATUS_PAID
.
getCode
()));
}
return
respDto
;
}
...
...
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