支付类型

This commit is contained in:
2026-01-17 17:32:31 +08:00
parent cf3c58169d
commit 8242a4f905
27 changed files with 84 additions and 86 deletions

View File

@@ -1,13 +1,13 @@
package com.czg.service.order.service.impl;
import cn.hutool.core.util.IdUtil;
import com.czg.PayCst;
import com.czg.account.entity.ShopUser;
import com.czg.account.entity.UserInfo;
import com.czg.account.service.ShopUserService;
import com.czg.account.service.UserInfoService;
import com.czg.constant.TableValueConstant;
import com.czg.constants.PayTypeConstants;
import com.czg.constants.SystemConstants;
import com.czg.enums.CzgPayEnum;
import com.czg.exception.CzgException;
import com.czg.market.service.MkDistributionConfigService;
@@ -83,7 +83,7 @@ public class DistributionPayServiceImpl implements DistributionPayService {
} else {
UserInfo userInfo = userInfoService.getById(userId);
initInfo.setPayment(orderPayment).setShopUser(shopUserInfo)
.setOpenId(SystemConstants.PayType.ALIPAY.equals(payParam.getPayType()) ? userInfo.getAlipayOpenId() : userInfo.getWechatOpenId());
.setOpenId(PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? userInfo.getAlipayOpenId() : userInfo.getWechatOpenId());
}
return initInfo;
}

View File

@@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.digest.MD5;
import com.alibaba.fastjson2.JSONObject;
import com.czg.PayCst;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
import com.czg.account.entity.ShopInfo;
import com.czg.account.entity.ShopUser;
@@ -242,7 +243,7 @@ public class OrderPayServiceImpl implements OrderPayService {
CzgPayBaseReq.ltPayReq(
payOrderNo, "充值并支付",
rechargeDetail.getAmount().multiply(PayService.MONEY_RATE).longValue(), payParam.getPayType(),
"wechatPay".equals(payParam.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId(), clintIp));
PayCst.Type.WECHAT.equals(payParam.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId(), clintIp));
}
@Override

View File

@@ -6,10 +6,10 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.PayAdapter;
import com.czg.PayAdapterFactory;
import com.czg.PayCst;
import com.czg.constant.PayChannelCst;
import com.czg.constants.ParamCodeCst;
import com.czg.constants.PayTypeConstants;
import com.czg.constants.SystemConstants;
import com.czg.enums.CzgPayEnum;
import com.czg.exception.CzgException;
import com.czg.order.dto.LtPayOtherDTO;
@@ -64,7 +64,10 @@ public class PayServiceImpl implements PayService {
} else if (shopMerchant.getChannel().equals(PayChannelCst.POLY)) {
payData = shopMerchant.getPolyPayJson();
}
bizData.setSubAppid(SystemConstants.PayType.ALIPAY.equals(bizData.getPayType()) ? shopMerchant.getAlipayAppId() : shopMerchant.getWechatAppId());
if (!PayCst.Type.WECHAT.equals(bizData.getPayType()) && !PayCst.Type.ALIPAY.equals(bizData.getPayType())) {
throw new CzgException("支付方式错误");
}
bizData.setSubAppid(PayCst.Type.ALIPAY.equals(bizData.getPayType()) ? shopMerchant.getAlipayAppId() : shopMerchant.getWechatAppId());
if (payType.equals(CzgPayEnum.MICRO_PAY)) {
checkMicroPay(bizData, shopMerchant);
}
@@ -203,7 +206,7 @@ public class PayServiceImpl implements PayService {
return sysParamsService.getSysParamValue(ParamCodeCst.System.POLY_DOMAIN);
}
private String getNotifyUrl(String channel) {
private String getNotifyUrl(String channel) {
String notifyUrl = "";
if (channel.equals(PayChannelCst.NATIVE)) {
notifyUrl = sysParamsService.getSysParamValue(ParamCodeCst.System.NATIVE_PAY_NOTIFY_URL);
@@ -229,11 +232,11 @@ public class PayServiceImpl implements PayService {
if (firstTwoDigits >= 10 && firstTwoDigits <= 15) {
//微信支付
bizData.setSubAppid(shopMerchant.getWechatAppId());
bizData.setPayType(SystemConstants.PayType.WECHAT);
bizData.setPayType(PayCst.Type.WECHAT);
} else if (firstTwoDigits >= 25 && firstTwoDigits <= 30) {
//支付宝支付
bizData.setSubAppid(shopMerchant.getAlipayAppId());
bizData.setPayType(SystemConstants.PayType.ALIPAY);
bizData.setPayType(PayCst.Type.ALIPAY);
} else {
throw new CzgException("扫描码非法或暂不支持");
}

View File

@@ -75,8 +75,8 @@ public class ShopMerchantServiceImpl extends ServiceImpl<ShopMerchantMapper, Sho
ShopMerchant shopMerchant = getOne(query().eq(ShopMerchant::getShopId, shopMerchantParam.getShopId()));
if (shopMerchant == null) {
shopMerchant = new ShopMerchant();
shopMerchant.setAlipayAppId(SystemConstants.PayType.ALIPAY_APP_ID);
shopMerchant.setWechatAppId(SystemConstants.PayType.WECHAT_APP_ID);
shopMerchant.setAlipayAppId(SystemConstants.PayAppId.ALIPAY_APP_ID);
shopMerchant.setWechatAppId(SystemConstants.PayAppId.WECHAT_APP_ID);
shopMerchant.setRelatedId(shopMerchantParam.getShopId());
}
shopMerchant.setShopId(shopMerchantParam.getShopId());

View File

@@ -2,6 +2,7 @@ package com.czg.service.order.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.SecureUtil;
import com.czg.PayCst;
import com.czg.account.dto.shopuser.ShopUserMoneyEditDTO;
import com.czg.account.entity.*;
import com.czg.account.service.*;
@@ -209,7 +210,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
String payType = isFree ? PayTypeConstants.SourceType.FREE : PayTypeConstants.SourceType.MEMBER_IN;
LtPayOtherDTO payParam = new LtPayOtherDTO()
.setOpenId("wechatPay".equals(rechargeDTO.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId())
.setOpenId(PayCst.Type.WECHAT.equals(rechargeDTO.getPayType()) ? userInfo.getWechatOpenId() : userInfo.getAlipayOpenId())
.setPayType(rechargeDTO.getPayType())
.setShopId(rechargeDTO.getShopId())
.setRecordId(shopUser.getId())