分销员开通接口

This commit is contained in:
张松
2025-10-27 11:38:08 +08:00
parent 8ed14ed241
commit 423b6f303f
7 changed files with 69 additions and 33 deletions

View File

@@ -64,14 +64,13 @@ public class DistributionPayServiceImpl implements DistributionPayService {
}
private InitInfo initPayment(Long userId, MkDistributionPayDTO payParam) {
Long mainShopId = shopInfoService.getMainIdByShopId(payParam.getShopId());
MkDistributionConfigVO detail = configService.detail(payParam.getShopId());
AssertUtil.isTrue(detail.getIsEnable() != 1, "分销未开启");
if (!TableValueConstant.DistributionConfig.OpenType.PAY.getCode().equals(detail.getOpenType())) {
throw new CzgException("当前未开启购买分销配置");
}
OrderPayment orderPayment = new OrderPayment().setShopId(mainShopId).setSourceId(userId)
OrderPayment orderPayment = new OrderPayment().setShopId(payParam.getShopId()).setSourceId(userId)
.setPayType("distribution").setOrderNo(payParam.getPlatformType() + IdUtil.getSnowflakeNextId()).setAmount(detail.getPayAmount());
orderPaymentService.save(orderPayment);

View File

@@ -136,6 +136,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private MkShopRechargeService shopRechargeService;
@Resource
private MkConsumeCashbackService consumeCashbackService;
@Resource
private MkDistributionConfigService distributionConfigService;
// 延迟 5 秒
private static final long DELAY = 5;
//重试次数
@@ -1154,6 +1156,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
// 充值赠送积分
memberConfigService.deliver(shopUser.getMainShopId(), shopUser.getUserId(), TableValueConstant.MemberExpFlow.Type.COST, payment.getAmount(), null, payment.getId());
// 分销员开通
} else if ("distribution".equals(payment.getPayType())) {
distributionConfigService.open(payment.getSourceId(), payment.getAmount(), payment.getShopId(), payment.getId());
}
}
}