Authored by LUOXC

Merge branch 'hotfix-invite-activity-2' into test6.9.1

... ... @@ -40,9 +40,9 @@ public class InviteSettlementUtilsTest {
}
@Test
public void calculateSettleAmountOfType2_1() {
public void calculateSettleAmountOfType2_3_300_500() {
LocalDateTime inviteTime = LocalDateTime.of(2019, 1, 26, 1, 2, 1);
LocalDateTime settleTime = LocalDateTime.of(2019, 2, 1, 0, 0, 0);
LocalDateTime settleTime = LocalDateTime.of(2020, 1, 1, 0, 0, 0);
List<InviteSettlementItem> items = Lists.newArrayList(
// 2019-05-28 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(),
... ... @@ -57,11 +57,43 @@ public class InviteSettlementUtilsTest {
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(999)).createTime(1564281119).build(),
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(4000)).createTime(1564281119).build(),
// 2019-12-31 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2990000)).createTime(1577759519).build()
);
Pair<BigDecimal, List<InviteSettlementItem>> settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items);
assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(41999.988));
Assert.assertEquals(settleResult.getRight().size(), 0);
}
@Test
public void calculateSettleAmountOfType2_1() {
LocalDateTime inviteTime = LocalDateTime.of(2019, 1, 26, 1, 2, 1);
LocalDateTime settleTime = LocalDateTime.of(2019, 2, 1, 0, 0, 0);
List<InviteSettlementItem> items = Lists.newArrayList(
// 2019-05-28 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(),
// 2019-06-28 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(1000)).createTime(1561689119).build(),
// 2019-12-31 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2490000)).createTime(1577759519).build()
);
Pair<BigDecimal, List<InviteSettlementItem>> settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items);
assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(0));
Assert.assertEquals(settleResult.getRight().size(), items.size());
items = Lists.newArrayList(
// 2019-01-28 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1548642719).build(),
// 2019-05-28 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(),
// 2019-06-28 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(1000)).createTime(1561689119).build(),
// 2019-12-31 10:31:59
InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2490000)).createTime(1577759519).build()
);
settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items);
assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(10000));
Assert.assertEquals(settleResult.getRight().size(), items.size() - 1);
}
... ...