2 Commits

Author SHA1 Message Date
c07e7ec5fd Merge remote-tracking branch 'origin/main' 2026-03-28 18:41:45 +08:00
53ab15a5ca update:
1. fix
2026-03-28 18:41:12 +08:00

View File

@@ -185,9 +185,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
public CreateOrderResponse createMallOrder(CreateMallOrderRequest request) { public CreateOrderResponse createMallOrder(CreateMallOrderRequest request) {
BigDecimal discount = BigDecimal.ZERO; BigDecimal discount = BigDecimal.ZERO;
String orderType = request.getOrderType().toUpperCase(); String orderType = request.getOrderType().toUpperCase();
if (!request.getIsOfflinePayment()) {
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
}
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.SELF_OPERATED_MALL)) { if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.SELF_OPERATED_MALL)) {
throw new ServiceException("无效业务订单"); throw new ServiceException("无效业务订单");
} }
@@ -201,6 +199,9 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode())); MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
Assert.notNull(product, "无效商品"); Assert.notNull(product, "无效商品");
if (!request.getIsOfflinePayment() && product.getRetailPrice().compareTo(BigDecimal.ONE) > 0) {
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
}
CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product); CommonUserOrderEntity order = AppCommonConvert.INSTANCE.convertMallProductToOrder(request, product);
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN); BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
BigDecimal actualAmount = totalAmount.subtract(discount); BigDecimal actualAmount = totalAmount.subtract(discount);
@@ -259,8 +260,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
} }
int selectedCount = travelerIds.size(); int selectedCount = travelerIds.size();
// 使用 Optional 处理数据库中可能为 NULL 的最大/最小人数限制 // 使用 Optional 处理数据库中可能为 NULL 的最大/最小人数限制
int minPeople = Optional.ofNullable(tourProduct.getMinPeople()).orElse(1); int minPeople = Optional.ofNullable(tourProduct.getMinPeople()).orElse(1);
@@ -309,7 +308,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
} }
BigDecimal actualAmount = totalAmount.subtract(discount); BigDecimal actualAmount = totalAmount.subtract(discount);
if (actualAmount.compareTo(BigDecimal.ZERO) < 0) { if (actualAmount.compareTo(BigDecimal.ZERO) < 0) {
actualAmount = BigDecimal.ZERO; // 防止实付金额为负 actualAmount = BigDecimal.ZERO; // 防止实付金额为负
@@ -351,8 +349,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
} }
@Override @Override
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) { public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {
CommonUserOrderEntity entity = new CommonUserOrderEntity(); CommonUserOrderEntity entity = new CommonUserOrderEntity();