扫码支付报错修复

This commit is contained in:
张松
2025-10-10 17:22:49 +08:00
parent d9669f7dfa
commit 069c3c80bb

View File

@@ -392,14 +392,19 @@ public class PayServiceImpl implements PayService {
public CzgResult<Map<String, Object>> microPayOrder(OrderPayParamDTO payParam) {
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
AssertUtil.isBlank(payParam.getAuthCode(), "扫描码不能为空");
ShopUser shopUser = shopUserService.getById(payParam.getShopUserId());
MkShopRechargeVO rechargeVO = shopRechargeService.detail(payParam.getShopId());
if (payParam.getRechargeDetailId() == null && rechargeVO.getIsCustom() == 0) {
throw new CzgException("未开启自定义充值金额");
if (payParam.getShopUserId() != null) {
ShopUser shopUser = shopUserService.getById(payParam.getShopUserId());
MkShopRechargeVO rechargeVO = shopRechargeService.detail(payParam.getShopId());
if (payParam.getRechargeDetailId() == null && rechargeVO.getIsCustom() == 0) {
throw new CzgException("未开启自定义充值金额");
}
Long mainShopId = shopInfoService.getMainIdByShopId(payParam.getShopId());
BigDecimal amount = shopRechargeService.checkRecharge(mainShopId, payParam.getShopId(), shopUser.getUserId(), payParam.getRechargeDetailId(), payParam.getAmount());
payParam.setAmount(amount);
}
Long mainShopId = shopInfoService.getMainIdByShopId(payParam.getShopId());
BigDecimal amount = shopRechargeService.checkRecharge(mainShopId, payParam.getShopId(), shopUser.getUserId(), payParam.getRechargeDetailId(), payParam.getAmount());
payParam.setAmount(amount);
String payOrderNo = orderInfo.getPlatformType() + IdUtil.getSnowflakeNextId();
Long paymentId = initOrderPayment(new OrderPayment(payParam.getShopId(), orderInfo.getId(),
"order", payOrderNo, payParam.getAuthCode(), orderInfo.getOrderAmount()));