会员支付 会员用户Id

This commit is contained in:
2025-02-28 17:49:51 +08:00
parent 7dcf7a869d
commit d8a55e2103
3 changed files with 19 additions and 6 deletions

View File

@@ -26,6 +26,7 @@ public class CzgLtPayReq extends CzgBaseReq {
* 支付宝支付和银联支付时,传入用户的 userId
*/
private String userId;
private String payType;
/**
* 用户 IP 支付的用户 IP
*/
@@ -50,11 +51,12 @@ public class CzgLtPayReq extends CzgBaseReq {
*/
private boolean isScreen;
public CzgLtPayReq(@NonNull String mchOrderNo, @NonNull Long amount,
public CzgLtPayReq(@NonNull String mchOrderNo, @NonNull Long amount,@NonNull String payType,
String body, @NonNull String openId, @NonNull String clientIp,
String returnUrl, String buyerRemark, @NonNull String extParam) {
super(mchOrderNo, amount, body, buyerRemark, extParam);
this.userId = openId;
this.payType = payType;
this.clientIp = clientIp;
this.returnUrl = returnUrl;
}

View File

@@ -5,6 +5,7 @@ import lombok.Getter;
/**
* 订单状态枚举类
* @author ww
*/
@Getter
public enum OrderStatusEnums {

View File

@@ -116,7 +116,7 @@ public class PayServiceImpl implements PayService {
ShopUser shopUser = new ShopUser();
if ("scanCode".equals(payParam.getPayType())) {
AssertUtil.isBlank(payParam.getAuthCode(), "会员码不能为空");
Object o = redisService.get(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getShopId() + ":" + payParam.getAuthCode());
Object o = redisService.get(RedisCst.SHOP_USER_DYNAMIC_CODE + payParam.getShopId() + ":" + payParam.getAuthCode());
AssertUtil.isNull(o, "会员码已失效");
shopUser = shopUserService.getById(o.toString());
} else {
@@ -136,7 +136,9 @@ public class PayServiceImpl implements PayService {
}
}
}
AssertUtil.isNull(shopUser, "会员不存在");
if (shopUser == null || shopUser.getId() == null) {
AssertUtil.isNull(shopUser, "会员不存在");
}
if (!shopUser.getShopId().equals(orderInfo.getShopId())) {
return CzgResult.failure("违规操作,请确认店铺后重试");
}
@@ -216,7 +218,7 @@ public class PayServiceImpl implements PayService {
"order", payOrderNo, "", orderInfo.getOrderAmount()));
upOrderPayInfo(orderInfo.getId(), "aliPay".equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId);
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(payOrderNo, orderInfo.getOrderAmount().multiply(MONEY_RATE).longValue(),
"点餐支付", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
payParam.getPayType(), "点餐支付", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
}
@Override
@@ -301,7 +303,7 @@ public class PayServiceImpl implements PayService {
String payOrderNo = payParam.getPlatformType() + IdUtil.getSnowflakeNextId();
initOrderPayment(new OrderPayment(payParam.getShopId(), shopUser.getId(), "memberIn", payOrderNo, "", payParam.getAmount()));
return ltPay(payParam.getShopId(), payParam.getPayType(), new CzgLtPayReq(payOrderNo, payParam.getAmount().multiply(MONEY_RATE).longValue(),
"会员充值", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
payParam.getPayType(), "会员充值", payParam.getOpenId(), clintIp, payParam.getReturnUrl(), payParam.getBuyerRemark(), ""));
}
@Override
@@ -432,7 +434,6 @@ public class PayServiceImpl implements PayService {
isPay = false;
refPayOrderNo = "";
}
orderInfo.setStatus(OrderStatusEnums.PART_REFUND.getCode());
if (CollUtil.isNotEmpty(param.getRefundDetails())) {
for (OrderDetail refundDetail : param.getRefundDetails()) {
AssertUtil.isNull(refundDetail.getNum(), "退单数量不能为空");
@@ -484,8 +485,17 @@ public class PayServiceImpl implements PayService {
}
orderDetailService.updateById(orderDetail);
}
long count = orderDetailService.queryChain()
.eq(OrderDetail::getOrderId, orderInfo.getId())
.ne(OrderDetail::getStatus, OrderStatusEnums.REFUND.getCode()).count();
if (count > 0) {
orderInfo.setStatus(OrderStatusEnums.PART_REFUND.getCode());
} else {
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
}
} else {
refundAmountTotal = param.getRefundAmount();
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
if (isPay) {
orderDetailService.updateChain()
.eq(OrderDetail::getOrderId, param.getOrderId())