|
|
@@ -84,6 +84,9 @@ public class ProductOrderService {
|
|
|
@Resource
|
|
|
private CommissionService commissionService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CfCommissionService cfCommissionService;
|
|
|
+
|
|
|
@Resource
|
|
|
private PaymentService paymentService;
|
|
|
|
|
|
@@ -619,32 +622,13 @@ public class ProductOrderService {
|
|
|
order.setUpdatedAt(new Date());
|
|
|
orderMapper.updateById(order);
|
|
|
|
|
|
- // CF值:购买者本人按分润公式获得
|
|
|
- try {
|
|
|
- Product p = productMapper.selectById(order.getProductId());
|
|
|
- if (p != null) {
|
|
|
- int effectivePpoint = ppointConfigService.getEffectivePpoint(p.getId(), p.getCategoryId());
|
|
|
- if (effectivePpoint > 0) {
|
|
|
- String shareStr = sysConfigService.getValue("product_platform_points_share");
|
|
|
- int shareBps = shareStr != null && !shareStr.isEmpty()
|
|
|
- ? Integer.parseInt(shareStr) : 1000;
|
|
|
- int cfValue = order.getTotalAmount() * effectivePpoint / 100 * shareBps / 10000;
|
|
|
- if (cfValue > 0) {
|
|
|
- platformPointsService.earn(order.getBuyerId(), cfValue,
|
|
|
- "product_order", order.getId(),
|
|
|
- "购买商品: " + order.getProductName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("购买者CF值发放失败: orderId={}, error={}", order.getId(), e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- // CF值:推荐人按推荐链分润
|
|
|
+ // CF值:统一分佣(当前人 + 推荐人)
|
|
|
try {
|
|
|
- commissionDistService.distribute(order.getBuyerId(), order.getId(), order.getProductId());
|
|
|
+ cfCommissionService.settle(order.getId(), "product", order.getBuyerId(),
|
|
|
+ userMapper.selectById(order.getBuyerId()).getFamilyId(),
|
|
|
+ order.getTotalAmount(), order.getProductId());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("推荐人分润失败: orderId={}, error={}", order.getId(), e.getMessage());
|
|
|
+ log.error("CF值分佣失败: orderId={}, error={}", order.getId(), e.getMessage());
|
|
|
}
|
|
|
|
|
|
// 原佣金结算标记为废弃,保留兼容
|