123
This commit is contained in:
@@ -97,6 +97,7 @@ public enum SystemConfigEnum {
|
||||
ANCHOR_JOIN_AGREEMENT("/#/agreement/anchor-join", "主播入驻协议地址",SystemConfigGroupEnum.DOMAIN),
|
||||
WS_SOCKET_URL("ws://localhost:8080/ws?token=%s&room_id=%s", "ws通讯地址",SystemConfigGroupEnum.DOMAIN),
|
||||
UPLOAD_FILE_DOMAIN("http://127.0.0.1:8080", "文件上传域名服务器",SystemConfigGroupEnum.DOMAIN),
|
||||
PAY_NOTIFY_URL("http://127.0.0.1:8080", "域名回调",SystemConfigGroupEnum.DOMAIN),
|
||||
// 七牛云 ?imageView2/2/w/120/h/120
|
||||
// 腾讯云 ?thumbnail=120y120&imageView
|
||||
IM_ICON_SUFFIX("?thumbnail=120y120&imageView", "im头像后缀",SystemConfigGroupEnum.DOMAIN),
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.domain.AlipayTradeQueryModel;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ijpay.alipay.AliPayApi;
|
||||
import com.ijpay.alipay.AliPayApiConfig;
|
||||
@@ -12,22 +13,23 @@ import com.ijpay.core.enums.SignType;
|
||||
import com.ijpay.core.kit.WxPayKit;
|
||||
import com.ijpay.wxpay.WxPayApi;
|
||||
import com.ijpay.wxpay.model.OrderQueryModel;
|
||||
import com.ruoyi.cai.domain.Goods;
|
||||
import com.ruoyi.cai.domain.PayConfig;
|
||||
import com.ruoyi.cai.domain.RechargeOrder;
|
||||
import com.ruoyi.cai.domain.VipOrder;
|
||||
import com.ruoyi.cai.domain.*;
|
||||
import com.ruoyi.cai.dto.ConsumeResp;
|
||||
import com.ruoyi.cai.dto.app.vo.pay.OrderPayStatusResp;
|
||||
import com.ruoyi.cai.dto.commom.consumer.RechargeConsumerResp;
|
||||
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||
import com.ruoyi.cai.manager.AwardManager;
|
||||
import com.ruoyi.cai.manager.ConsumerManager;
|
||||
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||
import com.ruoyi.cai.pay.model.PayQueryModel;
|
||||
import com.ruoyi.cai.service.*;
|
||||
import com.ruoyi.cai.trdpay.TrdPayTypeEnum;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -51,6 +53,27 @@ public class PayManager {
|
||||
private PayConfigManager payConfigManager;
|
||||
@Autowired
|
||||
private GoodsService goodsService;
|
||||
@Autowired
|
||||
private SystemConfigManager systemConfigManager;
|
||||
|
||||
|
||||
public String getNotifyDomain(String notifyUrl) {
|
||||
if(!StringUtils.isBlank(notifyUrl)){
|
||||
return notifyUrl;
|
||||
}else{
|
||||
String baseNotifyUrl = systemConfigManager.getSystemConfig(SystemConfigEnum.PAY_NOTIFY_URL);
|
||||
return baseNotifyUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public String getNotifyUrl(PayTrdConfig config, TrdPayTypeEnum type,boolean wx) {
|
||||
if(!StringUtils.isBlank(config.getNotifyUrl())){
|
||||
return type.getNotifyUrl(config.getNotifyUrl(),wx);
|
||||
}else{
|
||||
String notifyUrl = systemConfigManager.getSystemConfig(SystemConfigEnum.PAY_NOTIFY_URL);
|
||||
return type.getNotifyUrl(notifyUrl,wx);
|
||||
}
|
||||
}
|
||||
|
||||
public PayQueryModel queryOrder(PayConfig payConfig,String orderNo,String appid) throws AlipayApiException {
|
||||
if(PayTypeEnum.ALI.getCode().equals(payConfig.getPayType())){
|
||||
|
||||
@@ -90,7 +90,7 @@ public class V14Manager {
|
||||
String customerCode = payTrdConfig.getMchId();
|
||||
long payAmount = payOrderInfoDTO.getPriceFen(); // 支付金额,分为单位
|
||||
String payCurrency = "CNY"; // 币种,写死
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), true);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, true);
|
||||
String transactionStartTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); // 交易开始时间
|
||||
// String transactionEndTime = ""; // 交易结束时间
|
||||
WxJsOrderInfo orderInfo = new WxJsOrderInfo();
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PayTrdV10Service implements PayTrdService {
|
||||
params.put("pay_orderid", payOrderInfoDTO.getOrderNo());
|
||||
params.put("pay_applydate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
params.put("pay_bankcode", payTrdConfig.getProductId(wx));
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("pay_notifyurl", notifyUrl);
|
||||
params.put("pay_amount", payOrderInfoDTO.getPriceYuanStr());
|
||||
MultiValueMap<String, String> map = PayMd5Util.createParamsOfMap(params, payTrdConfig.getSign(), "pay_md5sign");
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PayTrdV11Service implements PayTrdService {
|
||||
params.put("pay_orderid", payOrderInfoDTO.getOrderNo());
|
||||
params.put("pay_applydate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
params.put("pay_bankcode", payTrdConfig.getProductId(wx));
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("pay_notifyurl", notifyUrl);
|
||||
params.put("pay_amount", payOrderInfoDTO.getPriceYuanStr());
|
||||
MultiValueMap<String, String> map = PayMd5Util.createParamsOfMap(params, payTrdConfig.getSign(), "pay_md5sign");
|
||||
|
||||
@@ -107,7 +107,7 @@ public class PayTrdV12Service implements PayTrdService {
|
||||
}else {
|
||||
bizRequest.setFuncCodeList(Collections.singletonList(FuncCodeEnum.FC02020004.getCode()));
|
||||
}
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
payerInfo.setFrontUrl(notifyUrl);
|
||||
payerInfo.setPayExtra(payExtraList);
|
||||
bizRequest.setPayerInfo(payerInfo);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PayTrdV13Service implements PayTrdService {
|
||||
params.put("type", "alipay");
|
||||
}
|
||||
params.put("out_trade_no", payOrderInfoDTO.getOrderNo());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notify_url", notifyUrl);
|
||||
// params.put("return_url", notifyUrl);
|
||||
params.put("name", payOrderInfoDTO.getSubject());
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.cai.trdpay.handle;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.cai.domain.PayTrdConfig;
|
||||
import com.ruoyi.cai.pay.PayManager;
|
||||
import com.ruoyi.cai.pay.PayOrderInfoDTO;
|
||||
import com.ruoyi.cai.pay.PayReturnResp;
|
||||
import com.ruoyi.cai.trdpay.PayTrdService;
|
||||
@@ -23,6 +24,8 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class PayTrdV14Service implements PayTrdService {
|
||||
|
||||
@Autowired
|
||||
private PayManager payManager;
|
||||
@Autowired
|
||||
private V14Manager v14Manager;
|
||||
|
||||
@@ -39,8 +42,8 @@ public class PayTrdV14Service implements PayTrdService {
|
||||
v14PayResp.setPrice(payOrderInfoDTO.getPrice());
|
||||
v14PayResp.setSubject(payOrderInfoDTO.getSubject());
|
||||
v14PayResp.setOrderNo(payOrderInfoDTO.getOrderNo());
|
||||
String notifyUrl = payTrdConfig.getNotifyUrl();
|
||||
String api = notifyUrl.replace("https://", "").replace("http://", "");
|
||||
String notifyDomain = payManager.getNotifyDomain(payTrdConfig.getNotifyUrl());
|
||||
String api = notifyDomain.replace("https://", "").replace("http://", "");
|
||||
v14PayResp.setApi(api);
|
||||
return PayReturnResp.createEfps(v14PayResp);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PayTrdV15Service implements PayTrdService {
|
||||
}else{
|
||||
params.put("pay_bankcode", payTrdConfig.getAliProductId());
|
||||
}
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("pay_notifyurl", notifyUrl);
|
||||
params.put("pay_callbackurl", notifyUrl);
|
||||
params.put("pay_amount", payOrderInfoDTO.getPriceYuanStr());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PayTrdV1Service implements PayTrdService {
|
||||
params.put("productId", payTrdConfig.getProductId(wx));
|
||||
params.put("mchOrderNo", payOrderInfoDTO.getOrderNo());
|
||||
params.put("amount", payOrderInfoDTO.getPriceFenStr());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notifyUrl", notifyUrl);
|
||||
String para = PayMd5Util.createParams(params, payTrdConfig.getSign());
|
||||
String gatewayUrl = getGatewayUrl(payTrdConfig);
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PayTrdV2Service implements PayTrdService {
|
||||
params.put("subject",payOrderInfoDTO.getSubject());
|
||||
params.put("body",payOrderInfoDTO.getBody());
|
||||
params.put("currency","cny");
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notifyUrl", notifyUrl);
|
||||
String para = PayMd5Util.createParams(params, payTrdConfig.getSign());
|
||||
String gatewayUrl = getGatewayUrl(payTrdConfig);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PayTrdV3Service implements PayTrdService {
|
||||
params.put("productId", payTrdConfig.getProductId(wx));
|
||||
params.put("mchOrderNo", payOrderInfoDTO.getOrderNo());
|
||||
params.put("amount", payOrderInfoDTO.getPriceFenStr());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notifyUrl", notifyUrl);
|
||||
String para = PayMd5Util.createParams(params, payTrdConfig.getSign());
|
||||
String gatewayUrl = getGatewayUrl(payTrdConfig);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PayTrdV4Service implements PayTrdService {
|
||||
params.put("tradeType", payTrdConfig.getProductId(wx));
|
||||
params.put("merchantPayNo", payOrderInfoDTO.getOrderNo());
|
||||
params.put("amt", payOrderInfoDTO.getPrice().toString());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notifyUrl", notifyUrl);
|
||||
params.put("goodsName",payOrderInfoDTO.getBody());
|
||||
String para = PayMd5Util.createParams(params, payTrdConfig.getSign());
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PayTrdV5Service implements PayTrdService {
|
||||
params.put("pay_orderid", payOrderInfoDTO.getOrderNo());
|
||||
params.put("pay_applydate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
params.put("pay_bankcode", payTrdConfig.getProductId(wx));
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("pay_notifyurl", notifyUrl);
|
||||
params.put("pay_amount", payOrderInfoDTO.getPriceYuanStr());
|
||||
MultiValueMap<String, String> map = PayMd5Util.createParamsOfMap(params, payTrdConfig.getSign(), "pay_md5sign");
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PayTrdV6Service implements PayTrdService {
|
||||
params.put("productId", payTrdConfig.getProductId(wx));
|
||||
params.put("extra", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
params.put("amount", payOrderInfoDTO.getPriceFenStr());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notifyUrl", notifyUrl);
|
||||
params.put("subject",payOrderInfoDTO.getSubject());
|
||||
params.put("body",payOrderInfoDTO.getBody());
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PayTrdV7Service implements PayTrdService {
|
||||
params.put("channelType", payTrdConfig.getProductId(wx));
|
||||
params.put("merchantOrderNo", payOrderInfoDTO.getOrderNo());
|
||||
params.put("amount", payOrderInfoDTO.getPriceYuanStr());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notifyUrl", notifyUrl);
|
||||
params.put("ip", ServletUtils.getClientIP());
|
||||
params.put("title", payOrderInfoDTO.getSubject());
|
||||
|
||||
@@ -73,7 +73,7 @@ public class PayTrdV8Service implements PayTrdService {
|
||||
params.put("device", "mobile");
|
||||
params.put("type", "alipay");
|
||||
params.put("out_trade_no", payOrderInfoDTO.getOrderNo());
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("notify_url", notifyUrl);
|
||||
params.put("name", payOrderInfoDTO.getSubject());
|
||||
params.put("money", payOrderInfoDTO.getPriceYuanStr());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PayTrdV9Service implements PayTrdService {
|
||||
params.put("pay_orderid", payOrderInfoDTO.getOrderNo());
|
||||
params.put("pay_applydate", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
params.put("pay_bankcode", payTrdConfig.getProductId(wx));
|
||||
String notifyUrl = type.getNotifyUrl(payTrdConfig.getNotifyUrl(), wx);
|
||||
String notifyUrl = payManager.getNotifyUrl(payTrdConfig, type, wx);
|
||||
params.put("pay_notifyurl", notifyUrl);
|
||||
params.put("pay_amount", payOrderInfoDTO.getPriceYuanStr());
|
||||
MultiValueMap<String, String> map = PayMd5Util.createParamsOfMap(params, payTrdConfig.getSign(), "pay_md5sign");
|
||||
|
||||
Reference in New Issue
Block a user