记得上下班打卡 | 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
9276c7f8
Commit
9276c7f8
authored
Jul 19, 2021
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支付通知逻辑
parent
c925b957
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
18 deletions
+23
-18
AbstractPayChannelStrategyImpl.java
...channel/strategy/impl/AbstractPayChannelStrategyImpl.java
+4
-4
PayChannelStrategyAlipayImpl.java
...n/channel/strategy/impl/PayChannelStrategyAlipayImpl.java
+11
-8
PayChannelStrategyWepayImpl.java
...on/channel/strategy/impl/PayChannelStrategyWepayImpl.java
+7
-4
DragonOrdersServiceImpl.java
.../service/dragon/service/impl/DragonOrdersServiceImpl.java
+1
-2
No files found.
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/strategy/impl/AbstractPayChannelStrategyImpl.java
View file @
9276c7f8
...
@@ -49,7 +49,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
...
@@ -49,7 +49,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
* @param bankReturnMsg
* @param bankReturnMsg
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
protected
void
completeSuccessOrder
(
DragonOrdersDto
dragonOrdersDto
,
String
bankTrxNo
,
LocalDateTime
timeEnd
,
String
bankReturnMsg
)
{
protected
boolean
completeSuccessOrder
(
DragonOrdersDto
dragonOrdersDto
,
String
bankTrxNo
,
LocalDateTime
timeEnd
,
String
bankReturnMsg
)
{
log
.
info
(
"订单支付成功!"
);
log
.
info
(
"订单支付成功!"
);
dragonOrdersDto
.
setPaymentAt
(
timeEnd
);
dragonOrdersDto
.
setPaymentAt
(
timeEnd
);
dragonOrdersDto
.
setPaymentId
(
bankTrxNo
);
// 设置银行流水号
dragonOrdersDto
.
setPaymentId
(
bankTrxNo
);
// 设置银行流水号
...
@@ -59,7 +59,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
...
@@ -59,7 +59,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
//修改订单状态
//修改订单状态
dragonPayBiz
.
updateOrderStatus
(
dragonOrdersDto
.
getCode
(),
dragonOrdersDto
.
getStatus
(),
bankTrxNo
);
dragonPayBiz
.
updateOrderStatus
(
dragonOrdersDto
.
getCode
(),
dragonOrdersDto
.
getStatus
(),
bankTrxNo
);
//通知商户
//通知商户
dragonPayBiz
.
sendNotify
(
dragonPayBiz
.
buildPayNotifyReqBo
(
dragonOrdersDto
));
return
dragonPayBiz
.
sendNotify
(
dragonPayBiz
.
buildPayNotifyReqBo
(
dragonOrdersDto
));
}
}
/**
/**
...
@@ -67,7 +67,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
...
@@ -67,7 +67,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
* @param dragonOrdersDto
* @param dragonOrdersDto
* @param bankReturnMsg
* @param bankReturnMsg
*/
*/
protected
void
completeFailOrder
(
DragonOrdersDto
dragonOrdersDto
,
String
bankReturnMsg
)
{
protected
boolean
completeFailOrder
(
DragonOrdersDto
dragonOrdersDto
,
String
bankReturnMsg
)
{
log
.
info
(
"订单支付失败!"
);
log
.
info
(
"订单支付失败!"
);
// dragonOrdersDto.setPaymentAt(timeEnd);
// dragonOrdersDto.setPaymentAt(timeEnd);
// dragonOrdersDto.setPaymentId(bankTrxNo);// 设置银行流水号
// dragonOrdersDto.setPaymentId(bankTrxNo);// 设置银行流水号
...
@@ -77,7 +77,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
...
@@ -77,7 +77,7 @@ public abstract class AbstractPayChannelStrategyImpl implements IPayChannelStrat
//修改订单状态
//修改订单状态
dragonPayBiz
.
updateOrderStatus
(
dragonOrdersDto
.
getCode
(),
dragonOrdersDto
.
getStatus
(),
null
);
dragonPayBiz
.
updateOrderStatus
(
dragonOrdersDto
.
getCode
(),
dragonOrdersDto
.
getStatus
(),
null
);
//通知商户
//通知商户
dragonPayBiz
.
sendNotify
(
dragonPayBiz
.
buildPayNotifyReqBo
(
dragonOrdersDto
));
return
dragonPayBiz
.
sendNotify
(
dragonPayBiz
.
buildPayNotifyReqBo
(
dragonOrdersDto
));
}
}
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/strategy/impl/PayChannelStrategyAlipayImpl.java
View file @
9276c7f8
...
@@ -88,7 +88,7 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
...
@@ -88,7 +88,7 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
log
.
info
(
"接收到{}支付结果{}"
,
payType
,
notifyMap
);
log
.
info
(
"接收到{}支付结果{}"
,
payType
,
notifyMap
);
String
returnStr
=
null
;
String
returnStr
=
"fail"
;
String
code
=
notifyMap
.
get
(
"out_trade_no"
);
String
code
=
notifyMap
.
get
(
"out_trade_no"
);
//持久化通知记录
//持久化通知记录
...
@@ -112,6 +112,7 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
...
@@ -112,6 +112,7 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
try
{
try
{
if
(
AlipaySignature
.
rsaCheckV1
(
notifyMap
,
merchantPubKey
,
"UTF-8"
,
"RSA2"
)){
if
(
AlipaySignature
.
rsaCheckV1
(
notifyMap
,
merchantPubKey
,
"UTF-8"
,
"RSA2"
)){
String
tradeStatus
=
notifyMap
.
get
(
"trade_status"
);
String
tradeStatus
=
notifyMap
.
get
(
"trade_status"
);
boolean
notifyResult
=
false
;
if
(
AlipayConstant
.
AlipayTradeStateEnum
.
TRADE_SUCCESS
.
name
().
equals
(
tradeStatus
)
if
(
AlipayConstant
.
AlipayTradeStateEnum
.
TRADE_SUCCESS
.
name
().
equals
(
tradeStatus
)
||
AlipayConstant
.
AlipayTradeStateEnum
.
TRADE_FINISHED
.
name
().
equals
(
tradeStatus
))
{
||
AlipayConstant
.
AlipayTradeStateEnum
.
TRADE_FINISHED
.
name
().
equals
(
tradeStatus
))
{
...
@@ -121,18 +122,20 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
...
@@ -121,18 +122,20 @@ public class PayChannelStrategyAlipayImpl extends AbstractPayChannelStrategyImpl
if
(!
StringUtil
.
isEmpty
(
gmtPaymentStr
))
{
if
(!
StringUtil
.
isEmpty
(
gmtPaymentStr
))
{
timeEnd
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
gmtPaymentStr
);
timeEnd
=
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
gmtPaymentStr
);
}
}
this
.
completeSuccessOrder
(
dragonOrdersDto
,
notifyMap
.
get
(
"trade_no"
),
timeEnd
,
notifyMap
.
toString
());
notifyResult
=
this
.
completeSuccessOrder
(
dragonOrdersDto
,
notifyMap
.
get
(
"trade_no"
),
timeEnd
,
notifyMap
.
toString
());
returnStr
=
"success"
;
}
else
{
}
else
{
this
.
completeFailOrder
(
dragonOrdersDto
,
notifyMap
.
toString
());
notifyResult
=
this
.
completeFailOrder
(
dragonOrdersDto
,
notifyMap
.
toString
());
returnStr
=
"fail"
;
}
if
(
notifyResult
){
returnStr
=
"success"
;
}
}
}
else
{
// 验证失败
}
else
{
// 验证失败
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getMessage
());
log
.
error
(
"alipay notify fail code:{} msg:{} "
,
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getMessage
());
return
returnStr
;
}
}
}
catch
(
AlipayApiException
e
)
{
}
catch
(
AlipayApiException
e
)
{
log
.
error
(
"
验签失败:
"
,
e
);
log
.
error
(
"
alipay notify fail 验签失败:e:{}
"
,
e
);
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getMessage
());
log
.
error
(
"alipay notify fail 验签失败:code:{} msg:{}"
,
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ALIPAY_SIGN_ERROR
.
getMessage
());
}
}
log
.
info
(
"返回支付通道{}信息{}"
,
payType
,
returnStr
);
log
.
info
(
"返回支付通道{}信息{}"
,
payType
,
returnStr
);
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/strategy/impl/PayChannelStrategyWepayImpl.java
View file @
9276c7f8
...
@@ -91,6 +91,7 @@ public class PayChannelStrategyWepayImpl extends AbstractPayChannelStrategyImpl
...
@@ -91,6 +91,7 @@ public class PayChannelStrategyWepayImpl extends AbstractPayChannelStrategyImpl
}
}
String
sign
=
notifyMap
.
remove
(
"sign"
);
String
sign
=
notifyMap
.
remove
(
"sign"
);
boolean
notifyResult
=
false
;
if
(
PayWepayUtils
.
getInstance
().
notifySign
(
notifyMap
,
sign
))
{
// 根据配置信息验证签名
if
(
PayWepayUtils
.
getInstance
().
notifySign
(
notifyMap
,
sign
))
{
// 根据配置信息验证签名
if
(
WepayConstant
.
WeixinTradeStateEnum
.
SUCCESS
.
getCode
().
equals
(
notifyMap
.
get
(
"result_code"
)))
{
// 业务结果
if
(
WepayConstant
.
WeixinTradeStateEnum
.
SUCCESS
.
getCode
().
equals
(
notifyMap
.
get
(
"result_code"
)))
{
// 业务结果
// 成功
// 成功
...
@@ -99,13 +100,15 @@ public class PayChannelStrategyWepayImpl extends AbstractPayChannelStrategyImpl
...
@@ -99,13 +100,15 @@ public class PayChannelStrategyWepayImpl extends AbstractPayChannelStrategyImpl
if
(!
StringUtil
.
isEmpty
(
timeEndStr
))
{
if
(!
StringUtil
.
isEmpty
(
timeEndStr
))
{
timeEnd
=
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
.
parse
(
timeEndStr
);
timeEnd
=
DateUtil
.
Formatter
.
yyyyMMddHHmmssTrim
.
parse
(
timeEndStr
);
}
}
this
.
completeSuccessOrder
(
dragonOrdersDto
,
notifyMap
.
get
(
"transaction_id"
),
timeEnd
,
notifyMap
.
toString
());
notifyResult
=
this
.
completeSuccessOrder
(
dragonOrdersDto
,
notifyMap
.
get
(
"transaction_id"
),
timeEnd
,
notifyMap
.
toString
());
returnStr
=
"<xml>\n"
+
" <return_code><![CDATA[SUCCESS]]></return_code>\n"
+
" <return_msg><![CDATA[OK]]></return_msg>\n"
+
"</xml>"
;
}
else
{
}
else
{
this
.
completeFailOrder
(
dragonOrdersDto
,
notifyMap
.
toString
());
notifyResult
=
this
.
completeFailOrder
(
dragonOrdersDto
,
notifyMap
.
toString
());
}
if
(
notifyResult
){
returnStr
=
"<xml>\n"
+
" <return_code><![CDATA[SUCCESS]]></return_code>\n"
+
" <return_msg><![CDATA[OK]]></return_msg>\n"
+
"</xml>"
;
}
}
}
else
{
}
else
{
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_WEPAY_SIGN_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_WEPAY_SIGN_ERROR
.
getMessage
());
log
.
error
(
"wepay notify fail code:{} msg:{} "
,
DragonErrorCodeEnum
.
TRADE_WEPAY_SIGN_ERROR
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_WEPAY_SIGN_ERROR
.
getMessage
());
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrdersServiceImpl.java
View file @
9276c7f8
...
@@ -85,7 +85,6 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
...
@@ -85,7 +85,6 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_ERROR_NOT_EXISTS
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ERROR_NOT_EXISTS
.
getMessage
());
throw
new
LiquidnetServiceException
(
DragonErrorCodeEnum
.
TRADE_ERROR_NOT_EXISTS
.
getCode
(),
DragonErrorCodeEnum
.
TRADE_ERROR_NOT_EXISTS
.
getMessage
());
}
}
//通知商户
//通知商户
dragonPayBiz
.
sendNotify
(
dragonPayBiz
.
buildPayNotifyReqBo
(
ordersDto
));
return
dragonPayBiz
.
sendNotify
(
dragonPayBiz
.
buildPayNotifyReqBo
(
ordersDto
));
return
false
;
}
}
}
}
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