From 12ad90cbe812d7542e6529b29a2e6f906f074df0 Mon Sep 17 00:00:00 2001 From: luluyuyu <3305167204@qq.com> Date: Fri, 6 Dec 2024 19:37:23 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/service/impl/OrderServiceImpl.java | 75 ++++++++++--------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java index cbf57c56..269d0d04 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java @@ -140,7 +140,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl List normsIdList = orderItemList.stream().map(OrderItem::getNormsId).collect(Collectors.toList()); List> normsListMap = iShopMaterialNormsService.queryShopMaterialByNormsIdList(Joiner.on(CommonCharConstants.COMMA_MARK).join(normsIdList)); Map normsPriceMap = normsListMap.stream() - .collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString())); + .collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString())); for (OrderItem orderItem : orderItemList) {// 计算每一个子单的总价 if (!normsPriceMap.containsKey(orderItem.getNormsId())) { throw new CustomException("商城不存在normsId: " + orderItem.getNormsId()); @@ -192,7 +192,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl setOrderAndOrderItem(couponUse, order, orderItem);// 操作订单和子单的优惠券 } else if (Objects.equals(couponUse.getProductScope(), PromotionMaterialScope.SPU.getKey())) {// 指定商品 List couponUseMaterialIds = couponUseMaterialService.queryListByCouponIds(Collections.singletonList(couponUseId)) - .stream().map(CouponUseMaterial::getMaterialId).collect(Collectors.toList());// 收集子单商品id + .stream().map(CouponUseMaterial::getMaterialId).collect(Collectors.toList());// 收集子单商品id List newOrderItemList = new ArrayList<>(); for (OrderItem item : orderItemList) {// 筛选出优惠券可用的商品 if (couponUseMaterialIds.contains(item.getMaterialId())) { @@ -283,33 +283,35 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl break; case "2": // 待收货 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.UNDELIVERED.getKey(),// 待发货 - ShopOrderState.DELIVERED.getKey(), // 已发货 - ShopOrderState.TRANSPORTING.getKey()});//运输中 + ShopOrderState.UNDELIVERED.getKey(),// 待发货 + ShopOrderState.DELIVERED.getKey(), // 已发货 + ShopOrderState.TRANSPORTING.getKey()});//运输中 break; case "3":// 已完成 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.SIGN.getKey(), // 已签收 - ShopOrderState.COMPLETED.getKey(), // 已完成 - ShopOrderState.UNEVALUATE.getKey(), // 待评价 - ShopOrderState.EVALUATED.getKey()});// 已评价 + ShopOrderState.SIGN.getKey(), // 已签收 + ShopOrderState.COMPLETED.getKey(), // 已完成 + ShopOrderState.UNEVALUATE.getKey(), // 待评价 + ShopOrderState.EVALUATED.getKey(),// 已评价 + ShopOrderState.PARTIALLYDONE.getKey(),//部分完成 + ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价 break; case "4":// 已取消 stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()}); break; case "5":// 处理中 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.REFUNDING.getKey(), // 退款中 + ShopOrderState.REFUNDING.getKey(), // 退款中 - ShopOrderState.SALESRETURNING.getKey(),//退货中 + ShopOrderState.SALESRETURNING.getKey(),//退货中 - ShopOrderState.EXCHANGEING.getKey()});//换货中 + ShopOrderState.EXCHANGEING.getKey()});//换货中 break; case "6": // 申请记录 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.REFUND.getKey(), // 已退款 - ShopOrderState.SALESRETURNED.getKey(),//已退货 - ShopOrderState.EXCHANGED.getKey()});//已换货 + ShopOrderState.REFUND.getKey(), // 已退款 + ShopOrderState.SALESRETURNED.getKey(),//已退货 + ShopOrderState.EXCHANGED.getKey()});//已换货 } QueryWrapper wrapper = super.getQueryWrapper(commonPageInfo); if (CollectionUtil.isNotEmpty(stateList)) { // 状态列表为空时,则查询全部订单 @@ -346,32 +348,33 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl break; case "2": // 待收货 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.UNDELIVERED.getKey(),// 待发货 - ShopOrderState.DELIVERED.getKey(), // 已发货 - ShopOrderState.TRANSPORTING.getKey()});//运输中 + ShopOrderState.UNDELIVERED.getKey(),// 待发货 + ShopOrderState.DELIVERED.getKey(), // 已发货 + ShopOrderState.TRANSPORTING.getKey()});//运输中 break; case "3":// 已完成 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.SIGN.getKey(), // 已签收 - ShopOrderState.COMPLETED.getKey(), // 已完成 - ShopOrderState.UNEVALUATE.getKey(), // 待评价 - ShopOrderState.EVALUATED.getKey()});// 已评价 - ShopOrderState.PARTIALLYDONE.getKey();//部分完成 + ShopOrderState.SIGN.getKey(), // 已签收 + ShopOrderState.COMPLETED.getKey(), // 已完成 + ShopOrderState.UNEVALUATE.getKey(), // 待评价 + ShopOrderState.EVALUATED.getKey(),// 已评价 + ShopOrderState.PARTIALLYDONE.getKey(),//部分完成 + ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价 break; case "4":// 已取消 stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()}); break; case "5":// 处理中 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.REFUNDING.getKey(), // 退款中 - ShopOrderState.SALESRETURNING.getKey(),//退货中 - ShopOrderState.EXCHANGEING.getKey()});//换货中 + ShopOrderState.REFUNDING.getKey(), // 退款中 + ShopOrderState.SALESRETURNING.getKey(),//退货中 + ShopOrderState.EXCHANGEING.getKey()});//换货中 break; case "6": // 申请记录 stateList = Arrays.asList(new Integer[]{ - ShopOrderState.REFUND.getKey(), // 已退款 - ShopOrderState.SALESRETURNED.getKey(),//已退货 - ShopOrderState.EXCHANGED.getKey()});//已换货 + ShopOrderState.REFUND.getKey(), // 已退款 + ShopOrderState.SALESRETURNED.getKey(),//已退货 + ShopOrderState.EXCHANGED.getKey()});//已换货 } QueryWrapper wrapper = new QueryWrapper<>(); if (CollectionUtil.isNotEmpty(stateList)) { // 状态列表为空时,则查询全部订单 @@ -480,9 +483,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl } // 可取消的订单状态:未提交(0)、已提交(1)、待支付(2)、待发货(5) if (Objects.equals(one.getState(), ShopOrderState.UNSUBMIT.getKey()) || - Objects.equals(one.getState(), ShopOrderState.SUBMIT.getKey()) || - Objects.equals(one.getState(), ShopOrderState.UNPAID.getKey()) || - Objects.equals(one.getState(), ShopOrderState.UNDELIVERED.getKey())) { + Objects.equals(one.getState(), ShopOrderState.SUBMIT.getKey()) || + Objects.equals(one.getState(), ShopOrderState.UNPAID.getKey()) || + Objects.equals(one.getState(), ShopOrderState.UNDELIVERED.getKey())) { updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), ShopOrderState.CANCELED.getKey()); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelType), params.get("cancelType")); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString()); @@ -537,7 +540,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper.set(MybatisPlusUtil.toColumns(Order::getPayTime), payOrderRespDTO.get("successTime").toString()); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getChannelFeeRate), payChannel.get("feeRate").toString()); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getChannelFeePrice), CalculationUtil.multiply( - one.getPayPrice(), payChannel.get("feeRate").toString())); + one.getPayPrice(), payChannel.get("feeRate").toString())); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionId), payOrderRespDTO.get("id").toString()); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getExtensionNo), payOrderRespDTO.get("no").toString()); update(updateWrapper); @@ -594,8 +597,8 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.eq(CommonConstants.ID, orderId); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), ShopOrderState.CANCELED.getKey()) - .set(MybatisPlusUtil.toColumns(Order::getCancelType), ShopOrderCancelType.PAY_TIMEOUT.getKey()) - .set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString()); + .set(MybatisPlusUtil.toColumns(Order::getCancelType), ShopOrderCancelType.PAY_TIMEOUT.getKey()) + .set(MybatisPlusUtil.toColumns(Order::getCancelTime), DateUtil.getTimeAndToString()); update(updateWrapper); refreshCache(orderId); } @@ -608,7 +611,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl orderItemService.UpdateOrderItemState(orderItemId); List orderItemList = orderItemService.queryOrderItemByParentId(orderId); boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState) - .allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO); + .allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO); if (allTwo) { Integer partiallydoneKey = ShopOrderState.COMPLETED.getKey(); updateOrderState(orderId, partiallydoneKey);