|
@@ -16,9 +16,10 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Set;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 统一 CF 值分佣服务。
|
|
* 统一 CF 值分佣服务。
|
|
@@ -96,6 +97,7 @@ public class CfCommissionService {
|
|
|
int shareBps = getSysBps("product_platform_points_share", 1000);
|
|
int shareBps = getSysBps("product_platform_points_share", 1000);
|
|
|
return amountYuan * effectivePpoint / 100 * shareBps / 10000;
|
|
return amountYuan * effectivePpoint / 100 * shareBps / 10000;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ log.warn("计算当前人返CF失败: productId={}, err={}", productId, e.getMessage());
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -118,7 +120,7 @@ public class CfCommissionService {
|
|
|
.orderByAsc(ReferralTree::getLevel));
|
|
.orderByAsc(ReferralTree::getLevel));
|
|
|
if (referrals == null || referrals.isEmpty()) return;
|
|
if (referrals == null || referrals.isEmpty()) return;
|
|
|
|
|
|
|
|
- List<Long> processed = new ArrayList<>();
|
|
|
|
|
|
|
+ Set<Long> processed = new HashSet<>();
|
|
|
for (ReferralTree ref : referrals) {
|
|
for (ReferralTree ref : referrals) {
|
|
|
Long referrerId = ref.getParentId();
|
|
Long referrerId = ref.getParentId();
|
|
|
if (processed.contains(referrerId)) continue;
|
|
if (processed.contains(referrerId)) continue;
|
|
@@ -159,6 +161,7 @@ public class CfCommissionService {
|
|
|
if (p == null) return 0;
|
|
if (p == null) return 0;
|
|
|
return ppointConfigService.getEffectivePpoint(productId, p.getCategoryId());
|
|
return ppointConfigService.getEffectivePpoint(productId, p.getCategoryId());
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
|
|
+ log.warn("计算推荐人分润基数失败: productId={}, err={}", productId, e.getMessage());
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -188,6 +191,10 @@ public class CfCommissionService {
|
|
|
r.setRefId(refId);
|
|
r.setRefId(refId);
|
|
|
r.setRemark(remark);
|
|
r.setRemark(remark);
|
|
|
r.setCreatedAt(new Date());
|
|
r.setCreatedAt(new Date());
|
|
|
- try { cfTransferRecordMapper.insert(r); } catch (Exception e) { log.warn("写流转记录失败: {}", e.getMessage()); }
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ cfTransferRecordMapper.insert(r);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("写流转记录失败: {}", e.getMessage());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|