Merge branch 'hotfix-invite-activity-2' into test6.9.1
Showing
1 changed file
with
34 additions
and
2 deletions
@@ -40,9 +40,9 @@ public class InviteSettlementUtilsTest { | @@ -40,9 +40,9 @@ public class InviteSettlementUtilsTest { | ||
40 | } | 40 | } |
41 | 41 | ||
42 | @Test | 42 | @Test |
43 | - public void calculateSettleAmountOfType2_1() { | 43 | + public void calculateSettleAmountOfType2_3_300_500() { |
44 | LocalDateTime inviteTime = LocalDateTime.of(2019, 1, 26, 1, 2, 1); | 44 | LocalDateTime inviteTime = LocalDateTime.of(2019, 1, 26, 1, 2, 1); |
45 | - LocalDateTime settleTime = LocalDateTime.of(2019, 2, 1, 0, 0, 0); | 45 | + LocalDateTime settleTime = LocalDateTime.of(2020, 1, 1, 0, 0, 0); |
46 | List<InviteSettlementItem> items = Lists.newArrayList( | 46 | List<InviteSettlementItem> items = Lists.newArrayList( |
47 | // 2019-05-28 10:31:59 | 47 | // 2019-05-28 10:31:59 |
48 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(), | 48 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(), |
@@ -57,11 +57,43 @@ public class InviteSettlementUtilsTest { | @@ -57,11 +57,43 @@ public class InviteSettlementUtilsTest { | ||
57 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(999)).createTime(1564281119).build(), | 57 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(999)).createTime(1564281119).build(), |
58 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(4000)).createTime(1564281119).build(), | 58 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(4000)).createTime(1564281119).build(), |
59 | // 2019-12-31 10:31:59 | 59 | // 2019-12-31 10:31:59 |
60 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2990000)).createTime(1577759519).build() | ||
61 | + ); | ||
62 | + Pair<BigDecimal, List<InviteSettlementItem>> settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items); | ||
63 | + assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(41999.988)); | ||
64 | + Assert.assertEquals(settleResult.getRight().size(), 0); | ||
65 | + } | ||
66 | + | ||
67 | + @Test | ||
68 | + public void calculateSettleAmountOfType2_1() { | ||
69 | + LocalDateTime inviteTime = LocalDateTime.of(2019, 1, 26, 1, 2, 1); | ||
70 | + LocalDateTime settleTime = LocalDateTime.of(2019, 2, 1, 0, 0, 0); | ||
71 | + List<InviteSettlementItem> items = Lists.newArrayList( | ||
72 | + // 2019-05-28 10:31:59 | ||
73 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(), | ||
74 | + // 2019-06-28 10:31:59 | ||
75 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(1000)).createTime(1561689119).build(), | ||
76 | + // 2019-12-31 10:31:59 | ||
60 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2490000)).createTime(1577759519).build() | 77 | InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2490000)).createTime(1577759519).build() |
61 | ); | 78 | ); |
62 | Pair<BigDecimal, List<InviteSettlementItem>> settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items); | 79 | Pair<BigDecimal, List<InviteSettlementItem>> settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items); |
63 | assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(0)); | 80 | assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(0)); |
64 | Assert.assertEquals(settleResult.getRight().size(), items.size()); | 81 | Assert.assertEquals(settleResult.getRight().size(), items.size()); |
82 | + | ||
83 | + | ||
84 | + items = Lists.newArrayList( | ||
85 | + // 2019-01-28 10:31:59 | ||
86 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1548642719).build(), | ||
87 | + // 2019-05-28 10:31:59 | ||
88 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(500000)).createTime(1559010719).build(), | ||
89 | + // 2019-06-28 10:31:59 | ||
90 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(1000)).createTime(1561689119).build(), | ||
91 | + // 2019-12-31 10:31:59 | ||
92 | + InviteSettlementItem.builder().orderAmount(BigDecimal.valueOf(2490000)).createTime(1577759519).build() | ||
93 | + ); | ||
94 | + settleResult = InviteSettlementUtils.calculateSettleAmountOfType2(inviteTime, settleTime, items); | ||
95 | + assertBigDecimalEquals(settleResult.getLeft(), BigDecimal.valueOf(10000)); | ||
96 | + Assert.assertEquals(settleResult.getRight().size(), items.size() - 1); | ||
65 | } | 97 | } |
66 | 98 | ||
67 | 99 |
-
Please register or login to post a comment