From d2ea1553a527d8e913f5838c2eaee3a8c958ce6e Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 24 May 2024 17:24:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/order/OrderCreateService.java | 3 ++ .../order/impl/BsOrderChildServiceImpl.java | 34 +++++++++++-------- .../order/impl/BsOrderServiceImpl.java | 3 +- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 2a19a0c..b8398d9 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -99,6 +99,9 @@ public class OrderCreateService { if (goodsVpd == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商品虚拟规格"); } + // 虚拟配置 + orderChild.setBusiness(goodsVpd); + // 创建卡券订单 BsOrderCoupon orderCoupon = new BsOrderCoupon(); orderCoupon.setOrderNo(orderChild.getOrderNo()); diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java index 35951a7..f73ba07 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderChildServiceImpl.java @@ -10,7 +10,9 @@ import com.hfkj.entity.GoodsUserAddress; import com.hfkj.model.order.OrderChildModel; import com.hfkj.service.goods.BsOrderGoodsService; import com.hfkj.service.goods.GoodsUserAddressService; +import com.hfkj.service.goods.GoodsVpdService; import com.hfkj.service.order.BsOrderChildService; +import com.hfkj.sysenum.order.OrderChildProductTypeEnum; import com.hfkj.sysenum.order.OrderChildStatusEnum; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -36,6 +38,8 @@ public class BsOrderChildServiceImpl implements BsOrderChildService { @Resource private BsOrderGoodsService orderGoodsService; + @Resource + private GoodsVpdService goodsVpdService; @Override public void editData(BsOrderChild data) { @@ -75,23 +79,25 @@ public class BsOrderChildServiceImpl implements BsOrderChildService { OrderChildModel childModel = new OrderChildModel(); BeanUtils.copyProperties(orderChild, childModel); - BsOrderGoods orderGoods = orderGoodsService.findGoodsOrder(orderNo); + if (childModel.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { + BsOrderGoods orderGoods = orderGoodsService.findGoodsOrder(orderNo); + if (orderGoods != null) { + GoodsUserAddress address = goodsUserAddressService.queryDetail(orderGoods.getDeliveryAddressId()); + JSONObject object; + if (childModel.getBusiness() == null) { + object = new JSONObject(); + } else { + object = new JSONObject((Map) childModel.getBusiness()); + } + + object.put("address", address); + object.put("orderGoodsId", orderGoods.getId()); + childModel.setBusiness(object); - if (orderGoods != null) { - GoodsUserAddress address = goodsUserAddressService.queryDetail(orderGoods.getDeliveryAddressId()); - JSONObject object; - if (childModel.getBusiness() == null) { - object = new JSONObject(); - } else { - object = new JSONObject((Map) childModel.getBusiness()); } - - object.put("address", address); - object.put("orderGoodsId", orderGoods.getId()); - childModel.setBusiness(object); - + } else if (childModel.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) { + childModel.setBusiness(goodsVpdService.queryDetailBySpecsId(childModel.getProductSpecId())); } - orderChildModelList.add(childModel); } return orderChildModelList; diff --git a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java index 9131539..6472b5f 100644 --- a/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java @@ -458,10 +458,9 @@ public class BsOrderServiceImpl implements BsOrderService { // todo 1.0阶段暂时需要返回收货地址使用 for (OrderChildModel orderChild : orderModel.getOrderChildList()) { - if (orderChild.getProductType() == 1) { + if (orderChild.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) { orderModel.setBusiness(orderChild.getBusiness()); } - } // 更新缓存