霸王餐

This commit is contained in:
wangw 2025-03-25 17:35:27 +08:00
parent ae3b7f8270
commit 79a77286c8
1 changed files with 4 additions and 2 deletions

View File

@ -53,6 +53,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
@ -146,12 +147,13 @@ public class PayServiceImpl implements PayService {
BigDecimalDTO totalAmount = new BigDecimalDTO(BigDecimal.ZERO);
//最终打包费
BigDecimalDTO packAmount = new BigDecimalDTO(BigDecimal.ZERO);
orderInfoService.processOrderDetails2(orderDetails, null, null, totalAmount, packAmount, payParam.isAllPack(), null, true);
orderInfoService.processOrderDetails2(orderDetails, null, null, totalAmount, packAmount, payParam.isAllPack(), payParam.getUserAllPack(), true);
BigDecimal total = totalAmount.getPrice().add(packAmount.getPrice());
if (total.compareTo(freeConfig.getRechargeThreshold()) < 0) {
throw new CzgException("霸王餐满" + freeConfig.getRechargeThreshold() + "可用,当前订单金额为" + total);
}
BigDecimal payAmount = (totalAmount.getPrice().add(packAmount.getPrice()).add(orderInfo.getSeatAmount())).multiply(new BigDecimal(freeConfig.getMultiple()));
BigDecimal payAmount = (totalAmount.getPrice().add(packAmount.getPrice()).add(orderInfo.getSeatAmount()))
.multiply(new BigDecimal(freeConfig.getMultiple())).setScale(2, RoundingMode.HALF_UP);
log.info("霸王餐应支付金额:{},充值金额为:{}", payAmount, payParam.getAmount());
if (payAmount.compareTo(payParam.getAmount()) != 0) {
throw new ValidateException("霸王餐支付金额不正确");