From f1b072d6c3ccc616afd049c1cb776b9f2aefdf7e Mon Sep 17 00:00:00 2001 From: Cauchy Date: Wed, 18 Oct 2023 16:59:07 +0800 Subject: [PATCH] bug fix --- .../book/controller/BuyOrderController.java | 9 ++++ .../modules/book/service/BuyOrderService.java | 4 ++ .../service/impl/BuyOrderServiceImpl.java | 47 +++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index 2bd36b8e..30e28193 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -199,6 +199,15 @@ public class BuyOrderController { return R.ok().put("result", expressFee); } + /** + * 列表 + */ + @RequestMapping("/getMyOrderList") + public R getMyOrderList(@RequestParam Map params) { + PageUtils page = buyOrderService.queryPage1(params); + return R.ok().put("page", page); + } + /** * 修改 diff --git a/src/main/java/com/peanut/modules/book/service/BuyOrderService.java b/src/main/java/com/peanut/modules/book/service/BuyOrderService.java index f5c05a0c..2d6e16b7 100644 --- a/src/main/java/com/peanut/modules/book/service/BuyOrderService.java +++ b/src/main/java/com/peanut/modules/book/service/BuyOrderService.java @@ -19,6 +19,8 @@ public interface BuyOrderService extends IService { PageUtils queryPage(Map params) throws Exception; + PageUtils queryPage1(Map params); + //更新订单状态 void updateOrderStatus(Integer userId, String orderSn, String type); @@ -35,4 +37,6 @@ public interface BuyOrderService extends IService { * @param buyOrderDetailId 订单详情 ID 列表 */ void createSplitPackageOrder(String expressCompanyCode, List buyOrderDetailId); + + } \ No newline at end of file diff --git a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java index b0902570..9ada1dcd 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java @@ -14,6 +14,7 @@ import com.peanut.modules.book.service.*; import com.peanut.modules.book.entity.ExpressCommodity; import com.peanut.modules.book.vo.ExpressOrderResponseVo; import com.peanut.modules.book.vo.UserOrderVo; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -43,6 +44,9 @@ public class BuyOrderServiceImpl extends ServiceImpl impl @Autowired CountyService countyService; + @Autowired + ShopProductService shopProductService; + protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class); @@ -96,6 +100,49 @@ public class BuyOrderServiceImpl extends ServiceImpl impl return new PageUtils(page); } + @Override + public PageUtils queryPage1(Map params) { + + String orderStatus = (String) params.get("orderStatus"); + if (orderStatus.equals("9")) { + orderStatus = null; + } + + String userId = (String) params.get("userId"); + + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + .eq("user_id", userId) + .eq(StringUtils.isNotBlank(orderStatus), "order_status", orderStatus) + .orderByDesc("create_time") + ); + List records = page.getRecords(); + for (BuyOrder buyOrderEntity : records) { + Integer orderId = buyOrderEntity.getOrderId(); + buyOrderEntity.setTimestamp(buyOrderEntity.getCreateTime().getTime() / 1000); + List entities = buyOrderDetailService.getBaseMapper().selectList(new QueryWrapper() + .eq("order_id", orderId)); + if (entities != null) { + for (BuyOrderDetail entity : entities) { + Integer productId = entity.getProductId(); + ShopProductEntity shopPro = shopProductService.getById(productId); + if (shopPro != null) { + String productImages = shopPro.getProductImages(); + + entity.setImage(productImages); + } + + + } + } + + buyOrderEntity.setProducts(entities); + } + + return new PageUtils(page); + } + @Override public void updateOrderStatus(Integer userId, String orderSn, String type) {