会员充值/霸王餐支付 关联id问题
统一异常拦截 rootCause 值 CLIENT_LOGIC 与 USER_LOGIC 问题
This commit is contained in:
@@ -198,7 +198,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public String getInviteCode(Long shopId, Long shopUserId) {
|
||||
public String getInviteCode(Long shopId, Long shopUserId) throws CzgException, ValidateException {
|
||||
ShopUser shopUser = shopUserService.getById(shopUserId);
|
||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||
MkDistributionConfigVO mkDistributionConfigVO = mkDistributionConfigService.detail(shopId);
|
||||
@@ -732,7 +732,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
||||
/**
|
||||
* 分销金额修改
|
||||
*
|
||||
* @param pendingIncome 待入账金额
|
||||
* @param pendingIncome 待入账金额
|
||||
* @param receivedIncome 已入账
|
||||
* @param withdrawIncome 已提现
|
||||
*/
|
||||
|
||||
@@ -1066,10 +1066,27 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
// 分销奖励
|
||||
distributionUserService.distribute(orderInfo.getId(), orderInfo.getOrderNo(), payment.getAmount(), orderInfo.getUserId(), orderInfo.getShopId(), "order");
|
||||
}
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType()) || PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||
boolean isFree = PayTypeConstants.SourceType.FREE.equals(payment.getSourceType());
|
||||
} else if (PayTypeConstants.SourceType.FREE.equals(payment.getSourceType())) {
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
if (shopUser == null) {
|
||||
log.error("霸王餐回调失败,会员不存在,会员id:{}", payment.getSourceId());
|
||||
} else {
|
||||
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getId, payment.getRelatedId()));
|
||||
if (orderInfo == null) {
|
||||
log.error("霸王餐支付,订单不存在,支付记录Id,{}", payment.getId());
|
||||
} else {
|
||||
//增加余额
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUser.getId()).setType(1)
|
||||
.setBizEnum(ShopUserFlowBizEnum.FREE_IN)
|
||||
.setRelationId(orderInfo.getId())
|
||||
.setMoney(BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
|
||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||
upOrderInfo(orderInfo, BigDecimal.ZERO, LocalDateTime.now(), null, PayEnums.FREE_PAY);
|
||||
}
|
||||
}
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_IN.equals(payment.getSourceType())) {
|
||||
ShopUser shopUser = shopUserService.getById(payment.getSourceId());
|
||||
OrderInfo orderInfo;
|
||||
if (shopUser == null) {
|
||||
log.error("会员充值失败,会员不存在,会员id:{}", payment.getSourceId());
|
||||
} else {
|
||||
@@ -1081,42 +1098,22 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
} else {
|
||||
bizEnum = ShopUserFlowBizEnum.CASH_IN;
|
||||
}
|
||||
if (isFree) {
|
||||
orderInfo = orderInfoService.getOne(new QueryWrapper().eq(OrderInfo::getId, payment.getRelatedId()));
|
||||
if (orderInfo == null) {
|
||||
log.error("霸王餐支付,订单不存在,支付记录Id,{}", payment.getId());
|
||||
} else {
|
||||
//增加余额
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUser.getId())
|
||||
.setType(1)
|
||||
.setBizEnum(ShopUserFlowBizEnum.FREE_IN)
|
||||
.setRelationId(orderInfo.getId())
|
||||
.setMoney(BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
|
||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||
upOrderInfo(orderInfo, BigDecimal.ZERO,
|
||||
LocalDateTime.now(), null, PayEnums.FREE_PAY);
|
||||
}
|
||||
} else {
|
||||
//充值并支付 ↓
|
||||
orderInfo = orderInfoService.getOne(new QueryWrapper()
|
||||
.eq(OrderInfo::getPayOrderId, payment.getId())
|
||||
.eq(OrderInfo::getPayType, PayEnums.VIP_PAY.getValue()));
|
||||
if (orderInfo != null) {
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUser.getId())
|
||||
.setType(0)
|
||||
.setBizEnum(ShopUserFlowBizEnum.ORDER_PAY)
|
||||
.setRelationId(orderInfo.getId())
|
||||
.setMoney(orderInfo.getOrderAmount());
|
||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||
upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||
LocalDateTime.now(), null, PayEnums.VIP_PAY);
|
||||
}
|
||||
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
||||
BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN),
|
||||
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
||||
//充值并支付 ↓
|
||||
OrderInfo orderInfo = orderInfoService.getOne(new QueryWrapper()
|
||||
.eq(OrderInfo::getPayOrderId, payment.getId())
|
||||
.eq(OrderInfo::getPayType, PayEnums.VIP_PAY.getValue()));
|
||||
if (orderInfo != null) {
|
||||
ShopUserMoneyEditDTO shopUserMoneyEditDTO = new ShopUserMoneyEditDTO()
|
||||
.setId(shopUser.getId()).setType(0)
|
||||
.setBizEnum(ShopUserFlowBizEnum.ORDER_PAY)
|
||||
.setRelationId(orderInfo.getId())
|
||||
.setMoney(orderInfo.getOrderAmount());
|
||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||
upOrderInfo(orderInfo, orderInfo.getOrderAmount(), LocalDateTime.now(), null, PayEnums.VIP_PAY);
|
||||
}
|
||||
shopRechargeService.recharge(payment.getShopId(), payment.getSourceId(), payment.getRelatedId(),
|
||||
BigDecimal.valueOf(notifyRespDTO.getAmount()).divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN),
|
||||
payment.getId(), payment.getSourceType(), bizEnum, orderInfo == null);
|
||||
}
|
||||
} else if (PayTypeConstants.SourceType.MEMBER_PAY.equals(payment.getSourceType())) {
|
||||
//购买会员
|
||||
|
||||
@@ -81,7 +81,7 @@ public class PayServiceImpl implements PayService {
|
||||
AssertUtil.isBlank(param.getPayType(), "支付方式不能为空");
|
||||
String payOrderNo = "LT" + IdUtil.getSnowflakeNextId();
|
||||
initPayment(OrderPayment.pay(param.getShopId(), param.getRecordId(), payType, payOrderNo,
|
||||
param.getPrice(), "", null));
|
||||
param.getPrice(), "", param.getRelatedId()));
|
||||
return pay(param.getShopId(), CzgPayEnum.LT_PAY,
|
||||
CzgPayBaseReq.ltPayReq(payOrderNo, detail, param.getPrice().multiply(MONEY_RATE).longValue(),
|
||||
param.getPayType(), param.getOpenId(), param.getIp()));
|
||||
|
||||
@@ -159,6 +159,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
||||
.setRecordId(shopUser.getId())
|
||||
.setPrice(memberOrder.getAmount())
|
||||
.setIp(clientIp);
|
||||
payParam1.setRelatedId(memberOrder.getId());
|
||||
return payService.ltPayOther(payParam1, PayTypeConstants.SourceType.MEMBER_PAY, "会员充值");
|
||||
}
|
||||
|
||||
@@ -190,6 +191,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
||||
.setRecordId(shopUser.getId())
|
||||
.setPrice(payParam.getAmount())
|
||||
.setIp(clintIp);
|
||||
payParam1.setRelatedId(isFree ? payParam.getOrderId() : payParam.getRechargeDetailId());
|
||||
return payService.ltPayOther(payParam1, payType, "会员充值");
|
||||
}
|
||||
|
||||
@@ -216,6 +218,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
||||
.setRecordId(shopUser.getId())
|
||||
.setPrice(amount)
|
||||
.setIp(clientIp);
|
||||
payParam.setRelatedId(isFree ? rechargeDTO.getOrderId() : rechargeDTO.getRechargeDetailId());
|
||||
return payService.ltPayOther(payParam, payType, "会员充值");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user