From d751e6dbd30d60b7eda29d9ce9a19d119a30ff6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 15 May 2026 14:00:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(shopping):=20=E6=96=B0=E5=A2=9E=E8=B4=AD?= =?UTF-8?q?=E7=89=A9=E8=BD=A6=E5=85=B6=E4=BB=96=E8=A6=81=E6=B1=82=E5=8F=8A?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BA=A4=E4=BB=98=E6=96=B9=E5=BC=8F=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在ShoppingCartVO中添加others字段以支持其他要求数据 - ShoppingController注入shoppingOrderDeliveryMethodService资源 - 购物车获取报价主体接口增加others数据加载 - 下单接口改用Convert转换request为QuotationShoppingOrder对象 - 设置订单编号、用户及时间信息,计算总费用及实际费用 - 保存订单项及新增订单交付方式批量保存逻辑 - 兼容无交付方式情况下的订单处理流程 --- .../controller/app/ShoppingController.java | 44 +++++++++++++------ .../quotation/pojo/vo/ShoppingCartVO.java | 6 +++ 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java index 64af4f79..959e8883 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/ShoppingController.java @@ -140,6 +140,9 @@ public class ShoppingController extends ControllerBase { @Resource private ITBaseDepartmentService departmentService; + @Resource + private IQuotationShoppingOrderDeliveryMethodService shoppingOrderDeliveryMethodService; + /** * 购物车-获取报价主体 */ @@ -498,6 +501,10 @@ public class ShoppingController extends ControllerBase { .eq(QuotationShoppingCartService::getCartId, cart.getId()) .list() ); + vo.setOthers(shoppingCartOtherService.lambdaQuery() + .eq(QuotationShoppingCartOther::getCartId, cart.getId()) + .list() + ); return ApiResult.success(vo); } @@ -554,18 +561,19 @@ public class ShoppingController extends ControllerBase { .throwMessage("客户名称不一致"); VUtils.trueThrowBusinessError(carts.stream().map(QuotationShoppingCart::getTargetId).collect(Collectors.toSet()).size() > 1) .throwMessage("报价主体不一致"); - QuotationShoppingOrder order = new QuotationShoppingOrder() - .setCreateByType(AppUserUtil.isAgent() ? 1 : 0) - .setCreateBy(AppUserUtil.getUserName()) - .setCreateById(AppUserUtil.getUserId()) - .setCreateTime(LocalDateTime.now()) - .setId(IdUtil.getId()) - .setCustomerName(carts.get(0).getCustomerName()) - .setEffectiveStartTime(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd")) - .setEffectiveEndTime(DateTimeUtil.format(LocalDate.now().plusMonths(1), "yyyy-MM-dd")) - .setQuotationCode(getQuotationCode()) - .setTargetId(carts.get(0).getTargetId()) - .setTotalFee(carts.stream().map(QuotationShoppingCart::getActualFee).reduce(BigDecimal::add).get()); + QuotationShoppingOrder order = Convert.convert(QuotationShoppingOrder.class, request); + order.setId(IdUtil.getId()); + order.setNo(genOrderNo()); + order.setCreateByType(AppUserUtil.isAgent() ? 1 : 0); + order.setCreateBy(AppUserUtil.getUserName()); + order.setCreateById(AppUserUtil.getUserId()); + order.setCreateTime(LocalDateTime.now()); + order.setCustomerName(carts.get(0).getCustomerName()); + order.setEffectiveStartTime(DateTimeUtil.format(LocalDate.now(), "yyyy-MM-dd")); + order.setEffectiveEndTime(DateTimeUtil.format(LocalDate.now().plusMonths(1), "yyyy-MM-dd")); + order.setQuotationCode(getQuotationCode()); + order.setTargetId(carts.get(0).getTargetId()); + order.setTotalFee(carts.stream().map(QuotationShoppingCart::getActualFee).reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); order.setActualFee(order.getTotalFee()); order.setExchangeFee(NumberUtil.multiply(order.getActualFee(), request.getExchangeRate())); shoppingOrderItemService.saveBatch( @@ -575,7 +583,17 @@ public class ShoppingController extends ControllerBase { .setCartId(cart.getId())) .collect(Collectors.toList()) ); - order.setNo(genOrderNo()); + if (CollectionUtil.isNotEmpty(request.getDeliveryMethods())) { + shoppingOrderDeliveryMethodService.saveBatch( + request.getDeliveryMethods().stream() + .map(deliveryMethod -> { + QuotationShoppingOrderDeliveryMethod dm = Convert.convert(QuotationShoppingOrderDeliveryMethod.class, deliveryMethod); + dm.setOrderId(order.getId()); + return dm; + }) + .collect(Collectors.toList()) + ); + } shoppingOrderService.save(order); shoppingCartService.lambdaUpdate() .set(QuotationShoppingCart::getStatus, 1) diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java index 27785c39..38324387 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/vo/ShoppingCartVO.java @@ -1,6 +1,7 @@ package com.nflg.mobilebroken.quotation.pojo.vo; import com.nflg.mobilebroken.repository.entity.QuotationShoppingCartAccessory; +import com.nflg.mobilebroken.repository.entity.QuotationShoppingCartOther; import com.nflg.mobilebroken.repository.entity.QuotationShoppingCartService; import lombok.Data; import lombok.experimental.Accessors; @@ -209,4 +210,9 @@ public class ShoppingCartVO { * 交机服务 */ private List services; + + /** + * 其他要求 + */ + private List others; }