接入微信支付生产环境

This commit is contained in:
2024-07-08 22:42:38 +08:00
parent 660d998035
commit 7d6bf3b8fa
9 changed files with 322 additions and 5 deletions
@@ -32,6 +32,9 @@ public class Payment implements Serializable {
@ApiModelProperty(value = "支付方式")
private String name;
@ApiModelProperty(value = "类型")
private Integer type;
@ApiModelProperty(value = "标识")
private String code;
@@ -95,9 +95,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
private SettingService settingService;
@Resource
private RedisUtil redisUtil;
public static String privateKeyPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_key.pem";
public static String privateKeyPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.modules/src/main/resources/cert/apiclient_key.pem";
public static String privateCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/apiclient_cert.pem";
public static String wechatpayCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.core/src/main/resources/cert/wechatpay_4A3231584E93B6AE77820074D07EADEACCB7E223.pem"; // 平台证书
public static String wechatpayCertPath = "/Users/gxwebsoft/JAVA/com.gxwebsoft.modules/src/main/resources/cert/wechatpay_2DD5A0669263BAE55E52BF3F35BF4A4006A2DAA6.pem"; // 平台证书
@Override
@@ -187,10 +187,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
final String uploadPath = config.getUploadPath(); // 服务器本地路径
final HashMap<String, String> orderInfo = new HashMap<>();
// 微信小程序(微信支付)
String key = "setting:mp-weixin:".concat(order.getTenantId().toString());
String key = "mp-weixin:".concat(order.getTenantId().toString());
final String string = redisUtil.get(key);
final JSONObject mpWx = JSONObject.parseObject(string);
final Payment payment = redisUtil.get("Payment:wxPay:".concat(order.getTenantId().toString()), Payment.class);
System.out.println("mpWx = " + mpWx);
String key2 = "Payment:".concat(order.getPayType().toString()).concat(":").concat(order.getTenantId().toString());
final Payment payment = redisUtil.get(key2, Payment.class);
System.out.println("payment = " + payment);
// 计算金额
BigDecimal decimal = order.getTotalPrice();
@@ -260,7 +263,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
public Order getByOutTradeNo(String outTradeNo) {
OrderParam param = new OrderParam();
param.setOrderNo(outTradeNo);
System.out.println("param222 = " + param);
baseMapper.getByOutTradeNo(param);
return param.getOne(baseMapper.getByOutTradeNo(param));
}