Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
V
volunteer_service
Project
Project
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
licc
volunteer_service
Commits
4f7b043b
Commit
4f7b043b
authored
Feb 01, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传支付宝接口
parent
b2fcf2c7
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
402 additions
and
7 deletions
+402
-7
PayPageDto.java
...odel/src/main/java/cn/wisenergy/model/dto/PayPageDto.java
+21
-0
PayQueryDto.java
...del/src/main/java/cn/wisenergy/model/dto/PayQueryDto.java
+22
-0
pom.xml
wisenergy-service/pom.xml
+8
-7
AliPay.java
...ice/src/main/java/cn/wisenergy/service/alipay/AliPay.java
+141
-0
Common.java
...ice/src/main/java/cn/wisenergy/service/common/Common.java
+30
-0
PayController.java
.../cn/wisenergy/web/admin/controller/app/PayController.java
+180
-0
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/dto/PayPageDto.java
0 → 100644
View file @
4f7b043b
package
cn
.
wisenergy
.
model
.
dto
;
/**
* @ Description: 支付页面接口请求参数Dto
* @ Author : 86187
* @ Date : 2021/2/1 13:57
*/
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
/**
* @author 86187
*/
@Data
@ApiModel
(
"PayPageDto"
)
public
class
PayPageDto
{
/**
* 支付金额 :金额不能为0
*/
private
String
price
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/PayQueryDto.java
0 → 100644
View file @
4f7b043b
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
/**
* @author 86187
*/
@Data
@ApiModel
()
public
class
PayQueryDto
{
/**
* 支付宝交易号
*/
private
String
tradeNo
;
/**
* 商户订单号
*/
private
String
outTradeNo
;
}
wisenergy-service/pom.xml
View file @
4f7b043b
...
...
@@ -15,12 +15,6 @@
<!-- 项目依赖 -->
<dependencies>
<!-- 模块依赖 -->
<!--<dependency>-->
<!--<groupId>cn.wisenergy</groupId>-->
<!--<artifactId>wisenergy-model</artifactId>-->
<!--<version>${moduleVersion.wisenergy-model}</version>-->
<!--</dependency>-->
<dependency>
<groupId>
cn.wisenergy
</groupId>
<artifactId>
wisenergy-mapper
</artifactId>
...
...
@@ -46,6 +40,13 @@
<version>
4.5.3
</version>
</dependency>
<!--阿里支付 https://mvnrepository.com/artifact/com.alipay.sdk/alipay-easysdk -->
<dependency>
<groupId>
com.alipay.sdk
</groupId>
<artifactId>
alipay-sdk-java
</artifactId>
<version>
4.11.33.ALL
</version>
</dependency>
</dependencies>
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/alipay/AliPay.java
0 → 100644
View file @
4f7b043b
package
cn
.
wisenergy
.
service
.
alipay
;
import
cn.wisenergy.service.common.Common
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.request.AlipayTradePagePayRequest
;
import
com.alipay.api.response.AlipayTradePagePayResponse
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @author 86187
*/
public
class
AliPay
{
private
static
final
String
CHARSET
=
"UTF-8"
;
public
static
void
main
(
String
[]
args
)
throws
AlipayApiException
,
IOException
{
HttpServletRequest
request
=
null
;
HttpServletResponse
httpResponse
=
null
;
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
"https://openapi.alipay.com/gateway.do"
,
Common
.
APP_ID
,
Common
.
PRIVATE_KEY
,
"json"
,
"GBK"
,
Common
.
ALIPAY_PUBLIC_KEY
,
"RSA2"
);
AlipayTradePagePayRequest
alipayRequest
=
new
AlipayTradePagePayRequest
();
//创建API对应的request
alipayRequest
.
setReturnUrl
(
"http://domain.com/CallBack/return_url.jsp"
);
//在公共参数中设置回跳和通知地址
alipayRequest
.
setNotifyUrl
(
"http://domain.com/CallBack/notify_url.jsp"
);
alipayRequest
.
setBizContent
(
"{"
+
"\"out_trade_no\":\"20210320010101001\","
+
"\"product_code\":\"FAST_INSTANT_TRADE_PAY\","
+
"\"total_amount\":0.01,"
+
"\"subject\":\"充值\","
+
"\"body\":\"充值\","
+
"\"time_expire\":\"2021-01-30 10:05:01\","
+
" \"goods_detail\":[{"
+
" \"goods_id\":\"apple-01\","
+
"\"alipay_goods_id\":\"20010001\","
+
"\"goods_name\":\"ipad\","
+
"\"quantity\":1,"
+
"\"price\":2000,"
+
"\"goods_category\":\"34543238\","
+
"\"categories_tree\":\"124868003|126232002|126252004\","
+
"\"body\":\"特价手机\","
+
"\"show_url\":\"http://www.alipay.com/xxx.jpg\""
+
" }],"
+
"\"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\","
+
"\"extend_params\":{"
+
"\"sys_service_provider_id\":\"2088511833207846\","
+
"\"hb_fq_num\":\"3\","
+
"\"hb_fq_seller_percent\":\"100\","
+
"\"industry_reflux_info\":\"{\\\\\\\"scene_code\\\\\\\":\\\\\\\"metro_tradeorder\\\\\\\",\\\\\\\"channel\\\\\\\":\\\\\\\"xxxx\\\\\\\",\\\\\\\"scene_data\\\\\\\":{\\\\\\\"asset_name\\\\\\\":\\\\\\\"ALIPAY\\\\\\\"}}\","
+
"\"card_type\":\"S0JP0000\""
+
" },"
+
"\"goods_type\":\"0\","
+
"\"timeout_express\":\"90m\","
+
"\"promo_params\":\"{\\\"storeIdType\\\":\\\"1\\\"}\","
+
"\"royalty_info\":{"
+
"\"royalty_type\":\"ROYALTY\","
+
" \"royalty_detail_infos\":[{"
+
" \"serial_no\":1,"
+
"\"trans_in_type\":\"userId\","
+
"\"batch_no\":\"123\","
+
"\"out_relation_id\":\"20131124001\","
+
"\"trans_out_type\":\"userId\","
+
"\"trans_out\":\"2088101126765726\","
+
"\"trans_in\":\"2088101126708402\","
+
"\"amount\":0.1,"
+
"\"desc\":\"分账测试1\","
+
"\"amount_percentage\":\"100\""
+
" }]"
+
" },"
+
"\"sub_merchant\":{"
+
"\"merchant_id\":\"2088000603999128\","
+
"\"merchant_type\":\"alipay: 支付宝分配的间连商户编号, merchant: 商户端的间连商户编号\""
+
" },"
+
"\"merchant_order_no\":\"20161008001\","
+
"\"enable_pay_channels\":\"pcredit,moneyFund,debitCardExpress\","
+
"\"store_id\":\"NJ_001\","
+
"\"disable_pay_channels\":\"pcredit,moneyFund,debitCardExpress\","
+
"\"qr_pay_mode\":\"1\","
+
"\"qrcode_width\":100,"
+
"\"settle_info\":{"
+
" \"settle_detail_infos\":[{"
+
" \"trans_in_type\":\"cardAliasNo\","
+
"\"trans_in\":\"A0001\","
+
"\"summary_dimension\":\"A0001\","
+
"\"settle_entity_id\":\"2088xxxxx;ST_0001\","
+
"\"settle_entity_type\":\"SecondMerchant、Store\","
+
"\"amount\":0.1"
+
" }],"
+
"\"settle_period_time\":\"7d\""
+
" },"
+
"\"invoice_info\":{"
+
"\"key_info\":{"
+
"\"is_support_invoice\":true,"
+
"\"invoice_merchant_name\":\"ABC|003\","
+
"\"tax_num\":\"1464888883494\""
+
" },"
+
"\"details\":\"[{\\\"code\\\":\\\"100294400\\\",\\\"name\\\":\\\"服饰\\\",\\\"num\\\":\\\"2\\\",\\\"sumPrice\\\":\\\"200.00\\\",\\\"taxRate\\\":\\\"6%\\\"}]\""
+
" },"
+
"\"agreement_sign_params\":{"
+
"\"personal_product_code\":\"GENERAL_WITHHOLDING_P\","
+
"\"sign_scene\":\"INDUSTRY|CARRENTAL\","
+
"\"external_agreement_no\":\"test\","
+
"\"external_logon_id\":\"13852852877\","
+
"\"sign_validity_period\":\"2m\","
+
"\"third_party_type\":\"PARTNER\","
+
"\"buckle_app_id\":\"1001164\","
+
"\"buckle_merchant_id\":\"268820000000414397785\","
+
"\"promo_params\":\"{\\\"key\\\",\\\"value\\\"}\""
+
" },"
+
"\"integration_type\":\"PCWEB\","
+
"\"request_from_url\":\"https://\","
+
"\"business_params\":\"{\\\"data\\\":\\\"123\\\"}\","
+
"\"ext_user_info\":{"
+
"\"name\":\"李明\","
+
"\"mobile\":\"16587658765\","
+
"\"cert_type\":\"IDENTITY_CARD\","
+
"\"cert_no\":\"362334768769238881\","
+
"\"min_age\":\"18\","
+
"\"fix_buyer\":\"F\","
+
"\"need_check_info\":\"F\""
+
" }"
+
" }"
);
String
form
=
""
;
AlipayTradePagePayResponse
response
=
alipayClient
.
pageExecute
(
alipayRequest
);
System
.
out
.
println
(
response
.
getBody
());
if
(
response
.
isSuccess
()){
System
.
out
.
println
(
"调用成功"
);
}
else
{
System
.
out
.
println
(
"调用失败"
);
}
httpResponse
.
setContentType
(
"text/html;charset="
+
CHARSET
);
//直接将完整的表单html输出到页面
httpResponse
.
getWriter
().
write
(
form
);
httpResponse
.
getWriter
().
flush
();
httpResponse
.
getWriter
().
close
();
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/common/Common.java
View file @
4f7b043b
...
...
@@ -24,6 +24,36 @@ public class Common {
*/
public
static
final
String
SMS_SECRET
=
"AvotjHvvGzEm8sX9vZaUhVypnZfUk7"
;
/**
* 阿里云短信超时时间
*/
public
static
final
long
SMS_TIMEOUT
=
300
;
/**
* 支付宝支付app_id
*/
public
static
final
String
APP_ID
=
"2021002126609937"
;
public
static
final
String
ALIPAY_PUBLIC_KEY
=
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk3F1VulieP0smmNEyEHLWS0l"
+
"wKOlaLA3xMkfbNK4Hn1D6MtLvU58IBboh0JkZbcBPCVEK9Ma6VT3Q0wofYwy2dosHskTNIuBi4N8EuHvss7f1/x/rb7nI7QbuSlualx5MlD"
+
"3cLIRm84QqEMeF1ndVAIDA3mA24BdxIuCmS7THHn46wZ9/KaudNq84XxRmy+JHAnQxj5+8pvCAdpA12hP7gTfj0ySRZDVvA3gks8yjlf4SGK"
+
"TqNDhM3AewWlwygEHUJPlL04JUm/lG3Q9viaqZv4SGv/MeUw0qXqpPuq9JzJUCmZjYq1gKXsqP3FMg8zBrLiZCjpoLa2ra7f6PbdtIwIDAQAB"
;
public
static
final
String
PRIVATE_KEY
=
"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCTcXVW6WJ4/"
+
"SyaY0TIQctZLSXAo6VosDfEyR9s0rgefUPoy0u9TnwgFuiHQmRltwE8JUQr0xrpVPdDTCh9jDLZ2iweyRM0i4GLg3wS4e+yzt/"
+
"X/H+tvucjtBu5KW5qXHkyUPdwshGbzhCoQx4XWd1UAgMDeYDbgF3Ei4KZLtMcefjrBn38pq502rzhfFGbL4kcCdDGPn7ym8IB2kDXaE/"
+
"uBN+PTJJFkNW8DeCSzzKOV/hIYpOo0OEzcB7BaXDKAQdQk+UvTglSb+UbdD2+Jqpm/hIa/8x5TDSpeqk+6r0nMlQKZmNirWApeyo/"
+
"cUyDzMGsuJkKOmgtratrt/o9t20jAgMBAAECggEAHTjmdbRJ1QrwlSTJlBseL214RwboGKicVP87oDjfTwOquu/"
+
"X8gwlI8MGkRBCj7pGn2IPcdQkSEyTuR3WBJQN3AmWpv9ZNBfWNA16QM/QzxKbYNZlg80LSJNAz2D7xk7Pon5TnF1eig+8U20CAMTJzgWcDUs"
+
"+k8KMUxEHcE7Mfp8KkG0sRPwZa9DqfuC4WOQuik9L6OphhVDrxnCGBKTW/KC1k2HfU25dMUDoirqY7fMbASJBkT14JO6o/"
+
"I0BBJU++ddfYpXTd2X6Lywy4PqJdstllHxzLxSJqPKgjk9Qd/iVozuHDDSuBvEp1a1DBOsjFHz0TGxmCoP2mrEN4e6WsQKBgQD6GnTuVUcI4"
+
"UxaeHrj6sSiWTsBOXsXYrrmk380RTUEwzPdExFfvV4wkf48BQsUqCl6R+CdWSbcbRriXTJ6hlZ37IPuqmJ4me++LlDE9MrfRg1m0qkOFyVC"
+
"1ysAw+0i0EPjj5eeXguvoZ6RarDPI9hWM6m2dAGclkwFq2FBN3yzGQKBgQCW62DEh6eTmnyzBiQcojyEhY44Vp3y6RebXqlS/O1kpEn1sT1"
+
"U6xBwE2na1udDv9PFzA6SapDw9ZRJWxbxgL07tG3A6V9p6MdjeCh/IR1OqO9STH8xag+YNwS28rSf+IEuM7bRUl6ESp9EXIt/jxh3syjYl"
+
"j9ecdXypJNWFeOFmwKBgQCR4PCnO1JtmYwBkRiM7Bi5YTaLZk2nvEyrxQiDIoLkPj94CXEu2LOhvOX/eCmYaOWYj2gyHxgNpg3yTs3srYKt/"
+
"GSPxw4crh0qXrV5zBaw2JlkiidVMqbnL73DeoRMtBGFH/Idy1khnjFxPDvY9l1vGj85TrzJ6th4zheyBH1VsQKBgDSXdbNG6pi/PzFLtI3d"
+
"42Ty/aqYVJZvr/BOvobS6Q8nSTa7Ovo6qBHGUh8WwKSVVoEZKQLQ7A1sJu6hNY+XI1qI965AJSXNHp6FIueabJIawLtXOQPJSAHtOlFepp8"
+
"QhEPLdavgHlvPfUzfSyV6gjZEUrmXMiIBXWMfAtD+87h9AoGANzOybVuH7XaPJfGFuKAMLSdsDUFFEAVkC37XF6nl5k1bC1LmHM2iJltmSh"
+
"N2nwJavbtbvycOFhLxRNNkhBDj3oZ8F/93vzyn1M/s0/y7ONUtBIqLdLAT9Q84xxVBFdOvVdja20J1NuQ8yYD4qInO/WcX2MOLXeCaGfMOg1XWaa0="
;
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/PayController.java
0 → 100644
View file @
4f7b043b
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.R
;
import
cn.wisenergy.model.dto.PayPageDto
;
import
cn.wisenergy.model.dto.PayQueryDto
;
import
cn.wisenergy.service.common.Common
;
import
com.alipay.api.AlipayApiException
;
import
com.alipay.api.AlipayClient
;
import
com.alipay.api.DefaultAlipayClient
;
import
com.alipay.api.request.AlipayTradePagePayRequest
;
import
com.alipay.api.request.AlipayTradeQueryRequest
;
import
com.alipay.api.response.AlipayTradePagePayResponse
;
import
com.alipay.api.response.AlipayTradeQueryResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* @author 86187
* @ Description:
* @ Author : 86187
* @ Date : 2021/2/1 10:05
*/
@RestController
@Api
(
tags
=
"PC-支付接口"
)
@RequestMapping
(
"/pay"
)
@Slf4j
public
class
PayController
{
private
static
final
String
CHARSET
=
"UTF-8"
;
@ApiOperation
(
value
=
"PC支付宝-支付接口"
,
notes
=
"PC支付宝-支付接口"
,
httpMethod
=
"POST"
)
@ApiImplicitParam
(
name
=
"payPageDto"
,
value
=
"参数"
,
dataType
=
"PayPageDto"
)
@PostMapping
(
"/page"
)
public
R
<
String
>
doPost
(
@RequestBody
PayPageDto
payPageDto
,
HttpServletRequest
request
,
HttpServletResponse
httpResponse
)
throws
IOException
,
AlipayApiException
{
if
(
null
==
payPageDto
||
StringUtils
.
isBlank
(
payPageDto
.
getPrice
()))
{
return
R
.
error
(
"人参不能为空!"
);
}
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
"https://openapi.alipay.com/gateway.do"
,
Common
.
APP_ID
,
Common
.
PRIVATE_KEY
,
"json"
,
"GBK"
,
Common
.
ALIPAY_PUBLIC_KEY
,
"RSA2"
);
AlipayTradePagePayRequest
alipayRequest
=
new
AlipayTradePagePayRequest
();
//创建API对应的request
alipayRequest
.
setReturnUrl
(
"http://domain.com/CallBack/return_url.jsp"
);
//在公共参数中设置回跳和通知地址
alipayRequest
.
setNotifyUrl
(
"http://domain.com/CallBack/notify_url.jsp"
);
alipayRequest
.
setBizContent
(
"{"
+
"\"out_trade_no\":\"20210320010101001\","
+
"\"product_code\":\"FAST_INSTANT_TRADE_PAY\","
+
"\"total_amount\":"
+
payPageDto
.
getPrice
()
+
","
+
"\"subject\":\"充值\","
+
"\"body\":\"充值\","
+
"\"time_expire\":\"2021-01-30 10:05:01\","
+
" \"goods_detail\":[{"
+
" \"goods_id\":\"apple-01\","
+
"\"alipay_goods_id\":\"20010001\","
+
"\"goods_name\":\"ipad\","
+
"\"quantity\":1,"
+
"\"price\":2000,"
+
"\"goods_category\":\"34543238\","
+
"\"categories_tree\":\"124868003|126232002|126252004\","
+
"\"body\":\"特价手机\","
+
"\"show_url\":\"http://www.alipay.com/xxx.jpg\""
+
" }],"
+
"\"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\","
+
"\"extend_params\":{"
+
"\"sys_service_provider_id\":\"2088511833207846\","
+
"\"hb_fq_num\":\"3\","
+
"\"hb_fq_seller_percent\":\"100\","
+
"\"industry_reflux_info\":\"{\\\\\\\"scene_code\\\\\\\":\\\\\\\"metro_tradeorder\\\\\\\",\\\\\\\"channel\\\\\\\":\\\\\\\"xxxx\\\\\\\",\\\\\\\"scene_data\\\\\\\":{\\\\\\\"asset_name\\\\\\\":\\\\\\\"ALIPAY\\\\\\\"}}\","
+
"\"card_type\":\"S0JP0000\""
+
" },"
+
"\"goods_type\":\"0\","
+
"\"timeout_express\":\"90m\","
+
"\"promo_params\":\"{\\\"storeIdType\\\":\\\"1\\\"}\","
+
"\"royalty_info\":{"
+
"\"royalty_type\":\"ROYALTY\","
+
" \"royalty_detail_infos\":[{"
+
" \"serial_no\":1,"
+
"\"trans_in_type\":\"userId\","
+
"\"batch_no\":\"123\","
+
"\"out_relation_id\":\"20131124001\","
+
"\"trans_out_type\":\"userId\","
+
"\"trans_out\":\"2088101126765726\","
+
"\"trans_in\":\"2088101126708402\","
+
"\"amount\":0.1,"
+
"\"desc\":\"分账测试1\","
+
"\"amount_percentage\":\"100\""
+
" }]"
+
" },"
+
"\"sub_merchant\":{"
+
"\"merchant_id\":\"2088000603999128\","
+
"\"merchant_type\":\"alipay: 支付宝分配的间连商户编号, merchant: 商户端的间连商户编号\""
+
" },"
+
"\"merchant_order_no\":\"20161008001\","
+
"\"enable_pay_channels\":\"pcredit,moneyFund,debitCardExpress\","
+
"\"store_id\":\"NJ_001\","
+
"\"disable_pay_channels\":\"pcredit,moneyFund,debitCardExpress\","
+
"\"qr_pay_mode\":\"1\","
+
"\"qrcode_width\":100,"
+
"\"settle_info\":{"
+
" \"settle_detail_infos\":[{"
+
" \"trans_in_type\":\"cardAliasNo\","
+
"\"trans_in\":\"A0001\","
+
"\"summary_dimension\":\"A0001\","
+
"\"settle_entity_id\":\"2088xxxxx;ST_0001\","
+
"\"settle_entity_type\":\"SecondMerchant、Store\","
+
"\"amount\":0.1"
+
" }],"
+
"\"settle_period_time\":\"7d\""
+
" },"
+
"\"invoice_info\":{"
+
"\"key_info\":{"
+
"\"is_support_invoice\":true,"
+
"\"invoice_merchant_name\":\"ABC|003\","
+
"\"tax_num\":\"1464888883494\""
+
" },"
+
"\"details\":\"[{\\\"code\\\":\\\"100294400\\\",\\\"name\\\":\\\"服饰\\\",\\\"num\\\":\\\"2\\\",\\\"sumPrice\\\":\\\"200.00\\\",\\\"taxRate\\\":\\\"6%\\\"}]\""
+
" },"
+
"\"agreement_sign_params\":{"
+
"\"personal_product_code\":\"GENERAL_WITHHOLDING_P\","
+
"\"sign_scene\":\"INDUSTRY|CARRENTAL\","
+
"\"external_agreement_no\":\"test\","
+
"\"external_logon_id\":\"13852852877\","
+
"\"sign_validity_period\":\"2m\","
+
"\"third_party_type\":\"PARTNER\","
+
"\"buckle_app_id\":\"1001164\","
+
"\"buckle_merchant_id\":\"268820000000414397785\","
+
"\"promo_params\":\"{\\\"key\\\",\\\"value\\\"}\""
+
" },"
+
"\"integration_type\":\"PCWEB\","
+
"\"request_from_url\":\"https://\","
+
"\"business_params\":\"{\\\"data\\\":\\\"123\\\"}\","
+
"\"ext_user_info\":{"
+
"\"name\":\"李明\","
+
"\"mobile\":\"16587658765\","
+
"\"cert_type\":\"IDENTITY_CARD\","
+
"\"cert_no\":\"362334768769238881\","
+
"\"min_age\":\"18\","
+
"\"fix_buyer\":\"F\","
+
"\"need_check_info\":\"F\""
+
" }"
+
" }"
);
String
form
=
""
;
//调用SDK生成表单
form
=
alipayClient
.
pageExecute
(
alipayRequest
).
getBody
();
httpResponse
.
setContentType
(
"text/html;charset="
+
CHARSET
);
//直接将完整的表单html输出到页面
httpResponse
.
getWriter
().
write
(
form
);
httpResponse
.
getWriter
().
flush
();
httpResponse
.
getWriter
().
close
();
return
R
.
ok
();
}
@ApiOperation
(
value
=
"PC支付宝-交易查询"
,
notes
=
"PC支付宝-交易查询"
,
httpMethod
=
"POST"
)
@ApiImplicitParam
(
name
=
"payQueryDto"
,
value
=
"查询参数"
,
dataType
=
"PayQueryDto"
)
@PostMapping
(
"/query"
)
public
R
<
String
>
query
(
@RequestBody
PayQueryDto
payQueryDto
)
throws
AlipayApiException
{
AlipayClient
alipayClient
=
new
DefaultAlipayClient
(
"https://openapi.alipay.com/gateway.do"
,
Common
.
APP_ID
,
Common
.
PRIVATE_KEY
,
"json"
,
"GBK"
,
Common
.
ALIPAY_PUBLIC_KEY
,
"RSA2"
);
AlipayTradeQueryRequest
request
=
new
AlipayTradeQueryRequest
();
request
.
setBizContent
(
"{"
+
" \"out_trade_no\":\""
+
payQueryDto
.
getOutTradeNo
()
+
"\","
+
" \"trade_no\":\""
+
payQueryDto
.
getTradeNo
()
+
"\""
+
" }"
);
AlipayTradeQueryResponse
response
=
alipayClient
.
execute
(
request
);
System
.
out
.
println
(
response
.
getBody
());
return
R
.
ok
(
response
.
getBody
());
}
}
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