|
@@ -715,10 +715,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
for (OrderGoods goods : goodsList) {
|
|
for (OrderGoods goods : goodsList) {
|
|
|
PayScoreCreateRequest.PostPayment payment = new PayScoreCreateRequest.PostPayment();
|
|
PayScoreCreateRequest.PostPayment payment = new PayScoreCreateRequest.PostPayment();
|
|
|
payment.setName("商品信息");
|
|
payment.setName("商品信息");
|
|
|
- payment.setAmount(goods.getPrice() != null ? goods.getPrice()
|
|
|
|
|
- : (goods.getMoney() != null ? goods.getMoney() : BigDecimal.ZERO));
|
|
|
|
|
|
|
+ // amount 为行总金额(单价 × 数量),微信校验: total_amount = sum(post_payments[].amount)
|
|
|
|
|
+ BigDecimal unitPrice = goods.getPrice() != null ? goods.getPrice()
|
|
|
|
|
+ : (goods.getMoney() != null ? goods.getMoney() : BigDecimal.ZERO);
|
|
|
|
|
+ int quantity = goods.getProductNum() != null ? goods.getProductNum() : 1;
|
|
|
|
|
+ payment.setAmount(unitPrice.multiply(BigDecimal.valueOf(quantity)));
|
|
|
payment.setDescription(goods.getProductName() != null ? goods.getProductName() : "未知商品");
|
|
payment.setDescription(goods.getProductName() != null ? goods.getProductName() : "未知商品");
|
|
|
- payment.setCount(goods.getProductNum() != null ? goods.getProductNum() : 1);
|
|
|
|
|
|
|
+ payment.setCount(1);
|
|
|
payments.add(payment);
|
|
payments.add(payment);
|
|
|
}
|
|
}
|
|
|
|
|
|