1. fix
This commit is contained in:
2026-03-28 18:41:12 +08:00
parent 66f6967b09
commit 53ab15a5ca

View File

@@ -141,14 +141,14 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
}
@Override
public List<CommonUserOrderVO> exportUserMallOrderToExcel(Integer orderStatus, String account ,Date startDate, Date endDate) {
public List<CommonUserOrderVO> exportUserMallOrderToExcel(Integer orderStatus, String account, Date startDate, Date endDate) {
Long countItem = baseMapper.countOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.SELF_OPERATED_MALL.getCode());
if (countItem > 10000) {
throw new ServiceException("导出数据量过大,超过" + 10000 + "条数据,请缩小范围导出");
}
return baseMapper.selectOrderExcelList(orderStatus, account ,startDate, endDate ,BusinessModule.SELF_OPERATED_MALL.getCode());
return baseMapper.selectOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.SELF_OPERATED_MALL.getCode());
}
@Override
@@ -158,7 +158,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
throw new ServiceException("导出数据量过大,超过" + 10000 + "条数据,请缩小范围导出");
}
return baseMapper.selectOrderExcelList(orderStatus, account ,startDate, endDate ,BusinessModule.ECOSYSTEM_PRODUCT.getCode());
return baseMapper.selectOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.ECOSYSTEM_PRODUCT.getCode());
}
@Override
@@ -168,7 +168,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
throw new ServiceException("导出数据量过大,超过" + 10000 + "条数据,请缩小范围导出");
}
return baseMapper.selectOrderExcelList(orderStatus, account ,startDate, endDate ,BusinessModule.TRAVEL_GROUP.getCode());
return baseMapper.selectOrderExcelList(orderStatus, account, startDate, endDate, BusinessModule.TRAVEL_GROUP.getCode());
}
@@ -185,22 +185,23 @@ 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)){
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.SELF_OPERATED_MALL)) {
throw new ServiceException("无效业务订单");
}
if (request.getConsigneePhone() == null){
if (request.getConsigneePhone() == null) {
throw new ServiceException("请填写联系电话");
}
if (request.getConsignee() == null){
if (request.getConsignee() == null) {
throw new ServiceException("请填写联系人");
}
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);
@@ -232,11 +233,11 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
throw new ServiceException("商品ID格式非法");
}
if (request.getPaymentType() != 1 && request.getPaymentType() != 2){
if (request.getPaymentType() != 1 && request.getPaymentType() != 2) {
throw new ServiceException("请选择正确的支付方式");
}
if (!BusinessModule.fromCodeIgnoreCaseOrNull(request.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)){
if (!BusinessModule.fromCodeIgnoreCaseOrNull(request.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)) {
throw new ServiceException("无效业务订单");
}
@@ -245,11 +246,11 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
throw new ServiceException("请至少选择一名出行人");
}
if (request.getTourStartDate() == null || request.getTourEndDate() == null){
if (request.getTourStartDate() == null || request.getTourEndDate() == null) {
throw new ServiceException("请选择出行时间");
}
if (request.getTourStartDate().getTime() >= request.getTourEndDate().getTime()){
if (request.getTourStartDate().getTime() >= request.getTourEndDate().getTime()) {
throw new ServiceException("开始时间不能大于结束时间");
}
@@ -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();
@@ -453,7 +449,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
if (order == null) {
throw new ServiceException("无效订单");
}
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.SELF_OPERATED_MALL)){
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.SELF_OPERATED_MALL)) {
throw new ServiceException("无效业务订单");
}
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
@@ -498,14 +494,14 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
if (!request.getIsOfflinePayment()) {
discount = BigDecimal.valueOf(new Random().nextInt(99) + 1, 2);
}
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.ECOSYSTEM_PRODUCT)){
if (!BusinessModule.fromCodeIgnoreCaseOrNull(orderType).equals(BusinessModule.ECOSYSTEM_PRODUCT)) {
throw new ServiceException("无效业务订单");
}
if (request.getConsigneePhone() == null){
if (request.getConsigneePhone() == null) {
throw new ServiceException("请填写联系电话");
}
if (request.getConsignee() == null){
if (request.getConsignee() == null) {
throw new ServiceException("请填写联系人");
}
@@ -531,7 +527,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
if (order == null) {
throw new ServiceException("无效订单");
}
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.ECOSYSTEM_PRODUCT)){
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.ECOSYSTEM_PRODUCT)) {
throw new ServiceException("无效业务订单");
}
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()
@@ -553,7 +549,7 @@ public class CommonUserOrderServiceImpl extends ServiceImpl<CommonUserOrderMappe
if (order == null) {
throw new ServiceException("无效订单");
}
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)){
if (!BusinessModule.fromCodeIgnoreCaseOrNull(order.getOrderType()).equals(BusinessModule.TRAVEL_GROUP)) {
throw new ServiceException("无效业务订单");
}
boolean updated = update(Wrappers.<CommonUserOrderEntity>lambdaUpdate()