diff --git a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java index 0d19481b..35ab2d69 100644 --- a/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java +++ b/nflg-mobilebroken-common/src/main/java/com/nflg/mobilebroken/common/pojo/request/ModelConfigSearchRequest.java @@ -28,6 +28,6 @@ public class ModelConfigSearchRequest extends PageRequest { */ private Long typeNumber; - @JsonIgnore - private Long planId; +// @JsonIgnore +// private Long planId; } diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java index ed462d89..f15adc9c 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/admin/PriceConfigController.java @@ -130,6 +130,8 @@ public class PriceConfigController extends ControllerBase { md.put("children", new ArrayList<>()); vo.getChildren().forEach(item -> convert(md, item)); } + //是否可以配置价格 + md.put("enable", CollectionUtil.isEmpty(vo.getChildren())); } /** diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java index 94d6f199..d298da88 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/controller/app/PlanController.java @@ -154,9 +154,9 @@ public class PlanController extends ControllerBase { .eq(QuotationUserPlanModel::getCreateById, AppUserUtil.getUserId()) .one(); vo.setInfo(Convert.convert(QuotationModelRatioVO.class, plan)); - if (Objects.nonNull(plan)) { - request.setPlanId(plan.getId()); - } +// if (Objects.nonNull(plan)) { +// request.setPlanId(plan.getId()); +// } List items = planModelItemService.search(request, AppUserUtil.isAgent() ? 1 : 0, AppUserUtil.getUserId()); int index = 0, startIndex = (request.getPage() - 1) * request.getPageSize(), endIndex = request.getPage() * request.getPageSize(); PageData pageData = new PageData<>(); 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 ea60d269..8ca68098 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 @@ -514,15 +514,15 @@ public class ShoppingController extends ControllerBase { List children = parts.stream() .filter(pi -> pi.getParentId().equals(part.getId())) .collect(Collectors.toList()); - vi.setAmount( - vi.getAmount().add( - children.stream() - .map(ModelConfigEffectiveDTO::getAmount) - .filter(Objects::nonNull) - .reduce(BigDecimal::add) - .orElse(BigDecimal.ZERO) - ) - ); + if (CollectionUtil.isNotEmpty(children)) { + vi.setAmount( + children.stream() + .map(ModelConfigEffectiveDTO::getAmount) + .filter(Objects::nonNull) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO) + ); + } vi.setChildren( children.stream() .map(pi -> { @@ -816,15 +816,15 @@ public class ShoppingController extends ControllerBase { List children = parts.stream() .filter(pi -> pi.getParentId().equals(part.getId())) .collect(Collectors.toList()); - vi.setAmount( - vi.getAmount().add( - children.stream() - .filter(pi -> pi.getType() == 0) - .map(ModelConfigEffectiveDTO::getAmount) - .reduce(BigDecimal::add) - .orElse(BigDecimal.ZERO) - ) - ); + if (CollectionUtil.isNotEmpty(children)) { + vi.setAmount( + children.stream() + .filter(pi -> pi.getType() == 0) + .map(ModelConfigEffectiveDTO::getAmount) + .reduce(BigDecimal::add) + .orElse(BigDecimal.ZERO) + ); + } vi.setChildren( children.stream() .map(pi -> convert(pi, BigDecimal.ONE)) @@ -1072,15 +1072,29 @@ public class ShoppingController extends ControllerBase { .setOldFee(item.getOldStandardFee()) .setNewFee(item.getNewStandardFee()) ); - if (CollectionUtil.isNotEmpty(item.getParts())) { + if (CollectionUtil.isNotEmpty(item.getOptionalParts())) { cart.setOptionalFee(cart.getOptionalFee() - .add(item.getParts() + .add(item.getOptionalParts() .stream() .map(QuotationPriceUpdateItemPartRequest::getSpread) .reduce(BigDecimal.ZERO, BigDecimal::add) ) ); - item.getParts().forEach(part -> { + List optionalParts = shoppingCartItemService.lambdaQuery() + .eq(QuotationShoppingCartItem::getCartId, item.getCartId()) + .in(QuotationShoppingCartItem::getConfigItemId, item.getOptionalParts() + .stream() + .map(QuotationPriceUpdateItemPartRequest::getConfigItemId) + .collect(Collectors.toList()) + ) + .list(); + item.getOptionalParts().forEach(part -> { + QuotationShoppingCartItem optionalPart = optionalParts.stream() + .filter(p -> Objects.equals(p.getConfigItemId(), part.getConfigItemId())) + .findFirst() + .get(); + optionalPart.setAmount(part.getNewStandardFee()); + optionalPart.setDiscount(part.getSpread()); adjustItems.add( new QuotationShoppingOrderAdjustItem() .setAdjustId(adjust.getId()) @@ -1091,10 +1105,16 @@ public class ShoppingController extends ControllerBase { .setNewFee(part.getNewStandardFee()) ); }); + if (CollectionUtil.isNotEmpty(optionalParts)) { + shoppingCartItemService.updateBatchById(optionalParts); + } } }); shoppingOrderAdjustItemService.saveBatch(adjustItems); shoppingOrderAdjustService.save(adjust); + if (CollectionUtil.isNotEmpty(carts)) { + shoppingCartService.updateBatchById(carts); + } } shoppingOrderService.lambdaUpdate() .set(Objects.nonNull(request.getActualFee()), QuotationShoppingOrder::getActualFee, request.getActualFee()) diff --git a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/request/QuotationPriceUpdateItemRequest.java b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/request/QuotationPriceUpdateItemRequest.java index 496acea0..561402ca 100644 --- a/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/request/QuotationPriceUpdateItemRequest.java +++ b/nflg-mobilebroken-quotation/src/main/java/com/nflg/mobilebroken/quotation/pojo/request/QuotationPriceUpdateItemRequest.java @@ -32,5 +32,5 @@ public class QuotationPriceUpdateItemRequest { * 选配调价 */ @Valid - List parts; + List optionalParts; } diff --git a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationUserPlanModelItemMapper.xml b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationUserPlanModelItemMapper.xml index 783426a6..ef57007c 100644 --- a/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationUserPlanModelItemMapper.xml +++ b/nflg-mobilebroken-repository/src/main/resources/mapper/QuotationUserPlanModelItemMapper.xml @@ -10,16 +10,12 @@