fix[订单模块]:支付订单配置参数获取方式优化
This commit is contained in:
+18
@@ -31,6 +31,12 @@ public class TencentPayConfiguration {
|
||||
|
||||
private String privateKeyPath;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String appSecret;
|
||||
|
||||
private String notifyUrl;
|
||||
|
||||
/**
|
||||
* jsapi支付方式 支持小程序公众号支付
|
||||
* @return
|
||||
@@ -58,4 +64,16 @@ public class TencentPayConfiguration {
|
||||
.apiV3Key(apiV3Key)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TencentPayProperties initTencentPayProperties() {
|
||||
TencentPayProperties tencentPayProperties = new TencentPayProperties();
|
||||
tencentPayProperties.setApiV3Key(apiV3Key);
|
||||
tencentPayProperties.setMerchantId(merchantId);
|
||||
tencentPayProperties.setMerchantSerialNumber(merchantSerialNumber);
|
||||
tencentPayProperties.setAppId(appId);
|
||||
tencentPayProperties.setAppSecret(appSecret);
|
||||
tencentPayProperties.setNotifyUrl(notifyUrl);
|
||||
return tencentPayProperties;
|
||||
}
|
||||
}
|
||||
|
||||
+25
-26
@@ -1,26 +1,25 @@
|
||||
//package com.central.order.config;
|
||||
//
|
||||
//
|
||||
//import lombok.Getter;
|
||||
//import lombok.Setter;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//
|
||||
//@Getter
|
||||
//@Setter
|
||||
//@ConfigurationProperties(prefix = "tencent")
|
||||
//public class TencentPayProperties {
|
||||
//
|
||||
// private String merchantId;
|
||||
//
|
||||
// private String merchantSerialNumber;
|
||||
//
|
||||
// private String apiV3Key;
|
||||
//
|
||||
// private String privateKeyPath;
|
||||
//
|
||||
// private String appId;
|
||||
//
|
||||
// private String appSecret;
|
||||
//
|
||||
// private String notifyUrl;
|
||||
//}
|
||||
package com.central.order.config;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class TencentPayProperties {
|
||||
|
||||
private String merchantId;
|
||||
|
||||
private String merchantSerialNumber;
|
||||
|
||||
private String apiV3Key;
|
||||
|
||||
private String privateKeyPath;
|
||||
|
||||
private String appId;
|
||||
|
||||
private String appSecret;
|
||||
|
||||
private String notifyUrl;
|
||||
|
||||
}
|
||||
|
||||
+16
-11
@@ -5,6 +5,7 @@ import com.central.common.model.LoginAppUser;
|
||||
import com.central.common.model.PageResult;
|
||||
import com.central.common.model.Result;
|
||||
import com.central.common.model.SysUser;
|
||||
import com.central.order.config.TencentPayProperties;
|
||||
import com.central.order.enums.OrderStatus;
|
||||
import com.central.order.feign.FileCenterService;
|
||||
import com.central.order.feign.UserCenterService;
|
||||
@@ -68,14 +69,17 @@ public class OrderController {
|
||||
@Autowired
|
||||
private IQrCodeService qrCodeService;
|
||||
|
||||
// @Value("tencent.appid")
|
||||
private String appId = "wx30a3c8de94a85584" ;
|
||||
@Autowired
|
||||
private TencentPayProperties tencentPayProperties;
|
||||
|
||||
// @Value("tencent.merchantId")
|
||||
private String mchid = "1703796518";
|
||||
|
||||
// @Value("tencent.notifyUrl")
|
||||
private String notifyUrl = "http://img.goflytec.com/api-order/wechat/pay/notify" ;
|
||||
//// @Value("tencent.appid")
|
||||
// private String appId = "wx30a3c8de94a85584" ;
|
||||
//
|
||||
//// @Value("tencent.merchantId")
|
||||
// private String mchid = "1703796518";
|
||||
//
|
||||
//// @Value("tencent.notifyUrl")
|
||||
// private String notifyUrl = "http://img.goflytec.com/api-order/wechat/pay/notify" ;
|
||||
|
||||
|
||||
/**
|
||||
@@ -183,7 +187,7 @@ public class OrderController {
|
||||
|
||||
|
||||
/**
|
||||
* 公众号支付
|
||||
* 公众号小程序支付
|
||||
*
|
||||
* @param orderId 微信公众号对应微信付款用户的唯一标识
|
||||
* @return 返回jsapi所需参数
|
||||
@@ -202,10 +206,10 @@ public class OrderController {
|
||||
Amount amount = new Amount();
|
||||
amount.setTotal(Integer.parseInt(order.getOrderAmount()));
|
||||
request.setAmount(amount);
|
||||
request.setAppid(appId);
|
||||
request.setMchid(mchid);
|
||||
request.setAppid(tencentPayProperties.getAppId());
|
||||
request.setMchid(tencentPayProperties.getMerchantId());
|
||||
request.setDescription(order.getOrderNo());
|
||||
request.setNotifyUrl(notifyUrl);
|
||||
request.setNotifyUrl(tencentPayProperties.getNotifyUrl());
|
||||
request.setOutTradeNo(order.getOrderNo());
|
||||
Payer payer = new Payer();
|
||||
payer.setOpenid(user.getOpenId());
|
||||
@@ -221,6 +225,7 @@ public class OrderController {
|
||||
@GetMapping("/queue/info")
|
||||
public Result<Map> getQueueInfo() {
|
||||
LoginAppUser user = LoginUserContextHolder.getUser();
|
||||
//@TODO 价格配置问题优化
|
||||
Double price = 19.90;
|
||||
long execTime = 3; //一单执行时间默认3分钟
|
||||
|
||||
|
||||
Reference in New Issue
Block a user