update 计算解冻金额逻辑

This commit is contained in:
2023-08-31 18:35:16 +08:00
parent 083f078069
commit 02929edd8b
3 changed files with 107 additions and 48 deletions

View File

@@ -374,37 +374,37 @@ public class SpringBootTestController {
*/
@Test
public void calculateUnfreezeAmountTest() {
BigDecimal orderAmount = new BigDecimal("28");
BigDecimal orderAmount = new BigDecimal("0.99");
List<OrderPayRecord> payRecordList = Lists.newArrayList();
// 第一笔支付记录
JSONObject jsonObject = new JSONObject();
jsonObject.put("paymentId", "1");
jsonObject.put("amount", "10");
jsonObject.put("paymentId", "002212023083114213410543206907226374144");
jsonObject.put("amount", "0.98");
OrderPayRecord build = OrderPayRecord.builder()
.payAmount(new BigDecimal("10"))
.payAmount(new BigDecimal("0.98"))
.deductionRecord(jsonObject.toJSONString())
.build();
payRecordList.add(build);
// 第二笔支付记录
JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("paymentId", "2");
jsonObject2.put("amount", "10");
jsonObject2.put("paymentId", "002212023083114410510543211818773135360");
jsonObject2.put("amount", "1.00");
OrderPayRecord build2 = OrderPayRecord.builder()
.payAmount(new BigDecimal("10"))
.payAmount(new BigDecimal("1.00"))
.deductionRecord(jsonObject2.toJSONString())
.build();
payRecordList.add(build2);
// 第三笔支付记录
JSONObject jsonObject3 = new JSONObject();
jsonObject3.put("paymentId", "3");
jsonObject3.put("amount", "10");
OrderPayRecord build3 = OrderPayRecord.builder()
.payAmount(new BigDecimal("10"))
.deductionRecord(jsonObject3.toJSONString())
.build();
payRecordList.add(build3);
// JSONObject jsonObject3 = new JSONObject();
// jsonObject3.put("paymentId", "3");
// jsonObject3.put("amount", "10");
// OrderPayRecord build3 = OrderPayRecord.builder()
// .payAmount(new BigDecimal("10"))
// .deductionRecord(jsonObject3.toJSONString())
// .build();
// payRecordList.add(build3);
List<Map<String, Object>> maps = orderBasicInfoService.calculateUnfreezeAmount(orderAmount, payRecordList);
System.out.println(maps);
}