|
@@ -57,8 +57,8 @@ class CfReferralWeightedPpointsTest {
|
|
|
if (ids.contains(110L)) sum += 50000;
|
|
if (ids.contains(110L)) sum += 50000;
|
|
|
return sum;
|
|
return sum;
|
|
|
});
|
|
});
|
|
|
- // 新权重 L1=100%,L2=90%,L10=10% → 10000*1.0 + 20000*0.9 + 50000*0.1 = 33000
|
|
|
|
|
- assertEquals(33000, service.getWeightedTeamAnnualPpoints(1L, asOf));
|
|
|
|
|
|
|
+ // 权重 L1=90%,L2=80%,L10=0% → 10000*0.9 + 20000*0.8 + 50000*0 = 25000
|
|
|
|
|
+ assertEquals(25000, service.getWeightedTeamAnnualPpoints(1L, asOf));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
@@ -68,12 +68,12 @@ class CfReferralWeightedPpointsTest {
|
|
|
tree(1L, 103L, 1), tree(1L, 103L, 2), tree(1L, 1L, 1)));
|
|
tree(1L, 103L, 1), tree(1L, 103L, 2), tree(1L, 1L, 1)));
|
|
|
when(ppointConsumptionLogMapper.sumPaidAmountYuan(anyCollection(), any(Date.class), any(Date.class)))
|
|
when(ppointConsumptionLogMapper.sumPaidAmountYuan(anyCollection(), any(Date.class), any(Date.class)))
|
|
|
.thenReturn(10000);
|
|
.thenReturn(10000);
|
|
|
- assertEquals(10000, service.getWeightedTeamAnnualPpoints(1L, asOf));
|
|
|
|
|
|
|
+ assertEquals(9000, service.getWeightedTeamAnnualPpoints(1L, asOf));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
void f03a_tier_ppoints_is_self_plus_weighted_once() {
|
|
void f03a_tier_ppoints_is_self_plus_weighted_once() {
|
|
|
- // self=10000(用户1本人),团队加权=10000(用户101 L1 ×100%)
|
|
|
|
|
|
|
+ // self=10000(用户1本人),团队加权=9000(用户101 L1 ×90%)
|
|
|
when(ppointConsumptionLogMapper.sumPaidAmountYuan(anyCollection(), any(Date.class), any(Date.class)))
|
|
when(ppointConsumptionLogMapper.sumPaidAmountYuan(anyCollection(), any(Date.class), any(Date.class)))
|
|
|
.thenAnswer(inv -> {
|
|
.thenAnswer(inv -> {
|
|
|
Collection<Long> ids = inv.getArgument(0);
|
|
Collection<Long> ids = inv.getArgument(0);
|
|
@@ -82,19 +82,19 @@ class CfReferralWeightedPpointsTest {
|
|
|
return 0;
|
|
return 0;
|
|
|
});
|
|
});
|
|
|
when(referralTreeMapper.selectList(any())).thenReturn(Collections.singletonList(tree(1L, 101L, 1)));
|
|
when(referralTreeMapper.selectList(any())).thenReturn(Collections.singletonList(tree(1L, 101L, 1)));
|
|
|
- assertEquals(20000, service.getF03aTierPpoints(1L, asOf)); // self10000 + 10000,self只加一次
|
|
|
|
|
|
|
+ assertEquals(19000, service.getF03aTierPpoints(1L, asOf)); // self10000 + 9000,self只加一次
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|
|
|
- void recalc_weight_L1_is_100_percent() {
|
|
|
|
|
- // 重算专用:按 paid_at 归属,L1直推自购100%计入;李志清51,400×100%=51,400≥32,000→至富70%
|
|
|
|
|
|
|
+ void recalc_weight_L1_is_90_percent() {
|
|
|
|
|
+ // 重算专用:按 paid_at 归属,L1直推自购90%计入;51,400×90%=46,260
|
|
|
when(ppointConsumptionLogMapper.sumPaidAmountYuan(anyCollection(), any(Date.class), any(Date.class)))
|
|
when(ppointConsumptionLogMapper.sumPaidAmountYuan(anyCollection(), any(Date.class), any(Date.class)))
|
|
|
.thenAnswer(inv -> {
|
|
.thenAnswer(inv -> {
|
|
|
Collection<Long> ids = inv.getArgument(0);
|
|
Collection<Long> ids = inv.getArgument(0);
|
|
|
return ids.contains(101L) ? 51400 : 0;
|
|
return ids.contains(101L) ? 51400 : 0;
|
|
|
});
|
|
});
|
|
|
when(referralTreeMapper.selectList(any())).thenReturn(Collections.singletonList(tree(1L, 101L, 1)));
|
|
when(referralTreeMapper.selectList(any())).thenReturn(Collections.singletonList(tree(1L, 101L, 1)));
|
|
|
- assertEquals(51400, service.getF03aTierPpointsForRecalc(1L, asOf));
|
|
|
|
|
|
|
+ assertEquals(46260, service.getF03aTierPpointsForRecalc(1L, asOf));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
@Test
|