记得上下班打卡 | 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
33fea9bc
Commit
33fea9bc
authored
Feb 18, 2022
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改支付宝 扫码支付
parent
4b6fa270
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
1 deletion
+112
-1
AlipayBiz.java
...iquidnet/service/dragon/channel/alipay/biz/AlipayBiz.java
+49
-1
AlipayTradePayReq.java
.../service/dragon/channel/alipay/req/AlipayTradePayReq.java
+1
-0
AbstractAlipayStrategy.java
.../channel/alipay/strategy/impl/AbstractAlipayStrategy.java
+1
-0
AlipayStrategyMicropayImpl.java
...nnel/alipay/strategy/impl/AlipayStrategyMicropayImpl.java
+61
-0
No files found.
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/alipay/biz/AlipayBiz.java
View file @
33fea9bc
...
...
@@ -33,13 +33,61 @@ import java.util.*;
@Slf4j
@Component
public
class
AlipayBiz
{
/**
* tradeMicroPay
* @param alipayTradePayReq
* @return
*/
public
static
Map
<
String
,
Object
>
tradeMicroPay
(
AlipayTradePayReq
alipayTradePayReq
)
{
log
.
info
(
"AlipayBiz.tradeMicroPay-->> req : {}"
,
alipayTradePayReq
.
toString
());
AlipayClient
alipayClient
=
PayAlipayUtils
.
getInstance
().
getHttpClient
();
SortedMap
<
String
,
Object
>
paramMap
=
new
TreeMap
<>();
paramMap
.
put
(
"out_trade_no"
,
alipayTradePayReq
.
getOutTradeNo
());
paramMap
.
put
(
"total_amount"
,
alipayTradePayReq
.
getTotalAmount
().
toString
());
paramMap
.
put
(
"subject"
,
alipayTradePayReq
.
getSubject
());
paramMap
.
put
(
"scene"
,
"bar_code"
);
paramMap
.
put
(
"auth_code"
,
alipayTradePayReq
.
getAuthCode
());
AlipayTradeWapPayRequest
request
=
new
AlipayTradeWapPayRequest
();
log
.
info
(
"bizContent :{}"
,
JsonUtils
.
toJson
(
paramMap
));
request
.
setBizContent
(
JsonUtils
.
toJson
(
paramMap
));
try
{
long
startTime
=
System
.
currentTimeMillis
();
AlipayTradeWapPayResponse
response
=
alipayClient
.
sdkExecute
(
request
);
log
.
info
(
"alipay-alipayClient.sdkExecut->耗时:{}"
,(
System
.
currentTimeMillis
()
-
startTime
)+
"毫秒"
);
startTime
=
System
.
currentTimeMillis
();
Map
<
String
,
Object
>
responseJSON
=
ObjectUtil
.
cloneHashMapStringAndObj
();
log
.
info
(
"AlipayUtil-->tradeMicroPay-->cloneHashMapStringAndObj 耗时:{}"
,(
System
.
currentTimeMillis
()
-
startTime
)+
"毫秒"
);
responseJSON
.
put
(
"code"
,
response
.
getCode
());
responseJSON
.
put
(
"msg"
,
response
.
getMsg
());
responseJSON
.
put
(
"subCode"
,
response
.
getSubCode
());
responseJSON
.
put
(
"subMsg"
,
response
.
getSubMsg
());
responseJSON
.
put
(
"body"
,
response
.
getBody
());
responseJSON
.
put
(
"merchantOrderNo"
,
response
.
getMerchantOrderNo
());
responseJSON
.
put
(
"outTradeNo"
,
response
.
getOutTradeNo
());
responseJSON
.
put
(
"sellerId"
,
response
.
getSellerId
());
responseJSON
.
put
(
"totalAmount"
,
response
.
getTotalAmount
());
responseJSON
.
put
(
"tradeNo"
,
response
.
getTradeNo
());
startTime
=
System
.
currentTimeMillis
();
log
.
info
(
"AlipayUtil-->tradeMicroPay-->支付宝返回结果:{}"
,
JsonUtils
.
toJson
(
response
));
log
.
info
(
"AlipayUtil-->tradeMicroPay-->支付宝返回结果 耗时:{}"
,(
System
.
currentTimeMillis
()
-
startTime
)+
"毫秒"
);
return
responseJSON
;
}
catch
(
Exception
e
)
{
log
.
error
(
"支付宝支付异常:{}"
,
e
);
JSONObject
resultJSON
=
ObjectUtil
.
cloneJsonObjectObj
();
resultJSON
.
put
(
"outTradeNo"
,
alipayTradePayReq
.
getOutTradeNo
());
resultJSON
.
put
(
"totalAmount"
,
alipayTradePayReq
.
getTotalAmount
().
toString
());
resultJSON
.
put
(
"errorCode"
,
"9999"
);
return
resultJSON
;
}
}
/**
* tradeWapPay
* @param alipayTradePayReq
* @return
*/
public
static
Map
<
String
,
Object
>
tradeWapPay
(
AlipayTradePayReq
alipayTradePayReq
)
{
log
.
info
(
"AlipayBiz.tradeWapPay-->> req : {}"
,
alipayTradePayReq
.
toString
());
log
.
info
(
"AlipayBiz.tradeWapPay
tradeWapPay
-->> req : {}"
,
alipayTradePayReq
.
toString
());
String
timeExpress
=
"5m"
;
// 支付超时,线下扫码交易定义为5分钟
AlipayClient
alipayClient
=
PayAlipayUtils
.
getInstance
().
getHttpClient
();
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/alipay/req/AlipayTradePayReq.java
View file @
33fea9bc
...
...
@@ -26,6 +26,7 @@ public class AlipayTradePayReq implements Serializable, Cloneable{
private
String
timeExpire
;
private
String
notifyUrl
;
private
String
timestamp
;
private
String
authCode
;
@Override
public
String
toString
(){
return
JSON
.
toJSONString
(
this
);
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/alipay/strategy/impl/AbstractAlipayStrategy.java
View file @
33fea9bc
...
...
@@ -51,6 +51,7 @@ public abstract class AbstractAlipayStrategy implements IAlipayStrategy {
alipayTradePayReq
.
setTimeExpire
(
timeExpire
);
alipayTradePayReq
.
setNotifyUrl
(
this
.
getNotifyUrl
());
alipayTradePayReq
.
setTimestamp
(
dragonPayBaseReqDto
.
getCreateDate
());
alipayTradePayReq
.
setAuthCode
(
dragonPayBaseReqDto
.
getAuthCode
());
//调用支付
long
startTime
=
System
.
currentTimeMillis
();
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/channel/alipay/strategy/impl/AlipayStrategyMicropayImpl.java
0 → 100644
View file @
33fea9bc
package
com
.
liquidnet
.
service
.
dragon
.
channel
.
alipay
.
strategy
.
impl
;
import
com.liquidnet.service.dragon.channel.alipay.biz.AlipayBiz
;
import
com.liquidnet.service.dragon.channel.alipay.req.AlipayTradePayReq
;
import
com.liquidnet.service.dragon.channel.alipay.strategy.annotation.StrategyAlipayHandler
;
import
com.liquidnet.service.dragon.constant.DragonConstant
;
import
com.liquidnet.service.dragon.dto.DragonPayBaseRespDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.Map
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: AlipayStrategyWapImpl
* @Package com.liquidnet.service.dragon.channel.alipay.strategy.impl
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/10 14:34
*/
@Slf4j
@Service
@StrategyAlipayHandler
(
DragonConstant
.
DeviceFromEnum
.
MICROPAY
)
public
class
AlipayStrategyMicropayImpl
extends
AbstractAlipayStrategy
{
@Value
(
"${liquidnet.dragon.alipay.gataway-url}"
)
private
String
alipayGatewayUrl
;
@Value
(
"${liquidnet.dragon.url}"
)
private
String
notifyUrl
;
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Autowired
private
AlipayBiz
alipayBiz
;
@Override
protected
Map
<
String
,
Object
>
executePay
(
AlipayTradePayReq
alipayTradePayReq
)
{
return
alipayBiz
.
tradeMicroPay
(
alipayTradePayReq
);
}
protected
void
setProductCode
()
{
this
.
productCode
=
"QUICK_WAP_PAY"
;
}
@Override
protected
String
getNotifyUrl
()
{
// notifyUrl = "/notify/wap/alipay/1";
return
notifyUrl
+
"/notify/alipay/wap"
;
}
@Override
DragonPayBaseRespDto
buildResponseDto
(
DragonPayBaseRespDto
payBaseRespDto
,
Map
<
String
,
Object
>
respResult
)
{
payBaseRespDto
.
getPayData
().
setRedirectUrl
(
alipayGatewayUrl
+
"?"
+
respResult
.
get
(
"body"
));
return
payBaseRespDto
;
}
}
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