update:
1. fix
This commit is contained in:
@@ -185,9 +185,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
public CreateOrderResponse createMallOrder(CreateMallOrderRequest request) {
|
||||
BigDecimal discount = BigDecimal.ZERO;
|
||||
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)) {
|
||||
throw new ServiceException("无效业务订单");
|
||||
}
|
||||
@@ -201,6 +199,9 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
|
||||
MallProductEntity product = productService.getById(Long.valueOf(request.getItemCode()));
|
||||
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);
|
||||
BigDecimal totalAmount = product.getRetailPrice().multiply(BigDecimal.valueOf(request.getQuantity())).setScale(2, RoundingMode.DOWN);
|
||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||
@@ -259,8 +260,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int selectedCount = travelerIds.size();
|
||||
// 使用 Optional 处理数据库中可能为 NULL 的最大/最小人数限制
|
||||
int minPeople = Optional.ofNullable(tourProduct.getMinPeople()).orElse(1);
|
||||
@@ -309,7 +308,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
BigDecimal actualAmount = totalAmount.subtract(discount);
|
||||
if (actualAmount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
actualAmount = BigDecimal.ZERO; // 防止实付金额为负
|
||||
@@ -351,8 +349,6 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<CommonUserOrderApiVO> selectOrderApiPage(IPage<CommonUserOrderApiVO> page, CommonUserOrderApiVO userOrder) {
|
||||
CommonUserOrderEntity entity = new CommonUserOrderEntity();
|
||||
|
||||
Reference in New Issue
Block a user