霸王餐日志打印 默认原价 打包费问题

This commit is contained in:
wangw 2025-03-25 17:56:06 +08:00
parent 79a77286c8
commit 9137f8e0a5
3 changed files with 10 additions and 2 deletions

View File

@ -30,6 +30,8 @@ public class VipPayParamDTO {
*/
private Integer userAllPack;
private Integer seatNum;
//会员价
private Integer vipPrice;
@NotNull(message = "充值金额不为空")
private BigDecimal amount;

View File

@ -460,6 +460,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
public void processOrderDetails2(List<OrderDetail> orderDetails, Map<Long, Integer> prodCouponMap,
BigDecimalDTO prodCouponAmount, BigDecimalDTO totalAmount, BigDecimalDTO packAmount,
boolean isAllPack, Integer userAllPack, boolean isVipPrice) {
log.info("霸王餐入参2 userAllPack{}", userAllPack);
Map<Long, List<OrderDetail>> detailMap = new HashMap<>();
for (OrderDetail detail : orderDetails) {
detailMap.computeIfAbsent(detail.getProductId(), k -> new ArrayList<>()).add(detail);

View File

@ -147,15 +147,17 @@ 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(), payParam.getUserAllPack(), true);
log.info("霸王餐入参:{}", JSON.toJSONString(payParam));
orderInfoService.processOrderDetails2(orderDetails, null, null, totalAmount, packAmount, payParam.isAllPack(), payParam.getUserAllPack(), false);
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())).setScale(2, RoundingMode.HALF_UP);
log.info("霸王餐应支付金额:{},充值金额为:{}", payAmount, payParam.getAmount());
if (payAmount.compareTo(payParam.getAmount()) != 0) {
log.info("霸王餐应支付金额:{} 其中 打包费{} 餐位费{},充值金额为:{}",
payAmount, packAmount.getPrice(), orderInfo.getSeatAmount(), payParam.getAmount());
throw new ValidateException("霸王餐支付金额不正确");
}
orderDetailService.updateBatch(orderDetails);
@ -542,6 +544,9 @@ public class PayServiceImpl implements PayService {
@Transactional
public CzgResult<Object> refundOrderBefore(OrderInfoRefundDTO param) {
OrderInfo orderInfo = orderInfoService.getById(param.getOrderId());
if (orderInfo.getStatus().equals(OrderStatusEnums.CANCELLED.getCode())) {
throw new CzgException("订单已过期不可退单");
}
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
Map<String, BigDecimal> returnProMap = new HashMap<>();
boolean isPay = true;